summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-02-03 18:41:18 -0800
committerIgor Babaev <igor@askmonty.org>2019-02-03 18:41:18 -0800
commit37deed3f37561f264f65e162146bbc2ad35fb1a2 (patch)
treec1cfb6c0995bfcc4ac3fb335f518a8b404413e32
parent658128af43b4d7c6db445164f8ed25ed4d1e3109 (diff)
parent5b996782be6b752ce50a0ecaa222b0688aa9e75d (diff)
downloadmariadb-git-37deed3f37561f264f65e162146bbc2ad35fb1a2.tar.gz
Merge branch '10.4' into bb-10.4-mdev16188
-rw-r--r--.gitignore3
-rw-r--r--.gitmodules4
-rwxr-xr-x.travis.compiler.sh13
-rw-r--r--.travis.yml65
-rwxr-xr-xBUILD/SETUP.sh5
-rw-r--r--CMakeLists.txt6
-rw-r--r--CONTRIBUTING.md47
-rw-r--r--Docs/INSTALL-BINARY24
-rw-r--r--Docs/README-wsrep50
-rw-r--r--Docs/glibc-2.2.5.patch137
-rw-r--r--Docs/linuxthreads.txt19
-rw-r--r--Docs/sp-imp-spec.txt1100
-rw-r--r--KNOWN_BUGS.txt38
-rw-r--r--README.md30
-rw-r--r--VERSION4
-rw-r--r--appveyor.yml4
-rw-r--r--client/CMakeLists.txt2
-rw-r--r--client/mysql.cc10
-rw-r--r--client/mysql_upgrade.c10
-rw-r--r--client/mysqladmin.cc2
-rw-r--r--client/mysqlbinlog.cc16
-rw-r--r--client/mysqldump.c12
-rw-r--r--client/mysqlimport.c5
-rw-r--r--client/mysqlshow.c4
-rw-r--r--client/mysqlslap.c2
-rw-r--r--client/mysqltest.cc50
-rw-r--r--cmake/configure.pl15
-rw-r--r--cmake/cpack_rpm.cmake4
-rw-r--r--cmake/make_dist.cmake.in8
-rw-r--r--cmake/mariadb_connector_c.cmake5
-rw-r--r--cmake/os/WindowsCache.cmake1
-rw-r--r--cmake/submodules.cmake6
-rw-r--r--cmake/wsrep.cmake15
-rw-r--r--cmake/zlib.cmake5
-rw-r--r--config.h.cmake1
-rw-r--r--configure.cmake1
-rwxr-xr-xdebian/additions/debian-start2
-rwxr-xr-xdebian/additions/debian-start.inc.sh2
-rwxr-xr-xdebian/autobake-deb.sh8
-rw-r--r--debian/control6
-rw-r--r--debian/mariadb-server-10.4.install5
-rw-r--r--debian/mariadb-server-10.4.postinst60
-rwxr-xr-xdebian/rules5
-rw-r--r--extra/innochecksum.cc40
-rw-r--r--extra/mariabackup/CMakeLists.txt29
-rw-r--r--extra/mariabackup/backup_copy.cc136
-rw-r--r--extra/mariabackup/backup_mysql.cc217
-rw-r--r--extra/mariabackup/changed_page_bitmap.cc26
-rw-r--r--extra/mariabackup/common.h71
-rw-r--r--extra/mariabackup/datasink.cc (renamed from extra/mariabackup/datasink.c)11
-rw-r--r--extra/mariabackup/ds_archive.cc (renamed from extra/mariabackup/ds_archive.c)0
-rw-r--r--extra/mariabackup/ds_buffer.cc (renamed from extra/mariabackup/ds_buffer.c)4
-rw-r--r--extra/mariabackup/ds_compress.cc (renamed from extra/mariabackup/ds_compress.c)8
-rw-r--r--extra/mariabackup/ds_local.cc1
-rw-r--r--extra/mariabackup/ds_stdout.cc (renamed from extra/mariabackup/ds_stdout.c)2
-rw-r--r--extra/mariabackup/ds_tmpfile.cc (renamed from extra/mariabackup/ds_tmpfile.c)22
-rw-r--r--extra/mariabackup/ds_xbstream.cc (renamed from extra/mariabackup/ds_xbstream.c)12
-rw-r--r--extra/mariabackup/encryption_plugin.cc9
-rw-r--r--extra/mariabackup/fil_cur.cc229
-rw-r--r--extra/mariabackup/innobackupex.cc2
-rw-r--r--extra/mariabackup/write_filt.cc11
-rw-r--r--extra/mariabackup/wsrep.cc7
-rw-r--r--extra/mariabackup/xbstream.cc (renamed from extra/mariabackup/xbstream.c)37
-rw-r--r--extra/mariabackup/xbstream.h2
-rw-r--r--extra/mariabackup/xbstream_read.cc (renamed from extra/mariabackup/xbstream_read.c)24
-rw-r--r--extra/mariabackup/xbstream_write.cc (renamed from extra/mariabackup/xbstream_write.c)6
-rw-r--r--extra/mariabackup/xtrabackup.cc717
-rw-r--r--extra/mariabackup/xtrabackup.h16
-rw-r--r--extra/perror.c6
-rw-r--r--extra/resolve_stack_dump.c2
-rw-r--r--extra/yassl/src/ssl.cpp16
-rw-r--r--include/aria_backup.h34
-rw-r--r--include/json_lib.h17
-rw-r--r--include/lf.h2
-rw-r--r--include/my_counter.h49
-rw-r--r--include/my_global.h2
-rw-r--r--include/my_pthread.h14
-rw-r--r--include/my_time.h55
-rw-r--r--include/mysql/plugin.h2
-rw-r--r--include/mysql/plugin_audit.h.pp45
-rw-r--r--include/mysql/plugin_auth.h.pp45
-rw-r--r--include/mysql/plugin_encryption.h.pp45
-rw-r--r--include/mysql/plugin_ftparser.h.pp45
-rw-r--r--include/mysql/plugin_password_validation.h.pp45
-rw-r--r--include/mysql/service_json.h117
-rw-r--r--include/mysql/service_wsrep.h305
-rw-r--r--include/mysql/services.h1
-rw-r--r--include/mysql_com.h1
-rw-r--r--include/service_versions.h1
-rw-r--r--include/thr_lock.h6
-rw-r--r--include/thread_pool_priv.h3
-rw-r--r--include/wsrep.h27
m---------libmariadb0
-rw-r--r--libmysqld/CMakeLists.txt2
-rw-r--r--libmysqld/examples/CMakeLists.txt2
-rw-r--r--libmysqld/lib_sql.cc9
-rw-r--r--libmysqld/libmysql.c7
-rw-r--r--libservices/CMakeLists.txt1
-rw-r--r--libservices/json_service.c19
-rw-r--r--man/CMakeLists.txt1
-rw-r--r--man/wsrep_sst_xtrabackup-v2.116
-rw-r--r--man/wsrep_sst_xtrabackup.116
-rw-r--r--mysql-test/include/add_anonymous_users.inc2
-rw-r--r--mysql-test/include/check-testcase.test51
-rw-r--r--mysql-test/include/check_ftwrl_incompatible.inc6
-rw-r--r--mysql-test/include/default_mysqld.cnf1
-rw-r--r--mysql-test/include/galera_cluster.inc6
-rw-r--r--mysql-test/include/galera_have_debug_sync.inc (renamed from mysql-test/suite/galera/include/galera_have_debug_sync.inc)0
-rw-r--r--mysql-test/include/galera_wait_sync_point.inc11
-rw-r--r--mysql-test/include/have_aria_used_for_temp_tables.inc4
-rw-r--r--mysql-test/include/have_auth_named_pipe.inc13
-rw-r--r--mysql-test/include/have_openssl.inc7
-rw-r--r--mysql-test/include/have_wsrep_enabled.inc1
-rw-r--r--mysql-test/include/innodb_encrypt_tables.combinations14
-rw-r--r--mysql-test/include/innodb_encrypt_tables.inc4
-rw-r--r--mysql-test/include/kill_galera.inc20
-rw-r--r--mysql-test/include/mtr_check.sql2
-rw-r--r--mysql-test/include/switch_to_mysql_global_priv.inc6
-rw-r--r--mysql-test/include/switch_to_mysql_user.inc56
-rw-r--r--mysql-test/include/system_db_struct.inc1
-rw-r--r--mysql-test/include/wait_until_connected_again.inc19
-rw-r--r--mysql-test/include/wsrep_wait_disconnect.inc20
-rwxr-xr-xmysql-test/lib/generate-ssl-certs.sh37
-rw-r--r--mysql-test/lib/mtr_cases.pm1
-rw-r--r--mysql-test/main/1st.result1
-rw-r--r--mysql-test/main/alter_table.result28
-rw-r--r--mysql-test/main/alter_table.test19
-rw-r--r--mysql-test/main/alter_table_errors.result19
-rw-r--r--mysql-test/main/alter_table_errors.test11
-rw-r--r--mysql-test/main/alter_user.result19
-rw-r--r--mysql-test/main/alter_user.test4
-rw-r--r--mysql-test/main/analyze.result7
-rw-r--r--mysql-test/main/auth_rpl.result2
-rw-r--r--mysql-test/main/backup_aria.result158
-rw-r--r--mysql-test/main/backup_aria.test157
-rw-r--r--mysql-test/main/backup_interaction.result520
-rw-r--r--mysql-test/main/backup_interaction.test503
-rw-r--r--mysql-test/main/backup_lock.result219
-rw-r--r--mysql-test/main/backup_lock.test284
-rw-r--r--mysql-test/main/backup_lock_debug.result28
-rw-r--r--mysql-test/main/backup_lock_debug.test40
-rw-r--r--mysql-test/main/backup_locks.result46
-rw-r--r--mysql-test/main/backup_locks.test50
-rw-r--r--mysql-test/main/backup_priv.result40
-rw-r--r--mysql-test/main/backup_priv.test52
-rw-r--r--mysql-test/main/backup_stages.result335
-rw-r--r--mysql-test/main/backup_stages.test385
-rw-r--r--mysql-test/main/backup_syntax.result163
-rw-r--r--mysql-test/main/backup_syntax.test181
-rw-r--r--mysql-test/main/bigint.result11
-rw-r--r--mysql-test/main/bigint.test9
-rw-r--r--mysql-test/main/check.result10
-rw-r--r--mysql-test/main/check.test12
-rw-r--r--mysql-test/main/column_compression_parts.result1
-rw-r--r--mysql-test/main/column_compression_parts.test2
-rw-r--r--mysql-test/main/connect.result19
-rw-r--r--mysql-test/main/connect.test29
-rw-r--r--mysql-test/main/create-big.result12
-rw-r--r--mysql-test/main/create-big.test12
-rw-r--r--mysql-test/main/create.result101
-rw-r--r--mysql-test/main/create.test91
-rw-r--r--mysql-test/main/create_drop_binlog.result4
-rw-r--r--mysql-test/main/create_or_replace.result51
-rw-r--r--mysql-test/main/create_or_replace.test22
-rw-r--r--mysql-test/main/create_user.result16
-rw-r--r--mysql-test/main/create_utf8.result89
-rw-r--r--mysql-test/main/create_utf8.test80
-rw-r--r--mysql-test/main/cte_recursive.result86
-rw-r--r--mysql-test/main/cte_recursive.test73
-rw-r--r--mysql-test/main/ctype_big5.result128
-rw-r--r--mysql-test/main/ctype_cp932_binlog_stm.result128
-rw-r--r--mysql-test/main/ctype_eucjpms.result128
-rw-r--r--mysql-test/main/ctype_euckr.result140
-rw-r--r--mysql-test/main/ctype_gb2312.result128
-rw-r--r--mysql-test/main/ctype_gbk.result454
-rw-r--r--mysql-test/main/ctype_latin1.result8
-rw-r--r--mysql-test/main/ctype_many.result4
-rw-r--r--mysql-test/main/ctype_recoding.result4
-rw-r--r--mysql-test/main/ctype_sjis.result128
-rw-r--r--mysql-test/main/ctype_uca.result40
-rw-r--r--mysql-test/main/ctype_uca_innodb.result28
-rw-r--r--mysql-test/main/ctype_ucs.result14
-rw-r--r--mysql-test/main/ctype_ucs.test15
-rw-r--r--mysql-test/main/ctype_ujis.result128
-rw-r--r--mysql-test/main/ctype_ujis_ucs2.result150
-rw-r--r--mysql-test/main/ctype_upgrade.result6
-rw-r--r--mysql-test/main/ctype_utf16.result4
-rw-r--r--mysql-test/main/ctype_utf16le.result4
-rw-r--r--mysql-test/main/ctype_utf32.result18
-rw-r--r--mysql-test/main/ctype_utf8.result86
-rw-r--r--mysql-test/main/ctype_utf8mb4.result52
-rw-r--r--mysql-test/main/ctype_utf8mb4_heap.result14
-rw-r--r--mysql-test/main/ctype_utf8mb4_innodb.result16
-rw-r--r--mysql-test/main/ctype_utf8mb4_myisam.result16
-rw-r--r--mysql-test/main/custom_aggregate_functions.result2
-rw-r--r--mysql-test/main/delayed.result4
-rw-r--r--mysql-test/main/delete_use_source.result9
-rw-r--r--mysql-test/main/deprecated_features.result2
-rw-r--r--mysql-test/main/derived_cond_pushdown.result251
-rw-r--r--mysql-test/main/derived_cond_pushdown.test27
-rw-r--r--mysql-test/main/derived_split_innodb.result1
-rw-r--r--mysql-test/main/derived_view.result8
-rw-r--r--mysql-test/main/disabled.def7
-rw-r--r--mysql-test/main/distinct.result24
-rw-r--r--mysql-test/main/distinct.test18
-rw-r--r--mysql-test/main/empty_user_table.result11
-rw-r--r--mysql-test/main/empty_user_table.test22
-rw-r--r--mysql-test/main/events_bugs.result2
-rw-r--r--mysql-test/main/explain_json.result1
-rw-r--r--mysql-test/main/explain_non_select.result2
-rw-r--r--mysql-test/main/failed_auth_3909.result25
-rw-r--r--mysql-test/main/failed_auth_3909.test18
-rw-r--r--mysql-test/main/failed_auth_unixsocket.result4
-rw-r--r--mysql-test/main/failed_auth_unixsocket.test4
-rw-r--r--mysql-test/main/flush.result21
-rw-r--r--mysql-test/main/flush.test48
-rw-r--r--mysql-test/main/flush_block_commit.test2
-rw-r--r--mysql-test/main/flush_block_commit_notembedded.test2
-rw-r--r--mysql-test/main/flush_read_lock.result58
-rw-r--r--mysql-test/main/flush_read_lock.test115
-rw-r--r--mysql-test/main/flush_read_lock_kill.test2
-rw-r--r--mysql-test/main/flush_ssl.result26
-rw-r--r--mysql-test/main/flush_ssl.test61
-rw-r--r--mysql-test/main/fulltext.result8
-rw-r--r--mysql-test/main/func_default.result10
-rw-r--r--mysql-test/main/func_default.test5
-rw-r--r--mysql-test/main/func_extract.result592
-rw-r--r--mysql-test/main/func_extract.test257
-rw-r--r--mysql-test/main/func_group_innodb.result26
-rw-r--r--mysql-test/main/func_group_innodb.test19
-rw-r--r--mysql-test/main/func_hybrid_type.result18
-rw-r--r--mysql-test/main/func_hybrid_type.test16
-rw-r--r--mysql-test/main/func_json.result20
-rw-r--r--mysql-test/main/func_json.test18
-rw-r--r--mysql-test/main/func_math.result40
-rw-r--r--mysql-test/main/func_math.test33
-rw-r--r--mysql-test/main/func_set.result4
-rw-r--r--mysql-test/main/func_str.result12
-rw-r--r--mysql-test/main/func_str.test16
-rw-r--r--mysql-test/main/func_time.result77
-rw-r--r--mysql-test/main/func_time.test40
-rw-r--r--mysql-test/main/func_time_round.result1374
-rw-r--r--mysql-test/main/func_time_round.test461
-rw-r--r--mysql-test/main/gis-rtree.result1
-rw-r--r--mysql-test/main/gis.result2
-rw-r--r--mysql-test/main/gis2.result4
-rw-r--r--mysql-test/main/grant.result42
-rw-r--r--mysql-test/main/grant.test43
-rw-r--r--mysql-test/main/grant2.result65
-rw-r--r--mysql-test/main/grant2.test25
-rw-r--r--mysql-test/main/grant3.result24
-rw-r--r--mysql-test/main/grant4.result18
-rw-r--r--mysql-test/main/grant5.result35
-rw-r--r--mysql-test/main/grant5.test19
-rw-r--r--mysql-test/main/grant_4332.result6
-rw-r--r--mysql-test/main/grant_4332.test8
-rw-r--r--mysql-test/main/group_by.result22
-rw-r--r--mysql-test/main/group_by.test13
-rw-r--r--mysql-test/main/group_by_innodb.result1
-rw-r--r--mysql-test/main/group_min_max.result116
-rw-r--r--mysql-test/main/group_min_max_innodb.result1
-rw-r--r--mysql-test/main/handlersocket.result2
-rw-r--r--mysql-test/main/having.result1
-rw-r--r--mysql-test/main/huge_frm-6224.result5
-rw-r--r--mysql-test/main/huge_frm-6224.test11
-rw-r--r--mysql-test/main/index_merge_innodb.result6
-rw-r--r--mysql-test/main/index_merge_innodb.test1
-rw-r--r--mysql-test/main/index_merge_myisam.result4
-rw-r--r--mysql-test/main/information_schema.result21
-rw-r--r--mysql-test/main/information_schema.test13
-rw-r--r--mysql-test/main/information_schema_all_engines.result2
-rw-r--r--mysql-test/main/init_file_set_password-7656.result6
-rw-r--r--mysql-test/main/innodb_ext_key.result7
-rw-r--r--mysql-test/main/innodb_ext_key.test1
-rw-r--r--mysql-test/main/innodb_icp.result8
-rw-r--r--mysql-test/main/innodb_mysql_sync.result4
-rw-r--r--mysql-test/main/innodb_mysql_sync.test2
-rw-r--r--mysql-test/main/insert.result32
-rw-r--r--mysql-test/main/invisible_field.result4
-rw-r--r--mysql-test/main/invisible_field_debug.result2
-rw-r--r--mysql-test/main/invisible_field_debug.test2
-rw-r--r--mysql-test/main/join.result10
-rw-r--r--mysql-test/main/join.test2
-rw-r--r--mysql-test/main/join_cache.result208
-rw-r--r--mysql-test/main/join_cache.test4
-rw-r--r--mysql-test/main/join_outer.result7
-rw-r--r--mysql-test/main/join_outer_innodb.result12
-rw-r--r--mysql-test/main/join_outer_jcl6.result7
-rw-r--r--mysql-test/main/kill.result2
-rw-r--r--mysql-test/main/kill.test8
-rw-r--r--mysql-test/main/limit_rows_examined.result11
-rw-r--r--mysql-test/main/loaddata.result6
-rw-r--r--mysql-test/main/lock.result3
-rw-r--r--mysql-test/main/lock.test2
-rw-r--r--mysql-test/main/lock_multi.result17
-rw-r--r--mysql-test/main/lock_multi.test68
-rw-r--r--mysql-test/main/lock_sync.result2
-rw-r--r--mysql-test/main/lock_sync.test4
-rw-r--r--mysql-test/main/log_tables_upgrade.result3
-rw-r--r--mysql-test/main/lowercase_fs_off.result3
-rw-r--r--mysql-test/main/max_password_errors.result45
-rw-r--r--mysql-test/main/max_password_errors.test64
-rw-r--r--mysql-test/main/mdev-504.result3
-rw-r--r--mysql-test/main/mdev-504.test4
-rw-r--r--mysql-test/main/mdev13607.result3
-rw-r--r--mysql-test/main/mdl.result74
-rw-r--r--mysql-test/main/mdl.test64
-rw-r--r--mysql-test/main/mdl_sync.result63
-rw-r--r--mysql-test/main/mdl_sync.test95
-rw-r--r--mysql-test/main/merge.result5
-rw-r--r--mysql-test/main/mix2_myisam.result1
-rw-r--r--mysql-test/main/multi_update.result4
-rw-r--r--mysql-test/main/myisam.result8
-rw-r--r--mysql-test/main/myisam_explain_non_select_all.result238
-rw-r--r--mysql-test/main/myisam_icp.result2
-rw-r--r--mysql-test/main/mysql_install_db_win.result13
-rw-r--r--mysql-test/main/mysql_install_db_win.test24
-rw-r--r--mysql-test/main/mysql_upgrade-6984.result7
-rw-r--r--mysql-test/main/mysql_upgrade-6984.test4
-rw-r--r--mysql-test/main/mysql_upgrade.result35
-rw-r--r--mysql-test/main/mysql_upgrade.test5
-rw-r--r--mysql-test/main/mysql_upgrade_no_innodb.result2
-rw-r--r--mysql-test/main/mysql_upgrade_noengine.result12
-rw-r--r--mysql-test/main/mysql_upgrade_noengine.test16
-rw-r--r--mysql-test/main/mysql_upgrade_ssl.result3
-rw-r--r--mysql-test/main/mysql_upgrade_view.result13
-rw-r--r--mysql-test/main/mysqlbinlog_row_compressed.result16
-rw-r--r--mysql-test/main/mysqlbinlog_row_minimal.result16
-rw-r--r--mysql-test/main/mysqlcheck.result10
-rw-r--r--mysql-test/main/mysqld--help.result29
-rw-r--r--mysql-test/main/mysqld_option_err.test2
-rw-r--r--mysql-test/main/mysqldump.result6
-rw-r--r--mysql-test/main/mysqldump.test2
-rw-r--r--mysql-test/main/not_embedded_server.result4
-rw-r--r--mysql-test/main/not_embedded_server.test2
-rw-r--r--mysql-test/main/null_key.result3
-rw-r--r--mysql-test/main/old-mode.result41
-rw-r--r--mysql-test/main/old-mode.test29
-rw-r--r--mysql-test/main/openssl_1.result72
-rw-r--r--mysql-test/main/openssl_1.test91
-rw-r--r--mysql-test/main/order_by.result37
-rw-r--r--mysql-test/main/order_by.test37
-rw-r--r--mysql-test/main/outfile_loaddata.result4
-rw-r--r--mysql-test/main/parser.result65
-rw-r--r--mysql-test/main/parser.test74
-rw-r--r--mysql-test/main/partition.result104
-rw-r--r--mysql-test/main/partition.test62
-rw-r--r--mysql-test/main/partition_alter.test2
-rw-r--r--mysql-test/main/partition_binlog.result1
-rw-r--r--mysql-test/main/partition_explicit_prune.result6
-rw-r--r--mysql-test/main/partition_innodb.result64
-rw-r--r--mysql-test/main/partition_innodb.test66
-rw-r--r--mysql-test/main/perror-win.result4
-rw-r--r--mysql-test/main/perror.result8
-rw-r--r--mysql-test/main/plugin.result6
-rw-r--r--mysql-test/main/plugin_auth.result3
-rw-r--r--mysql-test/main/plugin_auth.test8
-rw-r--r--mysql-test/main/plugin_auth_qa.result90
-rw-r--r--mysql-test/main/plugin_auth_qa_1.result44
-rw-r--r--mysql-test/main/plugin_auth_qa_1.test14
-rw-r--r--mysql-test/main/plugin_auth_qa_2.result26
-rw-r--r--mysql-test/main/processlist.result2
-rw-r--r--mysql-test/main/ps.result50
-rw-r--r--mysql-test/main/ps_ddl.result8
-rw-r--r--mysql-test/main/ps_ddl.test2
-rw-r--r--mysql-test/main/ps_error.result73
-rw-r--r--mysql-test/main/ps_error.test66
-rw-r--r--mysql-test/main/range.result87
-rw-r--r--mysql-test/main/range_innodb.result43
-rw-r--r--mysql-test/main/range_innodb.test42
-rw-r--r--mysql-test/main/range_mrr_icp.result121
-rw-r--r--mysql-test/main/range_vs_index_merge.result136
-rw-r--r--mysql-test/main/range_vs_index_merge.test17
-rw-r--r--mysql-test/main/range_vs_index_merge_innodb.result36
-rw-r--r--mysql-test/main/read_only.result16
-rw-r--r--mysql-test/main/read_only.test23
-rw-r--r--mysql-test/main/row.result2
-rw-r--r--mysql-test/main/select.result3
-rw-r--r--mysql-test/main/select_jcl6.result3
-rw-r--r--mysql-test/main/select_pkeycache.result3
-rw-r--r--mysql-test/main/select_safe.result9
-rw-r--r--mysql-test/main/selectivity_innodb.result1
-rw-r--r--mysql-test/main/session_tracker_last_gtid.result6
-rw-r--r--mysql-test/main/set_password.result28
-rw-r--r--mysql-test/main/set_password.test2
-rw-r--r--mysql-test/main/show_check.result6
-rw-r--r--mysql-test/main/show_grants_with_plugin-7985.result197
-rw-r--r--mysql-test/main/show_grants_with_plugin-7985.test160
-rw-r--r--mysql-test/main/sp-code.result12
-rw-r--r--mysql-test/main/sp-cursor.result26
-rw-r--r--mysql-test/main/sp-cursor.test21
-rw-r--r--mysql-test/main/sp-error.result2
-rw-r--r--mysql-test/main/sp-for-loop.result2
-rw-r--r--mysql-test/main/sp-for-loop.test2
-rw-r--r--mysql-test/main/sp-security.result24
-rw-r--r--mysql-test/main/sp-security.test9
-rw-r--r--mysql-test/main/sp-vars.result8
-rw-r--r--mysql-test/main/sp.result60
-rw-r--r--mysql-test/main/sp.test36
-rw-r--r--mysql-test/main/sp_notembedded.result2
-rw-r--r--mysql-test/main/sp_notembedded.test8
-rw-r--r--mysql-test/main/sql_mode.result8
-rw-r--r--mysql-test/main/sql_mode.test4
-rw-r--r--mysql-test/main/ssl-crl-revoked-crl.result1
-rw-r--r--mysql-test/main/ssl.result9
-rw-r--r--mysql-test/main/ssl.test5
-rw-r--r--mysql-test/main/ssl_cert_verify.result5
-rw-r--r--mysql-test/main/ssl_cert_verify.test43
-rw-r--r--mysql-test/main/ssl_cipher-master.opt1
-rw-r--r--mysql-test/main/ssl_cipher.result63
-rw-r--r--mysql-test/main/ssl_cipher.test110
-rw-r--r--mysql-test/main/ssl_crl-master.opt4
-rw-r--r--mysql-test/main/ssl_crl.combinations5
-rw-r--r--mysql-test/main/ssl_crl.result24
-rw-r--r--mysql-test/main/ssl_crl.test15
-rw-r--r--mysql-test/main/ssl_crl_clients-master.opt4
-rw-r--r--mysql-test/main/ssl_crl_clients-valid.result24
-rw-r--r--mysql-test/main/ssl_crl_clients.result6
-rw-r--r--mysql-test/main/ssl_crl_clients.test31
-rw-r--r--mysql-test/main/ssl_crl_clients_valid-master.opt4
-rw-r--r--mysql-test/main/ssl_crl_clients_valid.result16
-rw-r--r--mysql-test/main/ssl_crl_clients_valid.test23
-rw-r--r--mysql-test/main/ssl_crl_clrpath-master.opt4
-rw-r--r--mysql-test/main/ssl_crl_clrpath.result23
-rw-r--r--mysql-test/main/ssl_crl_clrpath.test16
-rw-r--r--mysql-test/main/stat_tables.result113
-rw-r--r--mysql-test/main/stat_tables.test59
-rw-r--r--mysql-test/main/stat_tables_disabled.result4
-rw-r--r--mysql-test/main/stat_tables_innodb.result113
-rw-r--r--mysql-test/main/stat_tables_rbr.result4
-rw-r--r--mysql-test/main/stat_tables_rbr.test5
-rw-r--r--mysql-test/main/statistics.result10
-rw-r--r--mysql-test/main/status.result8
-rw-r--r--mysql-test/main/str_to_datetime_457.result5
-rw-r--r--mysql-test/main/strict.result184
-rw-r--r--mysql-test/main/subselect.result16
-rw-r--r--mysql-test/main/subselect_exists2in.result7
-rw-r--r--mysql-test/main/subselect_exists2in_costmat.result2
-rw-r--r--mysql-test/main/subselect_extra.result4
-rw-r--r--mysql-test/main/subselect_extra_no_semijoin.result4
-rw-r--r--mysql-test/main/subselect_innodb.result1
-rw-r--r--mysql-test/main/subselect_mat.result6
-rw-r--r--mysql-test/main/subselect_mat_cost.result22
-rw-r--r--mysql-test/main/subselect_mat_cost_bugs.result1
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result14
-rw-r--r--mysql-test/main/subselect_no_mat.result12
-rw-r--r--mysql-test/main/subselect_no_opts.result6
-rw-r--r--mysql-test/main/subselect_no_scache.result16
-rw-r--r--mysql-test/main/subselect_no_semijoin.result4
-rw-r--r--mysql-test/main/subselect_sj.result2
-rw-r--r--mysql-test/main/subselect_sj2_mat.result36
-rw-r--r--mysql-test/main/subselect_sj2_mat.test4
-rw-r--r--mysql-test/main/subselect_sj_jcl6.result2
-rw-r--r--mysql-test/main/subselect_sj_mat.result22
-rw-r--r--mysql-test/main/system_mysql_db.result66
-rw-r--r--mysql-test/main/system_mysql_db_507.result (renamed from mysql-test/main/no_password_column-mdev-11170.result)12
-rw-r--r--mysql-test/main/system_mysql_db_507.test (renamed from mysql-test/main/no_password_column-mdev-11170.test)17
-rw-r--r--mysql-test/main/system_mysql_db_fix40123.result13
-rw-r--r--mysql-test/main/system_mysql_db_fix40123.test2
-rw-r--r--mysql-test/main/system_mysql_db_fix50030.result13
-rw-r--r--mysql-test/main/system_mysql_db_fix50030.test2
-rw-r--r--mysql-test/main/system_mysql_db_fix50117.result13
-rw-r--r--mysql-test/main/system_mysql_db_fix50117.test2
-rw-r--r--mysql-test/main/temp_table_frm.result6
-rw-r--r--mysql-test/main/temp_table_frm.test9
-rw-r--r--mysql-test/main/temporal_literal.result12
-rw-r--r--mysql-test/main/timezone2.result202
-rw-r--r--mysql-test/main/timezone2.test179
-rw-r--r--mysql-test/main/trigger.result4
-rw-r--r--mysql-test/main/trigger_notembedded.test2
-rw-r--r--mysql-test/main/truncate_coverage.result2
-rw-r--r--mysql-test/main/truncate_coverage.test4
-rw-r--r--mysql-test/main/type_date.result22
-rw-r--r--mysql-test/main/type_date_round.result174
-rw-r--r--mysql-test/main/type_date_round.test113
-rw-r--r--mysql-test/main/type_datetime.result8
-rw-r--r--mysql-test/main/type_datetime_round.result205
-rw-r--r--mysql-test/main/type_datetime_round.test147
-rw-r--r--mysql-test/main/type_decimal.result4
-rw-r--r--mysql-test/main/type_float.result2
-rw-r--r--mysql-test/main/type_interval.result83
-rw-r--r--mysql-test/main/type_interval.test54
-rw-r--r--mysql-test/main/type_newdecimal.result2
-rw-r--r--mysql-test/main/type_newdecimal.test1
-rw-r--r--mysql-test/main/type_num.result168
-rw-r--r--mysql-test/main/type_time.result40
-rw-r--r--mysql-test/main/type_time.test21
-rw-r--r--mysql-test/main/type_time_round.result260
-rw-r--r--mysql-test/main/type_time_round.test184
-rw-r--r--mysql-test/main/type_timestamp.result135
-rw-r--r--mysql-test/main/type_timestamp.test136
-rw-r--r--mysql-test/main/type_timestamp_round.result191
-rw-r--r--mysql-test/main/type_timestamp_round.test160
-rw-r--r--mysql-test/main/udf.result119
-rw-r--r--mysql-test/main/udf.test79
-rw-r--r--mysql-test/main/union.result40
-rw-r--r--mysql-test/main/union.test35
-rw-r--r--mysql-test/main/update.result4
-rw-r--r--mysql-test/main/update_use_source.result1
-rw-r--r--mysql-test/main/userstat.result4
-rw-r--r--mysql-test/main/view.result9
-rw-r--r--mysql-test/main/view_grant.result8
-rw-r--r--mysql-test/main/view_grant.test16
-rw-r--r--mysql-test/main/warnings.result68
-rw-r--r--mysql-test/main/win.result132
-rw-r--r--mysql-test/main/win.test127
-rw-r--r--mysql-test/main/win_big-mdev-11697.result2
-rwxr-xr-xmysql-test/mysql-test-run.pl167
-rw-r--r--mysql-test/std_data/ca-cert-verify.pem20
-rw-r--r--mysql-test/std_data/cacert.pem110
-rw-r--r--mysql-test/std_data/cakey.pem52
-rw-r--r--mysql-test/std_data/client-cert.crl12
-rw-r--r--mysql-test/std_data/client-cert.pem102
-rw-r--r--mysql-test/std_data/client-key.pem38
-rw-r--r--mysql-test/std_data/crl-ca-cert.pem63
-rw-r--r--mysql-test/std_data/crl-client-cert.pem62
-rw-r--r--mysql-test/std_data/crl-client-key.pem15
-rw-r--r--mysql-test/std_data/crl-client-revoked.crl10
-rw-r--r--mysql-test/std_data/crl-server-cert.pem62
-rw-r--r--mysql-test/std_data/crl-server-key.pem15
-rw-r--r--mysql-test/std_data/crldir/ed1f42db.r012
-rw-r--r--mysql-test/std_data/crldir/fc725416.r010
-rw-r--r--mysql-test/std_data/galera-cert.pem26
-rw-r--r--mysql-test/std_data/galera-key.pem28
-rw-r--r--mysql-test/std_data/galera-upgrade-ca-cert.pem40
-rw-r--r--mysql-test/std_data/galera-upgrade-server-cert.pem20
-rw-r--r--mysql-test/std_data/galera-upgrade-server-key.pem28
-rw-r--r--mysql-test/std_data/mdev17909#P#p20181029.MYD0
-rw-r--r--mysql-test/std_data/mdev17909#P#p20181029.MYIbin0 -> 1024 bytes
-rw-r--r--mysql-test/std_data/mdev17909#P#p20181128.MYD0
-rw-r--r--mysql-test/std_data/mdev17909#P#p20181128.MYIbin0 -> 1024 bytes
-rw-r--r--mysql-test/std_data/mdev17909.frmbin0 -> 3284 bytes
-rw-r--r--mysql-test/std_data/mdev17909.parbin0 -> 48 bytes
-rw-r--r--mysql-test/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001bin0 -> 514 bytes
-rw-r--r--mysql-test/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001bin0 -> 892 bytes
-rw-r--r--mysql-test/std_data/server-cert-verify-fail.pem19
-rw-r--r--mysql-test/std_data/server-cert-verify-pass.pem19
-rw-r--r--mysql-test/std_data/server-cert.crl12
-rw-r--r--mysql-test/std_data/server-cert.pem100
-rw-r--r--mysql-test/std_data/server-key-verify-fail.pem27
-rw-r--r--mysql-test/std_data/server-key-verify-pass.pem27
-rw-r--r--mysql-test/std_data/server-key.pem38
-rw-r--r--mysql-test/std_data/server-new-cert.pem81
-rw-r--r--mysql-test/std_data/server-new-key.pem27
-rw-r--r--mysql-test/std_data/server8k-cert.pem246
-rw-r--r--mysql-test/std_data/server8k-key.pem194
-rw-r--r--mysql-test/std_data/serversan-cert.pem92
-rw-r--r--mysql-test/std_data/serversan-key.pem40
-rw-r--r--mysql-test/suite.pm5
-rw-r--r--mysql-test/suite/archive/disabled.def13
-rw-r--r--mysql-test/suite/archive/flush.result18
-rw-r--r--mysql-test/suite/archive/flush.test25
-rw-r--r--mysql-test/suite/archive/rnd_pos.result56
-rw-r--r--mysql-test/suite/archive/rnd_pos.test27
-rw-r--r--mysql-test/suite/binlog/include/binlog.test8
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_binlog.result18
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_binlog.result16
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_binlog.test4
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel.result1
-rw-r--r--mysql-test/suite/compat/oracle/r/parser.result110
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-code.result42
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result25
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-cursor.result30
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-package-mdl.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-package.result48
-rw-r--r--mysql-test/suite/compat/oracle/r/sp.result60
-rw-r--r--mysql-test/suite/compat/oracle/r/versioning.result8
-rw-r--r--mysql-test/suite/compat/oracle/t/parser.test154
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-code.test2
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test23
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-cursor.test35
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-package.test57
-rw-r--r--mysql-test/suite/compat/oracle/t/sp.test45
-rw-r--r--mysql-test/suite/compat/oracle/t/versioning.test10
-rw-r--r--mysql-test/suite/csv/flush.result25
-rw-r--r--mysql-test/suite/csv/flush.test30
-rw-r--r--mysql-test/suite/encryption/disabled.def1
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change.result1
-rw-r--r--mysql-test/suite/encryption/r/innodb-checksum-algorithm.result225
-rw-r--r--mysql-test/suite/encryption/r/innodb-encryption-alter.result28
-rw-r--r--mysql-test/suite/encryption/r/innodb-encryption-disable.result1
-rw-r--r--mysql-test/suite/encryption/r/innodb-force-corrupt.result3
-rw-r--r--mysql-test/suite/encryption/r/innodb-missing-key.result1
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change.test1
-rw-r--r--mysql-test/suite/encryption/t/innodb-checksum-algorithm.test9
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-alter.test38
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-disable.test1
-rw-r--r--mysql-test/suite/encryption/t/innodb-force-corrupt.test9
-rw-r--r--mysql-test/suite/encryption/t/innodb-missing-key.test1
-rw-r--r--mysql-test/suite/engines/funcs/r/an_calendar.result4
-rw-r--r--mysql-test/suite/engines/funcs/r/an_number.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/an_string.result10
-rw-r--r--mysql-test/suite/engines/funcs/r/in_number_boundary_error.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result8
-rw-r--r--mysql-test/suite/engines/funcs/r/tc_partition_analyze.result1
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_decimal.result12
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_number.result304
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_year.result16
-rw-r--r--mysql-test/suite/engines/iuds/r/update_decimal.result4
-rw-r--r--mysql-test/suite/engines/iuds/r/update_delete_number.result17
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result72
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraint.result121
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraints.result36
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_innodb.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql.result197
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result197
-rw-r--r--mysql-test/suite/funcs_1/r/is_key_column_usage.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_routines_embedded.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics_mysql.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result8
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints.result3
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result3
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_mysql.result39
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result78
-rw-r--r--mysql-test/suite/funcs_1/r/is_user_privileges.result1839
-rw-r--r--mysql-test/suite/funcs_1/r/is_views.result1
-rw-r--r--mysql-test/suite/funcs_1/r/is_views_embedded.result1
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result72
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result72
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result6
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraint.test92
-rw-r--r--mysql-test/suite/funcs_1/t/is_user_privileges.test11
-rw-r--r--mysql-test/suite/galera/disabled.def28
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf26
-rw-r--r--mysql-test/suite/galera/galera_2nodes_as_master.cnf18
-rw-r--r--mysql-test/suite/galera/galera_2nodes_as_slave.cnf51
-rw-r--r--mysql-test/suite/galera/galera_3nodes_as_slave.cnf62
-rw-r--r--mysql-test/suite/galera/galera_4nodes.cnf30
-rw-r--r--mysql-test/suite/galera/include/galera_base_port.inc8
-rw-r--r--mysql-test/suite/galera/include/galera_concurrent_test.inc90
-rw-r--r--mysql-test/suite/galera/include/galera_dump_sr_table.inc28
-rw-r--r--mysql-test/suite/galera/include/galera_load_provider.inc68
-rw-r--r--mysql-test/suite/galera/include/galera_sst_restore.inc2
-rw-r--r--mysql-test/suite/galera/include/galera_st_disconnect_slave.inc8
-rw-r--r--mysql-test/suite/galera/include/galera_unload_provider.inc8
-rw-r--r--mysql-test/suite/galera/include/have_filekeymanagement.inc3
-rw-r--r--mysql-test/suite/galera/r/GAL-382.result2
-rw-r--r--mysql-test/suite/galera/r/GAL-401.result2
-rw-r--r--mysql-test/suite/galera/r/GAL-480.result2
-rw-r--r--mysql-test/suite/galera/r/GCF-1081.result47
-rw-r--r--mysql-test/suite/galera/r/GCF-939.result13
-rw-r--r--mysql-test/suite/galera/r/MDEV-15443.result2
-rw-r--r--mysql-test/suite/galera/r/MW-252.result2
-rw-r--r--mysql-test/suite/galera/r/MW-258.result2
-rw-r--r--mysql-test/suite/galera/r/MW-259.result2
-rw-r--r--mysql-test/suite/galera/r/MW-284.result4
-rw-r--r--mysql-test/suite/galera/r/MW-285.result2
-rw-r--r--mysql-test/suite/galera/r/MW-286.result21
-rw-r--r--mysql-test/suite/galera/r/MW-292.result27
-rw-r--r--mysql-test/suite/galera/r/MW-309.result2
-rw-r--r--mysql-test/suite/galera/r/MW-313.result2
-rw-r--r--mysql-test/suite/galera/r/MW-328A.result25
-rw-r--r--mysql-test/suite/galera/r/MW-328B.result2
-rw-r--r--mysql-test/suite/galera/r/MW-328C.result2
-rw-r--r--mysql-test/suite/galera/r/MW-328D.result2
-rw-r--r--mysql-test/suite/galera/r/MW-328E.result2
-rw-r--r--mysql-test/suite/galera/r/MW-329.result9
-rw-r--r--mysql-test/suite/galera/r/MW-336.result2
-rw-r--r--mysql-test/suite/galera/r/MW-357.result2
-rw-r--r--mysql-test/suite/galera/r/MW-360.result41
-rw-r--r--mysql-test/suite/galera/r/MW-369.result149
-rw-r--r--mysql-test/suite/galera/r/MW-388.result6
-rw-r--r--mysql-test/suite/galera/r/MW-402.result76
-rw-r--r--mysql-test/suite/galera/r/MW-416.result5
-rw-r--r--mysql-test/suite/galera/r/MW-86-wait1.result17
-rw-r--r--mysql-test/suite/galera/r/MW-86-wait8.result16
-rw-r--r--mysql-test/suite/galera/r/MW-86.result78
-rw-r--r--mysql-test/suite/galera/r/basic.result2
-rw-r--r--mysql-test/suite/galera/r/binlog_checksum.result2
-rw-r--r--mysql-test/suite/galera/r/create.result2
-rw-r--r--mysql-test/suite/galera/r/enforce_storage_engine.result2
-rw-r--r--mysql-test/suite/galera/r/enforce_storage_engine2.result2
-rw-r--r--mysql-test/suite/galera/r/ev51914.result2
-rw-r--r--mysql-test/suite/galera/r/fk.result2
-rw-r--r--mysql-test/suite/galera/r/galera#414.result2
-rw-r--r--mysql-test/suite/galera/r/galera#500.result8
-rw-r--r--mysql-test/suite/galera/r/galera#505.result2
-rw-r--r--mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result382
-rw-r--r--mysql-test/suite/galera/r/galera_admin.result4
-rw-r--r--mysql-test/suite/galera/r/galera_alter_engine_innodb.result2
-rw-r--r--mysql-test/suite/galera/r/galera_alter_engine_myisam.result2
-rw-r--r--mysql-test/suite/galera/r/galera_alter_table_force.result2
-rw-r--r--mysql-test/suite/galera/r/galera_applier_ftwrl_table.result2
-rw-r--r--mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result2
-rw-r--r--mysql-test/suite/galera/r/galera_as_master.result4
-rw-r--r--mysql-test/suite/galera/r/galera_as_master_gtid.result44
-rw-r--r--mysql-test/suite/galera/r/galera_as_master_large.result2
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave.result12
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_autoinc.result12
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid.result12
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db.result159
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db_cc.result315
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_nonprim.result16
-rw-r--r--mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result (renamed from mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result)4
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort.result4
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result2
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_for_update.result6
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result2
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_get_lock.result4
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_group_commit.result685
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_lock_table.result2
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_shutdown.result12
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_sleep.result4
-rw-r--r--mysql-test/suite/galera/r/galera_bf_background_statistics.result4
-rw-r--r--mysql-test/suite/galera/r/galera_bf_lock_wait.result2
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_cache_size.result2
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_checksum.result2
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result2
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result2
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_row_image.result2
-rw-r--r--mysql-test/suite/galera/r/galera_commit_empty.result15
-rw-r--r--mysql-test/suite/galera/r/galera_concurrent_ctas.result2
-rw-r--r--mysql-test/suite/galera/r/galera_create_function.result2
-rw-r--r--mysql-test/suite/galera/r/galera_create_procedure.result2
-rw-r--r--mysql-test/suite/galera/r/galera_create_table_as_select.result103
-rw-r--r--mysql-test/suite/galera/r/galera_create_table_like.result2
-rw-r--r--mysql-test/suite/galera/r/galera_create_trigger.result2
-rw-r--r--mysql-test/suite/galera/r/galera_ddl_multiline.result2
-rw-r--r--mysql-test/suite/galera/r/galera_defaults.result13
-rw-r--r--mysql-test/suite/galera/r/galera_delete_limit.result2
-rw-r--r--mysql-test/suite/galera/r/galera_desync_overlapped.result2
-rw-r--r--mysql-test/suite/galera/r/galera_drop_database.result8
-rw-r--r--mysql-test/suite/galera/r/galera_drop_multi.result2
-rw-r--r--mysql-test/suite/galera/r/galera_encrypt_tmp_files.result2
-rw-r--r--mysql-test/suite/galera/r/galera_enum.result4
-rw-r--r--mysql-test/suite/galera/r/galera_events.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_delete.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_update.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_conflict.result4
-rw-r--r--mysql-test/suite/galera/r/galera_fk_mismatch.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_multicolumn.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_multitable.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_no_pk.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_selfreferential.result2
-rw-r--r--mysql-test/suite/galera/r/galera_fk_setnull.result2
-rw-r--r--mysql-test/suite/galera/r/galera_flush_local.result6
-rw-r--r--mysql-test/suite/galera/r/galera_forced_binlog_format.result20
-rw-r--r--mysql-test/suite/galera/r/galera_ftwrl.result2
-rw-r--r--mysql-test/suite/galera/r/galera_ftwrl_drain.result4
-rw-r--r--mysql-test/suite/galera/r/galera_fulltext.result2
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover.result9
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result11
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_fc_limit.result2
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_fragment.result15
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_max_packet_size.result2
-rw-r--r--mysql-test/suite/galera/r/galera_gra_log.result2
-rw-r--r--mysql-test/suite/galera/r/galera_gtid.result2
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_slave.result26
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result107
-rw-r--r--mysql-test/suite/galera/r/galera_insert_ignore.result2
-rw-r--r--mysql-test/suite/galera/r/galera_insert_multi.result4
-rw-r--r--mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,release.rdiff114
-rw-r--r--mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result118
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff (renamed from mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff)17
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup.result (renamed from mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result)31
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff (renamed from mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff)17
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result98
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff19
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mysqldump.result3
-rw-r--r--mysql-test/suite/galera/r/galera_ist_progress.result9
-rw-r--r--mysql-test/suite/galera/r/galera_ist_recv_bind.result2
-rw-r--r--mysql-test/suite/galera/r/galera_ist_restart_joiner.result3
-rw-r--r--mysql-test/suite/galera/r/galera_ist_rsync.result5
-rw-r--r--mysql-test/suite/galera/r/galera_kill_ddl.result2
-rw-r--r--mysql-test/suite/galera/r/galera_kill_largechanges.result2
-rw-r--r--mysql-test/suite/galera/r/galera_kill_smallchanges.result2
-rw-r--r--mysql-test/suite/galera/r/galera_lock_table.result2
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin.result4
-rw-r--r--mysql-test/suite/galera/r/galera_log_output_csv.result2
-rw-r--r--mysql-test/suite/galera/r/galera_many_columns.result4
-rw-r--r--mysql-test/suite/galera/r/galera_many_indexes.result6
-rw-r--r--mysql-test/suite/galera/r/galera_many_rows.result6
-rw-r--r--mysql-test/suite/galera/r/galera_many_tables_nopk.result4
-rw-r--r--mysql-test/suite/galera/r/galera_many_tables_pk.result4
-rw-r--r--mysql-test/suite/galera/r/galera_mdev_10812.result2
-rw-r--r--mysql-test/suite/galera/r/galera_mdev_13787.result2
-rw-r--r--mysql-test/suite/galera/r/galera_mdev_15611.result2
-rw-r--r--mysql-test/suite/galera/r/galera_mdl_race.result4
-rw-r--r--mysql-test/suite/galera/r/galera_multi_database.result2
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_autocommit.result2
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_transactions.result2
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_bit.result4
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_blob.result4
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_large_varchar.result4
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_unicode.result4
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result8
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result20
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result4
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_simple.result2
-rw-r--r--mysql-test/suite/galera/r/galera_pc_recovery.result37
-rw-r--r--mysql-test/suite/galera/r/galera_pk_bigint_signed.result4
-rw-r--r--mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result4
-rw-r--r--mysql-test/suite/galera/r/galera_prepared_statement.result4
-rw-r--r--mysql-test/suite/galera/r/galera_query_cache.result2
-rw-r--r--mysql-test/suite/galera/r/galera_query_cache_sync_wait.result2
-rw-r--r--mysql-test/suite/galera/r/galera_read_only.result2
-rw-r--r--mysql-test/suite/galera/r/galera_repl_key_format_flat16.result2
-rw-r--r--mysql-test/suite/galera/r/galera_repl_max_ws_size.result4
-rw-r--r--mysql-test/suite/galera/r/galera_restart_nochanges.result2
-rw-r--r--mysql-test/suite/galera/r/galera_restart_on_unknown_option.result2
-rw-r--r--mysql-test/suite/galera/r/galera_roles.result2
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_add_pk.result2
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_drop_pk.result2
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_error.result2
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_simple.result2
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sbr.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sbr_binlog.result2
-rw-r--r--mysql-test/suite/galera/r/galera_schema_dirty_reads.result2
-rw-r--r--mysql-test/suite/galera/r/galera_serializable.result8
-rw-r--r--mysql-test/suite/galera/r/galera_server.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sql_log_bin_zero.result2
-rw-r--r--mysql-test/suite/galera/r/galera_ssl.result2
-rw-r--r--mysql-test/suite/galera/r/galera_ssl_compression.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff4
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff (renamed from mysql-test/suite/galera/r/galera_sst_xtrabackup-v2,debug.rdiff)4
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir.result (renamed from mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result)2
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result5
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result999
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff22
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff18
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump.result1
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff106
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result97
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff12
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sst_xtrabackup-v2-options.result3
-rw-r--r--mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_data_dir.result262
-rw-r--r--mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_encrypt_with_key.result3
-rw-r--r--mysql-test/suite/galera/r/galera_status_cluster.result2
-rw-r--r--mysql-test/suite/galera/r/galera_status_local_index.result2
-rw-r--r--mysql-test/suite/galera/r/galera_status_local_state.result2
-rw-r--r--mysql-test/suite/galera/r/galera_suspend_slave.result2
-rw-r--r--mysql-test/suite/galera/r/galera_sync_wait_show.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_error.result5
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_locking.result33
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_sequential.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_drop_database.result6
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ftwrl.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_lock_exclusive.result4
-rw-r--r--mysql-test/suite/galera/r/galera_toi_lock_shared.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_truncate.result4
-rw-r--r--mysql-test/suite/galera/r/galera_transaction_read_only.result2
-rw-r--r--mysql-test/suite/galera/r/galera_transaction_replay.result96
-rw-r--r--mysql-test/suite/galera/r/galera_truncate.result2
-rw-r--r--mysql-test/suite/galera/r/galera_truncate_temporary.result2
-rw-r--r--mysql-test/suite/galera/r/galera_unicode_identifiers.result2
-rw-r--r--mysql-test/suite/galera/r/galera_unicode_pk.result6
-rw-r--r--mysql-test/suite/galera/r/galera_update_limit.result2
-rw-r--r--mysql-test/suite/galera/r/galera_v1_row_events.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_OSU_method.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_OSU_method2.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result4
-rw-r--r--mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_cluster_address.result8
-rw-r--r--mysql-test/suite/galera/r/galera_var_desync_on.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_dirty_reads.result5
-rw-r--r--mysql-test/suite/galera/r/galera_var_fkchecks.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_gtid_domain_id.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result186
-rw-r--r--mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_load_data_splitting.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_log_bin.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_max_ws_rows.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_max_ws_size.result4
-rw-r--r--mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_node_address.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_reject_queries.result3
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_retry_autocommit.result28
-rw-r--r--mysql-test/suite/galera/r/galera_var_slave_threads.result60
-rw-r--r--mysql-test/suite/galera/r/galera_var_sst_auth.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_sync_wait.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_wsrep_on_off.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wan.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wan_restart_ist.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wan_restart_sst.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_log_conficts.result4
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_new_cluster.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result2
-rw-r--r--mysql-test/suite/galera/r/galera_zero_length_column.result2
-rw-r--r--mysql-test/suite/galera/r/grant.result4
-rw-r--r--mysql-test/suite/galera/r/lp1276424.result2
-rw-r--r--mysql-test/suite/galera/r/lp1347768.result2
-rw-r--r--mysql-test/suite/galera/r/lp1376747-2.result2
-rw-r--r--mysql-test/suite/galera/r/lp1376747-3.result2
-rw-r--r--mysql-test/suite/galera/r/lp1376747-4.result2
-rw-r--r--mysql-test/suite/galera/r/lp1376747.result2
-rw-r--r--mysql-test/suite/galera/r/lp1438990.result2
-rw-r--r--mysql-test/suite/galera/r/lp959512.result2
-rw-r--r--mysql-test/suite/galera/r/mdev_10518.result2
-rw-r--r--mysql-test/suite/galera/r/mdev_9290.result2
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#110.result2
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#198.result2
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#201.result2
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#216.result11
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#237.result4
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#247.result2
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#31.result2
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#33.result6
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#332.result42
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#90.result2
-rw-r--r--mysql-test/suite/galera/r/partition.result24
-rw-r--r--mysql-test/suite/galera/r/pxc-421.result2
-rw-r--r--mysql-test/suite/galera/r/query_cache.result2
-rw-r--r--mysql-test/suite/galera/r/rename.result2
-rw-r--r--mysql-test/suite/galera/r/rpl_row_annotate.result8
-rw-r--r--mysql-test/suite/galera/r/sql_log_bin.result2
-rw-r--r--mysql-test/suite/galera/r/unique_key.result2
-rw-r--r--mysql-test/suite/galera/r/versioning_trx_id.result2
-rw-r--r--mysql-test/suite/galera/r/view.result2
-rw-r--r--mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result15
-rw-r--r--mysql-test/suite/galera/suite.pm12
-rw-r--r--mysql-test/suite/galera/t/GAL-419.test4
-rw-r--r--mysql-test/suite/galera/t/GCF-1081.test72
-rw-r--r--mysql-test/suite/galera/t/GCF-939.test31
-rw-r--r--mysql-test/suite/galera/t/MW-284.test2
-rw-r--r--mysql-test/suite/galera/t/MW-286.test50
-rw-r--r--mysql-test/suite/galera/t/MW-292.test50
-rw-r--r--mysql-test/suite/galera/t/MW-328A.test40
-rw-r--r--mysql-test/suite/galera/t/MW-329.test28
-rw-r--r--mysql-test/suite/galera/t/MW-336.test9
-rw-r--r--mysql-test/suite/galera/t/MW-360-master.opt2
-rw-r--r--mysql-test/suite/galera/t/MW-360.test100
-rw-r--r--mysql-test/suite/galera/t/MW-369.inc7
-rw-r--r--mysql-test/suite/galera/t/MW-369.test100
-rw-r--r--mysql-test/suite/galera/t/MW-388.test5
-rw-r--r--mysql-test/suite/galera/t/MW-402.test56
-rw-r--r--mysql-test/suite/galera/t/MW-416.test8
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait1.test13
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait8.test11
-rw-r--r--mysql-test/suite/galera/t/galera#500.test6
-rw-r--r--mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test161
-rw-r--r--mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_as_master.test2
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid.test24
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test2
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave.test17
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_autoinc.test18
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid.test21
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.cnf17
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.test150
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db_cc.test176
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_nonprim.test26
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_preordered.test19
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test13
-rw-r--r--mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf (renamed from mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf)7
-rw-r--r--mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test (renamed from mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test)13
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_group_commit.cnf15
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_group_commit.test77
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_shutdown.test33
-rw-r--r--mysql-test/suite/galera/t/galera_commit_empty.test35
-rw-r--r--mysql-test/suite/galera/t/galera_create_table_as_select.test145
-rw-r--r--mysql-test/suite/galera/t/galera_defaults.test25
-rw-r--r--mysql-test/suite/galera/t/galera_drop_database.test26
-rw-r--r--mysql-test/suite/galera/t/galera_forced_binlog_format.test5
-rw-r--r--mysql-test/suite/galera/t/galera_ftwrl_drain.test4
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test12
-rw-r--r--mysql-test/suite/galera/t/galera_gcs_fragment.test4
-rw-r--r--mysql-test/suite/galera/t/galera_gtid-master.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_gtid_slave.test33
-rw-r--r--mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test110
-rw-r--r--mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf3
-rw-r--r--mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test1
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup.cnf (renamed from mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf)2
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup.test (renamed from mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test)3
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf14
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test13
-rw-r--r--mysql-test/suite/galera/t/galera_ist_progress.test4
-rw-r--r--mysql-test/suite/galera/t/galera_ist_restart_joiner.test4
-rw-r--r--mysql-test/suite/galera/t/galera_kill_applier.test1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.test2
-rw-r--r--mysql-test/suite/galera/t/galera_many_rows.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_many_rows.test7
-rw-r--r--mysql-test/suite/galera/t/galera_migrate.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test6
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test11
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test2
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_simple.test2
-rw-r--r--mysql-test/suite/galera/t/galera_pc_recovery.test102
-rw-r--r--mysql-test/suite/galera/t/galera_split_brain.test6
-rw-r--r--mysql-test/suite/galera/t/galera_ssl.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_ssl_compression.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_ssl_upgrade.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_ssl_upgrade.test6
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf (renamed from mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_data_dir.cnf)5
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.test (renamed from mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_data_dir.test)4
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.test (renamed from mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.test)6
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf (renamed from mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf)3
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test229
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mysqldump.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mysqldump.test2
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.cnf25
-rw-r--r--mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.test13
-rw-r--r--mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test20
-rw-r--r--mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_error.test5
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_locking.test54
-rw-r--r--mysql-test/suite/galera/t/galera_transaction_replay.test201
-rw-r--r--mysql-test/suite/galera/t/galera_var_cluster_address.test11
-rw-r--r--mysql-test/suite/galera/t/galera_var_dirty_reads.test12
-rw-r--r--mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test235
-rw-r--r--mysql-test/suite/galera/t/galera_var_log_bin.cnf5
-rw-r--r--mysql-test/suite/galera/t/galera_var_reject_queries.test7
-rw-r--r--mysql-test/suite/galera/t/galera_var_retry_autocommit.test24
-rw-r--r--mysql-test/suite/galera/t/galera_var_slave_threads.cnf7
-rw-r--r--mysql-test/suite/galera/t/galera_var_slave_threads.test139
-rw-r--r--mysql-test/suite/galera/t/galera_vote_drop_temporary-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster.test1
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#198-master.opt1
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#237.test4
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#332.test2
-rw-r--r--mysql-test/suite/galera/t/partition.test30
-rw-r--r--mysql-test/suite/galera/t/rpl_row_annotate.test5
-rw-r--r--mysql-test/suite/galera/t/wsrep_trx_fragment_size_sr.test22
-rw-r--r--mysql-test/suite/galera_3nodes/disabled.def1
-rw-r--r--mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf34
-rw-r--r--mysql-test/suite/galera_3nodes/galera_3nodes.cnf20
-rw-r--r--mysql-test/suite/galera_3nodes/include/galera_resume.inc (renamed from mysql-test/suite/galera/include/galera_resume.inc)2
-rw-r--r--mysql-test/suite/galera_3nodes/include/galera_suspend.inc2
-rw-r--r--mysql-test/suite/galera_3nodes/include/have_ipv6.inc15
-rw-r--r--mysql-test/suite/galera_3nodes/include/have_mariabackup.inc (renamed from mysql-test/suite/galera/include/have_xtrabackup.inc)0
-rw-r--r--mysql-test/suite/galera_3nodes/r/GAL-501.result6
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result2
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result5
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result8
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_garbd.result14
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result11
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result (renamed from mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result)8
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result24
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result5
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result2
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result4
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result13
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_pc_weight.result24
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result23
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result7
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result82
-rw-r--r--mysql-test/suite/galera_3nodes/suite.pm48
-rw-r--r--mysql-test/suite/galera_3nodes/t/GAL-501.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/GAL-501.test8
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test2
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test6
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_garbd.test22
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf4
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test58
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf (renamed from mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf)10
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test (renamed from mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test)22
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf10
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test48
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf10
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test2
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test2
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test2
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf8
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_pc_weight.test9
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test26
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test1
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test3
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test83
-rw-r--r--mysql-test/suite/galera_3nodes_sr/disabled.def7
-rw-r--r--mysql-test/suite/galera_3nodes_sr/galera_3nodes.cnf1
-rw-r--r--mysql-test/suite/galera_3nodes_sr/my.cnf1
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-336.result26
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-582.result23
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-606.result38
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-609.result20
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result256
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result100
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result177
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-817.result54
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-832.result26
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result80
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_join_slave.result39
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_master.result33
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply.result53
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback.result58
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result31
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result44
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split.result117
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-336.test47
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-582.test39
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-606.test80
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-609.test30
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test137
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test49
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test70
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-817.test109
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-832.test43
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test127
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test59
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test58
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply.test81
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test80
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test56
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test73
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf5
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test177
-rw-r--r--mysql-test/suite/galera_sr/disabled.def3
-rw-r--r--mysql-test/suite/galera_sr/galera_2nodes.cnf1
-rw-r--r--mysql-test/suite/galera_sr/my.cnf1
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-1008.result70
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-1018.result24
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-1018B.result12
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-1043A.result21
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-1043B.result21
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-1051.result46
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-1060.result21
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-437.result12
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-561.result50
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-571.result67
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-572.result37
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-574.result11
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-580.result13
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-585.result28
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-597.result21
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-620.result18
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-623.result29
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-627.result26
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-845.result21
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-851.result30
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-867.result4
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-889.result25
-rw-r--r--mysql-test/suite/galera_sr/r/GCF-900.result21
-rw-r--r--mysql-test/suite/galera_sr/r/galera-features#56.result32
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_bf_abort.result555
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_blob.result23
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_cc_master.result65
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result59
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_concurrent.result36
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_conflict.result21
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit.result31
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit2.result28
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_conflict_with_rollback_master.result29
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result48
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_ddl_schema.result23
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_ddl_slave.result50
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_ddl_unrelated.result42
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result46
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_fk_conflict.result39
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_gtid.result57
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_insert_select.result18
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_kill_all_nobootstrap.result29
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result30
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_kill_all_pcrecovery.result30
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_kill_connection.result32
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_kill_query.result31
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_kill_slave.result53
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_large_fragment.result33
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_load_data.result13
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_load_data_splitting.result9
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_log_bin.result124
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_many_fragments.result33
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_myisam.result16
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_mysqldump_sst.result58
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_parallel_apply.result37
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_rollback.result42
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_rollback_retry.result33
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_rollback_savepoint.result42
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_rollback_statement.result22
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_sbr.result16
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_shutdown_master.result31
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result43
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_small_gcache.result15
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_table_contents.result198
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_transaction_replay.result121
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_unit_statements.result54
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_v1_row_events.result20
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_ws_size.result36
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_ws_size2.result34
-rw-r--r--mysql-test/suite/galera_sr/r/galera_var_ignore_apply_errors_sr.result29
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep#215.result137
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#136.result65
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#138.result24
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#14.result12
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result42
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#15.result11
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result752
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#22.result35
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#27.result23
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#29.result14
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#32.result27
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#35.result41
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#8.result39
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#9.result20
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#93.result18
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#96.result33
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1008.inc36
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1008.test18
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1018.test38
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1018B.test40
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1043A.test13
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1043B.test13
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1051.test51
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-1060.test9
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-437.test21
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-561.test65
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-571.test54
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-572.test54
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-574.test27
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-580.test27
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-585.test44
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-597.test29
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-620.test22
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-623.test31
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-627.test30
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-845.test30
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-851.test24
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-867.test42
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-889.test29
-rw-r--r--mysql-test/suite/galera_sr/t/GCF-900.test28
-rw-r--r--mysql-test/suite/galera_sr/t/galera-features#56.test55
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_bf_abort.inc145
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_bf_abort.test50
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_blob.test38
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_cc_master.test98
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test97
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_concurrent.test45
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_conflict.test45
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit.test45
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit2.test46
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_conflict_with_rollback_master.test44
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test63
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_ddl_schema.test43
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_ddl_slave.test65
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_ddl_unrelated.test53
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test59
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_fk_conflict.test62
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt1
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_gtid.test46
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_insert_select.test33
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_all_nobootstrap.test52
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf4
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test53
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_all_pcrecovery.test54
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_connection.test59
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_query.test48
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf4
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_slave.test80
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_large_fragment-master.opt1
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test58
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_load_data.test39
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_load_data_splitting.test50
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_log_bin-master.opt1
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_log_bin.test70
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test53
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_myisam.test29
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf11
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test79
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_parallel_apply.test59
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_rollback.test76
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test55
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_rollback_savepoint.test51
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test61
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_sbr.test31
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_shutdown_master.test53
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test63
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf6
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_small_gcache.test21
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_table_contents.test49
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_transaction_replay.test260
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_unit_statements.test54
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_v1_row_events-master.opt1
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_v1_row_events.test27
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_ws_size.test70
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_ws_size2.test62
-rw-r--r--mysql-test/suite/galera_sr/t/galera_var_ignore_apply_errors_sr.test38
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep#215.test175
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#136-master.opt1
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#136.test41
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#138.test25
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test21
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test60
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#15.test17
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc104
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.test41
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test47
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#27.test29
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#29.test23
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#32-master.opt1
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#32.test44
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#35.test48
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#8.test63
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#9.test44
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#93.test29
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test45
-rw-r--r--mysql-test/suite/gcol/r/gcol_bugfixes.result2
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_innodb.result8
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_myisam.result6
-rw-r--r--mysql-test/suite/gcol/r/gcol_select_innodb.result7
-rw-r--r--mysql-test/suite/gcol/r/gcol_select_myisam.result11
-rw-r--r--mysql-test/suite/gcol/r/gcol_view_innodb.result1
-rw-r--r--mysql-test/suite/gcol/r/gcol_view_myisam.result1
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result9
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_index.result22
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test9
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_index.test19
-rw-r--r--mysql-test/suite/handler/aria.result4
-rw-r--r--mysql-test/suite/handler/heap.result5
-rw-r--r--mysql-test/suite/handler/innodb.result4
-rw-r--r--mysql-test/suite/handler/interface.result6
-rw-r--r--mysql-test/suite/handler/interface.test6
-rw-r--r--mysql-test/suite/handler/myisam.result4
-rw-r--r--mysql-test/suite/innodb/include/alter_instant.inc33
-rw-r--r--mysql-test/suite/innodb/include/crc32.pl33
-rw-r--r--mysql-test/suite/innodb/r/alter_candidate_key.result114
-rw-r--r--mysql-test/suite/innodb/r/alter_inplace_perfschema.result9
-rw-r--r--mysql-test/suite/innodb/r/analyze_table.result1
-rw-r--r--mysql-test/suite/innodb/r/data_types.result23
-rw-r--r--mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff11
-rw-r--r--mysql-test/suite/innodb/r/default_row_format_create.result22
-rw-r--r--mysql-test/suite/innodb/r/innochecksum.result5
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-debug.result23
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-table.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter.result35
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online.result7
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result48
-rw-r--r--mysql-test/suite/innodb/r/innodb-online-alter-gis.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-table-online.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb-update-insert.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-virtual-columns.result13
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-debug.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_28867993.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14676111.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug30423.result11
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug53046.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug57252.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result15
-rw-r--r--mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_drop_locked.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_fetch.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_persistent.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_zip_innochecksum.result91
-rw-r--r--mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result160
-rw-r--r--mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result227
-rw-r--r--mysql-test/suite/innodb/r/instant_alter.result635
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_bugs.result130
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_crash.result30
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_debug.result40
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_null.result56
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff18
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_purge.result46
-rw-r--r--mysql-test/suite/innodb/r/instant_drop.result27
-rw-r--r--mysql-test/suite/innodb/r/instant_varchar_enlarge.result9
-rw-r--r--mysql-test/suite/innodb/r/monitor.result1
-rw-r--r--mysql-test/suite/innodb/r/purge_secondary.result1
-rw-r--r--mysql-test/suite/innodb/r/table_flags.result5
-rw-r--r--mysql-test/suite/innodb/r/truncate.result33
-rw-r--r--mysql-test/suite/innodb/r/undo_truncate_recover.result1
-rw-r--r--mysql-test/suite/innodb/t/alter_candidate_key.test72
-rw-r--r--mysql-test/suite/innodb/t/alter_inplace_perfschema.test8
-rw-r--r--mysql-test/suite/innodb/t/data_types.test22
-rw-r--r--mysql-test/suite/innodb/t/default_row_format_create.test20
-rw-r--r--mysql-test/suite/innodb/t/innochecksum.test32
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-debug.test32
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter.test18
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test55
-rw-r--r--mysql-test/suite/innodb/t/innodb-table-online.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-virtual-columns.test11
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug.test14
-rw-r--r--mysql-test/suite/innodb/t/innodb_28867993.test12
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum.test239
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test118
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test406
-rw-r--r--mysql-test/suite/innodb/t/instant_alter.test236
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_bugs.test138
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_crash.test10
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_debug.test40
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_null.test57
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_purge.test75
-rw-r--r--mysql-test/suite/innodb/t/instant_drop.test14
-rw-r--r--mysql-test/suite/innodb/t/instant_varchar_enlarge.test8
-rw-r--r--mysql-test/suite/innodb/t/log_file_name_debug.test4
-rw-r--r--mysql-test/suite/innodb/t/purge_thread_shutdown.test4
-rw-r--r--mysql-test/suite/innodb/t/recovery_shutdown.test6
-rw-r--r--mysql-test/suite/innodb/t/table_flags.test6
-rw-r--r--mysql-test/suite/innodb/t/truncate.test35
-rw-r--r--mysql-test/suite/innodb/t/undo_truncate_recover.test4
-rw-r--r--mysql-test/suite/innodb_fts/r/create.result20
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result11
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb-fts-fic.result2
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result4
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result4
-rw-r--r--mysql-test/suite/innodb_fts/t/create.test16
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test10
-rw-r--r--mysql-test/suite/innodb_gis/r/1.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/alter_spatial_index.result9
-rw-r--r--mysql-test/suite/innodb_gis/r/create_spatial_index.result3
-rw-r--r--mysql-test/suite/innodb_gis/r/gis.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result1
-rw-r--r--mysql-test/suite/innodb_gis/r/rt_precise.result1
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_estimate.result1
-rw-r--r--mysql-test/suite/innodb_zip/r/innodb-zip.result4
-rw-r--r--mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result6
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum.test4
-rw-r--r--mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test14
-rw-r--r--mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result4
-rw-r--r--mysql-test/suite/maria/icp.result2
-rw-r--r--mysql-test/suite/maria/maria-autozerofill.result1
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-dynamic.result1
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-trans.result1
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree.result1
-rw-r--r--mysql-test/suite/maria/maria.result9
-rw-r--r--mysql-test/suite/maria/maria3.result2
-rw-r--r--mysql-test/suite/maria/system_tables.result1
-rw-r--r--mysql-test/suite/maria/system_tables.test4
-rw-r--r--mysql-test/suite/mariabackup/backup_grants.result5
-rw-r--r--mysql-test/suite/mariabackup/backup_grants.test30
-rw-r--r--mysql-test/suite/mariabackup/drop_table_during_backup.result5
-rw-r--r--mysql-test/suite/mariabackup/drop_table_during_backup.test9
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_compressed.opt6
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_compressed.result7
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_compressed.test48
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_corruption.opt6
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_corruption.result8
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_corruption.test70
-rw-r--r--mysql-test/suite/mariabackup/huge_lsn.opt4
-rw-r--r--mysql-test/suite/mariabackup/partition_partial.opt1
-rw-r--r--mysql-test/suite/mariabackup/partition_partial.result31
-rw-r--r--mysql-test/suite/mariabackup/partition_partial.test44
-rw-r--r--mysql-test/suite/mariabackup/rename_during_backup.result9
-rw-r--r--mysql-test/suite/mariabackup/rename_during_backup.test7
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.result11
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.test50
-rw-r--r--mysql-test/suite/mariabackup/xb_aws_key_management.result5
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result56
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result16
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_innodb.result32
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_myisam.result16
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_2_innodb.result80
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_2_myisam.result32
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result40
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result40
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_maria.result48
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_myisam.result48
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result40
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result40
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_maria.result48
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_myisam.result48
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_innodb.result216
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_myisam.result216
-rw-r--r--mysql-test/suite/parts/r/partition_basic_innodb.result64
-rw-r--r--mysql-test/suite/parts/r/partition_basic_myisam.result32
-rw-r--r--mysql-test/suite/parts/r/partition_basic_symlink_myisam.result39
-rw-r--r--mysql-test/suite/parts/r/partition_engine_innodb.result11
-rw-r--r--mysql-test/suite/parts/r/partition_engine_myisam.result11
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc0_memory.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc1_memory.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc2_memory.result1
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result1
-rw-r--r--mysql-test/suite/parts/r/partition_repair_myisam.result3
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_instruments.result4
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate.result412
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a.result344
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result268
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result272
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result196
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_h.result336
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_u.result340
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result264
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result4
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result4
-rw-r--r--mysql-test/suite/perfschema/r/privilege_table_io.result12
-rw-r--r--mysql-test/suite/perfschema/r/setup_instruments_defaults.result1
-rw-r--r--mysql-test/suite/perfschema/r/socket_connect.result13
-rw-r--r--mysql-test/suite/perfschema/r/stage_mdl_global.result2
-rw-r--r--mysql-test/suite/perfschema/t/socket_connect.test9
-rw-r--r--mysql-test/suite/perfschema/t/stage_mdl_global.test4
-rw-r--r--mysql-test/suite/plugins/r/audit_null.result6
-rw-r--r--mysql-test/suite/plugins/r/auth_ed25519.result2
-rw-r--r--mysql-test/suite/plugins/r/cracklib_password_check.result2
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_load.result2
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_send.result2
-rw-r--r--mysql-test/suite/plugins/r/max_password_errors_auth_named_pipe.result12
-rw-r--r--mysql-test/suite/plugins/r/max_password_errors_auth_socket.result12
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result22
-rw-r--r--mysql-test/suite/plugins/r/show_all_plugins.result4
-rw-r--r--mysql-test/suite/plugins/r/simple_password_check.result4
-rw-r--r--mysql-test/suite/plugins/r/sql_error_log.result4
-rw-r--r--mysql-test/suite/plugins/r/thread_pool_server_audit.result22
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_load.test4
-rw-r--r--mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.opt1
-rw-r--r--mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.test22
-rw-r--r--mysql-test/suite/plugins/t/max_password_errors_auth_socket.opt1
-rw-r--r--mysql-test/suite/plugins/t/max_password_errors_auth_socket.test23
-rw-r--r--mysql-test/suite/plugins/t/simple_password_check.test2
-rw-r--r--mysql-test/suite/roles/create_and_drop_role.result6
-rw-r--r--mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result1
-rw-r--r--mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test7
-rw-r--r--mysql-test/suite/roles/default_create_user_not_role.result2
-rw-r--r--mysql-test/suite/roles/flush_roles-17898.result9
-rw-r--r--mysql-test/suite/roles/flush_roles-17898.test12
-rw-r--r--mysql-test/suite/roles/grant_revoke_current.result3
-rw-r--r--mysql-test/suite/roles/grant_revoke_current.test5
-rw-r--r--mysql-test/suite/roles/grant_role_auto_create_user.result2
-rw-r--r--mysql-test/suite/roles/i_s_applicable_roles_is_default.result1
-rw-r--r--mysql-test/suite/roles/i_s_applicable_roles_is_default.test2
-rw-r--r--mysql-test/suite/roles/none_public.result12
-rw-r--r--mysql-test/suite/roles/none_public.test6
-rw-r--r--mysql-test/suite/roles/prepare_stmt_with_role.result6
-rw-r--r--mysql-test/suite/roles/rename_user.result2
-rw-r--r--mysql-test/suite/roles/role_case_sensitive-10744.result2
-rw-r--r--mysql-test/suite/roles/set_default_role_clear.result8
-rw-r--r--mysql-test/suite/roles/set_default_role_for.result13
-rw-r--r--mysql-test/suite/roles/set_default_role_for.test3
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid.result6
-rw-r--r--mysql-test/suite/roles/set_default_role_new_connection.result10
-rw-r--r--mysql-test/suite/roles/set_default_role_ps-6960.result3
-rw-r--r--mysql-test/suite/roles/set_default_role_ps-6960.test7
-rw-r--r--mysql-test/suite/roles/set_role-database-recursive.result2
-rw-r--r--mysql-test/suite/roles/set_role-database-simple.result2
-rw-r--r--mysql-test/suite/roles/set_role-recursive.result2
-rw-r--r--mysql-test/suite/roles/set_role-routine-simple.result2
-rw-r--r--mysql-test/suite/roles/set_role-simple.result2
-rw-r--r--mysql-test/suite/roles/set_role-table-column-priv.result2
-rw-r--r--mysql-test/suite/roles/set_role-table-simple.result2
-rw-r--r--mysql-test/suite/roles/show_grants.result2
-rw-r--r--mysql-test/suite/roles/show_grants_replicated.result2
-rw-r--r--mysql-test/suite/rpl/disabled.def1
-rw-r--r--mysql-test/suite/rpl/include/rpl_EE_err.test2
-rw-r--r--mysql-test/suite/rpl/include/rpl_row_001.test96
-rw-r--r--mysql-test/suite/rpl/include/rpl_row_annotate.test2
-rw-r--r--mysql-test/suite/rpl/include/rpl_row_delayed_ins.test2
-rw-r--r--mysql-test/suite/rpl/r/rpl_EE_err.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug31076.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_drop_user.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_if_not_exists.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_ddl.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_do_grant.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_grant.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_mdev4484.result40
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_stop_start.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_idempotency.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_revoke.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_table.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result45
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result23
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_optimistic.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_rewrt_db.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_001.result42
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_annotate_do.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_annotate_dont.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff31
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_big_table_id.result46
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_delayed_ins.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_000001.result33
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_temporal_round.result50
-rw-r--r--mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_user.result11
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test30
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_crash.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test68
-rw-r--r--mysql-test/suite/rpl/t/rpl_idempotency.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test58
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test62
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_optimistic.test42
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_001.test48
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_big_table_id.test57
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_000001.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporal_round.test35
-rw-r--r--mysql-test/suite/rpl/t/rpl_user.test11
-rw-r--r--mysql-test/suite/storage_engine/type_bool.result4
-rw-r--r--mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result1
-rw-r--r--mysql-test/suite/sys_vars/r/myisam_stats_method_func.result6
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_use_condition_selectivity_basic.result20
-rw-r--r--mysql-test/suite/sys_vars/r/sql_mode_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result44
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result58
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result58
-rw-r--r--mysql-test/suite/sys_vars/r/table_definition_cache_basic.result16
-rw-r--r--mysql-test/suite/sys_vars/r/use_stat_tables_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result15
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/sql_mode_basic.test8
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_aria.test1
-rw-r--r--mysql-test/suite/sys_vars/t/table_definition_cache_basic.test6
-rw-r--r--mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test2
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test16
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test5
-rw-r--r--mysql-test/suite/vcol/r/update.result4
-rw-r--r--mysql-test/suite/vcol/r/update_binlog.result8
-rw-r--r--mysql-test/suite/vcol/r/upgrade.result16
-rw-r--r--mysql-test/suite/vcol/r/vcol_keys_myisam.result1
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result28
-rw-r--r--mysql-test/suite/vcol/t/update.test4
-rw-r--r--mysql-test/suite/vcol/t/upgrade.test15
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test27
-rw-r--r--mysql-test/suite/versioning/r/alter.result2
-rw-r--r--mysql-test/suite/versioning/r/cte.result2
-rw-r--r--mysql-test/suite/versioning/r/foreign.result9
-rw-r--r--mysql-test/suite/versioning/r/online.result28
-rw-r--r--mysql-test/suite/versioning/r/sysvars.result15
-rw-r--r--mysql-test/suite/versioning/t/alter.test2
-rw-r--r--mysql-test/suite/versioning/t/foreign.test14
-rw-r--r--mysql-test/suite/versioning/t/online.test44
-rw-r--r--mysql-test/suite/versioning/t/sysvars.test10
-rw-r--r--mysql-test/suite/wsrep/disabled.def3
-rw-r--r--mysql-test/suite/wsrep/my.cnf4
-rw-r--r--mysql-test/suite/wsrep/r/variables.result3
-rw-r--r--mysql-test/suite/wsrep/r/wsrep-recover,binlogon.rdiff28
-rw-r--r--mysql-test/suite/wsrep/r/wsrep-recover.result66
-rw-r--r--mysql-test/suite/wsrep/suite.pm4
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.opt1
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.test1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_10186.cnf6
-rw-r--r--mysql-test/suite/wsrep/t/mdev_10186.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_10186.test1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_6832.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/mdev_6832.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_6832.test1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.test1
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.opt1
-rw-r--r--mysql-test/suite/wsrep/t/variables.test6
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover-step.inc41
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover.cnf9
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover.combinations4
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover.test204
-rw-r--r--mysys/mf_iocache.c12
-rw-r--r--mysys/safemalloc.c4
-rw-r--r--mysys/thr_alarm.c6
-rw-r--r--plugin/feedback/sender_thread.cc11
-rw-r--r--plugin/handler_socket/handlersocket/database.cpp6
-rw-r--r--plugin/metadata_lock_info/metadata_lock_info.cc29
-rw-r--r--plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result3
-rw-r--r--plugin/query_response_time/query_response_time.cc39
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/my.cnf7
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result10
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/suite.pm4
-rw-r--r--plugin/wsrep_info/plugin.cc87
-rw-r--r--scripts/CMakeLists.txt6
-rwxr-xr-xscripts/galera_new_cluster.sh2
-rw-r--r--scripts/mysql_install_db.sh7
-rw-r--r--scripts/mysql_secure_installation.sh6
-rw-r--r--scripts/mysql_system_tables.sql63
-rw-r--r--scripts/mysql_system_tables_data.sql26
-rw-r--r--scripts/mysql_system_tables_fix.sql76
-rw-r--r--scripts/mysql_test_db.sql4
-rw-r--r--scripts/mysqld_safe.sh11
-rw-r--r--scripts/mytop.sh19
-rwxr-xr-xscripts/wsrep_sst_common.sh6
-rw-r--r--scripts/wsrep_sst_mariabackup.sh155
-rw-r--r--scripts/wsrep_sst_mysqldump.sh5
-rw-r--r--scripts/wsrep_sst_rsync.sh27
-rw-r--r--scripts/wsrep_sst_xtrabackup-v2.sh1260
-rw-r--r--scripts/wsrep_sst_xtrabackup.sh692
-rw-r--r--sql-common/my_time.c515
-rw-r--r--sql/CMakeLists.txt25
-rw-r--r--sql/backup.cc385
-rw-r--r--sql/backup.h34
-rw-r--r--sql/compat56.cc21
-rw-r--r--sql/compat56.h9
-rw-r--r--sql/event_data_objects.cc34
-rw-r--r--sql/event_parse_data.cc14
-rw-r--r--sql/event_scheduler.cc24
-rw-r--r--sql/field.cc454
-rw-r--r--sql/field.h86
-rw-r--r--sql/field_conv.cc33
-rw-r--r--sql/filesort.cc115
-rw-r--r--sql/filesort.h3
-rw-r--r--sql/gen_lex_token.cc8
-rw-r--r--sql/ha_partition.cc9
-rw-r--r--sql/ha_partition.h4
-rw-r--r--sql/ha_sequence.cc2
-rw-r--r--sql/handle_connections_win.cc4
-rw-r--r--sql/handler.cc386
-rw-r--r--sql/handler.h49
-rw-r--r--sql/init.h1
-rw-r--r--sql/innodb_priv.h4
-rw-r--r--sql/item.cc217
-rw-r--r--sql/item.h300
-rw-r--r--sql/item_cmpfunc.cc228
-rw-r--r--sql/item_cmpfunc.h46
-rw-r--r--sql/item_create.cc101
-rw-r--r--sql/item_func.cc68
-rw-r--r--sql/item_func.h26
-rw-r--r--sql/item_inetfunc.cc544
-rw-r--r--sql/item_inetfunc.h60
-rw-r--r--sql/item_jsonfunc.cc9
-rw-r--r--sql/item_strfunc.cc107
-rw-r--r--sql/item_strfunc.h51
-rw-r--r--sql/item_subselect.cc26
-rw-r--r--sql/item_subselect.h1
-rw-r--r--sql/item_sum.cc28
-rw-r--r--sql/item_sum.h15
-rw-r--r--sql/item_timefunc.cc190
-rw-r--r--sql/item_timefunc.h54
-rw-r--r--sql/item_vers.cc4
-rw-r--r--sql/lex.h41
-rw-r--r--sql/lock.cc183
-rw-r--r--sql/log.cc130
-rw-r--r--sql/log.h17
-rw-r--r--sql/log_event.cc152
-rw-r--r--sql/log_event.h53
-rw-r--r--sql/mdl.cc626
-rw-r--r--sql/mdl.h123
-rw-r--r--sql/my_decimal.cc4
-rw-r--r--sql/my_decimal.h3
-rw-r--r--sql/mysql_install_db.cc14
-rw-r--r--sql/mysql_upgrade_service.cc189
-rw-r--r--sql/mysqld.cc1250
-rw-r--r--sql/mysqld.h28
-rw-r--r--sql/opt_range.cc14
-rw-r--r--sql/partition_info.cc21
-rw-r--r--sql/partition_info.h1
-rw-r--r--sql/protocol.cc22
-rw-r--r--sql/rpl_gtid.cc413
-rw-r--r--sql/rpl_gtid.h12
-rw-r--r--sql/rpl_mi.cc4
-rw-r--r--sql/rpl_mi.h6
-rw-r--r--sql/rpl_parallel.cc4
-rw-r--r--sql/rpl_record.cc3
-rw-r--r--sql/rpl_rli.cc87
-rw-r--r--sql/rpl_rli.h11
-rw-r--r--sql/semisync_master_ack_receiver.cc61
-rw-r--r--sql/semisync_master_ack_receiver.h147
-rw-r--r--sql/service_wsrep.cc255
-rw-r--r--sql/share/errmsg-utf8.txt16
-rw-r--r--sql/slave.cc197
-rw-r--r--sql/slave.h1
-rw-r--r--sql/sp.cc7
-rw-r--r--sql/sp.h3
-rw-r--r--sql/sp_head.cc58
-rw-r--r--sql/sp_pcontext.cc13
-rw-r--r--sql/sp_pcontext.h8
-rw-r--r--sql/sp_rcontext.cc27
-rw-r--r--sql/sql_acl.cc2332
-rw-r--r--sql/sql_admin.cc2
-rw-r--r--sql/sql_alter.cc2
-rw-r--r--sql/sql_array.h10
-rw-r--r--sql/sql_base.cc661
-rw-r--r--sql/sql_base.h23
-rw-r--r--sql/sql_basic_types.h265
-rw-r--r--sql/sql_cache.cc4
-rw-r--r--sql/sql_class.cc259
-rw-r--r--sql/sql_class.h423
-rw-r--r--sql/sql_cmd.h1
-rw-r--r--sql/sql_connect.cc32
-rw-r--r--sql/sql_const.h12
-rw-r--r--sql/sql_cursor.cc5
-rw-r--r--sql/sql_db.cc11
-rw-r--r--sql/sql_db.h3
-rw-r--r--sql/sql_delete.cc4
-rw-r--r--sql/sql_handler.cc14
-rw-r--r--sql/sql_handler.h1
-rw-r--r--sql/sql_insert.cc183
-rw-r--r--sql/sql_lex.cc167
-rw-r--r--sql/sql_lex.h31
-rw-r--r--sql/sql_load.cc11
-rw-r--r--sql/sql_parse.cc935
-rw-r--r--sql/sql_parse.h3
-rw-r--r--sql/sql_partition.cc2
-rw-r--r--sql/sql_plugin.cc30
-rw-r--r--sql/sql_plugin_services.ic59
-rw-r--r--sql/sql_prepare.cc60
-rw-r--r--sql/sql_reload.cc59
-rw-r--r--sql/sql_repl.cc123
-rw-r--r--sql/sql_select.cc121
-rw-r--r--sql/sql_show.cc531
-rw-r--r--sql/sql_signal.cc10
-rw-r--r--sql/sql_sort.h1
-rw-r--r--sql/sql_statistics.cc98
-rw-r--r--sql/sql_statistics.h28
-rw-r--r--sql/sql_string.cc176
-rw-r--r--sql/sql_string.h956
-rw-r--r--sql/sql_table.cc197
-rw-r--r--sql/sql_time.cc74
-rw-r--r--sql/sql_time.h22
-rw-r--r--sql/sql_trigger.cc9
-rw-r--r--sql/sql_trigger.h3
-rw-r--r--sql/sql_truncate.cc2
-rw-r--r--sql/sql_type.cc716
-rw-r--r--sql/sql_type.h1145
-rw-r--r--sql/sql_type_int.h44
-rw-r--r--sql/sql_udf.cc3
-rw-r--r--sql/sql_udf.h15
-rw-r--r--sql/sql_union.cc7
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/sql_yacc.yy686
-rw-r--r--sql/sql_yacc_ora.yy664
-rw-r--r--sql/structs.h41
-rw-r--r--sql/sys_vars.cc84
-rw-r--r--sql/sys_vars.ic7
-rw-r--r--sql/table.cc29
-rw-r--r--sql/table.h58
-rw-r--r--sql/table_cache.cc32
-rw-r--r--sql/table_cache.h2
-rw-r--r--sql/temporary_tables.cc50
-rw-r--r--sql/threadpool_common.cc2
-rw-r--r--sql/threadpool_generic.cc52
-rw-r--r--sql/transaction.cc56
-rw-r--r--sql/udf_example.c139
-rw-r--r--sql/udf_example.def7
-rw-r--r--sql/unireg.h2
-rw-r--r--sql/upgrade_conf_file.cc177
-rw-r--r--sql/vers_string.h6
-rw-r--r--sql/vers_utils.h39
-rw-r--r--sql/wsrep_applier.cc320
-rw-r--r--sql/wsrep_applier.h67
-rw-r--r--sql/wsrep_binlog.cc341
-rw-r--r--sql/wsrep_binlog.h35
-rw-r--r--sql/wsrep_check_opts.cc4
-rw-r--r--sql/wsrep_client_service.cc307
-rw-r--r--sql/wsrep_client_service.h63
-rw-r--r--sql/wsrep_client_state.h47
-rw-r--r--sql/wsrep_condition_variable.h54
-rw-r--r--sql/wsrep_dummy.cc112
-rw-r--r--sql/wsrep_high_priority_service.cc649
-rw-r--r--sql/wsrep_high_priority_service.h118
-rw-r--r--sql/wsrep_hton.cc658
-rw-r--r--sql/wsrep_mutex.h50
-rw-r--r--sql/wsrep_mysqld.cc2590
-rw-r--r--sql/wsrep_mysqld.h394
-rw-r--r--sql/wsrep_notify.cc77
-rw-r--r--sql/wsrep_plugin.cc53
-rw-r--r--sql/wsrep_priv.h24
-rw-r--r--sql/wsrep_schema.cc1360
-rw-r--r--sql/wsrep_schema.h161
-rw-r--r--sql/wsrep_server_service.cc318
-rw-r--r--sql/wsrep_server_service.h81
-rw-r--r--sql/wsrep_server_state.cc82
-rw-r--r--sql/wsrep_server_state.h66
-rw-r--r--sql/wsrep_sst.cc621
-rw-r--r--sql/wsrep_sst.h33
-rw-r--r--sql/wsrep_storage_service.cc238
-rw-r--r--sql/wsrep_storage_service.h48
-rw-r--r--sql/wsrep_thd.cc787
-rw-r--r--sql/wsrep_thd.h216
-rw-r--r--sql/wsrep_trans_observer.h423
-rw-r--r--sql/wsrep_types.h29
-rw-r--r--sql/wsrep_utils.cc104
-rw-r--r--sql/wsrep_utils.h79
-rw-r--r--sql/wsrep_var.cc324
-rw-r--r--sql/wsrep_var.h11
-rw-r--r--sql/wsrep_xid.cc118
-rw-r--r--sql/wsrep_xid.h14
-rw-r--r--storage/archive/azio.c5
-rw-r--r--storage/archive/ha_archive.cc14
-rw-r--r--storage/archive/ha_archive.h3
-rw-r--r--storage/blackhole/ha_blackhole.h2
-rw-r--r--storage/connect/global.h6
-rw-r--r--storage/connect/ha_connect.cc4
-rw-r--r--storage/connect/jsonudf.cpp12
-rw-r--r--storage/connect/mysql-test/connect/r/dir.result2
-rw-r--r--storage/connect/mysql-test/connect/r/jdbc.result13
-rw-r--r--storage/connect/mysql-test/connect/r/jdbc_oracle.result18
-rw-r--r--storage/connect/mysql-test/connect/r/jdbc_postgresql.result8
-rw-r--r--storage/connect/mysql-test/connect/r/xml2.result2
-rw-r--r--storage/connect/plugutil.cpp28
-rw-r--r--storage/connect/reldef.cpp11
-rw-r--r--storage/connect/tabfmt.h2
-rw-r--r--storage/connect/tabjson.cpp10
-rw-r--r--storage/connect/tabjson.h6
-rw-r--r--storage/connect/tabodbc.cpp317
-rw-r--r--storage/connect/tabxml.cpp13
-rw-r--r--storage/connect/tabxml.h5
-rw-r--r--storage/connect/user_connect.cc4
-rw-r--r--storage/csv/ha_tina.cc28
-rw-r--r--storage/csv/ha_tina.h2
-rw-r--r--storage/federated/ha_federated.h1
-rw-r--r--storage/federatedx/TODO30
-rw-r--r--storage/federatedx/ha_federatedx.h2
-rw-r--r--storage/heap/ha_heap.h2
-rw-r--r--storage/innobase/CMakeLists.txt6
-rw-r--r--storage/innobase/btr/btr0btr.cc142
-rw-r--r--storage/innobase/btr/btr0bulk.cc9
-rw-r--r--storage/innobase/btr/btr0cur.cc231
-rw-r--r--storage/innobase/btr/btr0defragment.cc25
-rw-r--r--storage/innobase/btr/btr0pcur.cc32
-rw-r--r--storage/innobase/btr/btr0scrub.cc8
-rw-r--r--storage/innobase/btr/btr0sea.cc8
-rw-r--r--storage/innobase/buf/buf0buf.cc470
-rw-r--r--storage/innobase/buf/buf0checksum.cc55
-rw-r--r--storage/innobase/buf/buf0dblwr.cc42
-rw-r--r--storage/innobase/buf/buf0dump.cc6
-rw-r--r--storage/innobase/buf/buf0flu.cc163
-rw-r--r--storage/innobase/buf/buf0lru.cc3
-rw-r--r--storage/innobase/buf/buf0rea.cc2
-rw-r--r--storage/innobase/data/data0data.cc7
-rw-r--r--storage/innobase/data/data0type.cc2
-rw-r--r--storage/innobase/dict/dict0boot.cc44
-rw-r--r--storage/innobase/dict/dict0crea.cc28
-rw-r--r--storage/innobase/dict/dict0defrag_bg.cc5
-rw-r--r--storage/innobase/dict/dict0dict.cc224
-rw-r--r--storage/innobase/dict/dict0load.cc5
-rw-r--r--storage/innobase/dict/dict0mem.cc73
-rw-r--r--storage/innobase/dict/dict0stats.cc8
-rw-r--r--storage/innobase/dict/dict0stats_bg.cc1
-rw-r--r--storage/innobase/fil/fil0crypt.cc185
-rw-r--r--storage/innobase/fil/fil0fil.cc525
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc9
-rw-r--r--storage/innobase/fsp/fsp0file.cc5
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc5
-rw-r--r--storage/innobase/fsp/fsp0space.cc16
-rw-r--r--storage/innobase/fsp/fsp0sysspace.cc20
-rw-r--r--storage/innobase/fts/fts0ast.cc2
-rw-r--r--storage/innobase/fts/fts0fts.cc107
-rw-r--r--storage/innobase/fts/fts0opt.cc2
-rw-r--r--storage/innobase/fts/fts0que.cc3
-rw-r--r--storage/innobase/gis/gis0rtree.cc14
-rw-r--r--storage/innobase/gis/gis0sea.cc15
-rw-r--r--storage/innobase/ha/ha0ha.cc20
-rw-r--r--storage/innobase/ha/ha0storage.cc1
-rw-r--r--storage/innobase/handler/ha_innodb.cc993
-rw-r--r--storage/innobase/handler/ha_innodb.h51
-rw-r--r--storage/innobase/handler/handler0alter.cc665
-rw-r--r--storage/innobase/handler/i_s.cc5
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc51
-rw-r--r--storage/innobase/include/btr0btr.h30
-rw-r--r--storage/innobase/include/btr0bulk.h7
-rw-r--r--storage/innobase/include/btr0cur.h3
-rw-r--r--storage/innobase/include/btr0defragment.h6
-rw-r--r--storage/innobase/include/btr0pcur.h5
-rw-r--r--storage/innobase/include/btr0scrub.h6
-rw-r--r--storage/innobase/include/btr0sea.h5
-rw-r--r--storage/innobase/include/btr0types.h5
-rw-r--r--storage/innobase/include/buf0buddy.h6
-rw-r--r--storage/innobase/include/buf0buddy.ic10
-rw-r--r--storage/innobase/include/buf0buf.h94
-rw-r--r--storage/innobase/include/buf0buf.ic63
-rw-r--r--storage/innobase/include/buf0checksum.h19
-rw-r--r--storage/innobase/include/buf0dblwr.h1
-rw-r--r--storage/innobase/include/buf0flu.h13
-rw-r--r--storage/innobase/include/buf0flu.ic79
-rw-r--r--storage/innobase/include/buf0lru.h1
-rw-r--r--storage/innobase/include/buf0rea.h2
-rw-r--r--storage/innobase/include/data0data.h2
-rw-r--r--storage/innobase/include/dict0boot.h17
-rw-r--r--storage/innobase/include/dict0crea.h11
-rw-r--r--storage/innobase/include/dict0defrag_bg.h5
-rw-r--r--storage/innobase/include/dict0dict.h185
-rw-r--r--storage/innobase/include/dict0dict.ic154
-rw-r--r--storage/innobase/include/dict0load.h2
-rw-r--r--storage/innobase/include/dict0mem.h215
-rw-r--r--storage/innobase/include/dict0priv.h14
-rw-r--r--storage/innobase/include/dict0priv.ic35
-rw-r--r--storage/innobase/include/dict0stats.h2
-rw-r--r--storage/innobase/include/dict0stats.ic1
-rw-r--r--storage/innobase/include/dict0stats_bg.h2
-rw-r--r--storage/innobase/include/dyn0buf.h3
-rw-r--r--storage/innobase/include/eval0eval.h1
-rw-r--r--storage/innobase/include/eval0proc.h1
-rw-r--r--storage/innobase/include/fil0crypt.h13
-rw-r--r--storage/innobase/include/fil0fil.h130
-rw-r--r--storage/innobase/include/fsp0file.h5
-rw-r--r--storage/innobase/include/fsp0fsp.h12
-rw-r--r--storage/innobase/include/fsp0space.h2
-rw-r--r--storage/innobase/include/fsp0sysspace.h1
-rw-r--r--storage/innobase/include/fsp0types.h6
-rw-r--r--storage/innobase/include/fts0ast.h1
-rw-r--r--storage/innobase/include/fts0fts.h18
-rw-r--r--storage/innobase/include/fts0plugin.h2
-rw-r--r--storage/innobase/include/fts0priv.h1
-rw-r--r--storage/innobase/include/fts0types.h1
-rw-r--r--storage/innobase/include/fts0types.ic29
-rw-r--r--storage/innobase/include/fut0fut.h3
-rw-r--r--storage/innobase/include/fut0lst.h11
-rw-r--r--storage/innobase/include/fut0lst.ic2
-rw-r--r--storage/innobase/include/gis0rtree.h18
-rw-r--r--storage/innobase/include/gis0type.h11
-rw-r--r--storage/innobase/include/ha0ha.h2
-rw-r--r--storage/innobase/include/ha0storage.ic2
-rw-r--r--storage/innobase/include/hash0hash.h1
-rw-r--r--storage/innobase/include/ib0mutex.h127
-rw-r--r--storage/innobase/include/ibuf0ibuf.h2
-rw-r--r--storage/innobase/include/ibuf0ibuf.ic7
-rw-r--r--storage/innobase/include/lock0iter.h1
-rw-r--r--storage/innobase/include/lock0lock.h2
-rw-r--r--storage/innobase/include/lock0prdt.h1
-rw-r--r--storage/innobase/include/lock0priv.h1
-rw-r--r--storage/innobase/include/lock0types.h1
-rw-r--r--storage/innobase/include/log0log.h9
-rw-r--r--storage/innobase/include/log0recv.h2
-rw-r--r--storage/innobase/include/mach0data.h4
-rw-r--r--storage/innobase/include/mem0mem.h102
-rw-r--r--storage/innobase/include/mem0mem.ic2
-rw-r--r--storage/innobase/include/mtr0log.h1
-rw-r--r--storage/innobase/include/mtr0mtr.h1
-rw-r--r--storage/innobase/include/mtr0mtr.ic2
-rw-r--r--storage/innobase/include/os0file.ic2
-rw-r--r--storage/innobase/include/os0proc.h2
-rw-r--r--storage/innobase/include/os0thread.h2
-rw-r--r--storage/innobase/include/page0cur.h3
-rw-r--r--storage/innobase/include/page0cur.ic5
-rw-r--r--storage/innobase/include/page0page.h33
-rw-r--r--storage/innobase/include/page0page.ic13
-rw-r--r--storage/innobase/include/page0size.h1
-rw-r--r--storage/innobase/include/page0types.h2
-rw-r--r--storage/innobase/include/page0zip.h30
-rw-r--r--storage/innobase/include/page0zip.ic10
-rw-r--r--storage/innobase/include/pars0opt.h2
-rw-r--r--storage/innobase/include/pars0pars.h1
-rw-r--r--storage/innobase/include/pars0sym.h2
-rw-r--r--storage/innobase/include/que0que.h2
-rw-r--r--storage/innobase/include/que0types.h1
-rw-r--r--storage/innobase/include/read0types.h37
-rw-r--r--storage/innobase/include/rem0cmp.h6
-rw-r--r--storage/innobase/include/rem0cmp.ic1
-rw-r--r--storage/innobase/include/rem0rec.h1
-rw-r--r--storage/innobase/include/rem0rec.ic1
-rw-r--r--storage/innobase/include/row0ext.h3
-rw-r--r--storage/innobase/include/row0ftsort.h5
-rw-r--r--storage/innobase/include/row0import.h1
-rw-r--r--storage/innobase/include/row0ins.h2
-rw-r--r--storage/innobase/include/row0log.h6
-rw-r--r--storage/innobase/include/row0merge.h5
-rw-r--r--storage/innobase/include/row0mysql.h56
-rw-r--r--storage/innobase/include/row0purge.h5
-rw-r--r--storage/innobase/include/row0quiesce.h1
-rw-r--r--storage/innobase/include/row0row.h7
-rw-r--r--storage/innobase/include/row0row.ic8
-rw-r--r--storage/innobase/include/row0sel.h2
-rw-r--r--storage/innobase/include/row0uins.h2
-rw-r--r--storage/innobase/include/row0umod.h2
-rw-r--r--storage/innobase/include/row0undo.h19
-rw-r--r--storage/innobase/include/row0upd.h34
-rw-r--r--storage/innobase/include/row0upd.ic8
-rw-r--r--storage/innobase/include/row0vers.h2
-rw-r--r--storage/innobase/include/srv0mon.h1
-rw-r--r--storage/innobase/include/srv0srv.h20
-rw-r--r--storage/innobase/include/srv0start.h1
-rw-r--r--storage/innobase/include/sync0arr.h1
-rw-r--r--storage/innobase/include/sync0debug.h1
-rw-r--r--storage/innobase/include/sync0policy.h524
-rw-r--r--storage/innobase/include/sync0policy.ic101
-rw-r--r--storage/innobase/include/sync0rw.h7
-rw-r--r--storage/innobase/include/sync0rw.ic87
-rw-r--r--storage/innobase/include/sync0sync.h1
-rw-r--r--storage/innobase/include/sync0types.h74
-rw-r--r--storage/innobase/include/trx0i_s.h1
-rw-r--r--storage/innobase/include/trx0purge.h42
-rw-r--r--storage/innobase/include/trx0rec.h3
-rw-r--r--storage/innobase/include/trx0roll.h12
-rw-r--r--storage/innobase/include/trx0sys.h63
-rw-r--r--storage/innobase/include/trx0trx.h27
-rw-r--r--storage/innobase/include/trx0types.h2
-rw-r--r--storage/innobase/include/trx0undo.h39
-rw-r--r--storage/innobase/include/trx0undo.ic31
-rw-r--r--storage/innobase/include/univ.i16
-rw-r--r--storage/innobase/include/ut0counter.h12
-rw-r--r--storage/innobase/include/ut0crc32.h6
-rw-r--r--storage/innobase/include/ut0dbg.h2
-rw-r--r--storage/innobase/include/ut0mem.h1
-rw-r--r--storage/innobase/include/ut0mutex.h6
-rw-r--r--storage/innobase/include/ut0new.h4
-rw-r--r--storage/innobase/include/ut0rbt.h1
-rw-r--r--storage/innobase/include/ut0rnd.h5
-rw-r--r--storage/innobase/include/ut0sort.h2
-rw-r--r--storage/innobase/include/ut0stage.h2
-rw-r--r--storage/innobase/include/ut0ut.h13
-rw-r--r--storage/innobase/include/ut0vec.h1
-rw-r--r--storage/innobase/include/ut0vec.ic2
-rw-r--r--storage/innobase/innodb.cmake2
-rw-r--r--storage/innobase/lock/lock0iter.cc1
-rw-r--r--storage/innobase/lock/lock0lock.cc161
-rw-r--r--storage/innobase/lock/lock0prdt.cc9
-rw-r--r--storage/innobase/lock/lock0wait.cc6
-rw-r--r--storage/innobase/log/log0log.cc18
-rw-r--r--storage/innobase/log/log0recv.cc33
-rw-r--r--storage/innobase/mem/mem0mem.cc2
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc6
-rw-r--r--storage/innobase/os/os0event.cc23
-rw-r--r--storage/innobase/os/os0file.cc36
-rw-r--r--storage/innobase/os/os0proc.cc31
-rw-r--r--storage/innobase/os/os0thread.cc17
-rw-r--r--storage/innobase/page/page0cur.cc14
-rw-r--r--storage/innobase/page/page0page.cc42
-rw-r--r--storage/innobase/page/page0zip.cc231
-rw-r--r--storage/innobase/pars/pars0opt.cc1
-rw-r--r--storage/innobase/pars/pars0pars.cc3
-rw-r--r--storage/innobase/que/que0que.cc5
-rw-r--r--storage/innobase/read/read0read.cc10
-rw-r--r--storage/innobase/rem/rem0cmp.cc33
-rw-r--r--storage/innobase/rem/rem0rec.cc20
-rw-r--r--storage/innobase/row/row0ftsort.cc42
-rw-r--r--storage/innobase/row/row0import.cc75
-rw-r--r--storage/innobase/row/row0ins.cc94
-rw-r--r--storage/innobase/row/row0log.cc25
-rw-r--r--storage/innobase/row/row0merge.cc86
-rw-r--r--storage/innobase/row/row0mysql.cc170
-rw-r--r--storage/innobase/row/row0purge.cc33
-rw-r--r--storage/innobase/row/row0quiesce.cc11
-rw-r--r--storage/innobase/row/row0row.cc6
-rw-r--r--storage/innobase/row/row0sel.cc105
-rw-r--r--storage/innobase/row/row0uins.cc209
-rw-r--r--storage/innobase/row/row0umod.cc76
-rw-r--r--storage/innobase/row/row0undo.cc189
-rw-r--r--storage/innobase/row/row0upd.cc110
-rw-r--r--storage/innobase/row/row0vers.cc2
-rw-r--r--storage/innobase/srv/srv0conc.cc38
-rw-r--r--storage/innobase/srv/srv0mon.cc9
-rw-r--r--storage/innobase/srv/srv0srv.cc79
-rw-r--r--storage/innobase/srv/srv0start.cc146
-rw-r--r--storage/innobase/sync/sync0arr.cc40
-rw-r--r--storage/innobase/sync/sync0debug.cc3
-rw-r--r--storage/innobase/sync/sync0rw.cc89
-rw-r--r--storage/innobase/sync/sync0sync.cc1
-rw-r--r--storage/innobase/trx/trx0i_s.cc14
-rw-r--r--storage/innobase/trx/trx0purge.cc42
-rw-r--r--storage/innobase/trx/trx0rec.cc101
-rw-r--r--storage/innobase/trx/trx0roll.cc190
-rw-r--r--storage/innobase/trx/trx0rseg.cc74
-rw-r--r--storage/innobase/trx/trx0sys.cc9
-rw-r--r--storage/innobase/trx/trx0trx.cc27
-rw-r--r--storage/innobase/trx/trx0undo.cc56
-rw-r--r--storage/innobase/ut/ut0crc32.cc81
-rw-r--r--storage/innobase/ut/ut0dbg.cc5
-rw-r--r--storage/innobase/ut/ut0new.cc2
-rw-r--r--storage/innobase/ut/ut0rbt.cc3
-rw-r--r--storage/maria/CMakeLists.txt7
-rw-r--r--storage/maria/ha_maria.cc29
-rw-r--r--storage/maria/ma_backup.c281
-rw-r--r--storage/maria/ma_check.c6
-rw-r--r--storage/maria/ma_control_file.c120
-rw-r--r--storage/maria/ma_control_file.h1
-rw-r--r--storage/maria/ma_extra.c5
-rw-r--r--storage/maria/ma_init.c2
-rw-r--r--storage/maria/ma_locking.c6
-rw-r--r--storage/maria/ma_loghandler.c26
-rw-r--r--storage/maria/ma_loghandler.h3
-rw-r--r--storage/maria/ma_pagecrc.c10
-rw-r--r--storage/maria/ma_recovery.c8
-rw-r--r--storage/maria/maria_def.h4
-rw-r--r--storage/maria/maria_read_log.c24
-rw-r--r--storage/maria/test_ma_backup.c449
-rwxr-xr-xstorage/maria/unittest/ma_test_recovery.pl23
-rw-r--r--storage/mroonga/ha_mroonga.cpp22
-rw-r--r--storage/mroonga/lib/mrn_condition_converter.cpp11
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result2
-rw-r--r--storage/myisam/TODO7
-rw-r--r--storage/myisam/mi_check.c4
-rw-r--r--storage/myisam/mi_extra.c5
-rw-r--r--storage/myisam/mi_locking.c6
-rw-r--r--storage/myisam/myisamdef.h1
-rw-r--r--storage/perfschema/unittest/pfs_server_stubs.cc2
-rw-r--r--storage/rocksdb/CMakeLists.txt4
-rw-r--r--storage/rocksdb/ha_rocksdb.cc1
-rwxr-xr-xstorage/rocksdb/myrocks_hotbackup.py (renamed from storage/rocksdb/myrocks_hotbackup)3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result12
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/analyze_table.result6
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/bulk_load.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_data.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted_rev.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/cardinality.result1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/drop_index_inplace.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb.result1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/misc.result4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/partition.result1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result14
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb_cf_per_partition.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/statistics.result3
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_bool.result4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_decimal.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_varchar.result5
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/xa.result32
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/disabled.def1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/xa-master.opt1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/xa.test38
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_rpl/r/mdev12179.result18
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_rpl/t/mdev12179.test85
-rw-r--r--storage/spider/ha_spider.cc199
-rw-r--r--storage/spider/ha_spider.h92
-rw-r--r--storage/spider/hs_client/hs_compat.h2
-rw-r--r--storage/spider/hs_client/hstcpcli.cpp25
-rw-r--r--storage/spider/hs_client/hstcpcli.hpp3
-rw-r--r--storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc15
-rw-r--r--storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc31
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_using_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_0_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_1_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_1_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_2_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_2_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_3_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_3_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/slave_trx_isolation_deinit.inc17
-rw-r--r--storage/spider/mysql-test/spider/include/slave_trx_isolation_init.inc39
-rw-r--r--storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result104
-rw-r--r--storage/spider/mysql-test/spider/r/direct_join_using.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_join.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result112
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_join.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result112
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_0.result515
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_1.result515
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_2.result515
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_3.result515
-rw-r--r--storage/spider/mysql-test/spider/r/slave_trx_isolation.result110
-rw-r--r--storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test134
-rw-r--r--storage/spider/mysql-test/spider/t/direct_join_using.test197
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_join.test197
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_join.test197
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_0.test309
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_1.test309
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_2.test309
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_3.test309
-rw-r--r--storage/spider/mysql-test/spider/t/slave_trx_isolation.test166
-rw-r--r--storage/spider/scripts/install_spider.sql93
-rw-r--r--storage/spider/spd_conn.cc10
-rw-r--r--storage/spider/spd_conn.h4
-rw-r--r--storage/spider/spd_copy_tables.cc45
-rw-r--r--storage/spider/spd_db_conn.cc547
-rw-r--r--storage/spider/spd_db_conn.h27
-rw-r--r--storage/spider/spd_db_handlersocket.cc125
-rw-r--r--storage/spider/spd_db_handlersocket.h9
-rw-r--r--storage/spider/spd_db_include.h12
-rw-r--r--storage/spider/spd_db_mysql.cc939
-rw-r--r--storage/spider/spd_db_mysql.h45
-rw-r--r--storage/spider/spd_db_oracle.cc301
-rw-r--r--storage/spider/spd_db_oracle.h11
-rw-r--r--storage/spider/spd_direct_sql.cc79
-rw-r--r--storage/spider/spd_environ.h15
-rw-r--r--storage/spider/spd_group_by_handler.cc67
-rw-r--r--storage/spider/spd_i_s.cc4
-rw-r--r--storage/spider/spd_include.h86
-rw-r--r--storage/spider/spd_param.cc81
-rw-r--r--storage/spider/spd_param.h10
-rw-r--r--storage/spider/spd_ping_table.cc2
-rw-r--r--storage/spider/spd_sys_table.cc169
-rw-r--r--storage/spider/spd_sys_table.h33
-rw-r--r--storage/spider/spd_table.cc59
-rw-r--r--storage/spider/spd_trx.cc38
-rw-r--r--storage/tokudb/CMakeLists.txt47
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_extra_col_master_tokudb.result2
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result45
-rw-r--r--storage/tokudb/mysql-test/tokudb/disabled.def4
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_add_drop.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_add_index.result3
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_drop_index.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_drop_index_2.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_drop_pk.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_no_keys.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_pk.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_pk_2.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_pk_sk.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_sk.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_sk_2.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/card_unique_sk.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_date.result6
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_datetime.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_decimal.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_float.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result2
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_bin.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_char.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_int.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py0
-rw-r--r--[-rwxr-xr-x]storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py0
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2_pick.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db757_part_alter_analyze.result6
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_2_tokudb.result56
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_tokudb.result32
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_2_tokudb.result80
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_1_tokudb.result40
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_2_tokudb.result40
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_1_tokudb.result40
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_2_tokudb.result40
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_alter4_tokudb.result216
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_basic_tokudb.result64
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_debug_tokudb.result262
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_engine_tokudb.result11
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc0_tokudb.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc10_tokudb.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc1_tokudb.result1
-rw-r--r--storage/tokudb/mysql-test/tokudb_rpl/r/mdev12179.result18
-rw-r--r--storage/tokudb/mysql-test/tokudb_rpl/t/mdev12179.test85
-rw-r--r--storage/tokudb/tokudb_sysvars.cc4
-rw-r--r--strings/json_lib.c252
-rw-r--r--support-files/compiler_warnings.supp1
-rw-r--r--support-files/policy/apparmor/usr.sbin.mysqld3
-rw-r--r--support-files/policy/selinux/mariadb-server.fc2
-rw-r--r--support-files/policy/selinux/mariadb-server.te4
-rw-r--r--tests/mysql_client_test.c62
-rw-r--r--unittest/mysys/lf-t.c5
-rw-r--r--unittest/mysys/my_atomic-t.c17
-rw-r--r--unittest/mysys/thr_template.c31
-rw-r--r--unittest/mysys/waiting_threads-t.c4
-rw-r--r--unittest/sql/mf_iocache-t.cc2
-rw-r--r--unittest/strings/CMakeLists.txt2
-rw-r--r--unittest/strings/json-t.c82
-rw-r--r--vio/docs/TODO3
-rw-r--r--win/upgrade_wizard/upgradeDlg.cpp27
m---------wsrep-lib0
-rw-r--r--wsrep/CMakeLists.txt26
-rw-r--r--wsrep/wsrep_api.h1117
-rw-r--r--wsrep/wsrep_dummy.c413
-rw-r--r--wsrep/wsrep_gtid.c74
-rw-r--r--wsrep/wsrep_loader.c226
-rw-r--r--wsrep/wsrep_uuid.c83
2383 files changed, 84549 insertions, 36587 deletions
diff --git a/.gitignore b/.gitignore
index 2ae0a2332fd..ec97b0c8ce5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -182,6 +182,7 @@ storage/maria/ma_sp_test
storage/maria/ma_test1
storage/maria/ma_test2
storage/maria/ma_test3
+storage/maria/test_ma_backup
storage/myisam/mi_test1
storage/myisam/mi_test2
storage/myisam/mi_test3
@@ -192,7 +193,9 @@ storage/myisam/myisampack
storage/myisam/rt_test
storage/myisam/sp_test
storage/rocksdb/ldb
+storage/rocksdb/myrocks_hotbackup
storage/rocksdb/mysql_ldb
+storage/rocksdb/myrocks_hotbackup
storage/rocksdb/sst_dump
storage/rocksdb/rdb_source_revision.h
storage/tokudb/PerconaFT/buildheader/db.h
diff --git a/.gitmodules b/.gitmodules
index 6419657e501..61d4c06dd4e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,7 @@
[submodule "storage/rocksdb/rocksdb"]
path = storage/rocksdb/rocksdb
url = https://github.com/facebook/rocksdb.git
+[submodule "wsrep-lib"]
+ path = wsrep-lib
+ url = https://github.com/codership/wsrep-lib.git
+ branch = master
diff --git a/.travis.compiler.sh b/.travis.compiler.sh
index 7a3b0dbc371..4748c0b9729 100755
--- a/.travis.compiler.sh
+++ b/.travis.compiler.sh
@@ -22,15 +22,22 @@ if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then
exclude_modules;
if which ccache ; then
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
- ccache --max-size=1200M
fi
if [[ "${CXX}" == 'clang++' ]]; then
- export CXX CC=${CXX/++/}
+ if [[ "${CC_VERSION}" == '6' ]]; then
+ export CXX=${CXX}-${CC_VERSION}.0
+ else
+ export CXX=${CXX}-${CC_VERSION}
+ fi
+ export CC=${CXX/++/}
+ # excess warnings about unused include path
+ export CFLAGS='-Wno-unused-command-line-argument'
+ export CXXFLAGS='-Wno-unused-command-line-argument'
elif [[ "${CXX}" == 'g++' ]]; then
export CXX=g++-${CC_VERSION}
export CC=gcc-${CC_VERSION}
fi
- if [[ ${CC_VERSION} == 6 ]]; then
+ if [[ ${CC_VERSION} == 7 ]]; then
wget http://mirrors.kernel.org/ubuntu/pool/universe/p/percona-xtradb-cluster-galera-2.x/percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb ;
ar vx percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb
tar -xJvf data.tar.xz
diff --git a/.travis.yml b/.travis.yml
index 95e0796099b..85d02cc4bec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@
# travis-ci.org definition
sudo: false
-dist: trusty
+dist: xenial
git:
depth: 2
@@ -11,13 +11,13 @@ language: cpp
os:
- linux
- osx
-osx_image: xcode9.1
+osx_image: xcode10.1
compiler:
- gcc
- clang
cache:
- timeout: 300
+ timeout: 500
apt: true
ccache: true
directories:
@@ -25,17 +25,24 @@ cache:
env:
matrix:
- - CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
- - CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- - CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
- - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
- - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
+ - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
+ - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
+ - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
+ - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
+ - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
+ - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
+ - CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
matrix:
exclude:
- os: osx
compiler: gcc
+ - os: osx
+ compiler: clang
+ env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
+ - os: linux
+ compiler: clang
+ env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
include:
- os: linux
compiler: gcc
@@ -79,49 +86,51 @@ matrix:
- uuid-dev
- devscripts
- fakeroot
+ - dh-systemd
+ - libsystemd-dev
+ - libzstd-dev
+ - unixodbc-dev
script:
- ${CC} --version ; ${CXX} --version
- # https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable
- # in trusty containers
- - export MTR_MEM=/tmp
- env DEB_BUILD_OPTIONS="parallel=4" debian/autobake-deb.sh;
- - ccache --show-stats
# Until OSX becomes a bit more stable: MDEV-12435 MDEV-16213
allow_failures:
- os: osx
compiler: clang
- env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
+ env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- os: osx
compiler: clang
- env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
+ env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
- os: osx
compiler: clang
- env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
+ env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- os: osx
compiler: clang
- env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
+ env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
- os: osx
compiler: clang
- env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
+ env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
- os: osx
compiler: clang
- env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
+ env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- - llvm-toolchain-trusty-5.0
- - llvm-toolchain-trusty-6.0
+ - llvm-toolchain-xenial-6.0
+ - llvm-toolchain-xenial-7
packages: # make sure these include all compilers and all build dependencies (see list above)
- - gcc-5
- - g++-5
- gcc-6
- g++-6
- - clang-5.0
- - llvm-5.0-dev
+ - gcc-7
+ - g++-7
+ - gcc-8
+ - g++-8
- clang-6.0
- llvm-6.0-dev
+ - clang-7
+ - llvm-7-dev
- bison
- chrpath
- cmake
@@ -156,14 +165,16 @@ addons:
before_install:
- if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
brew update;
- brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre;
+ brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre zstd;
brew link ccache;
+ export PATH="/usr/local/opt/ccache/libexec:$PATH";
fi
before_script:
- df -h
- ccache --version
- ccache --show-stats
+ - ccache --max-size=5G
script:
# following modules are disabled after sourcing .travis.compiler.sh:
@@ -181,6 +192,8 @@ script:
--suite=${MYSQL_TEST_SUITES}
--skip-test-list=unstable-tests
--skip-test=binlog.binlog_unsafe
+
+after_script:
- ccache --show-stats
- df -h
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index e9bede9c746..7e6f0831423 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -122,7 +122,8 @@ get_make_parallel_flag
# SSL library to use.--with-ssl will select our bundled yaSSL
# implementation of SSL. --with-ssl=yes will first try system library
# then the boundled one --with-ssl=system will use the system library.
-SSL_LIBRARY=--with-ssl=system
+# We use bundled by default as this is guaranteed to work with Galera
+SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" = "xpedantic" ]; then
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
@@ -194,6 +195,8 @@ base_configs="$base_configs --with-extra-charsets=complex "
base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables $maintainer_mode"
base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables"
+# Following is to get tokudb to work
+base_configs="$base_configs --with-jemalloc=NO"
if test -d "$path/../cmd-line-utils/readline"
then
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5415efb66db..b40a25e52cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -143,6 +143,7 @@ INCLUDE(misc)
INCLUDE(mysql_version)
INCLUDE(cpack_source_ignore_files)
INCLUDE(install_layout)
+INCLUDE(submodules)
INCLUDE(wsrep)
INCLUDE(cpack_rpm)
INCLUDE(cpack_deb)
@@ -342,6 +343,8 @@ MYSQL_CHECK_SSL()
MYSQL_CHECK_READLINE()
SET(MALLOC_LIBRARY "system")
+SET(PYTHON_SHEBANG "/usr/bin/env python" CACHE STRING "python shebang")
+MARK_AS_ADVANCED(PYTHON_SHEBANG)
CHECK_PCRE()
@@ -376,7 +379,6 @@ ENDIF()
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
-INCLUDE(submodules)
INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
# Add storage engines and plugins.
@@ -404,7 +406,7 @@ IF(NOT WITHOUT_SERVER)
ENDIF(WITH_EMBEDDED_SERVER)
IF(WITH_WSREP)
- ADD_SUBDIRECTORY(wsrep)
+ ADD_SUBDIRECTORY(wsrep-lib)
ENDIF()
ADD_SUBDIRECTORY(mysql-test)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000000..64af450d29f
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,47 @@
+# How to contribute
+
+MariaDB Server has a vibrant community contributing in a wide range of areas. There are many valuable ways you can contribute to MariaDB.
+
+### Engage online with other community members
+---
+- [MariaDB on Zulip](https://mariadb.zulipchat.com/)
+- [maria-developers mailing list](http://launchpad.net/~maria-developers)
+- [maria-discuss mailing list](http://launchpad.net/~maria-discuss)
+- [maria-docs mailing list](http://launchpad.net/~maria-docs)
+- ircs://chat.freenode.net/maria ([see the IRC page on the Knowledge Base](https://mariadb.com/kb/en/meta/irc-chat-servers-and-zulip-instance/) for help with IRC).
+- The MariaDB Foundation and MariaDB Corporation have a presence on Reddit, Twitter, Facebook and Google Plus. See the [social media page](https://mariadb.com/kb/en/mariadb/social-media/).
+
+### Help document MariaDB
+----
+- Contribute towards [documenting MariaDB Server](https://mariadb.com/kb/en/meta/writing-editing-library-articles/) and its ecosystem by adding new content or improving existing content.
+- [Translate](https://mariadb.com/kb/en/meta/translating-library-articles/) existing documentation.
+
+### Help debug and develop MariaDB
+-----
+- [Report bugs](https://jira.mariadb.org/)
+- Test development versions
+- Write code to fix bugs or develop new features (see [Getting Started for Developers](https://mariadb.org/getting-started-for-developers)).See also [list of beginner friendly tasks](https://jira.mariadb.org/browse/MDEV-15736?jql=resolution%20%3D%20Unresolved%20AND%20labels%20%3D%20beginner-friendly%20ORDER%20BY%20updated%20DESC)
+- Help with code quality control
+- Participate in packaging for different Linux distributions
+
+### Sponsor or donate
+---
+You’re very welcome to support MariaDB Server as an individual, or talk your company into joining the Foundation as a sponsoring member. See the [Sponsor page](https://mariadb.org/donate/).
+
+### Events, meetups and conferences
+---
+- Attend an event
+ - [Events and Conferences page](https://mariadb.org/events/)
+ - [mariadb.meetup.com](http://mariadb.meetup.com/)
+
+### Live QA for beginner contributors
+----
+MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC.
+From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, anyone can ask any questions they’d like,
+and a live developer will be available to assist.
+New contributors can ask questions any time, but we will provide immediate feedback during that interval.
+
+### Additional resources
+----
+ - [MariaDB Foundation ](https://mariadb.org/)
+ - [Knowledge Base](https://mariadb.com/kb/en/)
diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY
index 7ff33c7051e..2bd6daaea17 100644
--- a/Docs/INSTALL-BINARY
+++ b/Docs/INSTALL-BINARY
@@ -1,7 +1,9 @@
MariaDB and MySQL have identical install methods. In this document we
-describe how to install MariaDB; However all documentation at www.mysql.com
-also applies.
+describe how to install MariaDB.
+The full documentation for installing MariaDB can be found at
+https://mariadb.com/kb/en/library/binary-packages/
+However most documentation at www.mysql.com also applies.
2.2. Installing MariaDB from Generic Binaries on Unix/Linux
@@ -33,7 +35,8 @@ also applies.
If you run into problems and need to file a bug report,
please report them to: http://mariadb.org/jira
- See the instructions in Section 1.6, "How to Report Bugs or Problems."
+ See the instructions at
+ https://mariadb.com/kb/en/mariadb-community-bug-reporting
The basic commands that you must execute to install and use a
MariaDB binary distribution are:
@@ -79,10 +82,9 @@ shell> useradd -g mysql mysql
is protected, you must perform the installation as root.)
shell> cd /usr/local
- 3. Obtain a distribution file using the instructions in Section
- 2.1.3, "How to Get MariaDB." For a given release, binary
- distributions for all platforms are built from the same MariaDB
- source distribution.
+ 3. Obtain a distribution file using the instructions at
+ https://mariadb.com/kb/en/library/where-to-download-mariadb/
+ The description below describes how to install a MariaDB tar file.
4. Unpack the distribution, which creates the installation
directory. Then create a symbolic link to that directory:
@@ -149,8 +151,8 @@ shell> chown -R mysql data
machine, you can copy support-files/mysql.server to the
location where your system has its startup files. More
information can be found in the support-files/mysql.server
- script itself and in Section 2.13.1.2, "Starting and Stopping
- MariaDB Automatically."
+ script itself and at
+ https://mariadb.com/kb/en/starting-and-stopping-mariadb-automatically.
10. You can set up new accounts using the bin/mysql_setpermission
script if you install the DBI and DBD::mysql Perl modules. See
Section 4.6.14, "mysql_setpermission --- Interactively Set
@@ -181,8 +183,8 @@ shell> bin/mysqld_safe --user=mysql &
find some information in the host_name.err file in the data
directory.
- More information about mysqld_safe is given in Section 4.3.2,
- "mysqld_safe --- MySQL Server Startup Script."
+ More information about mysqld_safe can be found at
+ https://mariadb.com/kb/en/mysqld_safe
Note
diff --git a/Docs/README-wsrep b/Docs/README-wsrep
index 6bb329e9396..166901e111f 100644
--- a/Docs/README-wsrep
+++ b/Docs/README-wsrep
@@ -60,7 +60,7 @@ CONTENTS:
Wsrep API developed by Codership Oy is a modern generic (database-agnostic)
replication API for transactional databases with a goal to make database
replication/logging subsystem completely modular and pluggable. It is developed
-with flexibility and completeness in mind to satisfy broad range of modern
+with flexibility and completeness in mind to satisfy a broad range of modern
replication scenarios. It is equally suitable for synchronous and asynchronous,
master-slave and multi-master replication.
@@ -87,7 +87,7 @@ Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please
upgrade to mysql-server-5.1 first.
If you're installing over an existing mysql installation, mysql-server-wsrep
-will conflict with mysql-server-5.1 package, so remove it first:
+will conflict with the mysql-server-5.1 package, so remove it first:
$ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1
@@ -105,7 +105,7 @@ For example, installation of required packages on Debian Lenny:
$ sudo apt-get install psmisc
$ sudo apt-get -t lenny-backports install mysql-client-5.1
-Now you should be able to install mysql-wsrep package:
+Now you should be able to install the mysql-wsrep package:
$ sudo dpkg -i <mysql-server-wsrep DEB>
@@ -137,7 +137,7 @@ Additional packages to consider (if not yet installed):
* galera (multi-master replication provider, https://launchpad.net/galera)
* MySQL-client-community (for connecting to server and mysqldump-based SST)
* rsync (for rsync-based SST)
- * xtrabackup and nc (for xtrabackup-based SST)
+ * mariabackup and nc (for mariabackup-based SST)
2.2 Upgrade system tables.
@@ -150,7 +150,7 @@ and can be ignored unless specific functionality is needed.
3. FIRST TIME SETUP
Unless you're upgrading an already installed mysql-wsrep package, you will need
-to set up a few things to prepare server for operation.
+to set up a few things to prepare the server for operation.
3.1 CONFIGURATION FILES
@@ -162,7 +162,7 @@ to set up a few things to prepare server for operation.
* Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line.
* Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying
- a path to provider library. If you don't have a provider, leave it as it is.
+ a path to the provider library. If you don't have a provider, leave it as it is.
* When a new node joins the cluster it'll have to receive a state snapshot from
one of the peers. This requires a privileged MySQL account with access from
@@ -267,7 +267,7 @@ innodb_autoinc_lock_mode=2
This is a required parameter. Without it INSERTs into tables with
AUTO_INCREMENT column may fail.
autoinc lock modes 0 and 1 can cause unresolved deadlock, and make
- system unresponsive.
+ the system unresponsive.
innodb_locks_unsafe_for_binlog=1
This option is required for parallel applying.
@@ -299,14 +299,14 @@ wsrep_node_address=
results (multiple network interfaces, NAT, etc.)
If not explicitly overridden by wsrep_sst_receive_address, the <address> part
will be used to listen for SST (see below). And the whole <address>[:port]
- will be passed to wsrep provider to be used as a base address in its
+ will be passed to the wsrep provider to be used as a base address in its
communications.
wsrep_node_name=
Human readable node name (for easier log reading only). Defaults to hostname.
wsrep_slave_threads=1
- Number of threads dedicated to processing of writesets from other nodes.
+ The number of threads dedicated to the processing of writesets from other nodes.
For best performance should be few per CPU core.
wsrep_dbug_option
@@ -326,7 +326,7 @@ wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
Retry autocommit queries and single statement transactions should they fail
certification test. This is analogous to rescheduling an autocommit query
- should it go into deadlock with other transactions in the database lock
+ should it go into a deadlock with other transactions in the database lock
manager.
wsrep_auto_increment_control=1
@@ -357,7 +357,7 @@ wsrep_OSU_method=TOI
is not replicating and may be unable to process replication events (due to
table lock). Once DDL operation is complete, the node will catch up and sync
with the cluster to become fully operational again. The DDL statement or
- its effects are not replicated, so it is user's responsibility to manually
+ its effects are not replicated, so it is the user's responsibility to manually
perform this operation on each of the nodes.
wsrep_forced_binlog_format=none
@@ -380,14 +380,14 @@ to join or start a cluster.
wsrep_sst_method=rsync
What method to use to copy database state to a newly joined node. Supported
methods:
- - mysqldump: slow (except for small datasets) but allows for upgrade
- between major MySQL versions or InnoDB features.
- - rsync: much faster on large datasets (default).
- - rsync_wan: same as rsync but with deltaxfer to minimize network traffic.
- - xtrabackup: very fast and practically non-blocking SST method based on
- Percona's xtrabackup tool.
-
- (for xtrabackup to work the following settings must be present in my.cnf
+ - mysqldump: slow (except for small datasets) but allows for upgrade
+ between major MySQL versions or InnoDB features.
+ - rsync: much faster on large datasets (default).
+ - rsync_wan: same as rsync but with deltaxfer to minimize network traffic.
+ - mariabackup: very fast and practically non-blocking SST method based on
+ mariabackup tool (enhanced version of Percona's xtrabackup).
+
+ (for mariabackup to work the following settings must be present in my.cnf
on all nodes:
[mysqld]
wsrep_sst_auth=root:<root password>
@@ -412,8 +412,8 @@ wsrep_sst_auth=
wsrep_sst_donor=
A name of the node which should serve as state snapshot donor. This allows
- to control which node will serve state snapshot request. By default the
- most suitable node is chosen by wsrep provider. This is the same as given in
+ controlling which node will serve the state snapshot request. By default the
+ most suitable node is chosen by the wsrep provider. This is the same as given in
wsrep_node_name.
@@ -423,7 +423,7 @@ wsrep_sst_donor=
for the database. They change the database structure and are non-
transactional.
- Release 22.3 brings a new method for performing schema upgrades. User can
+ Release 22.3 brings a new method for performing schema upgrades. A user can
now choose whether to use the traditional total order isolation or new
rolling schema upgrade method. The OSU method choice is done by global
parameter: 'wsrep_OSU_method'.
@@ -439,7 +439,7 @@ wsrep_sst_donor=
6.2 Rolling Schema Upgrade (RSU)
- Rolling schema upgrade is new DDL processing method, where DDL will be
+ Rolling schema upgrade is a new DDL processing method, where DDL will be
processed locally for the node. The node is disconnected of the replication
for the duration of the DDL processing, so that there is only DDL statement
processing in the node and it does not block the rest of the cluster. When
@@ -468,7 +468,7 @@ wsrep_sst_donor=
* LOCK/UNLOCK TABLES cannot be supported in multi-master setups.
* lock functions (GET_LOCK(), RELEASE_LOCK()... )
-4) Query log cannot be directed to table. If you enable query logging,
+4) Query log cannot be directed to a table. If you enable query logging,
you must forward the log to a file:
log_output = FILE
Use general_log and general_log_file to choose query logging and the
@@ -480,7 +480,7 @@ wsrep_sst_donor=
6) Due to cluster level optimistic concurrency control, transaction issuing
COMMIT may still be aborted at that stage. There can be two transactions.
writing to same rows and committing in separate cluster nodes, and only one
- of the them can successfully commit. The failing one will be aborted.
+ of them can successfully commit. The failing one will be aborted.
For cluster level aborts, MySQL/galera cluster gives back deadlock error.
code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)).
diff --git a/Docs/glibc-2.2.5.patch b/Docs/glibc-2.2.5.patch
deleted file mode 100644
index ef5d40b6899..00000000000
--- a/Docs/glibc-2.2.5.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-diff -r -c --exclude='*.info*' glibc-2.2.5.org/linuxthreads/internals.h glibc-2.2.5/linuxthreads/internals.h
-*** glibc-2.2.5.org/linuxthreads/internals.h Thu Nov 29 08:44:16 2001
---- glibc-2.2.5/linuxthreads/internals.h Tue May 21 10:51:53 2002
-***************
-*** 343,349 ****
- THREAD_SELF implementation is used, this must be a power of two and
- a multiple of PAGE_SIZE. */
- #ifndef STACK_SIZE
-! #define STACK_SIZE (2 * 1024 * 1024)
- #endif
-
- /* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */
---- 343,349 ----
- THREAD_SELF implementation is used, this must be a power of two and
- a multiple of PAGE_SIZE. */
- #ifndef STACK_SIZE
-! #define STACK_SIZE (128 * 1024)
- #endif
-
- /* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */
-diff -r -c --exclude='*.info*' glibc-2.2.5.org/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h
-*** glibc-2.2.5.org/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Thu Jun 8 21:49:49 2000
---- glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Tue May 21 10:52:58 2002
-***************
-*** 64,70 ****
- /* The number of threads per process. */
- #define _POSIX_THREAD_THREADS_MAX 64
- /* This is the value this implementation supports. */
-! #define PTHREAD_THREADS_MAX 1024
-
- /* Maximum amount by which a process can descrease its asynchronous I/O
- priority level. */
---- 64,70 ----
- /* The number of threads per process. */
- #define _POSIX_THREAD_THREADS_MAX 64
- /* This is the value this implementation supports. */
-! #define PTHREAD_THREADS_MAX 4096
-
- /* Maximum amount by which a process can descrease its asynchronous I/O
- priority level. */
-diff -r -c --exclude='*.info*' glibc-2.2.5.org/nss/nsswitch.c glibc-2.2.5/nss/nsswitch.c
-*** glibc-2.2.5.org/nss/nsswitch.c Tue Jul 17 10:21:36 2001
---- glibc-2.2.5/nss/nsswitch.c Tue May 21 10:59:55 2002
-***************
-*** 496,501 ****
---- 496,502 ----
- {
- service_user *new_service;
- const char *name;
-+ int name_alloc_len;
-
- while (isspace (line[0]))
- ++line;
-***************
-*** 510,522 ****
- if (name == line)
- return result;
-
-
- new_service = (service_user *) malloc (sizeof (service_user)
-! + (line - name + 1));
- if (new_service == NULL)
- return result;
-
-! *((char *) __mempcpy (new_service->name, name, line - name)) = '\0';
-
- /* Set default actions. */
- new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
---- 511,534 ----
- if (name == line)
- return result;
-
-+ name_alloc_len = line - name + 1;
-+
-+ #ifdef DO_STATIC_NSS
-+ if (!((name_alloc_len == 6 && strncmp(name,"files",5) == 0) ||
-+ (name_alloc_len == 4 && strncmp(name,"dns",3) == 0)))
-+ {
-+ name = (char*) "files";
-+ name_alloc_len = 6;
-+ }
-+ #endif
-
- new_service = (service_user *) malloc (sizeof (service_user)
-! + name_alloc_len);
- if (new_service == NULL)
- return result;
-
-! *((char *) __mempcpy (new_service->name, name, name_alloc_len-1)) = '\0';
-!
-
- /* Set default actions. */
- new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
-diff -r -c --exclude='*.info*' glibc-2.2.5.org/time/Makefile glibc-2.2.5/time/Makefile
-*** glibc-2.2.5.org/time/Makefile Fri Aug 10 01:59:41 2001
---- glibc-2.2.5/time/Makefile Tue May 21 11:01:11 2002
-***************
-*** 37,44 ****
-
- include ../Rules
-
-! tz-cflags = -DTZDIR='"$(zonedir)"' \
-! -DTZDEFAULT='"$(localtime-file)"' \
- -DTZDEFRULES='"$(posixrules-file)"'
-
- CFLAGS-tzfile.c = $(tz-cflags)
---- 37,44 ----
-
- include ../Rules
-
-! tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \
-! -DTZDEFAULT='"/etc/localtime"' \
- -DTZDEFRULES='"$(posixrules-file)"'
-
- CFLAGS-tzfile.c = $(tz-cflags)
-diff -r -c --exclude='*.info*' glibc-2.2.5.org/timezone/Makefile glibc-2.2.5/timezone/Makefile
-*** glibc-2.2.5.org/timezone/Makefile Thu Aug 30 00:45:25 2001
---- glibc-2.2.5/timezone/Makefile Tue May 21 11:01:57 2002
-***************
-*** 159,166 ****
-
- $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
-
-! tz-cflags = -DTZDIR='"$(zonedir)"' \
-! -DTZDEFAULT='"$(localtime-file)"' \
- -DTZDEFRULES='"$(posixrules-file)"' \
- -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
-
---- 159,166 ----
-
- $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
-
-! tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \
-! -DTZDEFAULT='"/etc/localtime"' \
- -DTZDEFRULES='"$(posixrules-file)"' \
- -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
-
diff --git a/Docs/linuxthreads.txt b/Docs/linuxthreads.txt
deleted file mode 100644
index 552415fe794..00000000000
--- a/Docs/linuxthreads.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-[Note this information is obsolete]
-
-Notes on compiling glibc for the standard MySQL binary:
-
- - make sure you have gcc 2.95 and gmake 3.79 or newer
- - wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-2.2.5.tar.gz
- - wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-2.2.5.tar.gz
- - tar zxvf glibc-2.2.5.tar.gz ; cd glibc-2.2.5 ;
- tar zxvf ../glibc-linuxthreads-2.2.5.tar.gz
- - patch -p1 < ~/bk/mysql/Docs/glibc-2.2.5.patch
- - ./configure --prefix=/usr/local/mysql-glibc --enable-static-nss \
- --disable-shared --enable-add-ons=linuxthreads --target=i386 \
- --host=i386-pc-linux-gnu
- - make
- - possible problems - if compiler is not properly installed, one can get
- "cpp: too many input" files error - easiest way to solve - SUSE RPM for gcc
- 2.95
- - surun make install
- - To build the binaries, run Build-tools/Do-linux-build
diff --git a/Docs/sp-imp-spec.txt b/Docs/sp-imp-spec.txt
deleted file mode 100644
index 52389ea50f4..00000000000
--- a/Docs/sp-imp-spec.txt
+++ /dev/null
@@ -1,1100 +0,0 @@
-
- Implementation specification for Stored Procedures
- ==================================================
-
-
-- How parsing and execution of queries work
-
- In order to execute a query, the function sql_parse.cc:mysql_parse() is
- called, which in turn calls the parser (yyparse()) with an updated Lex
- structure as the result. mysql_parse() then calls mysql_execute_command()
- which dispatches on the command code (in Lex) to the corresponding code for
- executing that particular query.
-
- There are three structures involved in the execution of a query which are of
- interest to the stored procedure implementation:
-
- - Lex (mentioned above) is the "compiled" query, that is the output from
- the parser and what is then interpreted to do the actual work.
- It constains an enum value (sql_command) which is the query type, and
- all the data collected by the parser needed for the execution (table
- names, fields, values, etc).
- - THD is the "run-time" state of a connection, containing all that is
- needed for a particular client connection, and, among other things, the
- Lex structure currently being executed.
- - Item_*: During parsing, all data is translated into "items", objects of
- the subclasses of "Item", such as Item_int, Item_real, Item_string, etc,
- for basic datatypes, and also various more specialized Item types for
- expressions to be evaluated (Item_func objects).
-
-
-- How to fit Stored Procedure into this scheme
-
- - An overview of the classes and files for stored procedures
- (More detailed APIs at the end of this file)
-
- - class sp_head (sp_head.{cc,h})
- This contains, among other things, an array of "instructions" and the
- method for executing the procedure.
-
- - class sp_pcontext (sp_pcontext.{cc,h}
- This is the parse context for the procedure. It's primarily used during
- parsing to keep track of local parameters, variables and labels, but
- it's also used at CALL time do find parameters mode (IN, OUT or INOUT)
- and type when setting up the runtime context.
-
- - class sp_instr (sp_head.{cc,h})
- This is the base class for "instructions", that is, what is generated
- by the parser. It turns out that we only need a minimum of 5 different
- sub classes:
- - sp_instr_stmt
- Execute a statement. This is the "call-out" any normal SQL statement,
- like a SELECT, INSERT etc. It contains the Lex structure for the
- statement in question.
- - sp_instr_set
- Set the value of a local variable (or parameter)
- - sp_instr_jump
- An unconditional jump.
- - sp_instr_jump_if_not
- Jump if condition is not true. It turns out that the negative test is
- most convenient when generating the code for the flow control
- constructs.
- - sp_instr_freturn
- Return a value from a FUNCTION and exit.
- For condition HANDLERs some special instructions are also needed, see
- that section below.
-
- - class sp_rcontext (sp_rcontext.h)
- This is the runtime context in the THD structure.
- It contains an array of items, the parameters and local variables for
- the currently executing stored procedure.
- This means that variable value lookup is in runtime is constant time,
- a simple index operation.
-
- - class Item_splocal (Item.{cc,h})
- This is a subclass of Item. Its sole purpose is to hide the fact that
- the real Item is actually in the current frame (runtime context).
- It contains the frame offset and defers all methods to the real Item
- in the frame. This is what the parser generates for local variables.
-
- - Utility functions (sp.{cc,h})
- This contains functions for creating, dropping and finding a stored
- procedure in the mysql.proc table (or the internal cache).
-
-
- - Parsing CREATE PROCEDURE ...
-
- When parsing a CREATE PROCEDURE the parser first initializes the
- sphead and spcont (runtime context) fields in the Lex.
- The sql_command code for the result of parsing a is
- SQLCOM_CREATE_PROCEDURE.
-
- The parsing of the parameter list and body is relatively
- straight-forward:
-
- - Parameters:
- name, type and mode (IN/OUT/INOUT) is pushed to spcont
- - Declared local variables:
- Same as parameters (mode is then IN)
- - Local Variable references:
- If an identifier is found in in spcont, an Item_splocal is created
- with the variable's frame index, otherwise an Item_field or Item_ref
- is created (as before).
- - Statements:
- The Lex in THD is replaced by a new Lex structure and the statement,
- is parsed as usual. A sp_instr_stmt is created, containing the new
- Lex, and added to the instructions in sphead.
- Afterwards, the procedure's Lex is restored in THD.
- - SET var:
- Setting a local variable generates a sp_instr_set instruction,
- containing the variable's frame offset, the expression (an Item),
- and the type.
- - Flow control:
- Flow control constructs like, IF, WHILE, etc, generate a conditional
- and unconditional jumps in the "obvious" way, but a few notes may
- be required:
- - Forward jumps: When jumping forward, the exact destination is not
- known at the time of the creation of the jump instruction. The
- sphead therefore contains list of instruction-label pairs for
- each forward reference. When the position later is known, the
- instructions in the list are updated with the correct location.
- - Loop constructs have optional labels. If a loop doesn't have a
- label, an anonymous label is generated to simplify the parsing.
- - There are two types of CASE. The "simple" case is implemented
- with an anonymous variable bound to the value to be tested.
-
-
- - A simple example
-
- Parsing the procedure:
-
- create procedure a(s char(16))
- begin
- declare x int;
- set x = 3;
- while x > 0 do
- set x = x-1;
- insert into db.tab values (x, s);
- end while;
- end
-
- would generate the following structures:
- ______
- thd: | | _________
- | lex -+--->| | ___________________
- |______| | spcont -+------------------->| "s",in,char(16):0 |
- | sphead -+------ |("x",in,int :1)|
- |_________| | |___________________|
- ____V__________________
- | m_name: "a" |
- | m_defstr: "create ..."|
- | m_instr: ... |
- |_______________________|
-
- Note that the contents of the spcont is changing during the parsing,
- at all times reflecting the state of the would-be runtime frame.
- The m_instr is an array of instructions:
-
- Pos. Instruction
- 0 sp_instr_set(1, '3')
- 1 sp_instr_jump_if_not(5, 'x>0')
- 2 sp_instr_set(1, 'x-1')
- 3 sp_instr_stmt('insert into ...')
- 4 sp_instr_jump(1)
- 5 <end>
-
- Here, '3', 'x>0', etc, represent the Items or Lex for the respective
- expressions or statements.
-
-
- - Parsing CREATE FUNCTION ...
-
- Creating a functions is essentially the same thing as for a PROCEDURE,
- with the addition that a FUNCTION has a return type and a RETURN
- statement, but no OUT or INOUT parameters.
-
- The main difference during parsing is that we store the result type
- in the sp_head. However, there are big differences when it comes to
- invoking a FUNCTION. (See below.)
-
-
- - Storing, caching, dropping...
-
- As seen above, the entired definition string, including the "CREATE
- PROCEDURE" (or "FUNCTION") is kept. The procedure definition string is
- stored in the table mysql.proc with the name and type as the key, the
- type being one of the enum ("procedure","function").
-
- A PROCEDURE is just stored in the mysql.proc table. A FUNCTION has an
- additional requirement. They will be called in expressions with the same
- syntax as UDFs, so UDFs and stored FUNCTIONs share the namespace. Thus,
- we must make sure that we do not have UDFs and FUNCTIONs with the same
- name (even if they are stored in different places).
-
- This means that we can reparse the procedure as many time as we want.
- The first time, the resulting Lex is used to store the procedure in
- the database (using the function sp.c:sp_create_procedure()).
-
- The simplest way would be to just leave it at that, and re-read the
- procedure from the database each time it is called. (And in fact, that's
- the way the earliest implementation will work.)
- However, this is not very efficient, and we can do better. The full
- implementation should work like this:
-
- 1) Upon creation time, parse and store the procedure. Note that we still
- need to parse it to catch syntax errors, but we can't check if called
- procedures exists for instance.
- 2) Upon first CALL, read from the database, parse it, and cache the
- resulting Lex in memory. This time we can do more error checking.
- 3) Upon subsequent CALLs, use the cached Lex.
-
- Note that this implies that the Lex structure with its sphead must be
- reentrant, that is, reusable and shareable between different threads
- and calls. The runtime state for a procedure is kept in the sp_rcontext
- in THD.
-
- The mechanisms of storing, finding, and dropping procedures are
- encapsulated in the files sp.{cc,h}.
-
-
- - CALLing a procedure
-
- A CALL is parsed just like any statement. The resulting Lex has the
- sql_command SQLCOM_CALL, the procedure's name and the parameters are
- pushed to the Lex' value_list.
-
- sql_parse.cc:mysql_execute_command() then uses sp.cc:sp_find() to
- get the sp_head for the procedure (which may have been read from the
- database or fetched from the in-memory cache) and calls the sp_head's
- method execute().
- Note: It's important that substatements called by the procedure do not
- do send_ok(). Fortunately, there is a flag in THD->net to disable
- this during CALLs. If a substatement fails, it will however send
- an error back to the client, so the CALL mechanism must return
- immediately and without sending an error.
-
- The sp_head::execute() method works as follows:
-
- 1) Keep a pointer to the old runtime context in THD (if any)
- 2) Create a new runtime context. The information about the required size
- is in sp_head's parse time context.
- 3) Push each parameter (from the CALL's Lex->value_list) to the new
- context. If it's an OUT or INOUT parameter, the parameter's offset
- in the caller's frame is set in the new context as well.
- 4) For each instruction, call its execute() method.
- The result is a pointer to the next instruction to execute (or NULL)
- if an error occurred.
- 5) On success, set the new values of the OUT and INOUT parameters in
- the caller's frame.
-
- - USE database
-
- Before executing the instruction we also keeps the current default
- database (if any). If this was changed during execution (i.e. a "USE"
- statement has been executed), we restore the current database to the
- original.
-
- This is the most useful way to handle USE in procedures. If we didn't,
- the caller would find himself in a different database after calling
- a function, which can be confusing.
- Restoring the database also gives full freedom to the procedure writer:
- - It's possible to write "general" procedures that are independent of
- the actual database name.
- - It's possible to write procedures that work on a particular database
- by calling USE, without having to use fully qualified table names
- everywhere (which doesn't help if you want to call other, "general",
- procedures anyway).
-
- - Evaluating Items
-
- There are three occasions where we need to evaluate an expression:
-
- - When SETing a variable
- - When CALLing a procedure
- - When testing an expression for a branch (in IF, WHILE, etc)
-
- The semantics in stored procedures is "call-by-value", so we have to
- evaluate any "func" Items at the point of the CALL or SET, otherwise
- we would get a kind of "lazy" evaluation with unexpected results with
- respect to OUT parameters for instance.
- For this the support function, sp_head.cc:eval_func_item() is needed.
-
-
- - Calling a FUNCTION
-
- Functions don't have an explicit call keyword like procedures. Instead,
- they appear in expressions with the conventional syntax "fun(arg, ...)".
- The problem is that we already have User Defined Functions (UDFs) which
- are called the same way. A UDF is detected by the lexical analyzer (not
- the parser!), in the find_keyword() function, and returns a UDF_*_FUNC
- or UDA_*_SUM token with the udf_func object as the yylval.
-
- So, stored functions must be handled in a simpilar way, and as a
- consequence, UDFs and functions must not have the same name.
-
- - Detecting and parsing a FUNCTION invocation
-
- The existence of UDFs are checked during the lexical analysis (in
- sql_lex.cc:find_keyword()). This has the drawback that they must
- exist before they are referred to, which was ok before SPs existed,
- but then it becomes a problem. The first implementation of SP FUNCTIONs
- will work the same way, but this should be fixed a.s.a.p. (This will
- required some reworking of the way UDFs are handled, which is why it's
- not done from the start.)
- For the time being, a FUNCTION is detected the same way, and returns
- the token SP_FUNC. During the parsing we only check for the *existence*
- of the function, we don't parse it, since wa can't call the parser
- recursively.
-
- When encountering a SP_FUNC with parameters in the expression parser,
- an instance of the new Item_func_sp class is created. Unlike UDFs, we
- don't have different classes for different return types, since we at
- this point don't know the type.
-
- - Collecting FUNCTIONs to invoke
-
- A FUNCTION differs from a PROCEDURE in one important aspect: Whereas a
- PROCEDURE is CALLed as statement by itself, a FUNCTION is invoked
- "on-the-fly" during the execution of *another* statement.
- This makes things a lot more complicated compared to CALL:
- - We can't read and parse the FUNCTION from the mysql.proc table at the
- point of invocation; the server requires that all tables used are
- opened and locked at the beginning of the query execution.
- One "obvious" solution would be to simply push "mysql.proc" to the list
- of tables used by the query, but this implies a "join" with this table
- if the query is a select, so it doesn't work (and we can't exclude this
- table easily; since a privileged used might in fact want to search
- the proc table).
- Another solution would of course be to allow the opening and closing
- of the mysql.proc table during a query execution, but this it not
- possible at the present.
-
- So, the solution is to collect the names of the referred FUNCTIONs during
- parsing in the lex.
- Then, before doing anything else in mysql_execute_command(), read all
- functions from the database an keep them in the THD, where the function
- sp_find_function() can find them during the execution.
- Note: Even with an in-memory cache, we must still make sure that the
- functions are indeed read and cached at this point.
- The code that read and cache functions from the database must also be
- invoked recursively for each read FUNCTION to make sure we have *all* the
- functions we need.
-
-
- - Parsing DROP PROCEDURE/FUNCTION
-
- The procedure name is pushed to Lex->value_list.
- The sql_command code for the result of parsing a is
- SQLCOM_DROP_PROCEDURE/SQLCOM_DROP_FUNCTION.
-
- Dropping is done by simply getting the procedure with the sp_find()
- function and calling sp_drop() (both in sp.{cc,h}).
-
- DROP PROCEDURE/FUNCTION also supports the non-standard "IF EXISTS",
- analogous to other DROP statements in MySQL.
-
-
- - Condition and Handlers
-
- Condition names are lexical entities and are kept in the parser context
- just like variables. But, condition are just "aliases" for SQLSTATE
- strings, or mysqld error codes (which is a non-standard extension in
- MySQL), and are only used during parsing.
-
- Handlers comes in three types, CONTINUE, EXIT and UNDO. The latter is
- like an EXIT handler with an implicit rollback, and is currently not
- implemented.
- The EXIT handler jumps to the end of its BEGIN-END block when finished.
- The CONTINUE handler returns to the statement following that which
- invoked the handler.
-
- The handlers in effect at any point is part of each thread's runtime
- state, so we need to push and pop handlers in the sp_rcontext during
- execution. We use special instructions for this:
- - sp_instr_hpush_jump
- Push a handler. The instruction contains the necessary information,
- like which conditions we handle and the location of the handler.
- The jump takes us to the location after the handler code.
- - sp_instr_hpop
- Pop the handlers of the current frame (which we are just leaving).
-
- It might seems strange to jump past the handlers like that, but there's
- no extra cost in doing this, and for technical reasons it's easiest for
- the parser to generate the handler instructions when they occur in the
- source.
-
- When an error occurs, one of the error routines is called and an error
- message is normally sent back to the client immediately.
- Catching a condition must be done in these error routines (there are
- quite a few) to prevent them from doing this. We do this by calling
- a method in the THD's sp_rcontext (if there is one). If a handler is
- found, this is recorded in the context and the routine returns without
- sending the error message.
- The execution loop (sp_head::execute()) checks for this after each
- statement and invokes the handler that has been found. If several
- errors or warnings occurs during one statement, only the first is
- caught, the rest are ignored.
-
- Invoking and returning from a handler is trivial in the EXIT case.
- We simply jump to it, and it will have an sp_instr_jump as its last
- instruction.
-
- Calling and returning from a CONTINUE handler poses some special
- problems. Since we need to return to the point after its invocation,
- we push the return location on a stack in the sp_rcontext (this is
- done by the execution loop). The handler then ends with a special
- instruction, sp_instr_hreturn, which returns to this location.
-
- CONTINUE handlers have one additional problem: They are parsed at
- the lexical level where they occur, so variable offsets will assume
- that it's actually called at that level. However, a handler might be
- invoked from a sub-block where additional local variables have been
- declared, which will then share the location of any local variables
- in the handler itself. So, when calling a CONTINUE handler, we need
- to save any local variables above the handler's frame offset, and
- restore them upon return. (This is not a problem for EXIT handlers,
- since they will leave the block anyway.)
- This is taken care of by the execution loop and the sp_instr_hreturn
- instruction.
-
- - Examples:
-
- - EXIT handler
- begin
- declare x int default 0;
-
- begin
- declare exit handler for 'XXXXX' set x = 1;
-
- (statement1);
- (statement2);
- end;
- (statement3);
- end
-
- Pos. Instruction
- 0 sp_instr_set(0, '0')
- 1 sp_instr_hpush_jump(4, 1) # location and frame size
- 2 sp_instr_set(0, '1')
- 3 sp_instr_jump(6)
- 4 sp_instr_stmt('statement1')
- 5 sp_instr_stmt('statement2')
- 6 sp_instr_hpop(1)
- 7 sp_instr_stmt('statement3')
-
- - CONTINUE handler
- create procedure hndlr1(val int)
- begin
- declare x int default 0;
- declare foo condition for 1146;
- declare continue handler for foo set x = 1;
-
- insert into t3 values ("hndlr1", val); # Non-existing table?
- if x>0 then
- insert into t1 values ("hndlr1", val); # This instead then
- end if;
- end|
-
- Pos. Instruction
- 0 sp_instr_set(1, '0')
- 1 sp_instr_hpush_jump(4, 2)
- 2 sp_instr_set(1, '1')
- 3 sp_instr_hreturn(2) # frame size
- 4 sp_instr_stmt('insert ... t3 ...')
- 5 sp_instr_jump_if_not(7, 'x>0')
- 6 sp_instr_stmt('insert ... t1 ...')
- 7 sp_instr_hpop(2)
-
-
- - Cursors
-
- For stored procedures to be really useful, you want to have cursors.
- MySQL doesn't yet have "real" cursor support (with API and ODBC support,
- allowing updating, arbitrary scrolling, etc), but a simple asensitive,
- non-scrolling, read-only cursor can be implemented in SPs using the
- class Protocol_cursor.
- This class intecepts the creation and sending of results sets and instead
- stores it in-memory, as MYSQL_FIELDS and MYSQL_ROWS (as in the client API).
-
- To support this, we need the usual name binding support in sp_pcontext
- (similar to variables and conditions) to keep track on declared cursor
- names, and a corresponding run-time mechanism in sp_rcontext.
- Cursors are lexically scoped like everything with a body or BEGIN/END
- block, so they are pushed and poped as usual (see conditions and variables
- above).
- The basic operations on a cursor are OPEN, FETCH and CLOSE, which will
- each have a corresponding instruction. In addition, we need instructions
- to push a new cursor (this will encapsulate the LEX of the SELECT statement
- of the cursor), and a pop instruction:
- - sp_instr_cpush
- Push a cursor to the sp_rcontext. This instruction contains the LEX
- for the select statement
- - sp_instr_cpop
- Pop a number of cursors from the sp_rcontext.
- - sp_instr_copen
- Open a cursor: This will execute the select and get the result set
- in a sepeate memroot.
- - sp_instr_cfetch
- Fetch the next row from the in-memory result set. The instruction
- contains a list of the variables (frame offsets) to set.
- - sp_instr_cclose
- Free the result set.
-
- A cursor is a separate class, sp_cursor (defined in sp_rcontex.h) which
- encapsulates the basic operations used by the above instructions.
- This class contains the LEX, Protocol_cursor object, and its memroot,
- as well as the cursor's current state.
- Compiling and executing is fairly straight-forward. sp_instr_copen is
- a subclass of sp_instr_stmt and uses its mechanism to execute a
- substatement.
-
- - Example:
-
- begin
- declare x int;
- declare c cursor for select a from t1;
-
- open c;
- fetch c into x;
- close c;
- end
-
- Pos. Instruction
- 0 sp_instr_cpush('select a from ...')
- 1 sp_instr_copen(0) # The 0'th cursor
- 2 sp_instr_cfetch(0) # Contains the variable list
- 3 sp_instr_cclose(0)
- 4 sp_instr_cpop(1)
-
-
-
- - The SP cache
-
- There are two ways to cache SPs:
-
- 1) one global cache, share by all threads/connections,
- 2) one cache per thread.
-
- There are pros and cons with both methods:
-
- 1) Pros: Save memory, each SP only read from table once,
- Cons: Needs locking (= serialization at access), requires thread-safe
- data structures,
- 2) Pros: Fast, no locking required (almost), limited thread-safe
- requirement,
- Cons: Uses more memory, each SP read from table once per thread.
-
- Unfortunately, we cannot use alternative 1 for the time being, as most
- of the data structures to be cached (lex and items) are not reentrant
- and thread-safe. (Things are modified at execution, we have THD pointers
- stored everywhere, etc.)
- This leaves us with alternative 2, one cache per thread; or actually
- two, since we keep FUNCTIONs and PROCEDUREs in separate caches.
- This is not that terrible; the only case when it will perform
- significantly worse than a global cache is when we have an application
- where new threads are connecting, calling a procedure, and disconnecting,
- over and over again.
-
- The cache implementation itself is simple and straightforward, a hashtable
- wrapped in a class and a C API (see APIs below).
-
- There is however one issue with multiple caches: dropping and altering
- procedures. Normally, this should be a very rare event in a running
- system; it's typically something you do during development and testing,
- so it's not unthinkable that we would simply ignore the issue and let
- any threads running with a cached version of an SP keep doing so until
- its disconnected.
- But assuming we want to keep the caches consistent with respect to drop
- and alter, it can be done:
-
- 1) A global counter is needed, initialized to 0 at start.
- 2) At each DROP or ALTER, increase the counter by one.
- 3) Each cache has its own copy of the counter, copied at the last read.
- 4) When looking up a name in the cache, first check if the global counter
- is larger than the local copy.
- If so, clear the cache and return "not found", and update the local
- counter; otherwise, lookup as usual.
-
- This minimizes the cost to a single brief lock for the access of an
- integer when operating normally. Only in the event of an actual drop or
- alter, is the cache cleared. This may seem to be drastic, but since we
- assume that this is a rare event, it's not a problem.
- It would of course be possible to have a much more fine-grained solution,
- keeping track of each SP, but the overhead of doing so is not worth the
- effort.
-
-
- - Class and function APIs
- This is an outline of the key types. Some types and other details
- in the actual files have been omitted for readability.
-
- - The parser context: sp_pcontext.h
-
- typedef enum
- {
- sp_param_in,
- sp_param_out,
- sp_param_inout
- } sp_param_mode_t;
-
- typedef struct
- {
- LEX_STRING name;
- enum enum_field_types type;
- sp_param_mode_t mode;
- uint offset; // Offset in current frame
- my_bool isset;
- } sp_pvar_t;
-
- typedef struct sp_cond_type
- {
- enum { number, state, warning, notfound, exception } type;
- char sqlstate[6];
- uint mysqlerr;
- } sp_cond_type_t;
-
- class sp_pcontext
- {
- sp_pcontext();
-
- // Return the maximum frame size
- uint max_framesize();
-
- // Return the current frame size
- uint current_framesize();
-
- // Return the number of parameters
- uint params();
-
- // Set the number of parameters to the current frame size
- void set_params();
-
- // Set type of the variable at offset 'i' in the frame
- void set_type(uint i, enum enum_field_types type);
-
- // Mark the i:th variable to "set" (i.e. having a value) with
- // 'val' true.
- void set_isset(uint i, my_bool val);
-
- // Push the variable 'name' to the frame.
- void push_var(LEX_STRING *name,
- enum enum_field_types type, sp_param_mode_t mode);
-
- // Pop 'num' variables from the frame.
- void pop_var(uint num = 1);
-
- // Find variable by name
- sp_pvar_t *find_pvar(LEX_STRING *name);
-
- // Find variable by index
- sp_pvar_t *find_pvar(uint i);
-
- // Push label 'name' of instruction index 'ip' to the label context
- sp_label_t *push_label(char *name, uint ip);
-
- // Find label 'name' in the context
- sp_label_t *find_label(char *name);
-
- // Return the last pushed label
- sp_label_t *last_label();
-
- // Return and remove the last pushed label.
- sp_label_t *pop_label();
-
- // Push a condition to the context
- void push_cond(LEX_STRING *name, sp_cond_type_t *val);
-
- // Pop a 'num' condition from the context
- void pop_cond(uint num);
-
- // Find a condition in the context
- sp_cond_type_t *find_cond(LEX_STRING *name);
-
- // Increase the handler count
- void add_handler();
-
- // Returns the handler count
- uint handlers();
-
- // Push a cursor
- void push_cursor(LEX_STRING *name);
-
- // Find a cursor
- my_bool find_cursor(LEX_STRING *name, uint *poff);
-
- // Pop 'num' cursors
- void pop_cursor(uint num);
-
- // Return the number of cursors
- uint cursors();
- }
-
-
- - The run-time context (call frame): sp_rcontext.h
-
- #define SP_HANDLER_NONE 0
- #define SP_HANDLER_EXIT 1
- #define SP_HANDLER_CONTINUE 2
- #define SP_HANDLER_UNDO 3
-
- typedef struct
- {
- struct sp_cond_type *cond;
- uint handler; // Location of handler
- int type;
- uint foffset; // Frame offset for the handlers declare level
- } sp_handler_t;
-
- class sp_rcontext
- {
- // 'fsize' is the max size of the context, 'hmax' the number of handlers,
- // 'cmax' the number of cursors
- sp_rcontext(uint fsize, uint hmax, , uint cmax);
-
- // Push value (parameter) 'i' to the frame
- void push_item(Item *i);
-
- // Set slot 'idx' to value 'i'
- void set_item(uint idx, Item *i);
-
- // Return the item in slot 'idx'
- Item *get_item(uint idx);
-
- // Set the "out" index 'oidx' for slot 'idx. If it's an IN slot,
- // use 'oidx' -1.
- void set_oindex(uint idx, int oidx);
-
- // Return the "out" index for slot 'idx'
- int get_oindex(uint idx);
-
- // Set the FUNCTION result
- void set_result(Item *i);
-
- // Get the FUNCTION result
- Item *get_result();
-
- // Push handler at location 'h' for condition 'cond'. 'f' is the
- // current variable frame size.
- void push_handler(sp_cond_type_t *cond, uint h, int type, uint f);
-
- // Pop 'count' handlers
- void pop_handlers(uint count);
-
- // Find a handler for this error. This sets the state for a found
- // handler in the context. If called repeatedly without clearing,
- // only the first call's state is kept.
- int find_handler(uint sql_errno);
-
- // Returns 1 if a handler has been found, with '*ip' and '*fp' set
- // to the handler location and frame size respectively.
- int found_handler(uint *ip, uint *fp);
-
- // Clear the found handler state.
- void clear_handler();
-
- // Push a return address for a CONTINUE handler
- void push_hstack(uint ip);
-
- // Pop the CONTINUE handler return stack
- uint pop_hstack();
-
- // Save variables from frame index 'fp' and up.
- void save_variables(uint fp);
-
- // Restore saved variables from to frame index 'fp' and up.
- void restore_variables(uint fp);
-
- // Push a cursor for the statement (lex)
- void push_cursor(LEX *lex);
-
- // Pop 'count' cursors
- void pop_cursors(uint count);
-
- // Pop all cursors
- void pop_all_cursors();
-
- // Get the 'i'th cursor
- sp_cursor *get_cursor(uint i);
-
- }
-
-
- - The procedure: sp_head.h
-
- #define TYPE_ENUM_FUNCTION 1
- #define TYPE_ENUM_PROCEDURE 2
-
- class sp_head
- {
- int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
-
- sp_head();
-
- void init(LEX_STRING *name, LEX *lex, LEX_STRING *comment, char suid);
-
- // Store this procedure in the database. This is a wrapper around
- // the function sp_create_procedure().
- int create(THD *);
-
- // Invoke a FUNCTION
- int
- execute_function(THD *thd, Item **args, uint argcount, Item **resp);
-
- // CALL a PROCEDURE
- int
- execute_procedure(THD *thd, List<Item> *args);
-
- // Add the instruction to this procedure.
- void add_instr(sp_instr *);
-
- // Returns the number of instructions.
- uint instructions();
-
- // Returns the last instruction
- sp_instr *last_instruction();
-
- // Resets lex in 'thd' and keeps a copy of the old one.
- void reset_lex(THD *);
-
- // Restores lex in 'thd' from our copy, but keeps some status from the
- // one in 'thd', like ptr, tables, fields, etc.
- void restore_lex(THD *);
-
- // Put the instruction on the backpatch list, associated with
- // the label.
- void push_backpatch(sp_instr *, struct sp_label *);
-
- // Update all instruction with this label in the backpatch list to
- // the current position.
- void backpatch(struct sp_label *);
-
- // Returns the SP name (with optional length in '*lenp').
- char *name(uint *lenp = 0);
-
- // Returns the result type for a function
- Item_result result();
-
- // Sets various attributes
- void sp_set_info(char *creator, uint creatorlen,
- longlong created, longlong modified,
- bool suid, char *comment, uint commentlen);
- }
-
-
- - Instructions
-
- - The base class:
- class sp_instr
- {
- // 'ip' is the index of this instruction
- sp_instr(uint ip);
-
- // Execute this instrution.
- // '*nextp' will be set to the index of the next instruction
- // to execute. (For most instruction this will be the
- // instruction following this one.)
- // Returns 0 on success, non-zero if some error occurred.
- virtual int execute(THD *, uint *nextp)
- }
-
- - Statement instruction:
- class sp_instr_stmt : public sp_instr
- {
- sp_instr_stmt(uint ip);
-
- int execute(THD *, uint *nextp);
-
- // Set the statement's Lex
- void set_lex(LEX *);
-
- // Return the statement's Lex
- LEX *get_lex();
- }
-
- - SET instruction:
- class sp_instr_set : public sp_instr
- {
- // 'offset' is the variable's frame offset, 'val' the value,
- // and 'type' the variable type.
- sp_instr_set(uint ip,
- uint offset, Item *val, enum enum_field_types type);
-
- int execute(THD *, uint *nextp);
- }
-
- - Unconditional jump
- class sp_instr_jump : public sp_instr
- {
- // No destination, must be set.
- sp_instr_jump(uint ip);
-
- // 'dest' is the destination instruction index.
- sp_instr_jump(uint ip, uint dest);
-
- int execute(THD *, uint *nextp);
-
- // Set the destination instruction 'dest'.
- void set_destination(uint dest);
- }
-
- - Conditional jump
- class sp_instr_jump_if_not : public sp_instr_jump
- {
- // Jump if 'i' evaluates to false. Destination not set yet.
- sp_instr_jump_if_not(uint ip, Item *i);
-
- // Jump to 'dest' if 'i' evaluates to false.
- sp_instr_jump_if_not(uint ip, Item *i, uint dest)
-
- int execute(THD *, uint *nextp);
- }
-
- - Return a function value
- class sp_instr_freturn : public sp_instr
- {
- // Return the value 'val'
- sp_instr_freturn(uint ip, Item *val, enum enum_field_types type);
-
- int execute(THD *thd, uint *nextp);
- }
-
- - Push a handler and jump
- class sp_instr_hpush_jump : public sp_instr_jump
- {
- // Push handler of type 'htype', with current frame size 'fp'
- sp_instr_hpush_jump(uint ip, int htype, uint fp);
-
- int execute(THD *thd, uint *nextp);
-
- // Add condition for this handler
- void add_condition(struct sp_cond_type *cond);
- }
-
- - Pops handlers
- class sp_instr_hpop : public sp_instr
- {
- // Pop 'count' handlers
- sp_instr_hpop(uint ip, uint count);
-
- int execute(THD *thd, uint *nextp);
- }
-
- - Return from a CONTINUE handler
- class sp_instr_hreturn : public sp_instr
- {
- // Return from handler, and restore variables to 'fp'.
- sp_instr_hreturn(uint ip, uint fp);
-
- int execute(THD *thd, uint *nextp);
- }
-
- - Push a CURSOR
- class sp_instr_cpush : public sp_instr_stmt
- {
- // Push a cursor for statement 'lex'
- sp_instr_cpush(uint ip, LEX *lex)
-
- int execute(THD *thd, uint *nextp);
- }
-
- - Pop CURSORs
- class sp_instr_cpop : public sp_instr_stmt
- {
- // Pop 'count' cursors
- sp_instr_cpop(uint ip, uint count)
-
- int execute(THD *thd, uint *nextp);
- }
-
- - Open a CURSOR
- class sp_instr_copen : public sp_instr_stmt
- {
- // Open the 'c'th cursor
- sp_instr_copen(uint ip, uint c);
-
- int execute(THD *thd, uint *nextp);
- }
-
- - Close a CURSOR
- class sp_instr_cclose : public sp_instr
- {
- // Close the 'c'th cursor
- sp_instr_cclose(uint ip, uint c);
-
- int execute(THD *thd, uint *nextp);
- }
-
- - Fetch a row with CURSOR
- class sp_instr_cfetch : public sp_instr
- {
- // Fetch next with the 'c'th cursor
- sp_instr_cfetch(uint ip, uint c);
-
- int execute(THD *thd, uint *nextp);
-
- // Add a target variable for the fetch
- void add_to_varlist(struct sp_pvar *var);
- }
-
-
- - Utility functions: sp.h
-
- #define SP_OK 0
- #define SP_KEY_NOT_FOUND -1
- #define SP_OPEN_TABLE_FAILED -2
- #define SP_WRITE_ROW_FAILED -3
- #define SP_DELETE_ROW_FAILED -4
- #define SP_GET_FIELD_FAILED -5
- #define SP_PARSE_ERROR -6
-
- // Finds a stored procedure given its name. Returns NULL if not found.
- sp_head *sp_find_procedure(THD *, LEX_STRING *name);
-
- // Store the procedure 'name' in the database. 'def' is the complete
- // definition string ("create procedure ...").
- int sp_create_procedure(THD *,
- char *name, uint namelen,
- char *def, uint deflen,
- char *comment, uint commentlen, bool suid);
-
- // Drop the procedure 'name' from the database.
- int sp_drop_procedure(THD *, char *name, uint namelen);
-
- // Finds a stored function given its name. Returns NULL if not found.
- sp_head *sp_find_function(THD *, LEX_STRING *name);
-
- // Store the function 'name' in the database. 'def' is the complete
- // definition string ("create function ...").
- int sp_create_function(THD *,
- char *name, uint namelen,
- char *def, uint deflen,
- char *comment, uint commentlen, bool suid);
-
- // Drop the function 'name' from the database.
- int sp_drop_function(THD *, char *name, uint namelen);
-
-
- - The cache: sp_cache.h
-
- /* Initialize the SP caching once at startup */
- void sp_cache_init();
-
- /* Clear the cache *cp and set *cp to NULL */
- void sp_cache_clear(sp_cache **cp);
-
- /* Insert an SP to cache. If **cp points to NULL, it's set to a
- new cache */
- void sp_cache_insert(sp_cache **cp, sp_head *sp);
-
- /* Lookup an SP in cache */
- sp_head *sp_cache_lookup(sp_cache **cp, char *name, uint namelen);
-
- /* Remove an SP from cache */
- void sp_cache_remove(sp_cache **cp, sp_head *sp);
-
-
- - The mysql.proc schema:
-
- CREATE TABLE proc (
- db char(64) binary DEFAULT '' NOT NULL,
- name char(64) DEFAULT '' NOT NULL,
- type enum('FUNCTION','PROCEDURE') NOT NULL,
- specific_name char(64) DEFAULT '' NOT NULL,
- language enum('SQL') DEFAULT 'SQL' NOT NULL,
- sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL,
- is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL,
- security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL,
- param_list blob DEFAULT '' NOT NULL,
- returns char(64) DEFAULT '' NOT NULL,
- body blob DEFAULT '' NOT NULL,
- definer char(77) binary DEFAULT '' NOT NULL,
- created timestamp,
- modified timestamp,
- sql_mode set(
- 'REAL_AS_FLOAT',
- 'PIPES_AS_CONCAT',
- 'ANSI_QUOTES',
- 'IGNORE_SPACE',
- 'IGNORE_BAD_TABLE_OPTIONS',
- 'ONLY_FULL_GROUP_BY',
- 'NO_UNSIGNED_SUBTRACTION',
- 'NO_DIR_IN_CREATE',
- 'POSTGRESQL',
- 'ORACLE',
- 'MSSQL',
- 'DB2',
- 'MAXDB',
- 'NO_KEY_OPTIONS',
- 'NO_TABLE_OPTIONS',
- 'NO_FIELD_OPTIONS',
- 'MYSQL323',
- 'MYSQL40',
- 'ANSI',
- 'NO_AUTO_VALUE_ON_ZERO'
- ) DEFAULT 0 NOT NULL,
- comment char(64) binary DEFAULT '' NOT NULL,
- PRIMARY KEY (db,name,type)
- ) comment='Stored Procedures';
-
- --
-
diff --git a/KNOWN_BUGS.txt b/KNOWN_BUGS.txt
index 56c9102b0cd..af65c98590d 100644
--- a/KNOWN_BUGS.txt
+++ b/KNOWN_BUGS.txt
@@ -1,35 +1,15 @@
-This file should contain all known fatal bugs in Mariadb and the Aria
-storage engine for the last source or binary release. Minor bugs,
-extensions and feature requests, and bugs found since this release can
-be found in the MariaDB bugs database at: http://mariadb.org/jira and
-in the MySQL bugs databases at: http://bugs.mysql.com/ (category
-"Maria storage engine").
+This file should contain all known fatal bugs in MariaDB for the last
+source or binary release. Minor bugs, extensions and feature requests,
+and bugs found since this release can be found in the MariaDB bugs
+database at: https://jira.mariadb.org
There should not normally be any bugs which affect normal operations
in any MariaDB release. Still, there are always exceptions and edge
cases and that is what this file is for.
-If you have found a bug that is not listed here, please add it to
-http://mariadb.org/jira so we can either fix it for next release or in
-the worst case add it here for others to know!
+If you have find bug please add it to https://jira.mariadb.org so
+that we are can try to fix it for the next release. You can also add
+feature request to the JIRA.
-
-IMPORTANT:
-
-If you have been using the Maria (now Aria) storage engine with the
-MySQL-5.1-Maria-alpha build and are upgrading to a newer MariaDB you
-MUST run [m]aria_chk --recover on all your Aria tables. This is because
-we made an incompatible change with how the transaction id is stored
-and old transaction id's must be reset!
-
-cd mysql-data-directory
-aria_chk --recover */*.MAI
-
-Going forward, we will do our best to not introduce any incompatible
-changes in the data format for Aria tables. If this would be ever be
-needed, we will, if possible, support both the old and the new version
-to make upgrades as easy as possible.
-
-Note that for the MariaDB 5.1 release the Aria storage engine is
-classified as 'beta'; It should work, but use it with caution. Please
-report all bugs to http://mariadb.org/jira so we can fix them!
+The latest documentation for the MariaDB server can be found at:
+https://mariadb.com/kb
diff --git a/README.md b/README.md
index 7cdcc90471f..8d4a6e7cfab 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,21 @@
Code status:
------------
-* [![tests status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.4)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch)
+* [![Travis CI status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.4)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch)
+* [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com
## MariaDB: drop-in replacement for MySQL
MariaDB is designed as a drop-in replacement of MySQL(R) with more
features, new storage engines, fewer bugs, and better performance.
-MariaDB is brought to you by the MariaDB Foundation.
+MariaDB is brought to you by the MariaDB Foundation and the MariaDB corporation.
Please read the CREDITS file for details about the MariaDB Foundation,
and who is developing MariaDB.
MariaDB is developed by many of the original developers of MySQL who
-now work for the MariaDB Foundation and the MariaDB Corporation,
-and by many people in the community.
+now work for the MariaDB Corporation, the MariaDB Foundation and by
+many people in the community.
MySQL, which is the base of MariaDB, is a product and trademark of Oracle
Corporation, Inc. For a list of developers and other contributors,
@@ -23,28 +24,35 @@ list of active contributors.
A description of the MariaDB project and a manual can be found at:
-https://mariadb.org/
-
https://mariadb.com/kb/en/
https://mariadb.com/kb/en/mariadb-vs-mysql-features/
-https://mariadb.com/kb/en/mariadb-versus-mysql-features/
-
https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/
+https://mariadb.com/kb/en/library/new-and-old-releases/
+
+https://mariadb.org/
+
As MariaDB is a full replacement of MySQL, the MySQL manual at
http://dev.mysql.com/doc is generally applicable.
-Help:
+Help
-----
More help is available from the Maria Discuss mailing list
https://launchpad.net/~maria-discuss
and the #maria IRC channel on Freenode.
+Live QA for beginner contributors
+----
+MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC.
+From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays,
+anyone can ask any questions they’d like, and a live developer will be available to assist.
+
+New contributors can ask questions any time, but we will provide immediate feedback during that interval.
-License:
+License
--------
***************************************************************************
@@ -61,7 +69,7 @@ and COPYING.thirdparty files.
***************************************************************************
-Bug Reports:
+Bug Reports
------------
Bug and/or error reports regarding MariaDB should be submitted at:
diff --git a/VERSION b/VERSION
index b1d946982f6..87c93d24617 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=4
-MYSQL_VERSION_PATCH=1
-SERVER_MATURITY=alpha
+MYSQL_VERSION_PATCH=3
+SERVER_MATURITY=beta
diff --git a/appveyor.yml b/appveyor.yml
index 22939d496c9..4a6a49fd8b5 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,7 +3,7 @@ version: build-{build}~branch-{branch}
before_build:
- md %APPVEYOR_BUILD_FOLDER%\win_build
- cd %APPVEYOR_BUILD_FOLDER%\win_build
- - cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0
+ - cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 -DWITH_MARIABACKUP=0 -DMYSQL_MAINTAINER_MODE=ERR -DPLUGIN_ROCKSDB=NO -DPLUGIN_CONNECT=NO -DBISON_EXECUTABLE=C:\cygwin64\bin\bison
build:
project: win_build\MySQL.sln
@@ -16,6 +16,6 @@ platform: x64
test_script:
- set PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
- cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test
- - perl mysql-test-run.pl --force --max-test-fail=10 --parallel=auto --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup
+ - perl mysql-test-run.pl --force --max-test-fail=10 --parallel=4 --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main
image: Visual Studio 2017
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index e2329f505ab..ff6422d15da 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -46,7 +46,7 @@ ENDIF(UNIX)
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
-TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre pcreposix)
+TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcreposix pcre)
SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE)
diff --git a/client/mysql.cc b/client/mysql.cc
index 4e94d092a5e..a20a1665071 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -278,9 +278,9 @@ static COMMANDS commands[] = {
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
#endif
{ "ego", 'G', com_ego, 0,
- "Send command to mysql server, display result vertically."},
+ "Send command to MariaDB server, display result vertically."},
{ "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
- { "go", 'g', com_go, 0, "Send command to mysql server." },
+ { "go", 'g', com_go, 0, "Send command to MariaDB server." },
{ "help", 'h', com_help, 1, "Display this help." },
#ifdef USE_POPEN
{ "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
@@ -1537,7 +1537,7 @@ static struct my_option my_long_options[] =
&ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"init-command", OPT_INIT_COMMAND,
- "SQL Command to execute when connecting to MySQL server. Will "
+ "SQL Command to execute when connecting to MariaDB server. Will "
"automatically be re-executed when reconnecting.",
&opt_init_command, &opt_init_command, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -1599,7 +1599,7 @@ static struct my_option my_long_options[] =
"Get progress reports for long running commands (like ALTER TABLE)",
&opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},
- {"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
+ {"prompt", OPT_PROMPT, "Set the command line prompt to this value.",
&current_prompt, &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).",
@@ -3127,7 +3127,7 @@ com_help(String *buffer __attribute__((unused)),
put_info("\nGeneral information about MariaDB can be found at\n"
"http://mariadb.org\n", INFO_INFO);
- put_info("List of all MySQL commands:", INFO_INFO);
+ put_info("List of all client commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
for (i = 0; commands[i].name; i++)
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index c5a79e24c03..ee10996d678 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -111,7 +111,7 @@ static struct my_option my_long_options[]=
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
- "has already been executed for the current version of MySQL.",
+ "has already been executed for the current version of MariaDB.",
&opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -808,7 +808,7 @@ static my_bool is_mysql()
strstr(ds_events_struct.str, "IGNORE_BAD_TABLE_OPTIONS") != NULL)
ret= FALSE;
else
- verbose("MySQL upgrade detected");
+ verbose("MariaDB upgrade detected");
dynstr_free(&ds_events_struct);
return(ret);
@@ -878,10 +878,14 @@ static int run_mysqlcheck_fixnames(void)
static const char *expected_errors[]=
{
+ "ERROR 1051", /* Unknown table */
"ERROR 1060", /* Duplicate column name */
"ERROR 1061", /* Duplicate key name */
"ERROR 1054", /* Unknown column */
+ "ERROR 1146", /* Table does not exist */
"ERROR 1290", /* RR_OPTION_PREVENTS_STATEMENT */
+ "ERROR 1347", /* 'mysql.user' is not of type 'BASE TABLE' */
+ "ERROR 1348", /* Column 'Show_db_priv' is not updatable */
0
};
@@ -1192,7 +1196,7 @@ int main(int argc, char **argv)
*/
if (!opt_force && upgrade_already_done(0))
{
- printf("This installation of MySQL is already upgraded to %s, "
+ printf("This installation of MariaDB is already upgraded to %s, "
"use --force if you still need to run mysql_upgrade\n",
MYSQL_SERVER_VERSION);
goto end;
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index be81deb2780..35afe06eade 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -573,7 +573,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
if (!info)
{
info=1;
- fputs("Waiting for MySQL server to answer",stderr);
+ fputs("Waiting for MariaDB server to answer",stderr);
(void) fflush(stderr);
}
else
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 1b6c94aaf6d..a5995e103ef 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1598,7 +1598,7 @@ static struct my_option my_options[] =
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
- "enabled --to-last-log and are sending the output to the same MySQL server. "
+ "enabled --to-last-log and are sending the output to the same MariaDB server. "
"This way you could avoid an endless loop. You would also like to use it "
"when restoring after a crash to avoid duplication of the statements you "
"already have. NOTE: you will need a SUPER privilege to use this option.",
@@ -1643,7 +1643,7 @@ static struct my_option my_options[] =
{"protocol", OPT_MYSQL_PROTOCOL,
"The protocol to use for connection (tcp, socket, pipe).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"read-from-remote-server", 'R', "Read binary logs from a MySQL server.",
+ {"read-from-remote-server", 'R', "Read binary logs from a MariaDB server.",
&remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"raw", 0, "Requires -R. Output raw binlog data instead of SQL "
@@ -1696,7 +1696,7 @@ static struct my_option my_options[] =
{"start-datetime", OPT_START_DATETIME,
"Start reading the binlog at first event having a datetime equal or "
"posterior to the argument; the argument must be a date and time "
- "in the local time zone, in any format accepted by the MySQL server "
+ "in the local time zone, in any format accepted by the MariaDB server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
&start_datetime_str, &start_datetime_str,
@@ -1714,7 +1714,7 @@ static struct my_option my_options[] =
{"stop-datetime", OPT_STOP_DATETIME,
"Stop reading the binlog at first event having a datetime equal or "
"posterior to the argument; the argument must be a date and time "
- "in the local time zone, in any format accepted by the MySQL server "
+ "in the local time zone, in any format accepted by the MariaDB server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
&stop_datetime_str, &stop_datetime_str,
@@ -1738,7 +1738,7 @@ static struct my_option my_options[] =
0, 0, 0, 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
-binlog of the MySQL server. If you send the output to the same MySQL server, \
+binlog of the MariaDB server. If you send the output to the same MariaDB server, \
that may lead to an endless loop.",
&to_last_remote_log, &to_last_remote_log, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -1875,7 +1875,7 @@ static void usage()
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
printf("\
-Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
+Dumps a MariaDB binary log in a format usable for viewing or for piping to\n\
the mysql command line client.\n\n");
printf("Usage: %s [options] log-files\n", my_progname);
print_defaults("my",load_groups);
@@ -1893,7 +1893,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
uint dummy_in_dst_time_gap;
/* We require a total specification (date AND time) */
- if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &status) ||
+ if (str_to_datetime_or_date(str, (uint) strlen(str), &l_time, 0, &status) ||
l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings)
{
error("Incorrect date and time argument: %s", str);
@@ -2281,7 +2281,7 @@ static Exit_status check_master_version()
break;
default:
error("Could not find server version: "
- "Master reported unrecognized MySQL version '%s'.", row[0]);
+ "Master reported unrecognized MariaDB version '%s'.", row[0]);
goto err;
}
if (!glob_description_event || !glob_description_event->is_valid())
diff --git a/client/mysqldump.c b/client/mysqldump.c
index fd720514373..48eb2dfdb5e 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -254,10 +254,10 @@ static struct my_option my_long_options[] =
1, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables "
- "are dumped in a format optimized for MySQL. Legal modes are: ansi, "
+ "are dumped in a format optimized for MariaDB. Legal modes are: ansi, "
"mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, "
"no_table_options, no_field_options. One can use several modes separated "
- "by commas. Note: Requires MySQL server version 4.1.0 or higher. "
+ "by commas. Note: Requires MariaDB server version 4.1.0 or higher. "
"This option is ignored with earlier server versions.",
&opt_compatible_mode_str, &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -274,7 +274,7 @@ static struct my_option my_long_options[] =
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"create-options", 'a',
- "Include all MySQL specific create options.",
+ "Include all MariaDB specific create options.",
&create_options, &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"databases", 'B',
@@ -642,7 +642,7 @@ static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
- puts("Dumping structure and contents of MySQL databases and tables.");
+ puts("Dumping structure and contents of MariaDB databases and tables.");
short_usage_sub(stdout);
print_defaults("my",load_default_groups);
puts("");
@@ -700,7 +700,7 @@ static void write_header(FILE *sql_file, char *db_name)
else if (!opt_compact)
{
print_comment(sql_file, 0,
- "-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
+ "-- MariaDB dump %s Distrib %s, for %s (%s)\n--\n",
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s ",
@@ -5515,7 +5515,7 @@ static int start_transaction(MYSQL *mysql_con)
if ((mysql_get_server_version(mysql_con) < 40100) && opt_master_data)
{
fprintf(stderr, "-- %s: the combination of --single-transaction and "
- "--master-data requires a MySQL server version of at least 4.1 "
+ "--master-data requires a MariaDB server version of at least 4.1 "
"(current server's version is %s). %s\n",
ignore_errors ? "Warning" : "Error",
mysql_con->server_version ? mysql_con->server_version : "unknown",
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 2e4e8550fe3..977e0e6ca1e 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -195,13 +195,14 @@ static void usage(void)
{
puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.");
puts("Copyright 2008-2011 Oracle and Monty Program Ab.");
+ puts("Copyright 2012-2019 MariaDB Corporation Ab.");
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
printf("\
Loads tables from text files in various formats. The base name of the\n\
text file must be the name of the table that should be used.\n\
-If one uses sockets to connect to the MySQL server, the server will open and\n\
-read the text file directly. In other cases the client will open the text\n\
+If one uses sockets to connect to the MariaDB server, the server will open\n\
+and read the text file directly. In other cases the client will open the text\n\
file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n");
printf("\nUsage: %s [OPTIONS] database textfile...\n",my_progname);
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index d7c4dbec27e..a6108ef4fc1 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -268,7 +268,7 @@ static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
- puts("Shows the structure of a MySQL database (databases, tables, and columns).\n");
+ puts("Shows the structure of a MariaDB database (databases, tables, and columns).\n");
printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
puts("\n\
If last argument contains a shell or SQL wildcard (*,?,% or _) then only\n\
@@ -658,7 +658,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild)
fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n",
my_progname,db,wild ? wild : "",mysql_error(mysql));
if (mysql_errno(mysql) == ER_PARSE_ERROR)
- fprintf(stderr,"This error probably means that your MySQL server doesn't support the\n\'show table status' command.\n");
+ fprintf(stderr,"This error probably means that your MariaDB server doesn't support the\n\'show table status' command.\n");
return 1;
}
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 3b9703fe6d4..8c79da88e41 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -623,7 +623,7 @@ static struct my_option my_long_options[] =
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"init-command", OPT_INIT_COMMAND,
- "SQL Command to execute when connecting to MySQL server. Will "
+ "SQL Command to execute when connecting to MariaDB server. Will "
"automatically be re-executed when reconnecting.",
&opt_init_command, &opt_init_command, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index f8c4f84a385..a65dcc7da93 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -6581,8 +6581,6 @@ static inline bool is_escape_char(char c, char in_string)
SYNOPSIS
read_line
- buf buffer for the read line
- size size of the buffer i.e max size to read
DESCRIPTION
This function actually reads several lines and adds them to the
@@ -6600,10 +6598,15 @@ static inline bool is_escape_char(char c, char in_string)
*/
-int read_line(char *buf, int size)
+static char *read_command_buf= NULL;
+static size_t read_command_buflen= 0;
+static const size_t max_multibyte_length= 6;
+
+int read_line()
{
char c, last_quote=0, last_char= 0;
- char *p= buf, *buf_end= buf + size - 1;
+ char *p= read_command_buf;
+ char *buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
int skip_char= 0;
my_bool have_slash= FALSE;
@@ -6611,10 +6614,21 @@ int read_line(char *buf, int size)
R_COMMENT, R_LINE_START} state= R_LINE_START;
DBUG_ENTER("read_line");
+ *p= 0;
start_lineno= cur_file->lineno;
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
- for (; p < buf_end ;)
+ while (1)
{
+ if (p >= buf_end)
+ {
+ my_ptrdiff_t off= p - read_command_buf;
+ read_command_buf= (char*)my_realloc(read_command_buf,
+ read_command_buflen*2, MYF(MY_FAE));
+ p= read_command_buf + off;
+ read_command_buflen*= 2;
+ buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
+ }
+
skip_char= 0;
c= my_getc(cur_file->file);
if (feof(cur_file->file))
@@ -6650,7 +6664,7 @@ int read_line(char *buf, int size)
cur_file->lineno++;
/* Convert cr/lf to lf */
- if (p != buf && *(p-1) == '\r')
+ if (p != read_command_buf && *(p-1) == '\r')
p--;
}
@@ -6665,9 +6679,9 @@ int read_line(char *buf, int size)
}
else if ((c == '{' &&
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
- (uchar*) buf, MY_MIN(5, p - buf), 0) ||
+ (uchar*) read_command_buf, MY_MIN(5, p - read_command_buf), 0) ||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
- (uchar*) buf, MY_MIN(2, p - buf), 0))))
+ (uchar*) read_command_buf, MY_MIN(2, p - read_command_buf), 0))))
{
/* Only if and while commands can be terminated by { */
*p++= c;
@@ -6799,8 +6813,6 @@ int read_line(char *buf, int size)
}
}
}
- die("The input buffer is too small for this query.\n"
- "check your query or increase MAX_QUERY and recompile");
DBUG_RETURN(0);
}
@@ -6945,12 +6957,8 @@ bool is_delimiter(const char* p)
terminated by new line '\n' regardless how many "delimiter" it contain.
*/
-#define MAX_QUERY (256*1024*2) /* 256K -- a test in sp-big is >128K */
-static char read_command_buf[MAX_QUERY];
-
int read_command(struct st_command** command_ptr)
{
- char *p= read_command_buf;
struct st_command* command;
DBUG_ENTER("read_command");
@@ -6967,8 +6975,7 @@ int read_command(struct st_command** command_ptr)
die("Out of memory");
command->type= Q_UNKNOWN;
- read_command_buf[0]= 0;
- if (read_line(read_command_buf, sizeof(read_command_buf)))
+ if (read_line())
{
check_eol_junk(read_command_buf);
DBUG_RETURN(1);
@@ -6977,6 +6984,7 @@ int read_command(struct st_command** command_ptr)
if (opt_result_format_version == 1)
convert_to_format_v1(read_command_buf);
+ char *p= read_command_buf;
DBUG_PRINT("info", ("query: '%s'", read_command_buf));
if (*p == '#')
{
@@ -7170,7 +7178,7 @@ void usage()
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
- printf("Runs a test against the mysql server and compares output with a results file.\n\n");
+ printf("Runs a test against the MariaDB server and compares output with a results file.\n\n");
printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
print_defaults("my",load_default_groups);
puts("");
@@ -7928,7 +7936,7 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
static void handle_no_active_connection(struct st_command *command,
struct st_connection *cn, DYNAMIC_STRING *ds)
{
- handle_error(command, 2006, "MySQL server has gone away", "000000", ds);
+ handle_error(command, 2006, "MariaDB server has gone away", "000000", ds);
cn->pending= FALSE;
var_set_errno(2006);
}
@@ -9204,6 +9212,8 @@ int main(int argc, char **argv)
init_win_path_patterns();
#endif
+ read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
+
init_dynamic_string(&ds_res, "", 2048, 2048);
init_alloc_root(&require_file_root, "require_file", 1024, 1024, MYF(0));
@@ -9245,7 +9255,7 @@ int main(int argc, char **argv)
if (mysql_server_init(embedded_server_arg_count,
embedded_server_args,
(char**) embedded_server_groups))
- die("Can't initialize MySQL server");
+ die("Can't initialize MariaDB server");
server_initialized= 1;
if (cur_file == file_stack && cur_file->file == 0)
{
@@ -9972,7 +9982,7 @@ void do_get_replace(struct st_command *command)
char *buff, *start;
char word_end_chars[256], *pos;
POINTER_ARRAY to_array, from_array;
- DBUG_ENTER("get_replace");
+ DBUG_ENTER("do_get_replace");
free_replace();
diff --git a/cmake/configure.pl b/cmake/configure.pl
index c502a172a22..dfd961ee085 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -145,6 +145,11 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DPLUGIN_".uc($1)."=".uc($2);
next;
}
+ if($option =~ /without-wsrep/)
+ {
+ $cmakeargs = $cmakeargs." -DWITH_WSREP=OFF";
+ next;
+ }
if($option =~ /with-zlib-dir=bundled/)
{
$cmakeargs = $cmakeargs." -DWITH_ZLIB=bundled";
@@ -185,6 +190,16 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF";
next;
}
+ if($option =~ /with-(.*)=(.*)/)
+ {
+ $cmakeargs = $cmakeargs. " -DWITH_" . uc($1) . "=" . uc($2);
+ next;
+ }
+ if($option =~ /without-(.*)=(.*)/)
+ {
+ $cmakeargs = $cmakeargs. " -DWITHOUT_" . uc($1) . "=" . uc($2);
+ next;
+ }
if($option =~ /prefix=/)
{
$cmake_install_prefix= substr($option, 7);
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index d96638ed5df..19293e9a176 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -171,7 +171,7 @@ SETA(CPACK_RPM_server_PACKAGE_REQUIRES
IF(WITH_WSREP)
SETA(CPACK_RPM_server_PACKAGE_REQUIRES
- "galera" "rsync" "lsof" "grep" "gawk" "iproute"
+ "galera-4" "rsync" "lsof" "grep" "gawk" "iproute"
"coreutils" "findutils" "tar")
ENDIF()
@@ -214,6 +214,8 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
ALTERNATIVE_NAME("server" "mariadb-server")
ALTERNATIVE_NAME("server" "mysql-compat-server")
ALTERNATIVE_NAME("test" "mariadb-test")
+ELSEIF(RPM MATCHES "(rhel|centos)8")
+ SET(PYTHON_SHEBANG "/usr/bin/python3")
ENDIF()
# workaround for lots of perl dependencies added by rpmbuild
diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in
index 6fad17137fd..8e77b700eb7 100644
--- a/cmake/make_dist.cmake.in
+++ b/cmake/make_dist.cmake.in
@@ -50,6 +50,14 @@ IF(GIT_EXECUTABLE)
IF(NOT RESULT EQUAL 0)
SET(GIT_EXECUTABLE)
ENDIF()
+ EXECUTE_PROCESS(
+ COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/wsrep-lib/$path/"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wsrep-lib
+ RESULT_VARIABLE RESULT
+ )
+ IF(NOT RESULT EQUAL 0)
+ SET(GIT_EXECUTABLE)
+ ENDIF()
ENDIF()
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h
diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake
index c36087cb862..368a6cc8da5 100644
--- a/cmake/mariadb_connector_c.cmake
+++ b/cmake/mariadb_connector_c.cmake
@@ -6,10 +6,7 @@ ENDIF()
SET(CONC_WITH_SIGNCODE ${SIGNCODE})
SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS})
-
-IF(NOT TARGET zlib)
- SET(CONC_WITH_EXTERNAL_ZLIB ON)
-ENDIF()
+SET(CONC_WITH_EXTERNAL_ZLIB ON)
IF(SSL_DEFINES MATCHES "YASSL")
IF(WIN32)
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 2ba3aec16b4..f51015e436c 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -153,6 +153,7 @@ SET(HAVE_SIGSET CACHE INTERNAL "")
SET(HAVE_SIGTERM 1 CACHE INTERNAL "")
SET(HAVE_SIGTHREADMASK CACHE INTERNAL "")
SET(HAVE_SIGWAIT CACHE INTERNAL "")
+SET(HAVE_SIGWAITINFO CACHE INTERNAL "")
SET(HAVE_SIZEOF_CHARP TRUE CACHE INTERNAL "")
SET(SIZEOF_CHARP ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "")
SET(HAVE_SIZEOF_IN6_ADDR TRUE CACHE INTERNAL "")
diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake
index 4181f4cd01e..c2a415c6063 100644
--- a/cmake/submodules.cmake
+++ b/cmake/submodules.cmake
@@ -14,16 +14,16 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
SET(update_result 0)
ELSEIF (cmake_update_submodules MATCHES force)
MESSAGE(STATUS "Updating submodules (forced)")
- EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force
+ EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSEIF (cmake_update_submodules MATCHES yes)
- EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init
+ EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSE()
MESSAGE(STATUS "Updating submodules")
- EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init
+ EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ENDIF()
diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake
index 9fa127380a4..44e00649993 100644
--- a/cmake/wsrep.cmake
+++ b/cmake/wsrep.cmake
@@ -24,12 +24,15 @@ ELSE()
ENDIF()
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
+OPTION(WITH_WSREP_ALL
+ "Build all components of WSREP (unit tests, sample programs)"
+ OFF)
# Set the patch version
-SET(WSREP_PATCH_VERSION "23")
+SET(WSREP_PATCH_VERSION "22")
# Obtain wsrep API version
-FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION
+FILE(STRINGS "${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26/wsrep_api.h" WSREP_API_VERSION
LIMIT_COUNT 1 REGEX "WSREP_INTERFACE_VERSION")
STRING(REGEX MATCH "([0-9]+)" WSREP_API_VERSION "${WSREP_API_VERSION}")
@@ -40,4 +43,12 @@ SET(WSREP_PROC_INFO ${WITH_WSREP})
IF(WITH_WSREP)
SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}")
+ if (NOT WITH_WSREP_ALL)
+ SET(WSREP_LIB_WITH_UNIT_TESTS OFF CACHE BOOL
+ "Disable unit tests for wsrep-lib")
+ SET(WSREP_LIB_WITH_DBSIM OFF CACHE BOOL
+ "Disable building dbsim for wsrep-lib")
+ endif()
+ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/include)
+ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26)
ENDIF()
diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake
index 4b7faacc466..e269c473f36 100644
--- a/cmake/zlib.cmake
+++ b/cmake/zlib.cmake
@@ -34,11 +34,6 @@ ENDMACRO()
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
- # For NDBCLUSTER: Use bundled zlib by default
- IF (NOT WITH_ZLIB)
- SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
- ENDIF()
-
IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB()
ELSE()
diff --git a/config.h.cmake b/config.h.cmake
index 3974c2a3618..247d983c501 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -219,6 +219,7 @@
#cmakedefine HAVE_SIGACTION 1
#cmakedefine HAVE_SIGTHREADMASK 1
#cmakedefine HAVE_SIGWAIT 1
+#cmakedefine HAVE_SIGWAITINFO 1
#cmakedefine HAVE_SLEEP 1
#cmakedefine HAVE_SNPRINTF 1
#cmakedefine HAVE_STPCPY 1
diff --git a/configure.cmake b/configure.cmake
index 42ba2496105..08eac106e6a 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -400,6 +400,7 @@ CHECK_FUNCTION_EXISTS (setlocale HAVE_SETLOCALE)
CHECK_FUNCTION_EXISTS (sigaction HAVE_SIGACTION)
CHECK_FUNCTION_EXISTS (sigthreadmask HAVE_SIGTHREADMASK)
CHECK_FUNCTION_EXISTS (sigwait HAVE_SIGWAIT)
+CHECK_FUNCTION_EXISTS (sigwaitinfo HAVE_SIGWAITINFO)
CHECK_FUNCTION_EXISTS (sigset HAVE_SIGSET)
CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP)
CHECK_FUNCTION_EXISTS (snprintf HAVE_SNPRINTF)
diff --git a/debian/additions/debian-start b/debian/additions/debian-start
index 40c248fd81f..7940bbe68a5 100755
--- a/debian/additions/debian-start
+++ b/debian/additions/debian-start
@@ -15,7 +15,7 @@ fi
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
-MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
+MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check"
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
diff --git a/debian/additions/debian-start.inc.sh b/debian/additions/debian-start.inc.sh
index 0640bf9c2a6..fa5b1299bdc 100755
--- a/debian/additions/debian-start.inc.sh
+++ b/debian/additions/debian-start.inc.sh
@@ -60,7 +60,7 @@ function upgrade_system_tables_if_necessary() {
# errors as the script is designed to be idempotent.
LC_ALL=C $MYUPGRADE \
2>&1 \
- | egrep -v '^(1|@had|ERROR (1054|1060|1061))' \
+ | egrep -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \
| logger -p daemon.warn -i -t$0
}
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index 1c72ad28a3d..3442afbf376 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -102,7 +102,7 @@ fi
# AWS SDK also requires the build machine to have network access and git, so
# it cannot be part of the base version included in Linux distros, but a pure
# custom built plugin.
-if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && wget --timeout 15 --tries 1 --quiet --output-document /dev/null https://github.com/
+if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q </dev/tcp/github.com/22'
then
cat <<EOF >> debian/control
@@ -124,6 +124,12 @@ EOF
sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules
fi
+# Don't build cassandra package if thrift is not installed
+if [[ ! -f /usr/local/include/thrift/Thrift.h && ! -f /usr/include/thrift/Thrift.h ]]
+then
+ sed '/Package: mariadb-plugin-cassandra/,/^$/d' -i debian/control
+fi
+
# Mroonga, TokuDB never built on Travis CI anyway, see build flags above
if [[ $TRAVIS ]]
then
diff --git a/debian/control b/debian/control
index c990f4cfe5a..2366cbc9fc2 100644
--- a/debian/control
+++ b/debian/control
@@ -53,6 +53,8 @@ Conflicts: libmariadbclient18 (<< 10.2.0),
mariadb-server-5.2,
mariadb-server-5.3,
mariadb-server-5.5 (<< 5.5.33)
+Breaks: libmariadbclient18 (<< ${source:Version})
+Replaces: libmariadbclient18 (<< ${source:Version})
Description: MariaDB database client library
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -430,7 +432,7 @@ Recommends: libhtml-template-perl
Pre-Depends: adduser (>= 3.40),
debconf,
mariadb-common (>= ${source:Version})
-Depends: galera-3 (>=25.3),
+Depends: galera-4 (>=26.4),
gawk,
iproute | iproute2,
libdbi-perl,
@@ -594,7 +596,7 @@ Description: OQGraph storage engine for MariaDB
Package: mariadb-plugin-tokudb
Architecture: amd64
-Depends: libjemalloc1 (>= 3.0.0~),
+Depends: libjemalloc1 (>= 3.0.0~) | libjemalloc2,
mariadb-server-10.4 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
diff --git a/debian/mariadb-server-10.4.install b/debian/mariadb-server-10.4.install
index f115b212c98..292c2c2a521 100644
--- a/debian/mariadb-server-10.4.install
+++ b/debian/mariadb-server-10.4.install
@@ -36,8 +36,6 @@ usr/bin/wsrep_sst_common
usr/bin/wsrep_sst_mariabackup
usr/bin/wsrep_sst_mysqldump
usr/bin/wsrep_sst_rsync
-usr/bin/wsrep_sst_xtrabackup
-usr/bin/wsrep_sst_xtrabackup-v2
usr/lib/mysql/plugin/auth_ed25519.so
usr/lib/mysql/plugin/auth_pam.so
usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool
@@ -92,8 +90,7 @@ usr/share/man/man1/resolveip.1
usr/share/man/man1/wsrep_sst_common.1
usr/share/man/man1/wsrep_sst_mysqldump.1
usr/share/man/man1/wsrep_sst_rsync.1
-usr/share/man/man1/wsrep_sst_xtrabackup-v2.1
-usr/share/man/man1/wsrep_sst_xtrabackup.1
+usr/share/man/man1/wsrep_sst_mariabackup.1
usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/maria_add_gis_sp_bootstrap.sql
diff --git a/debian/mariadb-server-10.4.postinst b/debian/mariadb-server-10.4.postinst
index 3d9ece55b24..c813c9bd8b3 100644
--- a/debian/mariadb-server-10.4.postinst
+++ b/debian/mariadb-server-10.4.postinst
@@ -2,13 +2,16 @@
. /usr/share/debconf/confmodule
+# assume the filename is /path/to/mariadb-server-##.#.postinst
+VER=${0: -13:4}
+
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
-ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
+ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
# This will make an error in a logged command immediately apparent by aborting
# the install, rather than failing silently and leaving a broken install.
set -o pipefail
@@ -23,6 +26,8 @@ invoke() {
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --disable-log-bin --skip-grant-tables --default-storage-engine=myisam"
+have_global_priv_table=
+
set_mysql_rootpw() {
# forget we ever saw the password. don't use reset to keep the seen status
db_set mysql-server/root_password ""
@@ -33,13 +38,23 @@ set_mysql_rootpw() {
return 1
fi
- # this avoids us having to call "test" or "[" on $rootpw
cat << EOF > $tfile
USE mysql;
SET sql_log_bin=0;
+EOF
+ if test -n "$have_global_priv_table"; then
+ cat << EOF >> $tfile
+UPDATE global_priv SET priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', PASSWORD("$rootpw")) WHERE user='root';
+EOF
+ else
+ cat << EOF >> $tfile
UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root';
+EOF
+ fi
+ cat << EOF >> $tfile
FLUSH PRIVILEGES;
EOF
+ # this avoids us having to call "test" or "[" on $rootpw
if grep -q 'PASSWORD("")' $tfile; then
retval=0
else
@@ -146,7 +161,13 @@ EOF
$ERR_LOGGER
set -e
+ if test -f $mysql_datadir/mysql/global_priv.frm; then
+ have_global_priv_table=yes
+ fi
+ # To avoid downgrades.
+ touch $mysql_statedir/debian-$VER.flag
+
## On every reconfiguration the maintenance user is recreated.
#
# - It is easier to regenerate the password every time but as people
@@ -191,20 +212,29 @@ EOF
chown 0:0 $dc
chmod 0600 $dc
- replace_query=`/bin/echo -e \
+ if test -n "$have_global_priv_table"; then
+ replace_query=`/bin/echo -e \
"USE mysql;\n" \
- "SET sql_mode='';\n" \
- "REPLACE INTO user SET " \
- " host='localhost', user='debian-sys-maint', password=password('$pass'), " \
- " Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
- " Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
- " Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \
- " Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\
- " Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\
- " Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\
- " Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\
- " Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\
- " ssl_cipher='', x509_issuer='', x509_subject='';"`;
+ "SELECT json_object('access',cast(-1 as unsigned), " \
+ "'plugin', 'mysql_native_password', " \
+ "'authentication_string', password('$pass')) INTO @all_privileges;\n"\
+ "REPLACE global_priv VALUES ('localhost', 'debian-sys-maint', @all_privileges);"`
+ else
+ replace_query=`/bin/echo -e \
+ "USE mysql;\n" \
+ "SET sql_mode='';\n" \
+ "REPLACE INTO user SET " \
+ " host='localhost', user='debian-sys-maint', password=password('$pass'), " \
+ " Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
+ " Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
+ " Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \
+ " Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\
+ " Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\
+ " Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\
+ " Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\
+ " Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\
+ " ssl_cipher='', x509_issuer='', x509_subject='';"`;
+ fi
db_get mysql-server/root_password && rootpw="$RET"
if ! set_mysql_rootpw; then
diff --git a/debian/rules b/debian/rules
index 446b02b4164..13d1343671a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -114,11 +114,6 @@ override_dh_auto_install:
dh_testdir
dh_testroot
- # If libthrift-dev was available (manually installed, as it is
- # not in Debian) and ha_cassandra.so was thus built, create package,
- # otherwise skip it.
- [ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+20d" debian/control
-
ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
# Copy systemd files to a location available for dh_installinit
cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.4.mariadb.service
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index a4d6c361809..de640a17765 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
- Copyright (c) 2014, 2017, MariaDB Corporation.
+ Copyright (c) 2014, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -42,43 +42,18 @@
/* Only parts of these files are included from the InnoDB codebase.
The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
-typedef void fil_space_t;
-
-#include "univ.i" /* include all of this */
-#include "page0size.h"
-
-#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE)
-#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE)
-#define FSEG_PAGE_DATA FIL_PAGE_DATA
-#define FSEG_HEADER_SIZE 10
-#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
-
-#include "ut0ut.h"
-#include "ut0byte.h"
-#include "mtr0types.h"
#include "mach0data.h"
-#include "fsp0types.h"
-#include "rem0rec.h"
+#include "page0page.h"
#include "buf0checksum.h" /* buf_calc_page_*() */
#include "buf0buf.h" /* buf_page_is_corrupted */
-#include "fil0fil.h" /* FIL_* */
-#include "page0page.h" /* PAGE_* */
#include "page0zip.h" /* page_zip_*() */
#include "trx0undo.h" /* TRX_* */
-#include "fsp0fsp.h" /* fsp_flags_get_page_size() &
- fsp_flags_get_zip_size() */
#include "ut0crc32.h" /* ut_crc32_init() */
#include "fsp0pagecompress.h" /* fil_get_compression_alg_name */
#include "fil0crypt.h" /* fil_space_verify_crypt_checksum */
#include <string.h>
-#ifdef UNIV_NONINL
-# include "fsp0fsp.ic"
-# include "mach0data.ic"
-# include "ut0rnd.ic"
-#endif
-
#ifndef PRIuMAX
#define PRIuMAX "llu"
#endif
@@ -525,7 +500,16 @@ is_page_corrupted(
normal method. */
if (is_encrypted && key_version != 0) {
is_corrupted = !fil_space_verify_crypt_checksum(buf,
- page_size, space_id, (ulint)cur_page_num);
+ page_size);
+ if (is_corrupted && log_file) {
+ fprintf(log_file,
+ "Page " ULINTPF ":%llu may be corrupted;"
+ " key_version=%u\n",
+ space_id, cur_page_num,
+ mach_read_from_4(
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ + buf));
+ }
} else {
is_corrupted = true;
}
diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt
index 7df5fa17903..623e7460ee4 100644
--- a/extra/mariabackup/CMakeLists.txt
+++ b/extra/mariabackup/CMakeLists.txt
@@ -40,9 +40,6 @@ IF(NOT HAVE_SYSTEM_REGEX)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pcre)
ENDIF()
-IF(WITH_WSREP)
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep)
-ENDIF()
ADD_DEFINITIONS(-UMYSQL_SERVER)
########################################################################
@@ -61,19 +58,19 @@ MYSQL_ADD_EXECUTABLE(mariabackup
xtrabackup.cc
innobackupex.cc
changed_page_bitmap.cc
- datasink.c
- ds_buffer.c
- ds_compress.c
+ datasink.cc
+ ds_buffer.cc
+ ds_compress.cc
ds_local.cc
- ds_stdout.c
- ds_tmpfile.c
- ds_xbstream.c
+ ds_stdout.cc
+ ds_tmpfile.cc
+ ds_xbstream.cc
fil_cur.cc
quicklz/quicklz.c
read_filt.cc
write_filt.cc
wsrep.cc
- xbstream_write.c
+ xbstream_write.cc
backup_mysql.cc
backup_copy.cc
encryption_plugin.cc
@@ -100,13 +97,13 @@ ENDIF()
# xbstream binary
########################################################################
MYSQL_ADD_EXECUTABLE(mbstream
- ds_buffer.c
+ ds_buffer.cc
ds_local.cc
- ds_stdout.c
- datasink.c
- xbstream.c
- xbstream_read.c
- xbstream_write.c
+ ds_stdout.cc
+ datasink.cc
+ xbstream.cc
+ xbstream_read.cc
+ xbstream_write.cc
COMPONENT backup
)
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 1e2d57626e1..fcbecd6dfe8 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -236,7 +236,7 @@ datadir_iter_next_database(datadir_iter_t *it)
if (os_file_closedir(it->dbdir) != 0) {
msg("Warning: could not"
- " close database directory %s\n", it->dbpath);
+ " close database directory %s", it->dbpath);
it->err = DB_ERROR;
@@ -277,7 +277,7 @@ datadir_iter_next_database(datadir_iter_t *it)
}
if (check_if_skip_database_by_path(it->dbpath)) {
- msg("Skipping db: %s\n", it->dbpath);
+ msg("Skipping db: %s", it->dbpath);
continue;
}
@@ -521,19 +521,15 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
/* The following call prints an error message */
os_file_get_last_error(TRUE);
- msg("[%02u] error: cannot open "
- "file %s\n",
- thread_n, cursor->abs_path);
+ msg(thread_n,"error: cannot open "
+ "file %s", cursor->abs_path);
return(false);
}
if (!my_stat(cursor->abs_path, &cursor->statinfo, 0)) {
- msg("[%02u] error: cannot stat %s\n",
- thread_n, cursor->abs_path);
-
+ msg(thread_n, "error: cannot stat %s", cursor->abs_path);
datafile_close(cursor);
-
return(false);
}
@@ -724,9 +720,8 @@ directory_exists(const char *dir, bool create)
if (mkdirp(dir, 0777, MYF(0)) < 0) {
my_strerror(errbuf, sizeof(errbuf), my_errno);
- msg("Can not create directory %s: %s\n", dir, errbuf);
+ msg("Can not create directory %s: %s", dir, errbuf);
return(false);
-
}
}
@@ -735,7 +730,7 @@ directory_exists(const char *dir, bool create)
if (os_dir == NULL) {
my_strerror(errbuf, sizeof(errbuf), my_errno);
- msg("Can not open directory %s: %s\n", dir,
+ msg("Can not open directory %s: %s", dir,
errbuf);
return(false);
@@ -764,7 +759,7 @@ directory_exists_and_empty(const char *dir, const char *comment)
os_dir = os_file_opendir(dir, FALSE);
if (os_dir == NULL) {
- msg("%s can not open directory %s\n", comment, dir);
+ msg("%s can not open directory %s", comment, dir);
return(false);
}
@@ -773,7 +768,7 @@ directory_exists_and_empty(const char *dir, const char *comment)
os_file_closedir(os_dir);
if (!empty) {
- msg("%s directory %s is not empty!\n", comment, dir);
+ msg("%s directory %s is not empty!", comment, dir);
}
return(empty);
@@ -822,7 +817,7 @@ datafile_copy_backup(const char *filepath, uint thread_n)
of the filters value. */
if (check_if_skip_table(filepath)) {
- msg_ts("[%02u] Skipping %s.\n", thread_n, filepath);
+ msg(thread_n,"Skipping %s.", filepath);
return(true);
}
@@ -888,14 +883,13 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
dstfile = ds_open(ds_data, filename, &stat);
if (dstfile == NULL) {
- msg("[%02u] error: "
- "cannot open the destination stream for %s\n",
- 0, filename);
+ msg("error: Can't open the destination stream for %s",
+ filename);
goto error;
}
action = xb_get_copy_action("Writing");
- msg_ts("[%02u] %s %s\n", 0, action, filename);
+ msg("%s %s", action, filename);
if (buf_len == -1) {
goto error;
@@ -906,7 +900,7 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
}
/* close */
- msg_ts("[%02u] ...done\n", 0);
+ msg(" ...done");
free(buf);
if (ds_close(dstfile)) {
@@ -922,7 +916,7 @@ error:
}
error_close:
- msg("[%02u] Error: backup file failed.\n", 0);
+ msg("Error: backup file failed.");
return(false); /*ERROR*/
}
@@ -982,7 +976,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n)
for (i = 0; i < n; i++) {
ret = data_threads[i].ret && ret;
if (!data_threads[i].ret) {
- msg("Error: thread %u failed.\n", i);
+ msg("Error: thread %u failed.", i);
}
}
@@ -1017,14 +1011,12 @@ copy_file(ds_ctxt_t *datasink,
dstfile = ds_open(datasink, dst_path, &cursor.statinfo);
if (dstfile == NULL) {
- msg("[%02u] error: "
- "cannot open the destination stream for %s\n",
- thread_n, dst_name);
+ msg(thread_n,"error: "
+ "cannot open the destination stream for %s", dst_name);
goto error;
}
- msg_ts("[%02u] %s %s to %s\n",
- thread_n, xb_get_copy_action(), src_file_path, dstfile->path);
+ msg(thread_n, "%s %s to %s", xb_get_copy_action(), src_file_path, dstfile->path);
/* The main copy loop */
while ((res = datafile_read(&cursor)) == XB_FIL_CUR_SUCCESS) {
@@ -1039,7 +1031,7 @@ copy_file(ds_ctxt_t *datasink,
}
/* close */
- msg_ts("[%02u] ...done\n", thread_n);
+ msg(thread_n," ...done");
datafile_close(&cursor);
if (ds_close(dstfile)) {
goto error_close;
@@ -1053,7 +1045,7 @@ error:
}
error_close:
- msg("[%02u] Error: copy_file() failed.\n", thread_n);
+ msg(thread_n,"Error: copy_file() failed.");
return(false); /*ERROR*/
}
@@ -1085,36 +1077,34 @@ move_file(ds_ctxt_t *datasink,
if (file_exists(dst_file_path_abs)) {
msg("Error: Move file %s to %s failed: Destination "
- "file exists\n",
- src_file_path, dst_file_path_abs);
+ "file exists", src_file_path, dst_file_path_abs);
return(false);
}
- msg_ts("[%02u] Moving %s to %s\n",
- thread_n, src_file_path, dst_file_path_abs);
+ msg(thread_n,"Moving %s to %s", src_file_path, dst_file_path_abs);
if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) {
if (my_errno == EXDEV) {
bool ret;
ret = copy_file(datasink, src_file_path,
dst_file_path, thread_n);
- msg_ts("[%02u] Removing %s\n", thread_n, src_file_path);
+ msg(thread_n,"Removing %s", src_file_path);
if (unlink(src_file_path) != 0) {
my_strerror(errbuf, sizeof(errbuf), errno);
- msg("Error: unlink %s failed: %s\n",
+ msg("Error: unlink %s failed: %s",
src_file_path,
errbuf);
}
return(ret);
}
my_strerror(errbuf, sizeof(errbuf), my_errno);
- msg("Can not move file %s to %s: %s\n",
+ msg("Can not move file %s to %s: %s",
src_file_path, dst_file_path_abs,
errbuf);
return(false);
}
- msg_ts("[%02u] ...done\n", thread_n);
+ msg(thread_n," ...done");
return(true);
}
@@ -1266,13 +1256,13 @@ backup_files(const char *from, bool prep_mode)
prep_mode ? 1 : 2);
rsync_tmpfile = fopen(rsync_tmpfile_name, "w");
if (rsync_tmpfile == NULL) {
- msg("Error: can't create file %s\n",
+ msg("Error: can't create file %s",
rsync_tmpfile_name);
return(false);
}
}
- msg_ts("Starting %s non-InnoDB tables and files\n",
+ msg("Starting %s non-InnoDB tables and files",
prep_mode ? "prep copy of" : "to backup");
datadir_node_init(&node);
@@ -1288,7 +1278,7 @@ backup_files(const char *from, bool prep_mode)
ret = datafile_copy_backup(node.filepath, 1);
}
if (!ret) {
- msg("Failed to copy file %s\n", node.filepath);
+ msg("Failed to copy file %s", node.filepath);
goto out;
}
} else if (!prep_mode) {
@@ -1298,7 +1288,7 @@ backup_files(const char *from, bool prep_mode)
"%s/db.opt", node.filepath);
if (!(ret = backup_file_printf(
trim_dotslash(path), "%s", ""))) {
- msg("Failed to create file %s\n", path);
+ msg("Failed to create file %s", path);
goto out;
}
}
@@ -1323,13 +1313,13 @@ backup_files(const char *from, bool prep_mode)
cmd << "rsync -t . --files-from=" << rsync_tmpfile_name
<< " " << xtrabackup_target_dir;
- msg_ts("Starting rsync as: %s\n", cmd.str().c_str());
+ msg("Starting rsync as: %s", cmd.str().c_str());
if ((err = system(cmd.str().c_str()) && !prep_mode) != 0) {
- msg_ts("Error: rsync failed with error code %d\n", err);
+ msg("Error: rsync failed with error code %d", err);
ret = false;
goto out;
}
- msg_ts("rsync finished successfully.\n");
+ msg("rsync finished successfully.");
if (!prep_mode && !opt_no_lock) {
char path[FN_REFLEN];
@@ -1345,7 +1335,7 @@ backup_files(const char *from, bool prep_mode)
rsync_tmpfile = fopen(rsync_tmpfile_name, "r");
if (rsync_tmpfile == NULL) {
- msg("Error: can't open file %s\n",
+ msg("Error: can't open file %s",
rsync_tmpfile_name);
ret = false;
goto out;
@@ -1361,7 +1351,7 @@ backup_files(const char *from, bool prep_mode)
snprintf(dst_path, sizeof(dst_path),
"%s/%s", xtrabackup_target_dir,
path);
- msg_ts("Removing %s\n", dst_path);
+ msg("Removing %s", dst_path);
unlink(dst_path);
}
}
@@ -1371,7 +1361,7 @@ backup_files(const char *from, bool prep_mode)
}
}
- msg_ts("Finished %s non-InnoDB tables and files\n",
+ msg("Finished %s non-InnoDB tables and files",
prep_mode ? "a prep copy of" : "backing up");
out:
@@ -1395,7 +1385,9 @@ static lsn_t get_current_lsn(MYSQL *connection)
"SHOW ENGINE INNODB STATUS",
true, false)) {
if (MYSQL_ROW row = mysql_fetch_row(res)) {
- if (const char *p = strstr(row[2], lsn_prefix)) {
+ const char *p= strstr(row[2], lsn_prefix);
+ DBUG_ASSERT(p);
+ if (p) {
p += sizeof lsn_prefix - 1;
lsn = lsn_t(strtoll(p, NULL, 10));
}
@@ -1441,7 +1433,7 @@ bool backup_start()
rocksdb_create_checkpoint();
}
- msg_ts("Waiting for log copy thread to read lsn %llu\n", (ulonglong)server_lsn_after_lock);
+ msg("Waiting for log copy thread to read lsn %llu", (ulonglong)server_lsn_after_lock);
backup_wait_for_lsn(server_lsn_after_lock);
backup_fix_ddl();
@@ -1483,8 +1475,8 @@ bool backup_start()
write_binlog_info(mysql_connection);
}
- if (have_flush_engine_logs) {
- msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...\n");
+ if (have_flush_engine_logs && !opt_no_lock) {
+ msg("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...");
xb_mysql_query(mysql_connection,
"FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS", false);
}
@@ -1508,7 +1500,7 @@ void backup_release()
}
if (opt_safe_slave_backup && sql_thread_started) {
- msg("Starting slave SQL thread\n");
+ msg("Starting slave SQL thread");
xb_mysql_query(mysql_connection,
"START SLAVE SQL_THREAD", false);
}
@@ -1534,12 +1526,12 @@ bool backup_finish()
rocksdb_backup_checkpoint();
}
- msg_ts("Backup created in directory '%s'\n", xtrabackup_target_dir);
+ msg("Backup created in directory '%s'", xtrabackup_target_dir);
if (mysql_binlog_position != NULL) {
- msg("MySQL binlog position: %s\n", mysql_binlog_position);
+ msg("MySQL binlog position: %s", mysql_binlog_position);
}
if (mysql_slave_position && opt_slave_info) {
- msg("MySQL slave binlog position: %s\n",
+ msg("MySQL slave binlog position: %s",
mysql_slave_position);
}
@@ -1599,7 +1591,7 @@ ibx_copy_incremental_over_full()
if (!(ret = copy_file(ds_data, node.filepath,
node.filepath_rel, 1))) {
- msg("Failed to copy file %s\n",
+ msg("Failed to copy file %s",
node.filepath);
goto cleanup;
}
@@ -1739,7 +1731,7 @@ copy_back()
/* cd to backup directory */
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
{
- msg("cannot my_setwd %s\n", xtrabackup_target_dir);
+ msg("Can't my_setwd %s", xtrabackup_target_dir);
return(false);
}
@@ -1752,7 +1744,7 @@ copy_back()
srv_sys_space.set_path(".");
if (!srv_sys_space.parse_params(innobase_data_file_path, true)) {
- msg("syntax error in innodb_data_file_path\n");
+ msg("syntax error in innodb_data_file_path");
return(false);
}
@@ -1866,12 +1858,12 @@ copy_back()
snprintf(path, sizeof(path), "%s/%s",
mysql_data_home, node.filepath_rel);
- msg_ts("[%02u] Creating directory %s\n", 1, path);
+ msg("Creating directory %s", path);
if (mkdirp(path, 0777, MYF(0)) < 0) {
char errbuf[MYSYS_STRERROR_SIZE];
my_strerror(errbuf, sizeof(errbuf), my_errno);
- msg("Can not create directory %s: %s\n",
+ msg("Can not create directory %s: %s",
path, errbuf);
ret = false;
@@ -1879,7 +1871,7 @@ copy_back()
}
- msg_ts("[%02u] ...done.", 1);
+ msg(" ...done.");
continue;
}
@@ -1989,14 +1981,14 @@ decrypt_decompress_file(const char *filepath, uint thread_n)
if (needs_action) {
- msg_ts("[%02u] %s\n", thread_n, message.str().c_str());
+ msg(thread_n,"%s\n", message.str().c_str());
if (system(cmd.str().c_str()) != 0) {
return(false);
}
if (opt_remove_original) {
- msg_ts("[%02u] removing %s\n", thread_n, filepath);
+ msg(thread_n, "Removing %s", filepath);
if (my_delete(filepath, MYF(MY_WME)) != 0) {
return(false);
}
@@ -2059,7 +2051,7 @@ decrypt_decompress()
/* cd to backup directory */
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
{
- msg("cannot my_setwd %s\n", xtrabackup_target_dir);
+ msg("Can't my_setwd %s", xtrabackup_target_dir);
return(false);
}
@@ -2209,8 +2201,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
rc = make_hardlink(from_path, to_path);
if (rc)
{
- msg_ts("[%02u] Creating hardlink from %s to %s\n",
- 1, from_path, to_path);
+ msg("Creating hardlink from %s to %s",from_path, to_path);
}
else
{
@@ -2226,7 +2217,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
to, 1));
}
if (!rc)
- exit(EXIT_FAILURE);
+ die("copy or move file failed");
}
datadir_iter_free(it);
datadir_node_free(&node);
@@ -2244,14 +2235,14 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
*/
static void rocksdb_lock_checkpoint()
{
- msg_ts("Obtaining rocksdb checkpoint lock.\n");
+ msg("Obtaining rocksdb checkpoint lock.");
MYSQL_RES *res =
xb_mysql_query(mysql_connection, "SELECT GET_LOCK('mariabackup_rocksdb_checkpoint',3600)", true, true);
MYSQL_ROW r = mysql_fetch_row(res);
if (r && r[0] && strcmp(r[0], "1"))
{
- msg_ts("Could not obtain rocksdb checkpont lock\n");
+ msg("Could not obtain rocksdb checkpont lock.");
exit(EXIT_FAILURE);
}
mysql_free_result(res);
@@ -2305,7 +2296,7 @@ static void rocksdb_create_checkpoint()
if (!access(rocksdb_checkpoint_dir, 0))
{
- msg_ts("Removing rocksdb checkpoint from previous backup attempt.\n");
+ msg("Removing rocksdb checkpoint from previous backup attempt.");
rocksdb_remove_checkpoint_directory();
}
@@ -2321,15 +2312,14 @@ static void rocksdb_create_checkpoint()
*/
static void rocksdb_backup_checkpoint()
{
- msg_ts("Backing up rocksdb files.\n");
+ msg("Backing up rocksdb files.");
char rocksdb_backup_dir[FN_REFLEN];
snprintf(rocksdb_backup_dir, sizeof(rocksdb_backup_dir), "%s/" ROCKSDB_BACKUP_DIR , xtrabackup_target_dir);
bool backup_to_directory = xtrabackup_backup && xtrabackup_stream_fmt == XB_STREAM_FMT_NONE;
if (backup_to_directory)
{
if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){
- msg_ts("Can't create rocksdb backup directory %s\n", rocksdb_backup_dir);
- exit(EXIT_FAILURE);
+ die("Can't create rocksdb backup directory %s", rocksdb_backup_dir);
}
}
copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory);
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index a142ad70b26..2ff7e56f3ad 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -105,7 +105,7 @@ xb_mysql_connect()
sprintf(mysql_port_str, "%d", opt_port);
if (connection == NULL) {
- msg("Failed to init MySQL struct: %s.\n",
+ msg("Failed to init MySQL struct: %s.",
mysql_error(connection));
return(NULL);
}
@@ -121,8 +121,8 @@ xb_mysql_connect()
mysql_options(connection, MYSQL_OPT_PROTOCOL, &opt_protocol);
mysql_options(connection,MYSQL_SET_CHARSET_NAME, "utf8");
- msg_ts("Connecting to MySQL server host: %s, user: %s, password: %s, "
- "port: %s, socket: %s\n", opt_host ? opt_host : "localhost",
+ msg("Connecting to MySQL server host: %s, user: %s, password: %s, "
+ "port: %s, socket: %s", opt_host ? opt_host : "localhost",
opt_user ? opt_user : "not set",
opt_password ? "set" : "not set",
opt_port != 0 ? mysql_port_str : "not set",
@@ -148,8 +148,7 @@ xb_mysql_connect()
opt_password,
"" /*database*/, opt_port,
opt_socket, 0)) {
- msg("Failed to connect to MySQL server: %s.\n",
- mysql_error(connection));
+ msg("Failed to connect to MySQL server: %s.", mysql_error(connection));
mysql_close(connection);
return(NULL);
}
@@ -169,10 +168,10 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
MYSQL_RES *mysql_result = NULL;
if (mysql_query(connection, query)) {
- msg("Error: failed to execute query %s: %s\n", query,
- mysql_error(connection));
if (die_on_error) {
- exit(EXIT_FAILURE);
+ die("failed to execute query %s: %s", query, mysql_error(connection));
+ } else {
+ msg("Error: failed to execute query %s: %s", query, mysql_error(connection));
}
return(NULL);
}
@@ -180,9 +179,8 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
/* store result set on client if there is a result */
if (mysql_field_count(connection) > 0) {
if ((mysql_result = mysql_store_result(connection)) == NULL) {
- msg("Error: failed to fetch query result %s: %s\n",
+ die("failed to fetch query result %s: %s",
query, mysql_error(connection));
- exit(EXIT_FAILURE);
}
if (!use_result) {
@@ -317,11 +315,11 @@ check_server_version(unsigned long version_number,
msg("Error: Built-in InnoDB in MySQL 5.1 is not "
"supported in this release. You can either use "
"Percona XtraBackup 2.0, or upgrade to InnoDB "
- "plugin.\n");
+ "plugin.");
} else if (!version_supported) {
msg("Error: Unsupported server version: '%s'. Please "
"report a bug at "
- "https://bugs.launchpad.net/percona-xtrabackup\n",
+ "https://bugs.launchpad.net/percona-xtrabackup",
version_string);
}
@@ -408,7 +406,7 @@ get_mysql_vars(MYSQL *connection)
opt_binlog_info == BINLOG_INFO_LOCKLESS) {
msg("Error: --binlog-info=LOCKLESS is not supported by the "
- "server\n");
+ "server");
return(false);
}
@@ -446,7 +444,7 @@ get_mysql_vars(MYSQL *connection)
have_gtid_slave = true;
}
- msg("Using server version %s\n", version_var);
+ msg("Using server version %s", version_var);
if (!(ret = detect_mysql_capabilities_for_backup())) {
goto out;
@@ -456,17 +454,17 @@ get_mysql_vars(MYSQL *connection)
if (check_if_param_set("datadir")) {
if (!directory_exists(mysql_data_home, false)) {
msg("Warning: option 'datadir' points to "
- "nonexistent directory '%s'\n", mysql_data_home);
+ "nonexistent directory '%s'", mysql_data_home);
}
if (!directory_exists(datadir_var, false)) {
msg("Warning: MySQL variable 'datadir' points to "
- "nonexistent directory '%s'\n", datadir_var);
+ "nonexistent directory '%s'", datadir_var);
}
if (!equal_paths(mysql_data_home, datadir_var)) {
msg("Warning: option 'datadir' has different "
"values:\n"
" '%s' in defaults file\n"
- " '%s' in SHOW VARIABLES\n",
+ " '%s' in SHOW VARIABLES",
mysql_data_home, datadir_var);
}
}
@@ -565,14 +563,14 @@ detect_mysql_capabilities_for_backup()
if (opt_galera_info && !have_galera_enabled) {
msg("--galera-info is specified on the command "
"line, but the server does not support Galera "
- "replication. Ignoring the option.\n");
+ "replication. Ignoring the option.");
opt_galera_info = false;
}
if (opt_slave_info && have_multi_threaded_slave &&
!have_gtid_slave) {
msg("The --slave-info option requires GTID enabled for a "
- "multi-threaded slave.\n");
+ "multi-threaded slave.");
return(false);
}
@@ -619,7 +617,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
const MYSQL_ROW row = mysql_fetch_row(mysql_result);
if (row) {
*incremental_lsn = strtoull(row[0], NULL, 10);
- msg("Found and using lsn: " LSN_PF " for %s %s\n",
+ msg("Found and using lsn: " LSN_PF " for %s %s",
*incremental_lsn,
opt_incremental_history_uuid ? "uuid" : "name",
opt_incremental_history_uuid ?
@@ -627,7 +625,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
opt_incremental_history_name);
} else {
msg("Error while attempting to find history record "
- "for %s %s\n",
+ "for %s %s",
opt_incremental_history_uuid ? "uuid" : "name",
opt_incremental_history_uuid ?
opt_incremental_history_uuid :
@@ -737,7 +735,7 @@ have_queries_to_wait_for(MYSQL *connection, uint threshold)
&& duration >= (int)threshold
&& ((all_queries && is_query(info))
|| is_update_query(info))) {
- msg_ts("Waiting for query %s (duration %d sec): %s",
+ msg("Waiting for query %s (duration %d sec): %s",
id, duration, info);
have_to_wait = true;
break;
@@ -766,7 +764,7 @@ kill_long_queries(MYSQL *connection, time_t timeout)
(time_t)duration >= timeout &&
((all_queries && is_query(info)) ||
is_select_query(info))) {
- msg_ts("Killing query %s (duration %d sec): %s\n",
+ msg("Killing query %s (duration %d sec): %s",
id, (int)duration, info);
snprintf(kill_stmt, sizeof(kill_stmt),
"KILL %s", id);
@@ -785,8 +783,8 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold)
start_time = time(NULL);
- msg_ts("Waiting %u seconds for queries running longer than %u seconds "
- "to finish\n", timeout, threshold);
+ msg("Waiting %u seconds for queries running longer than %u seconds "
+ "to finish", timeout, threshold);
while (time(NULL) <= (time_t)(start_time + timeout)) {
if (!have_queries_to_wait_for(connection, threshold)) {
@@ -795,7 +793,7 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold)
os_thread_sleep(1000000);
}
- msg_ts("Unable to obtain lock. Please try again later.");
+ msg("Unable to obtain lock. Please try again later.");
return(false);
}
@@ -813,7 +811,7 @@ DECLARE_THREAD(kill_query_thread)(
os_event_set(kill_query_thread_started);
- msg_ts("Kill query timeout %d seconds.\n",
+ msg("Kill query timeout %d seconds.",
opt_kill_long_queries_timeout);
while (time(NULL) - start_time <
@@ -825,7 +823,7 @@ DECLARE_THREAD(kill_query_thread)(
}
if ((mysql = xb_mysql_connect()) == NULL) {
- msg("Error: kill query thread failed\n");
+ msg("Error: kill query thread failed");
goto stop_thread;
}
@@ -840,7 +838,7 @@ DECLARE_THREAD(kill_query_thread)(
mysql_close(mysql);
stop_thread:
- msg_ts("Kill query thread stopped\n");
+ msg("Kill query thread stopped");
os_event_set(kill_query_thread_stopped);
@@ -871,83 +869,6 @@ stop_query_killer()
}
-/*
-Killing connections that wait for MDL lock.
-If lock-ddl-per-table is used, there can be some DDL statements
-
-FLUSH TABLES would hang infinitely, if DDL statements are waiting for
-MDL lock, which mariabackup currently holds. Therefore we start killing
-those statements from a dedicated thread, until FLUSH TABLES WITH READ LOCK
-succeeds.
-*/
-
-static os_event_t mdl_killer_stop_event;
-static os_event_t mdl_killer_finished_event;
-
-static
-os_thread_ret_t
-DECLARE_THREAD(kill_mdl_waiters_thread(void *))
-{
- MYSQL *mysql;
- if ((mysql = xb_mysql_connect()) == NULL) {
- msg("Error: kill mdl waiters thread failed to connect\n");
- goto stop_thread;
- }
-
- for(;;){
- if (os_event_wait_time(mdl_killer_stop_event, 1000) == 0)
- break;
-
- MYSQL_RES *result = xb_mysql_query(mysql,
- "SELECT ID, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST "
- " WHERE State='Waiting for table metadata lock'",
- true, true);
- while (MYSQL_ROW row = mysql_fetch_row(result))
- {
- char query[64];
-
- if (row[1] && !strcmp(row[1], "Killed"))
- continue;
-
- msg_ts("Killing MDL waiting %s ('%s') on connection %s\n",
- row[1], row[2], row[0]);
- snprintf(query, sizeof(query), "KILL QUERY %s", row[0]);
- if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) {
- msg("Error: failed to execute query %s: %s\n", query,mysql_error(mysql));
- exit(EXIT_FAILURE);
- }
- }
- mysql_free_result(result);
- }
-
- mysql_close(mysql);
-
-stop_thread:
- msg_ts("Kill mdl waiters thread stopped\n");
- os_event_set(mdl_killer_finished_event);
- os_thread_exit();
- return os_thread_ret_t(0);
-}
-
-
-static void start_mdl_waiters_killer()
-{
- mdl_killer_stop_event = os_event_create(0);
- mdl_killer_finished_event = os_event_create(0);
- os_thread_create(kill_mdl_waiters_thread, 0, 0);
-}
-
-
-/* Tell MDL killer to stop and finish for its completion*/
-static void stop_mdl_waiters_killer()
-{
- os_event_set(mdl_killer_stop_event);
- os_event_wait(mdl_killer_finished_event);
-
- os_event_destroy(mdl_killer_stop_event);
- os_event_destroy(mdl_killer_finished_event);
-}
-
/*********************************************************************//**
Function acquires either a backup tables lock, if supported
by the server, or a global read lock (FLUSH TABLES WITH READ LOCK)
@@ -965,35 +886,11 @@ lock_tables(MYSQL *connection)
}
if (have_backup_locks) {
- msg_ts("Executing LOCK TABLES FOR BACKUP...\n");
+ msg("Executing LOCK TABLES FOR BACKUP...");
xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false);
return(true);
}
- if (opt_lock_ddl_per_table) {
- start_mdl_waiters_killer();
- }
-
- if (!opt_lock_wait_timeout && !opt_kill_long_queries_timeout) {
-
- /* We do first a FLUSH TABLES. If a long update is running, the
- FLUSH TABLES will wait but will not stall the whole mysqld, and
- when the long update is done the FLUSH TABLES WITH READ LOCK
- will start and succeed quickly. So, FLUSH TABLES is to lower
- the probability of a stage where both mysqldump and most client
- connections are stalled. Of course, if a second long update
- starts between the two FLUSHes, we have that bad stall.
-
- Option lock_wait_timeout serve the same purpose and is not
- compatible with this trick.
- */
-
- msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...\n");
-
- xb_mysql_query(connection,
- "FLUSH NO_WRITE_TO_BINLOG TABLES", false);
- }
-
if (opt_lock_wait_timeout) {
if (!wait_for_no_updates(connection, opt_lock_wait_timeout,
opt_lock_wait_threshold)) {
@@ -1001,7 +898,7 @@ lock_tables(MYSQL *connection)
}
}
- msg_ts("Executing FLUSH TABLES WITH READ LOCK...\n");
+ msg("Acquiring BACKUP LOCKS...");
if (opt_kill_long_queries_timeout) {
start_query_killer();
@@ -1012,11 +909,10 @@ lock_tables(MYSQL *connection)
"SET SESSION wsrep_causal_reads=0", false);
}
- xb_mysql_query(connection, "FLUSH TABLES WITH READ LOCK", false);
-
- if (opt_lock_ddl_per_table) {
- stop_mdl_waiters_killer();
- }
+ xb_mysql_query(connection, "BACKUP STAGE START", true);
+ //xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
+ //xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
+ xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
if (opt_kill_long_queries_timeout) {
stop_query_killer();
@@ -1034,7 +930,7 @@ bool
lock_binlog_maybe(MYSQL *connection)
{
if (have_backup_locks && !opt_no_lock && !binlog_locked) {
- msg_ts("Executing LOCK BINLOG FOR BACKUP...\n");
+ msg("Executing LOCK BINLOG FOR BACKUP...");
xb_mysql_query(connection, "LOCK BINLOG FOR BACKUP", false);
binlog_locked = true;
@@ -1053,20 +949,15 @@ void
unlock_all(MYSQL *connection)
{
if (opt_debug_sleep_before_unlock) {
- msg_ts("Debug sleep for %u seconds\n",
+ msg("Debug sleep for %u seconds",
opt_debug_sleep_before_unlock);
os_thread_sleep(opt_debug_sleep_before_unlock * 1000);
}
- if (binlog_locked) {
- msg_ts("Executing UNLOCK BINLOG\n");
- xb_mysql_query(connection, "UNLOCK BINLOG", false);
- }
-
- msg_ts("Executing UNLOCK TABLES\n");
- xb_mysql_query(connection, "UNLOCK TABLES", false);
+ msg("Executing BACKUP STAGE END");
+ xb_mysql_query(connection, "BACKUP STAGE END", false);
- msg_ts("All tables unlocked\n");
+ msg("All tables unlocked");
}
@@ -1117,7 +1008,7 @@ wait_for_safe_slave(MYSQL *connection)
if (!(read_master_log_pos && slave_sql_running)) {
msg("Not checking slave open temp tables for "
- "--safe-slave-backup because host is not a slave\n");
+ "--safe-slave-backup because host is not a slave");
goto cleanup;
}
@@ -1131,36 +1022,36 @@ wait_for_safe_slave(MYSQL *connection)
}
open_temp_tables = get_open_temp_tables(connection);
- msg_ts("Slave open temp tables: %d\n", open_temp_tables);
+ msg("Slave open temp tables: %d", open_temp_tables);
while (open_temp_tables && n_attempts--) {
- msg_ts("Starting slave SQL thread, waiting %d seconds, then "
+ msg("Starting slave SQL thread, waiting %d seconds, then "
"checking Slave_open_temp_tables again (%d attempts "
- "remaining)...\n", sleep_time, n_attempts);
+ "remaining)...", sleep_time, n_attempts);
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
os_thread_sleep(sleep_time * 1000000);
xb_mysql_query(connection, "STOP SLAVE SQL_THREAD", false);
open_temp_tables = get_open_temp_tables(connection);
- msg_ts("Slave open temp tables: %d\n", open_temp_tables);
+ msg("Slave open temp tables: %d", open_temp_tables);
}
/* Restart the slave if it was running at start */
if (open_temp_tables == 0) {
- msg_ts("Slave is safe to backup\n");
+ msg("Slave is safe to backup");
goto cleanup;
}
result = false;
if (sql_thread_started) {
- msg_ts("Restarting slave SQL thread.\n");
+ msg("Restarting slave SQL thread.");
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
}
- msg_ts("Slave_open_temp_tables did not become zero after "
- "%d seconds\n", opt_safe_slave_backup_timeout);
+ msg("Slave_open_temp_tables did not become zero after "
+ "%d seconds", opt_safe_slave_backup_timeout);
cleanup:
free_mysql_variables(status);
@@ -1202,10 +1093,8 @@ write_slave_info(MYSQL *connection)
if (master == NULL || filename == NULL || position == NULL) {
msg("Failed to get master binlog coordinates "
- "from SHOW SLAVE STATUS\n");
- msg("This means that the server is not a "
- "replication slave. Ignoring the --slave-info "
- "option\n");
+ "from SHOW SLAVE STATUS.This means that the server is not a "
+ "replication slave. Ignoring the --slave-info option");
/* we still want to continue the backup */
result = true;
goto cleanup;
@@ -1288,7 +1177,7 @@ write_galera_info(MYSQL *connection)
if ((state_uuid == NULL && state_uuid55 == NULL)
|| (last_committed == NULL && last_committed55 == NULL)) {
- msg("Failed to get master wsrep state from SHOW STATUS.\n");
+ msg("Failed to get master wsrep state from SHOW STATUS.");
result = false;
goto cleanup;
}
@@ -1801,9 +1690,9 @@ mdl_lock_table(ulint space_id)
std::ostringstream lock_query;
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
- msg_ts("Locking MDL for %s\n", full_table_name.c_str());
+ msg("Locking MDL for %s", full_table_name.c_str());
if (mysql_query(mdl_con, lock_query.str().c_str())) {
- msg_ts("Warning : locking MDL failed for space id %zu, name %s\n", space_id, full_table_name.c_str());
+ msg("Warning : locking MDL failed for space id %zu, name %s", space_id, full_table_name.c_str());
} else {
MYSQL_RES *r = mysql_store_result(mdl_con);
mysql_free_result(r);
@@ -1813,7 +1702,7 @@ mdl_lock_table(ulint space_id)
void
mdl_unlock_all()
{
- msg_ts("Unlocking MDL for all tables\n");
+ msg("Unlocking MDL for all tables");
xb_mysql_query(mdl_con, "COMMIT", false, true);
mysql_close(mdl_con);
spaceid_to_tablename.clear();
diff --git a/extra/mariabackup/changed_page_bitmap.cc b/extra/mariabackup/changed_page_bitmap.cc
index b704c3a063d..bff5f64e8fa 100644
--- a/extra/mariabackup/changed_page_bitmap.cc
+++ b/extra/mariabackup/changed_page_bitmap.cc
@@ -203,7 +203,7 @@ log_online_read_bitmap_page(
/* The following call prints an error message */
os_file_get_last_error(TRUE);
msg("InnoDB: Warning: failed reading changed page bitmap "
- "file \'%s\'\n", bitmap_file->name);
+ "file \'%s\'", bitmap_file->name);
return FALSE;
}
@@ -282,7 +282,7 @@ log_online_setup_bitmap_file_range(
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
if (UNIV_UNLIKELY(!bitmap_dir)) {
- msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n",
+ msg("InnoDB: Error: failed to open bitmap directory \'%s\'",
srv_data_home);
return FALSE;
}
@@ -332,7 +332,7 @@ log_online_setup_bitmap_file_range(
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
os_file_get_last_error(TRUE);
- msg("InnoDB: Error: cannot close \'%s\'\n",srv_data_home);
+ msg("InnoDB: Error: cannot close \'%s\'",srv_data_home);
return FALSE;
}
@@ -349,7 +349,7 @@ log_online_setup_bitmap_file_range(
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
if (UNIV_UNLIKELY(!bitmap_dir)) {
- msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n",
+ msg("InnoDB: Error: failed to open bitmap directory \'%s\'",
srv_data_home);
return FALSE;
}
@@ -380,7 +380,7 @@ log_online_setup_bitmap_file_range(
if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {
msg("InnoDB: Error: inconsistent bitmap file "
- "directory\n");
+ "directory");
free(bitmap_files->files);
return FALSE;
}
@@ -400,7 +400,7 @@ log_online_setup_bitmap_file_range(
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
os_file_get_last_error(TRUE);
- msg("InnoDB: Error: cannot close \'%s\'\n", srv_data_home);
+ msg("InnoDB: Error: cannot close \'%s\'", srv_data_home);
free(bitmap_files->files);
return FALSE;
}
@@ -451,7 +451,7 @@ log_online_open_bitmap_file_read_only(
/* Here and below assume that bitmap file names do not
contain apostrophes, thus no need for ut_print_filename(). */
msg("InnoDB: Warning: error opening the changed page "
- "bitmap \'%s\'\n", bitmap_file->name);
+ "bitmap \'%s\'", bitmap_file->name);
return success;
}
@@ -495,7 +495,7 @@ log_online_diagnose_bitmap_eof(
itself. */
msg("InnoDB: Warning: junk at the end of changed "
- "page bitmap file \'%s\'.\n", bitmap_file->name);
+ "page bitmap file \'%s\'.", bitmap_file->name);
}
if (UNIV_UNLIKELY(!last_page_in_run)) {
@@ -506,7 +506,7 @@ log_online_diagnose_bitmap_eof(
for the whole server */
msg("InnoDB: Warning: changed page bitmap "
"file \'%s\' does not contain a complete run "
- "at the end.\n", bitmap_file->name);
+ "at the end.", bitmap_file->name);
return FALSE;
}
}
@@ -537,7 +537,7 @@ xb_msg_missing_lsn_data(
lsn_t missing_interval_end) /*!<in: interval end */
{
msg("mariabackup: warning: changed page data missing for LSNs between "
- LSN_PF " and " LSN_PF "\n", missing_interval_start,
+ LSN_PF " and " LSN_PF, missing_interval_start,
missing_interval_end);
}
@@ -615,7 +615,7 @@ xb_page_bitmap_init(void)
msg("mariabackup: incremental backup LSN " LSN_PF
" is larger than than the last checkpoint LSN " LSN_PF
- "\n", bmp_start_lsn, bmp_end_lsn);
+ , bmp_start_lsn, bmp_end_lsn);
return NULL;
}
@@ -699,7 +699,7 @@ xb_page_bitmap_init(void)
bmp_start_lsn))) {
msg("mariabackup: Warning: changed page bitmap file "
- "\'%s\' corrupted\n", bitmap_file.name);
+ "\'%s\' corrupted", bitmap_file.name);
rbt_free(result);
free(bitmap_files.files);
os_file_close(bitmap_file.file);
@@ -804,7 +804,7 @@ xb_page_bitmap_init(void)
if (UNIV_UNLIKELY(!last_page_ok)) {
msg("mariabackup: warning: changed page bitmap file "
- "\'%s\' corrupted.\n", bitmap_file.name);
+ "\'%s\' corrupted.", bitmap_file.name);
rbt_free(result);
free(bitmap_files.files);
os_file_close(bitmap_file.file);
diff --git a/extra/mariabackup/common.h b/extra/mariabackup/common.h
index fae466adc97..2426f090888 100644
--- a/extra/mariabackup/common.h
+++ b/extra/mariabackup/common.h
@@ -72,7 +72,7 @@ static inline int asprintf(char **strp, const char *fmt,...)
#define xb_a(expr) \
do { \
if (!(expr)) { \
- msg("Assertion \"%s\" failed at %s:%lu\n", \
+ fprintf(stderr,"Assertion \"%s\" failed at %s:%lu\n", \
#expr, __FILE__, (ulong) __LINE__); \
abort(); \
} \
@@ -86,42 +86,55 @@ static inline int asprintf(char **strp, const char *fmt,...)
#define XB_DELTA_INFO_SUFFIX ".meta"
-static inline int msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-static inline int msg(const char *fmt, ...)
+static inline int msg1(uint thread_num, const char *prefix, const char *fmt, va_list args)
{
- int result;
- va_list args;
-
- va_start(args, fmt);
- result = vfprintf(stderr, fmt, args);
- va_end(args);
-
- return result;
+ int result;
+ time_t t = time(NULL);
+ char date[100];
+ char *line;
+ strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&t));
+ result = vasprintf(&line, fmt, args);
+ if (result != -1) {
+ if (fmt && fmt[strlen(fmt)] != '\n')
+ result = fprintf(stderr, "[%02u] %s%s %s\n", thread_num, prefix, date, line);
+ else
+ result = fprintf(stderr, "[%02u] %s%s %s", thread_num, prefix, date, line);
+ free(line);
+ }
+ return result;
}
-static inline int msg_ts(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-static inline int msg_ts(const char *fmt, ...)
+static inline ATTRIBUTE_FORMAT(printf, 2, 3) int msg(unsigned int thread_num, const char *fmt, ...)
{
- int result;
- time_t t = time(NULL);
- char date[100];
- char *line;
- va_list args;
-
- strftime(date, sizeof(date), "%y%m%d %H:%M:%S", localtime(&t));
-
- va_start(args, fmt);
- result = vasprintf(&line, fmt, args);
- va_end(args);
+ int result;
+ va_list args;
+ va_start(args, fmt);
+ result = msg1(thread_num,"", fmt, args);
+ va_end(args);
+ return result;
+}
- if (result != -1) {
- result = fprintf(stderr, "%s %s", date, line);
- free(line);
- }
+static inline ATTRIBUTE_FORMAT(printf, 1, 2) int msg(const char *fmt, ...)
+{
+ int result;
+ va_list args;
+ va_start(args, fmt);
+ result = msg1(0, "", fmt, args);
+ va_end(args);
+ return result;
+}
- return result;
+static inline ATTRIBUTE_FORMAT(printf, 1,2) ATTRIBUTE_NORETURN void die(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ msg1(0, "FATAL ERROR: ", fmt, args);
+ va_end(args);
+ fflush(stderr);
+ _exit(EXIT_FAILURE);
}
+
/* Use POSIX_FADV_NORMAL when available */
#ifdef POSIX_FADV_NORMAL
diff --git a/extra/mariabackup/datasink.c b/extra/mariabackup/datasink.cc
index f6d924f7e06..d0c51e2b571 100644
--- a/extra/mariabackup/datasink.c
+++ b/extra/mariabackup/datasink.cc
@@ -49,8 +49,7 @@ ds_create(const char *root, ds_type_t type)
#ifdef HAVE_LIBARCHIVE
ds = &datasink_archive;
#else
- msg("Error : mariabackup was built without libarchive support");
- exit(EXIT_FAILURE);
+ die("mariabackup was built without libarchive support");
#endif
break;
case DS_TYPE_XBSTREAM:
@@ -61,8 +60,7 @@ ds_create(const char *root, ds_type_t type)
break;
case DS_TYPE_ENCRYPT:
case DS_TYPE_DECRYPT:
- msg("Error : mariabackup does not support encrypted backups.");
- exit(EXIT_FAILURE);
+ die("mariabackup does not support encrypted backups.");
break;
case DS_TYPE_TMPFILE:
@@ -72,7 +70,7 @@ ds_create(const char *root, ds_type_t type)
ds = &datasink_buffer;
break;
default:
- msg("Unknown datasink type: %d\n", type);
+ msg("Unknown datasink type: %d", type);
xb_ad(0);
return NULL;
}
@@ -81,8 +79,7 @@ ds_create(const char *root, ds_type_t type)
if (ctxt != NULL) {
ctxt->datasink = ds;
} else {
- msg("Error: failed to initialize datasink.\n");
- exit(EXIT_FAILURE);
+ die("failed to initialize datasink.");
}
return ctxt;
diff --git a/extra/mariabackup/ds_archive.c b/extra/mariabackup/ds_archive.cc
index ae473bc3385..ae473bc3385 100644
--- a/extra/mariabackup/ds_archive.c
+++ b/extra/mariabackup/ds_archive.cc
diff --git a/extra/mariabackup/ds_buffer.c b/extra/mariabackup/ds_buffer.cc
index 186b897c675..687311976e8 100644
--- a/extra/mariabackup/ds_buffer.c
+++ b/extra/mariabackup/ds_buffer.cc
@@ -71,7 +71,7 @@ buffer_init(const char *root)
ds_ctxt_t *ctxt;
ds_buffer_ctxt_t *buffer_ctxt;
- ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t),
+ ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t),
MYF(MY_FAE));
buffer_ctxt = (ds_buffer_ctxt_t *) (ctxt + 1);
buffer_ctxt->buffer_size = DS_DEFAULT_BUFFER_SIZE;
@@ -96,7 +96,7 @@ buffer_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
dst_file = ds_open(pipe_ctxt, path, mystat);
if (dst_file == NULL) {
- exit(EXIT_FAILURE);
+ die("ds_open(%s) failed", path);
}
buffer_ctxt = (ds_buffer_ctxt_t *) ctxt->ptr;
diff --git a/extra/mariabackup/ds_compress.c b/extra/mariabackup/ds_compress.cc
index d064068a7e2..7f4744ec972 100644
--- a/extra/mariabackup/ds_compress.c
+++ b/extra/mariabackup/ds_compress.cc
@@ -96,7 +96,7 @@ compress_init(const char *root)
/* Create and initialize the worker threads */
threads = create_worker_threads(xtrabackup_compress_threads);
if (threads == NULL) {
- msg("compress: failed to create worker threads.\n");
+ msg("compress: failed to create worker threads.");
return NULL;
}
@@ -244,7 +244,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
write_uint64_le(dest_file,
comp_file->bytes_processed)) {
msg("compress: write to the destination stream "
- "failed.\n");
+ "failed.");
return 1;
}
@@ -254,7 +254,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
ds_write(dest_file, threads[i].to,
threads[i].to_len)) {
msg("compress: write to the destination stream "
- "failed.\n");
+ "failed.");
return 1;
}
@@ -368,7 +368,7 @@ create_worker_threads(uint n)
if (pthread_create(&thd->id, NULL, compress_worker_thread_func,
thd)) {
msg("compress: pthread_create() failed: "
- "errno = %d\n", errno);
+ "errno = %d", errno);
goto err;
}
}
diff --git a/extra/mariabackup/ds_local.cc b/extra/mariabackup/ds_local.cc
index 5ecc711c3a4..eea4fcecdd8 100644
--- a/extra/mariabackup/ds_local.cc
+++ b/extra/mariabackup/ds_local.cc
@@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <mysys_err.h>
#include "common.h"
#include "datasink.h"
-#include "univ.i"
#include "fsp0fsp.h"
#ifdef _WIN32
#include <winioctl.h>
diff --git a/extra/mariabackup/ds_stdout.c b/extra/mariabackup/ds_stdout.cc
index a6555c17352..87c4bf1a99b 100644
--- a/extra/mariabackup/ds_stdout.c
+++ b/extra/mariabackup/ds_stdout.cc
@@ -49,7 +49,7 @@ stdout_init(const char *root)
{
ds_ctxt_t *ctxt;
- ctxt = my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
+ ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
ctxt->root = my_strdup(root, MYF(MY_FAE));
diff --git a/extra/mariabackup/ds_tmpfile.c b/extra/mariabackup/ds_tmpfile.cc
index 0e5decc5a6e..9af470980e2 100644
--- a/extra/mariabackup/ds_tmpfile.c
+++ b/extra/mariabackup/ds_tmpfile.cc
@@ -61,7 +61,7 @@ tmpfile_init(const char *root)
ds_ctxt_t *ctxt;
ds_tmpfile_ctxt_t *tmpfile_ctxt;
- ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t),
+ ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t),
MYF(MY_FAE));
tmpfile_ctxt = (ds_tmpfile_ctxt_t *) (ctxt + 1);
tmpfile_ctxt->file_list = NULL;
@@ -178,12 +178,11 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
/* Walk the files in the order they have been added */
list = list_reverse(list);
while (list != NULL) {
- tmp_file = list->data;
+ tmp_file = (ds_tmp_file_t *)list->data;
/* Stat the file to replace size and mtime on the original
* mystat struct */
if (my_fstat(tmp_file->fd, &mystat, MYF(0))) {
- msg("error: my_fstat() failed.\n");
- exit(EXIT_FAILURE);
+ die("my_fstat() failed.");
}
tmp_file->mystat.st_size = mystat.st_size;
tmp_file->mystat.st_mtime = mystat.st_mtime;
@@ -191,32 +190,29 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
dst_file = ds_open(pipe_ctxt, tmp_file->orig_path,
&tmp_file->mystat);
if (dst_file == NULL) {
- msg("error: could not stream a temporary file to "
- "'%s'\n", tmp_file->orig_path);
- exit(EXIT_FAILURE);
+ die("could not stream a temporary file to "
+ "'%s'", tmp_file->orig_path);
}
/* copy to the destination datasink */
posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL);
if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) ==
MY_FILEPOS_ERROR) {
- msg("error: my_seek() failed for '%s', errno = %d.\n",
+ die("my_seek() failed for '%s', errno = %d.",
tmp_file->file->path, my_errno);
- exit(EXIT_FAILURE);
}
offset = 0;
- while ((bytes = my_read(tmp_file->fd, buf, buf_size,
+ while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size,
MYF(MY_WME))) > 0) {
posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED);
offset += buf_size;
if (ds_write(dst_file, buf, bytes)) {
- msg("error: cannot write to stream for '%s'.\n",
+ die("cannot write to stream for '%s'.",
tmp_file->orig_path);
- exit(EXIT_FAILURE);
}
}
if (bytes == (size_t) -1) {
- exit(EXIT_FAILURE);
+ die("my_read failed for %s", tmp_file->orig_path);
}
my_close(tmp_file->fd, MYF(MY_WME));
diff --git a/extra/mariabackup/ds_xbstream.c b/extra/mariabackup/ds_xbstream.cc
index 74ac27ac428..8f6c231404c 100644
--- a/extra/mariabackup/ds_xbstream.c
+++ b/extra/mariabackup/ds_xbstream.cc
@@ -79,18 +79,18 @@ xbstream_init(const char *root __attribute__((unused)))
ds_stream_ctxt_t *stream_ctxt;
xb_wstream_t *xbstream;
- ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t),
+ ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t),
MYF(MY_FAE));
stream_ctxt = (ds_stream_ctxt_t *)(ctxt + 1);
if (pthread_mutex_init(&stream_ctxt->mutex, NULL)) {
- msg("xbstream_init: pthread_mutex_init() failed.\n");
+ msg("xbstream_init: pthread_mutex_init() failed.");
goto err;
}
xbstream = xb_stream_write_new();
if (xbstream == NULL) {
- msg("xb_stream_write_new() failed.\n");
+ msg("xb_stream_write_new() failed.");
goto err;
}
stream_ctxt->xbstream = xbstream;
@@ -143,7 +143,7 @@ xbstream_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
my_xbstream_write_callback);
if (xbstream_file == NULL) {
- msg("xb_stream_write_open() failed.\n");
+ msg("xb_stream_write_open() failed.");
goto err;
}
@@ -177,7 +177,7 @@ xbstream_write(ds_file_t *file, const uchar *buf, size_t len)
xbstream_file = stream_file->xbstream_file;
if (xb_stream_write_data(xbstream_file, buf, len)) {
- msg("xb_stream_write_data() failed.\n");
+ msg("xb_stream_write_data() failed.");
return 1;
}
@@ -209,7 +209,7 @@ xbstream_deinit(ds_ctxt_t *ctxt)
stream_ctxt = (ds_stream_ctxt_t *) ctxt->ptr;
if (xb_stream_write_done(stream_ctxt->xbstream)) {
- msg("xb_stream_done() failed.\n");
+ msg("xb_stream_done() failed.");
}
if (stream_ctxt->dest_file) {
diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc
index 6335cdf3cd7..505ae69af7b 100644
--- a/extra/mariabackup/encryption_plugin.cc
+++ b/extra/mariabackup/encryption_plugin.cc
@@ -61,8 +61,7 @@ static std::string get_encryption_plugin_from_cnf()
FILE *f = fopen("backup-my.cnf", "r");
if (!f)
{
- msg("cannot open backup-my.cnf for reading\n");
- exit(EXIT_FAILURE);
+ die("Can't open backup-my.cnf for reading");
}
char line[512];
std::string plugin_load;
@@ -183,7 +182,7 @@ void encryption_plugin_prepare_init(int argc, char **argv)
std::string plugin_load= get_encryption_plugin_from_cnf();
if (plugin_load.size())
{
- msg("Loading encryption plugin from %s\n", plugin_load.c_str());
+ msg("Loading encryption plugin from %s", plugin_load.c_str());
}
else
{
@@ -210,9 +209,9 @@ static void encryption_plugin_init(int argc, char **argv)
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;
plugin_maturity = MariaDB_PLUGIN_MATURITY_UNKNOWN; /* mariabackup accepts all plugins */
- msg("Loading encryption plugin\n");
+ msg("Loading encryption plugin");
for (int i= 1; i < argc; i++)
- msg("\t Encryption plugin parameter : '%s'\n", argv[i]);
+ msg("\t Encryption plugin parameter : '%s'", argv[i]);
plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE);
}
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index ea4cce92dda..f40304c07d7 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <trx0sys.h>
#include "fil_cur.h"
+#include "fil0crypt.h"
+#include "fil0pagecompress.h"
#include "common.h"
#include "read_filt.h"
#include "xtrabackup.h"
@@ -109,7 +111,6 @@ xb_fil_node_close_file(
ut_a(fil_system.n_open > 0);
fil_system.n_open--;
- fil_n_file_opened--;
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
fil_is_user_tablespace_id(node->space->id)) {
@@ -159,8 +160,11 @@ xb_fil_cur_open(
/* In the backup mode we should already have a tablespace handle created
by fil_ibd_load() unless it is a system
tablespace. Otherwise we open the file here. */
- if (cursor->is_system() || srv_operation == SRV_OPERATION_RESTORE_DELTA
- || xb_close_files) {
+ if (!node->is_open()) {
+ ut_ad(cursor->is_system()
+ || srv_operation == SRV_OPERATION_RESTORE_DELTA
+ || xb_close_files);
+
node->handle = os_file_create_simple_no_error_handling(
0, node->name,
OS_FILE_OPEN,
@@ -169,16 +173,14 @@ xb_fil_cur_open(
/* The following call prints an error message */
os_file_get_last_error(TRUE);
- msg("[%02u] mariabackup: error: cannot open "
- "tablespace %s\n",
- thread_n, cursor->abs_path);
+ msg(thread_n, "mariabackup: error: cannot open "
+ "tablespace %s", cursor->abs_path);
return(XB_FIL_CUR_SKIP);
}
mutex_enter(&fil_system.mutex);
fil_system.n_open++;
- fil_n_file_opened++;
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
fil_is_user_tablespace_id(node->space->id)) {
@@ -213,8 +215,8 @@ xb_fil_cur_open(
cursor->statinfo.st_size = (ulonglong)max_file_size;
}
if (err) {
- msg("[%02u] mariabackup: error: cannot fstat %s\n",
- thread_n, cursor->abs_path);
+ msg(thread_n, "mariabackup: error: cannot fstat %s",
+ cursor->abs_path);
xb_fil_cur_close(cursor);
@@ -229,7 +231,7 @@ xb_fil_cur_open(
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
- const page_size_t page_size(cursor->node->space->flags);
+ const page_size_t page_size(node->space->flags);
cursor->page_size = page_size;
/* Allocate read buffer */
@@ -245,6 +247,19 @@ xb_fil_cur_open(
cursor->buf_page_no = 0;
cursor->thread_n = thread_n;
+ if (!node->space->crypt_data
+ && os_file_read(IORequestRead,
+ node->handle, cursor->buf, 0,
+ page_size.physical())) {
+ mutex_enter(&fil_system.mutex);
+ if (!node->space->crypt_data) {
+ node->space->crypt_data
+ = fil_space_read_crypt_data(page_size,
+ cursor->buf);
+ }
+ mutex_exit(&fil_system.mutex);
+ }
+
cursor->space_size = (ulint)(cursor->statinfo.st_size
/ page_size.physical());
@@ -255,6 +270,107 @@ xb_fil_cur_open(
return(XB_FIL_CUR_SUCCESS);
}
+static bool page_is_corrupted(const byte *page, ulint page_no,
+ const xb_fil_cur_t *cursor,
+ const fil_space_t *space)
+{
+ byte tmp_frame[UNIV_PAGE_SIZE_MAX];
+ byte tmp_page[UNIV_PAGE_SIZE_MAX];
+ const ulint page_size = cursor->page_size.physical();
+ ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
+
+ /* We ignore the doublewrite buffer pages.*/
+ if (cursor->space_id == TRX_SYS_SPACE
+ && page_no >= FSP_EXTENT_SIZE
+ && page_no < FSP_EXTENT_SIZE * 3) {
+ return false;
+ }
+
+ /* Validate page number. */
+ if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no
+ && cursor->space_id != TRX_SYS_SPACE) {
+ /* On pages that are not all zero, the
+ page number must match.
+
+ There may be a mismatch on tablespace ID,
+ because files may be renamed during backup.
+ We disable the page number check
+ on the system tablespace, because it may consist
+ of multiple files, and here we count the pages
+ from the start of each file.)
+
+ The first 38 and last 8 bytes are never encrypted. */
+ const ulint* p = reinterpret_cast<const ulint*>(page);
+ const ulint* const end = reinterpret_cast<const ulint*>(
+ page + page_size);
+ do {
+ if (*p++) {
+ return true;
+ }
+ } while (p != end);
+
+ /* Whole zero page is valid. */
+ return false;
+ }
+
+ /* Validate encrypted pages. The first page is never encrypted.
+ In the system tablespace, the first page would be written with
+ FIL_PAGE_FILE_FLUSH_LSN at shutdown, and if the LSN exceeds
+ 4,294,967,295, the mach_read_from_4() below would wrongly
+ interpret the page as encrypted. We prevent that by checking
+ page_no first. */
+ if (page_no
+ && mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
+ && (opt_encrypted_backup
+ || (space->crypt_data
+ && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) {
+
+ if (!fil_space_verify_crypt_checksum(page, cursor->page_size))
+ return true;
+
+ /* Compressed encrypted need to be decrypted
+ and decompressed for verification. */
+ if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
+ && !opt_extended_validation)
+ return false;
+
+ memcpy(tmp_page, page, page_size);
+
+ bool decrypted = false;
+ if (!space->crypt_data
+ || space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED
+ || !fil_space_decrypt(space, tmp_frame, tmp_page,
+ &decrypted)) {
+ return true;
+ }
+
+ if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
+ return buf_page_is_corrupted(true, tmp_page,
+ cursor->page_size, space);
+ }
+ }
+
+ if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
+ memcpy(tmp_page, page, page_size);
+ }
+
+ if (page_type == FIL_PAGE_PAGE_COMPRESSED
+ || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
+ ulint decomp = fil_page_decompress(tmp_frame, tmp_page);
+ page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE);
+
+ return (!decomp
+ || (decomp != srv_page_size
+ && cursor->page_size.is_compressed())
+ || page_type == FIL_PAGE_PAGE_COMPRESSED
+ || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
+ || buf_page_is_corrupted(true, tmp_page,
+ cursor->page_size, space));
+ }
+
+ return buf_page_is_corrupted(true, page, cursor->page_size, space);
+}
+
/************************************************************************
Reads and verifies the next block of pages from the source
file. Positions the cursor after the last read non-corrupted page.
@@ -266,7 +382,6 @@ xb_fil_cur_read(
/*============*/
xb_fil_cur_t* cursor) /*!< in/out: source file cursor */
{
- ibool success;
byte* page;
ulint i;
ulint npages;
@@ -294,14 +409,8 @@ xb_fil_cur_read(
&& offset + to_read == cursor->statinfo.st_size) {
if (to_read < (ib_int64_t) page_size) {
- msg("[%02u] mariabackup: Warning: junk at the end of "
- "%s:\n", cursor->thread_n, cursor->abs_path);
- msg("[%02u] mariabackup: Warning: offset = %llu, "
- "to_read = %llu\n",
- cursor->thread_n,
- (unsigned long long) offset,
- (unsigned long long) to_read);
-
+ msg(cursor->thread_n, "Warning: junk at the end of "
+ "%s, offset = %llu, to_read = %llu",cursor->abs_path, (ulonglong) offset, (ulonglong) to_read);
return(XB_FIL_CUR_EOF);
}
@@ -311,75 +420,61 @@ xb_fil_cur_read(
xb_a((to_read & (page_size - 1)) == 0);
- npages = (ulint) (to_read / cursor->page_size.physical());
+ npages = (ulint) (to_read / page_size);
retry_count = 10;
ret = XB_FIL_CUR_SUCCESS;
+ fil_space_t *space = fil_space_acquire_for_io(cursor->space_id);
+
+ if (!space) {
+ return XB_FIL_CUR_ERROR;
+ }
+
read_retry:
xtrabackup_io_throttling();
cursor->buf_read = 0;
cursor->buf_npages = 0;
cursor->buf_offset = offset;
- cursor->buf_page_no = (ulint)(offset / cursor->page_size.physical());
-
- fil_space_t* space = fil_space_get(cursor->space_id);
-
- if (!space) {
- return(XB_FIL_CUR_ERROR);
- }
+ cursor->buf_page_no = (ulint)(offset / page_size);
- success = os_file_read(IORequestRead,
- cursor->file, cursor->buf, offset,
- (ulint) to_read);
- if (!success) {
- return(XB_FIL_CUR_ERROR);
+ if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
+ (ulint) to_read)) {
+ ret = XB_FIL_CUR_ERROR;
+ goto func_exit;
}
-
/* check pages for corruption and re-read if necessary. i.e. in case of
partially written pages */
for (page = cursor->buf, i = 0; i < npages;
page += page_size, i++) {
ulint page_no = cursor->buf_page_no + i;
- if (cursor->space_id == TRX_SYS_SPACE &&
- page_no >= FSP_EXTENT_SIZE &&
- page_no < FSP_EXTENT_SIZE * 3) {
- /* We ignore the doublewrite buffer pages */
- } else if (!fil_space_verify_crypt_checksum(
- page, cursor->page_size, space->id, page_no)
- && buf_page_is_corrupted(true, page,
- cursor->page_size,
- space)) {
- retry_count--;
- if (retry_count == 0) {
- msg("[%02u] mariabackup: "
- "Error: failed to read page after "
- "10 retries. File %s seems to be "
- "corrupted.\n", cursor->thread_n,
- cursor->abs_path);
- ret = XB_FIL_CUR_ERROR;
- break;
- }
-
- if (retry_count == 9) {
- msg("[%02u] mariabackup: "
- "Database page corruption detected at page "
- ULINTPF ", retrying...\n",
- cursor->thread_n, page_no);
- }
-
- os_thread_sleep(100000);
-
- goto read_retry;
- }
- cursor->buf_read += page_size;
- cursor->buf_npages++;
+ if (page_is_corrupted(page, page_no, cursor, space)){
+ retry_count--;
+
+ if (retry_count == 0) {
+ msg(cursor->thread_n,
+ "Error: failed to read page after "
+ "10 retries. File %s seems to be "
+ "corrupted.", cursor->abs_path);
+ ret = XB_FIL_CUR_ERROR;
+ buf_page_print(page, cursor->page_size);
+ break;
+ }
+ msg(cursor->thread_n, "Database page corruption detected at page "
+ ULINTPF ", retrying...",
+ page_no);
+ os_thread_sleep(100000);
+ goto read_retry;
+ }
+ cursor->buf_read += page_size;
+ cursor->buf_npages++;
}
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
-
+func_exit:
+ space->release_for_io();
return(ret);
}
diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc
index 3f74f25f5ba..ac2272bf9b0 100644
--- a/extra/mariabackup/innobackupex.cc
+++ b/extra/mariabackup/innobackupex.cc
@@ -738,7 +738,7 @@ ibx_get_one_option(int optid,
exit(0);
break;
case 'v':
- msg("innobackupex version %s %s (%s)\n",
+ printf("innobackupex version %s %s (%s)",
MYSQL_SERVER_VERSION,
SYSTEM_TYPE, MACHINE_TYPE);
exit(0);
diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc
index 382a31f859f..63b11850bfb 100644
--- a/extra/mariabackup/write_filt.cc
+++ b/extra/mariabackup/write_filt.cc
@@ -80,9 +80,8 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);
if (!cp->delta_buf) {
- msg("[%02u] mariabackup: Error: "
- "cannot allocate %zu bytes\n",
- cursor->thread_n, (size_t) cp->delta_buf_size);
+ msg(cursor->thread_n,"Can't allocate %zu bytes",
+ (size_t) cp->delta_buf_size);
return (FALSE);
}
@@ -91,9 +90,9 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
XB_DELTA_INFO_SUFFIX);
const xb_delta_info_t info(cursor->page_size, cursor->space_id);
if (!xb_write_delta_metadata(meta_name, &info)) {
- msg("[%02u] mariabackup: Error: "
- "failed to write meta info for %s\n",
- cursor->thread_n, cursor->rel_path);
+ msg(cursor->thread_n,"Error: "
+ "failed to write meta info for %s",
+ cursor->rel_path);
return(FALSE);
}
diff --git a/extra/mariabackup/wsrep.cc b/extra/mariabackup/wsrep.cc
index c3ad1b53a21..6b57dd4e712 100644
--- a/extra/mariabackup/wsrep.cc
+++ b/extra/mariabackup/wsrep.cc
@@ -92,7 +92,7 @@ xb_write_galera_info(bool incremental_prepare)
fp = fopen(XB_GALERA_INFO_FILENAME, "w");
if (fp == NULL) {
- msg("mariabackup: error: "
+ die(
"could not create " XB_GALERA_INFO_FILENAME
", errno = %d\n",
errno);
@@ -106,11 +106,10 @@ xb_write_galera_info(bool incremental_prepare)
if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
- msg("mariabackup: error: "
+ die(
"could not write to " XB_GALERA_INFO_FILENAME
", errno = %d\n",
- errno);
- exit(EXIT_FAILURE);
+ errno);;
}
fclose(fp);
diff --git a/extra/mariabackup/xbstream.c b/extra/mariabackup/xbstream.cc
index 03bd2fda646..04d2c51b5d1 100644
--- a/extra/mariabackup/xbstream.c
+++ b/extra/mariabackup/xbstream.cc
@@ -45,7 +45,6 @@ datasink_t datasink_archive;
datasink_t datasink_xbstream;
datasink_t datasink_compress;
datasink_t datasink_tmpfile;
-datasink_t datasink_buffer;
static run_mode_t opt_mode;
static char * opt_directory = NULL;
@@ -106,7 +105,7 @@ main(int argc, char **argv)
}
if (opt_mode == RUN_MODE_NONE) {
- msg("%s: either -c or -x must be specified.\n", my_progname);
+ msg("%s: either -c or -x must be specified.", my_progname);
goto err;
}
@@ -184,7 +183,7 @@ int
set_run_mode(run_mode_t mode)
{
if (opt_mode != RUN_MODE_NONE) {
- msg("%s: can't set specify both -c and -x.\n", my_progname);
+ msg("%s: can't set specify both -c and -x.", my_progname);
return 1;
}
@@ -233,7 +232,7 @@ stream_one_file(File file, xb_wstream_file_t *xbfile)
while ((bytes = (ssize_t)my_read(file, buf, XBSTREAM_BUFFER_SIZE,
MYF(MY_WME))) > 0) {
if (xb_stream_write_data(xbfile, buf, bytes)) {
- msg("%s: xb_stream_write_data() failed.\n",
+ msg("%s: xb_stream_write_data() failed.",
my_progname);
my_free(buf);
return 1;
@@ -262,13 +261,13 @@ mode_create(int argc, char **argv)
xb_wstream_t *stream;
if (argc < 1) {
- msg("%s: no files are specified.\n", my_progname);
+ msg("%s: no files are specified.", my_progname);
return 1;
}
stream = xb_stream_write_new();
if (stream == NULL) {
- msg("%s: xb_stream_write_new() failed.\n", my_progname);
+ msg("%s: xb_stream_write_new() failed.", my_progname);
return 1;
}
@@ -281,13 +280,13 @@ mode_create(int argc, char **argv)
goto err;
}
if (!MY_S_ISREG(mystat.st_mode)) {
- msg("%s: %s is not a regular file, exiting.\n",
+ msg("%s: %s is not a regular file, exiting.",
my_progname, filepath);
goto err;
}
if ((src_file = my_open(filepath, O_RDONLY, MYF(MY_WME))) < 0) {
- msg("%s: failed to open %s.\n", my_progname, filepath);
+ msg("%s: failed to open %s.", my_progname, filepath);
goto err;
}
@@ -297,7 +296,7 @@ mode_create(int argc, char **argv)
}
if (opt_verbose) {
- msg("%s\n", filepath);
+ msg("%s", filepath);
}
if (stream_one_file(src_file, file) ||
@@ -338,12 +337,12 @@ file_entry_new(extract_ctxt_t *ctxt, const char *path, uint pathlen)
file = ds_open(ctxt->ds_ctxt, path, NULL);
if (file == NULL) {
- msg("%s: failed to create file.\n", my_progname);
+ msg("%s: failed to create file.", my_progname);
goto err;
}
if (opt_verbose) {
- msg("%s\n", entry->path);
+ msg("%s", entry->path);
}
entry->file = file;
@@ -425,7 +424,7 @@ extract_worker_thread_func(void *arg)
break;
}
if (my_hash_insert(ctxt->filehash, (uchar *) entry)) {
- msg("%s: my_hash_insert() failed.\n",
+ msg("%s: my_hash_insert() failed.",
my_progname);
pthread_mutex_unlock(ctxt->mutex);
break;
@@ -454,7 +453,7 @@ extract_worker_thread_func(void *arg)
if (entry->offset != chunk.offset) {
msg("%s: out-of-order chunk: real offset = 0x%llx, "
- "expected offset = 0x%llx\n", my_progname,
+ "expected offset = 0x%llx", my_progname,
chunk.offset, entry->offset);
pthread_mutex_unlock(&entry->mutex);
res = XB_STREAM_READ_ERROR;
@@ -462,7 +461,7 @@ extract_worker_thread_func(void *arg)
}
if (ds_write(entry->file, chunk.data, chunk.length)) {
- msg("%s: my_write() failed.\n", my_progname);
+ msg("%s: my_write() failed.", my_progname);
pthread_mutex_unlock(&entry->mutex);
res = XB_STREAM_READ_ERROR;
break;
@@ -500,12 +499,12 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
if (my_hash_init(&filehash, &my_charset_bin, START_FILE_HASH_SIZE,
0, 0, (my_hash_get_key) get_file_entry_key,
(my_hash_free_key) file_entry_free, MYF(0))) {
- msg("%s: failed to initialize file hash.\n", my_progname);
+ msg("%s: failed to initialize file hash.", my_progname);
return 1;
}
if (pthread_mutex_init(&mutex, NULL)) {
- msg("%s: failed to initialize mutex.\n", my_progname);
+ msg("%s: failed to initialize mutex.", my_progname);
my_hash_free(&filehash);
return 1;
}
@@ -520,7 +519,7 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
stream = xb_stream_read_new();
if (stream == NULL) {
- msg("%s: xb_stream_read_new() failed.\n", my_progname);
+ msg("%s: xb_stream_read_new() failed.", my_progname);
pthread_mutex_destroy(&mutex);
ret = 1;
goto exit;
@@ -531,8 +530,8 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
ctxt.ds_ctxt = ds_ctxt;
ctxt.mutex = &mutex;
- tids = calloc(n_threads, sizeof(pthread_t));
- retvals = calloc(n_threads, sizeof(void*));
+ tids = (pthread_t *)calloc(n_threads, sizeof(pthread_t));
+ retvals = (void **)calloc(n_threads, sizeof(void*));
for (i = 0; i < n_threads; i++)
pthread_create(tids + i, NULL, extract_worker_thread_func,
diff --git a/extra/mariabackup/xbstream.h b/extra/mariabackup/xbstream.h
index 08b017ca5ce..5ee909d0a8e 100644
--- a/extra/mariabackup/xbstream.h
+++ b/extra/mariabackup/xbstream.h
@@ -101,6 +101,6 @@ xb_rstream_result_t xb_stream_read_chunk(xb_rstream_t *stream,
int xb_stream_read_done(xb_rstream_t *stream);
-int xb_stream_validate_checksum(xb_rstream_chunk_t *chunk);
+xb_rstream_result_t xb_stream_validate_checksum(xb_rstream_chunk_t *chunk);
#endif
diff --git a/extra/mariabackup/xbstream_read.c b/extra/mariabackup/xbstream_read.cc
index 3e38cffddae..a2bcea1c7a5 100644
--- a/extra/mariabackup/xbstream_read.c
+++ b/extra/mariabackup/xbstream_read.cc
@@ -67,15 +67,15 @@ validate_chunk_type(uchar code)
}
}
-int
+xb_rstream_result_t
xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
{
ulong checksum;
- checksum = crc32_iso3309(0, chunk->data, (uint)chunk->length);
+ checksum = crc32_iso3309(0, (unsigned char *)chunk->data, (uint)chunk->length);
if (checksum != chunk->checksum) {
msg("xb_stream_read_chunk(): invalid checksum at offset "
- "0x%llx: expected 0x%lx, read 0x%lx.\n",
+ "0x%llx: expected 0x%lx, read 0x%lx.",
(ulonglong) chunk->checksum_offset, chunk->checksum,
checksum);
return XB_STREAM_READ_ERROR;
@@ -86,8 +86,8 @@ xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
#define F_READ(buf,len) \
do { \
- if (xb_read_full(fd, buf, len) < len) { \
- msg("xb_stream_read_chunk(): my_read() failed.\n"); \
+ if (xb_read_full(fd, (uchar *)buf, len) < len) { \
+ msg("xb_stream_read_chunk(): my_read() failed."); \
goto err; \
} \
} while (0)
@@ -111,7 +111,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
return XB_STREAM_READ_EOF;
} else if (tbytes < CHUNK_HEADER_CONSTANT_LEN) {
msg("xb_stream_read_chunk(): unexpected end of stream at "
- "offset 0x%llx.\n", stream->offset);
+ "offset 0x%llx.", stream->offset);
goto err;
}
@@ -120,7 +120,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
/* Chunk magic value */
if (memcmp(tmpbuf, XB_STREAM_CHUNK_MAGIC, 8)) {
msg("xb_stream_read_chunk(): wrong chunk magic at offset "
- "0x%llx.\n", (ulonglong) stream->offset);
+ "0x%llx.", (ulonglong) stream->offset);
goto err;
}
ptr += 8;
@@ -135,7 +135,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
if (chunk->type == XB_CHUNK_TYPE_UNKNOWN &&
!(chunk->flags & XB_STREAM_FLAG_IGNORABLE)) {
msg("xb_stream_read_chunk(): unknown chunk type 0x%lu at "
- "offset 0x%llx.\n", (ulong) *ptr,
+ "offset 0x%llx.", (ulong) *ptr,
(ulonglong) stream->offset);
goto err;
}
@@ -146,7 +146,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
pathlen = uint4korr(ptr);
if (pathlen >= FN_REFLEN) {
msg("xb_stream_read_chunk(): path length (%lu) is too large at "
- "offset 0x%llx.\n", (ulong) pathlen, stream->offset);
+ "offset 0x%llx.", (ulong) pathlen, stream->offset);
goto err;
}
chunk->pathlen = pathlen;
@@ -170,7 +170,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
ullval = uint8korr(tmpbuf);
if (ullval > (ulonglong) SIZE_T_MAX) {
msg("xb_stream_read_chunk(): chunk length is too large at "
- "offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset,
+ "offset 0x%llx: 0x%llx.", (ulonglong) stream->offset,
ullval);
goto err;
}
@@ -181,7 +181,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
ullval = uint8korr(tmpbuf + 8);
if (ullval > (ulonglong) MY_OFF_T_MAX) {
msg("xb_stream_read_chunk(): chunk offset is too large at "
- "offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset,
+ "offset 0x%llx: 0x%llx.", (ulonglong) stream->offset,
ullval);
goto err;
}
@@ -194,7 +194,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
MYF(MY_WME | MY_ALLOW_ZERO_PTR));
if (chunk->data == NULL) {
msg("xb_stream_read_chunk(): failed to increase buffer "
- "to %lu bytes.\n", (ulong) chunk->length);
+ "to %lu bytes.", (ulong) chunk->length);
goto err;
}
chunk->buflen = chunk->length;
diff --git a/extra/mariabackup/xbstream_write.c b/extra/mariabackup/xbstream_write.cc
index 649bce28788..8c27db78c83 100644
--- a/extra/mariabackup/xbstream_write.c
+++ b/extra/mariabackup/xbstream_write.cc
@@ -55,7 +55,7 @@ xb_stream_default_write_callback(xb_wstream_file_t *file __attribute__((unused))
void *userdata __attribute__((unused)),
const void *buf, size_t len)
{
- if (my_write(my_fileno(stdout), buf, len, MYF(MY_WME | MY_NABP)))
+ if (my_write(my_fileno(stdout), (const uchar *)buf, len, MYF(MY_WME | MY_NABP)))
return -1;
return len;
}
@@ -83,7 +83,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
path_len = strlen(path);
if (path_len > FN_REFLEN) {
- msg("xb_stream_write_open(): file path is too long.\n");
+ msg("xb_stream_write_open(): file path is too long.");
return NULL;
}
@@ -216,7 +216,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len)
int8store(ptr, len); /* Payload length */
ptr += 8;
- checksum = crc32_iso3309(0, buf, (uint)len); /* checksum */
+ checksum = crc32_iso3309(0, (const uchar *)buf, (uint)len); /* checksum */
pthread_mutex_lock(&stream->mutex);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 3bad9dcf9c9..3ad3de2b6c8 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -185,7 +185,7 @@ xb_stream_fmt_t xtrabackup_stream_fmt = XB_STREAM_FMT_NONE;
ibool xtrabackup_stream = FALSE;
const char *xtrabackup_compress_alg = NULL;
-ibool xtrabackup_compress = FALSE;
+uint xtrabackup_compress = FALSE;
uint xtrabackup_compress_threads;
ulonglong xtrabackup_compress_chunk_size = 0;
@@ -200,6 +200,8 @@ static char* log_ignored_opt;
extern my_bool opt_use_ssl;
my_bool opt_ssl_verify_server_cert;
+my_bool opt_extended_validation;
+my_bool opt_encrypted_backup;
/* === metadata of backup === */
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
@@ -301,6 +303,7 @@ my_bool opt_decompress = FALSE;
my_bool opt_remove_original;
my_bool opt_lock_ddl_per_table = FALSE;
+static my_bool opt_check_privileges;
extern const char *innodb_checksum_algorithm_names[];
extern TYPELIB innodb_checksum_algorithm_typelib;
@@ -474,9 +477,18 @@ DECLARE_THREAD(dbug_execute_in_new_connection)(void *arg)
dbug_thread_param_t *par= (dbug_thread_param_t *)arg;
int err = mysql_query(par->con, par->query);
int err_no = mysql_errno(par->con);
- DBUG_ASSERT(par->expect_err == err);
- if (err && par->expect_errno)
- DBUG_ASSERT(err_no == par->expect_errno);
+ if(par->expect_err != err)
+ {
+ msg("FATAL: dbug_execute_in_new_connection : mysql_query '%s' returns %d, instead of expected %d",
+ par->query, err, par->expect_err);
+ _exit(1);
+ }
+ if (err && par->expect_errno && par->expect_errno != err_no)
+ {
+ msg("FATAL: dbug_execute_in_new_connection: mysql_query '%s' returns mysql_errno %d, instead of expected %d",
+ par->query, err_no, par->expect_errno);
+ _exit(1);
+ }
mysql_close(par->con);
mysql_thread_end();
os_event_t done = par->done_event;
@@ -527,13 +539,13 @@ static os_event_t dbug_start_query_thread(
if (exists) {
goto end;
}
- msg_ts("Waiting for query '%s' on connection %lu to "
+ msg("Waiting for query '%s' on connection %lu to "
" reach state '%s'", query, mysql_thread_id(par->con),
wait_state);
my_sleep(1000);
}
end:
- msg_ts("query '%s' on connection %lu reached state '%s'", query,
+ msg("query '%s' on connection %lu reached state '%s'", query,
mysql_thread_id(par->con), wait_state);
return par->done_event;
}
@@ -604,16 +616,16 @@ static void backup_file_op(ulint space_id, const byte* flags,
if (flags) {
ddl_tracker.id_to_name[space_id] = filename_to_spacename(name, len);
- msg("DDL tracking : create %zu \"%.*s\": %x\n",
+ msg("DDL tracking : create %zu \"%.*s\": %x",
space_id, int(len), name, mach_read_from_4(flags));
}
else if (new_name) {
ddl_tracker.id_to_name[space_id] = filename_to_spacename(new_name, new_len);
- msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"\n",
+ msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"",
space_id, int(len), name, int(new_len), new_name);
} else {
ddl_tracker.drops.insert(space_id);
- msg("DDL tracking : delete %zu \"%.*s\"\n", space_id, int(len), name);
+ msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name);
}
pthread_mutex_unlock(&backup_mutex);
}
@@ -635,13 +647,13 @@ static void backup_file_op_fail(ulint space_id, const byte* flags,
ut_a(opt_no_lock);
bool fail;
if (flags) {
- msg("DDL tracking : create %zu \"%.*s\": %x\n",
+ msg("DDL tracking : create %zu \"%.*s\": %x",
space_id, int(len), name, mach_read_from_4(flags));
std::string spacename = filename_to_spacename(name, len);
fail = !check_if_skip_table(spacename.c_str());
}
else if (new_name) {
- msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"\n",
+ msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"",
space_id, int(len), name, int(new_len), new_name);
std::string spacename = filename_to_spacename(name, len);
std::string new_spacename = filename_to_spacename(new_name, new_len);
@@ -650,13 +662,11 @@ static void backup_file_op_fail(ulint space_id, const byte* flags,
else {
std::string spacename = filename_to_spacename(name, len);
fail = !check_if_skip_table(spacename.c_str());
- msg("DDL tracking : delete %zu \"%.*s\"\n", space_id, int(len), name);
+ msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name);
}
if (fail) {
- msg("ERROR : DDL operation detected in the late phase of backup."
- "Backup is inconsistent. Remove --no-lock option to fix.\n");
- log_mutex_exit();
- exit(EXIT_FAILURE);
+ die("DDL operation detected in the late phase of backup."
+ "Backup is inconsistent. Remove --no-lock option to fix.");
}
}
@@ -676,10 +686,10 @@ static void backup_optimized_ddl_op(ulint space_id)
*/
static void backup_optimized_ddl_op_fail(ulint space_id) {
ut_a(opt_no_lock);
- msg("DDL tracking : optimized DDL on space %zu\n", space_id);
+ msg("DDL tracking : optimized DDL on space %zu", space_id);
if (ddl_tracker.tables_in_backup.find(space_id) != ddl_tracker.tables_in_backup.end()) {
msg("ERROR : Optimized DDL operation detected in the late phase of backup."
- "Backup is inconsistent. Remove --no-lock option to fix.\n");
+ "Backup is inconsistent. Remove --no-lock option to fix.");
exit(EXIT_FAILURE);
}
}
@@ -749,6 +759,8 @@ enum options_xtrabackup
OPT_XTRA_DATABASES,
OPT_XTRA_DATABASES_FILE,
OPT_XTRA_PARALLEL,
+ OPT_XTRA_EXTENDED_VALIDATION,
+ OPT_XTRA_ENCRYPTED_BACKUP,
OPT_XTRA_STREAM,
OPT_XTRA_COMPRESS,
OPT_XTRA_COMPRESS_THREADS,
@@ -822,7 +834,8 @@ enum options_xtrabackup
OPT_PROTOCOL,
OPT_LOCK_DDL_PER_TABLE,
OPT_ROCKSDB_DATADIR,
- OPT_BACKUP_ROCKSDB
+ OPT_BACKUP_ROCKSDB,
+ OPT_XTRA_CHECK_PRIVILEGES
};
struct my_option xb_client_options[] =
@@ -1205,6 +1218,22 @@ struct my_option xb_server_options[] =
(G_PTR*) &xtrabackup_parallel, (G_PTR*) &xtrabackup_parallel, 0, GET_INT,
REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0},
+ {"extended_validation", OPT_XTRA_EXTENDED_VALIDATION,
+ "Enable extended validation for Innodb data pages during backup phase. "
+ "Will slow down backup considerably, in case encryption is used. "
+ "May fail if tables are created during the backup.",
+ (G_PTR*)&opt_extended_validation,
+ (G_PTR*)&opt_extended_validation,
+ 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0},
+
+ {"encrypted_backup", OPT_XTRA_ENCRYPTED_BACKUP,
+ "In --backup, assume that nonzero key_version implies that the page"
+ " is encrypted. Use --backup --skip-encrypted-backup to allow"
+ " copying unencrypted that were originally created before MySQL 5.1.48.",
+ (G_PTR*)&opt_encrypted_backup,
+ (G_PTR*)&opt_encrypted_backup,
+ 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0},
+
{"log", OPT_LOG, "Ignored option for MySQL option compatibility",
(G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -1375,6 +1404,10 @@ struct my_option xb_server_options[] =
&xb_backup_rocksdb, &xb_backup_rocksdb,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
+ {"check-privileges", OPT_XTRA_CHECK_PRIVILEGES, "Check database user "
+ "privileges fro the backup user",
+ &opt_check_privileges, &opt_check_privileges,
+ 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -1415,14 +1448,13 @@ debug_sync_point(const char *name)
xtrabackup_target_dir);
fp = fopen(pid_path, "w");
if (fp == NULL) {
- msg("mariabackup: Error: cannot open %s\n", pid_path);
- exit(EXIT_FAILURE);
+ die("Can't open open %s", pid_path);
}
fprintf(fp, "%u\n", (uint) pid);
fclose(fp);
msg("mariabackup: DEBUG: Suspending at debug sync point '%s'. "
- "Resume with 'kill -SIGCONT %u'.\n", name, (uint) pid);
+ "Resume with 'kill -SIGCONT %u'.", name, (uint) pid);
debug_sync_resumed= 0;
kill(pid, SIGSTOP);
@@ -1431,13 +1463,13 @@ debug_sync_point(const char *name)
}
/* On resume */
- msg("mariabackup: DEBUG: removing the pid file.\n");
+ msg("mariabackup: DEBUG: removing the pid file.");
my_delete(pid_path, MYF(MY_WME));
#endif
}
-static std::vector<std::string> tables_for_export;
+static std::set<std::string> tables_for_export;
static void append_export_table(const char *dbname, const char *tablename, bool is_remote)
{
@@ -1449,7 +1481,15 @@ static void append_export_table(const char *dbname, const char *tablename, bool
char *p=strrchr(buf, '.');
if (p) *p=0;
- tables_for_export.push_back(ut_get_name(0,buf));
+ std::string name=ut_get_name(0, buf);
+ /* Strip partition name comment from table name, if any */
+ if (ends_with(name.c_str(), "*/"))
+ {
+ size_t pos= name.rfind("/*");
+ if (pos != std::string::npos)
+ name.resize(pos);
+ }
+ tables_for_export.insert(name);
}
}
@@ -1464,9 +1504,10 @@ static int create_bootstrap_file()
fputs("SET NAMES UTF8;\n",f);
enumerate_ibd_files(append_export_table);
- for (size_t i= 0; i < tables_for_export.size(); i++)
+ for (std::set<std::string>::iterator it = tables_for_export.begin();
+ it != tables_for_export.end(); it++)
{
- const char *tab = tables_for_export[i].c_str();
+ const char *tab = it->c_str();
fprintf(f,
"BEGIN NOT ATOMIC "
"DECLARE CONTINUE HANDLER FOR NOT FOUND,SQLEXCEPTION BEGIN END;"
@@ -1496,7 +1537,7 @@ static int prepare_export()
snprintf(cmdline, sizeof cmdline,
IF_WIN("\"","") "\"%s\" --mysqld \"%s\" "
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
- " --innodb --innodb-fast-shutdown=0"
+ " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe,
@@ -1508,7 +1549,7 @@ static int prepare_export()
sprintf(cmdline,
IF_WIN("\"","") "\"%s\" --mysqld"
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
- " --innodb --innodb-fast-shutdown=0"
+ " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe,
@@ -1542,7 +1583,7 @@ static const char *xb_server_default_groups[]=
static void print_version(void)
{
- msg("%s based on MariaDB server %s %s (%s) \n",
+ msg("%s based on MariaDB server %s %s (%s)",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -1667,7 +1708,7 @@ xb_get_one_option(int optid,
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
else
{
- msg("Invalid --stream argument: %s\n", argument);
+ msg("Invalid --stream argument: %s", argument);
return 1;
}
xtrabackup_stream = TRUE;
@@ -1677,7 +1718,7 @@ xb_get_one_option(int optid,
xtrabackup_compress_alg = "quicklz";
else if (strcasecmp(argument, "quicklz"))
{
- msg("Invalid --compress argument: %s\n", argument);
+ msg("Invalid --compress argument: %s", argument);
return 1;
}
xtrabackup_compress = TRUE;
@@ -1742,8 +1783,10 @@ static bool innodb_init_param()
/* === some variables from mysqld === */
memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list));
- if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
+ if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) {
+ msg("init_tmpdir() failed");
return true;
+ }
xtrabackup_tmpdir = my_tmpdir(&mysql_tmpdir_list);
/* dummy for initialize all_charsets[] */
get_charset_name(0);
@@ -1761,9 +1804,9 @@ static bool innodb_init_param()
srv_page_size_shift = ulong(n_shift);
srv_page_size = 1U << n_shift;
msg("InnoDB: The universal page size of the "
- "database is set to %lu.\n", srv_page_size);
+ "database is set to %lu.", srv_page_size);
} else {
- msg("InnoDB: Error: invalid value of "
+ msg("invalid value of "
"innobase_page_size: %lld", innobase_page_size);
goto error;
}
@@ -1776,12 +1819,12 @@ static bool innodb_init_param()
if (sizeof(ulint) == 4) {
if (xtrabackup_use_memory > UINT_MAX32) {
msg("mariabackup: use-memory can't be over 4GB"
- " on 32-bit systems\n");
+ " on 32-bit systems");
}
if (innobase_buffer_pool_size > UINT_MAX32) {
msg("mariabackup: innobase_buffer_pool_size can't be "
- "over 4GB on 32-bit systems\n");
+ "over 4GB on 32-bit systems");
goto error;
}
@@ -1794,10 +1837,10 @@ static bool innodb_init_param()
read from MySQL .cnf file */
if (xtrabackup_backup) {
- msg("mariabackup: using the following InnoDB configuration:\n");
+ msg("mariabackup: using the following InnoDB configuration:");
} else {
msg("mariabackup: using the following InnoDB configuration "
- "for recovery:\n");
+ "for recovery:");
}
/*--------------- Data files -------------------------*/
@@ -1806,7 +1849,7 @@ static bool innodb_init_param()
srv_data_home = (xtrabackup_backup && innobase_data_home_dir
? innobase_data_home_dir : default_path);
- msg("mariabackup: innodb_data_home_dir = %s\n", srv_data_home);
+ msg("innodb_data_home_dir = %s", srv_data_home);
/* Set default InnoDB data file size to 10 MB and let it be
auto-extending. Thus users can use InnoDB in >= 4.0 without having
@@ -1815,7 +1858,7 @@ static bool innodb_init_param()
if (!innobase_data_file_path) {
innobase_data_file_path = (char*) "ibdata1:10M:autoextend";
}
- msg("mariabackup: innodb_data_file_path = %s\n",
+ msg("innodb_data_file_path = %s",
innobase_data_file_path);
/* This is the first time univ_page_size is used.
@@ -1845,13 +1888,12 @@ static bool innodb_init_param()
if (xtrabackup_prepare && xtrabackup_incremental_dir) {
srv_log_group_home_dir = xtrabackup_incremental_dir;
}
- msg("mariabackup: innodb_log_group_home_dir = %s\n",
+ msg("innodb_log_group_home_dir = %s",
srv_log_group_home_dir);
os_normalize_path(srv_log_group_home_dir);
if (strchr(srv_log_group_home_dir, ';')) {
-
msg("syntax error in innodb_log_group_home_dir, ");
goto error;
}
@@ -1899,8 +1941,7 @@ static bool innodb_init_param()
#elif defined(LINUX_NATIVE_AIO)
if (srv_use_native_aio) {
- ut_print_timestamp(stderr);
- msg(" InnoDB: Using Linux native AIO\n");
+ msg("InnoDB: Using Linux native AIO");
}
#else
/* Currently native AIO is supported only on windows and linux
@@ -1945,7 +1986,7 @@ static bool innodb_init()
}
if (err != DB_SUCCESS) {
- msg("mariabackup: innodb_init() returned %d (%s).\n",
+ msg("mariabackup: innodb_init() returned %d (%s).",
err, ut_strerr(err));
innodb_shutdown();
return(TRUE);
@@ -1969,7 +2010,7 @@ xtrabackup_read_metadata(char *filename)
fp = fopen(filename,"r");
if(!fp) {
- msg("mariabackup: Error: cannot open %s\n", filename);
+ msg("Error: cannot open %s", filename);
return(FALSE);
}
@@ -2048,8 +2089,7 @@ xtrabackup_stream_metadata(ds_ctxt_t *ds_ctxt)
stream = ds_open(ds_ctxt, XTRABACKUP_METADATA_FILENAME, &mystat);
if (stream == NULL) {
- msg("mariabackup: Error: cannot open output stream "
- "for %s\n", XTRABACKUP_METADATA_FILENAME);
+ msg("Error: cannot open output stream for %s", XTRABACKUP_METADATA_FILENAME);
return(FALSE);
}
@@ -2081,7 +2121,7 @@ xtrabackup_write_metadata(const char *filepath)
fp = fopen(filepath, "w");
if(!fp) {
- msg("mariabackup: Error: cannot open %s\n", filepath);
+ msg("Error: cannot open %s", filepath);
return(FALSE);
}
if (fwrite(buf, len, 1, fp) < 1) {
@@ -2130,7 +2170,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)
fclose(fp);
if (page_size == ULINT_UNDEFINED) {
- msg("mariabackup: page_size is required in %s\n", filepath);
+ msg("page_size is required in %s", filepath);
r = FALSE;
} else {
info->page_size = page_size_t(zip_size ? zip_size : page_size,
@@ -2140,7 +2180,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)
if (info->space_id == ULINT_UNDEFINED) {
msg("mariabackup: Warning: This backup was taken with XtraBackup 2.0.1 "
"or earlier, some DDL operations between full and incremental "
- "backups may be handled incorrectly\n");
+ "backups may be handled incorrectly");
}
return(r);
@@ -2173,8 +2213,7 @@ xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info)
f = ds_open(ds_meta, filename, &mystat);
if (f == NULL) {
- msg("mariabackup: Error: cannot open output stream for %s\n",
- filename);
+ msg("Error: Can't open output stream for %s",filename);
return(FALSE);
}
@@ -2348,6 +2387,18 @@ check_if_skip_table(
const char *ptr;
char *eptr;
+
+ dbname = NULL;
+ tbname = name;
+ while ((ptr = strchr(tbname, '/')) != NULL) {
+ dbname = tbname;
+ tbname = ptr + 1;
+ }
+
+ if (strncmp(tbname, tmp_file_prefix, tmp_file_prefix_length) == 0) {
+ return TRUE;
+ }
+
if (regex_exclude_list.empty() &&
regex_include_list.empty() &&
tables_include_hash == NULL &&
@@ -2357,13 +2408,6 @@ check_if_skip_table(
return(FALSE);
}
- dbname = NULL;
- tbname = name;
- while ((ptr = strchr(tbname, '/')) != NULL) {
- dbname = tbname;
- tbname = ptr + 1;
- }
-
if (dbname == NULL) {
return(FALSE);
}
@@ -2482,7 +2526,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
if (fil_is_user_tablespace_id(node->space->id)
&& check_if_skip_table(node_name)) {
- msg("[%02u] Skipping %s.\n", thread_n, node_name);
+ msg(thread_n, "Skipping %s.", node_name);
return(FALSE);
}
@@ -2528,26 +2572,22 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
if (write_filter->init != NULL &&
!write_filter->init(&write_filt_ctxt, dst_name, &cursor)) {
- msg("[%02u] mariabackup: error: "
- "failed to initialize page write filter.\n", thread_n);
+ msg (thread_n, "mariabackup: error: failed to initialize page write filter.");
goto error;
}
dstfile = ds_open(ds_data, dst_name, &cursor.statinfo);
if (dstfile == NULL) {
- msg("[%02u] mariabackup: error: "
- "cannot open the destination stream for %s\n",
- thread_n, dst_name);
+ msg(thread_n,"mariabackup: error: can't open the destination stream for %s", dst_name);
goto error;
}
action = xb_get_copy_action();
if (xtrabackup_stream) {
- msg_ts("[%02u] %s %s\n", thread_n, action, node_path);
+ msg(thread_n, "%s %s", action, node_path);
} else {
- msg_ts("[%02u] %s %s to %s\n", thread_n, action,
- node_path, dstfile->path);
+ msg(thread_n, "%s %s to %s", action, node_path, dstfile->path);
}
/* The main copy loop */
@@ -2571,7 +2611,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
pthread_mutex_unlock(&backup_mutex);
/* close */
- msg_ts("[%02u] ...done\n", thread_n);
+ msg(thread_n," ...done");
xb_fil_cur_close(&cursor);
if (ds_close(dstfile)) {
rc = TRUE;
@@ -2589,8 +2629,7 @@ error:
if (write_filter && write_filter->deinit) {
write_filter->deinit(&write_filt_ctxt);;
}
- msg("[%02u] mariabackup: Error: "
- "xtrabackup_copy_datafile() failed.\n", thread_n);
+ msg(thread_n, "mariabackup: xtrabackup_copy_datafile() failed.");
return(TRUE); /*ERROR*/
skip:
@@ -2601,11 +2640,7 @@ skip:
if (write_filter && write_filter->deinit) {
write_filter->deinit(&write_filt_ctxt);
}
- msg("[%02u] mariabackup: Warning: We assume the "
- "table was dropped during xtrabackup execution "
- "and ignore the file.\n", thread_n);
- msg("[%02u] mariabackup: Warning: skipping tablespace %s.\n",
- thread_n, node_name);
+ msg(thread_n,"Warning: We assume the table was dropped during xtrabackup execution and ignore the tablespace %s", node_name);
return(FALSE);
}
@@ -2630,9 +2665,8 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
&& scanned_checkpoint - checkpoint >= 0x80000000UL) {
/* Garbage from a log buffer flush which was made
before the most recent database recovery */
- msg("mariabackup: checkpoint wrap: "
- LSN_PF ",%zx,%zx\n",
- scanned_lsn, scanned_checkpoint, checkpoint);
+ msg(0,"checkpoint wrap: " LSN_PF ",%zx,%zx",
+ scanned_lsn, scanned_checkpoint, checkpoint);
break;
}
@@ -2652,8 +2686,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
} else if (data_len >= log_sys.trailer_offset()
|| data_len <= LOG_BLOCK_HDR_SIZE) {
/* We got a garbage block (abrupt end of the log). */
- msg("mariabackup: garbage block: " LSN_PF ",%zu\n",
- scanned_lsn, data_len);
+ msg(0,"garbage block: " LSN_PF ",%zu",scanned_lsn, data_len);
break;
} else {
/* We got a partial block (abrupt end of the log). */
@@ -2664,7 +2697,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
if (more_data && recv_parse_log_recs(0, STORE_NO, false)) {
- msg("mariabackup: copying the log failed \n");
+ msg("Error: copying the log failed");
return(0);
}
@@ -2683,8 +2716,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
}
if (ds_write(dst_log_file, log_sys.buf, write_size)) {
- msg("mariabackup: Error: "
- "write to logfile failed\n");
+ msg("Error: write to logfile failed");
return(0);
}
}
@@ -2720,7 +2752,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
|| lsn != start_lsn) {
break;
}
- msg("Retrying read of log at LSN=" LSN_PF "\n", lsn);
+ msg("Retrying read of log at LSN=" LSN_PF, lsn);
my_sleep(1000);
}
@@ -2730,15 +2762,13 @@ static bool xtrabackup_copy_logfile(bool last = false)
log_mutex_exit();
if (!start_lsn) {
- msg("mariabackup: Error: xtrabackup_copy_logfile()"
- " failed.\n");
- exit(EXIT_FAILURE);
+ die("xtrabackup_copy_logfile() failed.");
}
} while (start_lsn == end_lsn);
ut_ad(start_lsn == log_sys.log.scanned_lsn);
- msg_ts(">> log scanned up to (" LSN_PF ")\n", start_lsn);
+ msg(">> log scanned up to (" LSN_PF ")", start_lsn);
/* update global variable*/
pthread_mutex_lock(&backup_mutex);
@@ -2847,7 +2877,7 @@ static void dbug_mariabackup_event(const char *event,const char *key)
}
char *sql = getenv(envvar);
if (sql) {
- msg("dbug_mariabackup_event : executing '%s'\n", sql);
+ msg("dbug_mariabackup_event : executing '%s'", sql);
xb_mysql_query(mysql_connection, sql, false, true);
}
@@ -2878,15 +2908,10 @@ DECLARE_THREAD(data_copy_thread_func)(
debug_sync_point("data_copy_thread_func");
while ((node = datafiles_iter_next(ctxt->it)) != NULL) {
-
DBUG_MARIABACKUP_EVENT("before_copy", node->space->name);
-
-
/* copy the datafile */
if(xtrabackup_copy_datafile(node, num)) {
- msg("[%02u] mariabackup: Error: "
- "failed to copy datafile.\n", num);
- exit(EXIT_FAILURE);
+ die("failed to copy datafile.");
}
DBUG_MARIABACKUP_EVENT("after_copy", node->space->name);
@@ -3062,9 +3087,7 @@ xb_load_single_table_tablespace(
Datafile *file = xb_new_datafile(name, is_remote);
if (file->open_read_only(true) != DB_SUCCESS) {
- msg("Can't open datafile %s\n", name);
- ut_free(name);
- exit(EXIT_FAILURE);
+ die("Can't open datafile %s", name);
}
err = file->validate_first_page(&flush_lsn);
@@ -3083,11 +3106,8 @@ xb_load_single_table_tablespace(
ut_a(space != NULL);
- if (!fil_node_create(file->filepath(), ulint(n_pages), space,
- false, false)) {
- ut_error;
- }
-
+ space->add(file->filepath(), OS_FILE_CLOSED, ulint(n_pages),
+ false, false);
/* by opening the tablespace we forcing node and space objects
in the cache to be populated with fields from space header */
space->open();
@@ -3105,7 +3125,7 @@ xb_load_single_table_tablespace(
if (err != DB_SUCCESS && err != DB_CORRUPTION && xtrabackup_backup) {
/* allow corrupted first page for xtrabackup, it could be just
zero-filled page, which we restore from redo log later */
- exit(EXIT_FAILURE);
+ die("Failed to not validate first page of the file %s, error %d",name, (int)err);
}
}
@@ -3268,7 +3288,7 @@ static dberr_t xb_assign_undo_space_start()
OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret);
if (!ret) {
- msg("mariabackup: Error in opening %s\n", srv_sys_space.first_datafile()->filepath());
+ msg("Error opening %s", srv_sys_space.first_datafile()->filepath());
return DB_ERROR;
}
@@ -3279,7 +3299,7 @@ retry:
if (!os_file_read(IORequestRead, file, page,
TRX_SYS_PAGE_NO << srv_page_size_shift,
srv_page_size)) {
- msg("mariabackup: Reading TRX_SYS page failed.\n");
+ msg("Reading TRX_SYS page failed.\n");
error = DB_ERROR;
goto func_exit;
}
@@ -3337,16 +3357,22 @@ xb_load_tablespaces()
/* create_new_db must not be true. */
if (err != DB_SUCCESS || create_new_db) {
- msg("mariabackup: could not find data files at the "
- "specified datadir\n");
+ msg("Could not find data files at the specified datadir");
return(DB_ERROR);
}
- err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes,
- &flush_lsn);
+ for (int i= 0; i < 10; i++) {
+ err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes,
+ &flush_lsn);
+ if (err == DB_PAGE_CORRUPTED || err == DB_CORRUPTION) {
+ my_sleep(1000);
+ }
+ else
+ break;
+ }
if (err != DB_SUCCESS) {
- msg("mariabackup: Could not open data files.\n");
+ msg("Could not open data files.\n");
return(err);
}
@@ -3368,7 +3394,7 @@ xb_load_tablespaces()
srv_undo_tablespaces_init(), because fil_is_user_tablespace_id() *
relies on srv_undo_tablespaces_open to be properly initialized */
- msg("mariabackup: Generating a list of tablespaces\n");
+ msg("mariabackup: Generating a list of tablespaces");
err = enumerate_ibd_files(xb_load_single_table_tablespace);
if (err != DB_SUCCESS) {
@@ -3471,13 +3497,11 @@ xb_validate_name(
/* perform only basic validation. validate length and
path symbols */
if (len > NAME_LEN) {
- msg("mariabackup: name `%s` is too long.\n", name);
- exit(EXIT_FAILURE);
+ die("name `%s` is too long.", name);
}
p = strpbrk(name, "/\\~");
if (p && (uint) (p - name) < NAME_LEN) {
- msg("mariabackup: name `%s` is not valid.\n", name);
- exit(EXIT_FAILURE);
+ die("name `%s` is not valid.", name);
}
}
@@ -3555,8 +3579,7 @@ xb_register_table(
const char* name) /*!< in: name of table */
{
if (strchr(name, '.') == NULL) {
- msg("mariabackup: `%s` is not fully qualified name.\n", name);
- exit(EXIT_FAILURE);
+ die("`%s` is not fully qualified name.", name);
}
xb_register_include_filter_entry(name);
@@ -3577,7 +3600,7 @@ xb_add_regex_to_list(
if (ret != 0) {
regerror(ret, &compiled_regex, errbuf, sizeof(errbuf));
- msg("mariabackup: error: %s regcomp(%s): %s\n",
+ msg("mariabackup: error: %s regcomp(%s): %s",
error_context, regex, errbuf);
exit(EXIT_FAILURE);
}
@@ -3646,17 +3669,15 @@ xb_load_list_file(
/* read and store the filenames */
fp = fopen(filename, "r");
if (!fp) {
- msg("mariabackup: cannot open %s\n",
+ die("Can't open %s",
filename);
- exit(EXIT_FAILURE);
}
while (fgets(name_buf, sizeof(name_buf), fp) != NULL) {
char* p = strchr(name_buf, '\n');
if (p) {
*p = '\0';
} else {
- msg("mariabackup: `%s...` name is too long", name_buf);
- exit(EXIT_FAILURE);
+ die("`%s...` name is too long", name_buf);
}
ins(name_buf);
@@ -3764,22 +3785,17 @@ xb_filters_free()
}
/*********************************************************************//**
-Creates or opens the log files and closes them.
-@return DB_SUCCESS or error code */
+Create log file metadata. */
static
-ulint
+void
open_or_create_log_file(
/*====================*/
fil_space_t* space,
- ibool* log_file_created, /*!< out: TRUE if new log file
- created */
ulint i) /*!< in: log file number in group */
{
char name[10000];
ulint dirnamelen;
- *log_file_created = FALSE;
-
os_normalize_path(srv_log_group_home_dir);
dirnamelen = strlen(srv_log_group_home_dir);
@@ -3791,14 +3807,13 @@ open_or_create_log_file(
name[dirnamelen++] = OS_PATH_SEPARATOR;
}
- sprintf(name + dirnamelen, "%s%lu", "ib_logfile", (ulong) i);
+ sprintf(name + dirnamelen, "%s%zu", "ib_logfile", i);
ut_a(fil_validate());
- ut_a(fil_node_create(name, ulint(srv_log_file_size >> srv_page_size_shift),
- space, false, false));
-
- return(DB_SUCCESS);
+ space->add(name, OS_FILE_CLOSED,
+ ulint(srv_log_file_size >> srv_page_size_shift),
+ false, false);
}
/***********************************************************************
@@ -3902,10 +3917,10 @@ static bool xtrabackup_backup_low()
metadata_to_lsn = mach_read_from_8(
log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN);
msg("mariabackup: The latest check point"
- " (for incremental): '" LSN_PF "'\n",
+ " (for incremental): '" LSN_PF "'",
metadata_to_lsn);
} else {
- msg("mariabackup: Error: recv_find_max_checkpoint() failed.\n");
+ msg("Error: recv_find_max_checkpoint() failed.");
}
log_mutex_exit();
}
@@ -3935,7 +3950,7 @@ static bool xtrabackup_backup_low()
metadata_last_lsn = log_copy_scanned_lsn;
if (!xtrabackup_stream_metadata(ds_meta)) {
- msg("mariabackup: Error: failed to stream metadata.\n");
+ msg("Error: failed to stream metadata.");
return false;
}
if (xtrabackup_extra_lsndir) {
@@ -3944,15 +3959,15 @@ static bool xtrabackup_backup_low()
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir,
XTRABACKUP_METADATA_FILENAME);
if (!xtrabackup_write_metadata(filename)) {
- msg("mariabackup: Error: failed to write metadata "
- "to '%s'.\n", filename);
+ msg("Error: failed to write metadata "
+ "to '%s'.", filename);
return false;
}
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir,
XTRABACKUP_INFO);
if (!write_xtrabackup_info(mysql_connection, filename, false)) {
- msg("mariabackup: Error: failed to write info "
- "to '%s'.\n", filename);
+ msg("Error: failed to write info "
+ "to '%s'.", filename);
return false;
}
}
@@ -3975,19 +3990,19 @@ xtrabackup_backup_func()
pthread_cond_init(&scanned_lsn_cond, NULL);
#ifdef USE_POSIX_FADVISE
- msg("mariabackup: uses posix_fadvise().\n");
+ msg("uses posix_fadvise().");
#endif
/* cd to datadir */
if (my_setwd(mysql_real_data_home,MYF(MY_WME)))
{
- msg("mariabackup: cannot my_setwd %s\n", mysql_real_data_home);
+ msg("my_setwd() failed , %s", mysql_real_data_home);
return(false);
}
- msg("mariabackup: cd to %s\n", mysql_real_data_home);
+ msg("cd to %s", mysql_real_data_home);
encryption_plugin_backup_init(mysql_connection);
- msg("mariabackup: open files limit requested %u, set to %u\n",
+ msg("open files limit requested %u, set to %u",
(uint) xb_open_files_limit,
xb_set_max_open_files(xb_open_files_limit));
@@ -4002,12 +4017,6 @@ xtrabackup_backup_func()
log_file_op = backup_file_op;
metadata_to_lsn = 0;
- if (xb_close_files)
- msg("mariabackup: warning: close-files specified. Use it "
- "at your own risk. If there are DDL operations like table DROP TABLE "
- "or RENAME TABLE during the backup, inconsistent backup will be "
- "produced.\n");
-
/* initialize components */
if(innodb_init_param()) {
fail:
@@ -4058,13 +4067,6 @@ fail:
xb_filters_init();
- {
- ibool log_file_created;
- ibool log_created = FALSE;
- ibool log_opened = FALSE;
- ulint err;
- ulint i;
-
xb_fil_io_init();
srv_n_file_io_threads = srv_n_read_io_threads;
@@ -4077,43 +4079,15 @@ fail:
"innodb_redo_log", SRV_LOG_SPACE_FIRST_ID, 0,
FIL_TYPE_LOG, NULL);
- for (i = 0; i < srv_n_log_files; i++) {
- err = open_or_create_log_file(space, &log_file_created, i);
- if (err != DB_SUCCESS) {
- goto fail;
- }
-
- if (log_file_created) {
- log_created = TRUE;
- } else {
- log_opened = TRUE;
- }
- if ((log_opened && log_created)) {
- msg(
- "mariabackup: Error: all log files must be created at the same time.\n"
- "mariabackup: All log files must be created also in database creation.\n"
- "mariabackup: If you want bigger or smaller log files, shut down the\n"
- "mariabackup: database and make sure there were no errors in shutdown.\n"
- "mariabackup: Then delete the existing log files. Edit the .cnf file\n"
- "mariabackup: and start the database again.\n");
-
- goto fail;
- }
- }
-
- /* log_file_created must not be TRUE, if online */
- if (log_file_created) {
- msg("mariabackup: Something wrong with source files...\n");
- goto fail;
- }
-
+ for (ulint i = 0; i < srv_n_log_files; i++) {
+ open_or_create_log_file(space, i);
}
/* create extra LSN dir if it does not exist. */
if (xtrabackup_extra_lsndir
&&!my_stat(xtrabackup_extra_lsndir,&stat_info,MYF(0))
&& (my_mkdir(xtrabackup_extra_lsndir,0777,MYF(0)) < 0)) {
- msg("mariabackup: Error: cannot mkdir %d: %s\n",
+ msg("Error: cannot mkdir %d: %s\n",
my_errno, xtrabackup_extra_lsndir);
goto fail;
}
@@ -4121,7 +4095,7 @@ fail:
/* create target dir if not exist */
if (!xtrabackup_stream_str && !my_stat(xtrabackup_target_dir,&stat_info,MYF(0))
&& (my_mkdir(xtrabackup_target_dir,0777,MYF(0)) < 0)){
- msg("mariabackup: Error: cannot mkdir %d: %s\n",
+ msg("Error: cannot mkdir %d: %s\n",
my_errno, xtrabackup_target_dir);
goto fail;
}
@@ -4148,8 +4122,8 @@ log_fail:
if (log_sys.log.format == 0) {
old_format:
- msg("mariabackup: Error: cannot process redo log"
- " before MariaDB 10.2.2\n");
+ msg("Error: cannot process redo log"
+ " before MariaDB 10.2.2");
log_mutex_exit();
goto log_fail;
}
@@ -4188,8 +4162,8 @@ reread_log_header:
memset(&stat_info, 0, sizeof(MY_STAT));
dst_log_file = ds_open(ds_redo, "ib_logfile0", &stat_info);
if (dst_log_file == NULL) {
- msg("mariabackup: error: failed to open the target stream for "
- "'ib_logfile0'.\n");
+ msg("§rror: failed to open the target stream for "
+ "'ib_logfile0'.");
goto fail;
}
@@ -4207,7 +4181,7 @@ reread_log_header:
/* Write the log header. */
if (ds_write(dst_log_file, log_hdr, sizeof log_hdr)) {
log_write_fail:
- msg("mariabackup: error: write to logfile failed\n");
+ msg("error: write to logfile failed");
goto fail;
}
/* Adjust the checkpoint page. */
@@ -4242,8 +4216,8 @@ reread_log_header:
/* Populate fil_system with tablespaces to copy */
err = xb_load_tablespaces();
if (err != DB_SUCCESS) {
- msg("mariabackup: error: xb_load_tablespaces() failed with"
- " error %s.\n", ut_strerr(err));
+ msg("merror: xb_load_tablespaces() failed with"
+ " error %s.", ut_strerr(err));
fail_before_log_copying_thread_start:
log_copying_running = false;
goto fail;
@@ -4271,7 +4245,7 @@ fail_before_log_copying_thread_start:
if (xtrabackup_parallel > 1) {
msg("mariabackup: Starting %u threads for parallel data "
- "files transfer\n", xtrabackup_parallel);
+ "files transfer", xtrabackup_parallel);
}
if (opt_lock_ddl_per_table) {
@@ -4280,12 +4254,12 @@ fail_before_log_copying_thread_start:
DBUG_EXECUTE_IF("check_mdl_lock_works",
dbug_alter_thread_done =
dbug_start_query_thread("ALTER TABLE test.t ADD COLUMN mdl_lock_column int",
- "Waiting for table metadata lock", 1, ER_QUERY_INTERRUPTED););
+ "Waiting for table metadata lock", 0, 0););
}
datafiles_iter_t *it = datafiles_iter_new();
if (it == NULL) {
- msg("mariabackup: Error: datafiles_iter_new() failed.\n");
+ msg("mariabackup: Error: datafiles_iter_new() failed.");
goto fail;
}
@@ -4346,16 +4320,16 @@ fail_before_log_copying_thread_start:
}
xtrabackup_destroy_datasinks();
- msg("mariabackup: Redo log (from LSN " LSN_PF " to " LSN_PF
- ") was copied.\n", checkpoint_lsn_start, log_copy_scanned_lsn);
+ msg("Redo log (from LSN " LSN_PF " to " LSN_PF
+ ") was copied.", checkpoint_lsn_start, log_copy_scanned_lsn);
xb_filters_free();
xb_data_files_close();
/* Make sure that the latest checkpoint was included */
if (metadata_to_lsn > log_copy_scanned_lsn) {
- msg("mariabackup: error: failed to copy enough redo log ("
- "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").\n",
+ msg("Error: failed to copy enough redo log ("
+ "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").",
log_copy_scanned_lsn, metadata_to_lsn);
goto fail;
}
@@ -4498,6 +4472,7 @@ void backup_fix_ddl(void)
}
datafiles_iter_free(it);
+ DBUG_EXECUTE_IF("check_mdl_lock_works", DBUG_ASSERT(new_tables.size() == 0););
for (std::set<std::string>::iterator iter = new_tables.begin();
iter != new_tables.end(); iter++) {
const char *space_name = iter->c_str();
@@ -4512,7 +4487,7 @@ void backup_fix_ddl(void)
const char *dbname = buf;
char *p = strchr(buf, '/');
if (p == 0) {
- msg("Unexpected tablespace %s filename %s\n", space_name, name.c_str());
+ msg("Unexpected tablespace %s filename %s", space_name, name.c_str());
ut_a(0);
}
ut_a(p);
@@ -4531,16 +4506,6 @@ void backup_fix_ddl(void)
continue;
std::string dest_name(node->space->name);
dest_name.append(".new");
-#if 0
- bool do_full_copy = ddl_tracker.optimized_ddl.find(n->space->id) != ddl_tracker.optimized_ddl.end();
- if (do_full_copy) {
- msg(
- "Performing a full copy of the tablespace %s, because optimized (without redo logging) DDL operation"
- "ran during backup. You can use set innodb_log_optimize_ddl=OFF to improve backup performance"
- "in the future.\n",
- n->space->name);
- }
-#endif
xtrabackup_copy_datafile(node, 0, dest_name.c_str()/*, do_full_copy ? ULONGLONG_MAX:UNIV_PAGE_SIZE */);
}
@@ -4595,7 +4560,7 @@ xb_space_create_file(
*file = os_file_create_simple_no_error_handling(
0, path, OS_FILE_CREATE, OS_FILE_READ_WRITE, false, &ret);
if (!ret) {
- msg("mariabackup: cannot create file %s\n", path);
+ msg("Can't create file %s", path);
return ret;
}
@@ -4603,7 +4568,7 @@ xb_space_create_file(
FIL_IBD_FILE_INITIAL_SIZE
<< srv_page_size_shift);
if (!ret) {
- msg("mariabackup: cannot set size for file %s\n", path);
+ msg("mariabackup: cannot set size for file %s", path);
os_file_close(*file);
os_file_delete(0, path);
return ret;
@@ -4647,7 +4612,7 @@ xb_space_create_file(
free(buf);
if (!ret) {
- msg("mariabackup: could not write the first page to %s\n",
+ msg("mariabackup: could not write the first page to %s",
path);
os_file_close(*file);
os_file_delete(0, path);
@@ -4718,7 +4683,7 @@ xb_delta_open_matching_space(
/* Create the database directory if it doesn't exist yet */
if (!os_file_create_directory(dest_dir, FALSE)) {
- msg("mariabackup: error: cannot create dir %s\n", dest_dir);
+ msg("mariabackup: error: cannot create dir %s", dest_dir);
return file;
}
@@ -4765,12 +4730,12 @@ exit:
snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#" ULINTPF,
dbname, fil_space->id);
- msg("mariabackup: Renaming %s to %s.ibd\n",
+ msg("mariabackup: Renaming %s to %s.ibd",
fil_space->name, tmpname);
if (fil_space->rename(tmpname, NULL, false)
!= DB_SUCCESS) {
- msg("mariabackup: Cannot rename %s to %s\n",
+ msg("mariabackup: Cannot rename %s to %s",
fil_space->name, tmpname);
goto exit;
}
@@ -4779,9 +4744,8 @@ exit:
if (info.space_id == ULINT_UNDEFINED)
{
- msg("mariabackup: Error: Cannot handle DDL operation on tablespace "
+ die("Can't handle DDL operation on tablespace "
"%s\n", dest_space_name);
- exit(EXIT_FAILURE);
}
mutex_enter(&fil_system.mutex);
fil_space = fil_space_get_by_id(info.space_id);
@@ -4791,12 +4755,12 @@ exit:
strncpy(tmpname, dest_space_name, FN_REFLEN);
- msg("mariabackup: Renaming %s to %s\n",
+ msg("mariabackup: Renaming %s to %s",
fil_space->name, dest_space_name);
if (fil_space->rename(tmpname, NULL, false) != DB_SUCCESS)
{
- msg("mariabackup: Cannot rename %s to %s\n",
+ msg("mariabackup: Cannot rename %s to %s",
fil_space->name, dest_space_name);
goto exit;
}
@@ -4824,8 +4788,7 @@ exit:
*success = xb_space_create_file(real_name, info.space_id,
flags, &file);
} else {
- msg("mariabackup: Cannot create tablespace %s\n",
- dest_space_name);
+ msg("Can't create tablespace %s\n", dest_space_name);
}
goto exit;
@@ -4895,12 +4858,12 @@ xtrabackup_apply_delta(
page_size = info.page_size.physical();
page_size_shift = get_bit_shift(page_size);
- msg("mariabackup: page size for %s is %zu bytes\n",
+ msg("page size for %s is %zu bytes",
src_path, page_size);
if (page_size_shift < 10 ||
page_size_shift > UNIV_PAGE_SIZE_SHIFT_MAX) {
- msg("mariabackup: error: invalid value of page_size "
- "(%zu bytes) read from %s\n", page_size, meta_path);
+ msg("error: invalid value of page_size "
+ "(%zu bytes) read from %s", page_size, meta_path);
goto error;
}
@@ -4909,7 +4872,7 @@ xtrabackup_apply_delta(
OS_FILE_OPEN, OS_FILE_READ_WRITE, false, &success);
if (!success) {
os_file_get_last_error(TRUE);
- msg("mariabackup: error: cannot open %s\n", src_path);
+ msg("error: can't open %s", src_path);
goto error;
}
@@ -4919,7 +4882,7 @@ xtrabackup_apply_delta(
dbname, space_name, info,
dst_path, sizeof(dst_path), &success);
if (!success) {
- msg("mariabackup: error: cannot open %s\n", dst_path);
+ msg("error: can't open %s", dst_path);
goto error;
}
@@ -4932,7 +4895,7 @@ xtrabackup_apply_delta(
(ut_align(incremental_buffer_base,
page_size));
- msg("Applying %s to %s...\n", src_path, dst_path);
+ msg("Applying %s to %s...", src_path, dst_path);
while (!last_buffer) {
ulint cluster_header;
@@ -4955,8 +4918,8 @@ xtrabackup_apply_delta(
last_buffer = TRUE;
break;
default:
- msg("mariabackup: error: %s seems not "
- ".delta file.\n", src_path);
+ msg("error: %s seems not "
+ ".delta file.", src_path);
goto error;
}
@@ -5054,7 +5017,7 @@ error:
os_file_close(src_file);
if (dst_file != OS_FILE_CLOSED)
os_file_close(dst_file);
- msg("mariabackup: Error: xtrabackup_apply_delta(): "
+ msg("Error: xtrabackup_apply_delta(): "
"failed to apply %s to %s.\n", src_path, dst_path);
return FALSE;
}
@@ -5072,8 +5035,7 @@ std::string change_extension(std::string filename, std::string new_ext) {
static void rename_file(const char *from,const char *to) {
msg("Renaming %s to %s\n", from, to);
if (my_rename(from, to, MY_WME)) {
- msg("Cannot rename %s to %s errno %d", from, to, errno);
- exit(EXIT_FAILURE);
+ die("Can't rename %s to %s errno %d", from, to, errno);
}
}
@@ -5094,7 +5056,7 @@ typedef ibool (*handle_datadir_entry_func_t)(
/** Rename, and replace destination file, if exists */
static void rename_force(const char *from, const char *to) {
if (access(to, R_OK) == 0) {
- msg("Removing %s\n", to);
+ msg("Removing %s", to);
if (my_delete(to, MYF(MY_WME))) {
msg("Can't remove %s, errno %d", to, errno);
exit(EXIT_FAILURE);
@@ -5202,6 +5164,7 @@ xb_process_datadir(
path, NULL,
fileinfo.name, NULL))
{
+ os_file_closedir(dbdir);
return(FALSE);
}
}
@@ -5213,16 +5176,14 @@ next_file_item_1:
os_file_closedir(dbdir);
} else {
- msg("mariabackup: Cannot open dir %s\n",
- path);
+ msg("Can't open dir %s", path);
}
/* single table tablespaces */
dir = os_file_opendir(path, FALSE);
if (dir == NULL) {
- msg("mariabackup: Cannot open dir %s\n",
- path);
+ msg("Can't open dir %s", path);
}
ret = fil_file_readdir_next_file(&err, path, dir,
@@ -5263,6 +5224,7 @@ next_file_item_1:
dbinfo.name,
fileinfo.name, NULL))
{
+ os_file_closedir(dbdir);
return(FALSE);
}
}
@@ -5317,7 +5279,7 @@ store_binlog_info(const char* filename, const char* name, ulonglong pos)
FILE *fp = fopen(filename, "w");
if (!fp) {
- msg("mariabackup: failed to open '%s'\n", filename);
+ msg("mariabackup: failed to open '%s'", filename);
return(false);
}
@@ -5338,7 +5300,7 @@ static std::string read_file_as_string(const std::string file) {
char content[FN_REFLEN];
FILE *f = fopen(file.c_str(), "r");
if (!f) {
- msg("Can not open %s\n", file.c_str());
+ msg("Can not open %s", file.c_str());
}
size_t len = fread(content, 1, FN_REFLEN, f);
fclose(f);
@@ -5350,8 +5312,7 @@ static void delete_file(const std::string& file, bool if_exists = false) {
if (if_exists && !file_exists(file))
return;
if (my_delete(file.c_str(), MYF(MY_WME))) {
- msg("Can't remove %s, errno %d", file.c_str(), errno);
- exit(EXIT_FAILURE);
+ die("Can't remove %s, errno %d", file.c_str(), errno);
}
}
@@ -5435,14 +5396,21 @@ xtrabackup_prepare_func(char** argv)
if (my_setwd(xtrabackup_real_target_dir,MYF(MY_WME)))
{
- msg("mariabackup: cannot my_setwd %s\n",
- xtrabackup_real_target_dir);
+ msg("can't my_setwd %s", xtrabackup_real_target_dir);
return(false);
}
- msg("mariabackup: cd to %s\n", xtrabackup_real_target_dir);
+ msg("cd to %s", xtrabackup_real_target_dir);
fil_path_to_mysql_datadir = ".";
+ /* Fix DDL for prepare. Process .del,.ren, and .new files.
+ The order in which files are processed, is important
+ (see MDEV-18185, MDEV-18201)
+ */
+ xb_process_datadir(xtrabackup_incremental_dir ? xtrabackup_incremental_dir : ".",
+ ".del", prepare_handle_del_files);
+ xb_process_datadir(xtrabackup_incremental_dir? xtrabackup_incremental_dir:".",
+ ".ren", prepare_handle_ren_files);
if (xtrabackup_incremental_dir) {
xb_process_datadir(xtrabackup_incremental_dir, ".new.meta", prepare_handle_new_files);
xb_process_datadir(xtrabackup_incremental_dir, ".new.delta", prepare_handle_new_files);
@@ -5450,11 +5418,6 @@ xtrabackup_prepare_func(char** argv)
else {
xb_process_datadir(".", ".new", prepare_handle_new_files);
}
- xb_process_datadir(xtrabackup_incremental_dir? xtrabackup_incremental_dir:".",
- ".ren", prepare_handle_ren_files);
- xb_process_datadir(xtrabackup_incremental_dir ? xtrabackup_incremental_dir : ".",
- ".del", prepare_handle_del_files);
-
int argc; for (argc = 0; argv[argc]; argc++) {}
encryption_plugin_prepare_init(argc, argv);
@@ -5472,32 +5435,31 @@ xtrabackup_prepare_func(char** argv)
XTRABACKUP_METADATA_FILENAME);
if (!xtrabackup_read_metadata(metadata_path)) {
- msg("mariabackup: Error: failed to read metadata from '%s'\n",
+ msg("Error: failed to read metadata from '%s'\n",
metadata_path);
return(false);
}
if (!strcmp(metadata_type, "full-backuped")) {
if (xtrabackup_incremental) {
- msg("mariabackup: error: applying incremental backup "
- "needs a prepared target.\n");
+ msg("error: applying incremental backup "
+ "needs a prepared target.");
return(false);
}
- msg("mariabackup: This target seems to be not prepared yet.\n");
+ msg("This target seems to be not prepared yet.");
} else if (!strcmp(metadata_type, "log-applied")) {
- msg("mariabackup: This target seems to be already prepared.\n");
+ msg("This target seems to be already prepared.");
} else {
- msg("mariabackup: This target does not have correct metadata.\n");
+ msg("This target does not have correct metadata.");
return(false);
}
bool ok = !xtrabackup_incremental
|| metadata_to_lsn == incremental_lsn;
if (!ok) {
- msg("mariabackup: error: This incremental backup seems "
- "not to be proper for the target.\n"
- "mariabackup: Check 'to_lsn' of the target and "
- "'from_lsn' of the incremental.\n");
+ msg("error: This incremental backup seems "
+ "not to be proper for the target. Check 'to_lsn' of the target and "
+ "'from_lsn' of the incremental.");
return(false);
}
@@ -5573,9 +5535,10 @@ xtrabackup_prepare_func(char** argv)
srv_n_write_io_threads = 4;
}
- msg("mariabackup: Starting InnoDB instance for recovery.\n"
- "mariabackup: Using %lld bytes for buffer pool "
- "(set by --use-memory parameter)\n", xtrabackup_use_memory);
+ msg("Starting InnoDB instance for recovery.");
+
+ msg("mariabackup: Using %lld bytes for buffer pool "
+ "(set by --use-memory parameter)", xtrabackup_use_memory);
srv_max_buf_pool_modified_pct = (double)max_buf_pool_modified_pct;
@@ -5588,7 +5551,7 @@ xtrabackup_prepare_func(char** argv)
}
if (ok) {
- msg("Last binlog file %s, position %lld\n",
+ msg("Last binlog file %s, position %lld",
trx_sys.recovered_binlog_filename,
longlong(trx_sys.recovered_binlog_offset));
@@ -5612,7 +5575,7 @@ xtrabackup_prepare_func(char** argv)
&& srv_start_lsn < target_lsn) {
msg("mariabackup: error: "
"The log was only applied up to LSN " LSN_PF
- ", instead of " LSN_PF "\n",
+ ", instead of " LSN_PF,
srv_start_lsn, target_lsn);
ok = false;
}
@@ -5640,13 +5603,13 @@ xtrabackup_prepare_func(char** argv)
if (!xtrabackup_write_metadata(filename)) {
msg("mariabackup: Error: failed to write metadata "
- "to '%s'\n", filename);
+ "to '%s'", filename);
ok = false;
} else if (xtrabackup_extra_lsndir) {
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_METADATA_FILENAME);
if (!xtrabackup_write_metadata(filename)) {
msg("mariabackup: Error: failed to write "
- "metadata to '%s'\n", filename);
+ "metadata to '%s'", filename);
ok = false;
}
}
@@ -5681,6 +5644,153 @@ append_defaults_group(const char *group, const char *default_groups[],
ut_a(appended);
}
+static const char*
+normalize_privilege_target_name(const char* name)
+{
+ if (strcmp(name, "*") == 0) {
+ return "\\*";
+ }
+ else {
+ /* should have no regex special characters. */
+ ut_ad(strpbrk(name, ".()[]*+?") == 0);
+ }
+ return name;
+}
+
+/******************************************************************//**
+Check if specific privilege is granted.
+Uses regexp magic to check if requested privilege is granted for given
+database.table or database.* or *.*
+or if user has 'ALL PRIVILEGES' granted.
+@return true if requested privilege is granted, false otherwise. */
+static bool
+has_privilege(const std::list<std::string> &granted,
+ const char* required,
+ const char* db_name,
+ const char* table_name)
+{
+ char buffer[1000];
+ regex_t priv_re;
+ regmatch_t tables_regmatch[1];
+ bool result = false;
+
+ db_name = normalize_privilege_target_name(db_name);
+ table_name = normalize_privilege_target_name(table_name);
+
+ int written = snprintf(buffer, sizeof(buffer),
+ "GRANT .*(%s)|(ALL PRIVILEGES).* ON (\\*|`%s`)\\.(\\*|`%s`)",
+ required, db_name, table_name);
+ if (written < 0 || written == sizeof(buffer)
+ || regcomp(&priv_re, buffer, REG_EXTENDED)) {
+ die("regcomp() failed for '%s'", buffer);
+ }
+
+ typedef std::list<std::string>::const_iterator string_iter;
+ for (string_iter i = granted.begin(), e = granted.end(); i != e; ++i) {
+ int res = regexec(&priv_re, i->c_str(),
+ 1, tables_regmatch, 0);
+
+ if (res != REG_NOMATCH) {
+ result = true;
+ break;
+ }
+ }
+
+ xb_regfree(&priv_re);
+ return result;
+}
+
+enum {
+ PRIVILEGE_OK = 0,
+ PRIVILEGE_WARNING = 1,
+ PRIVILEGE_ERROR = 2,
+};
+
+/******************************************************************//**
+Check if specific privilege is granted.
+Prints error message if required privilege is missing.
+@return PRIVILEGE_OK if requested privilege is granted, error otherwise. */
+static
+int check_privilege(
+ const std::list<std::string> &granted_priv, /* in: list of
+ granted privileges*/
+ const char* required, /* in: required privilege name */
+ const char* target_database, /* in: required privilege target
+ database name */
+ const char* target_table, /* in: required privilege target
+ table name */
+ int error = PRIVILEGE_ERROR) /* in: return value if privilege
+ is not granted */
+{
+ if (!has_privilege(granted_priv,
+ required, target_database, target_table)) {
+ msg("%s: missing required privilege %s on %s.%s",
+ (error == PRIVILEGE_ERROR ? "Error" : "Warning"),
+ required, target_database, target_table);
+ return error;
+ }
+ return PRIVILEGE_OK;
+}
+
+
+/**
+Check DB user privileges according to the intended actions.
+
+Fetches DB user privileges, determines intended actions based on
+command-line arguments and prints missing privileges.
+@return whether all the necessary privileges are granted */
+static bool check_all_privileges()
+{
+ if (!mysql_connection) {
+ /* Not connected, no queries is going to be executed. */
+ return true;
+ }
+
+ /* Fetch effective privileges. */
+ std::list<std::string> granted_privileges;
+ MYSQL_RES* result = xb_mysql_query(mysql_connection, "SHOW GRANTS",
+ true);
+ while (MYSQL_ROW row = mysql_fetch_row(result)) {
+ granted_privileges.push_back(*row);
+ }
+ mysql_free_result(result);
+
+ int check_result = PRIVILEGE_OK;
+
+ /* FLUSH TABLES WITH READ LOCK */
+ if (!opt_no_lock)
+ {
+ check_result |= check_privilege(
+ granted_privileges,
+ "RELOAD", "*", "*");
+ check_result |= check_privilege(
+ granted_privileges,
+ "PROCESS", "*", "*");
+ }
+
+ /* KILL ... */
+ if ((!opt_no_lock && (opt_kill_long_queries_timeout || opt_lock_ddl_per_table))
+ /* START SLAVE SQL_THREAD */
+ /* STOP SLAVE SQL_THREAD */
+ || opt_safe_slave_backup) {
+ check_result |= check_privilege(
+ granted_privileges,
+ "SUPER", "*", "*",
+ PRIVILEGE_WARNING);
+ }
+
+ /* SHOW MASTER STATUS */
+ /* SHOW SLAVE STATUS */
+ if (opt_galera_info || opt_slave_info
+ || (opt_no_lock && opt_safe_slave_backup)) {
+ check_result |= check_privilege(granted_privileges,
+ "REPLICATION CLIENT", "*", "*",
+ PRIVILEGE_WARNING);
+ }
+
+ return !(check_result & PRIVILEGE_ERROR);
+}
+
bool
xb_init()
{
@@ -5694,7 +5804,7 @@ xb_init()
&& !opt_safe_slave_backup) {
msg("Error: --slave-info is used with --no-lock but "
"without --safe-slave-backup. The binlog position "
- "cannot be consistent with the backup data.\n");
+ "cannot be consistent with the backup data.");
return(false);
}
@@ -5745,7 +5855,9 @@ xb_init()
if (!get_mysql_vars(mysql_connection)) {
return(false);
}
-
+ if (opt_check_privileges && !check_all_privileges()) {
+ return(false);
+ }
history_start_time = time(NULL);
}
@@ -5914,21 +6026,13 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
char *optend = strcend((argv)[i], '=');
if (optend - argv[i] == 15 &&
- !strncmp(argv[i], "--defaults-file", optend - argv[i])) {
-
- msg("mariabackup: Error: --defaults-file "
- "must be specified first on the command "
- "line\n");
- exit(EXIT_FAILURE);
+ !strncmp(argv[i], "--defaults-file", optend - argv[i])) {
+ die("--defaults-file must be specified first on the command line");
}
- if (optend - argv[i] == 21 &&
- !strncmp(argv[i], "--defaults-extra-file",
- optend - argv[i])) {
-
- msg("mariabackup: Error: --defaults-extra-file "
- "must be specified first on the command "
- "line\n");
- exit(EXIT_FAILURE);
+ if (optend - argv[i] == 21 &&
+ !strncmp(argv[i], "--defaults-extra-file",
+ optend - argv[i])) {
+ die("--defaults-extra-file must be specified first on the command line");
}
}
@@ -5975,7 +6079,7 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
if (!server_option) {
msg("mariabackup: Error:"
- " unknown argument: '%s'\n", opt);
+ " unknown argument: '%s'", opt);
exit(EXIT_FAILURE);
}
}
@@ -6031,7 +6135,7 @@ int main(int argc, char **argv)
if (mysql_server_init(-1, NULL, NULL))
{
- exit(EXIT_FAILURE);
+ die("mysql_server_init() failed");
}
system_charset_info = &my_charset_utf8_general_ci;
@@ -6075,7 +6179,7 @@ int main(int argc, char **argv)
mysql_mutex_destroy(&LOCK_error_log);
if (status == EXIT_SUCCESS) {
- msg_ts("completed OK!\n");
+ msg("completed OK!");
}
return status;
@@ -6093,7 +6197,7 @@ static int main_low(char** argv)
&& !strcmp(mysql_data_home, "./")) {
if (!xtrabackup_print_param)
usage();
- msg("\nmariabackup: Error: Please set parameter 'datadir'\n");
+ msg("mariabackup: Error: Please set parameter 'datadir'");
return(EXIT_FAILURE);
}
@@ -6164,7 +6268,7 @@ static int main_low(char** argv)
if (error) {
msg("mariabackup: value '%s' may be wrong format for "
- "incremental option.\n", xtrabackup_incremental);
+ "incremental option.", xtrabackup_incremental);
return(EXIT_FAILURE);
}
} else if (xtrabackup_backup && xtrabackup_incremental_basedir) {
@@ -6174,7 +6278,7 @@ static int main_low(char** argv)
if (!xtrabackup_read_metadata(filename)) {
msg("mariabackup: error: failed to read metadata from "
- "%s\n", filename);
+ "%s", filename);
return(EXIT_FAILURE);
}
@@ -6187,7 +6291,7 @@ static int main_low(char** argv)
if (!xtrabackup_read_metadata(filename)) {
msg("mariabackup: error: failed to read metadata from "
- "%s\n", filename);
+ "%s", filename);
return(EXIT_FAILURE);
}
@@ -6205,7 +6309,7 @@ static int main_low(char** argv)
}
if (xtrabackup_stream && !xtrabackup_backup) {
- msg("Warning: --stream parameter is ignored, it only works together with --backup.\n");
+ msg("Warning: --stream parameter is ignored, it only works together with --backup.");
}
if (!xb_init()) {
@@ -6220,13 +6324,13 @@ static int main_low(char** argv)
print_version();
if (xtrabackup_incremental) {
- msg("incremental backup from " LSN_PF " is enabled.\n",
+ msg("incremental backup from " LSN_PF " is enabled.",
incremental_lsn);
}
if (xtrabackup_export && innobase_file_per_table == FALSE) {
msg("mariabackup: auto-enabling --innodb-file-per-table due to "
- "the --export option\n");
+ "the --export option");
innobase_file_per_table = TRUE;
}
@@ -6292,3 +6396,12 @@ static int get_exepath(char *buf, size_t size, const char *argv0)
return my_realpath(buf, argv0, 0);
}
+
+
+#if defined (__SANITIZE_ADDRESS__) && defined (__linux__)
+/* Avoid LeakSanitizer's false positives. */
+const char* __asan_default_options()
+{
+ return "detect_leaks=0";
+}
+#endif
diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h
index 857c253f803..90f5e28e2c7 100644
--- a/extra/mariabackup/xtrabackup.h
+++ b/extra/mariabackup/xtrabackup.h
@@ -71,7 +71,7 @@ extern char *xtrabackup_databases_file;
extern char *xtrabackup_tables_exclude;
extern char *xtrabackup_databases_exclude;
-extern ibool xtrabackup_compress;
+extern uint xtrabackup_compress;
extern my_bool xtrabackup_backup;
extern my_bool xtrabackup_prepare;
@@ -86,14 +86,10 @@ extern int xtrabackup_parallel;
extern my_bool xb_close_files;
extern const char *xtrabackup_compress_alg;
-#ifdef __cplusplus
-extern "C"{
-#endif
- extern uint xtrabackup_compress_threads;
- extern ulonglong xtrabackup_compress_chunk_size;
-#ifdef __cplusplus
-}
-#endif
+
+extern uint xtrabackup_compress_threads;
+extern ulonglong xtrabackup_compress_chunk_size;
+
extern my_bool xtrabackup_export;
extern char *xtrabackup_extra_lsndir;
extern ulint xtrabackup_log_copy_interval;
@@ -111,6 +107,8 @@ extern my_bool opt_noversioncheck;
extern my_bool opt_no_backup_locks;
extern my_bool opt_decompress;
extern my_bool opt_remove_original;
+extern my_bool opt_extended_validation;
+extern my_bool opt_encrypted_backup;
extern my_bool opt_lock_ddl_per_table;
extern char *opt_incremental_history_name;
diff --git a/extra/perror.c b/extra/perror.c
index bd62401c8b2..49b1318cbb2 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -87,7 +87,7 @@ static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
- printf("Print a description for a system error code or a MySQL error code.\n");
+ printf("Print a description for a system error code or a MariaDB error code.\n");
printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
my_print_help(my_long_options);
@@ -336,7 +336,7 @@ int main(int argc,char *argv[])
{
found= 1;
if (verbose)
- printf("MySQL error code %3d: %s\n", code, msg);
+ printf("MariaDB error code %3d: %s\n", code, msg);
else
puts(msg);
}
@@ -344,7 +344,7 @@ int main(int argc,char *argv[])
{
found= 1;
if (verbose)
- printf("MySQL error code %3d (%s): %s\n", code, name, msg);
+ printf("MariaDB error code %3d (%s): %s\n", code, name, msg);
else
puts(msg);
}
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index dbd9941141d..78a32298dab 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -75,7 +75,7 @@ static void print_version(void)
static void usage()
{
print_version();
- printf("MySQL AB, by Sasha Pachev\n");
+ printf("MariaDB Corporation, originally created by Sasha Pachev\n");
printf("This software comes with ABSOLUTELY NO WARRANTY\n\n");
printf("Resolve numeric stack strace dump into symbols.\n\n");
printf("Usage: %s [OPTIONS] symbols-file [numeric-dump-file]\n",
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index 51e1bd1ab21..d0234a6b68e 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -295,6 +295,7 @@ int SSL_connect(SSL* ssl)
sendClientHello(*ssl);
if (!ssl->GetError())
ssl->useStates().UseConnect() = CLIENT_HELLO_SENT;
+ /* fall through */
case CLIENT_HELLO_SENT :
neededState = ssl->getSecurity().get_resuming() ?
@@ -302,13 +303,14 @@ int SSL_connect(SSL* ssl)
while (ssl->getStates().getClient() < neededState) {
if (ssl->GetError()) break;
processReply(*ssl);
- // if resumption failed, reset needed state
+ // if resumption failed, reset needed state
if (neededState == serverFinishedComplete)
if (!ssl->getSecurity().get_resuming())
neededState = serverHelloDoneComplete;
}
if (!ssl->GetError())
ssl->useStates().UseConnect() = FIRST_REPLY_DONE;
+ /* fall through */
case FIRST_REPLY_DONE :
if(ssl->getCrypto().get_certManager().sendVerify())
@@ -326,6 +328,7 @@ int SSL_connect(SSL* ssl)
if (!ssl->GetError())
ssl->useStates().UseConnect() = FINISHED_DONE;
+ /* fall through */
case FINISHED_DONE :
if (!ssl->getSecurity().get_resuming())
@@ -335,6 +338,7 @@ int SSL_connect(SSL* ssl)
}
if (!ssl->GetError())
ssl->useStates().UseConnect() = SECOND_REPLY_DONE;
+ /* fall through */
case SECOND_REPLY_DONE :
ssl->verifyState(serverFinishedComplete);
@@ -343,7 +347,7 @@ int SSL_connect(SSL* ssl)
if (ssl->GetError()) {
GetErrors().Add(ssl->GetError());
return SSL_FATAL_ERROR;
- }
+ }
return SSL_SUCCESS;
default :
@@ -371,7 +375,6 @@ int SSL_accept(SSL* ssl)
ssl->SetError(no_error);
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_WRITE)) {
-
ssl->SetError(no_error);
ssl->SendWriteBuffered();
if (!ssl->GetError())
@@ -385,6 +388,7 @@ int SSL_accept(SSL* ssl)
processReply(*ssl);
if (!ssl->GetError())
ssl->useStates().UseAccept() = ACCEPT_FIRST_REPLY_DONE;
+ /* fall through */
case ACCEPT_FIRST_REPLY_DONE :
sendServerHello(*ssl);
@@ -401,9 +405,10 @@ int SSL_accept(SSL* ssl)
sendServerHelloDone(*ssl);
ssl->flushBuffer();
}
-
+
if (!ssl->GetError())
ssl->useStates().UseAccept() = SERVER_HELLO_DONE;
+ /* fall through */
case SERVER_HELLO_DONE :
if (!ssl->getSecurity().get_resuming()) {
@@ -414,6 +419,7 @@ int SSL_accept(SSL* ssl)
}
if (!ssl->GetError())
ssl->useStates().UseAccept() = ACCEPT_SECOND_REPLY_DONE;
+ /* fall through */
case ACCEPT_SECOND_REPLY_DONE :
sendChangeCipher(*ssl);
@@ -422,6 +428,7 @@ int SSL_accept(SSL* ssl)
if (!ssl->GetError())
ssl->useStates().UseAccept() = ACCEPT_FINISHED_DONE;
+ /* fall through */
case ACCEPT_FINISHED_DONE :
if (ssl->getSecurity().get_resuming()) {
@@ -432,6 +439,7 @@ int SSL_accept(SSL* ssl)
}
if (!ssl->GetError())
ssl->useStates().UseAccept() = ACCEPT_THIRD_REPLY_DONE;
+ /* fall through */
case ACCEPT_THIRD_REPLY_DONE :
ssl->useLog().ShowTCP(ssl->getSocket().get_fd());
diff --git a/include/aria_backup.h b/include/aria_backup.h
new file mode 100644
index 00000000000..bb2d06b0acd
--- /dev/null
+++ b/include/aria_backup.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 2018 MariaDB corporation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+/* Interfaces for doing backups of Aria tables */
+
+typedef struct st_aria_table_capabilities
+{
+ my_off_t header_size;
+ ulong bitmap_pages_covered;
+ uint block_size;
+ uint keypage_header;
+ my_bool checksum;
+ my_bool transactional;
+ /* This is true if the table can be copied without any locks */
+ my_bool online_backup_safe;
+} ARIA_TABLE_CAPABILITIES;
+
+int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap);
+int aria_read_index(File kfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
+ uchar *buffer);
+int aria_read_data(File dfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
+ uchar *buffer, size_t *bytes_read);
diff --git a/include/json_lib.h b/include/json_lib.h
index fed85b516d9..b6add6d13a3 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -174,11 +174,11 @@ enum json_value_types
{
JSON_VALUE_OBJECT=1,
JSON_VALUE_ARRAY=2,
- JSON_VALUE_STRING,
- JSON_VALUE_NUMBER,
- JSON_VALUE_TRUE,
- JSON_VALUE_FALSE,
- JSON_VALUE_NULL
+ JSON_VALUE_STRING=3,
+ JSON_VALUE_NUMBER=4,
+ JSON_VALUE_TRUE=5,
+ JSON_VALUE_FALSE=6,
+ JSON_VALUE_NULL=7
};
@@ -423,10 +423,15 @@ int json_path_parts_compare(
int json_path_compare(const json_path_t *a, const json_path_t *b,
enum json_value_types vt);
+int json_valid(const char *js, size_t js_len, CHARSET_INFO *cs);
+
+int json_locate_key(const char *js, const char *js_end,
+ const char *kname,
+ const char **key_start, const char **key_end,
+ int *comma_pos);
#ifdef __cplusplus
}
#endif
#endif /* JSON_LIB_INCLUDED */
-
diff --git a/include/lf.h b/include/lf.h
index a9d7e9ee688..fe861a524dc 100644
--- a/include/lf.h
+++ b/include/lf.h
@@ -167,6 +167,8 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins,
my_hash_walk_action action, void *argument);
+#define lf_hash_size(hash) \
+ my_atomic_load32_explicit(&(hash)->count, MY_MEMORY_ORDER_RELAXED)
/*
shortcut macros to access underlying pinbox functions from an LF_HASH
see lf_pinbox_get_pins() and lf_pinbox_put_pins()
diff --git a/include/my_counter.h b/include/my_counter.h
new file mode 100644
index 00000000000..c5cbe296df0
--- /dev/null
+++ b/include/my_counter.h
@@ -0,0 +1,49 @@
+#ifndef MY_COUNTER_H_INCLUDED
+#define MY_COUNTER_H_INCLUDED
+/*
+ Copyright (C) 2018 MariaDB Foundation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include <atomic>
+
+
+template <typename Type> class Atomic_counter
+{
+ std::atomic<Type> m_counter;
+
+ Type add(Type i) { return m_counter.fetch_add(i, std::memory_order_relaxed); }
+ Type sub(Type i) { return m_counter.fetch_sub(i, std::memory_order_relaxed); }
+
+public:
+ Atomic_counter(const Atomic_counter<Type> &rhs)
+ { m_counter.store(rhs, std::memory_order_relaxed); }
+ Atomic_counter(Type val): m_counter(val) {}
+ Atomic_counter() {}
+
+ Type operator++(int) { return add(1); }
+ Type operator--(int) { return sub(1); }
+
+ Type operator++() { return add(1) + 1; }
+ Type operator--() { return sub(1) - 1; }
+
+ Type operator+=(const Type i) { return add(i) + i; }
+ Type operator-=(const Type i) { return sub(i) - i; }
+
+ operator Type() const { return m_counter.load(std::memory_order_relaxed); }
+ Type operator=(const Type val)
+ { m_counter.store(val, std::memory_order_relaxed); return val; }
+};
+#endif /* MY_COUNTER_H_INCLUDED */
diff --git a/include/my_global.h b/include/my_global.h
index ea438e7171f..69b91f8b870 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1068,7 +1068,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
static inline char *dlerror(void)
{
static char win_errormsg[2048];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
0, GetLastError(), 0, win_errormsg, 2048, NULL);
return win_errormsg;
}
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 2712c7d8ffd..843701ccab9 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -189,7 +189,19 @@ extern int my_pthread_create_detached;
int sigwait(sigset_t *set, int *sig);
#endif
-#define my_sigwait(A,B) sigwait((A),(B))
+static inline int my_sigwait(sigset_t *set, int *sig, int *code)
+{
+#ifdef HAVE_SIGWAITINFO
+ siginfo_t siginfo;
+ *sig= sigwaitinfo(set, &siginfo);
+ *code= siginfo.si_code;
+ return *sig < 0 ? errno : 0;
+#else
+#define SI_KERNEL 128
+ *code= 0;
+ return sigwait(set, sig);
+#endif
+}
#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))
diff --git a/include/my_time.h b/include/my_time.h
index babd6101eeb..27011be8b47 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -57,13 +57,6 @@ extern uchar days_in_month[];
/* Flags to str_to_datetime */
-/*
- TIME_FUZZY_DATES is used for the result will only be used for comparison
- purposes. Conversion is as relaxed as possible.
-*/
-#define C_TIME_FUZZY_DATES 1U
-#define C_TIME_DATETIME_ONLY 2U
-#define C_TIME_TIME_ONLY 4U
#define C_TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */
#define C_TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */
#define C_TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */
@@ -86,6 +79,16 @@ extern uchar days_in_month[];
/* Useful constants */
#define SECONDS_IN_24H 86400L
+/* Limits for the INTERVAL data type */
+
+ /* Number of hours between '0001-01-01 00h' and '9999-12-31 23h' */
+#define TIME_MAX_INTERVAL_HOUR 87649415
+#define TIME_MAX_INTERVAL_HOUR_CHAR_LENGTH 8
+
+/* Number of full days between '0001-01-01' and '9999-12-31'*/
+#define TIME_MAX_INTERVAL_DAY 3652058 /*87649415/24*/
+#define TIME_MAX_INTERVAL_DAY_CHAR_LENGTH 7
+
/* Limits for the TIME data type */
#define TIME_MAX_HOUR 838
#define TIME_MAX_MINUTE 59
@@ -105,27 +108,46 @@ typedef struct st_mysql_time_status
{
int warnings;
uint precision;
+ uint nanoseconds;
} MYSQL_TIME_STATUS;
static inline void my_time_status_init(MYSQL_TIME_STATUS *status)
{
status->warnings= 0;
status->precision= 0;
+ status->nanoseconds= 0;
}
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
ulonglong flags, int *was_cut);
my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *l_time,
ulong max_hour, MYSQL_TIME_STATUS *status);
-my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time,
- ulonglong flag, MYSQL_TIME_STATUS *status);
-my_bool str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time,
- ulonglong flags, MYSQL_TIME_STATUS *status);
-longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
- ulonglong flags, int *was_cut);
-
-int number_to_time(my_bool neg, ulonglong nr, ulong sec_part,
- MYSQL_TIME *ltime, int *was_cut);
+my_bool str_to_datetime_or_date_or_time(const char *str, size_t length,
+ MYSQL_TIME *to, ulonglong flag,
+ MYSQL_TIME_STATUS *status,
+ ulong time_max_hour,
+ ulong time_err_hour);
+my_bool
+str_to_datetime_or_date_or_interval_hhmmssff(const char *str, size_t length,
+ MYSQL_TIME *to, ulonglong flag,
+ MYSQL_TIME_STATUS *status,
+ ulong time_max_hour,
+ ulong time_err_hour);
+my_bool
+str_to_datetime_or_date_or_interval_day(const char *str, size_t length,
+ MYSQL_TIME *to, ulonglong flag,
+ MYSQL_TIME_STATUS *status,
+ ulong time_max_hour,
+ ulong time_err_hour);
+my_bool str_to_datetime_or_date(const char *str, size_t length, MYSQL_TIME *to,
+ ulonglong flags, MYSQL_TIME_STATUS *status);
+
+longlong number_to_datetime_or_date(longlong nr, ulong sec_part,
+ MYSQL_TIME *time_res,
+ ulonglong flags, int *was_cut);
+int number_to_time_only(my_bool neg, ulonglong nr, ulong sec_part,
+ ulong max_hour, MYSQL_TIME *to, int *was_cut);
+
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
@@ -188,6 +210,7 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
#define MAX_DATE_STRING_REP_LENGTH 30
#define AUTO_SEC_PART_DIGITS DECIMAL_NOT_SPECIFIED
+int my_interval_DDhhmmssff_to_str(const MYSQL_TIME *, char *to, uint digits);
int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
int my_date_to_str(const MYSQL_TIME *l_time, char *to);
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index b122d888c6d..02a87c6db71 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x010d
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x010e
/*
The allowable types of plugins
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 89f7dcc36c4..c5ae678e82a 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 7ed786cc1ab..41cb7d075c4 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp
index 7defe0aec2c..6597decfbef 100644
--- a/include/mysql/plugin_encryption.h.pp
+++ b/include/mysql/plugin_encryption.h.pp
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index a36f51e74e1..bd1cfc7b68b 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp
index b13f8cc9afb..2f9d2299c1f 100644
--- a/include/mysql/plugin_password_validation.h.pp
+++ b/include/mysql/plugin_password_validation.h.pp
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
struct st_mysql_xid {
long formatID;
long gtrid_length;
diff --git a/include/mysql/service_json.h b/include/mysql/service_json.h
new file mode 100644
index 00000000000..141b76279a5
--- /dev/null
+++ b/include/mysql/service_json.h
@@ -0,0 +1,117 @@
+/* Copyright (C) 2018 MariaDB Corporation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+#ifndef MYSQL_SERVICE_JSON
+#define MYSQL_SERVICE_JSON
+
+/**
+ @file
+ json service
+
+ Esports JSON parsing methods for plugins to use.
+
+ Fuctions of the service:
+ js_type - returns the type of the JSON argument,
+ and the parsed value if it's scalar (not object or array)
+
+ js_get_array_item - expecs JSON array as an argument,
+ and returns the n_item's item's type and value
+ Returns JSV_NOTHING type if the array is shorter
+ than n_item and the actual length of the array in v_len.
+
+ js_get_object_key - expects JSON object as an argument,
+ searches for a key in the object, return it's type and value.
+ JSV_NOTHING if no such key found, the number of keys
+ in v_len.
+
+ js_get_object_nkey - expects JSON object as an argument.
+ finds n_key's key in the object, returns it's name, type and value.
+ JSV_NOTHING if object has less keys than n_key.
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum json_types
+{
+ JSV_BAD_JSON=-1,
+ JSV_NOTHING=0,
+ JSV_OBJECT=1,
+ JSV_ARRAY=2,
+ JSV_STRING=3,
+ JSV_NUMBER=4,
+ JSV_TRUE=5,
+ JSV_FALSE=6,
+ JSV_NULL=7
+};
+
+extern struct json_service_st {
+ enum json_types (*json_type)(const char *js, const char *js_end,
+ const char **value, int *value_len);
+ enum json_types (*json_get_array_item)(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_key)(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+ enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
+ int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+ int (*json_escape_string)(const char *str,const char *str_end,
+ char *json, char *json_end);
+ int (*json_unescape_json)(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+} *json_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define json_type json_service->json_type
+#define json_get_array_item json_service->json_get_array_item
+#define json_get_object_key json_service->json_get_object_key
+#define json_get_object_nkey json_service->json_get_object_nkey
+#define json_escape_string json_service->json_escape_string
+#define json_unescape_json json_service->json_unescape_json
+
+#else
+
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len);
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len);
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len);
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len);
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end);
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end);
+
+#endif /*MYSQL_DYNAMIC_PLUGIN*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*MYSQL_SERVICE_JSON */
+
+
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index cefba6303fe..5aa97cdb47e 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -1,5 +1,20 @@
#ifndef MYSQL_SERVICE_WSREP_INCLUDED
+#define MYSQL_SERVICE_WSREP_INCLUDED
+
+enum Wsrep_service_key_type
+{
+ WSREP_SERVICE_KEY_SHARED,
+ WSREP_SERVICE_KEY_REFERENCE,
+ WSREP_SERVICE_KEY_UPDATE,
+ WSREP_SERVICE_KEY_EXCLUSIVE
+};
+
+#if (defined (MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED)) || (!defined(MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_STATIC_INCLUDED))
+
+#else
+
/* Copyright (c) 2015 MariaDB Corporation Ab
+ 2018 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,153 +36,92 @@
Interface to WSREP functionality in the server.
For engines that want to support galera.
*/
-
+#include <my_pthread.h>
#ifdef __cplusplus
-extern "C" {
#endif
-enum wsrep_conflict_state {
- NO_CONFLICT,
- MUST_ABORT,
- ABORTING,
- ABORTED,
- MUST_REPLAY,
- REPLAYING,
- RETRY_AUTOCOMMIT,
- CERT_FAILURE,
-};
-
-enum wsrep_exec_mode {
- /* Transaction processing before replication. */
- LOCAL_STATE,
- /* Slave thread applying write sets from other nodes or replaying thread. */
- REPL_RECV,
- /* Total-order-isolation mode. */
- TOTAL_ORDER,
- /*
- Transaction procession after it has been replicated in prepare stage and
- has passed certification.
- */
- LOCAL_COMMIT
-};
-
-enum wsrep_query_state {
- QUERY_IDLE,
- QUERY_EXEC,
- QUERY_COMMITTING,
- QUERY_EXITING,
- QUERY_ROLLINGBACK,
-};
-
-enum wsrep_trx_status {
- WSREP_TRX_OK,
- WSREP_TRX_CERT_FAIL, /* certification failure, must abort */
- WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */
- WSREP_TRX_ERROR, /* native mysql error */
-};
-
struct xid_t;
-struct wsrep;
struct wsrep_ws_handle;
struct wsrep_buf;
+/* Must match to definition in sql/mysqld.h */
+typedef int64 query_id_t;
+
+
extern struct wsrep_service_st {
- struct wsrep * (*get_wsrep_func)();
- my_bool (*get_wsrep_certify_nonPK_func)();
- my_bool (*get_wsrep_debug_func)();
- my_bool (*get_wsrep_drupal_282555_workaround_func)();
my_bool (*get_wsrep_recovery_func)();
- my_bool (*get_wsrep_load_data_splitting_func)();
- my_bool (*get_wsrep_log_conflicts_func)();
- long (*get_wsrep_protocol_version_func)();
- my_bool (*wsrep_aborting_thd_contains_func)(THD *thd);
- void (*wsrep_aborting_thd_enqueue_func)(THD *thd);
- bool (*wsrep_consistency_check_func)(THD *thd);
- int (*wsrep_is_wsrep_xid_func)(const struct xid_t *xid);
+ bool (*wsrep_consistency_check_func)(MYSQL_THD thd);
+ int (*wsrep_is_wsrep_xid_func)(const void *xid);
long long (*wsrep_xid_seqno_func)(const struct xid_t *xid);
const unsigned char* (*wsrep_xid_uuid_func)(const struct xid_t *xid);
- void (*wsrep_lock_rollback_func)();
- int (*wsrep_on_func)(MYSQL_THD);
- void (*wsrep_post_commit_func)(THD* thd, bool all);
- bool (*wsrep_prepare_key_func)(const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*);
- enum wsrep_trx_status (*wsrep_run_wsrep_commit_func)(THD *thd, bool all);
- void (*wsrep_thd_LOCK_func)(THD *thd);
- void (*wsrep_thd_UNLOCK_func)(THD *thd);
- void (*wsrep_thd_awake_func)(THD *thd, my_bool signal);
- enum wsrep_conflict_state (*wsrep_thd_conflict_state_func)(MYSQL_THD, my_bool);
- const char * (*wsrep_thd_conflict_state_str_func)(THD *thd);
- enum wsrep_exec_mode (*wsrep_thd_exec_mode_func)(THD *thd);
- const char * (*wsrep_thd_exec_mode_str_func)(THD *thd);
- enum wsrep_conflict_state (*wsrep_thd_get_conflict_state_func)(MYSQL_THD);
- my_bool (*wsrep_thd_is_BF_func)(MYSQL_THD , my_bool);
- my_bool (*wsrep_thd_is_wsrep_func)(MYSQL_THD thd);
- char * (*wsrep_thd_query_func)(THD *thd);
- enum wsrep_query_state (*wsrep_thd_query_state_func)(THD *thd);
- const char * (*wsrep_thd_query_state_str_func)(THD *thd);
- int (*wsrep_thd_retry_counter_func)(THD *thd);
- void (*wsrep_thd_set_conflict_state_func)(THD *thd, enum wsrep_conflict_state state);
- bool (*wsrep_thd_ignore_table_func)(THD *thd);
- long long (*wsrep_thd_trx_seqno_func)(THD *thd);
- struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd);
- int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd);
- int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD);
- void (*wsrep_unlock_rollback_func)();
+ my_bool (*wsrep_on_func)(const MYSQL_THD thd);
+ bool (*wsrep_prepare_key_for_innodb_func)(MYSQL_THD thd, const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*);
+ void (*wsrep_thd_LOCK_func)(const MYSQL_THD thd);
+ void (*wsrep_thd_UNLOCK_func)(const MYSQL_THD thd);
+ const char * (*wsrep_thd_query_func)(const MYSQL_THD thd);
+ int (*wsrep_thd_retry_counter_func)(const MYSQL_THD thd);
+ bool (*wsrep_thd_ignore_table_func)(MYSQL_THD thd);
+ long long (*wsrep_thd_trx_seqno_func)(const MYSQL_THD thd);
+ my_bool (*wsrep_thd_is_aborting_func)(const MYSQL_THD thd);
void (*wsrep_set_data_home_dir_func)(const char *data_dir);
+ my_bool (*wsrep_thd_is_BF_func)(const MYSQL_THD thd, my_bool sync);
+ my_bool (*wsrep_thd_is_local_func)(const MYSQL_THD thd);
+ void (*wsrep_thd_self_abort_func)(MYSQL_THD thd);
+ int (*wsrep_thd_append_key_func)(MYSQL_THD thd, const struct wsrep_key* key,
+ int n_keys, enum Wsrep_service_key_type);
+ const char* (*wsrep_thd_client_state_str_func)(const MYSQL_THD thd);
+ const char* (*wsrep_thd_client_mode_str_func)(const MYSQL_THD thd);
+ const char* (*wsrep_thd_transaction_state_str_func)(const MYSQL_THD thd);
+ query_id_t (*wsrep_thd_transaction_id_func)(const MYSQL_THD thd);
+ my_bool (*wsrep_thd_bf_abort_func)(const MYSQL_THD bf_thd,
+ MYSQL_THD victim_thd,
+ my_bool signal);
+ my_bool (*wsrep_thd_order_before_func)(const MYSQL_THD left, const MYSQL_THD right);
+ void (*wsrep_handle_SR_rollback_func)(MYSQL_THD BF_thd, MYSQL_THD victim_thd);
+ my_bool (*wsrep_thd_skip_locking_func)(const MYSQL_THD thd);
+ const char* (*wsrep_get_sr_table_name_func)();
+ my_bool (*wsrep_get_debug_func)();
} *wsrep_service;
+#define MYSQL_SERVICE_WSREP_INCLUDED
+#endif
+
#ifdef MYSQL_DYNAMIC_PLUGIN
-#define get_wsrep() wsrep_service->get_wsrep_func()
-#define get_wsrep_certify_nonPK() wsrep_service->get_wsrep_certify_nonPK_func()
-#define get_wsrep_debug() wsrep_service->get_wsrep_debug_func()
-#define get_wsrep_drupal_282555_workaround() wsrep_service->get_wsrep_drupal_282555_workaround_func()
+
+#define MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED
#define get_wsrep_recovery() wsrep_service->get_wsrep_recovery_func()
-#define get_wsrep_load_data_splitting() wsrep_service->get_wsrep_load_data_splitting_func()
-#define get_wsrep_log_conflicts() wsrep_service->get_wsrep_log_conflicts_func()
-#define get_wsrep_protocol_version() wsrep_service->get_wsrep_protocol_version_func()
-#define wsrep_aborting_thd_contains(T) wsrep_service->wsrep_aborting_thd_contains_func(T)
-#define wsrep_aborting_thd_enqueue(T) wsrep_service->wsrep_aborting_thd_enqueue_func(T)
#define wsrep_consistency_check(T) wsrep_service->wsrep_consistency_check_func(T)
#define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X)
#define wsrep_xid_seqno(X) wsrep_service->wsrep_xid_seqno_func(X)
#define wsrep_xid_uuid(X) wsrep_service->wsrep_xid_uuid_func(X)
-#define wsrep_lock_rollback() wsrep_service->wsrep_lock_rollback_func()
#define wsrep_on(X) wsrep_service->wsrep_on_func(X)
-#define wsrep_post_commit(T,A) wsrep_service->wsrep_post_commit_func(T,A)
-#define wsrep_prepare_key(A,B,C,D,E,F) wsrep_service->wsrep_prepare_key_func(A,B,C,D,E,F)
-#define wsrep_run_wsrep_commit(T,A) wsrep_service->wsrep_run_wsrep_commit_func(T,A)
+#define wsrep_prepare_key_for_innodb(A,B,C,D,E,F,G) wsrep_service->wsrep_prepare_key_for_innodb_func(A,B,C,D,E,F,G)
#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T)
#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T)
-#define wsrep_thd_awake(T,S) wsrep_service->wsrep_thd_awake_func(T,S)
-#define wsrep_thd_conflict_state(T,S) wsrep_service->wsrep_thd_conflict_state_func(T,S)
-#define wsrep_thd_conflict_state_str(T) wsrep_service->wsrep_thd_conflict_state_str_func(T)
-#define wsrep_thd_exec_mode(T) wsrep_service->wsrep_thd_exec_mode_func(T)
-#define wsrep_thd_exec_mode_str(T) wsrep_service->wsrep_thd_exec_mode_str_func(T)
-#define wsrep_thd_get_conflict_state(T) wsrep_service->wsrep_thd_get_conflict_state_func(T)
-#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S)
-#define wsrep_thd_is_wsrep(T) wsrep_service->wsrep_thd_is_wsrep_func(T)
#define wsrep_thd_query(T) wsrep_service->wsrep_thd_query_func(T)
-#define wsrep_thd_query_state(T) wsrep_service->wsrep_thd_query_state_func(T)
-#define wsrep_thd_query_state_str(T) wsrep_service->wsrep_thd_query_state_str_func(T)
#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T)
-#define wsrep_thd_set_conflict_state(T,S) wsrep_service->wsrep_thd_set_conflict_state_func(T,S)
#define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T)
#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T)
-#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T)
-#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T)
-#define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2)
-#define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func()
#define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A)
-
-#define wsrep_debug get_wsrep_debug()
-#define wsrep_log_conflicts get_wsrep_log_conflicts()
-#define wsrep_certify_nonPK get_wsrep_certify_nonPK()
-#define wsrep_load_data_splitting get_wsrep_load_data_splitting()
-#define wsrep_drupal_282555_workaround get_wsrep_drupal_282555_workaround()
-#define wsrep_recovery get_wsrep_recovery()
-#define wsrep_protocol_version get_wsrep_protocol_version()
+#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S)
+#define wsrep_thd_is_aborting(T) wsrep_service->wsrep_thd_is_aborting_func(T)
+#define wsrep_thd_is_local(T) wsrep_service->wsrep_thd_is_local_func(T)
+#define wsrep_thd_self_abort(T) wsrep_service->wsrep_thd_self_abort_func(T)
+#define wsrep_thd_append_key(T,W,N,K) wsrep_service->wsrep_thd_append_key_func(T,W,N,K)
+#define wsrep_thd_client_state_str(T) wsrep_service->wsrep_thd_client_state_str_func(T)
+#define wsrep_thd_client_mode_str(T) wsrep_service->wsrep_thd_client_mode_str_func(T)
+#define wsrep_thd_transaction_state_str(T) wsrep_service->wsrep_thd_transaction_state_str_func(T)
+#define wsrep_thd_transaction_id(T) wsrep_service->wsrep_thd_transaction_id_func(T)
+#define wsrep_thd_bf_abort(T,T2,S) wsrep_service->wsrep_thd_bf_abort_func(T,T2,S)
+#define wsrep_thd_order_before(L,R) wsrep_service->wsrep_thd_order_before_func(L,R)
+#define wsrep_handle_SR_rollback(B,V) wsrep_service->wsrep_handle_SR_rollback_func(B,V)
+#define wsrep_thd_skip_locking(T) wsrep_service->wsrep_thd_skip_locking_func(T)
+#define wsrep_get_sr_table_name() wsrep_service->wsrep_get_sr_table_name_func()
+#define wsrep_get_debug() wsrep_service->wsrep_get_debug_func()
#else
+#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
extern my_bool wsrep_debug;
extern my_bool wsrep_log_conflicts;
extern my_bool wsrep_certify_nonPK;
@@ -176,54 +130,81 @@ extern my_bool wsrep_drupal_282555_workaround;
extern my_bool wsrep_recovery;
extern long wsrep_protocol_version;
-bool wsrep_consistency_check(THD *thd);
-bool wsrep_prepare_key(const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len);
-char *wsrep_thd_query(THD *thd);
-const char *wsrep_thd_conflict_state_str(THD *thd);
-const char *wsrep_thd_exec_mode_str(THD *thd);
-const char *wsrep_thd_query_state_str(THD *thd);
-enum wsrep_conflict_state wsrep_thd_conflict_state(MYSQL_THD thd, my_bool sync);
-enum wsrep_conflict_state wsrep_thd_get_conflict_state(MYSQL_THD thd);
-enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd);
-enum wsrep_query_state wsrep_thd_query_state(THD *thd);
-enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, bool all);
-int wsrep_is_wsrep_xid(const struct xid_t* xid);
-long long wsrep_xid_seqno(const struct xid_t* xid);
+extern "C" bool wsrep_consistency_check(MYSQL_THD thd);
+bool wsrep_prepare_key_for_innodb(MYSQL_THD thd, const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len);
+extern "C" const char *wsrep_thd_query(const MYSQL_THD thd);
+extern "C" int wsrep_is_wsrep_xid(const void* xid);
+extern "C" long long wsrep_xid_seqno(const struct xid_t* xid);
const unsigned char* wsrep_xid_uuid(const struct xid_t* xid);
-int wsrep_on(MYSQL_THD thd);
-int wsrep_thd_retry_counter(THD *thd);
-int wsrep_trx_is_aborting(MYSQL_THD thd);
-int wsrep_trx_order_before(MYSQL_THD thd1, MYSQL_THD thd2);
-long get_wsrep_protocol_version();
-long long wsrep_thd_trx_seqno(THD *thd);
-my_bool get_wsrep_certify_nonPK();
-my_bool get_wsrep_debug();
-my_bool get_wsrep_drupal_282555_workaround();
+extern "C" long long wsrep_thd_trx_seqno(const MYSQL_THD thd);
my_bool get_wsrep_recovery();
-my_bool get_wsrep_load_data_splitting();
-my_bool get_wsrep_log_conflicts();
-my_bool wsrep_aborting_thd_contains(THD *thd);
-my_bool wsrep_thd_is_BF(MYSQL_THD thd, my_bool sync);
-my_bool wsrep_thd_is_wsrep(MYSQL_THD thd);
-struct wsrep *get_wsrep();
-struct wsrep_ws_handle *wsrep_thd_ws_handle(THD *thd);
-void wsrep_aborting_thd_enqueue(THD *thd);
-void wsrep_lock_rollback();
-void wsrep_post_commit(THD* thd, bool all);
-void wsrep_thd_LOCK(THD *thd);
-void wsrep_thd_UNLOCK(THD *thd);
-void wsrep_thd_awake(THD *thd, my_bool signal);
-void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state);
-bool wsrep_thd_ignore_table(THD *thd);
-void wsrep_unlock_rollback();
+bool wsrep_thd_ignore_table(MYSQL_THD thd);
void wsrep_set_data_home_dir(const char *data_dir);
+/* from mysql wsrep-lib */
+#include "my_global.h"
+#include "my_pthread.h"
+
+/* Return true if wsrep is enabled for a thd. This means that
+ wsrep is enabled globally and the thd has wsrep on */
+extern "C" my_bool wsrep_on(const MYSQL_THD thd);
+/* Lock thd wsrep lock */
+extern "C" void wsrep_thd_LOCK(const MYSQL_THD thd);
+/* Unlock thd wsrep lock */
+extern "C" void wsrep_thd_UNLOCK(const MYSQL_THD thd);
+
+/* Return thd client state string */
+extern "C" const char* wsrep_thd_client_state_str(const MYSQL_THD thd);
+/* Return thd client mode string */
+extern "C" const char* wsrep_thd_client_mode_str(const MYSQL_THD thd);
+/* Return thd transaction state string */
+extern "C" const char* wsrep_thd_transaction_state_str(const MYSQL_THD thd);
+
+/* Return current transaction id */
+extern "C" query_id_t wsrep_thd_transaction_id(const MYSQL_THD thd);
+/* Mark thd own transaction as aborted */
+extern "C" void wsrep_thd_self_abort(MYSQL_THD thd);
+/* Return true if thd is in replicating mode */
+extern "C" my_bool wsrep_thd_is_local(const MYSQL_THD thd);
+/* Return true if thd is in high priority mode */
+/* todo: rename to is_high_priority() */
+extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd);
+/* Return true if thd is in TOI mode */
+extern "C" my_bool wsrep_thd_is_toi(const MYSQL_THD thd);
+/* Return true if thd is in replicating TOI mode */
+extern "C" my_bool wsrep_thd_is_local_toi(const MYSQL_THD thd);
+/* Return true if thd is in RSU mode */
+extern "C" my_bool wsrep_thd_is_in_rsu(const MYSQL_THD thd);
+/* Return true if thd is in BF mode, either high_priority or TOI */
+extern "C" my_bool wsrep_thd_is_BF(const MYSQL_THD thd, my_bool sync);
+/* Return true if thd is streaming */
+extern "C" my_bool wsrep_thd_is_SR(const MYSQL_THD thd);
+extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd);
+/* Return thd retry counter */
+extern "C" int wsrep_thd_retry_counter(const MYSQL_THD thd);
+/* BF abort victim_thd */
+extern "C" my_bool wsrep_thd_bf_abort(const MYSQL_THD bf_thd,
+ MYSQL_THD victim_thd,
+ my_bool signal);
+/* Return true if left thd is ordered before right thd */
+extern "C" my_bool wsrep_thd_order_before(const MYSQL_THD left, const MYSQL_THD right);
+/* Return true if thd should skip locking. This means that the thd
+ is operating on shared resource inside commit order critical section. */
+extern "C" my_bool wsrep_thd_skip_locking(const MYSQL_THD thd);
+/* Return true if thd is aborting */
+extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd);
+
+struct wsrep_key;
+struct wsrep_key_array;
+extern "C" int wsrep_thd_append_key(MYSQL_THD thd,
+ const struct wsrep_key* key,
+ int n_keys,
+ enum Wsrep_service_key_type);
+
+extern const char* wsrep_sr_table_name_full;
+
+extern "C" const char* wsrep_get_sr_table_name();
+
+extern "C" my_bool wsrep_get_debug();
#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#define MYSQL_SERVICE_WSREP_INCLUDED
-#endif
-
+#endif /* MYSQL_SERVICE_WSREP_INCLUDED */
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 6168c5ed8dc..6dc970df1e6 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -39,6 +39,7 @@ extern "C" {
#include <mysql/service_thd_specifics.h>
#include <mysql/service_thd_timezone.h>
#include <mysql/service_thd_wait.h>
+#include <mysql/service_json.h>
/*#include <mysql/service_wsrep.h>*/
#ifdef __cplusplus
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 902c0ff2706..8b0847ab399 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -231,6 +231,7 @@ enum enum_indicator_type
#define REFRESH_DES_KEY_FILE (1ULL << 18)
#define REFRESH_USER_RESOURCES (1ULL << 19)
#define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */
+#define REFRESH_SSL (1ULL << 21)
#define REFRESH_GENERIC (1ULL << 30)
#define REFRESH_FAST (1ULL << 31) /* Intern flag */
diff --git a/include/service_versions.h b/include/service_versions.h
index 753d6444475..050012d30b9 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -42,3 +42,4 @@
#define VERSION_thd_timezone 0x0100
#define VERSION_thd_wait 0x0100
#define VERSION_wsrep 0x0202
+#define VERSION_json 0x0100
diff --git a/include/thr_lock.h b/include/thr_lock.h
index e6451bf21c4..ee15fd7315d 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -168,9 +168,9 @@ void thr_set_lock_wait_callback(void (*before_wait)(void),
void (*after_wait)(void));
#ifdef WITH_WSREP
- typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool);
- typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool);
- typedef int (* wsrep_on_fun)(void *);
+ typedef my_bool (* wsrep_thd_is_brute_force_fun)(const MYSQL_THD, my_bool);
+ typedef my_bool(* wsrep_abort_thd_fun)(const MYSQL_THD, MYSQL_THD, my_bool);
+ typedef my_bool (* wsrep_on_fun)(const MYSQL_THD);
void wsrep_thr_lock_init(
wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun,
my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun);
diff --git a/include/thread_pool_priv.h b/include/thread_pool_priv.h
index f5fdbfbdf47..cd53306e851 100644
--- a/include/thread_pool_priv.h
+++ b/include/thread_pool_priv.h
@@ -61,9 +61,6 @@ void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
my_socket thd_get_fd(THD *thd);
int thd_store_globals(THD* thd);
-THD *first_global_thread();
-THD *next_global_thread(THD *thd);
-
/* Print to the MySQL error log */
void sql_print_error(const char *format, ...);
diff --git a/include/wsrep.h b/include/wsrep.h
index f7a9b6b0231..df8a88e1c69 100644
--- a/include/wsrep.h
+++ b/include/wsrep.h
@@ -13,11 +13,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
-#include <my_config.h>
-
#ifndef WSREP_INCLUDED
#define WSREP_INCLUDED
+#include <my_config.h>
+
#ifdef WITH_WSREP
#define IF_WSREP(A,B) A
#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A)
@@ -28,12 +28,14 @@
goto wsrep_error_label;
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \
- if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \
- table_list_, alter_info_)) \
+ if (WSREP(thd) && wsrep_thd_is_local(thd) && \
+ wsrep_to_isolation_begin(thd, db_, table_, \
+ table_list_, alter_info_)) \
goto wsrep_error_label;
-#define WSREP_TO_ISOLATION_END \
- if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \
+#define WSREP_TO_ISOLATION_END \
+ if ((WSREP(thd) && wsrep_thd_is_local_toi(thd)) || \
+ wsrep_thd_is_in_rsu(thd)) \
wsrep_to_isolation_end(thd);
/*
@@ -54,19 +56,22 @@
{ if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
-#else
+#else /* !WITH_WSREP */
+
+/* These macros are needed to compile MariaDB without WSREP support
+ * (e.g. embedded) */
+
#define IF_WSREP(A,B) B
-#define DBUG_ASSERT_IF_WSREP(A)
+//#define DBUG_ASSERT_IF_WSREP(A)
#define WSREP_DEBUG(...)
-#define WSREP_INFO(...)
-#define WSREP_WARN(...)
+//#define WSREP_INFO(...)
+//#define WSREP_WARN(...)
#define WSREP_ERROR(...)
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0)
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_)
#define WSREP_TO_ISOLATION_END
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
#define WSREP_SYNC_WAIT(thd_, before_)
-
#endif /* WITH_WSREP */
#endif /* WSREP_INCLUDED */
diff --git a/libmariadb b/libmariadb
-Subproject 17d0e5317604718fc059ee1ad4bd2ea36494226
+Subproject 34f8887af03d022416dd6593de91d0706e57f46
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 537f40cbbbf..dfb5d4ce86f 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -118,7 +118,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/ha_sequence.cc ../sql/ha_sequence.h
../sql/temporary_tables.cc
../sql/session_tracker.cc
- ../sql/proxy_protocol.cc
+ ../sql/proxy_protocol.cc ../sql/backup.cc
../sql/sql_tvc.cc ../sql/sql_tvc.h
../sql/opt_split.cc
../sql/item_vers.cc
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index d47638ad2f9..1eb07a2adf8 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -34,7 +34,7 @@ ENDIF(UNIX)
MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc
COMPONENT Test)
-TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre pcreposix)
+TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcreposix pcre)
IF(CMAKE_GENERATOR MATCHES "Xcode")
# It does not seem possible to tell Xcode the resulting target might need
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 715f1dde5b5..305f6346c9e 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -432,11 +432,9 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row)
static void emb_free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
- mysql_mutex_lock(&LOCK_thread_count);
+ server_threads.erase(thd);
thd->clear_data_list();
thd->store_globals();
- thd->unlink();
- mysql_mutex_unlock(&LOCK_thread_count);
delete thd;
my_pthread_setspecific_ptr(THR_THD, 0);
mysql->thd=0;
@@ -711,10 +709,7 @@ void *create_embedded_thd(int client_flag)
thd->first_data= 0;
thd->data_tail= &thd->first_data;
bzero((char*) &thd->net, sizeof(thd->net));
-
- mysql_mutex_lock(&LOCK_thread_count);
- threads.append(thd);
- mysql_mutex_unlock(&LOCK_thread_count);
+ server_threads.insert(thd);
thd->mysys_var= 0;
thd->reset_globals();
return thd;
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index b3ef96698ff..cd170b42b42 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -3215,7 +3215,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
{
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
MYSQL_TIME_STATUS status;
- str_to_time(value, length, tm, 0, &status);
+ str_to_datetime_or_date_or_time(value, length, tm, 0, &status,
+ TIME_MAX_HOUR, UINT_MAX32);
err= status.warnings;
*param->error= MY_TEST(err);
break;
@@ -3226,7 +3227,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
{
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
MYSQL_TIME_STATUS status;
- (void) str_to_datetime(value, length, tm, 0, &status);
+ (void) str_to_datetime_or_date(value, length, tm, 0, &status);
err= status.warnings;
*param->error= MY_TEST(err) && (param->buffer_type == MYSQL_TYPE_DATE &&
tm->time_type != MYSQL_TIMESTAMP_DATE);
@@ -3350,7 +3351,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_DATETIME:
{
int error;
- value= number_to_datetime(value, 0, (MYSQL_TIME *) buffer, 0, &error);
+ value= number_to_datetime_or_date(value, 0, (MYSQL_TIME *) buffer, 0, &error);
*param->error= MY_TEST(error);
break;
}
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index e20be6d7a7c..b99be7106e1 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -37,6 +37,7 @@ SET(MYSQLSERVICES_SOURCES
thd_timezone_service.c
thd_wait_service.c
wsrep_service.c
+ json_service.c
)
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
diff --git a/libservices/json_service.c b/libservices/json_service.c
new file mode 100644
index 00000000000..96b3b3fa532
--- /dev/null
+++ b/libservices/json_service.c
@@ -0,0 +1,19 @@
+
+/* Copyright (c) 2018, Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include <service_versions.h>
+SERVICE_VERSION json_service= (void*)VERSION_json;
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 9c34ede59c7..1ac4931fdf1 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -25,7 +25,6 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
resolveip.1 mariadb-service-convert.1
mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1
wsrep_sst_mysqldump.1 wsrep_sst_rsync.1
- wsrep_sst_xtrabackup-v2.1 wsrep_sst_xtrabackup.1
galera_recovery.1 galera_new_cluster.1 tokuft_logprint.1
mysql_ldb.1
wsrep_sst_mariabackup.1 mbstream.1 mariabackup.1
diff --git a/man/wsrep_sst_xtrabackup-v2.1 b/man/wsrep_sst_xtrabackup-v2.1
deleted file mode 100644
index 3f95e3eef0d..00000000000
--- a/man/wsrep_sst_xtrabackup-v2.1
+++ /dev/null
@@ -1,16 +0,0 @@
-'\" t
-.\"
-.TH "\FBWSREP_SST_XTRABACKUP-V2\FR" "1" "9 May 2017" "MariaDB 10\&.3" "MariaDB Database System"
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.SH NAME
-wsrep_sst_xtrabackup-v2 \- xtrabackup\-based state snapshot transfer
-.SH DESCRIPTION
-Use: xtrabackup-based state snapshot transfer\.
-.PP
-For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/wsrep_sst_xtrabackup.1 b/man/wsrep_sst_xtrabackup.1
deleted file mode 100644
index c171a7cf954..00000000000
--- a/man/wsrep_sst_xtrabackup.1
+++ /dev/null
@@ -1,16 +0,0 @@
-'\" t
-.\"
-.TH "\FBWSREP_SST_XTRABACKUP\FR" "1" "9 May 2017" "MariaDB 10\&.3" "MariaDB Database System"
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.SH NAME
-wsrep_sst_xtrabackup \- xtrabackup\-based state snapshot transfer
-.SH DESCRIPTION
-Use: xtrabackup-based state snapshot transfer\.
-.PP
-For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/mysql-test/include/add_anonymous_users.inc b/mysql-test/include/add_anonymous_users.inc
index 635a80e3dee..86ce529d1e2 100644
--- a/mysql-test/include/add_anonymous_users.inc
+++ b/mysql-test/include/add_anonymous_users.inc
@@ -1,7 +1,7 @@
# Allow anonymous users to connect
disable_warnings;
disable_query_log;
-INSERT IGNORE INTO mysql.user (host, user) VALUES ('localhost','');
+INSERT IGNORE INTO mysql.global_priv (host, user) VALUES ('localhost','');
FLUSH PRIVILEGES;
enable_query_log;
enable_warnings;
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test
index a9c8e13fa7c..39aa3d49d68 100644
--- a/mysql-test/include/check-testcase.test
+++ b/mysql-test/include/check-testcase.test
@@ -103,5 +103,56 @@ cat_file $datadir.tempfiles.txt;
remove_file $datadir.tempfiles.txt;
list_files $datadir/mysql #sql*;
+#
+# Check that SHOW ENGINE INNODB STATUS does not show any active transactions
+# We do this only if wsrep provider is loaded, to avoid disturbing any non-Galera MTR tests
+#
+if (`SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsrep' AND PLUGIN_STATUS='ACTIVE'`) {
+ if (`SELECT @@wsrep_on`) {
+ if (`SELECT COUNT(*) FROM information_schema.innodb_trx WHERE trx_mysql_thread_id != 0`) {
+ if ($before) {
+ --echo Before test start.
+ }
+ if (!$before) {
+ --echo After test end.
+ }
+ --echo There is one or more active InnoDB transaction(s) when there should be none. Dumping some diagnostics.
+
+ --let $status_locks = `SELECT @@innodb_status_output_locks`
+ --let $status_output = `SELECT @@innodb_status_output`
+ --enable_query_log
+ SET GLOBAL innodb_status_output_locks=ON;
+ SHOW ENGINE INNODB STATUS;
+ --disable_query_log
+ --eval SET GLOBAL innodb_status_output_locks=$status_locks;
+ --eval SET GLOBAL innodb_status_output=$status_output;
+ --enable_query_log
+
+ --vertical_results
+ if ($before) {
+ --replace_regex /$/ /
+ }
+ SELECT * FROM information_schema.processlist;
+
+ if ($before) {
+ --replace_regex /$/ /
+ }
+ SELECT * FROM information_schema.innodb_trx;
+
+ if ($before) {
+ --replace_regex /$/ /
+ }
+ SELECT * FROM information_schema.innodb_locks;
+
+ if ($before) {
+ --replace_regex /$/ /
+ }
+ SELECT * FROM information_schema.innodb_lock_waits;
+ --horizontal_results
+ --disable_query_log
+ }
+ }
+}
+
--enable_query_log
diff --git a/mysql-test/include/check_ftwrl_incompatible.inc b/mysql-test/include/check_ftwrl_incompatible.inc
index 4787a69ea9c..a7e87c3750b 100644
--- a/mysql-test/include/check_ftwrl_incompatible.inc
+++ b/mysql-test/include/check_ftwrl_incompatible.inc
@@ -68,8 +68,7 @@ connection $con_aux1;
--enable_query_log
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where (state = "Waiting for global read lock" or
- state = "Waiting for commit lock") and
+ where state = "Waiting for backup lock" and
info = "$statement";
--source include/wait_condition.inc
--disable_result_log
@@ -116,8 +115,7 @@ connection $con_aux2;
--enable_query_log
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where (state = "Waiting for global read lock" or
- state = "Waiting for commit lock") and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
--disable_result_log
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 69a2b58288b..edae06ee7be 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -107,6 +107,7 @@ loose-performance-schema-consumer-thread-instrumentation=ON
binlog-direct-non-transactional-updates
default-storage-engine=myisam
+use_stat_tables=preferably
loose-ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
loose-ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
diff --git a/mysql-test/include/galera_cluster.inc b/mysql-test/include/galera_cluster.inc
index c1834c3c26f..7f76ea59c7f 100644
--- a/mysql-test/include/galera_cluster.inc
+++ b/mysql-test/include/galera_cluster.inc
@@ -8,5 +8,11 @@
--let $galera_cluster_size = 2
--source include/galera_init.inc
+--source include/have_innodb.inc
+--source include/galera_wait_ready.inc
+--connection node_2
+--source include/galera_wait_ready.inc
--source include/have_innodb.inc
+
+--connection node_1
diff --git a/mysql-test/suite/galera/include/galera_have_debug_sync.inc b/mysql-test/include/galera_have_debug_sync.inc
index 7c0156052d8..7c0156052d8 100644
--- a/mysql-test/suite/galera/include/galera_have_debug_sync.inc
+++ b/mysql-test/include/galera_have_debug_sync.inc
diff --git a/mysql-test/include/galera_wait_sync_point.inc b/mysql-test/include/galera_wait_sync_point.inc
index cf3a4980186..c0951b220b4 100644
--- a/mysql-test/include/galera_wait_sync_point.inc
+++ b/mysql-test/include/galera_wait_sync_point.inc
@@ -1,6 +1,17 @@
--let $wait_timeout = 10
--let $wsrep_on_orig = `SELECT @@wsrep_on`
SET SESSION wsrep_on = 0;
+
+#
+# following is only for debugging purposes
+# should be commented out when test wporks as planned
+#
+#--sleep 1
+# SHOW PROCESSLIST;
+#SHOW STATUS LIKE 'wsrep_%';
+#--echo $galera_sync_point
+
--let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters' AND VARIABLE_VALUE = '$galera_sync_point'
--source include/wait_condition.inc
--eval SET SESSION wsrep_on = $wsrep_on_orig
+
diff --git a/mysql-test/include/have_aria_used_for_temp_tables.inc b/mysql-test/include/have_aria_used_for_temp_tables.inc
new file mode 100644
index 00000000000..c921ba91d22
--- /dev/null
+++ b/mysql-test/include/have_aria_used_for_temp_tables.inc
@@ -0,0 +1,4 @@
+if (!`SELECT @@aria_used_for_temp_tables`)
+{
+ skip Need Aria to be used for temporary tables;
+}
diff --git a/mysql-test/include/have_auth_named_pipe.inc b/mysql-test/include/have_auth_named_pipe.inc
new file mode 100644
index 00000000000..4f4bf37f11e
--- /dev/null
+++ b/mysql-test/include/have_auth_named_pipe.inc
@@ -0,0 +1,13 @@
+--source include/not_embedded.inc
+
+if (!$AUTH_NAMED_PIPE_SO) {
+ skip No auth_named_pipe plugin;
+}
+
+if (!$USERNAME) {
+ skip USER variable is undefined;
+}
+
+if (`SELECT count(*) <> 0 FROM mysql.user WHERE user = '$USERNAME'`) {
+ skip %USERNAME%=$USER which exists in mysql.user;
+}
diff --git a/mysql-test/include/have_openssl.inc b/mysql-test/include/have_openssl.inc
index c9260123f9d..ee51ee4527a 100644
--- a/mysql-test/include/have_openssl.inc
+++ b/mysql-test/include/have_openssl.inc
@@ -1,7 +1,4 @@
--- source include/have_ssl_communication.inc
-let $crllen=`select length(trim(coalesce(@@ssl_crl, ''))) + length(trim(coalesce(@@ssl_crlpath, '')))`;
-if (!$crllen)
-{
+if (`SELECT count(*) = 0 FROM information_schema.GLOBAL_VARIABLES WHERE
+ VARIABLE_NAME = 'have_openssl' AND VARIABLE_VALUE = 'YES'`){
skip Needs OpenSSL;
}
-
diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc
index 9287369c87c..7eb8b4372cf 100644
--- a/mysql-test/include/have_wsrep_enabled.inc
+++ b/mysql-test/include/have_wsrep_enabled.inc
@@ -1,7 +1,6 @@
# To be used in a test which requires wsrep plugin to be ACTIVE and enabled
# (i.e. wsrep_on=ON). It includes have_wsrep.inc.
---source include/have_wsrep.inc
--source include/have_innodb.inc
if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_on' AND VARIABLE_VALUE='ON'`)
diff --git a/mysql-test/include/innodb_encrypt_tables.combinations b/mysql-test/include/innodb_encrypt_tables.combinations
new file mode 100644
index 00000000000..4ca9b672119
--- /dev/null
+++ b/mysql-test/include/innodb_encrypt_tables.combinations
@@ -0,0 +1,14 @@
+[crypt]
+innodb_encrypt_tables=ON
+plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+loose-file-key-management
+loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
+file-key-management-encryption-algorithm=aes_cbc
+
+[clear]
+innodb_encrypt_tables=OFF
+plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+loose-file-key-management
+loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
+file-key-management-encryption-algorithm=aes_cbc
+
diff --git a/mysql-test/include/innodb_encrypt_tables.inc b/mysql-test/include/innodb_encrypt_tables.inc
new file mode 100644
index 00000000000..31ab7999aef
--- /dev/null
+++ b/mysql-test/include/innodb_encrypt_tables.inc
@@ -0,0 +1,4 @@
+# The goal of including this file is to enable innodb_encrypt_tables combinations
+# (see include/innodb_encrypt_tables.combinations)
+
+--source include/have_innodb.inc
diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc
new file mode 100644
index 00000000000..d7f665df6c7
--- /dev/null
+++ b/mysql-test/include/kill_galera.inc
@@ -0,0 +1,20 @@
+--echo Killing server ...
+
+# Write file to make mysql-test-run.pl expect the crash, but don't start it
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--exec echo "wait" > $_expect_file_name
+
+# Kill the connected server
+--disable_reconnect
+--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
+
+--perl
+ my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
+ my $mysqld_pid = `cat $pid_filename`;
+ chomp($mysqld_pid);
+ system("kill -9 $mysqld_pid");
+ exit(0);
+EOF
+
+--source include/wait_until_disconnected.inc
diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql
index 8548200f437..b5673b2a313 100644
--- a/mysql-test/include/mtr_check.sql
+++ b/mysql-test/include/mtr_check.sql
@@ -95,7 +95,7 @@ BEGIN
mysql.time_zone_name,
mysql.time_zone_transition,
mysql.time_zone_transition_type,
- mysql.user;
+ mysql.global_priv;
-- verify that no plugin changed its disabled/enabled state
SELECT * FROM INFORMATION_SCHEMA.PLUGINS;
diff --git a/mysql-test/include/switch_to_mysql_global_priv.inc b/mysql-test/include/switch_to_mysql_global_priv.inc
new file mode 100644
index 00000000000..78df6642760
--- /dev/null
+++ b/mysql-test/include/switch_to_mysql_global_priv.inc
@@ -0,0 +1,6 @@
+disable_query_log;
+drop table mysql.user;
+rename table mysql.user_bak to mysql.user;
+rename table mysql.global_priv_bak to mysql.global_priv;
+flush privileges;
+enable_query_log;
diff --git a/mysql-test/include/switch_to_mysql_user.inc b/mysql-test/include/switch_to_mysql_user.inc
new file mode 100644
index 00000000000..f5801db6114
--- /dev/null
+++ b/mysql-test/include/switch_to_mysql_user.inc
@@ -0,0 +1,56 @@
+disable_query_log;
+rename table mysql.user to mysql.user_bak;
+CREATE TABLE mysql.user (
+ Host char(60) binary DEFAULT '' NOT NULL,
+ User char(80) binary DEFAULT '' NOT NULL,
+ Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL,
+ Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Delete_history_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ ssl_type enum('','ANY','X509','SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
+ ssl_cipher BLOB NOT NULL,
+ x509_issuer BLOB NOT NULL,
+ x509_subject BLOB NOT NULL,
+ max_questions int(11) unsigned DEFAULT 0 NOT NULL,
+ max_updates int(11) unsigned DEFAULT 0 NOT NULL,
+ max_connections int(11) unsigned DEFAULT 0 NOT NULL,
+ max_user_connections int(11) DEFAULT 0 NOT NULL,
+ plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
+ authentication_string TEXT NOT NULL,
+ password_expired ENUM('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ is_role enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ default_role char(80) binary DEFAULT '' NOT NULL,
+ max_statement_time decimal(12,6) DEFAULT 0 NOT NULL,
+ PRIMARY KEY Host (Host,User)
+) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+insert mysql.user select * from mysql.user_bak;
+rename table mysql.global_priv to mysql.global_priv_bak;
+flush privileges;
+enable_query_log;
diff --git a/mysql-test/include/system_db_struct.inc b/mysql-test/include/system_db_struct.inc
index 7dd7746459e..d043d209850 100644
--- a/mysql-test/include/system_db_struct.inc
+++ b/mysql-test/include/system_db_struct.inc
@@ -7,6 +7,7 @@ show tables;
show create table db;
show create table user;
show create table func;
+show create table global_priv;
show create table tables_priv;
show create table columns_priv;
show create table procs_priv;
diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc
index 26168d10558..15a1e5bf847 100644
--- a/mysql-test/include/wait_until_connected_again.inc
+++ b/mysql-test/include/wait_until_connected_again.inc
@@ -11,7 +11,7 @@ let $counter= 5000;
let $mysql_errno= 9999;
while ($mysql_errno)
{
- --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013
+ --error 0,ER_ACCESS_DENIED_ERROR,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013
show status;
dec $counter;
@@ -19,13 +19,18 @@ while ($mysql_errno)
{
--die Server failed to restart
}
+ if (!$mysql_errno)
+ {
+ # WSREP: SHOW STATUS queries are allowed even if wsrep
+ # is not ready. Make sure wsrep is ready before
+ # returning from this script
+ source include/wait_wsrep_ready.inc;
+ }
+ if ($mysql_errno == 1045)
+ {
+ let $mysql_errno=0;
+ }
--sleep 0.1
}
--enable_query_log
--enable_result_log
-
-# WSREP: SHOW STATUS queries are allowed even if wsrep
-# is not ready. Make sure wsrep is ready before
-# returning from this script
-
---source include/wait_wsrep_ready.inc
diff --git a/mysql-test/include/wsrep_wait_disconnect.inc b/mysql-test/include/wsrep_wait_disconnect.inc
new file mode 100644
index 00000000000..740fc0d9426
--- /dev/null
+++ b/mysql-test/include/wsrep_wait_disconnect.inc
@@ -0,0 +1,20 @@
+let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'OFF';
+# since this is called until AFTER provider disconnects,we need to allow
+# queries in non-prim
+#
+# We are also forced to use a hard-coded value for wsrep_sync_wait here because
+# we can not issue a SELECT query to obtain the original value and then restore
+# it
+disable_query_log;
+SET SESSION wsrep_sync_wait = 7;
+--let $restore_wsrep_on = `SHOW VARIABLES WHERE Variable_name = 'wsrep_on' AND Value = 'ON'`
+SET SESSION wsrep_on = OFF;
+
+--source include/wait_condition.inc
+
+if ($restore_wsrep_on != "")
+{
+ --eval SET SESSION wsrep_on = ON
+}
+SET SESSION wsrep_sync_wait = 15;
+enable_query_log;
diff --git a/mysql-test/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh
index 8f15ba9d521..0894be3a299 100755
--- a/mysql-test/lib/generate-ssl-certs.sh
+++ b/mysql-test/lib/generate-ssl-certs.sh
@@ -10,30 +10,49 @@ rm -rf demoCA
mkdir demoCA demoCA/newcerts
touch demoCA/index.txt
echo 01 > demoCA/serial
+echo 01 > demoCA/crlnumber
# CA certificate, self-signed
openssl req -x509 -newkey rsa:2048 -keyout cakey.pem -out cacert.pem -days 7300 -nodes -subj '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' -text
# server certificate signing request and private key. Note the very long subject (for MDEV-7859)
-openssl req -newkey rsa:1024 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name'
+openssl req -newkey rsa:2048 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name'
# convert the key to yassl compatible format
openssl rsa -in server-key.pem -out server-key.pem
# sign the server certificate with CA certificate
-openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -infiles demoCA/server-req.pem
+openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -in demoCA/server-req.pem
+# server certificate with different validity period (MDEV-7598)
+openssl req -newkey rsa:2048 -keyout server-new-key.pem -out demoCA/server-new-req.pem -days 7301 -nodes -subj '/CN=server-new/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl rsa -in server-new-key.pem -out server-new-key.pem
+openssl ca -keyfile cakey.pem -days 7301 -batch -cert cacert.pem -policy policy_anything -out server-new-cert.pem -in demoCA/server-new-req.pem
+
+# 8K cert
openssl req -newkey rsa:8192 -keyout server8k-key.pem -out demoCA/server8k-req.pem -days 7300 -nodes -subj '/CN=server8k/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
openssl rsa -in server8k-key.pem -out server8k-key.pem
-openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -infiles demoCA/server8k-req.pem
-
-openssl req -newkey rsa:1024 -keyout client-key.pem -out demoCA/client-req.pem -days 7300 -nodes -subj '/CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
-openssl rsa -in client-key.pem -out client-key.pem
-openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out client-cert.pem -infiles demoCA/client-req.pem
+openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -in demoCA/server8k-req.pem
# with SubjectAltName, only for OpenSSL 1.0.2+
cat > demoCA/sanext.conf <<EOF
subjectAltName=DNS:localhost
EOF
-openssl req -newkey rsa:1024 -keyout serversan-key.pem -out demoCA/serversan-req.pem -days 7300 -nodes -subj '/CN=server/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
-openssl ca -keyfile cakey.pem -extfile demoCA/sanext.conf -days 7300 -batch -cert cacert.pem -policy policy_anything -out serversan-cert.pem -infiles demoCA/serversan-req.pem
+openssl req -newkey rsa:2048 -keyout serversan-key.pem -out demoCA/serversan-req.pem -days 7300 -nodes -subj '/CN=server/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl ca -keyfile cakey.pem -extfile demoCA/sanext.conf -days 7300 -batch -cert cacert.pem -policy policy_anything -out serversan-cert.pem -in demoCA/serversan-req.pem
+
+# client cert
+openssl req -newkey rsa:2048 -keyout client-key.pem -out demoCA/client-req.pem -days 7300 -nodes -subj '/CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl rsa -in client-key.pem -out client-key.pem
+openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out client-cert.pem -in demoCA/client-req.pem
+
+# generate crls
+openssl ca -revoke server-cert.pem -keyfile cakey.pem -batch -cert cacert.pem
+openssl ca -gencrl -keyfile cakey.pem -crldays 7300 -batch -cert cacert.pem -out server-cert.crl
+# we only want to have one certificate per CRL. Un-revoke server-cert.crl
+cp demoCA/index.txt.old demoCA/index.txt
+openssl ca -revoke client-cert.pem -keyfile cakey.pem -batch -cert cacert.pem
+openssl ca -gencrl -keyfile cakey.pem -crldays 7300 -batch -cert cacert.pem -out client-cert.crl
+
+rm -fv crldir/*
+cp -v client-cert.crl crldir/`openssl x509 -in client-cert.pem -noout -issuer_hash`.r0
rm -rf demoCA
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 61ce88f9a5a..3fe57987713 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -291,6 +291,7 @@ sub combinations_from_file($$)
@combs = ({ skip => $skip_combinations{$filename} });
} else {
return () if @::opt_combinations or not -f $filename;
+ return () if ::using_extern();
# Read combinations file in my.cnf format
mtr_verbose("Read combinations file $filename");
my $config= My::Config->new($filename);
diff --git a/mysql-test/main/1st.result b/mysql-test/main/1st.result
index 2d49726c5f6..c630be1d61c 100644
--- a/mysql-test/main/1st.result
+++ b/mysql-test/main/1st.result
@@ -13,6 +13,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index 49c42479516..92946b65e66 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -181,6 +181,7 @@ t1 0 a 2 b A 300 NULL NULL YES BTREE
t1 1 b 1 b A 100 NULL NULL YES BTREE
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -751,12 +752,12 @@ create table t1(f1 int);
alter table t1 add column f2 datetime not null, add column f21 date not null;
insert into t1 values(1,'2000-01-01','2000-01-01');
alter table t1 add column f3 datetime not null;
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'f3' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`f3` at row 1
alter table t1 add column f3 date not null;
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'f3' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`f3` at row 1
alter table t1 add column f4 datetime not null default '2002-02-02',
add column f41 date not null;
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'f41' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`f41` at row 1
alter table t1 add column f4 datetime not null default '2002-02-02',
add column f41 date not null default '2002-02-02';
select * from t1;
@@ -2469,3 +2470,24 @@ DROP TABLE t1;
#
# End of 10.2 tests
#
+#
+# MDEV-17778: Alter table leads to a truncation warning with ANALYZE command
+#
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @@use_stat_tables=PREFERABLY;
+create table t1 (a int)engine=InnoDB;
+insert into t1 values (1),(1),(2),(3);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+alter table t1 change a b int;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1;
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
index dfa8e2e148b..829f4013cb3 100644
--- a/mysql-test/main/alter_table.test
+++ b/mysql-test/main/alter_table.test
@@ -2021,3 +2021,22 @@ DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # MDEV-17778: Alter table leads to a truncation warning with ANALYZE command
+--echo #
+
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @@use_stat_tables=PREFERABLY;
+
+create table t1 (a int)engine=InnoDB;
+insert into t1 values (1),(1),(2),(3);
+
+analyze table t1;
+alter table t1 change a b int;
+analyze table t1;
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1;
diff --git a/mysql-test/main/alter_table_errors.result b/mysql-test/main/alter_table_errors.result
index 020a30304d0..b26409e3d05 100644
--- a/mysql-test/main/alter_table_errors.result
+++ b/mysql-test/main/alter_table_errors.result
@@ -8,3 +8,22 @@ t CREATE TABLE `t` (
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t;
+create temporary table t1 (a int, v int as (a));
+alter table t1 change column a b int, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create temporary table t2 (a int, v int as (a));
+lock table t2 write;
+alter table t2 change column a b int, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
+show create table t2;
+Table Create Table
+t2 CREATE TEMPORARY TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
diff --git a/mysql-test/main/alter_table_errors.test b/mysql-test/main/alter_table_errors.test
index d9982ac26f4..8fa65b0f330 100644
--- a/mysql-test/main/alter_table_errors.test
+++ b/mysql-test/main/alter_table_errors.test
@@ -8,3 +8,14 @@ create table t (a int, v int as (a)) engine=innodb;
alter table t change column a b tinyint, algorithm=inplace;
show create table t;
drop table t;
+
+create temporary table t1 (a int, v int as (a));
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t1 change column a b int, algorithm=inplace;
+show create table t1;
+
+create temporary table t2 (a int, v int as (a));
+lock table t2 write;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t2 change column a b int, algorithm=inplace;
+show create table t2;
diff --git a/mysql-test/main/alter_user.result b/mysql-test/main/alter_user.result
index 68720b6d6c7..cc3c4a43ffe 100644
--- a/mysql-test/main/alter_user.result
+++ b/mysql-test/main/alter_user.result
@@ -1,3 +1,4 @@
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
select * from mysql.user where user = 'root' and host = 'localhost';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000
@@ -51,15 +52,15 @@ Note 1396 Operation ALTER USER failed for 'boo'
alter user foo identified by 'something';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
alter user foo identified by 'something2';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *9CD58369E930E28C8996A89DB18B63294E6DC10C N N 0.000000
+% foo *9CD58369E930E28C8996A89DB18B63294E6DC10C N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *9CD58369E930E28C8996A89DB18B63294E6DC10C N N 0.000000
alter user foo identified by password '*88C89BE093D4ECF72D039F62EBB7477EA1FD4D63';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
alter user foo identified with 'somecoolplugin';
ERROR HY000: Operation ALTER USER failed for 'foo'@'%'
show warnings;
@@ -73,21 +74,21 @@ Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv D
alter user foo identified with 'mysql_old_password' using '0123456789ABCDEF';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_old_password 0123456789ABCDEF N N 0.000000
+% foo 0123456789ABCDEF N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_old_password 0123456789ABCDEF N N 0.000000
# Test ssl related altering.
alter user foo identified by 'something' require SSL;
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N ANY 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N ANY 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
alter user foo identified by 'something' require X509;
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N X509 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N X509 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
alter user foo identified by 'something'
require cipher 'text' issuer 'foo_issuer' subject 'foo_subject';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
# Test resource limits altering.
alter user foo with MAX_QUERIES_PER_HOUR 10
MAX_UPDATES_PER_HOUR 20
@@ -95,6 +96,6 @@ MAX_CONNECTIONS_PER_HOUR 30
MAX_USER_CONNECTIONS 40;
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000
drop user foo;
-update mysql.user set plugin='';
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test
index ef20f79a554..9ea98615272 100644
--- a/mysql-test/main/alter_user.test
+++ b/mysql-test/main/alter_user.test
@@ -1,5 +1,7 @@
--source include/not_embedded.inc
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
+
select * from mysql.user where user = 'root' and host = 'localhost';
--echo # Test syntax
--echo #
@@ -82,4 +84,4 @@ alter user foo with MAX_QUERIES_PER_HOUR 10
select * from mysql.user where user = 'foo';
drop user foo;
-update mysql.user set plugin='';
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
diff --git a/mysql-test/main/analyze.result b/mysql-test/main/analyze.result
index 9dff94ab08c..dd785abcd42 100644
--- a/mysql-test/main/analyze.result
+++ b/mysql-test/main/analyze.result
@@ -3,6 +3,7 @@ lock tables t1 write;
insert into t1 values(0);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
unlock tables;
check table t1;
@@ -15,6 +16,7 @@ lock tables t1 write;
delete from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
unlock tables;
check table t1;
@@ -25,6 +27,7 @@ create table t1 (a bigint);
insert into t1 values(0);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
check table t1;
Table Op Msg_type Msg_text
@@ -34,9 +37,13 @@ create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_g
insert into t1 values ('hello');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
test.t1 analyze status OK
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
test.t1 analyze status Table is already up to date
drop table t1;
CREATE TABLE t1 (a int);
diff --git a/mysql-test/main/auth_rpl.result b/mysql-test/main/auth_rpl.result
index a3da7985da1..56f5f5e8f2b 100644
--- a/mysql-test/main/auth_rpl.result
+++ b/mysql-test/main/auth_rpl.result
@@ -15,7 +15,7 @@ connection master;
connection slave;
# Slave in-sync with master now.
SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user';
-user plugin authentication_string
+User plugin authentication_string
plug_user test_plugin_server plug_user
# Cleanup (on slave).
include/stop_slave.inc
diff --git a/mysql-test/main/backup_aria.result b/mysql-test/main/backup_aria.result
new file mode 100644
index 00000000000..d537711404f
--- /dev/null
+++ b/mysql-test/main/backup_aria.result
@@ -0,0 +1,158 @@
+connect con1,localhost,root,,;
+SET SESSION lock_wait_timeout = 1;
+#-----------------------------------------------------------------------
+# Single-threaded tests
+#-----------------------------------------------------------------------
+# Show the fate and impact of some SELECT /HANDLER ... READ
+# sliding through the sequence.
+CREATE TABLE t_permanent_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+INSERT INTO t_permanent_aria SET col1 = 1;
+BACKUP STAGE START;
+SELECT COUNT(*) FROM t_permanent_aria;
+COUNT(*)
+1
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+col1
+1
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE FLUSH;
+SELECT COUNT(*) FROM t_permanent_aria;
+COUNT(*)
+1
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+col1
+1
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE BLOCK_DDL;
+SELECT COUNT(*) FROM t_permanent_aria;
+COUNT(*)
+1
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+col1
+1
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE BLOCK_COMMIT;
+SELECT COUNT(*) FROM t_permanent_aria;
+COUNT(*)
+1
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+col1
+1
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE END;
+# In case the backup lock is taken by the current connection than
+# - DML modifying some permanent table is not allowed
+BACKUP STAGE START;
+SET AUTOCOMMIT = 0;
+INSERT INTO t_permanent_aria SET col1 = 1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+SET AUTOCOMMIT = 1;
+INSERT INTO t_permanent_aria SET col1 = 1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+# - DDL creating or renaming a permanent table or a procedure is not
+# allowed.
+# The latter tries to modify a permanent system table.
+CREATE TABLE throw_away (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+RENAME TABLE t_permanent_aria To throw_away;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+# - DDL creating a temporary table is allowed.
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+# - DML modifying that temporary table is allowed.
+INSERT INTO t_temporary_aria SET col1 = 1;
+SELECT COUNT(*) FROM t_temporary_aria;
+COUNT(*)
+1
+BACKUP STAGE END;
+# Show the fate and impact of some auto committed INSERT into temporary
+# table sliding through the sequence.
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE FLUSH;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE BLOCK_DDL;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE BLOCK_COMMIT;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE END;
+SELECT COUNT(*) FROM t_temporary_aria;
+COUNT(*)
+5
+# Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding
+# through the sequence.
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE FLUSH;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE BLOCK_DDL;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE BLOCK_COMMIT;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE END;
+# Show that even more DDL on the temporary table is allowed.
+BACKUP STAGE START;
+TRUNCATE t_temporary_aria;
+ALTER TABLE t_temporary_aria ADD COLUMN col2 INT;
+ALTER TABLE t_temporary_aria ADD KEY idx(col2);
+BACKUP STAGE END;
+DROP TABLE t_permanent_aria;
+#-----------------------------------------------------------------------
+# Show that non transactional tables locks with BACKUP STAGE FLUSH
+#-----------------------------------------------------------------------
+set session lock_wait_timeout=default;
+create table t1 (a int) engine=aria transactional=0;
+insert into t1 values (1), (2);
+connection con1;
+backup stage start;
+backup stage flush;
+connection default;
+select * from t1;
+a
+1
+2
+SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (3);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+INSERT INTO t1 values (4);
+connection con1;
+backup stage end;
+connection default;
+select * from t1;
+a
+1
+2
+4
+drop table t1;
+#-----------------------------------------------------------------------
+# Show that transactional tables doesn't lock with BACKUP STAGE FLUSH
+#-----------------------------------------------------------------------
+set session lock_wait_timeout=default;
+create table t1 (a int) engine=aria transactional=1 page_checksum=1;
+insert into t1 values (1), (2);
+connection con1;
+backup stage start;
+backup stage flush;
+connection default;
+INSERT INTO t1 values (4);
+connection con1;
+backup stage end;
+connection default;
+select * from t1;
+a
+1
+2
+4
+drop table t1;
+#
+# Cleanup
+#
+disconnect con1;
diff --git a/mysql-test/main/backup_aria.test b/mysql-test/main/backup_aria.test
new file mode 100644
index 00000000000..7b741b829a1
--- /dev/null
+++ b/mysql-test/main/backup_aria.test
@@ -0,0 +1,157 @@
+########################################################################
+# Tests for Implement LOCK FOR BACKUP (MDEV-5336)
+########################################################################
+# Check a non transactional table per ENGINE = Aria TRANSACTIONAL = 0.
+#
+
+--source include/not_embedded.inc
+# As non transactional engine we use Aria with TRANSACTIONAL = 0
+--source include/have_aria.inc
+
+# Following connections are used in a few of the following tests
+connect (con1,localhost,root,,);
+
+SET SESSION lock_wait_timeout = 1;
+
+--echo #-----------------------------------------------------------------------
+--echo # Single-threaded tests
+--echo #-----------------------------------------------------------------------
+
+--echo # Show the fate and impact of some SELECT /HANDLER ... READ
+--echo # sliding through the sequence.
+CREATE TABLE t_permanent_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+INSERT INTO t_permanent_aria SET col1 = 1;
+BACKUP STAGE START;
+SELECT COUNT(*) FROM t_permanent_aria;
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE FLUSH;
+SELECT COUNT(*) FROM t_permanent_aria;
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE BLOCK_DDL;
+SELECT COUNT(*) FROM t_permanent_aria;
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE BLOCK_COMMIT;
+SELECT COUNT(*) FROM t_permanent_aria;
+HANDLER t_permanent_aria OPEN;
+HANDLER t_permanent_aria READ FIRST;
+HANDLER t_permanent_aria CLOSE;
+BACKUP STAGE END;
+
+--echo # In case the backup lock is taken by the current connection than
+--echo # - DML modifying some permanent table is not allowed
+BACKUP STAGE START;
+SET AUTOCOMMIT = 0;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+INSERT INTO t_permanent_aria SET col1 = 1;
+SET AUTOCOMMIT = 1;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+INSERT INTO t_permanent_aria SET col1 = 1;
+
+--echo # - DDL creating or renaming a permanent table or a procedure is not
+--echo # allowed.
+--echo # The latter tries to modify a permanent system table.
+
+--error ER_BACKUP_LOCK_IS_ACTIVE
+CREATE TABLE throw_away (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+RENAME TABLE t_permanent_aria To throw_away;
+--echo # - DDL creating a temporary table is allowed.
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+--echo # - DML modifying that temporary table is allowed.
+INSERT INTO t_temporary_aria SET col1 = 1;
+SELECT COUNT(*) FROM t_temporary_aria;
+BACKUP STAGE END;
+
+--echo # Show the fate and impact of some auto committed INSERT into temporary
+--echo # table sliding through the sequence.
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE FLUSH;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE BLOCK_DDL;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE BLOCK_COMMIT;
+INSERT INTO t_temporary_aria SET col1 = 1;
+BACKUP STAGE END;
+SELECT COUNT(*) FROM t_temporary_aria;
+
+--echo # Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding
+--echo # through the sequence.
+
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE FLUSH;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE BLOCK_DDL;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE BLOCK_COMMIT;
+DROP TEMPORARY TABLE t_temporary_aria;
+CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0;
+BACKUP STAGE END;
+--echo # Show that even more DDL on the temporary table is allowed.
+BACKUP STAGE START;
+TRUNCATE t_temporary_aria;
+ALTER TABLE t_temporary_aria ADD COLUMN col2 INT;
+ALTER TABLE t_temporary_aria ADD KEY idx(col2);
+BACKUP STAGE END;
+
+DROP TABLE t_permanent_aria;
+
+--echo #-----------------------------------------------------------------------
+--echo # Show that non transactional tables locks with BACKUP STAGE FLUSH
+--echo #-----------------------------------------------------------------------
+
+set session lock_wait_timeout=default;
+create table t1 (a int) engine=aria transactional=0;
+insert into t1 values (1), (2);
+
+connection con1;
+backup stage start;
+backup stage flush;
+connection default;
+select * from t1;
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (3);
+--send INSERT INTO t1 values (4)
+connection con1;
+backup stage end;
+connection default;
+--reap # send
+select * from t1;
+drop table t1;
+
+--echo #-----------------------------------------------------------------------
+--echo # Show that transactional tables doesn't lock with BACKUP STAGE FLUSH
+--echo #-----------------------------------------------------------------------
+
+set session lock_wait_timeout=default;
+create table t1 (a int) engine=aria transactional=1 page_checksum=1;
+insert into t1 values (1), (2);
+
+connection con1;
+backup stage start;
+backup stage flush;
+connection default;
+INSERT INTO t1 values (4);
+connection con1;
+backup stage end;
+connection default;
+select * from t1;
+drop table t1;
+
+--echo #
+--echo # Cleanup
+--echo #
+
+disconnect con1;
diff --git a/mysql-test/main/backup_interaction.result b/mysql-test/main/backup_interaction.result
new file mode 100644
index 00000000000..20ba8fa0811
--- /dev/null
+++ b/mysql-test/main/backup_interaction.result
@@ -0,0 +1,520 @@
+#
+# Check backup and FTWRL
+#
+flush tables with read lock;
+backup stage start;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+backup stage start;
+flush tables with read lock;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+backup stage end;
+#
+# Check backup and FLUSH TABLES
+#
+flush tables;
+backup stage start;
+flush tables;
+backup stage end;
+#
+# Check BACKUP STAGE under lock tables
+#
+create table t1 (a int);
+lock table t1 write;
+backup stage start;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+backup stage end;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+unlock tables;
+lock table t1 read;
+backup stage start;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+backup stage end;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+unlock tables;
+#
+# Check lock tables under BACKUP STAGE
+#
+backup stage start;
+unlock tables;
+select lock_mode from information_schema.metadata_lock_info;
+lock_mode
+MDL_BACKUP_START
+lock table t1 write;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+lock table t1 read;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+unlock tables;
+backup stage end;
+drop table t1;
+#
+# Check setting readonly under BACKUP STAGE
+#
+backup stage start;
+set @@global.read_only=1;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+backup stage end;
+# also make sure going back from read-only mode is not allowed
+set @@global.read_only=1;
+backup stage start;
+set @@global.read_only=0;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+backup stage end;
+set @@global.read_only=0;
+#
+# Check BACKUP STAGE under read_only
+#
+set @@global.read_only=1;
+backup stage start;
+backup stage end;
+set @@global.read_only=0;
+#
+# Check that we can't create tables during backup
+#
+backup stage start;
+create table t1 (a int);
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+backup stage end;
+# also make sure we can't write to a table during backup
+create table t1(a INT);
+backup stage start;
+insert into t1 values(1);
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+insert delayed into t1 values(1);
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+update t1 set a=1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+delete from t1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+truncate table t1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+drop table t1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+backup stage end;
+drop table t1;
+#
+# BACKUP STAGE performs implicit commits
+#
+create table t1(a int) engine=InnoDB;
+begin;
+insert into t1 values(1);
+select lock_mode from information_schema.metadata_lock_info;
+lock_mode
+MDL_SHARED_WRITE
+backup stage start;
+select lock_mode from information_schema.metadata_lock_info;
+lock_mode
+MDL_BACKUP_START
+backup stage block_commit;
+commit;
+backup stage end;
+drop table t1;
+# Ensure that BACKUP STAGE ... does AUTOCOMMIT like most DDL.
+# Sideeffect:
+# Show the impact of not yet committed INSERT before sequence start
+# and ROLLBACK sliding through the sequence.
+CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+ROLLBACK;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+ROLLBACK;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+ROLLBACK;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+ROLLBACK;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+ROLLBACK;
+SELECT COUNT(*) = 5 AS expect_1 FROM t1;
+expect_1
+1
+# Show the impact of not yet committed INSERT before sequence start
+# and a COMMIT sliding through the sequence.
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+COMMIT;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+COMMIT;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+COMMIT;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+COMMIT;
+BACKUP STAGE END;
+#----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+COMMIT;
+SELECT COUNT(*) = 10 AS expect_1 FROM t1;
+expect_1
+1
+DELETE FROM t1;
+COMMIT;
+drop table t1;
+#
+# CHECK: RO transaction under BACKUP STAGE is a potential deadlock
+# OTOH we most probably allow them under FTWRL as well
+#
+CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
+insert into t1 values (1);
+backup stage start;
+backup stage block_commit;
+begin;
+select * from t1;
+col1
+1
+select lock_mode from information_schema.metadata_lock_info;
+lock_mode
+MDL_BACKUP_WAIT_COMMIT
+MDL_SHARED_READ
+backup stage end;
+select lock_mode from information_schema.metadata_lock_info;
+lock_mode
+drop table t1;
+#
+# Check that handler are closed by backup stage block_ddl
+#
+create table t1 (a int, key a (a));
+insert into t1 (a) values (1), (2), (3), (4), (5);
+handler t1 open;
+handler t1 read a prev;
+a
+5
+backup stage start;
+handler t1 read a prev;
+a
+4
+backup stage flush;
+backup stage block_ddl;
+handler t1 read a prev;
+a
+5
+backup stage block_commit;
+handler t1 read a prev;
+a
+4
+backup stage end;
+handler t1 close;
+drop table t1;
+# Show the fate and impact of some SELECT /HANDLER ... READ
+# sliding through the sequence.
+CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB;
+INSERT INTO t1_innodb values (1),(2),(3);
+COMMIT;
+CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM;
+INSERT INTO t1_myisam values (1),(2),(3);
+BACKUP STAGE START;
+SELECT COUNT(*) FROM t1_innodb;
+COUNT(*)
+3
+SELECT * FROM t1_innodb;
+col1
+1
+2
+3
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+col1
+1
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+COUNT(*)
+3
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+col1
+1
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE FLUSH;
+SELECT COUNT(*) FROM t1_innodb;
+COUNT(*)
+3
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+col1
+1
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+COUNT(*)
+3
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+col1
+1
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE BLOCK_DDL;
+SELECT COUNT(*) FROM t1_innodb;
+COUNT(*)
+3
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+col1
+1
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+COUNT(*)
+3
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+col1
+1
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE BLOCK_COMMIT;
+SELECT COUNT(*) FROM t1_innodb;
+COUNT(*)
+3
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+col1
+1
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+COUNT(*)
+3
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+col1
+1
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE END;
+drop table t1_innodb,t1_myisam;
+# Show the fate and impact of some SET GLOBAL tx_read_only = 1/0
+# sliding through the sequence.
+BACKUP STAGE START;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE FLUSH;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE BLOCK_DDL;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE BLOCK_COMMIT;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE END;
+# Show the fate and impact of some SET SESSION sql_log_bin = 0/1
+# sliding through the sequence.
+COMMIT;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE START;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE FLUSH;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE BLOCK_DDL;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE BLOCK_COMMIT;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE END;
+#----
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE START;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE FLUSH;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE BLOCK_DDL;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE BLOCK_COMMIT;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE END;
+SET SESSION sql_log_bin = 1;
+#-----------------------------------------------------------------------
+# BACKUP STAGE statements are not allowed in stored routines
+#-----------------------------------------------------------------------
+CREATE TABLE t1 (col1 INT);
+CREATE PROCEDURE p1()
+BEGIN
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+END|
+ERROR 0A000: BACKUP STAGE is not allowed in stored procedures
+CREATE FUNCTION f1 (s CHAR(20)) RETURNS INT DETERMINISTIC
+BEGIN
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+RETURN 1;
+END|
+ERROR 0A000: BACKUP STAGE is not allowed in stored procedures
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+END|
+ERROR 0A000: BACKUP STAGE is not allowed in stored procedures
+DROP TABLE t1;
+#-----------------------------------------------------------------------
+# Check BACKUP status variables
+#-----------------------------------------------------------------------
+SET SESSION lock_wait_timeout = 1;
+FLUSH STATUS;
+# Show how the status variable 'Com_backup' changes after BACKUP STAGE ..
+SHOW STATUS LIKE 'Com_backup';
+Variable_name Value
+Com_backup 0
+BACKUP STAGE START;
+SHOW STATUS LIKE 'Com_backup';
+Variable_name Value
+Com_backup 1
+BACKUP STAGE START;
+ERROR HY000: Backup stage 'START' is same or before current backup stage 'START'
+SHOW STATUS LIKE 'Com_backup';
+Variable_name Value
+Com_backup 2
+BACKUP STAGE FLUSH;
+SHOW STATUS LIKE 'Com_backup';
+Variable_name Value
+Com_backup 3
+BACKUP STAGE BLOCK_DDL;
+SHOW STATUS LIKE 'Com_backup';
+Variable_name Value
+Com_backup 4
+BACKUP STAGE BLOCK_COMMIT;
+SHOW STATUS LIKE 'Com_backup';
+Variable_name Value
+Com_backup 5
+BACKUP STAGE END;
+# In case the backup lock is taken by the current connection than
+# - DML modifying some permanent table is not allowed
+CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM;
+BACKUP STAGE START;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1_innodb SET col1 = 1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+SET AUTOCOMMIT = 1;
+INSERT INTO t1_innodb SET col1 = 1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+INSERT INTO t1_myisam SET col1 = 1;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+# - DDL creating or renaming a permanent table or a procedure etc.
+# is not allowed.
+CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+RENAME TABLE t1_innodb To throw_away;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+CREATE PROCEDURE p1() SELECT 13;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+CREATE PROCEDURE p1() SELECT 13;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+BACKUP STAGE END;
+DROP TABLE t1_innodb;
+DROP TABLE t1_myisam;
+#
+# Creating and modifying TEMPORARY TABLES are allowed
+#
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+CREATE TEMPORARY TABLE tmp (col1 INT);
+DROP TEMPORARY TABLE tmp;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TEMPORARY TABLE t_temporary_myisam (col1 INT) ENGINE = MyISAM;
+# - DML modifying that temporary table is allowed.
+INSERT INTO t_temporary_innodb SET col1 = 1;
+SELECT COUNT(*) FROM t_temporary_innodb;
+COUNT(*)
+1
+INSERT INTO t_temporary_myisam SET col1 = 1;
+SELECT COUNT(*) FROM t_temporary_myisam;
+COUNT(*)
+1
+BACKUP STAGE END;
+# Show the fate and impact of some auto committed INSERT into temporary
+# table sliding through the sequence.
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE FLUSH;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE BLOCK_DDL;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE BLOCK_COMMIT;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE END;
+SELECT COUNT(*) FROM t_temporary_innodb;
+COUNT(*)
+5
+# Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding
+# through the sequence.
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE FLUSH;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE BLOCK_DDL;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE BLOCK_COMMIT;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE END;
+# Show that even more DDL on the temporary table is allowed.
+BACKUP STAGE START;
+TRUNCATE t_temporary_innodb;
+ALTER TABLE t_temporary_innodb ADD COLUMN col2 INT;
+ALTER TABLE t_temporary_innodb ADD KEY idx(col2);
+BACKUP STAGE END;
diff --git a/mysql-test/main/backup_interaction.test b/mysql-test/main/backup_interaction.test
new file mode 100644
index 00000000000..f5362417c98
--- /dev/null
+++ b/mysql-test/main/backup_interaction.test
@@ -0,0 +1,503 @@
+########################################################################
+# Tests how BACKUP STAGE interacts with other commands (MDEV-5336)
+########################################################################
+
+--source include/have_innodb.inc
+--source include/have_metadata_lock_info.inc
+
+--echo #
+--echo # Check backup and FTWRL
+--echo #
+
+flush tables with read lock;
+--error ER_CANT_UPDATE_WITH_READLOCK
+backup stage start;
+unlock tables;
+backup stage start;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+flush tables with read lock;
+backup stage end;
+
+--echo #
+--echo # Check backup and FLUSH TABLES
+--echo #
+
+flush tables;
+backup stage start;
+flush tables;
+backup stage end;
+
+--echo #
+--echo # Check BACKUP STAGE under lock tables
+--echo #
+
+create table t1 (a int);
+lock table t1 write;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+backup stage start;
+--error ER_BACKUP_NOT_RUNNING
+backup stage end;
+unlock tables;
+
+lock table t1 read;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+backup stage start;
+--error ER_BACKUP_NOT_RUNNING
+backup stage end;
+unlock tables;
+
+
+--echo #
+--echo # Check lock tables under BACKUP STAGE
+--echo #
+backup stage start;
+unlock tables;
+select lock_mode from information_schema.metadata_lock_info;
+
+--error ER_BACKUP_LOCK_IS_ACTIVE
+lock table t1 write;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+lock table t1 read;
+unlock tables;
+backup stage end;
+drop table t1;
+
+
+--echo #
+--echo # Check setting readonly under BACKUP STAGE
+--echo #
+backup stage start;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+set @@global.read_only=1;
+backup stage end;
+
+--echo # also make sure going back from read-only mode is not allowed
+set @@global.read_only=1;
+backup stage start;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+set @@global.read_only=0;
+backup stage end;
+set @@global.read_only=0;
+
+--echo #
+--echo # Check BACKUP STAGE under read_only
+--echo #
+
+set @@global.read_only=1;
+backup stage start;
+backup stage end;
+set @@global.read_only=0;
+
+--echo #
+--echo # Check that we can't create tables during backup
+--echo #
+
+backup stage start;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+create table t1 (a int);
+backup stage end;
+
+--echo # also make sure we can't write to a table during backup
+create table t1(a INT);
+backup stage start;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+insert into t1 values(1);
+--error ER_BACKUP_LOCK_IS_ACTIVE
+insert delayed into t1 values(1);
+--error ER_BACKUP_LOCK_IS_ACTIVE
+update t1 set a=1;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+delete from t1;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+truncate table t1;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+drop table t1;
+backup stage end;
+drop table t1;
+
+--echo #
+--echo # BACKUP STAGE performs implicit commits
+--echo #
+create table t1(a int) engine=InnoDB;
+begin;
+insert into t1 values(1);
+select lock_mode from information_schema.metadata_lock_info;
+backup stage start;
+select lock_mode from information_schema.metadata_lock_info;
+backup stage block_commit;
+commit;
+backup stage end;
+drop table t1;
+
+--echo # Ensure that BACKUP STAGE ... does AUTOCOMMIT like most DDL.
+--echo # Sideeffect:
+--echo # Show the impact of not yet committed INSERT before sequence start
+--echo # and ROLLBACK sliding through the sequence.
+
+CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+ROLLBACK;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+ROLLBACK;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+ROLLBACK;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+ROLLBACK;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+ROLLBACK;
+SELECT COUNT(*) = 5 AS expect_1 FROM t1;
+
+--echo # Show the impact of not yet committed INSERT before sequence start
+--echo # and a COMMIT sliding through the sequence.
+
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+COMMIT;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+COMMIT;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+COMMIT;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+COMMIT;
+BACKUP STAGE END;
+--echo #----
+INSERT INTO t1 SET col1 = 1;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+COMMIT;
+SELECT COUNT(*) = 10 AS expect_1 FROM t1;
+DELETE FROM t1;
+COMMIT;
+drop table t1;
+
+--echo #
+--echo # CHECK: RO transaction under BACKUP STAGE is a potential deadlock
+--echo # OTOH we most probably allow them under FTWRL as well
+--echo #
+
+CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
+insert into t1 values (1);
+backup stage start;
+backup stage block_commit;
+begin;
+select * from t1;
+select lock_mode from information_schema.metadata_lock_info;
+backup stage end;
+select lock_mode from information_schema.metadata_lock_info;
+drop table t1;
+
+--echo #
+--echo # Check that handler are closed by backup stage block_ddl
+--echo #
+
+create table t1 (a int, key a (a));
+insert into t1 (a) values (1), (2), (3), (4), (5);
+handler t1 open;
+handler t1 read a prev;
+backup stage start;
+handler t1 read a prev;
+backup stage flush;
+backup stage block_ddl;
+handler t1 read a prev;
+backup stage block_commit;
+handler t1 read a prev;
+backup stage end;
+handler t1 close;
+drop table t1;
+
+--echo # Show the fate and impact of some SELECT /HANDLER ... READ
+--echo # sliding through the sequence.
+
+CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB;
+INSERT INTO t1_innodb values (1),(2),(3);
+COMMIT;
+CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM;
+INSERT INTO t1_myisam values (1),(2),(3);
+BACKUP STAGE START;
+SELECT COUNT(*) FROM t1_innodb;
+SELECT * FROM t1_innodb;
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE FLUSH;
+SELECT COUNT(*) FROM t1_innodb;
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE BLOCK_DDL;
+SELECT COUNT(*) FROM t1_innodb;
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE BLOCK_COMMIT;
+SELECT COUNT(*) FROM t1_innodb;
+HANDLER t1_innodb OPEN;
+HANDLER t1_innodb READ FIRST;
+HANDLER t1_innodb CLOSE;
+SELECT COUNT(*) FROM t1_myisam;
+HANDLER t1_myisam OPEN;
+HANDLER t1_myisam READ FIRST;
+HANDLER t1_myisam CLOSE;
+BACKUP STAGE END;
+drop table t1_innodb,t1_myisam;
+
+--echo # Show the fate and impact of some SET GLOBAL tx_read_only = 1/0
+--echo # sliding through the sequence.
+
+BACKUP STAGE START;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE FLUSH;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE BLOCK_DDL;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE BLOCK_COMMIT;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+BACKUP STAGE END;
+
+--echo # Show the fate and impact of some SET SESSION sql_log_bin = 0/1
+--echo # sliding through the sequence.
+COMMIT;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE START;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE FLUSH;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE BLOCK_DDL;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE BLOCK_COMMIT;
+SET SESSION sql_log_bin = 0;
+SET SESSION sql_log_bin = 1;
+BACKUP STAGE END;
+
+--echo #----
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE START;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE FLUSH;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE BLOCK_DDL;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE BLOCK_COMMIT;
+SET SESSION sql_log_bin = 1;
+SET SESSION sql_log_bin = 0;
+BACKUP STAGE END;
+SET SESSION sql_log_bin = 1;
+
+--echo #-----------------------------------------------------------------------
+--echo # BACKUP STAGE statements are not allowed in stored routines
+--echo #-----------------------------------------------------------------------
+
+CREATE TABLE t1 (col1 INT);
+
+delimiter |;
+--error ER_SP_BADSTATEMENT
+CREATE PROCEDURE p1()
+BEGIN
+ BACKUP STAGE START;
+ BACKUP STAGE FLUSH;
+ BACKUP STAGE BLOCK_DDL;
+ BACKUP STAGE BLOCK_COMMIT;
+ BACKUP STAGE END;
+END|
+
+--error ER_SP_BADSTATEMENT
+CREATE FUNCTION f1 (s CHAR(20)) RETURNS INT DETERMINISTIC
+BEGIN
+ BACKUP STAGE START;
+ BACKUP STAGE FLUSH;
+ BACKUP STAGE BLOCK_DDL;
+ BACKUP STAGE BLOCK_COMMIT;
+ BACKUP STAGE END;
+ RETURN 1;
+END|
+
+--error ER_SP_BADSTATEMENT
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+ BACKUP STAGE START;
+ BACKUP STAGE FLUSH;
+ BACKUP STAGE BLOCK_DDL;
+ BACKUP STAGE BLOCK_COMMIT;
+ BACKUP STAGE END;
+END|
+
+delimiter ;|
+DROP TABLE t1;
+
+--echo #-----------------------------------------------------------------------
+--echo # Check BACKUP status variables
+--echo #-----------------------------------------------------------------------
+
+SET SESSION lock_wait_timeout = 1;
+
+FLUSH STATUS;
+
+# MDEV-5336 introduces the status variable Com_backup
+--echo # Show how the status variable 'Com_backup' changes after BACKUP STAGE ..
+
+SHOW STATUS LIKE 'Com_backup';
+BACKUP STAGE START;
+SHOW STATUS LIKE 'Com_backup';
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE START;
+SHOW STATUS LIKE 'Com_backup';
+BACKUP STAGE FLUSH;
+SHOW STATUS LIKE 'Com_backup';
+BACKUP STAGE BLOCK_DDL;
+SHOW STATUS LIKE 'Com_backup';
+BACKUP STAGE BLOCK_COMMIT;
+SHOW STATUS LIKE 'Com_backup';
+BACKUP STAGE END;
+
+--echo # In case the backup lock is taken by the current connection than
+--echo # - DML modifying some permanent table is not allowed
+
+CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM;
+
+BACKUP STAGE START;
+SET AUTOCOMMIT = 0;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+INSERT INTO t1_innodb SET col1 = 1;
+SET AUTOCOMMIT = 1;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+INSERT INTO t1_innodb SET col1 = 1;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+INSERT INTO t1_myisam SET col1 = 1;
+--echo # - DDL creating or renaming a permanent table or a procedure etc.
+--echo # is not allowed.
+--error ER_BACKUP_LOCK_IS_ACTIVE
+CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+RENAME TABLE t1_innodb To throw_away;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+CREATE PROCEDURE p1() SELECT 13;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+CREATE PROCEDURE p1() SELECT 13;
+BACKUP STAGE END;
+DROP TABLE t1_innodb;
+DROP TABLE t1_myisam;
+
+--echo #
+--echo # Creating and modifying TEMPORARY TABLES are allowed
+--echo #
+
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+CREATE TEMPORARY TABLE tmp (col1 INT);
+DROP TEMPORARY TABLE tmp;
+
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TEMPORARY TABLE t_temporary_myisam (col1 INT) ENGINE = MyISAM;
+--echo # - DML modifying that temporary table is allowed.
+INSERT INTO t_temporary_innodb SET col1 = 1;
+SELECT COUNT(*) FROM t_temporary_innodb;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+SELECT COUNT(*) FROM t_temporary_myisam;
+BACKUP STAGE END;
+
+--echo # Show the fate and impact of some auto committed INSERT into temporary
+--echo # table sliding through the sequence.
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE FLUSH;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE BLOCK_DDL;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE BLOCK_COMMIT;
+INSERT INTO t_temporary_innodb SET col1 = 1;
+INSERT INTO t_temporary_myisam SET col1 = 1;
+BACKUP STAGE END;
+SELECT COUNT(*) FROM t_temporary_innodb;
+
+--echo # Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding
+--echo # through the sequence.
+SET AUTOCOMMIT = 1;
+BACKUP STAGE START;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE FLUSH;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE BLOCK_DDL;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE BLOCK_COMMIT;
+DROP TEMPORARY TABLE t_temporary_innodb;
+CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB;
+BACKUP STAGE END;
+--echo # Show that even more DDL on the temporary table is allowed.
+BACKUP STAGE START;
+TRUNCATE t_temporary_innodb;
+ALTER TABLE t_temporary_innodb ADD COLUMN col2 INT;
+ALTER TABLE t_temporary_innodb ADD KEY idx(col2);
+BACKUP STAGE END;
diff --git a/mysql-test/main/backup_lock.result b/mysql-test/main/backup_lock.result
new file mode 100644
index 00000000000..95b2f520d90
--- /dev/null
+++ b/mysql-test/main/backup_lock.result
@@ -0,0 +1,219 @@
+#
+# Testing which locks we get from all stages
+#
+BACKUP STAGE START;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_START Backup lock
+BACKUP STAGE FLUSH;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_FLUSH Backup lock
+BACKUP STAGE BLOCK_DDL;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_WAIT_DDL Backup lock
+BACKUP STAGE BLOCK_COMMIT;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_WAIT_COMMIT Backup lock
+BACKUP STAGE END;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+#
+# testing BACKUP STAGE LOCK's
+#
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection default;
+#
+# testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
+#
+create table t1 (a int) engine=innodb;
+start transaction;
+insert into t1 values (1);
+connection con1;
+alter table t1 add column (j int), algorithm copy;
+connection con2;
+backup stage start;
+backup stage flush;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_DDL Backup lock
+MDL_BACKUP_FLUSH Backup lock
+MDL_SHARED_WRITE Table metadata lock test t1
+MDL_SHARED_UPGRADABLE Table metadata lock test t1
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+SET STATEMENT max_statement_time=1 FOR backup stage block_ddl;
+ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
+backup stage block_ddl;
+connection default;
+commit;
+SELECT * FROM t1;
+a
+1
+SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+INSERT INTO t1 values (2,0);;
+connection con2;
+backup stage end;
+connection con1;
+connection default;
+select * from t1;
+a j
+1 NULL
+2 0
+drop table t1;
+# Test with inline alter table, which doesn't block block_commit
+create table t1 (a int) engine=innodb;
+start transaction;
+insert into t1 values (1);
+connection con1;
+alter table t1 add column (j int);
+connection con2;
+backup stage start;
+backup stage flush;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_ALTER_COPY Backup lock
+MDL_BACKUP_FLUSH Backup lock
+MDL_SHARED_WRITE Table metadata lock test t1
+MDL_SHARED_UPGRADABLE Table metadata lock test t1
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+backup stage block_ddl;
+backup stage block_commit;
+connection default;
+SELECT * FROM t1;
+a
+1
+commit;
+connection con2;
+backup stage end;
+connection con1;
+connection default;
+drop table t1;
+#
+# testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
+#
+create table t1 (a int) engine=innodb;
+start transaction;
+insert into t1 values (1);
+connection con1;
+SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+DROP TABLE t1;
+connection con2;
+backup stage start;
+backup stage flush;
+SET STATEMENT lock_wait_timeout=0 FOR SELECT * FROM t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+backup stage block_ddl;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_WAIT_DDL Backup lock
+MDL_SHARED_WRITE Table metadata lock test t1
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+backup stage end;
+connection default;
+commit;
+connection con1;
+connection default;
+#
+# Check if backup stage block_dll + concurrent drop table blocks select
+#
+create table t1 (a int) engine=innodb;
+backup stage start;
+backup stage block_ddl;
+connection con1;
+DROP TABLE t1;
+connection con2;
+connection con2;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_WAIT_DDL Backup lock
+SELECT * FROM t1;
+a
+connection default;
+backup stage end;
+connection con1;
+connection default;
+#
+# Check if backup stage block_dll overrides ddl lock for drop table
+#
+create table t1 (a int) engine=innodb;
+start transaction;
+insert into t1 values (1);
+connection con1;
+SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+DROP TABLE t1;
+connection con2;
+backup stage start;
+backup stage flush;
+backup stage block_ddl;
+connection default;
+commit;
+connection con2;
+backup stage end;
+connection con1;
+connection default;
+#
+# Check if BACKUP STAGE BLOCK_COMMIT blocks commit
+#
+create table t1 (a int) engine=innodb;
+start transaction;
+insert into t1 values (1);
+connection con1;
+backup stage start;
+backup stage block_commit;
+connection default;
+commit;
+connection con1;
+backup stage end;
+connection default;
+select * from t1;
+a
+1
+drop table t1;
+disconnect con1;
+disconnect con2;
+#
+# Test backup stage and flush tables
+#
+BACKUP STAGE START ;
+BACKUP STAGE BLOCK_DDL ;
+FLUSH TABLES;
+CREATE TEMPORARY TABLE t12345678_tmp (col1 INT);
+drop table t12345678_tmp;
+BACKUP STAGE END;
+#
+# Test BACKUP STAGES with lock timeouts
+#
+SET GLOBAL lock_wait_timeout=0;
+CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM;
+INSERT INTO t_permanent_innodb SET col1 = 1;
+INSERT INTO t_permanent_myisam SET col1 = 1;
+CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_con1_myisam (col1 INT) ENGINE = MyISAM;
+connect con1,localhost,root,,;
+SET AUTOCOMMIT = 0;
+connection default;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+connection con1;
+UPDATE t_permanent_innodb SET col1 = 8;
+UPDATE t_permanent_myisam SET col1 = 8;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+DROP TABLE t_con1_innodb;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+DROP TABLE t_con1_myisam;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection default;
+BACKUP STAGE END;
+DROP TABLE t_permanent_myisam, t_permanent_innodb;
+DROP TABLE t_con1_innodb, t_con1_myisam;
+disconnect con1;
+set global lock_wait_timeout=default;
diff --git a/mysql-test/main/backup_lock.test b/mysql-test/main/backup_lock.test
new file mode 100644
index 00000000000..d6db7a6364e
--- /dev/null
+++ b/mysql-test/main/backup_lock.test
@@ -0,0 +1,284 @@
+########################################################################
+# Tests BACKUP STAGE locking
+########################################################################
+
+--source include/have_innodb.inc
+--source include/have_metadata_lock_info.inc
+--source include/not_embedded.inc
+
+--echo #
+--echo # Testing which locks we get from all stages
+--echo #
+
+BACKUP STAGE START;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP STAGE FLUSH;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP STAGE BLOCK_DDL;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP STAGE BLOCK_COMMIT;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP STAGE END;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+
+--echo #
+--echo # testing BACKUP STAGE LOCK's
+--echo #
+
+# Following connections are used in a few of the following tests
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connection default;
+
+--echo #
+--echo # testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
+--echo #
+
+create table t1 (a int) engine=innodb;
+
+start transaction;
+# Acquires MDL lock
+insert into t1 values (1);
+
+connection con1;
+# Waits on MDL
+--send alter table t1 add column (j int), algorithm copy
+
+connection con2;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock";
+--source include/wait_condition.inc
+backup stage start;
+backup stage flush;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+#
+# Do first test with max_statement_time, other tests later are done with
+# lock_wait_timeout. This is mostly to ensure that both methods works
+#
+--error ER_STATEMENT_TIMEOUT
+SET STATEMENT max_statement_time=1 FOR backup stage block_ddl;
+--send backup stage block_ddl
+
+connection default;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for backup lock";
+--source include/wait_condition.inc
+commit;
+# The following select works because alter table is waiting for DDL lock
+SELECT * FROM t1;
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (2);
+--send INSERT INTO t1 values (2,0);
+connection con2;
+--reap # BLOCK_DDL
+backup stage end;
+connection con1;
+--reap # ALTER TABLE
+connection default;
+--reap # INSERT
+select * from t1;
+drop table t1;
+
+--echo # Test with inline alter table, which doesn't block block_commit
+
+create table t1 (a int) engine=innodb;
+
+start transaction;
+# Acquires MDL lock
+insert into t1 values (1);
+
+connection con1;
+# Waits on MDL
+--send alter table t1 add column (j int)
+
+connection con2;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock";
+--source include/wait_condition.inc
+backup stage start;
+backup stage flush;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+backup stage block_ddl;
+backup stage block_commit;
+connection default;
+SELECT * FROM t1;
+--send commit
+connection con2;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for backup lock";
+backup stage end;
+connection con1;
+--reap # ALTER TABLE
+connection default;
+--reap # commit
+drop table t1;
+
+--echo #
+--echo # testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
+--echo #
+
+create table t1 (a int) engine=innodb;
+start transaction;
+# Acquires MDL lock
+insert into t1 values (1);
+
+connection con1;
+# Waits on MDL
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1;
+--send DROP TABLE t1
+
+connection con2;
+backup stage start;
+backup stage flush;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock";
+--source include/wait_condition.inc
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR SELECT * FROM t1;
+
+backup stage block_ddl;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+backup stage end;
+
+connection default;
+commit;
+connection con1;
+--reap # DROP TABLE
+connection default;
+
+--echo #
+--echo # Check if backup stage block_dll + concurrent drop table blocks select
+--echo #
+
+create table t1 (a int) engine=innodb;
+backup stage start;
+backup stage block_ddl;
+connection con1;
+--send DROP TABLE t1
+connection con2;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for backup lock";
+--source include/wait_condition.inc
+connection con2;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+# Check that select's are not blocked
+SELECT * FROM t1;
+connection default;
+backup stage end;
+connection con1;
+--reap
+connection default;
+
+--echo #
+--echo # Check if backup stage block_dll overrides ddl lock for drop table
+--echo #
+
+create table t1 (a int) engine=innodb;
+start transaction;
+# Acquires MDL lock
+insert into t1 values (1);
+
+connection con1;
+# Waits on MDL
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1;
+--send DROP TABLE t1
+
+connection con2;
+backup stage start;
+backup stage flush;
+backup stage block_ddl;
+connection default;
+commit;
+connection con2;
+backup stage end;
+connection con1;
+--reap # DROP TABLE
+connection default;
+
+--echo #
+--echo # Check if BACKUP STAGE BLOCK_COMMIT blocks commit
+--echo #
+
+create table t1 (a int) engine=innodb;
+start transaction;
+# Acquires MDL lock
+insert into t1 values (1);
+
+connection con1;
+backup stage start;
+backup stage block_commit;
+connection default;
+--send commit
+connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for backup lock";
+backup stage end;
+connection default;
+--reap # commit
+select * from t1;
+drop table t1;
+
+#
+# End of tests using con1 and con2
+#
+disconnect con1;
+disconnect con2;
+
+--echo #
+--echo # Test backup stage and flush tables
+--echo #
+
+BACKUP STAGE START ;
+BACKUP STAGE BLOCK_DDL ;
+FLUSH TABLES;
+CREATE TEMPORARY TABLE t12345678_tmp (col1 INT);
+drop table t12345678_tmp;
+BACKUP STAGE END;
+
+--echo #
+--echo # Test BACKUP STAGES with lock timeouts
+--echo #
+
+SET GLOBAL lock_wait_timeout=0;
+CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM;
+INSERT INTO t_permanent_innodb SET col1 = 1;
+
+INSERT INTO t_permanent_myisam SET col1 = 1;
+CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_con1_myisam (col1 INT) ENGINE = MyISAM;
+
+--connect(con1,localhost,root,,)
+SET AUTOCOMMIT = 0;
+
+--connection default
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+
+--connection con1
+UPDATE t_permanent_innodb SET col1 = 8;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t_permanent_myisam SET col1 = 8;
+--error ER_LOCK_WAIT_TIMEOUT
+DROP TABLE t_con1_innodb;
+
+--error ER_LOCK_WAIT_TIMEOUT
+DROP TABLE t_con1_myisam;
+
+--connection default
+BACKUP STAGE END;
+DROP TABLE t_permanent_myisam, t_permanent_innodb;
+DROP TABLE t_con1_innodb, t_con1_myisam;
+--disconnect con1
+set global lock_wait_timeout=default;
diff --git a/mysql-test/main/backup_lock_debug.result b/mysql-test/main/backup_lock_debug.result
new file mode 100644
index 00000000000..8832d9cd3e7
--- /dev/null
+++ b/mysql-test/main/backup_lock_debug.result
@@ -0,0 +1,28 @@
+#
+# Make sure pending LOCK TABLES doesn't block BACKUP STAGE
+#
+CREATE TABLE t1(a INT);
+LOCK TABLE t1 READ;
+#
+connect con1,localhost,root,,;
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
+LOCK TABLE t1 WRITE;
+#
+connect con2,localhost,root,,;
+SET DEBUG_SYNC= 'now WAIT_FOR ready';
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+disconnect con2;
+#
+connection default;
+UNLOCK TABLES;
+#
+connection con1;
+UNLOCK TABLES;
+disconnect con1;
+#
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/main/backup_lock_debug.test b/mysql-test/main/backup_lock_debug.test
new file mode 100644
index 00000000000..8cf492b3404
--- /dev/null
+++ b/mysql-test/main/backup_lock_debug.test
@@ -0,0 +1,40 @@
+########################################################################
+# Tests for BACKUP STAGE locking that requires debug.
+########################################################################
+
+--source include/have_debug_sync.inc
+
+--echo #
+--echo # Make sure pending LOCK TABLES doesn't block BACKUP STAGE
+--echo #
+CREATE TABLE t1(a INT);
+LOCK TABLE t1 READ;
+
+--echo #
+connect (con1,localhost,root,,);
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
+--send LOCK TABLE t1 WRITE
+
+--echo #
+connect (con2,localhost,root,,);
+SET DEBUG_SYNC= 'now WAIT_FOR ready';
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+disconnect con2;
+
+--echo #
+connection default;
+UNLOCK TABLES;
+
+--echo #
+connection con1;
+reap;
+UNLOCK TABLES;
+disconnect con1;
+
+--echo #
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/main/backup_locks.result b/mysql-test/main/backup_locks.result
new file mode 100644
index 00000000000..a3a66937cf9
--- /dev/null
+++ b/mysql-test/main/backup_locks.result
@@ -0,0 +1,46 @@
+#
+# Test lock taken
+#
+BACKUP LOCK test.t1;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_SHARED_HIGH_PRIO Table metadata lock test t1
+BACKUP UNLOCK;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+BACKUP LOCK t1;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_SHARED_HIGH_PRIO Table metadata lock test t1
+BACKUP UNLOCK;
+BACKUP LOCK non_existing.t1;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_SHARED_HIGH_PRIO Table metadata lock non_existing t1
+BACKUP UNLOCK;
+#
+# Test that backup lock protects against ddl
+#
+connect con1,localhost,root,,;
+connection default;
+create table t1 (a int) engine=innodb;
+insert into t1 values (1);
+backup lock t1;
+select * from t1;
+a
+1
+connection con1;
+drop table t1;
+connection default;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_SHARED_HIGH_PRIO Table metadata lock test t1
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+select * from t1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+backup unlock;
+connection con1;
+connection default;
+disconnect con1;
+show tables;
+Tables_in_test
diff --git a/mysql-test/main/backup_locks.test b/mysql-test/main/backup_locks.test
new file mode 100644
index 00000000000..21b67100506
--- /dev/null
+++ b/mysql-test/main/backup_locks.test
@@ -0,0 +1,50 @@
+########################################################################
+# Tests BACKUP STAGE locking
+########################################################################
+
+--source include/have_innodb.inc
+--source include/have_metadata_lock_info.inc
+--source include/not_embedded.inc
+
+--echo #
+--echo # Test lock taken
+--echo #
+
+BACKUP LOCK test.t1;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP UNLOCK;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP LOCK t1;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP UNLOCK;
+BACKUP LOCK non_existing.t1;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+BACKUP UNLOCK;
+
+--echo #
+--echo # Test that backup lock protects against ddl
+--echo #
+
+connect (con1,localhost,root,,);
+
+connection default;
+create table t1 (a int) engine=innodb;
+insert into t1 values (1);
+backup lock t1;
+select * from t1;
+connection con1;
+--send drop table t1
+connection default;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock";
+--source include/wait_condition.inc
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+--error ER_LOCK_DEADLOCK
+select * from t1;
+backup unlock;
+connection con1;
+--reap
+connection default;
+disconnect con1;
+show tables;
diff --git a/mysql-test/main/backup_priv.result b/mysql-test/main/backup_priv.result
new file mode 100644
index 00000000000..4169f58f40f
--- /dev/null
+++ b/mysql-test/main/backup_priv.result
@@ -0,0 +1,40 @@
+#
+# Test privileges for BACKUP STAGES
+#
+set sql_mode="";
+GRANT RELOAD ON *.* TO user1@localhost;
+GRANT CREATE, DROP ON *.* TO user2@localhost;
+connect con1, localhost, user1;
+BACKUP STAGE START;
+BACKUP STAGE END;
+# change_user must release backup lock
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock';
+lock_mode
+MDL_BACKUP_FLUSH
+SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock';
+lock_mode
+disconnect con1;
+connection default;
+# A very low privileged user (-> con4) cannot acquire the backup lock
+connect con1, localhost, user2;
+BACKUP STAGE START;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+BACKUP STAGE FLUSH;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+BACKUP STAGE BLOCK_DDL;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+BACKUP STAGE BLOCK_COMMIT;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+BACKUP STAGE END;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+disconnect con1;
+connection default;
+DROP USER user1@localhost, user2@localhost;
+#
+# Test using BACKUP STAGES in a SP
+#
+create procedure foo42()
+BACKUP STAGE START;
+ERROR 0A000: BACKUP STAGE is not allowed in stored procedures
diff --git a/mysql-test/main/backup_priv.test b/mysql-test/main/backup_priv.test
new file mode 100644
index 00000000000..93b69af0b67
--- /dev/null
+++ b/mysql-test/main/backup_priv.test
@@ -0,0 +1,52 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+--source include/have_metadata_lock_info.inc
+
+--echo #
+--echo # Test privileges for BACKUP STAGES
+--echo #
+
+set sql_mode="";
+
+GRANT RELOAD ON *.* TO user1@localhost;
+GRANT CREATE, DROP ON *.* TO user2@localhost;
+
+--connect(con1, localhost, user1)
+BACKUP STAGE START;
+BACKUP STAGE END;
+--echo # change_user must release backup lock
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock';
+change_user user2;
+SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock';
+--disconnect con1
+--source include/wait_until_disconnected.inc
+--connection default
+
+--echo # A very low privileged user (-> con4) cannot acquire the backup lock
+
+--connect(con1, localhost, user2)
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+BACKUP STAGE START;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+BACKUP STAGE FLUSH;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+BACKUP STAGE BLOCK_DDL;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+BACKUP STAGE BLOCK_COMMIT;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+BACKUP STAGE END;
+--disconnect con1
+--source include/wait_until_disconnected.inc
+
+--connection default
+DROP USER user1@localhost, user2@localhost;
+
+--echo #
+--echo # Test using BACKUP STAGES in a SP
+--echo #
+
+--error ER_SP_BADSTATEMENT
+create procedure foo42()
+ BACKUP STAGE START;
diff --git a/mysql-test/main/backup_stages.result b/mysql-test/main/backup_stages.result
new file mode 100644
index 00000000000..caea1fda0b9
--- /dev/null
+++ b/mysql-test/main/backup_stages.result
@@ -0,0 +1,335 @@
+#-----------------------------------------------------------------------
+# Multi-threaded tests
+#-----------------------------------------------------------------------
+# Show that only one connection can hold the backup lock.
+connection default;
+BACKUP STAGE START;
+connect con1,localhost,root,,;
+SET STATEMENT lock_wait_timeout=0 FOR BACKUP STAGE START;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+BACKUP STAGE START;
+connection default;
+# Show that the connection con1 has to wait for the backup lock and the
+# corresponding representation within the processlist.
+SET @con1_id = <con1_id>;
+SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY
+FROM information_schema.processlist WHERE id = @con1_id;
+ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY
+<con1_id> root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START
+BACKUP STAGE END;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_START Backup lock
+connection con1;
+# The connection default has removed the backup lock.
+# And so the current connection con1 can reap for its BACKUP STAGE START
+connect con2,localhost,root,,;
+# The connection con2 cannot continue the work of con1 by setting the
+# next BACKUP STAGE FLUSH.
+BACKUP STAGE FLUSH;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+BACKUP STAGE START;
+connection default;
+SET @con2_id = <con2_id>;
+# Connection con2 waits for the backup lock held by con1.
+SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY
+FROM information_schema.processlist WHERE id = @con2_id;
+ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY
+<con2_id> root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START
+disconnect con1;
+connection con2;
+# Connection con1 frees the backup lock held by disconnecting.
+# So connection con2 gets the backup lock.
+connect con3,localhost,root,,;
+BACKUP STAGE START;
+connection default;
+SET @con3_id = <con3_id>;
+# Connection con3 waits for the backup lock held by con2.
+SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY
+FROM information_schema.processlist WHERE id = @con3_id;
+ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY
+<con3_id> root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START
+KILL CONNECTION @con2_id;
+connection con3;
+# Connection con2 frees the backup lock held by getting killed.
+# So connection con3 gets the backup lock.
+BACKUP STAGE END;
+disconnect con3;
+connection default;
+CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB;
+INSERT INTO t_permanent_innodb SET col1 = 1;
+CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM;
+INSERT INTO t_permanent_myisam SET col1 = 1;
+connect backup,localhost,root,,;
+connect con11,localhost,root,,;
+SET AUTOCOMMIT = 0;
+set session lock_wait_timeout=0;
+connect con12,localhost,root,,;
+SET AUTOCOMMIT = 1;
+# Between (connection default) BACKUP STAGE START and FLUSH
+# no restrictions for concurrent sessions regarding DDL or DML
+# affecting transactional/non transactional permanent tables.
+connection backup;
+BACKUP STAGE START;
+connection con11;
+UPDATE t_permanent_innodb SET col1 = 2;
+UPDATE t_permanent_myisam SET col1 = 2;
+SELECT COUNT(*) FROM t_permanent_innodb;
+COUNT(*)
+1
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+col1
+2
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+COUNT(*)
+1
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+col1
+2
+HANDLER t_permanent_myisam CLOSE;
+CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB;
+ALTER TABLE t_permanent_innodb ADD COLUMN col2 INT;
+ALTER TABLE t_permanent_myisam ADD COLUMN col2 INT;
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb;
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam;
+connection con12;
+UPDATE t_permanent_innodb SET col1 = 3;
+UPDATE t_permanent_myisam SET col1 = 3;
+# Between (connection default) BACKUP STAGE FLUSH and BLOCK_DDL
+# concurrent sessions
+# - can change transactional permanent tables with DDL and DML
+# - can run DROP/CREATE transactional/non transactional TABLE
+# - cannot modify non transactional permanent tables with DDL or DML
+connection backup;
+BACKUP STAGE FLUSH;
+connection con11;
+UPDATE t_permanent_innodb SET col1 = 4;
+SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_myisam SET col1 = 4;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT COUNT(*) FROM t_permanent_innodb;
+COUNT(*)
+1
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+col1 col2
+4 NULL
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+COUNT(*)
+1
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+col1 col2
+3 NULL
+HANDLER t_permanent_myisam CLOSE;
+DROP TABLE t_con1_innodb;
+DROP TABLE t_con1_myisam;
+CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB;
+ALTER TABLE t_permanent_innodb ADD COLUMN col3 INT;
+SET STATEMENT lock_wait_timeout=0 FOR ALTER TABLE t_permanent_myisam ADD COLUMN col3 INT;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb;
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam;
+connection con12;
+UPDATE t_permanent_innodb SET col1 = 5;
+# Between (connection default) BACKUP STAGE BLOCK_DDL and BLOCK_COMMIT
+# concurrent sessions
+# - can change transactional permanent tables with DML
+# - cannot run DDL
+# - cannot change non transactional permanent tables with DML
+connection backup;
+BACKUP STAGE BLOCK_DDL;
+connection con11;
+UPDATE t_permanent_innodb SET col1 = 6;
+UPDATE t_permanent_myisam SET col1 = 6;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT COUNT(*) FROM t_permanent_innodb;
+COUNT(*)
+1
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+col1 col2 col3
+6 NULL NULL
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+COUNT(*)
+1
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+col1 col2
+3 NULL
+HANDLER t_permanent_myisam CLOSE;
+DROP TABLE t_con1_innodb;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ALTER TABLE t_permanent_innodb ADD COLUMN col4 INT;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con12;
+UPDATE t_permanent_innodb SET col1 = 7;
+# Between (connection default) BACKUP STAGE BLOCK_COMMIT and END
+# concurrent sessions
+# - can change transactional permanent tables with DML
+# - cannot run DDL
+# - cannot change non transactional permanent tables with DML
+connection backup;
+BACKUP STAGE BLOCK_COMMIT;
+connection con11;
+UPDATE t_permanent_innodb SET col1 = 8;
+UPDATE t_permanent_myisam SET col1 = 8;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT COUNT(*) FROM t_permanent_innodb;
+COUNT(*)
+1
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+col1 col2 col3
+8 NULL NULL
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+COUNT(*)
+1
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+col1 col2
+3 NULL
+HANDLER t_permanent_myisam CLOSE;
+DROP TABLE t_con1_innodb;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+DROP TABLE t_con1_myisam;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con12;
+SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_innodb SET col1 = 9;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection backup;
+BACKUP STAGE END;
+connection con11;
+COMMIT;
+SELECT * FROM t_permanent_innodb ORDER BY col1;
+col1 col2 col3
+7 NULL NULL
+SELECT * FROM t_permanent_myisam ORDER BY col1;
+col1 col2
+3 NULL
+SET AUTOCOMMIT = 0;
+SET GLOBAL tx_read_only = 1;
+connection con12;
+BACKUP STAGE START;
+BACKUP STAGE END;
+SET GLOBAL tx_read_only = 0;
+DROP VIEW v_some_view;
+DROP TABLE t_con1_innodb;
+DROP TABLE t_con1_myisam;
+# Connection backup holds the backup log and is on some stage.
+# Connection con11 tries to LOCK TABLEs or to set read_only.
+connection backup;
+BACKUP STAGE START;
+connection con11;
+# Between BACKUP STAGE START and FLUSH:
+# No restrictions for other connection around LOCK TABLES or read-only.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+LOCK TABLES t_permanent_innodb WRITE;
+LOCK TABLES t_permanent_myisam WRITE;
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+connection backup;
+BACKUP STAGE FLUSH;
+connection con11;
+# Between BACKUP STAGE FLUSH and BLOCK_COMMIT:
+# Connection con11 not holding the backup lock cannot
+# LOCK WRITE non transactional table.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+LOCK TABLES t_permanent_innodb WRITE;
+LOCK TABLES t_permanent_myisam WRITE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+connection backup;
+BACKUP STAGE BLOCK_DDL;
+connection con11;
+# Between BACKUP STAGE FLUSH and BLOCK_COMMIT:
+# Connection con11 not holding the backup lock cannot
+# LOCK WRITE transactional or non transactional table.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+LOCK TABLES t_permanent_innodb WRITE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+LOCK TABLES t_permanent_myisam WRITE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+connection backup;
+BACKUP STAGE BLOCK_COMMIT;
+connection con11;
+# Between BACKUP BLOCK_COMMIT FLUSH and END:
+# Connection con11 not holding the backup lock cannot
+# LOCK WRITE transactional or non transactional table.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+LOCK TABLES t_permanent_innodb WRITE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+LOCK TABLES t_permanent_myisam WRITE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+connection backup;
+BACKUP STAGE END;
+DROP TABLE t_permanent_innodb;
+DROP TABLE t_permanent_myisam;
+#
+# Log tables
+#
+connection backup;
+SET @old_general_log = @@general_log;
+SET @old_slow_query_log = @@slow_query_log;
+SET @old_log_output = @@log_output;
+SET GLOBAL log_output = 'TABLE';
+SET GLOBAL general_log = ON;
+SET GLOBAL slow_query_log = ON;
+connection con11;
+SET @old_long_query_time = @@SESSION.long_query_time;
+SET SESSION long_query_time = 0;
+connection backup;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+connection con11;
+SELECT 1;
+1
+1
+connection backup;
+SELECT 1;
+1
+1
+connection con11;
+SET SESSION long_query_time = @old_long_query_time;
+connection backup;
+BACKUP STAGE END;
+SET GLOBAL log_output = @old_log_output;
+SET GLOBAL slow_query_log = @old_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+#-----------------------------------------------------------------------
+# Cleanup
+#-----------------------------------------------------------------------
+SET GLOBAL lock_wait_timeout = <old_lock_wait_timeout>;
+disconnect con2;
+disconnect con11;
+disconnect con12;
+disconnect backup;
+connection default;
diff --git a/mysql-test/main/backup_stages.test b/mysql-test/main/backup_stages.test
new file mode 100644
index 00000000000..ba9c15a1d7e
--- /dev/null
+++ b/mysql-test/main/backup_stages.test
@@ -0,0 +1,385 @@
+########################################################################
+# Test what is locked in each stage for LOCK FOR BACKUP (MDEV-5336)
+########################################################################
+
+--source include/not_embedded.inc
+# A transactional engine
+--source include/have_innodb.inc
+--source include/have_metadata_lock_info.inc
+# As non transactional engine we have MyISAM anyway.
+
+# Save the initial number of concurrent sessions.
+--source include/count_sessions.inc
+
+let $old_lock_wait_timeout = `SELECT @@global.lock_wait_timeout`;
+
+--echo #-----------------------------------------------------------------------
+--echo # Multi-threaded tests
+--echo #-----------------------------------------------------------------------
+--echo # Show that only one connection can hold the backup lock.
+
+--connection default
+let $default_id= `SELECT CONNECTION_ID()`;
+BACKUP STAGE START;
+
+# con1, root high privileged user
+--connect(con1,localhost,root,,)
+let $con1_id= `SELECT CONNECTION_ID()`;
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR BACKUP STAGE START;
+send BACKUP STAGE START;
+--connection default
+
+--echo # Show that the connection con1 has to wait for the backup lock and the
+--echo # corresponding representation within the processlist.
+
+--replace_result $con1_id <con1_id>
+
+eval SET @con1_id = $con1_id;
+# Output expected here is
+# ID USER COMMAND STATE INFO INFO_BINARY
+# <con1_id> root Query Waiting for backup lock BACKUP STAGE START BACKUP STAGE START
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE STATE = "Waiting for backup lock" and INFO = "BACKUP STAGE START";
+--source include/wait_condition.inc
+--replace_column 1 <con1_id>
+eval
+SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY
+FROM information_schema.processlist WHERE id = @con1_id;
+# con1 uses @@global.lock_wait_timeout
+
+BACKUP STAGE END;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+
+--connection con1
+--echo # The connection default has removed the backup lock.
+--echo # And so the current connection con1 can reap for its BACKUP STAGE START
+--reap
+
+# con2, root high privileged user
+--connect(con2,localhost,root,,)
+let $con2_id= `SELECT CONNECTION_ID()`;
+--echo # The connection con2 cannot continue the work of con1 by setting the
+--echo # next BACKUP STAGE FLUSH.
+--error ER_BACKUP_NOT_RUNNING
+BACKUP STAGE FLUSH;
+send
+BACKUP STAGE START;
+
+--connection default
+--replace_result $con2_id <con2_id>
+eval SET @con2_id = $con2_id;
+--echo # Connection con2 waits for the backup lock held by con1.
+--source include/wait_condition.inc
+--replace_column 1 <con2_id>
+eval
+SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY
+FROM information_schema.processlist WHERE id = @con2_id;
+
+--disconnect con1
+
+--connection con2
+--echo # Connection con1 frees the backup lock held by disconnecting.
+--echo # So connection con2 gets the backup lock.
+--reap
+
+--connect(con3,localhost,root,,)
+let $con3_id= `SELECT CONNECTION_ID()`;
+send
+BACKUP STAGE START;
+
+--connection default
+--replace_result $con3_id <con3_id>
+eval SET @con3_id = $con3_id;
+--echo # Connection con3 waits for the backup lock held by con2.
+--source include/wait_condition.inc
+--replace_column 1 <con3_id>
+eval
+SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY
+FROM information_schema.processlist WHERE id = @con3_id;
+KILL CONNECTION @con2_id;
+
+--connection con3
+--echo # Connection con2 frees the backup lock held by getting killed.
+--echo # So connection con3 gets the backup lock.
+--reap
+BACKUP STAGE END;
+disconnect con3;
+--connection default
+
+CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB;
+INSERT INTO t_permanent_innodb SET col1 = 1;
+CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM;
+INSERT INTO t_permanent_myisam SET col1 = 1;
+
+# backup : Try the BACKUP STAGE sequence
+# con11 : Try DDL + DML with AUTOCOMMIT = 0
+# con12 : Try DML with AUTOCOMMIT = 1
+--connect(backup,localhost,root,,)
+--connect(con11,localhost,root,,)
+SET AUTOCOMMIT = 0;
+set session lock_wait_timeout=0;
+--connect(con12,localhost,root,,)
+SET AUTOCOMMIT = 1;
+
+--echo # Between (connection default) BACKUP STAGE START and FLUSH
+--echo # no restrictions for concurrent sessions regarding DDL or DML
+--echo # affecting transactional/non transactional permanent tables.
+
+--connection backup
+BACKUP STAGE START;
+--connection con11
+UPDATE t_permanent_innodb SET col1 = 2;
+UPDATE t_permanent_myisam SET col1 = 2;
+SELECT COUNT(*) FROM t_permanent_innodb;
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+HANDLER t_permanent_myisam CLOSE;
+CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB;
+ALTER TABLE t_permanent_innodb ADD COLUMN col2 INT;
+ALTER TABLE t_permanent_myisam ADD COLUMN col2 INT;
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb;
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam;
+--connection con12
+UPDATE t_permanent_innodb SET col1 = 3;
+UPDATE t_permanent_myisam SET col1 = 3;
+
+--echo # Between (connection default) BACKUP STAGE FLUSH and BLOCK_DDL
+--echo # concurrent sessions
+--echo # - can change transactional permanent tables with DDL and DML
+--echo # - can run DROP/CREATE transactional/non transactional TABLE
+--echo # - cannot modify non transactional permanent tables with DDL or DML
+
+--connection backup
+BACKUP STAGE FLUSH;
+--connection con11
+UPDATE t_permanent_innodb SET col1 = 4;
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_myisam SET col1 = 4;
+SELECT COUNT(*) FROM t_permanent_innodb;
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+HANDLER t_permanent_myisam CLOSE;
+DROP TABLE t_con1_innodb;
+DROP TABLE t_con1_myisam;
+CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
+CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB;
+ALTER TABLE t_permanent_innodb ADD COLUMN col3 INT;
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR ALTER TABLE t_permanent_myisam ADD COLUMN col3 INT;
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb;
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam;
+--connection con12
+UPDATE t_permanent_innodb SET col1 = 5;
+
+
+--echo # Between (connection default) BACKUP STAGE BLOCK_DDL and BLOCK_COMMIT
+--echo # concurrent sessions
+--echo # - can change transactional permanent tables with DML
+--echo # - cannot run DDL
+--echo # - cannot change non transactional permanent tables with DML
+
+--connection backup
+BACKUP STAGE BLOCK_DDL;
+--connection con11
+
+UPDATE t_permanent_innodb SET col1 = 6;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t_permanent_myisam SET col1 = 6;
+SELECT COUNT(*) FROM t_permanent_innodb;
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+HANDLER t_permanent_myisam CLOSE;
+--error ER_LOCK_WAIT_TIMEOUT
+DROP TABLE t_con1_innodb;
+--error ER_LOCK_WAIT_TIMEOUT
+CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB;
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t_permanent_innodb ADD COLUMN col4 INT;
+--error ER_LOCK_WAIT_TIMEOUT
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb;
+--error ER_LOCK_WAIT_TIMEOUT
+CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam;
+--connection con12
+UPDATE t_permanent_innodb SET col1 = 7;
+
+
+--echo # Between (connection default) BACKUP STAGE BLOCK_COMMIT and END
+--echo # concurrent sessions
+--echo # - can change transactional permanent tables with DML
+--echo # - cannot run DDL
+--echo # - cannot change non transactional permanent tables with DML
+
+--connection backup
+BACKUP STAGE BLOCK_COMMIT;
+--connection con11
+UPDATE t_permanent_innodb SET col1 = 8;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t_permanent_myisam SET col1 = 8;
+SELECT COUNT(*) FROM t_permanent_innodb;
+HANDLER t_permanent_innodb OPEN;
+HANDLER t_permanent_innodb READ FIRST;
+HANDLER t_permanent_innodb CLOSE;
+SELECT COUNT(*) FROM t_permanent_myisam;
+HANDLER t_permanent_myisam OPEN;
+HANDLER t_permanent_myisam READ FIRST;
+HANDLER t_permanent_myisam CLOSE;
+--error ER_LOCK_WAIT_TIMEOUT
+DROP TABLE t_con1_innodb;
+--error ER_LOCK_WAIT_TIMEOUT
+DROP TABLE t_con1_myisam;
+--connection con12
+--error ER_LOCK_WAIT_TIMEOUT
+SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_innodb SET col1 = 9;
+
+--connection backup
+BACKUP STAGE END;
+--connection con11
+COMMIT;
+SELECT * FROM t_permanent_innodb ORDER BY col1;
+SELECT * FROM t_permanent_myisam ORDER BY col1;
+SET AUTOCOMMIT = 0;
+SET GLOBAL tx_read_only = 1;
+--connection con12
+BACKUP STAGE START;
+BACKUP STAGE END;
+SET GLOBAL tx_read_only = 0;
+DROP VIEW v_some_view;
+DROP TABLE t_con1_innodb;
+DROP TABLE t_con1_myisam;
+
+--echo # Connection backup holds the backup log and is on some stage.
+--echo # Connection con11 tries to LOCK TABLEs or to set read_only.
+
+--connection backup
+BACKUP STAGE START;
+--connection con11
+--echo # Between BACKUP STAGE START and FLUSH:
+--echo # No restrictions for other connection around LOCK TABLES or read-only.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+LOCK TABLES t_permanent_innodb WRITE;
+LOCK TABLES t_permanent_myisam WRITE;
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+--connection backup
+BACKUP STAGE FLUSH;
+--connection con11
+--echo # Between BACKUP STAGE FLUSH and BLOCK_COMMIT:
+--echo # Connection con11 not holding the backup lock cannot
+--echo # LOCK WRITE non transactional table.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+LOCK TABLES t_permanent_innodb WRITE;
+--error ER_LOCK_WAIT_TIMEOUT
+LOCK TABLES t_permanent_myisam WRITE;
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+--connection backup
+BACKUP STAGE BLOCK_DDL;
+--connection con11
+--echo # Between BACKUP STAGE FLUSH and BLOCK_COMMIT:
+--echo # Connection con11 not holding the backup lock cannot
+--echo # LOCK WRITE transactional or non transactional table.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+--error ER_LOCK_WAIT_TIMEOUT
+LOCK TABLES t_permanent_innodb WRITE;
+--error ER_LOCK_WAIT_TIMEOUT
+LOCK TABLES t_permanent_myisam WRITE;
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+--connection backup
+BACKUP STAGE BLOCK_COMMIT;
+--connection con11
+--echo # Between BACKUP BLOCK_COMMIT FLUSH and END:
+--echo # Connection con11 not holding the backup lock cannot
+--echo # LOCK WRITE transactional or non transactional table.
+LOCK TABLES t_permanent_innodb READ;
+LOCK TABLES t_permanent_myisam READ;
+--error ER_LOCK_WAIT_TIMEOUT
+LOCK TABLES t_permanent_innodb WRITE;
+--error ER_LOCK_WAIT_TIMEOUT
+LOCK TABLES t_permanent_myisam WRITE;
+UNLOCK TABLES;
+SET GLOBAL tx_read_only = 1;
+SET GLOBAL tx_read_only = 0;
+--connection backup
+BACKUP STAGE END;
+
+DROP TABLE t_permanent_innodb;
+DROP TABLE t_permanent_myisam;
+
+--echo #
+--echo # Log tables
+--echo #
+
+--connection backup
+
+SET @old_general_log = @@general_log;
+SET @old_slow_query_log = @@slow_query_log;
+SET @old_log_output = @@log_output;
+
+SET GLOBAL log_output = 'TABLE';
+SET GLOBAL general_log = ON;
+SET GLOBAL slow_query_log = ON;
+
+
+--connection con11
+SET @old_long_query_time = @@SESSION.long_query_time;
+SET SESSION long_query_time = 0;
+
+--connection backup
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+
+--connection con11
+SELECT 1;
+
+--connection backup
+SELECT 1;
+
+--connection con11
+SET SESSION long_query_time = @old_long_query_time;
+
+--connection backup
+BACKUP STAGE END;
+
+SET GLOBAL log_output = @old_log_output;
+SET GLOBAL slow_query_log = @old_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+
+--echo #-----------------------------------------------------------------------
+--echo # Cleanup
+--echo #-----------------------------------------------------------------------
+
+--replace_result $old_lock_wait_timeout <old_lock_wait_timeout>
+eval
+SET GLOBAL lock_wait_timeout = $old_lock_wait_timeout;
+
+--disconnect con2
+--disconnect con11
+--disconnect con12
+--disconnect backup
+
+--connection default
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/main/backup_syntax.result b/mysql-test/main/backup_syntax.result
new file mode 100644
index 00000000000..4b8e74edd57
--- /dev/null
+++ b/mysql-test/main/backup_syntax.result
@@ -0,0 +1,163 @@
+#-----------------------------------------------------------------------
+# Basic syntax checks
+#-----------------------------------------------------------------------
+# Check existing BACKUP STAGE statements in the sequence to be used.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+# Check invalid variants of BACKUP .... syntax.
+BACKUP LOG;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LOG' at line 1
+BACKUP LOCK;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+BACKUP STAGE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+BACKUP STAGE LOCK;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LOCK' at line 1
+BACKUP STAGE not_existing;
+ERROR HY000: Unknown backup stage: 'not_existing'. Stage should be one of START, FLUSH, BLOCK_DDL, BLOCK_COMMIT or END
+#-----------------------------------------------------------------------
+# BACKUP STAGE statements in various orders.
+#-----------------------------------------------------------------------
+# All BACKUP STAGE statements != 'BACKUP STAGE START' expect that a
+# backup lock (generated by BACKUP STAGE START) already exists.
+#
+backup stage start;
+backup stage flush;
+backup stage start;
+ERROR HY000: Backup stage 'START' is same or before current backup stage 'FLUSH'
+backup stage start;
+ERROR HY000: Backup stage 'START' is same or before current backup stage 'FLUSH'
+backup stage block_commit;
+backup stage flush;
+ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_COMMIT'
+backup stage flush;
+ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_COMMIT'
+backup stage end;
+backup stage flush;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+BACKUP STAGE END;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+BACKUP STAGE BLOCK_COMMIT;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+BACKUP STAGE BLOCK_DDL;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+BACKUP STAGE FLUSH;
+ERROR HY000: You must start backup with "BACKUP STAGE START"
+# Ordered "give up" with 'BACKUP STAGE END' because of whatever reason.
+# Some existing backup lock assumed a 'BACKUP STAGE END' is allowed in
+# every situation.
+BACKUP STAGE START;
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+# Orders with BACKUP STAGE FLUSH omitted.
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+# Orders with BACKUP STAGE BLOCK_DDL omitted.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+# Orders with BACKUP STAGE BLOCK_COMMIT omitted.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+# Orders with doubled BACKUP STAGE statements.
+# We get an error but that seems to have no bad impact on the state.
+# And so we are allowed to go on with BACKUP STAGE statements.
+BACKUP STAGE START;
+BACKUP STAGE START;
+ERROR HY000: Backup stage 'START' is same or before current backup stage 'START'
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE FLUSH;
+ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'FLUSH'
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_DDL;
+ERROR HY000: Backup stage 'BLOCK_DDL' is same or before current backup stage 'BLOCK_DDL'
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE BLOCK_COMMIT;
+ERROR HY000: Backup stage 'BLOCK_COMMIT' is same or before current backup stage 'BLOCK_COMMIT'
+BACKUP STAGE END;
+# Scrambled orders.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE START;
+ERROR HY000: Backup stage 'START' is same or before current backup stage 'FLUSH'
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE START;
+ERROR HY000: Backup stage 'START' is same or before current backup stage 'BLOCK_DDL'
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE START;
+ERROR HY000: Backup stage 'START' is same or before current backup stage 'BLOCK_COMMIT'
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE FLUSH;
+ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_DDL'
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE FLUSH;
+ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_COMMIT'
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE BLOCK_DDL;
+ERROR HY000: Backup stage 'BLOCK_DDL' is same or before current backup stage 'BLOCK_COMMIT'
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE FLUSH;
+ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_DDL'
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+#----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE BLOCK_DDL;
+ERROR HY000: Backup stage 'BLOCK_DDL' is same or before current backup stage 'BLOCK_COMMIT'
+BACKUP STAGE END;
+#
+# Check Oracle syntax
+#
+set SQL_MODE=Oracle;
+backup stage start;
+backup stage end;
+set SQL_MODE=default;
diff --git a/mysql-test/main/backup_syntax.test b/mysql-test/main/backup_syntax.test
new file mode 100644
index 00000000000..f02c69bdd85
--- /dev/null
+++ b/mysql-test/main/backup_syntax.test
@@ -0,0 +1,181 @@
+########################################################################
+# Tests things releated to syntax of BACKUP STAGE (MDEV-5336)
+########################################################################
+
+--source include/have_innodb.inc
+--source include/have_metadata_lock_info.inc
+
+--echo #-----------------------------------------------------------------------
+--echo # Basic syntax checks
+--echo #-----------------------------------------------------------------------
+
+--echo # Check existing BACKUP STAGE statements in the sequence to be used.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+
+--echo # Check invalid variants of BACKUP .... syntax.
+--error ER_PARSE_ERROR
+BACKUP LOG;
+--error ER_PARSE_ERROR
+BACKUP LOCK;
+--error ER_PARSE_ERROR
+BACKUP STAGE;
+--error ER_PARSE_ERROR
+BACKUP STAGE LOCK;
+--error ER_BACKUP_UNKNOWN_STAGE
+BACKUP STAGE not_existing;
+
+--echo #-----------------------------------------------------------------------
+--echo # BACKUP STAGE statements in various orders.
+--echo #-----------------------------------------------------------------------
+--echo # All BACKUP STAGE statements != 'BACKUP STAGE START' expect that a
+--echo # backup lock (generated by BACKUP STAGE START) already exists.
+--echo #
+
+backup stage start;
+backup stage flush;
+--error ER_BACKUP_WRONG_STAGE
+backup stage start;
+--error ER_BACKUP_WRONG_STAGE
+backup stage start;
+backup stage block_commit;
+--error ER_BACKUP_WRONG_STAGE
+backup stage flush;
+--error ER_BACKUP_WRONG_STAGE
+backup stage flush;
+backup stage end;
+--error ER_BACKUP_NOT_RUNNING
+backup stage flush;
+--error ER_BACKUP_NOT_RUNNING
+BACKUP STAGE END;
+--error ER_BACKUP_NOT_RUNNING
+BACKUP STAGE BLOCK_COMMIT;
+--error ER_BACKUP_NOT_RUNNING
+BACKUP STAGE BLOCK_DDL;
+--error ER_BACKUP_NOT_RUNNING
+BACKUP STAGE FLUSH;
+
+--echo # Ordered "give up" with 'BACKUP STAGE END' because of whatever reason.
+--echo # Some existing backup lock assumed a 'BACKUP STAGE END' is allowed in
+--echo # every situation.
+
+BACKUP STAGE START;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+--echo # Orders with BACKUP STAGE FLUSH omitted.
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+--echo # Orders with BACKUP STAGE BLOCK_DDL omitted.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+--echo # Orders with BACKUP STAGE BLOCK_COMMIT omitted.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+
+--echo # Orders with doubled BACKUP STAGE statements.
+--echo # We get an error but that seems to have no bad impact on the state.
+--echo # And so we are allowed to go on with BACKUP STAGE statements.
+
+BACKUP STAGE START;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE FLUSH;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+
+--echo # Scrambled orders.
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_COMMIT;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE START;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_COMMIT;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE FLUSH;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE BLOCK_COMMIT;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_COMMIT;
+BACKUP STAGE END;
+--echo #----
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE BLOCK_COMMIT;
+--error ER_BACKUP_WRONG_STAGE
+BACKUP STAGE BLOCK_DDL;
+BACKUP STAGE END;
+
+--echo #
+--echo # Check Oracle syntax
+--echo #
+
+set SQL_MODE=Oracle;
+backup stage start;
+backup stage end;
+set SQL_MODE=default;
diff --git a/mysql-test/main/bigint.result b/mysql-test/main/bigint.result
index 8f4b287ab21..6e0384182fe 100644
--- a/mysql-test/main/bigint.result
+++ b/mysql-test/main/bigint.result
@@ -510,3 +510,14 @@ DROP TABLE t1;
SELECT 100 BETWEEN 1 AND 9223372036854775808;
100 BETWEEN 1 AND 9223372036854775808
1
+#
+# MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615
+#
+CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL);
+INSERT INTO t1 VALUES (0),(101),(255);
+SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1;
+c1
+0
+101
+255
+DROP TABLE t1;
diff --git a/mysql-test/main/bigint.test b/mysql-test/main/bigint.test
index ae325c7d7de..68ffcd9230e 100644
--- a/mysql-test/main/bigint.test
+++ b/mysql-test/main/bigint.test
@@ -416,3 +416,12 @@ DROP TABLE t1;
--echo # MDEV-9372 select 100 between 1 and 9223372036854775808 returns false
--echo #
SELECT 100 BETWEEN 1 AND 9223372036854775808;
+
+--echo #
+--echo # MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615
+--echo #
+
+CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL);
+INSERT INTO t1 VALUES (0),(101),(255);
+SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1;
+DROP TABLE t1;
diff --git a/mysql-test/main/check.result b/mysql-test/main/check.result
index e3dcda773f4..e882a4cdbe6 100644
--- a/mysql-test/main/check.result
+++ b/mysql-test/main/check.result
@@ -85,3 +85,13 @@ t1 CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+create temporary table t1 (
+id int not null auto_increment primary key,
+f int not null default 0
+);
+insert into t1 () values ();
+alter ignore table t1 add constraint check (f > 0);
+Warnings:
+Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+alter table t1;
+drop table t1;
diff --git a/mysql-test/main/check.test b/mysql-test/main/check.test
index cce8fd34c9c..475a7996a09 100644
--- a/mysql-test/main/check.test
+++ b/mysql-test/main/check.test
@@ -103,3 +103,15 @@ CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+
+#
+# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table
+#
+create temporary table t1 (
+ id int not null auto_increment primary key,
+ f int not null default 0
+);
+insert into t1 () values ();
+alter ignore table t1 add constraint check (f > 0);
+alter table t1;
+drop table t1;
diff --git a/mysql-test/main/column_compression_parts.result b/mysql-test/main/column_compression_parts.result
index e0b54aec20c..bc3028826ee 100644
--- a/mysql-test/main/column_compression_parts.result
+++ b/mysql-test/main/column_compression_parts.result
@@ -12,6 +12,7 @@ INSERT INTO t1 VALUES (1,REPEAT('a',100)),(2,REPEAT('v',200)),(3,REPEAT('r',300)
INSERT INTO t1 VALUES (5,REPEAT('k',500)),(6,'April'),(7,7),(8,""),(9,"M"),(10,DEFAULT);
ALTER TABLE t1 ANALYZE PARTITION p1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 CHECK PARTITION p2;
Table Op Msg_type Msg_text
diff --git a/mysql-test/main/column_compression_parts.test b/mysql-test/main/column_compression_parts.test
index 9a6f63d0cde..4c77a7308f7 100644
--- a/mysql-test/main/column_compression_parts.test
+++ b/mysql-test/main/column_compression_parts.test
@@ -179,4 +179,4 @@ ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (PARTITION p22 VALUES LESS THAN (MAX
SHOW CREATE TABLE t1;
ALTER TABLE t1 REBUILD PARTITION p22;
-DROP TABLE t1; \ No newline at end of file
+DROP TABLE t1;
diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result
index c52c9edd578..89e10d221d2 100644
--- a/mysql-test/main/connect.result
+++ b/mysql-test/main/connect.result
@@ -1,5 +1,4 @@
SET global secure_auth=0;
-drop table if exists t1,t2;
connect con1,localhost,root,,mysql;
show tables;
Tables_in_mysql
@@ -9,6 +8,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
@@ -56,6 +56,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
@@ -100,6 +101,14 @@ connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
update mysql.user set plugin="", authentication_string="", password=old_password("gambling2") where user=_binary"test";
flush privileges;
+show grants for test@localhost;
+Grants for test@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573'
+update mysql.user set plugin='mysql_old_password' where user='test';
+flush privileges;
+show grants for test@localhost;
+Grants for test@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573'
connect con10,localhost,test,gambling2,;
connect con5,localhost,test,gambling2,mysql;
set password="";
@@ -114,6 +123,7 @@ db
event
func
general_log
+global_priv_bak
gtid_slave_pos
help_category
help_keyword
@@ -138,6 +148,7 @@ time_zone_transition
time_zone_transition_type
transaction_registry
user
+user_bak
connect con6,localhost,test,gambling3,test;
show tables;
Tables_in_test
@@ -158,7 +169,6 @@ connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
delete from mysql.user where user=_binary"test";
-flush privileges;
connect con7,localhost,root,,test;
create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key);
@@ -358,8 +368,8 @@ update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2';
select user, password, plugin, authentication_string from mysql.user
where user like 'mysqltest_up_';
user password plugin authentication_string
-mysqltest_up1 mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
-mysqltest_up2 mysql_old_password 09301740536db389
+mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
+mysqltest_up2 09301740536db389 mysql_old_password 09301740536db389
flush privileges;
connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
select user(), current_user();
@@ -383,7 +393,6 @@ drop table t1;
create table t1 (col1 int);
alter table t1 add via int not null;
drop table t1;
-drop procedure if exists p1;
create procedure p1(x int)
foo: loop
if x = 0 then
diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test
index 9bc067f3236..b0461a5afac 100644
--- a/mysql-test/main/connect.test
+++ b/mysql-test/main/connect.test
@@ -14,10 +14,6 @@
SET global secure_auth=0;
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
#connect (con1,localhost,root,,"");
#show tables;
connect (con1,localhost,root,,mysql);
@@ -66,8 +62,13 @@ connect (fail_con,localhost,test,zorro,test2);
connect (fail_con,localhost,test,zorro,);
# check if old password version also works
+source include/switch_to_mysql_user.inc;
update mysql.user set plugin="", authentication_string="", password=old_password("gambling2") where user=_binary"test";
flush privileges;
+show grants for test@localhost;
+update mysql.user set plugin='mysql_old_password' where user='test';
+flush privileges;
+show grants for test@localhost;
connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql);
@@ -97,11 +98,10 @@ connect (fail_con,localhost,test,zorro,test2);
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
-
+source include/switch_to_mysql_global_priv.inc;
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
delete from mysql.user where user=_binary"test";
-flush privileges;
#
# Bug#12517 Clear user variables and replication events before
@@ -251,11 +251,8 @@ let $wait_condition =
--echo
--echo # -- Waiting for connections to close...
-let $wait_condition =
- SELECT COUNT(*) = 1
- FROM information_schema.processlist
- WHERE db = 'test';
---source include/wait_condition.inc
+let $count_sessions=1;
+--source include/wait_until_count_sessions.inc
--echo
DROP USER mysqltest_u1@localhost;
@@ -406,6 +403,7 @@ connection default;
#
# cannot connect when password is set and plugin=mysql_native_password
#
+source include/switch_to_mysql_user.inc;
update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1';
update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2';
select user, password, plugin, authentication_string from mysql.user
@@ -421,13 +419,14 @@ select user(), current_user();
disconnect pcon7;
connection default;
+source include/switch_to_mysql_global_priv.inc;
+
DROP USER mysqltest_up1@'%';
DROP USER mysqltest_up2@'%';
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
-
--echo #
--echo # BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore
--echo #
@@ -439,10 +438,6 @@ create table t1 (col1 int);
alter table t1 add via int not null;
drop table t1;
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-
delimiter |;
create procedure p1(x int)
foo: loop
@@ -457,6 +452,4 @@ delimiter ;|
call p1(2);
drop procedure p1;
-
-
SET global secure_auth=default;
diff --git a/mysql-test/main/create-big.result b/mysql-test/main/create-big.result
index d041419443e..fc29b08ffb8 100644
--- a/mysql-test/main/create-big.result
+++ b/mysql-test/main/create-big.result
@@ -237,11 +237,11 @@ select @a;
@a
0
drop table t1;
-set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
-create table if not exists t1 select 1 as i;;
+set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go';
+create table if not exists t1 select 1 as i;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
-drop table t1;;
+drop table t1;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
@@ -249,11 +249,11 @@ connection addconroot1;
connection default;
create table t1 (i int);
set @a:=0;
-set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
-create table if not exists t1 select 1 as i;;
+set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go';
+create table if not exists t1 select 1 as i;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
-create trigger t1_bi before insert on t1 for each row set @a:=1;;
+create trigger t1_bi before insert on t1 for each row set @a:=1;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
diff --git a/mysql-test/main/create-big.test b/mysql-test/main/create-big.test
index 7f20a8b42af..82a4dd82a32 100644
--- a/mysql-test/main/create-big.test
+++ b/mysql-test/main/create-big.test
@@ -395,11 +395,11 @@ select @a;
drop table t1;
# Concurrent DROP TABLE
-set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
---send create table if not exists t1 select 1 as i;
+set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go';
+--send create table if not exists t1 select 1 as i
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
---send drop table t1;
+--send drop table t1
connection addconroot2;
# Wait until the above DROP TABLE is blocked due to CREATE TABLE
let $wait_condition=
@@ -417,11 +417,11 @@ connection default;
# Concurrent CREATE TRIGGER
create table t1 (i int);
set @a:=0;
-set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
---send create table if not exists t1 select 1 as i;
+set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go';
+--send create table if not exists t1 select 1 as i
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
---send create trigger t1_bi before insert on t1 for each row set @a:=1;
+--send create trigger t1_bi before insert on t1 for each row set @a:=1
connection addconroot2;
# Wait until the above DROP TABLE is blocked due to CREATE TABLE
let $wait_condition=
diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result
index dc34185ad2e..ea9014498e0 100644
--- a/mysql-test/main/create.result
+++ b/mysql-test/main/create.result
@@ -404,7 +404,7 @@ create table t3 like mysqltest.t3;
ERROR 42S01: Table 't3' already exists
create table non_existing_database.t1 like t1;
ERROR 42000: Unknown database 'non_existing_database'
-create table t3 like non_existing_table;
+create table t4 like non_existing_table;
ERROR 42S02: Table 'test.non_existing_table' doesn't exist
create temporary table t3 like t1;
ERROR 42S01: Table 't3' already exists
@@ -914,8 +914,12 @@ unlock tables;
lock table t1 read, t2 read;
create table t2 select * from t1;
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+create table t3 select * from t1;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
create table if not exists t2 select * from t1;
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+create table if not exists t3 select * from t1;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
unlock tables;
lock table t1 read, t2 write;
create table t2 select * from t1;
@@ -1053,95 +1057,6 @@ USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
-set names utf8;
-create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
-use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
-select database();
-database()
-имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45
-use test;
-select SCHEMA_NAME from information_schema.schemata
-where schema_name='имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45';
-SCHEMA_NAME
-имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45
-drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
-create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
-(
-имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45 int,
-index имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48 (имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45)
-);
-create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42 as
-select имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
-from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-select * from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
-select TABLE_NAME from information_schema.tables where
-table_schema='test';
-TABLE_NAME
-имÑ_вью_кодировке_утф8_длиной_больше_чем_42
-имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
-select COLUMN_NAME from information_schema.columns where
-table_schema='test';
-COLUMN_NAME
-имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
-имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
-select INDEX_NAME from information_schema.statistics where
-table_schema='test';
-INDEX_NAME
-имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48
-select TABLE_NAME from information_schema.views where
-table_schema='test';
-TABLE_NAME
-имÑ_вью_кодировке_утф8_длиной_больше_чем_42
-show create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-Table Create Table
-имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 CREATE TABLE `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48` (
- `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` int(11) DEFAULT NULL,
- KEY `имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48` (`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-show create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
-View Create View character_set_client collation_connection
-имÑ_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имÑ_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` AS `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` from `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48` utf8 utf8_general_ci
-create trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
-before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
-select TRIGGER_NAME from information_schema.triggers where
-trigger_schema='test';
-TRIGGER_NAME
-имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
-drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49;
-create trigger
-очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
-before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
-drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
-create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
-begin
-end;
-select ROUTINE_NAME from information_schema.routines where
-routine_schema='test';
-ROUTINE_NAME
-имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50
-drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
-create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
-begin
-end;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
-create function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49()
-returns int
-return 0;
-select ROUTINE_NAME from information_schema.routines where
-routine_schema='test';
-ROUTINE_NAME
-имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49
-drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49;
-create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
-returns int
-return 0;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
-drop view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
-drop table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-set names default;
drop table if exists t1,t2,t3;
drop function if exists f1;
create function f1() returns int
@@ -1249,7 +1164,7 @@ INSERT INTO t3 VALUES (0);
SET sql_mode = TRADITIONAL;
ALTER TABLE t3 ADD INDEX(c1);
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'c1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t3`.`c1` at row 1
# -- Cleanup.
SET sql_mode = '';
@@ -1807,12 +1722,12 @@ NULL 0000-00-00 0000-00-00
drop table t1;
set @@session.sql_mode='STRICT_ALL_TABLES';
create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
-ERROR 22007: Incorrect date value: '1' for column 'b' at row 1
+ERROR 22007: Incorrect date value: '1' for column `test`.`t1`.`b` at row 1
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
create table if not exists t1 (a int, b date, c date)
replace select 1 as b, 2 as c;
-ERROR 22007: Incorrect date value: '1' for column 'b' at row 1
+ERROR 22007: Incorrect date value: '1' for column `test`.`t1`.`b` at row 1
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
create table if not exists t1 (a int, b date, c date)
diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test
index af5c427852c..4bf6ce99504 100644
--- a/mysql-test/main/create.test
+++ b/mysql-test/main/create.test
@@ -323,7 +323,7 @@ create table t3 like mysqltest.t3;
--error 1049
create table non_existing_database.t1 like t1;
--error ER_NO_SUCH_TABLE
-create table t3 like non_existing_table;
+create table t4 like non_existing_table;
--error 1050
create temporary table t3 like t1;
drop table t1, t2, t3;
@@ -768,7 +768,6 @@ drop table t1;
--error ER_CANT_AGGREGATE_2COLLATIONS
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
-
# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
# results of CREATE TABLE ... SELECT when temporary table exists").
# In this situation we either have to create non-temporary table and
@@ -776,6 +775,7 @@ create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1
# permanent table. After patch for Bug#47418, we create the base table and
# instert data into it, even though a temporary table exists with the same
# name.
+
create temporary table t1 (j int);
create table if not exists t1 select 1;
select * from t1;
@@ -783,7 +783,6 @@ drop temporary table t1;
select * from t1;
drop table t1;
-
#
# CREATE TABLE ... SELECT and LOCK TABLES
#
@@ -792,6 +791,7 @@ drop table t1;
# the server doesn't crash, hang and produces sensible errors.
# Includes test for bug #20662 "Infinite loop in CREATE TABLE
# IF NOT EXISTS ... SELECT with locked tables".
+
create table t1 (i int);
insert into t1 values (1), (2);
lock tables t1 read;
@@ -812,8 +812,12 @@ unlock tables;
lock table t1 read, t2 read;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create table t2 select * from t1;
+--error ER_TABLE_NOT_LOCKED
+create table t3 select * from t1;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create table if not exists t2 select * from t1;
+--error ER_TABLE_NOT_LOCKED
+create table if not exists t3 select * from t1;
unlock tables;
lock table t1 read, t2 write;
--error ER_TABLE_EXISTS_ERROR
@@ -991,87 +995,6 @@ USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
#
-# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
-#
-set names utf8;
-
-create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
-use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
-select database();
-use test;
-
-select SCHEMA_NAME from information_schema.schemata
-where schema_name='имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45';
-
-drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
-create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
-(
- имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45 int,
- index имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48 (имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45)
-);
-
-create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42 as
-select имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
-from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-
-# database, table, field, key, view
-select * from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-
---sorted_result
-select TABLE_NAME from information_schema.tables where
-table_schema='test';
-
-select COLUMN_NAME from information_schema.columns where
-table_schema='test';
-
-select INDEX_NAME from information_schema.statistics where
-table_schema='test';
-
-select TABLE_NAME from information_schema.views where
-table_schema='test';
-
-show create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-show create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
-
-create trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
-before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
-select TRIGGER_NAME from information_schema.triggers where
-trigger_schema='test';
-drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49;
---error 1059
-create trigger
-очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
-before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
---error 1059
-drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66;
-
-create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
-begin
-end;
-select ROUTINE_NAME from information_schema.routines where
-routine_schema='test';
-drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
---error 1059
-create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
-begin
-end;
-
-create function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49()
- returns int
-return 0;
-select ROUTINE_NAME from information_schema.routines where
-routine_schema='test';
-drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49;
---error 1059
-create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
- returns int
-return 0;
-
-drop view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
-drop table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-set names default;
-
-#
# Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crash
#
diff --git a/mysql-test/main/create_drop_binlog.result b/mysql-test/main/create_drop_binlog.result
index be40fcc140a..b8f8b61c359 100644
--- a/mysql-test/main/create_drop_binlog.result
+++ b/mysql-test/main/create_drop_binlog.result
@@ -322,8 +322,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
# # Gtid 1 # GTID #-#-#
# # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT)
# # Gtid 1 # GTID #-#-#
-# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT)
-# # Gtid 1 # GTID #-#-#
# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a)
# # Gtid 1 # GTID #-#-#
# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a)
@@ -377,8 +375,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
# # Gtid 1 # GTID #-#-#
# # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT)
# # Gtid 1 # GTID #-#-#
-# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT)
-# # Gtid 1 # GTID #-#-#
# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a)
# # Gtid 1 # GTID #-#-#
# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a)
diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result
index 54bec5c3f9d..485091e5810 100644
--- a/mysql-test/main/create_or_replace.result
+++ b/mysql-test/main/create_or_replace.result
@@ -257,12 +257,13 @@ drop table if exists test.t1,mysqltest2.t2;
Warnings:
Note 1051 Unknown table 'test.t1'
Note 1051 Unknown table 'mysqltest2.t2'
-create table test.t1 (i int);
+create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
@@ -274,7 +275,8 @@ Tables_in_test
t2
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
@@ -289,7 +291,8 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
@@ -301,7 +304,8 @@ Tables_in_test
t2
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
@@ -311,6 +315,31 @@ select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
create table t1 (i int);
drop table t1;
+create table test.t1 (i int) engine=innodb;
+create table mysqltest2.t2 like test.t1;
+lock table test.t1 write, mysqltest2.t2 write;
+select * from information_schema.metadata_lock_info;
+THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
+# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
+# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
+# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
+unlock tables;
+drop table test.t1,mysqltest2.t2;
+create table test.t1 (i int) engine=aria transactional=1 checksum=1;
+create table mysqltest2.t2 like test.t1;
+lock table test.t1 write, mysqltest2.t2 write;
+select * from information_schema.metadata_lock_info;
+THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
+# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
+# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
+# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
+unlock tables;
+drop table t1;
+create table test.t1 (i int);
drop database mysqltest2;
#
# Testing CREATE .. LIKE
@@ -398,28 +427,32 @@ create table t1 (a int);
lock table t1 write, t2 read;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
# MDL_SHARED_READ NULL Table metadata lock test t2
create or replace table t1 (i int);
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
# MDL_SHARED_READ NULL Table metadata lock test t2
create or replace table t1 like t2;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
# MDL_SHARED_READ NULL Table metadata lock test t2
create or replace table t1 select 1 as f1;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-# MDL_INTENTION_EXCLUSIVE NULL Global read lock
+# MDL_BACKUP_DDL NULL Backup lock
+# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
# MDL_SHARED_READ NULL Table metadata lock test t2
diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test
index 4b167663742..1b4994e811f 100644
--- a/mysql-test/main/create_or_replace.test
+++ b/mysql-test/main/create_or_replace.test
@@ -210,7 +210,7 @@ drop table t1,t3,t4;
create database mysqltest2;
drop table if exists test.t1,mysqltest2.t2;
-create table test.t1 (i int);
+create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 #
@@ -249,6 +249,26 @@ create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a';
select * from information_schema.metadata_lock_info;
create table t1 (i int);
drop table t1;
+
+create table test.t1 (i int) engine=innodb;
+create table mysqltest2.t2 like test.t1;
+lock table test.t1 write, mysqltest2.t2 write;
+--replace_column 1 #
+--sorted_result
+select * from information_schema.metadata_lock_info;
+unlock tables;
+drop table test.t1,mysqltest2.t2;
+
+create table test.t1 (i int) engine=aria transactional=1 checksum=1;
+create table mysqltest2.t2 like test.t1;
+lock table test.t1 write, mysqltest2.t2 write;
+--replace_column 1 #
+--sorted_result
+select * from information_schema.metadata_lock_info;
+unlock tables;
+drop table t1;
+
+create table test.t1 (i int);
drop database mysqltest2;
--echo #
diff --git a/mysql-test/main/create_user.result b/mysql-test/main/create_user.result
index bd10c6aba3b..8bd0ca88335 100644
--- a/mysql-test/main/create_user.result
+++ b/mysql-test/main/create_user.result
@@ -6,45 +6,45 @@ drop user foo;
create user foo identified by 'password';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo identified by 'password' require SSL;
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ANY 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ANY 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo identified by 'password' require X509;
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N X509 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N X509 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo identified by 'password' require CIPHER 'cipher';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo identified by 'password' require ISSUER 'issuer';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED issuer 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED issuer 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo identified by 'password' require SUBJECT 'subject';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo identified by 'password' require CIPHER 'cipher'
SUBJECT 'subject';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo identified by 'password' require CIPHER 'cipher'
AND SUBJECT 'subject'
AND ISSUER 'issuer';
select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
-% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000
drop user foo;
create user foo, foo2 identified by 'password' require CIPHER 'cipher'
AND SUBJECT 'subject'
diff --git a/mysql-test/main/create_utf8.result b/mysql-test/main/create_utf8.result
new file mode 100644
index 00000000000..e1ccf7a08d7
--- /dev/null
+++ b/mysql-test/main/create_utf8.result
@@ -0,0 +1,89 @@
+set names utf8;
+create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+select database();
+database()
+имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45
+use test;
+select SCHEMA_NAME from information_schema.schemata
+where schema_name='имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45';
+SCHEMA_NAME
+имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45
+drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
+(
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45 int,
+index имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48 (имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45)
+);
+create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42 as
+select имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+select * from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+select TABLE_NAME from information_schema.tables where
+table_schema='test';
+TABLE_NAME
+имÑ_вью_кодировке_утф8_длиной_больше_чем_42
+имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
+select COLUMN_NAME from information_schema.columns where
+table_schema='test';
+COLUMN_NAME
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+select INDEX_NAME from information_schema.statistics where
+table_schema='test';
+INDEX_NAME
+имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48
+select TABLE_NAME from information_schema.views where
+table_schema='test';
+TABLE_NAME
+имÑ_вью_кодировке_утф8_длиной_больше_чем_42
+show create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+Table Create Table
+имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 CREATE TABLE `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48` (
+ `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` int(11) DEFAULT NULL,
+ KEY `имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48` (`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+View Create View character_set_client collation_connection
+имÑ_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имÑ_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` AS `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` from `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48` utf8 utf8_general_ci
+create trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+select TRIGGER_NAME from information_schema.triggers where
+trigger_schema='test';
+TRIGGER_NAME
+имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
+drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49;
+create trigger
+очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
+begin
+end;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+ROUTINE_NAME
+имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50
+drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
+create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+begin
+end;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+create function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49()
+returns int
+return 0;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+ROUTINE_NAME
+имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49
+drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49;
+create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+returns int
+return 0;
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+drop view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+drop table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+set names default;
diff --git a/mysql-test/main/create_utf8.test b/mysql-test/main/create_utf8.test
new file mode 100644
index 00000000000..40e814834bc
--- /dev/null
+++ b/mysql-test/main/create_utf8.test
@@ -0,0 +1,80 @@
+#
+# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
+#
+set names utf8;
+
+create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+select database();
+use test;
+
+select SCHEMA_NAME from information_schema.schemata
+where schema_name='имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45';
+
+drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48
+(
+ имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45 int,
+ index имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48 (имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45)
+);
+
+create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42 as
+select имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45
+from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+
+# database, table, field, key, view
+select * from имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+
+--sorted_result
+select TABLE_NAME from information_schema.tables where
+table_schema='test';
+
+select COLUMN_NAME from information_schema.columns where
+table_schema='test';
+
+select INDEX_NAME from information_schema.statistics where
+table_schema='test';
+
+select TABLE_NAME from information_schema.views where
+table_schema='test';
+
+show create table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+show create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+
+create trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+select TRIGGER_NAME from information_schema.triggers where
+trigger_schema='test';
+drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49;
+--error 1059
+create trigger
+очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
+before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
+--error 1059
+drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66;
+
+create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
+begin
+end;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
+--error 1059
+create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+begin
+end;
+
+create function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49()
+ returns int
+return 0;
+select ROUTINE_NAME from information_schema.routines where
+routine_schema='test';
+drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49;
+--error 1059
+create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
+ returns int
+return 0;
+
+drop view имÑ_вью_кодировке_утф8_длиной_больше_чем_42;
+drop table имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
+set names default;
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index 9e934b19efc..f2ae9929145 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -1608,6 +1608,44 @@ id name dob father mother
8 Grandpa Ben 1940-10-21 NULL NULL
6 Grandgrandma Martha 1923-05-17 NULL NULL
drop table my_ancestors;
+WITH RECURSIVE
+positions(i) AS (
+VALUES(0)
+UNION SELECT ALL
+i+1 FROM positions WHERE i < 4*4-1
+),
+solutions(board, n_queens) AS (
+SELECT REPEAT('-', 4*4), 0
+FROM positions
+UNION
+SELECT
+concat(substr(board, 1, i),'*',substr(board, i+2)),n_queens + 1 AS n_queens
+FROM positions AS ps, solutions
+WHERE n_queens < 4
+AND substr(board,1,i) != '*'
+ AND NOT EXISTS (
+SELECT 1 FROM positions WHERE
+substr(board,i+1,1) = '*' AND
+(
+i % 4 = ps.i % 4 OR
+i div 4 = ps.i div 4 OR
+i div 4 + (i % 4) = ps.i div 4 + (ps.i % 4) OR
+i div 4 - (i % 4) = ps.i div 4 - (ps.i % 4)
+)
+)
+)
+SELECT regexp_replace(board,concat('(',REPEAT('.', 4),')'),'\\1\n') n_queens FROM solutions WHERE n_queens = 4;
+n_queens
+-*--
+---*
+*---
+--*-
+
+--*-
+*---
+---*
+-*--
+
#
# MDEV-10883: execution of prepared statement from SELECT
# with recursive CTE that renames columns
@@ -3606,6 +3644,54 @@ Mandelbrot Set
..............................................................................
...........................................................................
........................................................................
+#
+# MDEV-17871: EXPLAIN for query with not used recursive cte
+#
+create table t1 (a int);
+insert into t1 values (2), (1), (4), (3);
+explain extended
+with recursive cte as
+(select * from t1 where a=1 union select a+1 from cte where a<3)
+select * from cte as t;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00 Using where
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 with recursive cte as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union /* select#3 */ select `cte`.`a` + 1 AS `a+1` from `cte` where `cte`.`a` < 3)/* select#1 */ select `t`.`a` AS `a` from `cte` `t`
+with recursive cte as
+(select * from t1 where a=1 union select a+1 from cte where a<3)
+select * from cte as t;
+a
+1
+2
+3
+explain extended
+with recursive cte as
+(select * from t1 where a=1 union select a+1 from cte where a<3)
+select * from t1 as t;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00
+Warnings:
+Note 1003 with recursive cte as (/* select#2 */ select `*` AS `*` from `test`.`t1` where `a` = 1 union /* select#3 */ select `a` + 1 AS `a+1` from `cte` where `a` < 3)/* select#1 */ select `test`.`t`.`a` AS `a` from `test`.`t1` `t`
+with recursive cte as
+(select * from t1 where a=1 union select a+1 from cte where a<3)
+select * from t1 as t;
+a
+2
+1
+4
+3
+create table t2 ( i1 int, i2 int);
+insert into t2 values (1,1),(2,2);
+explain
+with recursive cte as
+( select * from t1 union select s1.* from t1 as s1, cte where s1.i1 = cte.i2 )
+select * from t1 as t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 4
+drop table t1,t2;
# End of 10.2 tests
#
# MDEV-14217 [db crash] Recursive CTE when SELECT includes new field
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index 79809044c00..483e1ea8c7a 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -1200,6 +1200,40 @@ select * from my_ancestors;
drop table my_ancestors;
+#
+# MDEV-17967 Add a solution of the 8 queens problem to the regression test for CTE
+#
+# adapted to MariaDB from https://rosettacode.org/wiki/N-queens_problem#SQL
+#
+let $N=4; # 8 takes too long for a test
+eval WITH RECURSIVE
+ positions(i) AS (
+ VALUES(0)
+ UNION SELECT ALL
+ i+1 FROM positions WHERE i < $N*$N-1
+ ),
+ solutions(board, n_queens) AS (
+ SELECT REPEAT('-', $N*$N), 0
+ FROM positions
+ UNION
+ SELECT
+ concat(substr(board, 1, i),'*',substr(board, i+2)),n_queens + 1 AS n_queens
+ FROM positions AS ps, solutions
+ WHERE n_queens < $N
+ AND substr(board,1,i) != '*'
+ AND NOT EXISTS (
+ SELECT 1 FROM positions WHERE
+ substr(board,i+1,1) = '*' AND
+ (
+ i % $N = ps.i % $N OR
+ i div $N = ps.i div $N OR
+ i div $N + (i % $N) = ps.i div $N + (ps.i % $N) OR
+ i div $N - (i % $N) = ps.i div $N - (ps.i % $N)
+ )
+ )
+ )
+SELECT regexp_replace(board,concat('(',REPEAT('.', $N),')'),'\\\\1\\n') n_queens FROM solutions WHERE n_queens = $N;
+
--echo #
--echo # MDEV-10883: execution of prepared statement from SELECT
--echo # with recursive CTE that renames columns
@@ -2496,6 +2530,45 @@ SELECT GROUP_CONCAT(
GROUP BY Iy
ORDER BY Iy;
+--echo #
+--echo # MDEV-17871: EXPLAIN for query with not used recursive cte
+--echo #
+
+create table t1 (a int);
+insert into t1 values (2), (1), (4), (3);
+
+let $rec_cte =
+with recursive cte as
+ (select * from t1 where a=1 union select a+1 from cte where a<3);
+
+eval
+explain extended
+$rec_cte
+select * from cte as t;
+
+eval
+$rec_cte
+select * from cte as t;
+
+eval
+explain extended
+$rec_cte
+select * from t1 as t;
+
+eval
+$rec_cte
+select * from t1 as t;
+
+create table t2 ( i1 int, i2 int);
+insert into t2 values (1,1),(2,2);
+
+explain
+with recursive cte as
+ ( select * from t1 union select s1.* from t1 as s1, cte where s1.i1 = cte.i2 )
+select * from t1 as t;
+
+drop table t1,t2;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result
index 2db4da51667..f61fc4c8400 100644
--- a/mysql-test/main/ctype_big5.result
+++ b/mysql-test/main/ctype_big5.result
@@ -565,70 +565,70 @@ COUNT(*)
28672
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1 WHERE a<>'?';
COUNT(*)
13973
diff --git a/mysql-test/main/ctype_cp932_binlog_stm.result b/mysql-test/main/ctype_cp932_binlog_stm.result
index f49400b63ff..089820d628a 100644
--- a/mysql-test/main/ctype_cp932_binlog_stm.result
+++ b/mysql-test/main/ctype_cp932_binlog_stm.result
@@ -98,70 +98,70 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1;
COUNT(*)
14623
diff --git a/mysql-test/main/ctype_eucjpms.result b/mysql-test/main/ctype_eucjpms.result
index 507d0021a1f..be341cc7e68 100644
--- a/mysql-test/main/ctype_eucjpms.result
+++ b/mysql-test/main/ctype_eucjpms.result
@@ -10042,70 +10042,70 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1;
COUNT(*)
56959
diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result
index cc50ddd20be..3006e77412a 100644
--- a/mysql-test/main/ctype_euckr.result
+++ b/mysql-test/main/ctype_euckr.result
@@ -389,22 +389,22 @@ insert into t1 values (0xA181);
insert into t1 values (0xA1FE);
insert ignore into t1 values (0xA140);
Warnings:
-Warning 1366 Incorrect string value: '\xA1@' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xA1@' for column `test`.`t1`.`s1` at row 1
insert ignore into t1 values (0xA15B);
Warnings:
-Warning 1366 Incorrect string value: '\xA1[' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xA1[' for column `test`.`t1`.`s1` at row 1
insert ignore into t1 values (0xA160);
Warnings:
-Warning 1366 Incorrect string value: '\xA1`' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xA1`' for column `test`.`t1`.`s1` at row 1
insert ignore into t1 values (0xA17B);
Warnings:
-Warning 1366 Incorrect string value: '\xA1{' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xA1{' for column `test`.`t1`.`s1` at row 1
insert ignore into t1 values (0xA180);
Warnings:
-Warning 1366 Incorrect string value: '\xA1\x80' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xA1\x80' for column `test`.`t1`.`s1` at row 1
insert ignore into t1 values (0xA1FF);
Warnings:
-Warning 1366 Incorrect string value: '\xA1\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xA1\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1;
hex(s1) hex(convert(s1 using utf8))
3F3F 3F3F
@@ -24428,70 +24428,70 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1 WHERE a<>'?';
COUNT(*)
22428
diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result
index c3c2eee9b1c..8a0950caea8 100644
--- a/mysql-test/main/ctype_gb2312.result
+++ b/mysql-test/main/ctype_gb2312.result
@@ -489,70 +489,70 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1 WHERE a<>'?';
COUNT(*)
8178
diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result
index 4515b9fbdbf..9bf69584725 100644
--- a/mysql-test/main/ctype_gbk.result
+++ b/mysql-test/main/ctype_gbk.result
@@ -515,70 +515,70 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1 WHERE a<>'?';
COUNT(*)
23940
@@ -5196,25 +5196,25 @@ INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
WHERE type1='tail' OR type1='bad' OR type2='bad'
ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 1
-Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 2
-Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 3
-Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 4
-Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 5
-Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 6
-Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 7
-Warning 1366 Incorrect string value: '\x80\xFF' for column 'c' at row 8
-Warning 1366 Incorrect string value: '\x81\xFF' for column 'c' at row 9
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 10
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 11
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 12
-Warning 1366 Incorrect string value: '\xFF@' for column 'c' at row 13
-Warning 1366 Incorrect string value: '\xFF\x80' for column 'c' at row 14
-Warning 1366 Incorrect string value: '\xFF\x81' for column 'c' at row 15
-Warning 1366 Incorrect string value: '\xFF\xA1@' for column 'c' at row 16
-Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column 'c' at row 17
-Warning 1366 Incorrect string value: '\xFF\xFE@' for column 'c' at row 18
-Warning 1366 Incorrect string value: '\xFF\xFF' for column 'c' at row 19
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 1
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 2
+Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 3
+Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 4
+Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 5
+Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 6
+Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 7
+Warning 1366 Incorrect string value: '\x80\xFF' for column `test`.`t3`.`c` at row 8
+Warning 1366 Incorrect string value: '\x81\xFF' for column `test`.`t3`.`c` at row 9
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 10
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 11
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 12
+Warning 1366 Incorrect string value: '\xFF@' for column `test`.`t3`.`c` at row 13
+Warning 1366 Incorrect string value: '\xFF\x80' for column `test`.`t3`.`c` at row 14
+Warning 1366 Incorrect string value: '\xFF\x81' for column `test`.`t3`.`c` at row 15
+Warning 1366 Incorrect string value: '\xFF\xA1@' for column `test`.`t3`.`c` at row 16
+Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column `test`.`t3`.`c` at row 17
+Warning 1366 Incorrect string value: '\xFF\xFE@' for column `test`.`t3`.`c` at row 18
+Warning 1366 Incorrect string value: '\xFF\xFF' for column `test`.`t3`.`c` at row 19
SELECT COUNT(*) FROM t3;
COUNT(*)
19
@@ -5252,14 +5252,14 @@ WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1))
AND (FIND_IN_SET('tail',type2) AND NOT FIND_IN_SET('ascii',type2))
ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 1
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 2
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 3
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 4
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 5
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 7
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 8
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 1
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 2
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 3
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 4
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 5
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 6
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 7
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 8
SELECT COUNT(*) FROM t3;
COUNT(*)
8
@@ -5282,7 +5282,7 @@ DELETE FROM t3;
#
INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 5
+Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 5
SELECT COUNT(*) FROM t3;
COUNT(*)
6
@@ -5405,70 +5405,70 @@ INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
WHERE type1='tail' OR type1='bad' OR type2='bad' OR type3='bad'
ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 1
-Warning 1366 Incorrect string value: '\x80\xFF' for column 'c' at row 2
-Warning 1366 Incorrect string value: '\x81\xFF' for column 'c' at row 3
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 4
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 5
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 6
-Warning 1366 Incorrect string value: '\xFF@' for column 'c' at row 7
-Warning 1366 Incorrect string value: '\xFF\x80' for column 'c' at row 8
-Warning 1366 Incorrect string value: '\xFF\x81' for column 'c' at row 9
-Warning 1366 Incorrect string value: '\xFF\xA1@' for column 'c' at row 10
-Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column 'c' at row 11
-Warning 1366 Incorrect string value: '\xFF\xFE@' for column 'c' at row 12
-Warning 1366 Incorrect string value: '\xFF\xFF' for column 'c' at row 13
-Warning 1366 Incorrect string value: '\x80@@' for column 'c' at row 14
-Warning 1366 Incorrect string value: '\x80@\x80' for column 'c' at row 15
-Warning 1366 Incorrect string value: '\x80@\x81' for column 'c' at row 16
-Warning 1366 Incorrect string value: '\x80@\xA1@' for column 'c' at row 17
-Warning 1366 Incorrect string value: '\x80@\xA1\xA3' for column 'c' at row 18
-Warning 1366 Incorrect string value: '\x80@\xFE@' for column 'c' at row 19
-Warning 1366 Incorrect string value: '\x80@\xFF' for column 'c' at row 20
-Warning 1366 Incorrect string value: '\x80\x80@' for column 'c' at row 21
-Warning 1366 Incorrect string value: '\x80\x80\x80' for column 'c' at row 22
-Warning 1366 Incorrect string value: '\x80\x80\x81' for column 'c' at row 23
-Warning 1366 Incorrect string value: '\x80\x80\xA1@' for column 'c' at row 24
-Warning 1366 Incorrect string value: '\x80\x80\xA1\xA3' for column 'c' at row 25
-Warning 1366 Incorrect string value: '\x80\x80\xFE@' for column 'c' at row 26
-Warning 1366 Incorrect string value: '\x80\x80\xFF' for column 'c' at row 27
-Warning 1366 Incorrect string value: '\x80\x81@' for column 'c' at row 28
-Warning 1366 Incorrect string value: '\x80\x81\x80' for column 'c' at row 29
-Warning 1366 Incorrect string value: '\x80\x81\x81' for column 'c' at row 30
-Warning 1366 Incorrect string value: '\x80\x81\xA1@' for column 'c' at row 31
-Warning 1366 Incorrect string value: '\x80\x81\xA1\xA3' for column 'c' at row 32
-Warning 1366 Incorrect string value: '\x80\x81\xFE@' for column 'c' at row 33
-Warning 1366 Incorrect string value: '\x80\x81\xFF' for column 'c' at row 34
-Warning 1366 Incorrect string value: '\x80\xA1@@' for column 'c' at row 35
-Warning 1366 Incorrect string value: '\x80\xA1@\x80' for column 'c' at row 36
-Warning 1366 Incorrect string value: '\x80\xA1@\x81' for column 'c' at row 37
-Warning 1366 Incorrect string value: '\x80\xA1@\xA1@' for column 'c' at row 38
-Warning 1366 Incorrect string value: '\x80\xA1@\xA1\xA3' for column 'c' at row 39
-Warning 1366 Incorrect string value: '\x80\xA1@\xFE@' for column 'c' at row 40
-Warning 1366 Incorrect string value: '\x80\xA1@\xFF' for column 'c' at row 41
-Warning 1366 Incorrect string value: '\x80\xA1\xA3@' for column 'c' at row 42
-Warning 1366 Incorrect string value: '\x80\xA1\xA3\x80' for column 'c' at row 43
-Warning 1366 Incorrect string value: '\x80\xA1\xA3\x81' for column 'c' at row 44
-Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1@' for column 'c' at row 45
-Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1\xA3' for column 'c' at row 46
-Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFE@' for column 'c' at row 47
-Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFF' for column 'c' at row 48
-Warning 1366 Incorrect string value: '\x80\xFE@@' for column 'c' at row 49
-Warning 1366 Incorrect string value: '\x80\xFE@\x80' for column 'c' at row 50
-Warning 1366 Incorrect string value: '\x80\xFE@\x81' for column 'c' at row 51
-Warning 1366 Incorrect string value: '\x80\xFE@\xA1@' for column 'c' at row 52
-Warning 1366 Incorrect string value: '\x80\xFE@\xA1\xA3' for column 'c' at row 53
-Warning 1366 Incorrect string value: '\x80\xFE@\xFE@' for column 'c' at row 54
-Warning 1366 Incorrect string value: '\x80\xFE@\xFF' for column 'c' at row 55
-Warning 1366 Incorrect string value: '\x80\xFF@' for column 'c' at row 56
-Warning 1366 Incorrect string value: '\x80\xFF\x80' for column 'c' at row 57
-Warning 1366 Incorrect string value: '\x80\xFF\x81' for column 'c' at row 58
-Warning 1366 Incorrect string value: '\x80\xFF\xA1@' for column 'c' at row 59
-Warning 1366 Incorrect string value: '\x80\xFF\xA1\xA3' for column 'c' at row 60
-Warning 1366 Incorrect string value: '\x80\xFF\xFE@' for column 'c' at row 61
-Warning 1366 Incorrect string value: '\x80\xFF\xFF' for column 'c' at row 62
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 63
-Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 64
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 1
+Warning 1366 Incorrect string value: '\x80\xFF' for column `test`.`t3`.`c` at row 2
+Warning 1366 Incorrect string value: '\x81\xFF' for column `test`.`t3`.`c` at row 3
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 4
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 5
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 6
+Warning 1366 Incorrect string value: '\xFF@' for column `test`.`t3`.`c` at row 7
+Warning 1366 Incorrect string value: '\xFF\x80' for column `test`.`t3`.`c` at row 8
+Warning 1366 Incorrect string value: '\xFF\x81' for column `test`.`t3`.`c` at row 9
+Warning 1366 Incorrect string value: '\xFF\xA1@' for column `test`.`t3`.`c` at row 10
+Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column `test`.`t3`.`c` at row 11
+Warning 1366 Incorrect string value: '\xFF\xFE@' for column `test`.`t3`.`c` at row 12
+Warning 1366 Incorrect string value: '\xFF\xFF' for column `test`.`t3`.`c` at row 13
+Warning 1366 Incorrect string value: '\x80@@' for column `test`.`t3`.`c` at row 14
+Warning 1366 Incorrect string value: '\x80@\x80' for column `test`.`t3`.`c` at row 15
+Warning 1366 Incorrect string value: '\x80@\x81' for column `test`.`t3`.`c` at row 16
+Warning 1366 Incorrect string value: '\x80@\xA1@' for column `test`.`t3`.`c` at row 17
+Warning 1366 Incorrect string value: '\x80@\xA1\xA3' for column `test`.`t3`.`c` at row 18
+Warning 1366 Incorrect string value: '\x80@\xFE@' for column `test`.`t3`.`c` at row 19
+Warning 1366 Incorrect string value: '\x80@\xFF' for column `test`.`t3`.`c` at row 20
+Warning 1366 Incorrect string value: '\x80\x80@' for column `test`.`t3`.`c` at row 21
+Warning 1366 Incorrect string value: '\x80\x80\x80' for column `test`.`t3`.`c` at row 22
+Warning 1366 Incorrect string value: '\x80\x80\x81' for column `test`.`t3`.`c` at row 23
+Warning 1366 Incorrect string value: '\x80\x80\xA1@' for column `test`.`t3`.`c` at row 24
+Warning 1366 Incorrect string value: '\x80\x80\xA1\xA3' for column `test`.`t3`.`c` at row 25
+Warning 1366 Incorrect string value: '\x80\x80\xFE@' for column `test`.`t3`.`c` at row 26
+Warning 1366 Incorrect string value: '\x80\x80\xFF' for column `test`.`t3`.`c` at row 27
+Warning 1366 Incorrect string value: '\x80\x81@' for column `test`.`t3`.`c` at row 28
+Warning 1366 Incorrect string value: '\x80\x81\x80' for column `test`.`t3`.`c` at row 29
+Warning 1366 Incorrect string value: '\x80\x81\x81' for column `test`.`t3`.`c` at row 30
+Warning 1366 Incorrect string value: '\x80\x81\xA1@' for column `test`.`t3`.`c` at row 31
+Warning 1366 Incorrect string value: '\x80\x81\xA1\xA3' for column `test`.`t3`.`c` at row 32
+Warning 1366 Incorrect string value: '\x80\x81\xFE@' for column `test`.`t3`.`c` at row 33
+Warning 1366 Incorrect string value: '\x80\x81\xFF' for column `test`.`t3`.`c` at row 34
+Warning 1366 Incorrect string value: '\x80\xA1@@' for column `test`.`t3`.`c` at row 35
+Warning 1366 Incorrect string value: '\x80\xA1@\x80' for column `test`.`t3`.`c` at row 36
+Warning 1366 Incorrect string value: '\x80\xA1@\x81' for column `test`.`t3`.`c` at row 37
+Warning 1366 Incorrect string value: '\x80\xA1@\xA1@' for column `test`.`t3`.`c` at row 38
+Warning 1366 Incorrect string value: '\x80\xA1@\xA1\xA3' for column `test`.`t3`.`c` at row 39
+Warning 1366 Incorrect string value: '\x80\xA1@\xFE@' for column `test`.`t3`.`c` at row 40
+Warning 1366 Incorrect string value: '\x80\xA1@\xFF' for column `test`.`t3`.`c` at row 41
+Warning 1366 Incorrect string value: '\x80\xA1\xA3@' for column `test`.`t3`.`c` at row 42
+Warning 1366 Incorrect string value: '\x80\xA1\xA3\x80' for column `test`.`t3`.`c` at row 43
+Warning 1366 Incorrect string value: '\x80\xA1\xA3\x81' for column `test`.`t3`.`c` at row 44
+Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1@' for column `test`.`t3`.`c` at row 45
+Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1\xA3' for column `test`.`t3`.`c` at row 46
+Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFE@' for column `test`.`t3`.`c` at row 47
+Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFF' for column `test`.`t3`.`c` at row 48
+Warning 1366 Incorrect string value: '\x80\xFE@@' for column `test`.`t3`.`c` at row 49
+Warning 1366 Incorrect string value: '\x80\xFE@\x80' for column `test`.`t3`.`c` at row 50
+Warning 1366 Incorrect string value: '\x80\xFE@\x81' for column `test`.`t3`.`c` at row 51
+Warning 1366 Incorrect string value: '\x80\xFE@\xA1@' for column `test`.`t3`.`c` at row 52
+Warning 1366 Incorrect string value: '\x80\xFE@\xA1\xA3' for column `test`.`t3`.`c` at row 53
+Warning 1366 Incorrect string value: '\x80\xFE@\xFE@' for column `test`.`t3`.`c` at row 54
+Warning 1366 Incorrect string value: '\x80\xFE@\xFF' for column `test`.`t3`.`c` at row 55
+Warning 1366 Incorrect string value: '\x80\xFF@' for column `test`.`t3`.`c` at row 56
+Warning 1366 Incorrect string value: '\x80\xFF\x80' for column `test`.`t3`.`c` at row 57
+Warning 1366 Incorrect string value: '\x80\xFF\x81' for column `test`.`t3`.`c` at row 58
+Warning 1366 Incorrect string value: '\x80\xFF\xA1@' for column `test`.`t3`.`c` at row 59
+Warning 1366 Incorrect string value: '\x80\xFF\xA1\xA3' for column `test`.`t3`.`c` at row 60
+Warning 1366 Incorrect string value: '\x80\xFF\xFE@' for column `test`.`t3`.`c` at row 61
+Warning 1366 Incorrect string value: '\x80\xFF\xFF' for column `test`.`t3`.`c` at row 62
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 63
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 64
SELECT COUNT(*) FROM t3;
COUNT(*)
163
@@ -5650,30 +5650,30 @@ WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1))
AND type2='tail'
ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 1
-Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 2
-Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 3
-Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 4
-Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 5
-Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 6
-Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 7
-Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 8
-Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 9
-Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 10
-Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 11
-Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 12
-Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 13
-Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 14
-Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 15
-Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 16
-Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 17
-Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 18
-Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 19
-Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 20
-Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 21
-Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 22
-Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 23
-Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 24
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 1
+Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 2
+Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 3
+Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 4
+Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 5
+Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 6
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 7
+Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 8
+Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 9
+Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 10
+Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 11
+Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 12
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 13
+Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 14
+Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 15
+Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 16
+Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 17
+Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 18
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 19
+Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 20
+Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 21
+Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 22
+Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 23
+Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 24
SELECT COUNT(*) FROM t3;
COUNT(*)
24
@@ -5717,22 +5717,22 @@ WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) AND
type3='tail'
ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 1
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 2
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 3
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 4
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 5
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 6
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 7
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 8
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 9
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 10
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 11
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 12
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 13
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 14
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 15
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 16
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 1
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 2
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 3
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 4
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 5
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 6
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 7
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 8
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 9
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 10
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 11
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 12
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 13
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 14
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 15
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 16
SELECT COUNT(*) FROM t3;
COUNT(*)
16
@@ -5768,15 +5768,15 @@ AND NOT FIND_IN_SET('ascii',type3)
AND NOT FIND_IN_SET('mb2',type3)
ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 1
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 2
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 3
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 4
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 5
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 7
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 8
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 9
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 1
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 2
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 3
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 4
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 5
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 6
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 7
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 8
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 9
SELECT COUNT(*) FROM t3;
COUNT(*)
9
@@ -5852,28 +5852,28 @@ DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
DELETE FROM t3;
INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b;
Warnings:
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 1
-Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 3
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 5
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 7
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 9
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 10
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 12
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 13
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 15
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 16
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 18
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 19
-Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 27
-Warning 1366 Incorrect string value: '\x80' for column 'c' at row 30
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 31
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 35
-Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 37
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 39
-Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 41
-Warning 1366 Incorrect string value: '\x81' for column 'c' at row 43
-Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 45
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 1
+Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 3
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 5
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 6
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 7
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 9
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 10
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 12
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 13
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 15
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 16
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 18
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 19
+Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 27
+Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 30
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 31
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 35
+Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 37
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 39
+Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 41
+Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 43
+Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 45
SELECT COUNT(*) FROM t3;
COUNT(*)
46
diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result
index 8098a07375a..59a706a7fd8 100644
--- a/mysql-test/main/ctype_latin1.result
+++ b/mysql-test/main/ctype_latin1.result
@@ -7987,12 +7987,12 @@ SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT IGNORE INTO t1 VALUES ('Â'),('Â#');
Warnings:
-Warning 1366 Incorrect string value: '\xC2' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\xC2#' for column 'a' at row 2
+Warning 1366 Incorrect string value: '\xC2' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\xC2#' for column `test`.`t1`.`a` at row 2
SHOW WARNINGS;
Level Code Message
-Warning 1366 Incorrect string value: '\xC2' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\xC2#' for column 'a' at row 2
+Warning 1366 Incorrect string value: '\xC2' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\xC2#' for column `test`.`t1`.`a` at row 2
SELECT HEX(a),a FROM t1;
HEX(a) a
3F ?
diff --git a/mysql-test/main/ctype_many.result b/mysql-test/main/ctype_many.result
index d73a478b0c0..25802af4b5d 100644
--- a/mysql-test/main/ctype_many.result
+++ b/mysql-test/main/ctype_many.result
@@ -1767,8 +1767,8 @@ CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (0x10082), (0x12345);
INSERT IGNORE INTO t2 SELECT * FROM t1;
Warnings:
-Warning 1366 Incorrect string value: '\x00\x01\x00\x82' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x00\x01\x23\x45' for column 'a' at row 2
+Warning 1366 Incorrect string value: '\x00\x01\x00\x82' for column `test`.`t2`.`a` at row 1
+Warning 1366 Incorrect string value: '\x00\x01\x23\x45' for column `test`.`t2`.`a` at row 2
SELECT HEX(a) FROM t2;
HEX(a)
003F
diff --git a/mysql-test/main/ctype_recoding.result b/mysql-test/main/ctype_recoding.result
index 806d9dc6997..4668ddf9684 100644
--- a/mysql-test/main/ctype_recoding.result
+++ b/mysql-test/main/ctype_recoding.result
@@ -171,8 +171,8 @@ create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');
insert ignore into t1 values ('ÊÃÕË','ÊÃÕË');
Warnings:
-Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'b' at row 1
+Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column `test`.`t1`.`b` at row 1
drop table t1;
set names koi8r;
create table t1 (a char(10) character set cp1251);
diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result
index c19a0008e11..090bb12fc42 100644
--- a/mysql-test/main/ctype_sjis.result
+++ b/mysql-test/main/ctype_sjis.result
@@ -412,70 +412,70 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1;
COUNT(*)
14623
diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result
index 88fba0b3973..7394ec82924 100644
--- a/mysql-test/main/ctype_uca.result
+++ b/mysql-test/main/ctype_uca.result
@@ -6743,13 +6743,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -6766,21 +6766,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -6824,7 +6824,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -6845,13 +6845,13 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
ch
a
@@ -6872,7 +6872,7 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
@@ -6884,23 +6884,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
@@ -6987,13 +6987,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -7010,21 +7010,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
diff --git a/mysql-test/main/ctype_uca_innodb.result b/mysql-test/main/ctype_uca_innodb.result
index c04a99c8cd3..bd6f3b8a21f 100644
--- a/mysql-test/main/ctype_uca_innodb.result
+++ b/mysql-test/main/ctype_uca_innodb.result
@@ -24,13 +24,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -47,21 +47,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -105,7 +105,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -126,13 +126,13 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
ch
a
@@ -153,7 +153,7 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
@@ -165,23 +165,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result
index f01b3650ddf..db09bf116fc 100644
--- a/mysql-test/main/ctype_ucs.result
+++ b/mysql-test/main/ctype_ucs.result
@@ -5409,7 +5409,7 @@ ERROR 22003: Out of range value for column 'a' at row 1
SET sql_mode=DEFAULT;
INSERT IGNORE INTO t1 VALUES (CONVERT('aaa' USING ucs2));
Warnings:
-Warning 1366 Incorrect decimal value: 'aaa' for column 'a' at row 1
+Warning 1366 Incorrect decimal value: 'aaa' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
#
# End of 5.6 tests
@@ -6383,3 +6383,15 @@ DEALLOCATE PREPARE stmt;
#
# End of 10.2 tests
#
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-17995 INET6_NTOA(ucs2_input) erroneously returns NULL
+#
+SELECT HEX(INET6_ATON('1::1')), HEX(INET6_ATON(CONVERT('1::1' USING ucs2)));
+HEX(INET6_ATON('1::1')) HEX(INET6_ATON(CONVERT('1::1' USING ucs2)))
+00010000000000000000000000000001 00010000000000000000000000000001
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test
index d0d463c0340..983f48edbc5 100644
--- a/mysql-test/main/ctype_ucs.test
+++ b/mysql-test/main/ctype_ucs.test
@@ -1094,3 +1094,18 @@ DEALLOCATE PREPARE stmt;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-17995 INET6_NTOA(ucs2_input) erroneously returns NULL
+--echo #
+
+SELECT HEX(INET6_ATON('1::1')), HEX(INET6_ATON(CONVERT('1::1' USING ucs2)));
+
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result
index 0b1cf606f0b..a1fcce33bbb 100644
--- a/mysql-test/main/ctype_ujis.result
+++ b/mysql-test/main/ctype_ujis.result
@@ -2571,70 +2571,70 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
-Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
-Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4
-Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6
-Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8
-Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9
-Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10
-Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11
-Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12
-Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13
-Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14
-Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15
-Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16
-Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17
-Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18
-Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19
-Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20
-Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21
-Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22
-Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23
-Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24
-Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25
-Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26
-Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27
-Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28
-Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29
-Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30
-Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31
-Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32
-Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33
-Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34
-Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35
-Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36
-Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37
-Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38
-Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39
-Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40
-Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41
-Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42
-Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43
-Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44
-Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45
-Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46
-Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47
-Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48
-Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49
-Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50
-Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51
-Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52
-Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53
-Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54
-Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55
-Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56
-Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57
-Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58
-Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59
-Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60
-Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61
-Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62
-Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63
-Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64
+Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10
+Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11
+Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12
+Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13
+Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14
+Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15
+Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16
+Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17
+Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18
+Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19
+Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20
+Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21
+Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22
+Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23
+Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24
+Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25
+Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26
+Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27
+Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28
+Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29
+Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30
+Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31
+Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32
+Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33
+Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34
+Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35
+Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36
+Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37
+Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38
+Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39
+Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40
+Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41
+Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42
+Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43
+Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44
+Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45
+Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46
+Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47
+Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48
+Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49
+Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50
+Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51
+Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52
+Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53
+Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54
+Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55
+Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56
+Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57
+Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58
+Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59
+Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60
+Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61
+Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62
+Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63
+Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64
SELECT COUNT(*) FROM t1;
COUNT(*)
44671
diff --git a/mysql-test/main/ctype_ujis_ucs2.result b/mysql-test/main/ctype_ujis_ucs2.result
index 77961046346..cb501fd065f 100644
--- a/mysql-test/main/ctype_ujis_ucs2.result
+++ b/mysql-test/main/ctype_ujis_ucs2.result
@@ -1140,70 +1140,70 @@ update t1 set name='User defined range #2' where ujis >= 0x8FF5A1 and ujis <= 0x
update t1 set name='UNASSIGNED' where name='';
update ignore t1 set ucs2=ujis, ujis2=ucs2;
Warnings:
-Warning 1366 Incorrect string value: '\xA2\xAF' for column 'ucs2' at row 237
-Warning 1366 Incorrect string value: '\xA2\xB0' for column 'ucs2' at row 238
-Warning 1366 Incorrect string value: '\xA2\xB1' for column 'ucs2' at row 239
-Warning 1366 Incorrect string value: '\xA2\xB2' for column 'ucs2' at row 240
-Warning 1366 Incorrect string value: '\xA2\xB3' for column 'ucs2' at row 241
-Warning 1366 Incorrect string value: '\xA2\xB4' for column 'ucs2' at row 242
-Warning 1366 Incorrect string value: '\xA2\xB5' for column 'ucs2' at row 243
-Warning 1366 Incorrect string value: '\xA2\xB6' for column 'ucs2' at row 244
-Warning 1366 Incorrect string value: '\xA2\xB7' for column 'ucs2' at row 245
-Warning 1366 Incorrect string value: '\xA2\xB8' for column 'ucs2' at row 246
-Warning 1366 Incorrect string value: '\xA2\xB9' for column 'ucs2' at row 247
-Warning 1366 Incorrect string value: '\xA2\xC2' for column 'ucs2' at row 256
-Warning 1366 Incorrect string value: '\xA2\xC3' for column 'ucs2' at row 257
-Warning 1366 Incorrect string value: '\xA2\xC4' for column 'ucs2' at row 258
-Warning 1366 Incorrect string value: '\xA2\xC5' for column 'ucs2' at row 259
-Warning 1366 Incorrect string value: '\xA2\xC6' for column 'ucs2' at row 260
-Warning 1366 Incorrect string value: '\xA2\xC7' for column 'ucs2' at row 261
-Warning 1366 Incorrect string value: '\xA2\xC8' for column 'ucs2' at row 262
-Warning 1366 Incorrect string value: '\xA2\xC9' for column 'ucs2' at row 263
-Warning 1366 Incorrect string value: '\xA2\xD1' for column 'ucs2' at row 271
-Warning 1366 Incorrect string value: '\xA2\xD2' for column 'ucs2' at row 272
-Warning 1366 Incorrect string value: '\xA2\xD3' for column 'ucs2' at row 273
-Warning 1366 Incorrect string value: '\xA2\xD4' for column 'ucs2' at row 274
-Warning 1366 Incorrect string value: '\xA2\xD5' for column 'ucs2' at row 275
-Warning 1366 Incorrect string value: '\xA2\xD6' for column 'ucs2' at row 276
-Warning 1366 Incorrect string value: '\xA2\xD7' for column 'ucs2' at row 277
-Warning 1366 Incorrect string value: '\xA2\xD8' for column 'ucs2' at row 278
-Warning 1366 Incorrect string value: '\xA2\xD9' for column 'ucs2' at row 279
-Warning 1366 Incorrect string value: '\xA2\xDA' for column 'ucs2' at row 280
-Warning 1366 Incorrect string value: '\xA2\xDB' for column 'ucs2' at row 281
-Warning 1366 Incorrect string value: '\xA2\xEB' for column 'ucs2' at row 297
-Warning 1366 Incorrect string value: '\xA2\xEC' for column 'ucs2' at row 298
-Warning 1366 Incorrect string value: '\xA2\xED' for column 'ucs2' at row 299
-Warning 1366 Incorrect string value: '\xA2\xEE' for column 'ucs2' at row 300
-Warning 1366 Incorrect string value: '\xA2\xEF' for column 'ucs2' at row 301
-Warning 1366 Incorrect string value: '\xA2\xF0' for column 'ucs2' at row 302
-Warning 1366 Incorrect string value: '\xA2\xF1' for column 'ucs2' at row 303
-Warning 1366 Incorrect string value: '\xA2\xFA' for column 'ucs2' at row 312
-Warning 1366 Incorrect string value: '\xA2\xFB' for column 'ucs2' at row 313
-Warning 1366 Incorrect string value: '\xA2\xFC' for column 'ucs2' at row 314
-Warning 1366 Incorrect string value: '\xA2\xFD' for column 'ucs2' at row 315
-Warning 1366 Incorrect string value: '\xA3\xA1' for column 'ucs2' at row 317
-Warning 1366 Incorrect string value: '\xA3\xA2' for column 'ucs2' at row 318
-Warning 1366 Incorrect string value: '\xA3\xA3' for column 'ucs2' at row 319
-Warning 1366 Incorrect string value: '\xA3\xA4' for column 'ucs2' at row 320
-Warning 1366 Incorrect string value: '\xA3\xA5' for column 'ucs2' at row 321
-Warning 1366 Incorrect string value: '\xA3\xA6' for column 'ucs2' at row 322
-Warning 1366 Incorrect string value: '\xA3\xA7' for column 'ucs2' at row 323
-Warning 1366 Incorrect string value: '\xA3\xA8' for column 'ucs2' at row 324
-Warning 1366 Incorrect string value: '\xA3\xA9' for column 'ucs2' at row 325
-Warning 1366 Incorrect string value: '\xA3\xAA' for column 'ucs2' at row 326
-Warning 1366 Incorrect string value: '\xA3\xAB' for column 'ucs2' at row 327
-Warning 1366 Incorrect string value: '\xA3\xAC' for column 'ucs2' at row 328
-Warning 1366 Incorrect string value: '\xA3\xAD' for column 'ucs2' at row 329
-Warning 1366 Incorrect string value: '\xA3\xAE' for column 'ucs2' at row 330
-Warning 1366 Incorrect string value: '\xA3\xAF' for column 'ucs2' at row 331
-Warning 1366 Incorrect string value: '\xA3\xBA' for column 'ucs2' at row 342
-Warning 1366 Incorrect string value: '\xA3\xBB' for column 'ucs2' at row 343
-Warning 1366 Incorrect string value: '\xA3\xBC' for column 'ucs2' at row 344
-Warning 1366 Incorrect string value: '\xA3\xBD' for column 'ucs2' at row 345
-Warning 1366 Incorrect string value: '\xA3\xBE' for column 'ucs2' at row 346
-Warning 1366 Incorrect string value: '\xA3\xBF' for column 'ucs2' at row 347
-Warning 1366 Incorrect string value: '\xA3\xC0' for column 'ucs2' at row 348
-Warning 1366 Incorrect string value: '\xA3\xDB' for column 'ucs2' at row 375
+Warning 1366 Incorrect string value: '\xA2\xAF' for column `test`.`t1`.`ucs2` at row 237
+Warning 1366 Incorrect string value: '\xA2\xB0' for column `test`.`t1`.`ucs2` at row 238
+Warning 1366 Incorrect string value: '\xA2\xB1' for column `test`.`t1`.`ucs2` at row 239
+Warning 1366 Incorrect string value: '\xA2\xB2' for column `test`.`t1`.`ucs2` at row 240
+Warning 1366 Incorrect string value: '\xA2\xB3' for column `test`.`t1`.`ucs2` at row 241
+Warning 1366 Incorrect string value: '\xA2\xB4' for column `test`.`t1`.`ucs2` at row 242
+Warning 1366 Incorrect string value: '\xA2\xB5' for column `test`.`t1`.`ucs2` at row 243
+Warning 1366 Incorrect string value: '\xA2\xB6' for column `test`.`t1`.`ucs2` at row 244
+Warning 1366 Incorrect string value: '\xA2\xB7' for column `test`.`t1`.`ucs2` at row 245
+Warning 1366 Incorrect string value: '\xA2\xB8' for column `test`.`t1`.`ucs2` at row 246
+Warning 1366 Incorrect string value: '\xA2\xB9' for column `test`.`t1`.`ucs2` at row 247
+Warning 1366 Incorrect string value: '\xA2\xC2' for column `test`.`t1`.`ucs2` at row 256
+Warning 1366 Incorrect string value: '\xA2\xC3' for column `test`.`t1`.`ucs2` at row 257
+Warning 1366 Incorrect string value: '\xA2\xC4' for column `test`.`t1`.`ucs2` at row 258
+Warning 1366 Incorrect string value: '\xA2\xC5' for column `test`.`t1`.`ucs2` at row 259
+Warning 1366 Incorrect string value: '\xA2\xC6' for column `test`.`t1`.`ucs2` at row 260
+Warning 1366 Incorrect string value: '\xA2\xC7' for column `test`.`t1`.`ucs2` at row 261
+Warning 1366 Incorrect string value: '\xA2\xC8' for column `test`.`t1`.`ucs2` at row 262
+Warning 1366 Incorrect string value: '\xA2\xC9' for column `test`.`t1`.`ucs2` at row 263
+Warning 1366 Incorrect string value: '\xA2\xD1' for column `test`.`t1`.`ucs2` at row 271
+Warning 1366 Incorrect string value: '\xA2\xD2' for column `test`.`t1`.`ucs2` at row 272
+Warning 1366 Incorrect string value: '\xA2\xD3' for column `test`.`t1`.`ucs2` at row 273
+Warning 1366 Incorrect string value: '\xA2\xD4' for column `test`.`t1`.`ucs2` at row 274
+Warning 1366 Incorrect string value: '\xA2\xD5' for column `test`.`t1`.`ucs2` at row 275
+Warning 1366 Incorrect string value: '\xA2\xD6' for column `test`.`t1`.`ucs2` at row 276
+Warning 1366 Incorrect string value: '\xA2\xD7' for column `test`.`t1`.`ucs2` at row 277
+Warning 1366 Incorrect string value: '\xA2\xD8' for column `test`.`t1`.`ucs2` at row 278
+Warning 1366 Incorrect string value: '\xA2\xD9' for column `test`.`t1`.`ucs2` at row 279
+Warning 1366 Incorrect string value: '\xA2\xDA' for column `test`.`t1`.`ucs2` at row 280
+Warning 1366 Incorrect string value: '\xA2\xDB' for column `test`.`t1`.`ucs2` at row 281
+Warning 1366 Incorrect string value: '\xA2\xEB' for column `test`.`t1`.`ucs2` at row 297
+Warning 1366 Incorrect string value: '\xA2\xEC' for column `test`.`t1`.`ucs2` at row 298
+Warning 1366 Incorrect string value: '\xA2\xED' for column `test`.`t1`.`ucs2` at row 299
+Warning 1366 Incorrect string value: '\xA2\xEE' for column `test`.`t1`.`ucs2` at row 300
+Warning 1366 Incorrect string value: '\xA2\xEF' for column `test`.`t1`.`ucs2` at row 301
+Warning 1366 Incorrect string value: '\xA2\xF0' for column `test`.`t1`.`ucs2` at row 302
+Warning 1366 Incorrect string value: '\xA2\xF1' for column `test`.`t1`.`ucs2` at row 303
+Warning 1366 Incorrect string value: '\xA2\xFA' for column `test`.`t1`.`ucs2` at row 312
+Warning 1366 Incorrect string value: '\xA2\xFB' for column `test`.`t1`.`ucs2` at row 313
+Warning 1366 Incorrect string value: '\xA2\xFC' for column `test`.`t1`.`ucs2` at row 314
+Warning 1366 Incorrect string value: '\xA2\xFD' for column `test`.`t1`.`ucs2` at row 315
+Warning 1366 Incorrect string value: '\xA3\xA1' for column `test`.`t1`.`ucs2` at row 317
+Warning 1366 Incorrect string value: '\xA3\xA2' for column `test`.`t1`.`ucs2` at row 318
+Warning 1366 Incorrect string value: '\xA3\xA3' for column `test`.`t1`.`ucs2` at row 319
+Warning 1366 Incorrect string value: '\xA3\xA4' for column `test`.`t1`.`ucs2` at row 320
+Warning 1366 Incorrect string value: '\xA3\xA5' for column `test`.`t1`.`ucs2` at row 321
+Warning 1366 Incorrect string value: '\xA3\xA6' for column `test`.`t1`.`ucs2` at row 322
+Warning 1366 Incorrect string value: '\xA3\xA7' for column `test`.`t1`.`ucs2` at row 323
+Warning 1366 Incorrect string value: '\xA3\xA8' for column `test`.`t1`.`ucs2` at row 324
+Warning 1366 Incorrect string value: '\xA3\xA9' for column `test`.`t1`.`ucs2` at row 325
+Warning 1366 Incorrect string value: '\xA3\xAA' for column `test`.`t1`.`ucs2` at row 326
+Warning 1366 Incorrect string value: '\xA3\xAB' for column `test`.`t1`.`ucs2` at row 327
+Warning 1366 Incorrect string value: '\xA3\xAC' for column `test`.`t1`.`ucs2` at row 328
+Warning 1366 Incorrect string value: '\xA3\xAD' for column `test`.`t1`.`ucs2` at row 329
+Warning 1366 Incorrect string value: '\xA3\xAE' for column `test`.`t1`.`ucs2` at row 330
+Warning 1366 Incorrect string value: '\xA3\xAF' for column `test`.`t1`.`ucs2` at row 331
+Warning 1366 Incorrect string value: '\xA3\xBA' for column `test`.`t1`.`ucs2` at row 342
+Warning 1366 Incorrect string value: '\xA3\xBB' for column `test`.`t1`.`ucs2` at row 343
+Warning 1366 Incorrect string value: '\xA3\xBC' for column `test`.`t1`.`ucs2` at row 344
+Warning 1366 Incorrect string value: '\xA3\xBD' for column `test`.`t1`.`ucs2` at row 345
+Warning 1366 Incorrect string value: '\xA3\xBE' for column `test`.`t1`.`ucs2` at row 346
+Warning 1366 Incorrect string value: '\xA3\xBF' for column `test`.`t1`.`ucs2` at row 347
+Warning 1366 Incorrect string value: '\xA3\xC0' for column `test`.`t1`.`ucs2` at row 348
+Warning 1366 Incorrect string value: '\xA3\xDB' for column `test`.`t1`.`ucs2` at row 375
Characters with safe Unicode round trip
select hex(ujis), hex(ucs2), hex(ujis2), name from t1 where ujis=ujis2 order by ujis;
hex(ujis) hex(ucs2) hex(ujis2) name
@@ -19131,17 +19131,17 @@ insert into t1 (ucs2,name) values (0xFFE2,'U+FFE2 FULLWIDTH NOT SIGN');
insert into t1 (ucs2,name) values (0xFFE4,'U+FFE4 FULLWIDTH BROKEN BAR');
update ignore t1 set ujis=ucs2;
Warnings:
-Warning 1366 Incorrect string value: '\x00\xA5' for column 'ujis' at row 1
-Warning 1366 Incorrect string value: '\x20\x14' for column 'ujis' at row 2
-Warning 1366 Incorrect string value: '\x20\x3E' for column 'ujis' at row 3
-Warning 1366 Incorrect string value: '\x22\x25' for column 'ujis' at row 4
-Warning 1366 Incorrect string value: '\xFF\x0D' for column 'ujis' at row 5
-Warning 1366 Incorrect string value: '\xFF\x3C' for column 'ujis' at row 6
-Warning 1366 Incorrect string value: '\xFF\x5E' for column 'ujis' at row 7
-Warning 1366 Incorrect string value: '\xFF\xE0' for column 'ujis' at row 8
-Warning 1366 Incorrect string value: '\xFF\xE1' for column 'ujis' at row 9
-Warning 1366 Incorrect string value: '\xFF\xE2' for column 'ujis' at row 10
-Warning 1366 Incorrect string value: '\xFF\xE4' for column 'ujis' at row 11
+Warning 1366 Incorrect string value: '\x00\xA5' for column `test`.`t1`.`ujis` at row 1
+Warning 1366 Incorrect string value: '\x20\x14' for column `test`.`t1`.`ujis` at row 2
+Warning 1366 Incorrect string value: '\x20\x3E' for column `test`.`t1`.`ujis` at row 3
+Warning 1366 Incorrect string value: '\x22\x25' for column `test`.`t1`.`ujis` at row 4
+Warning 1366 Incorrect string value: '\xFF\x0D' for column `test`.`t1`.`ujis` at row 5
+Warning 1366 Incorrect string value: '\xFF\x3C' for column `test`.`t1`.`ujis` at row 6
+Warning 1366 Incorrect string value: '\xFF\x5E' for column `test`.`t1`.`ujis` at row 7
+Warning 1366 Incorrect string value: '\xFF\xE0' for column `test`.`t1`.`ujis` at row 8
+Warning 1366 Incorrect string value: '\xFF\xE1' for column `test`.`t1`.`ujis` at row 9
+Warning 1366 Incorrect string value: '\xFF\xE2' for column `test`.`t1`.`ujis` at row 10
+Warning 1366 Incorrect string value: '\xFF\xE4' for column `test`.`t1`.`ujis` at row 11
select hex(ucs2),hex(ujis),name from t1 order by name;
hex(ucs2) hex(ujis) name
00A5 3F U+00A5 YEN SIGN
diff --git a/mysql-test/main/ctype_upgrade.result b/mysql-test/main/ctype_upgrade.result
index 7f8b594cbf8..9d19c3b5203 100644
--- a/mysql-test/main/ctype_upgrade.result
+++ b/mysql-test/main/ctype_upgrade.result
@@ -235,6 +235,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -257,9 +258,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -293,6 +294,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -315,9 +317,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result
index 784bdae7275..1417e0ba752 100644
--- a/mysql-test/main/ctype_utf16.result
+++ b/mysql-test/main/ctype_utf16.result
@@ -1015,7 +1015,7 @@ insert into t1 values (0xdf84);
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify column s1 varchar(50) character set utf16;
Warnings:
-Warning 1366 Incorrect string value: '\xDF\x84' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
003F
@@ -1024,7 +1024,7 @@ create table t1 (s1 varchar(5) character set ucs2, s2 varchar(5) character set u
insert into t1 (s1) values (0xdf84);
update ignore t1 set s2 = s1;
Warnings:
-Warning 1366 Incorrect string value: '\xDF\x84' for column 's2' at row 1
+Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s2` at row 1
select hex(s2) from t1;
hex(s2)
003F
diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result
index 4d1186bd361..633809b51fa 100644
--- a/mysql-test/main/ctype_utf16le.result
+++ b/mysql-test/main/ctype_utf16le.result
@@ -1124,7 +1124,7 @@ INSERT INTO t1 VALUES (0xDF84);
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 MODIFY column s1 VARCHAR(50) CHARACTER SET utf16le;
Warnings:
-Warning 1366 Incorrect string value: '\xDF\x84' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s1` at row 1
SELECT HEX(s1) FROM t1;
HEX(s1)
3F00
@@ -1136,7 +1136,7 @@ CREATE TABLE t1 (s1 VARCHAR(5) CHARACTER SET ucs2, s2 VARCHAR(5) CHARACTER SET u
INSERT INTO t1 (s1) VALUES (0xdf84);
UPDATE IGNORE t1 set s2 = s1;
Warnings:
-Warning 1366 Incorrect string value: '\xDF\x84' for column 's2' at row 1
+Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s2` at row 1
SELECT HEX(s2) FROM t1;
HEX(s2)
3F00
diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result
index 7b3eaa9384a..2da1f22f592 100644
--- a/mysql-test/main/ctype_utf32.result
+++ b/mysql-test/main/ctype_utf32.result
@@ -985,31 +985,31 @@ create table t1 (utf32 varchar(2) character set utf32);
Wrong character with pad
insert ignore into t1 values (0x110000);
Warnings:
-Warning 1366 Incorrect string value: '\x11\x00\x00' for column 'utf32' at row 1
+Warning 1366 Incorrect string value: '\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1
Wrong chsaracter without pad
insert ignore into t1 values (0x00110000);
Warnings:
-Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1
+Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1
Wrong character with pad followed by another wrong character
insert ignore into t1 values (0x11000000110000);
Warnings:
-Warning 1366 Incorrect string value: '\x11\x00\x00\x00\x11\x00...' for column 'utf32' at row 1
+Warning 1366 Incorrect string value: '\x11\x00\x00\x00\x11\x00...' for column `test`.`t1`.`utf32` at row 1
Good character with pad followed by bad character
insert ignore into t1 values (0x10000000110000);
Warnings:
-Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1
+Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1
Good character without pad followed by bad character
insert ignore into t1 values (0x0010000000110000);
Warnings:
-Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1
+Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1
Wrong character with the second byte higher than 0x10
insert ignore into t1 values (0x00800037);
Warnings:
-Warning 1366 Incorrect string value: '\x00\x80\x007' for column 'utf32' at row 1
+Warning 1366 Incorrect string value: '\x00\x80\x007' for column `test`.`t1`.`utf32` at row 1
Wrong character with pad with the second byte higher than 0x10
insert ignore into t1 values (0x00800037);
Warnings:
-Warning 1366 Incorrect string value: '\x00\x80\x007' for column 'utf32' at row 1
+Warning 1366 Incorrect string value: '\x00\x80\x007' for column `test`.`t1`.`utf32` at row 1
drop table t1;
select _utf32'a' collate utf32_general_ci = 0xfffd;
_utf32'a' collate utf32_general_ci = 0xfffd
@@ -1561,12 +1561,12 @@ CREATE TABLE t1 (utf32 CHAR(5) CHARACTER SET utf32, latin1 CHAR(5) CHARACTER SET
INSERT INTO t1 (utf32) VALUES (0xc581);
UPDATE IGNORE t1 SET latin1 = utf32;
Warnings:
-Warning 1366 Incorrect string value: '\x00\x00\xC5\x81' for column 'latin1' at row 1
+Warning 1366 Incorrect string value: '\x00\x00\xC5\x81' for column `test`.`t1`.`latin1` at row 1
DELETE FROM t1;
INSERT INTO t1 (utf32) VALUES (0x100cc);
UPDATE IGNORE t1 SET latin1 = utf32;
Warnings:
-Warning 1366 Incorrect string value: '\x00\x01\x00\xCC' for column 'latin1' at row 1
+Warning 1366 Incorrect string value: '\x00\x01\x00\xCC' for column `test`.`t1`.`latin1` at row 1
DROP TABLE t1;
#
# Bug#55912 FORMAT with locale set fails for numbers < 1000
diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result
index a193eba64e3..6f336d2fcfb 100644
--- a/mysql-test/main/ctype_utf8.result
+++ b/mysql-test/main/ctype_utf8.result
@@ -222,7 +222,7 @@ drop table t1;
create table t1 (s1 char(10) character set utf8);
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -230,7 +230,7 @@ drop table t1;
create table t1 (s1 varchar(10) character set utf8);
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -238,7 +238,7 @@ drop table t1;
create table t1 (s1 text character set utf8);
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -5456,13 +5456,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -5479,21 +5479,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -5537,7 +5537,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -5558,13 +5558,13 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
ch
a
@@ -5585,7 +5585,7 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
@@ -5597,23 +5597,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
@@ -5700,13 +5700,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -5723,21 +5723,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -5781,7 +5781,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -5802,13 +5802,13 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
ch
a
@@ -5829,7 +5829,7 @@ az
aЀ
aÖ€
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
@@ -5841,23 +5841,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
ch
z
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
@@ -5944,13 +5944,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='adminðŒ†';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='adminðŒ†';
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -5967,21 +5967,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch;
ch
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
ch
a
@@ -10611,11 +10611,11 @@ DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' IGNORE INTO TABLE t1 CHARACTER SET utf8 IGNORE 4 LINES;
Warnings:
-Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 7
-Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
+Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\xE1\x80' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 8
SELECT HEX(a) FROM t1;
HEX(a)
3F
@@ -10633,7 +10633,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
LOAD XML INFILE '../../std_data/loaddata/mdev9874.xml' IGNORE INTO TABLE t1 CHARACTER SET utf8 ROWS IDENTIFIED BY '<row>';
Warnings:
-Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
+Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1
SELECT HEX(a) FROM t1;
HEX(a)
613F
diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result
index 27ffd5552fa..fac15a5a2cd 100644
--- a/mysql-test/main/ctype_utf8mb4.result
+++ b/mysql-test/main/ctype_utf8mb4.result
@@ -222,7 +222,7 @@ drop table t1;
create table t1 (s1 char(10) character set utf8mb4);
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -230,7 +230,7 @@ drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4);
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -238,7 +238,7 @@ drop table t1;
create table t1 (s1 text character set utf8mb4);
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -2328,7 +2328,7 @@ insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
insert ignore into t1 values (0xF08F8080);
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1 order by binary utf8mb4;
hex(utf8mb4)
3F
@@ -2348,7 +2348,7 @@ insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
insert ignore into t1 values (0xF4908080);
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1 order by binary utf8mb4;
hex(utf8mb4)
3F
@@ -2442,7 +2442,7 @@ u_decimal hex(utf8mb4_encoding)
119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480
INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
-Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't1' AND column_name= 'utf8mb4_encoding';
character_maximum_length character_octet_length
@@ -2456,14 +2456,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1;
HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8'))
@@ -2524,17 +2524,17 @@ count(*)
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9D\x84\x80' for column 'utf8mb4_encoding' at row 1
-Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E' for column 'utf8mb4_encoding' at row 2
-Warning 1366 Incorrect string value: '\xF0\x9D\x85\x9E' for column 'utf8mb4_encoding' at row 3
-Warning 1366 Incorrect string value: '\xF0\x9D\x87\x8F' for column 'utf8mb4_encoding' at row 4
-Warning 1366 Incorrect string value: '\xF0\x9D\x9C\x9F' for column 'utf8mb4_encoding' at row 5
-Warning 1366 Incorrect string value: '\xF0\x9D\x9E\x9F' for column 'utf8mb4_encoding' at row 6
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb4_encoding' at row 7
-Warning 1366 Incorrect string value: '\xF3\xA0\x87\xAF' for column 'utf8mb4_encoding' at row 8
-Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column 'utf8mb4_encoding' at row 9
-Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column 'utf8mb4_encoding' at row 10
-Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column 'utf8mb4_encoding' at row 11
+Warning 1366 Incorrect string value: '\xF0\x9D\x84\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1
+Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E' for column `test`.`t1`.`utf8mb4_encoding` at row 2
+Warning 1366 Incorrect string value: '\xF0\x9D\x85\x9E' for column `test`.`t1`.`utf8mb4_encoding` at row 3
+Warning 1366 Incorrect string value: '\xF0\x9D\x87\x8F' for column `test`.`t1`.`utf8mb4_encoding` at row 4
+Warning 1366 Incorrect string value: '\xF0\x9D\x9C\x9F' for column `test`.`t1`.`utf8mb4_encoding` at row 5
+Warning 1366 Incorrect string value: '\xF0\x9D\x9E\x9F' for column `test`.`t1`.`utf8mb4_encoding` at row 6
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t1`.`utf8mb4_encoding` at row 7
+Warning 1366 Incorrect string value: '\xF3\xA0\x87\xAF' for column `test`.`t1`.`utf8mb4_encoding` at row 8
+Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column `test`.`t1`.`utf8mb4_encoding` at row 9
+Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column `test`.`t1`.`utf8mb4_encoding` at row 10
+Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column `test`.`t1`.`utf8mb4_encoding` at row 11
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -3427,8 +3427,8 @@ b VARCHAR(32) CHARACTER SET utf8
);
INSERT IGNORE INTO t1 SELECT 'a 😠b', 'a 😠b';
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column `test`.`t1`.`b` at row 1
SELECT * FROM t1;
a b
a ???? b a ???? b
@@ -3447,7 +3447,7 @@ b VARCHAR(32) CHARACTER SET utf8
);
INSERT IGNORE INTO t1 SELECT 'a 😠b', 'a 😠b';
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column `test`.`t1`.`b` at row 1
SELECT * FROM t1;
a b
a 😠b a ? b
@@ -3539,10 +3539,10 @@ DROP FUNCTION f1;
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' IGNORE INTO TABLE t1 CHARACTER SET utf8mb4 IGNORE 4 LINES;
Warnings:
-Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
-Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
-Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
-Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
+Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect string value: '\xE1\x80' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 8
SELECT HEX(a) FROM t1;
HEX(a)
3F
diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result
index d82ed89be9c..85668451181 100644
--- a/mysql-test/main/ctype_utf8mb4_heap.result
+++ b/mysql-test/main/ctype_utf8mb4_heap.result
@@ -222,7 +222,7 @@ drop table t1;
create table t1 (s1 char(10) character set utf8mb4) engine heap;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -230,7 +230,7 @@ drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4) engine heap;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -2160,7 +2160,7 @@ insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
insert ignore into t1 values (0xF08F8080);
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1;
hex(utf8mb4)
3F
@@ -2180,7 +2180,7 @@ insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
insert ignore into t1 values (0xF4908080);
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1;
hex(utf8mb4)
3F
@@ -2255,7 +2255,7 @@ u_decimal hex(utf8mb4_encoding)
917999 F3A087AF
INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
-Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't1' AND column_name= 'utf8mb4_encoding';
character_maximum_length character_octet_length
@@ -2269,14 +2269,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1;
HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8'))
diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result
index 956b2f83d9e..82f0ddff1c4 100644
--- a/mysql-test/main/ctype_utf8mb4_innodb.result
+++ b/mysql-test/main/ctype_utf8mb4_innodb.result
@@ -222,7 +222,7 @@ drop table t1;
create table t1 (s1 char(10) character set utf8mb4) engine InnoDB;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -230,7 +230,7 @@ drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4) engine InnoDB;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -238,7 +238,7 @@ drop table t1;
create table t1 (s1 text character set utf8mb4) engine InnoDB;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -2286,7 +2286,7 @@ insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
insert ignore into t1 values (0xF08F8080);
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1;
hex(utf8mb4)
3F
@@ -2306,7 +2306,7 @@ insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
insert ignore into t1 values (0xF4908080);
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1;
hex(utf8mb4)
3F
@@ -2398,7 +2398,7 @@ u_decimal hex(utf8mb4_encoding)
917999 F3A087AF
INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
-Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't1' AND column_name= 'utf8mb4_encoding';
character_maximum_length character_octet_length
@@ -2412,14 +2412,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1;
HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8'))
diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result
index fd58e12542c..0bd13ef0282 100644
--- a/mysql-test/main/ctype_utf8mb4_myisam.result
+++ b/mysql-test/main/ctype_utf8mb4_myisam.result
@@ -222,7 +222,7 @@ drop table t1;
create table t1 (s1 char(10) character set utf8mb4) engine MyISAM;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -230,7 +230,7 @@ drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4) engine MyISAM;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -238,7 +238,7 @@ drop table t1;
create table t1 (s1 text character set utf8mb4) engine MyISAM;
insert ignore into t1 values (0x41FF);
Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
+Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1
select hex(s1) from t1;
hex(s1)
413F
@@ -2293,7 +2293,7 @@ insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
insert ignore into t1 values (0xF08F8080);
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1;
hex(utf8mb4)
3F
@@ -2313,7 +2313,7 @@ insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
insert ignore into t1 values (0xF4908080);
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
+Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1
select hex(utf8mb4) from t1;
hex(utf8mb4)
3F
@@ -2407,7 +2407,7 @@ u_decimal hex(utf8mb4_encoding)
917999 F3A087AF
INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
-Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't1' AND column_name= 'utf8mb4_encoding';
character_maximum_length character_octet_length
@@ -2421,14 +2421,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
+Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1;
HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8'))
diff --git a/mysql-test/main/custom_aggregate_functions.result b/mysql-test/main/custom_aggregate_functions.result
index 4060d6665f6..0a27334f58e 100644
--- a/mysql-test/main/custom_aggregate_functions.result
+++ b/mysql-test/main/custom_aggregate_functions.result
@@ -573,7 +573,7 @@ select f3(sal) from t1;
f3(sal)
1000
select f2(val) from t1;
-ERROR 22007: Incorrect integer value: 'ab' for column 'x' at row 1
+ERROR 22007: Incorrect integer value: 'ab' for column ``.``.`x` at row 1
select val, id, c from (select f1(sal) as c from t2) as t1, t2;
val id c
10 2 17000
diff --git a/mysql-test/main/delayed.result b/mysql-test/main/delayed.result
index 26a1fc670f4..ec36e3af46d 100644
--- a/mysql-test/main/delayed.result
+++ b/mysql-test/main/delayed.result
@@ -284,9 +284,9 @@ CREATE TABLE t2 (
);
SET SQL_MODE='NO_ZERO_DATE,STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
INSERT DELAYED INTO t2 VALUES (0,'0000-00-00');
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'f1' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t2`.`f1` at row 1
INSERT DELAYED INTO t2 VALUES (0,'2007-00-00');
-ERROR 22007: Incorrect date value: '2007-00-00' for column 'f1' at row 1
+ERROR 22007: Incorrect date value: '2007-00-00' for column `test`.`t2`.`f1` at row 1
DROP TABLE t1,t2;
set @old_delayed_updates = @@global.low_priority_updates;
set global low_priority_updates = 1;
diff --git a/mysql-test/main/delete_use_source.result b/mysql-test/main/delete_use_source.result
index 08da8901528..a9a6df88077 100644
--- a/mysql-test/main/delete_use_source.result
+++ b/mysql-test/main/delete_use_source.result
@@ -6,6 +6,7 @@ insert t1 select 2,seq from seq_1_to_50;
insert t1 select 3,seq from seq_1_to_20;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
#
# Delete with limit (quick select - range acces)
@@ -47,8 +48,8 @@ rollback;
start transaction;
explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL c1 NULL NULL NULL 502 Using where
-2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 58 Using index
+1 PRIMARY t1 range c1 c1 4 NULL 600 Using where
+2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 167 Using index
delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
affected rows: 1
delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
@@ -63,8 +64,8 @@ rollback;
start transaction;
explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL c1 NULL NULL NULL 502 Using where
-2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 58 Using index
+1 PRIMARY t1 ALL c1 NULL NULL NULL 670 Using where
+2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 167 Using index
delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 ;
affected rows: 500
select count(*) from v1 where c1=0;
diff --git a/mysql-test/main/deprecated_features.result b/mysql-test/main/deprecated_features.result
index fc6c86d065d..2c77d745e2e 100644
--- a/mysql-test/main/deprecated_features.result
+++ b/mysql-test/main/deprecated_features.result
@@ -5,7 +5,7 @@ ERROR HY000: Unknown system variable 'table_type'
select @@table_type='MyISAM';
ERROR HY000: Unknown system variable 'table_type'
backup table t1 to 'data.txt';
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'backup table t1 to 'data.txt'' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'table t1 to 'data.txt'' at line 1
restore table t1 from 'data.txt';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'restore table t1 from 'data.txt'' at line 1
show plugin;
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index c73fb80d1a4..473415ac099 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -10403,6 +10403,99 @@ f
3
DROP VIEW v1;
DROP TABLE t1;
+#
+# MDEV-17574: pushdown into derived from mergeable view
+# used in multi-table UPDATE
+# pushdown into materialized derived from mergeable view
+# used in SELECT
+#
+CREATE TABLE t1 (f1 text, f2 int);
+INSERT INTO t1 VALUES ('x',1), ('y',2);
+CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t;
+UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
+EXPLAIN FORMAT=JSON UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.f2 < 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.f2 < 2"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.f2 = t.f2"
+ }
+ }
+}
+SELECT * FROM t1;
+f1 f2
+z 1
+y 2
+CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t;
+SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
+f2 f1 f2
+1 z 1
+EXPLAIN FORMAT=JSON SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.f2 < 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.f2 < 2"
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t1.f2 = t.f2"
+ }
+ }
+}
+DROP VIEW v1,v2;
+DROP TABLE t1;
# End of 10.2 tests
#
# MDEV-14579: pushdown conditions into materialized views/derived tables
@@ -13870,16 +13963,16 @@ a b max_c a b c
1 21 345 3 21 231
select * from v1,t2 where (v1.b=t2.b) and (v1.a<5);
a b max_c a b c
-1 21 345 3 21 231
2 33 7 5 33 207
-2 33 7 8 33 117
-3 21 500 3 21 231
4 33 123 5 33 207
+2 33 7 8 33 117
4 33 123 8 33 117
+1 21 345 3 21 231
+3 21 500 3 21 231
explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<5);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 9
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join)
2 DERIVED t3 range i1 i1 5 NULL 5 Using index condition
explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<5);
EXPLAIN
@@ -13887,23 +13980,11 @@ EXPLAIN
"query_block": {
"select_id": 1,
"table": {
- "table_name": "t2",
+ "table_name": "<derived2>",
"access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 80,
- "attached_condition": "v1.a < 5"
- },
- "buffer_type": "flat",
- "buffer_size": "256Kb",
- "join_type": "BNL",
- "attached_condition": "v1.b = t2.b",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "v1.a < 5",
"materialized": {
"query_block": {
"select_id": 2,
@@ -13920,6 +14001,18 @@ EXPLAIN
}
}
}
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t2.b = v1.b"
}
}
}
@@ -14843,7 +14936,9 @@ insert into t2 values
insert into t2 select a+10, b+10, concat(c,'f') from t2;
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
set statement optimizer_switch='split_materialized=off' for select t1.a,t.s,t.m
from t1 join
@@ -14873,7 +14968,7 @@ where t1.b < 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 range idx_b idx_b 5 NULL 4 100.00 Using index condition; Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00
-2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 2 100.00
+2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`c`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` < 3
explain format=json select t1.a,t.s,t.m
@@ -14919,7 +15014,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t1.a"],
- "rows": 2,
+ "rows": 1,
"filtered": 100
}
}
@@ -14982,10 +15077,10 @@ on t1.a=t.a
where t1.b <= 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL idx_b NULL NULL NULL 12 83.33 Using where
-1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 9 100.00
-2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00
+2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5
explain format=json select t1.a,t.s,t.m
from t1 join
(select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t
@@ -15011,22 +15106,22 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t1.a"],
- "rows": 9,
+ "rows": 2,
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 2,
- "filesort": {
- "sort_key": "t2.a",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx_a"],
- "rows": 90,
- "filtered": 100
- }
- }
+ "outer_ref_condition": "t1.a is not null",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100
}
}
}
@@ -15085,11 +15180,11 @@ from t1 left join
(select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t
on t1.a=t.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00
-1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00 Using where
-2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 2 100.00
+1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 9 100.00 Using where
+2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1
explain format=json select t1.a,t.max,t.min
from t1 left join
(select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t
@@ -15102,7 +15197,7 @@ EXPLAIN
"table": {
"table_name": "t1",
"access_type": "ALL",
- "rows": 4,
+ "rows": 12,
"filtered": 100
},
"table": {
@@ -15113,23 +15208,23 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t1.a"],
- "rows": 2,
+ "rows": 9,
"filtered": 100,
"attached_condition": "trigcond(trigcond(t1.a is not null))",
"materialized": {
"query_block": {
"select_id": 2,
- "outer_ref_condition": "t1.a is not null",
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx_a"],
- "key": "idx_a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100
+ "filesort": {
+ "sort_key": "t2.a",
+ "temporary_table": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx_a"],
+ "rows": 90,
+ "filtered": 100
+ }
+ }
}
}
}
@@ -15150,7 +15245,9 @@ insert into t4 values
insert into t4 select a+10, b+10, concat(c,'f') from t4;
analyze table t3,t4;
Table Op Msg_type Msg_text
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
+test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min
from t3 join
@@ -15466,8 +15563,11 @@ insert into t4 select a+100, b+100, concat(c,'g') from t4;
insert into t4 select a+1000, b+1000, concat(c,'h') from t4;
analyze table t2,t3,t4;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
+test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
set statement optimizer_switch='split_materialized=off' for select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min
from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t
@@ -15488,9 +15588,9 @@ from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t
where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where
-1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where
+1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 2 100.00
-2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 3 100.00
+2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z')
explain format=json select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min
@@ -15520,7 +15620,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t2.a"],
- "rows": 2,
+ "rows": 1,
"filtered": 100,
"attached_condition": "t3.c is not null"
},
@@ -15546,7 +15646,7 @@ EXPLAIN
"key_length": "128",
"used_key_parts": ["c"],
"ref": ["test.t3.c"],
- "rows": 3,
+ "rows": 2,
"filtered": 100
}
}
@@ -15634,8 +15734,8 @@ explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min
from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t
where t2.b < 40 and t2.a=t3.a and t3.c=t.c;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 90 100.00 Using where
-1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL 90 33.33 Using where
+1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00
2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort
Warnings:
@@ -15651,7 +15751,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 90,
- "filtered": 100,
+ "filtered": 33.333,
"attached_condition": "t2.b < 40 and t2.a is not null"
},
"table": {
@@ -15662,7 +15762,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t2.a"],
- "rows": 2,
+ "rows": 1,
"filtered": 100,
"attached_condition": "t3.c is not null"
},
@@ -15735,9 +15835,9 @@ from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t
where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where
-1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where
+1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 2 100.00
-2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 3 100.00 Using temporary
+2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 2 100.00 Using temporary
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`t`.`c` AS `c`,`t`.`b` AS `b`,`t`.`sum(b) over (partition by c)` AS `sum(b) over (partition by c)` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,`test`.`t4`.`b` AS `b`,sum(`test`.`t4`.`b`) over ( partition by `test`.`t4`.`c`) AS `sum(b) over (partition by c)` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z')
explain format=json select *
@@ -15767,7 +15867,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t2.a"],
- "rows": 2,
+ "rows": 1,
"filtered": 100,
"attached_condition": "t3.c is not null"
},
@@ -15800,7 +15900,7 @@ EXPLAIN
"key_length": "128",
"used_key_parts": ["c"],
"ref": ["test.t3.c"],
- "rows": 3,
+ "rows": 2,
"filtered": 100
}
}
@@ -16130,8 +16230,8 @@ explain extended select *
from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t
where t2.b < 40 and t2.a=t3.a and t3.c=t.c;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 90 100.00 Using where
-1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL 90 33.33 Using where
+1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00
2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary
Warnings:
@@ -16147,7 +16247,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 90,
- "filtered": 100,
+ "filtered": 33.333,
"attached_condition": "t2.b < 40 and t2.a is not null"
},
"table": {
@@ -16158,7 +16258,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t2.a"],
- "rows": 2,
+ "rows": 1,
"filtered": 100,
"attached_condition": "t3.c is not null"
},
@@ -16214,9 +16314,13 @@ INSERT INTO t4 VALUES
(5,'zzz'),(9,'xyz'),(2,'yxz'),(5,'zxy'),(7,'zyx') ;
ANALYZE TABLE t1,t2,t3,t4;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
+test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
CREATE VIEW v1 AS
SELECT c FROM t3
@@ -16558,8 +16662,11 @@ INSERT INTO t3 VALUES
(3), (4), (1), (8), (3);
ANALYZE tables t1,t2,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SELECT *
FROM t3,
@@ -16589,7 +16696,7 @@ WHERE t3.d = dt.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t3.d 2 100.00
-2 LATERAL DERIVED t1 ref idx_b idx_b 5 test.t3.d 2 100.00 Using index; Using temporary; Using filesort
+2 LATERAL DERIVED t1 ref idx_b idx_b 5 test.t3.d 1 100.00 Using index; Using temporary; Using filesort
2 LATERAL DERIVED t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1003 /* select#1 */ select `test`.`t3`.`d` AS `d`,`dt`.`b` AS `b`,`dt`.`c` AS `c` from `test`.`t3` join (/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`b` = `test`.`t3`.`d` group by `test`.`t1`.`b`,`test`.`t2`.`c`) `dt` where `dt`.`b` = `test`.`t3`.`d`
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index 659bc2026ff..076d39c1abd 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -2075,6 +2075,33 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-17574: pushdown into derived from mergeable view
+--echo # used in multi-table UPDATE
+--echo # pushdown into materialized derived from mergeable view
+--echo # used in SELECT
+--echo #
+
+CREATE TABLE t1 (f1 text, f2 int);
+INSERT INTO t1 VALUES ('x',1), ('y',2);
+
+CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t;
+let $q1 =
+UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
+eval $q1;
+eval EXPLAIN FORMAT=JSON $q1;
+
+SELECT * FROM t1;
+
+CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t;
+let $q2 =
+SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
+eval $q2;
+eval EXPLAIN FORMAT=JSON $q2;
+
+DROP VIEW v1,v2;
+DROP TABLE t1;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result
index 21dbd494e4b..5073aa84c13 100644
--- a/mysql-test/main/derived_split_innodb.result
+++ b/mysql-test/main/derived_split_innodb.result
@@ -11,6 +11,7 @@ KEY n1_c1_n2 (n1,c1,n2)
INSERT INTO t1 VALUES (0, 2, 'a'), (1, 3, 'a');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t
WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1;
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 86dd73f5733..45de32d1ee1 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -2939,21 +2939,23 @@ insert into t2 select b+10 from t2;
insert into t2 select b+10 from t2;
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain select a from t1 where a in (select b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
-1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
+1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1)
explain select * from (select a from t1 where a in (select b from t2)) t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
-1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
+1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1)
create view v1 as select a from t1 where a in (select b from t2);
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
-1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
+1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1)
drop view v1;
drop table t1,t2;
#
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def
index e83ff00d10b..eecee845a35 100644
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@ -14,11 +14,10 @@ events_time_zone : Test is not predictable as it depends on precise timi
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
#show_explain : Psergey: random timeout in range-checked-for-each record query.
-ssl_crl_clients_valid : broken upstream
-ssl_crl : broken upstream
-ssl_crl_clrpath : broken upstream
innodb-wl5522-debug-zip : broken upstream
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
-connect-abstract : waiting for libmariadb update
+mysqlcheck : special tables like proxy , host specific to a system are shown
+flush_read_lock : special tables like proxy , host specific to a system are shown
+join_cache : enable after MDEV-17752 is fixed
diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result
index 70bce519ad2..8fcc45e740a 100644
--- a/mysql-test/main/distinct.result
+++ b/mysql-test/main/distinct.result
@@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3);
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using where; Using temporary
+1 SIMPLE t2 index a a 4 NULL 5 Using index; Using temporary
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using where
1 SIMPLE t3 ref a a 5 test.t1.b 2 Using index
-1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Using join buffer (flat, BNL join)
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -1049,4 +1049,24 @@ b1+'0' b2+'0' b3+'0' b4+'0' b5+'0' b6 +'0'
1 0 0 1 0 1
0 1 0 0 1 0
DROP TABLE t1;
+#
+# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
+# or Invalid write in JOIN::make_aggr_tables_info
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2);
+explain
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
+UNION
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary
+2 UNCACHEABLE UNION t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
+UNION
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
+1
+1
+drop table t1;
End of 5.5 tests
diff --git a/mysql-test/main/distinct.test b/mysql-test/main/distinct.test
index c11f8b501bc..d41340c29fd 100644
--- a/mysql-test/main/distinct.test
+++ b/mysql-test/main/distinct.test
@@ -798,4 +798,22 @@ CREATE TABLE t1 (b1 BIT, b2 BIT, b3 BIT, b4 BIT , b5 BIT, b6 BIT);
INSERT INTO t1 VALUES (1,0,0,1,0,1),(0,1,0,0,1,0);
SELECT DISTINCT b1+'0', b2+'0', b3+'0', b4+'0', b5+'0', b6 +'0' FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
+--echo # or Invalid write in JOIN::make_aggr_tables_info
+--echo #
+
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2);
+explain
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
+UNION
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
+
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
+UNION
+( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
+drop table t1;
+
--echo End of 5.5 tests
diff --git a/mysql-test/main/empty_user_table.result b/mysql-test/main/empty_user_table.result
index 54a7fd4907b..924e4cd8ea5 100644
--- a/mysql-test/main/empty_user_table.result
+++ b/mysql-test/main/empty_user_table.result
@@ -1,9 +1,14 @@
-create table t1 as select * from mysql.user;
-truncate table mysql.user;
+create table t1 as select * from mysql.global_priv;
+truncate table mysql.global_priv;
flush privileges;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u1;
Got one of the listed errors
-insert mysql.user select * from t1;
+insert mysql.global_priv select * from t1;
drop table t1;
flush privileges;
+truncate table mysql.user;
+flush privileges;
+connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
+connect fail,localhost,u1;
+Got one of the listed errors
diff --git a/mysql-test/main/empty_user_table.test b/mysql-test/main/empty_user_table.test
index b54f2109e30..8a544fece83 100644
--- a/mysql-test/main/empty_user_table.test
+++ b/mysql-test/main/empty_user_table.test
@@ -4,8 +4,8 @@
source include/not_embedded.inc;
-create table t1 as select * from mysql.user;
-truncate table mysql.user;
+create table t1 as select * from mysql.global_priv;
+truncate table mysql.global_priv;
flush privileges;
# connecting via unix socket gives ER_ACCESS_DENIED_ERROR
@@ -14,7 +14,23 @@ flush privileges;
--error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED
connect (fail,localhost,u1);
-insert mysql.user select * from t1;
+insert mysql.global_priv select * from t1;
drop table t1;
flush privileges;
+#
+# same with mysql.user
+#
+
+source include/switch_to_mysql_user.inc;
+truncate table mysql.user;
+
+flush privileges;
+
+# connecting via unix socket gives ER_ACCESS_DENIED_ERROR
+# connecting via tcp/ip gives ER_HOST_NOT_PRIVILEGED
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED
+connect (fail,localhost,u1);
+
+source include/switch_to_mysql_global_priv.inc;
diff --git a/mysql-test/main/events_bugs.result b/mysql-test/main/events_bugs.result
index b56912dea7e..3e770451735 100644
--- a/mysql-test/main/events_bugs.result
+++ b/mysql-test/main/events_bugs.result
@@ -96,7 +96,7 @@ select release_lock('ee_16407_2');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
insert into events_test.events_smode_test values ('test','1980-19-02')|
-ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '1980-19-02' for column `events_test`.`events_smode_test`.`a` at row 1
"This is ok"
create event ee_16407_3 on schedule every 60 second do
begin
diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result
index df82b2e31cc..2f60a827cc0 100644
--- a/mysql-test/main/explain_json.result
+++ b/mysql-test/main/explain_json.result
@@ -1029,6 +1029,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c);
create index idx_t1_2 on t1 (a1,a2,b);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/explain_non_select.result b/mysql-test/main/explain_non_select.result
index 5a6b9f841c2..51414d0c196 100644
--- a/mysql-test/main/explain_non_select.result
+++ b/mysql-test/main/explain_non_select.result
@@ -229,7 +229,7 @@ INSERT INTO t1 VALUES (1),(2);
EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-1 SIMPLE user index NULL PRIMARY 420 NULL 4 Using index
+1 SIMPLE global_priv index NULL PRIMARY 420 NULL 4 Using index
DROP TABLE t1;
DROP VIEW v1;
#
diff --git a/mysql-test/main/failed_auth_3909.result b/mysql-test/main/failed_auth_3909.result
index 4c3c0aba9df..19951415585 100644
--- a/mysql-test/main/failed_auth_3909.result
+++ b/mysql-test/main/failed_auth_3909.result
@@ -1,24 +1,17 @@
-optimize table mysql.user;
-Table Op Msg_type Msg_text
-mysql.user optimize status OK
-insert ignore mysql.user (user,plugin) values ('foo','mysql_old_password'),('bar','mysql_old_password'),('baz','mysql_old_password');
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
-flush privileges;
+create user foo identified via mysql_old_password;
+create user bar identified via mysql_old_password;
+create user baz identified via mysql_old_password;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u1;
-ERROR HY000: Server is running in --secure-auth mode, but 'u1'@'localhost' has a password in the old format; please change the password to the new format
+ERROR 28000: Access denied for user 'u1'@'localhost' (using password: NO)
connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u2;
-ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
+ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format
connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u2,password;
-ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
-ERROR HY000: Server is running in --secure-auth mode, but 'u1'@'localhost' has a password in the old format; please change the password to the new format
-ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
-ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
+ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format
+ERROR 28000: Access denied for user 'u1'@'localhost' (using password: NO)
+ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format
+ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format
delete from mysql.user where plugin = 'mysql_old_password';
flush privileges;
diff --git a/mysql-test/main/failed_auth_3909.test b/mysql-test/main/failed_auth_3909.test
index fb104cf4b81..25e45e49a0e 100644
--- a/mysql-test/main/failed_auth_3909.test
+++ b/mysql-test/main/failed_auth_3909.test
@@ -6,29 +6,29 @@ source include/not_embedded.inc;
# verify that for some failed login attemps (with wrong user names)
# the server requests a plugin
#
-optimize table mysql.user;
-insert ignore mysql.user (user,plugin) values ('foo','mysql_old_password'),('bar','mysql_old_password'),('baz','mysql_old_password');
-flush privileges;
+create user foo identified via mysql_old_password;
+create user bar identified via mysql_old_password;
+create user baz identified via mysql_old_password;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_SERVER_IS_IN_SECURE_AUTH_MODE
+--error ER_ACCESS_DENIED_ERROR
connect (fail,localhost,u1);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
+--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
connect (fail,localhost,u2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
+--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
connect (fail,localhost,u2,password);
---error ER_SERVER_IS_IN_SECURE_AUTH_MODE
+--error ER_ACCESS_DENIED_ERROR
change_user u1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
change_user u2;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
change_user u2,password;
delete from mysql.user where plugin = 'mysql_old_password';
diff --git a/mysql-test/main/failed_auth_unixsocket.result b/mysql-test/main/failed_auth_unixsocket.result
index 3b2cff7e845..b2081c9ba84 100644
--- a/mysql-test/main/failed_auth_unixsocket.result
+++ b/mysql-test/main/failed_auth_unixsocket.result
@@ -1,4 +1,4 @@
-update mysql.user set plugin='unix_socket';
+update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket');
flush privileges;
Warnings:
Warning 1524 Plugin 'unix_socket' is not loaded
@@ -13,6 +13,6 @@ flush privileges;
connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'USER'@'localhost'
ERROR 28000: Access denied for user 'USER'@'localhost'
-update mysql.user set plugin='';
+update mysql.global_priv set priv=json_remove(priv, '$.plugin');
flush privileges;
uninstall plugin unix_socket;
diff --git a/mysql-test/main/failed_auth_unixsocket.test b/mysql-test/main/failed_auth_unixsocket.test
index 5dfd9585882..179e561e9ed 100644
--- a/mysql-test/main/failed_auth_unixsocket.test
+++ b/mysql-test/main/failed_auth_unixsocket.test
@@ -4,7 +4,7 @@
# MDEV-3909 remote user enumeration
# unix_socket tests
#
-update mysql.user set plugin='unix_socket';
+update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket');
flush privileges;
# Make sure that the replace works, even if $USER is 'user' or something else
@@ -36,7 +36,7 @@ connect (fail,localhost,$USER);
--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
change_user $USER;
-update mysql.user set plugin='';
+update mysql.global_priv set priv=json_remove(priv, '$.plugin');
flush privileges;
uninstall plugin unix_socket;
diff --git a/mysql-test/main/flush.result b/mysql-test/main/flush.result
index af8e327657b..8149ce29dec 100644
--- a/mysql-test/main/flush.result
+++ b/mysql-test/main/flush.result
@@ -364,16 +364,19 @@ flush table t1;
connection default;
# Let flush table sync in.
select * from t1;
+a
connection con1;
select * from t1;
a
unlock tables;
+connection default;
+select count(*) from information_schema.processlist where state = "Waiting for table metadata lock";
+count(*)
+1
+commit;
connection con2;
# Reaping 'flush table t1'...
connection default;
-# Reaping 'select * from t1'...
-a
-commit;
#
# Repeat the same test but with FLUSH TABLES
#
@@ -386,13 +389,10 @@ connection con1;
#
lock table t1 read;
connection con2;
-#
-# FLUSH TABLES expels the table definition from the cache.
-# Sending 'flush tables'...
flush tables;
connection default;
-# Let flush table sync in.
select * from t1;
+a
connection con1;
select * from t1;
a
@@ -400,8 +400,6 @@ unlock tables;
connection con2;
# Reaping 'flush tables'...
connection default;
-# Reaping 'select * from t1'...
-a
commit;
# Cleanup
connection con1;
@@ -472,10 +470,7 @@ create table t1 (i int);
create table t2 (i int);
handler t1 open;
connection con1;
-# Sending:
flush tables with read lock;
-connection con2;
-# Wait until FTWRL starts waiting for 't1' to be closed.
connection default;
# The below statement should not cause deadlock.
# Sending:
@@ -483,8 +478,6 @@ insert into t2 values (1);
connection con2;
# Wait until INSERT starts to wait for FTWRL to go away.
connection con1;
-# FTWRL should be able to continue now.
-# Reap FTWRL.
unlock tables;
connection default;
# Reap INSERT.
diff --git a/mysql-test/main/flush.test b/mysql-test/main/flush.test
index 51b5c48c137..17f9241a122 100644
--- a/mysql-test/main/flush.test
+++ b/mysql-test/main/flush.test
@@ -449,24 +449,20 @@ connection default;
--echo # Let flush table sync in.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
+ where state = "Waiting for table metadata lock"
and info = "flush table t1";
--source include/wait_condition.inc
-send select * from t1;
+select * from t1;
connection con1;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "select * from t1";
select * from t1;
unlock tables;
+connection default;
+select count(*) from information_schema.processlist where state = "Waiting for table metadata lock";
+commit;
connection con2;
--echo # Reaping 'flush table t1'...
reap;
connection default;
---echo # Reaping 'select * from t1'...
-reap;
-commit;
--echo #
--echo # Repeat the same test but with FLUSH TABLES
@@ -480,31 +476,16 @@ connection con1;
--echo #
lock table t1 read;
connection con2;
---echo #
---echo # FLUSH TABLES expels the table definition from the cache.
---echo # Sending 'flush tables'...
send flush tables;
connection default;
---echo # Let flush table sync in.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "flush tables";
---source include/wait_condition.inc
-send select * from t1;
+select * from t1;
connection con1;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "select * from t1";
select * from t1;
unlock tables;
connection con2;
--echo # Reaping 'flush tables'...
reap;
connection default;
---echo # Reaping 'select * from t1'...
-reap;
commit;
--echo # Cleanup
@@ -566,17 +547,7 @@ create table t2 (i int);
handler t1 open;
connection con1;
---echo # Sending:
---send flush tables with read lock
-
-connection con2;
---echo # Wait until FTWRL starts waiting for 't1' to be closed.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "flush tables with read lock";
---source include/wait_condition.inc
-
+flush tables with read lock;
connection default;
--echo # The below statement should not cause deadlock.
--echo # Sending:
@@ -586,14 +557,11 @@ connection con2;
--echo # Wait until INSERT starts to wait for FTWRL to go away.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock"
+ where state = "Waiting for backup lock"
and info = "insert into t2 values (1)";
--source include/wait_condition.inc
connection con1;
---echo # FTWRL should be able to continue now.
---echo # Reap FTWRL.
---reap
unlock tables;
connection default;
diff --git a/mysql-test/main/flush_block_commit.test b/mysql-test/main/flush_block_commit.test
index 6a6120ce63f..0280aedf2ca 100644
--- a/mysql-test/main/flush_block_commit.test
+++ b/mysql-test/main/flush_block_commit.test
@@ -32,7 +32,7 @@ connection con2;
--echo # Wait until COMMIT gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and info = "COMMIT";
+ where state = "Waiting for backup lock" and info = "COMMIT";
--source include/wait_condition.inc
--echo # Verify that 'con1' was blocked and data did not move.
SELECT * FROM t1;
diff --git a/mysql-test/main/flush_block_commit_notembedded.test b/mysql-test/main/flush_block_commit_notembedded.test
index 3d894c5f16c..5be9e50e58b 100644
--- a/mysql-test/main/flush_block_commit_notembedded.test
+++ b/mysql-test/main/flush_block_commit_notembedded.test
@@ -46,7 +46,7 @@ begin;
connection con1;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "insert into t1 values (1)";
--source include/wait_condition.inc
unlock tables;
diff --git a/mysql-test/main/flush_read_lock.result b/mysql-test/main/flush_read_lock.result
index 55c31ae8d12..33dc1092190 100644
--- a/mysql-test/main/flush_read_lock.result
+++ b/mysql-test/main/flush_read_lock.result
@@ -652,6 +652,7 @@ connection default;
# 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
# active FTWRL. But since the latter keeps tables open
# FTWRL is blocked by FLUSH TABLES <list> WITH READ LOCK.
+# Fixed by MDEV-5336
flush tables with read lock;
# FT <list> WRL is allowed under FTWRL at the moment.
# It does not make much sense though.
@@ -668,12 +669,9 @@ connection default;
flush tables t1_base, t2_base with read lock;
connection con1;
flush tables with read lock;
-connection con2;
-# Wait until FTWRL is blocked.
connection default;
unlock tables;
connection con1;
-# Reap FTWRL.
unlock tables;
connection default;
#
@@ -1677,3 +1675,57 @@ disconnect con1;
disconnect con2;
disconnect con3;
set global sql_mode=default;
+#
+# Deadlock between FTWRL under open handler and DDL/LOCK TABLES
+#
+CREATE TABLE t1(a INT);
+HANDLER t1 OPEN;
+#
+connect con1,localhost,root,,;
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
+LOCK TABLE t1 WRITE;
+#
+# we need to do it in a separate connection,
+# because SET DEBUG_SYNC call open_tables()/mysql_ha_flush() :(
+connect con2,localhost,root,,;
+SET DEBUG_SYNC= 'now WAIT_FOR ready';
+disconnect con2;
+#
+connection default;
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+HANDLER t1 CLOSE;
+#
+connection con1;
+UNLOCK TABLES;
+disconnect con1;
+#
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+#
+# Make sure pending LOCK TABLES doesn't block FTWRL
+#
+CREATE TABLE t1(a INT);
+LOCK TABLE t1 READ;
+#
+connect con1,localhost,root,,;
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
+LOCK TABLE t1 WRITE;
+#
+connect con2,localhost,root,,;
+SET DEBUG_SYNC= 'now WAIT_FOR ready';
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+disconnect con2;
+#
+connection default;
+UNLOCK TABLES;
+#
+connection con1;
+UNLOCK TABLES;
+disconnect con1;
+#
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/main/flush_read_lock.test b/mysql-test/main/flush_read_lock.test
index 4a9752ae9f1..f39dbecf4a9 100644
--- a/mysql-test/main/flush_read_lock.test
+++ b/mysql-test/main/flush_read_lock.test
@@ -259,7 +259,7 @@ connection $con_aux1;
--echo # Wait until COMMIT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "commit";
--source include/wait_condition.inc
unlock tables;
@@ -281,7 +281,7 @@ connection $con_aux2;
--echo # Wait until FTWRL is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
set debug_sync='now SIGNAL go';
@@ -565,7 +565,7 @@ connection $con_aux1;
--echo # Check that EXECUTE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "insert into t1_base values (1)";
--source include/wait_condition.inc
unlock tables;
@@ -582,7 +582,7 @@ connection $con_aux2;
--echo # Wait until FTWRL is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
set debug_sync='now SIGNAL go';
@@ -800,6 +800,8 @@ connection default;
--echo # 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
--echo # active FTWRL. But since the latter keeps tables open
--echo # FTWRL is blocked by FLUSH TABLES <list> WITH READ LOCK.
+--echo # Fixed by MDEV-5336
+
flush tables with read lock;
--echo # FT <list> WRL is allowed under FTWRL at the moment.
--echo # It does not make much sense though.
@@ -815,19 +817,10 @@ unlock tables;
connection default;
flush tables t1_base, t2_base with read lock;
connection $con_aux1;
---send flush tables with read lock
-connection $con_aux2;
---echo # Wait until FTWRL is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
+flush tables with read lock;
connection default;
unlock tables;
connection $con_aux1;
---echo # Reap FTWRL.
---reap
unlock tables;
connection default;
@@ -1018,7 +1011,7 @@ connection $con_aux1;
--echo # Check that LOCK TABLES WRITE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "lock tables t1_base write";
--source include/wait_condition.inc
unlock tables;
@@ -1062,7 +1055,7 @@ connection $con_aux1;
--echo # Check that OPTIMIZE TABLE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "optimize table t1_base";
--source include/wait_condition.inc
unlock tables;
@@ -1228,7 +1221,7 @@ connection $con_aux1;
--echo # Check that REPAIR TABLE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "repair table t1_base";
--source include/wait_condition.inc
unlock tables;
@@ -1427,7 +1420,7 @@ connection $con_aux1;
--echo # Wait until SET AUTOCOMMIT=1 is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "set autocommit= 1";
--source include/wait_condition.inc
unlock tables;
@@ -1449,7 +1442,7 @@ connection $con_aux2;
--echo # Wait until FTWRL is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
set debug_sync='now SIGNAL go';
@@ -1628,7 +1621,7 @@ connection $con_aux1;
--echo # Wait until XA COMMIT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "xa commit 'test1'";
--source include/wait_condition.inc
unlock tables;
@@ -1652,7 +1645,7 @@ connection $con_aux2;
--echo # Wait until FTWRL is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
set debug_sync='now SIGNAL go';
@@ -1731,7 +1724,7 @@ connection $con_aux1;
--echo # Check that ANALYZE TABLE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "analyze table t3_trans";
--source include/wait_condition.inc
unlock tables;
@@ -1806,7 +1799,7 @@ connection $con_aux1;
--echo # Check that CHECK TABLE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "check table t1_base";
--source include/wait_condition.inc
unlock tables;
@@ -1824,7 +1817,7 @@ connection $con_aux1;
--echo # Check that ALTER TABLE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
+ where state = "Waiting for backup lock" and
info = "alter table t1_temp add column c1 int";
--source include/wait_condition.inc
unlock tables;
@@ -1877,7 +1870,7 @@ connection $con_aux2;
--echo # Wait until FTWRL is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
--echo # Try to run another INSERT and see that it is blocked.
@@ -1886,7 +1879,7 @@ connection con3;
--echo # Wait until new INSERT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "insert into t2_base values (1)";
--echo # Unblock INSERT in the first connection.
set debug_sync='now SIGNAL go';
@@ -2022,3 +2015,73 @@ set global sql_mode=default;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
+
+
+--echo #
+--echo # Deadlock between FTWRL under open handler and DDL/LOCK TABLES
+--echo #
+CREATE TABLE t1(a INT);
+HANDLER t1 OPEN;
+
+--echo #
+connect (con1,localhost,root,,);
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
+--send LOCK TABLE t1 WRITE
+
+--echo #
+--echo # we need to do it in a separate connection,
+--echo # because SET DEBUG_SYNC call open_tables()/mysql_ha_flush() :(
+connect (con2,localhost,root,,);
+SET DEBUG_SYNC= 'now WAIT_FOR ready';
+disconnect con2;
+
+--echo #
+connection default;
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+HANDLER t1 CLOSE;
+
+--echo #
+connection con1;
+reap;
+UNLOCK TABLES;
+disconnect con1;
+
+--echo #
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+
+
+--echo #
+--echo # Make sure pending LOCK TABLES doesn't block FTWRL
+--echo #
+CREATE TABLE t1(a INT);
+LOCK TABLE t1 READ;
+
+--echo #
+connect (con1,localhost,root,,);
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
+--send LOCK TABLE t1 WRITE
+
+--echo #
+connect (con2,localhost,root,,);
+SET DEBUG_SYNC= 'now WAIT_FOR ready';
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+disconnect con2;
+
+--echo #
+connection default;
+UNLOCK TABLES;
+
+--echo #
+connection con1;
+reap;
+UNLOCK TABLES;
+disconnect con1;
+
+--echo #
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/main/flush_read_lock_kill.test b/mysql-test/main/flush_read_lock_kill.test
index d83e5b3f1df..bd3efd7bdc4 100644
--- a/mysql-test/main/flush_read_lock_kill.test
+++ b/mysql-test/main/flush_read_lock_kill.test
@@ -51,7 +51,7 @@ SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
--echo # to active COMMIT
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock"
+ where state = "Waiting for backup lock"
and info = "flush tables with read lock";
--source include/wait_condition.inc
diff --git a/mysql-test/main/flush_ssl.result b/mysql-test/main/flush_ssl.result
new file mode 100644
index 00000000000..e2941db9f95
--- /dev/null
+++ b/mysql-test/main/flush_ssl.result
@@ -0,0 +1,26 @@
+# Kill the server
+connect ssl_con,localhost,root,,,,,SSL;
+SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after';
+# Use a different certificate ("Not after" certificate field changed)
+FLUSH SSL;
+# Check new certificate used by new connection
+Result
+OK
+# Check that existing SSL connection still works, and uses old certificate, even if new one is loaded in FLUSH SSL
+connection ssl_con;
+SELECT IF(VARIABLE_VALUE=@ssl_not_after,'OK','FAIL') as Result FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after';
+Result
+OK
+disconnect ssl_con;
+connection default;
+SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts');
+NAME VALUE
+SSL_ACCEPTS 1
+SSL_FINISHED_ACCEPTS 1
+FLUSH SSL;
+SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts');
+NAME VALUE
+SSL_ACCEPTS 0
+SSL_FINISHED_ACCEPTS 0
+# Cleanup
+# Kill the server
diff --git a/mysql-test/main/flush_ssl.test b/mysql-test/main/flush_ssl.test
new file mode 100644
index 00000000000..e7bd57b156a
--- /dev/null
+++ b/mysql-test/main/flush_ssl.test
@@ -0,0 +1,61 @@
+# MDEV-16266 Reload SSL certificate
+# This test reloads server SSL certs FLUSH SSL, and checks that
+# 1. old SSL connections (that existed before FLUSH) still work and use old certificate
+# 2. new SSL connection use new certificate
+# 3. if FLUSH SSL runs into error, SSL is still functioning
+# SWtatus variable Ssl_server_not_after is used to tell the old certificate from new.
+
+
+source include/have_ssl_communication.inc;
+
+# Restart server with cert. files located in temp directory
+# We are going to remove / replace them within the test,
+# so we can't use the ones in std_data directly.
+
+let $ssl_cert=$MYSQLTEST_VARDIR/tmp/ssl_cert.pem;
+let $ssl_key=$MYSQLTEST_VARDIR/tmp/ssl_key.pem;
+
+copy_file $MYSQL_TEST_DIR/std_data/server-key.pem $ssl_key;
+copy_file $MYSQL_TEST_DIR/std_data/server-cert.pem $ssl_cert;
+
+let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert;
+--source include/kill_mysqld.inc
+--source include/start_mysqld.inc
+
+connect ssl_con,localhost,root,,,,,SSL;
+SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after';
+let $ssl_not_after=`SELECT @ssl_not_after`;
+
+remove_file $ssl_cert;
+remove_file $ssl_key;
+
+--echo # Use a different certificate ("Not after" certificate field changed)
+copy_file $MYSQL_TEST_DIR/std_data/server-new-key.pem $ssl_key;
+copy_file $MYSQL_TEST_DIR/std_data/server-new-cert.pem $ssl_cert;
+
+FLUSH SSL;
+
+--echo # Check new certificate used by new connection
+exec $MYSQL --ssl -e "SELECT IF(VARIABLE_VALUE <> '$ssl_not_after', 'OK', 'FAIL') as Result FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'";
+
+--echo # Check that existing SSL connection still works, and uses old certificate, even if new one is loaded in FLUSH SSL
+connection ssl_con;
+SELECT IF(VARIABLE_VALUE=@ssl_not_after,'OK','FAIL') as Result FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after';
+
+disconnect ssl_con;
+connection default;
+
+SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts');
+FLUSH SSL;
+#Check that accepts are zeroed by FLUSH SSL.
+SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts');
+
+--echo # Cleanup
+remove_file $ssl_cert;
+remove_file $ssl_key;
+# restart with usuall SSL
+let $restart_parameters=;
+--source include/kill_mysqld.inc
+--source include/start_mysqld.inc
+
+
diff --git a/mysql-test/main/fulltext.result b/mysql-test/main/fulltext.result
index 308d1d7fcb9..3f4223eee07 100644
--- a/mysql-test/main/fulltext.result
+++ b/mysql-test/main/fulltext.result
@@ -382,10 +382,10 @@ aus Osnabrück utf8_general_ci 1.591140
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
Warnings:
-Warning 1366 Incorrect string value: '\xD0\xAD\xD1\x82\xD0\xBE...' for column 't' at row 3
-Warning 1366 Incorrect string value: '\xD0\x9E\xD1\x82\xD0\xBB...' for column 't' at row 4
-Warning 1366 Incorrect string value: '\xD0\x9D\xD0\xB5 \xD0...' for column 't' at row 5
-Warning 1366 Incorrect string value: '\xD0\xB8 \xD0\xB1\xD1...' for column 't' at row 6
+Warning 1366 Incorrect string value: '\xD0\xAD\xD1\x82\xD0\xBE...' for column `test`.`t1`.`t` at row 3
+Warning 1366 Incorrect string value: '\xD0\x9E\xD1\x82\xD0\xBB...' for column `test`.`t1`.`t` at row 4
+Warning 1366 Incorrect string value: '\xD0\x9D\xD0\xB5 \xD0...' for column `test`.`t1`.`t` at row 5
+Warning 1366 Incorrect string value: '\xD0\xB8 \xD0\xB1\xD1...' for column `test`.`t1`.`t` at row 6
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
t collation(t)
aus Osnabrück latin1_german2_ci
diff --git a/mysql-test/main/func_default.result b/mysql-test/main/func_default.result
index 535be10da86..9699f0795e3 100644
--- a/mysql-test/main/func_default.result
+++ b/mysql-test/main/func_default.result
@@ -8,13 +8,21 @@ explain extended select default(str), default(strnull), default(intg), default(r
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select default('') AS `default(str)`,default('') AS `default(strnull)`,default(0) AS `default(intg)`,default(0) AS `default(rel)` from dual
+Note 1003 select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from dual
select * from t1 where str <> default(str);
str strnull intg rel
0 0
explain select * from t1 where str <> default(str);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
+create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1;
+select * from v1;
+default(str) default(strnull) default(intg) default(rel)
+def NULL 10 3.14
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select default(`t1`.`str`) AS `default(str)`,default(`t1`.`strnull`) AS `default(strnull)`,default(`t1`.`intg`) AS `default(intg)`,default(`t1`.`rel`) AS `default(rel)` from `t1` latin1 latin1_swedish_ci
+drop view v1;
drop table t1;
CREATE TABLE t1 (id int(11), s varchar(20));
INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
diff --git a/mysql-test/main/func_default.test b/mysql-test/main/func_default.test
index fbd73990297..332bfca021f 100644
--- a/mysql-test/main/func_default.test
+++ b/mysql-test/main/func_default.test
@@ -11,6 +11,11 @@ explain extended select default(str), default(strnull), default(intg), default(r
select * from t1 where str <> default(str);
explain select * from t1 where str <> default(str);
+create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
#TODO: uncomment when bug will be fixed
#create table t2 select default(str), default(strnull), default(intg), default(rel) from t1;
#show create table from t1;
diff --git a/mysql-test/main/func_extract.result b/mysql-test/main/func_extract.result
new file mode 100644
index 00000000000..30ec0460d61
--- /dev/null
+++ b/mysql-test/main/func_extract.result
@@ -0,0 +1,592 @@
+#
+# MDEV-17385 MICROSECOND() returns confusing results with an out-of-range TIME-alike argument
+#
+CREATE TABLE t1 (v VARCHAR(64), ll BIGINT, t TIME, dt DATETIME, d DATE);
+CREATE TABLE t2 AS SELECT
+EXTRACT(DAY FROM t),
+EXTRACT(DAY_HOUR FROM t),
+EXTRACT(DAY_MINUTE FROM t),
+EXTRACT(DAY_SECOND FROM t),
+EXTRACT(DAY_MICROSECOND FROM t),
+EXTRACT(DAY FROM d),
+EXTRACT(DAY_HOUR FROM d),
+EXTRACT(DAY_MINUTE FROM d),
+EXTRACT(DAY_SECOND FROM d),
+EXTRACT(DAY_MICROSECOND FROM d),
+EXTRACT(DAY FROM v),
+EXTRACT(DAY_HOUR FROM v),
+EXTRACT(DAY_MINUTE FROM v),
+EXTRACT(DAY_SECOND FROM v),
+EXTRACT(DAY_MICROSECOND FROM v),
+EXTRACT(DAY FROM ll),
+EXTRACT(DAY_HOUR FROM ll),
+EXTRACT(DAY_MINUTE FROM ll),
+EXTRACT(DAY_SECOND FROM ll),
+EXTRACT(DAY_MICROSECOND FROM ll)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXTRACT(DAY FROM t)` int(3) DEFAULT NULL,
+ `EXTRACT(DAY_HOUR FROM t)` int(5) DEFAULT NULL,
+ `EXTRACT(DAY_MINUTE FROM t)` int(7) DEFAULT NULL,
+ `EXTRACT(DAY_SECOND FROM t)` int(9) DEFAULT NULL,
+ `EXTRACT(DAY_MICROSECOND FROM t)` bigint(15) DEFAULT NULL,
+ `EXTRACT(DAY FROM d)` int(3) DEFAULT NULL,
+ `EXTRACT(DAY_HOUR FROM d)` int(5) DEFAULT NULL,
+ `EXTRACT(DAY_MINUTE FROM d)` int(7) DEFAULT NULL,
+ `EXTRACT(DAY_SECOND FROM d)` int(9) DEFAULT NULL,
+ `EXTRACT(DAY_MICROSECOND FROM d)` bigint(15) DEFAULT NULL,
+ `EXTRACT(DAY FROM v)` int(8) DEFAULT NULL,
+ `EXTRACT(DAY_HOUR FROM v)` int(10) DEFAULT NULL,
+ `EXTRACT(DAY_MINUTE FROM v)` bigint(12) DEFAULT NULL,
+ `EXTRACT(DAY_SECOND FROM v)` bigint(14) DEFAULT NULL,
+ `EXTRACT(DAY_MICROSECOND FROM v)` bigint(20) DEFAULT NULL,
+ `EXTRACT(DAY FROM ll)` int(8) DEFAULT NULL,
+ `EXTRACT(DAY_HOUR FROM ll)` int(10) DEFAULT NULL,
+ `EXTRACT(DAY_MINUTE FROM ll)` bigint(12) DEFAULT NULL,
+ `EXTRACT(DAY_SECOND FROM ll)` bigint(14) DEFAULT NULL,
+ `EXTRACT(DAY_MICROSECOND FROM ll)` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64), b DECIMAL(32,9));
+INSERT INTO t1 VALUES
+('9999-12-31 23:59:59.123456', 99991231235959.123456),
+('2001-01-01 10:20:30.123456', 20010101102030.123456),
+('4294967296:59:59.123456', 42949672965959.123456),
+('4294967295:59:59.123456', 42949672955959.123456),
+('87649416:59:59.123456', 876494165959.123456),
+('87649415:59:59.123456', 876494155959.123456),
+('87649414:59:59.123456', 876494145959.123456),
+('9999:59:59.123456', 99995959.123456),
+('9999:01:01.123456', 99990101.123456),
+('9999:01:01', 99990101),
+('0.999999', 0.999999),
+('0.99999', 0.99999),
+('0.9999', 0.9999),
+('0.999', 0.999),
+('0.99', 0.99),
+('0.9', 0.9),
+('000000',0);
+# Summary:
+# Check that FUNC(varchar) and FUNC(decimal) give equal results
+# Expect empty sets
+SELECT a, b, EXTRACT(DAY_HOUR FROM a), EXTRACT(DAY_HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(DAY_HOUR FROM a)<=>EXTRACT(DAY_HOUR FROM b));
+a b EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_HOUR FROM b)
+SELECT a, b, EXTRACT(DAY FROM a), EXTRACT(DAY FROM b) FROM t1 WHERE NOT (EXTRACT(DAY FROM a)<=>EXTRACT(DAY FROM b));
+a b EXTRACT(DAY FROM a) EXTRACT(DAY FROM b)
+SELECT a, b, EXTRACT(HOUR FROM a), EXTRACT(HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(HOUR FROM a)<=>EXTRACT(HOUR FROM b));
+a b EXTRACT(HOUR FROM a) EXTRACT(HOUR FROM b)
+SELECT a, b, EXTRACT(MINUTE FROM a), EXTRACT(MINUTE FROM b) FROM t1 WHERE NOT (EXTRACT(MINUTE FROM a)<=>EXTRACT(MINUTE FROM b));
+a b EXTRACT(MINUTE FROM a) EXTRACT(MINUTE FROM b)
+SELECT a, b, EXTRACT(SECOND FROM a), EXTRACT(SECOND FROM b) FROM t1 WHERE NOT (EXTRACT(SECOND FROM a)<=>EXTRACT(SECOND FROM b));
+a b EXTRACT(SECOND FROM a) EXTRACT(SECOND FROM b)
+SELECT a, b, EXTRACT(MICROSECOND FROM a), EXTRACT(MICROSECOND FROM b) FROM t1 WHERE NOT (EXTRACT(MICROSECOND FROM a)<=>EXTRACT(MICROSECOND FROM b));
+a b EXTRACT(MICROSECOND FROM a) EXTRACT(MICROSECOND FROM b)
+# Detailed results
+SELECT
+a,
+CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm,
+EXTRACT(DAY FROM a) * 24 + EXTRACT(HOUR FROM a) AS dh,
+EXTRACT(DAY_HOUR FROM a),
+EXTRACT(DAY FROM a),
+EXTRACT(HOUR FROM a),
+EXTRACT(MINUTE FROM a),
+EXTRACT(SECOND FROM a),
+EXTRACT(MICROSECOND FROM a)
+FROM t1;
+a cidm dh EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a)
+9999-12-31 23:59:59.123456 NULL 767 3123 31 23 59 59 123456
+2001-01-01 10:20:30.123456 NULL 34 110 1 10 20 30 123456
+4294967296:59:59.123456 NULL NULL NULL NULL NULL NULL NULL NULL
+4294967295:59:59.123456 NULL NULL NULL NULL NULL NULL NULL NULL
+87649416:59:59.123456 NULL NULL NULL NULL NULL NULL NULL NULL
+87649415:59:59.123456 3652058 23:59:59.123456 87649415 365205823 3652058 23 59 59 123456
+87649414:59:59.123456 3652058 22:59:59.123456 87649414 365205822 3652058 22 59 59 123456
+9999:59:59.123456 416 15:59:59.123456 9999 41615 416 15 59 59 123456
+9999:01:01.123456 416 15:01:01.123456 9999 41615 416 15 1 1 123456
+9999:01:01 416 15:01:01.000000 9999 41615 416 15 1 1 0
+0.999999 00:00:00.999999 0 0 0 0 0 0 999999
+0.99999 00:00:00.999990 0 0 0 0 0 0 999990
+0.9999 00:00:00.999900 0 0 0 0 0 0 999900
+0.999 00:00:00.999000 0 0 0 0 0 0 999000
+0.99 00:00:00.990000 0 0 0 0 0 0 990000
+0.9 00:00:00.900000 0 0 0 0 0 0 900000
+000000 00:00:00.000000 0 0 0 0 0 0 0
+Warnings:
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '9999-12-31 23:59:59.123456'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01 10:20:30.123456'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967296:59:59.123456'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect interval value: '4294967295:59:59.123456'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+Warning 1292 Incorrect interval value: '87649416:59:59.123456'
+SELECT
+b,
+CAST(b AS INTERVAL DAY_SECOND(6)) AS cidm,
+EXTRACT(DAY FROM b) * 24 + EXTRACT(HOUR FROM b) AS dh,
+EXTRACT(DAY_HOUR FROM b),
+EXTRACT(DAY FROM b),
+EXTRACT(HOUR FROM b),
+EXTRACT(MINUTE FROM b),
+EXTRACT(SECOND FROM b),
+EXTRACT(MICROSECOND FROM b)
+FROM t1;
+b cidm dh EXTRACT(DAY_HOUR FROM b) EXTRACT(DAY FROM b) EXTRACT(HOUR FROM b) EXTRACT(MINUTE FROM b) EXTRACT(SECOND FROM b) EXTRACT(MICROSECOND FROM b)
+99991231235959.123456000 NULL 767 3123 31 23 59 59 123456
+20010101102030.123456000 NULL 34 110 1 10 20 30 123456
+42949672965959.123456000 NULL NULL NULL NULL NULL NULL NULL NULL
+42949672955959.123456000 NULL NULL NULL NULL NULL NULL NULL NULL
+876494165959.123456000 NULL NULL NULL NULL NULL NULL NULL NULL
+876494155959.123456000 3652058 23:59:59.123456 87649415 365205823 3652058 23 59 59 123456
+876494145959.123456000 3652058 22:59:59.123456 87649414 365205822 3652058 22 59 59 123456
+99995959.123456000 416 15:59:59.123456 9999 41615 416 15 59 59 123456
+99990101.123456000 416 15:01:01.123456 9999 41615 416 15 1 1 123456
+99990101.000000000 416 15:01:01.000000 9999 41615 416 15 1 1 0
+0.999999000 00:00:00.999999 0 0 0 0 0 0 999999
+0.999990000 00:00:00.999990 0 0 0 0 0 0 999990
+0.999900000 00:00:00.999900 0 0 0 0 0 0 999900
+0.999000000 00:00:00.999000 0 0 0 0 0 0 999000
+0.990000000 00:00:00.990000 0 0 0 0 0 0 990000
+0.900000000 00:00:00.900000 0 0 0 0 0 0 900000
+0.000000000 00:00:00.000000 0 0 0 0 0 0 0
+Warnings:
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '99991231235959.123456000'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '20010101102030.123456000'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '42949672965959.123456000'
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '42949672955959.123456000'
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '876494165959.123456000'
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494155959.123456000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494145959.123456000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '99995959.123456000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '99990101.123456000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '99990101.000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999999000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999990000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999900000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.990000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.900000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.000000000'
+DROP TABLE t1;
+# Special case: DAY + TIME
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('9999-01-01');
+SELECT a,
+EXTRACT(DAY_HOUR FROM a),
+EXTRACT(DAY_MINUTE FROM a),
+EXTRACT(DAY_SECOND FROM a),
+EXTRACT(DAY_MICROSECOND FROM a),
+EXTRACT(DAY FROM a),
+EXTRACT(HOUR FROM a),
+EXTRACT(MINUTE FROM a),
+EXTRACT(SECOND FROM a),
+EXTRACT(MICROSECOND FROM a)
+FROM t1;
+a EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_MINUTE FROM a) EXTRACT(DAY_SECOND FROM a) EXTRACT(DAY_MICROSECOND FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a)
+9999-01-01 100 10000 1000000 1000000000000 1 0 0 0 0
+DROP TABLE t1;
+# Bad values
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('');
+SELECT a,
+CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm,
+EXTRACT(DAY_HOUR FROM a),
+EXTRACT(DAY_MINUTE FROM a),
+EXTRACT(DAY_SECOND FROM a),
+EXTRACT(DAY_MICROSECOND FROM a),
+EXTRACT(DAY FROM a),
+EXTRACT(HOUR FROM a),
+EXTRACT(MINUTE FROM a),
+EXTRACT(SECOND FROM a),
+EXTRACT(MICROSECOND FROM a)
+FROM t1;
+a cidm EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_MINUTE FROM a) EXTRACT(DAY_SECOND FROM a) EXTRACT(DAY_MICROSECOND FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a)
+ NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+Warnings:
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+Warning 1292 Incorrect interval value: ''
+DROP TABLE t1;
+# Backward compatibility
+# This still parses as DATETIME
+SELECT EXTRACT(YEAR FROM '2001/02/03 10:20:30');
+EXTRACT(YEAR FROM '2001/02/03 10:20:30')
+2001
+SELECT EXTRACT(MONTH FROM '2001/02/03 10:20:30');
+EXTRACT(MONTH FROM '2001/02/03 10:20:30')
+2
+SELECT EXTRACT(DAY FROM '2001/02/03 10:20:30');
+EXTRACT(DAY FROM '2001/02/03 10:20:30')
+3
+SELECT EXTRACT(YEAR FROM '01/02/03 10:20:30');
+EXTRACT(YEAR FROM '01/02/03 10:20:30')
+2001
+SELECT EXTRACT(MONTH FROM '01/02/03 10:20:30');
+EXTRACT(MONTH FROM '01/02/03 10:20:30')
+2
+SELECT EXTRACT(DAY FROM '01/02/03 10:20:30');
+EXTRACT(DAY FROM '01/02/03 10:20:30')
+3
+SELECT EXTRACT(YEAR FROM '01:02:03 10:20:30');
+EXTRACT(YEAR FROM '01:02:03 10:20:30')
+2001
+SELECT EXTRACT(MONTH FROM '01:02:03 10:20:30');
+EXTRACT(MONTH FROM '01:02:03 10:20:30')
+2
+SELECT EXTRACT(DAY FROM '01:02:03 10:20:30');
+EXTRACT(DAY FROM '01:02:03 10:20:30')
+3
+# This still parses as DATETIME and returns NULL
+SELECT EXTRACT(YEAR FROM "2011-02-32 8:46:06.23434");
+EXTRACT(YEAR FROM "2011-02-32 8:46:06.23434")
+NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '2011-02-32 8:46:06.23434'
+SELECT EXTRACT(MONTH FROM "2011-02-32 8:46:06.23434");
+EXTRACT(MONTH FROM "2011-02-32 8:46:06.23434")
+NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '2011-02-32 8:46:06.23434'
+SELECT EXTRACT(DAY FROM "2011-02-32 8:46:06.23434");
+EXTRACT(DAY FROM "2011-02-32 8:46:06.23434")
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '2011-02-32 8:46:06.23434'
+SELECT EXTRACT(HOUR FROM "2011-02-32 8:46:06.23434");
+EXTRACT(HOUR FROM "2011-02-32 8:46:06.23434")
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '2011-02-32 8:46:06.23434'
+# This still parses as DATE
+SELECT EXTRACT(YEAR FROM '2001/02/03');
+EXTRACT(YEAR FROM '2001/02/03')
+2001
+SELECT EXTRACT(MONTH FROM '2001/02/03');
+EXTRACT(MONTH FROM '2001/02/03')
+2
+SELECT EXTRACT(DAY FROM '2001/02/03');
+EXTRACT(DAY FROM '2001/02/03')
+3
+SELECT EXTRACT(YEAR FROM '01/02/03');
+EXTRACT(YEAR FROM '01/02/03')
+2001
+SELECT EXTRACT(MONTH FROM '01/02/03');
+EXTRACT(MONTH FROM '01/02/03')
+2
+SELECT EXTRACT(DAY FROM '01/02/03');
+EXTRACT(DAY FROM '01/02/03')
+3
+SELECT EXTRACT(YEAR FROM '01-02-03');
+EXTRACT(YEAR FROM '01-02-03')
+2001
+SELECT EXTRACT(MONTH FROM '01-02-03');
+EXTRACT(MONTH FROM '01-02-03')
+2
+SELECT EXTRACT(DAY FROM '01-02-03');
+EXTRACT(DAY FROM '01-02-03')
+3
+SELECT EXTRACT(YEAR FROM '1-2-3');
+EXTRACT(YEAR FROM '1-2-3')
+1
+SELECT EXTRACT(MONTH FROM '1-2-3');
+EXTRACT(MONTH FROM '1-2-3')
+2
+SELECT EXTRACT(DAY FROM '1-2-3');
+EXTRACT(DAY FROM '1-2-3')
+3
+SELECT EXTRACT(HOUR FROM '1-2-3');
+EXTRACT(HOUR FROM '1-2-3')
+0
+SELECT EXTRACT(DAY FROM '2024-01-03 garbage /////');
+EXTRACT(DAY FROM '2024-01-03 garbage /////')
+3
+Warnings:
+Warning 1292 Truncated incorrect date value: '2024-01-03 garbage /////'
+SELECT EXTRACT(DAY FROM '24-01-03 garbage /////');
+EXTRACT(DAY FROM '24-01-03 garbage /////')
+3
+Warnings:
+Warning 1292 Truncated incorrect date value: '24-01-03 garbage /////'
+SELECT EXTRACT(DAY FROM '01-02-03');
+EXTRACT(DAY FROM '01-02-03')
+3
+SELECT EXTRACT(DAY FROM '24:02:03T');
+EXTRACT(DAY FROM '24:02:03T')
+3
+SELECT EXTRACT(DAY FROM '24-02-03');
+EXTRACT(DAY FROM '24-02-03')
+3
+SELECT EXTRACT(DAY FROM '24/02/03');
+EXTRACT(DAY FROM '24/02/03')
+3
+SELECT EXTRACT(DAY FROM '11111');
+EXTRACT(DAY FROM '11111')
+1
+SELECT TIME('2001-01-01T'), TIME('2001-01-01T ');
+TIME('2001-01-01T') TIME('2001-01-01T ')
+00:00:00 00:00:00
+SELECT TIME('2001/01/01T'), TIME('2001/01/01T ');
+TIME('2001/01/01T') TIME('2001/01/01T ')
+00:00:00 00:00:00
+SELECT TIME('2001:01:01T'), TIME('2001:01:01T ');
+TIME('2001:01:01T') TIME('2001:01:01T ')
+00:00:00 00:00:00
+SELECT EXTRACT(DAY FROM '2001-01-01T'), EXTRACT(DAY FROM '2001-01-01T ');
+EXTRACT(DAY FROM '2001-01-01T') EXTRACT(DAY FROM '2001-01-01T ')
+1 1
+SELECT EXTRACT(DAY FROM '2001/01/01T'), EXTRACT(DAY FROM '2001/01/01T ');
+EXTRACT(DAY FROM '2001/01/01T') EXTRACT(DAY FROM '2001/01/01T ')
+1 1
+SELECT EXTRACT(DAY FROM '2001:01:01T'), EXTRACT(DAY FROM '2001:01:01T ');
+EXTRACT(DAY FROM '2001:01:01T') EXTRACT(DAY FROM '2001:01:01T ')
+1 1
+SELECT TIME('2001:01:01T'), TIME('2001:01:01T ');
+TIME('2001:01:01T') TIME('2001:01:01T ')
+00:00:00 00:00:00
+SELECT EXTRACT(HOUR FROM '2001-01-01T'), EXTRACT(HOUR FROM '2001-01-01T ');
+EXTRACT(HOUR FROM '2001-01-01T') EXTRACT(HOUR FROM '2001-01-01T ')
+0 0
+SELECT EXTRACT(HOUR FROM '2001/01/01T'), EXTRACT(HOUR FROM '2001/01/01T ');
+EXTRACT(HOUR FROM '2001/01/01T') EXTRACT(HOUR FROM '2001/01/01T ')
+0 0
+SELECT EXTRACT(HOUR FROM '2001:01:01T'), EXTRACT(HOUR FROM '2001:01:01T ');
+EXTRACT(HOUR FROM '2001:01:01T') EXTRACT(HOUR FROM '2001:01:01T ')
+0 0
+# This still parses as DATE and returns NULL (without trying TIME)
+SELECT EXTRACT(DAY FROM '100000:02:03T');
+EXTRACT(DAY FROM '100000:02:03T')
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '100000:02:03T'
+SELECT EXTRACT(DAY FROM '100000/02/03');
+EXTRACT(DAY FROM '100000/02/03')
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '100000/02/03'
+SELECT EXTRACT(DAY FROM '100000-02-03');
+EXTRACT(DAY FROM '100000-02-03')
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '100000-02-03'
+SELECT EXTRACT(DAY FROM '1111');
+EXTRACT(DAY FROM '1111')
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '1111'
+SELECT EXTRACT(DAY FROM '111');
+EXTRACT(DAY FROM '111')
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '111'
+SELECT EXTRACT(DAY FROM '11');
+EXTRACT(DAY FROM '11')
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '11'
+SELECT EXTRACT(DAY FROM '1');
+EXTRACT(DAY FROM '1')
+NULL
+Warnings:
+Warning 1292 Incorrect interval value: '1'
+# This still parses as TIME
+SELECT EXTRACT(HOUR FROM '11111');
+EXTRACT(HOUR FROM '11111')
+1
+SELECT EXTRACT(HOUR FROM '1111');
+EXTRACT(HOUR FROM '1111')
+0
+SELECT EXTRACT(HOUR FROM '111');
+EXTRACT(HOUR FROM '111')
+0
+SELECT EXTRACT(HOUR FROM '11');
+EXTRACT(HOUR FROM '11')
+0
+SELECT EXTRACT(HOUR FROM '1');
+EXTRACT(HOUR FROM '1')
+0
+SELECT TIME('01:02:03:');
+TIME('01:02:03:')
+01:02:03
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03:'
+SELECT TIME('01:02:03-');
+TIME('01:02:03-')
+01:02:03
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03-'
+SELECT TIME('01:02:03;');
+TIME('01:02:03;')
+01:02:03
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03;'
+SELECT TIME('01:02:03/');
+TIME('01:02:03/')
+01:02:03
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03/'
+SELECT EXTRACT(HOUR FROM '01:02:03:');
+EXTRACT(HOUR FROM '01:02:03:')
+1
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03:'
+SELECT EXTRACT(HOUR FROM '01:02:03-');
+EXTRACT(HOUR FROM '01:02:03-')
+1
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03-'
+SELECT EXTRACT(HOUR FROM '01:02:03;');
+EXTRACT(HOUR FROM '01:02:03;')
+1
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03;'
+SELECT EXTRACT(HOUR FROM '01:02:03/');
+EXTRACT(HOUR FROM '01:02:03/')
+1
+Warnings:
+Warning 1292 Truncated incorrect time value: '01:02:03/'
+# Backward compatibility preserved for YEAR and MONTH only
+# (behavior has changed for DAY, see below)
+SELECT EXTRACT(YEAR FROM '01:02:03');
+EXTRACT(YEAR FROM '01:02:03')
+2001
+SELECT EXTRACT(MONTH FROM '01:02:03');
+EXTRACT(MONTH FROM '01:02:03')
+2
+SELECT EXTRACT(YEAR FROM '24:01:03 garbage /////');
+EXTRACT(YEAR FROM '24:01:03 garbage /////')
+2024
+Warnings:
+Warning 1292 Truncated incorrect date value: '24:01:03 garbage /////'
+SELECT EXTRACT(MONTH FROM '24:01:03 garbage /////');
+EXTRACT(MONTH FROM '24:01:03 garbage /////')
+1
+Warnings:
+Warning 1292 Truncated incorrect date value: '24:01:03 garbage /////'
+# This still parses as TIME 00:20:01
+SELECT TIME('2001/01/01');
+TIME('2001/01/01')
+00:20:01
+Warnings:
+Warning 1292 Truncated incorrect time value: '2001/01/01'
+SELECT TIME('2001-01-01');
+TIME('2001-01-01')
+00:20:01
+Warnings:
+Warning 1292 Truncated incorrect time value: '2001-01-01'
+# This still parses as TIME and overflows to '838:59:59'
+SELECT TIME('2001:01:01');
+TIME('2001:01:01')
+838:59:59
+Warnings:
+Warning 1292 Truncated incorrect time value: '2001:01:01'
+# This used to parse as DATE, now parses as TIME interval
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2024:01:03 garbage /////'),
+('24:01:03 garbage /////'),
+('01:01:03 garbage /////'),
+('2024:02:03'),
+('100000:02:03'),
+('24:02:03'),
+('01:02:03'),
+('01:02:03:'),
+('01:02:03-'),
+('01:02:03;'),
+('01:02:03/'),
+('20 10:20:30');
+SELECT
+EXTRACT(DAY FROM a),
+EXTRACT(DAY_SECOND FROM a), a,
+CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm
+FROM t1;
+EXTRACT(DAY FROM a) EXTRACT(DAY_SECOND FROM a) a cidm
+84 84080103 2024:01:03 garbage ///// NULL
+1 1000103 24:01:03 garbage ///// NULL
+0 10103 01:01:03 garbage ///// NULL
+84 84080203 2024:02:03 84 08:02:03.000000
+4166 4166160203 100000:02:03 4166 16:02:03.000000
+1 1000203 24:02:03 1 00:02:03.000000
+0 10203 01:02:03 01:02:03.000000
+0 10203 01:02:03: 01:02:03.000000
+0 10203 01:02:03- NULL
+0 10203 01:02:03; 01:02:03.000000
+0 10203 01:02:03/ 01:02:03.000000
+20 20102030 20 10:20:30 20 10:20:30.000000
+Warnings:
+Warning 1292 Truncated incorrect time value: '2024:01:03 garbage /////'
+Warning 1292 Truncated incorrect time value: '2024:01:03 garbage /////'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2024:01:03 garbage /////'
+Warning 1292 Truncated incorrect time value: '24:01:03 garbage /////'
+Warning 1292 Truncated incorrect time value: '24:01:03 garbage /////'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '24:01:03 garbage /////'
+Warning 1292 Truncated incorrect time value: '01:01:03 garbage /////'
+Warning 1292 Truncated incorrect time value: '01:01:03 garbage /////'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '01:01:03 garbage /////'
+Warning 1292 Truncated incorrect time value: '01:02:03:'
+Warning 1292 Truncated incorrect time value: '01:02:03:'
+Warning 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '01:02:03:'
+Warning 1292 Truncated incorrect time value: '01:02:03-'
+Warning 1292 Truncated incorrect time value: '01:02:03-'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '01:02:03-'
+Warning 1292 Truncated incorrect time value: '01:02:03;'
+Warning 1292 Truncated incorrect time value: '01:02:03;'
+Warning 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '01:02:03;'
+Warning 1292 Truncated incorrect time value: '01:02:03/'
+Warning 1292 Truncated incorrect time value: '01:02:03/'
+Warning 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '01:02:03/'
+DROP TABLE t1;
diff --git a/mysql-test/main/func_extract.test b/mysql-test/main/func_extract.test
new file mode 100644
index 00000000000..edc99b9c00c
--- /dev/null
+++ b/mysql-test/main/func_extract.test
@@ -0,0 +1,257 @@
+--echo #
+--echo # MDEV-17385 MICROSECOND() returns confusing results with an out-of-range TIME-alike argument
+--echo #
+
+CREATE TABLE t1 (v VARCHAR(64), ll BIGINT, t TIME, dt DATETIME, d DATE);
+CREATE TABLE t2 AS SELECT
+ EXTRACT(DAY FROM t),
+ EXTRACT(DAY_HOUR FROM t),
+ EXTRACT(DAY_MINUTE FROM t),
+ EXTRACT(DAY_SECOND FROM t),
+ EXTRACT(DAY_MICROSECOND FROM t),
+ EXTRACT(DAY FROM d),
+ EXTRACT(DAY_HOUR FROM d),
+ EXTRACT(DAY_MINUTE FROM d),
+ EXTRACT(DAY_SECOND FROM d),
+ EXTRACT(DAY_MICROSECOND FROM d),
+ EXTRACT(DAY FROM v),
+ EXTRACT(DAY_HOUR FROM v),
+ EXTRACT(DAY_MINUTE FROM v),
+ EXTRACT(DAY_SECOND FROM v),
+ EXTRACT(DAY_MICROSECOND FROM v),
+ EXTRACT(DAY FROM ll),
+ EXTRACT(DAY_HOUR FROM ll),
+ EXTRACT(DAY_MINUTE FROM ll),
+ EXTRACT(DAY_SECOND FROM ll),
+ EXTRACT(DAY_MICROSECOND FROM ll)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a VARCHAR(64), b DECIMAL(32,9));
+INSERT INTO t1 VALUES
+('9999-12-31 23:59:59.123456', 99991231235959.123456),
+('2001-01-01 10:20:30.123456', 20010101102030.123456),
+('4294967296:59:59.123456', 42949672965959.123456),
+('4294967295:59:59.123456', 42949672955959.123456),
+('87649416:59:59.123456', 876494165959.123456),
+('87649415:59:59.123456', 876494155959.123456),
+('87649414:59:59.123456', 876494145959.123456),
+('9999:59:59.123456', 99995959.123456),
+('9999:01:01.123456', 99990101.123456),
+('9999:01:01', 99990101),
+('0.999999', 0.999999),
+('0.99999', 0.99999),
+('0.9999', 0.9999),
+('0.999', 0.999),
+('0.99', 0.99),
+('0.9', 0.9),
+('000000',0);
+
+--echo # Summary:
+--echo # Check that FUNC(varchar) and FUNC(decimal) give equal results
+--echo # Expect empty sets
+--disable_warnings
+SELECT a, b, EXTRACT(DAY_HOUR FROM a), EXTRACT(DAY_HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(DAY_HOUR FROM a)<=>EXTRACT(DAY_HOUR FROM b));
+SELECT a, b, EXTRACT(DAY FROM a), EXTRACT(DAY FROM b) FROM t1 WHERE NOT (EXTRACT(DAY FROM a)<=>EXTRACT(DAY FROM b));
+SELECT a, b, EXTRACT(HOUR FROM a), EXTRACT(HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(HOUR FROM a)<=>EXTRACT(HOUR FROM b));
+SELECT a, b, EXTRACT(MINUTE FROM a), EXTRACT(MINUTE FROM b) FROM t1 WHERE NOT (EXTRACT(MINUTE FROM a)<=>EXTRACT(MINUTE FROM b));
+SELECT a, b, EXTRACT(SECOND FROM a), EXTRACT(SECOND FROM b) FROM t1 WHERE NOT (EXTRACT(SECOND FROM a)<=>EXTRACT(SECOND FROM b));
+SELECT a, b, EXTRACT(MICROSECOND FROM a), EXTRACT(MICROSECOND FROM b) FROM t1 WHERE NOT (EXTRACT(MICROSECOND FROM a)<=>EXTRACT(MICROSECOND FROM b));
+--enable_warnings
+
+--echo # Detailed results
+SELECT
+ a,
+ CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm,
+ EXTRACT(DAY FROM a) * 24 + EXTRACT(HOUR FROM a) AS dh,
+ EXTRACT(DAY_HOUR FROM a),
+ EXTRACT(DAY FROM a),
+ EXTRACT(HOUR FROM a),
+ EXTRACT(MINUTE FROM a),
+ EXTRACT(SECOND FROM a),
+ EXTRACT(MICROSECOND FROM a)
+FROM t1;
+SELECT
+ b,
+ CAST(b AS INTERVAL DAY_SECOND(6)) AS cidm,
+ EXTRACT(DAY FROM b) * 24 + EXTRACT(HOUR FROM b) AS dh,
+ EXTRACT(DAY_HOUR FROM b),
+ EXTRACT(DAY FROM b),
+ EXTRACT(HOUR FROM b),
+ EXTRACT(MINUTE FROM b),
+ EXTRACT(SECOND FROM b),
+ EXTRACT(MICROSECOND FROM b)
+FROM t1;
+DROP TABLE t1;
+
+--echo # Special case: DAY + TIME
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('9999-01-01');
+SELECT a,
+ EXTRACT(DAY_HOUR FROM a),
+ EXTRACT(DAY_MINUTE FROM a),
+ EXTRACT(DAY_SECOND FROM a),
+ EXTRACT(DAY_MICROSECOND FROM a),
+ EXTRACT(DAY FROM a),
+ EXTRACT(HOUR FROM a),
+ EXTRACT(MINUTE FROM a),
+ EXTRACT(SECOND FROM a),
+ EXTRACT(MICROSECOND FROM a)
+FROM t1;
+DROP TABLE t1;
+
+--echo # Bad values
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('');
+SELECT a,
+ CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm,
+ EXTRACT(DAY_HOUR FROM a),
+ EXTRACT(DAY_MINUTE FROM a),
+ EXTRACT(DAY_SECOND FROM a),
+ EXTRACT(DAY_MICROSECOND FROM a),
+ EXTRACT(DAY FROM a),
+ EXTRACT(HOUR FROM a),
+ EXTRACT(MINUTE FROM a),
+ EXTRACT(SECOND FROM a),
+ EXTRACT(MICROSECOND FROM a)
+FROM t1;
+DROP TABLE t1;
+
+
+--echo # Backward compatibility
+
+--echo # This still parses as DATETIME
+SELECT EXTRACT(YEAR FROM '2001/02/03 10:20:30');
+SELECT EXTRACT(MONTH FROM '2001/02/03 10:20:30');
+SELECT EXTRACT(DAY FROM '2001/02/03 10:20:30');
+
+SELECT EXTRACT(YEAR FROM '01/02/03 10:20:30');
+SELECT EXTRACT(MONTH FROM '01/02/03 10:20:30');
+SELECT EXTRACT(DAY FROM '01/02/03 10:20:30');
+
+SELECT EXTRACT(YEAR FROM '01:02:03 10:20:30');
+SELECT EXTRACT(MONTH FROM '01:02:03 10:20:30');
+SELECT EXTRACT(DAY FROM '01:02:03 10:20:30');
+
+--echo # This still parses as DATETIME and returns NULL
+
+SELECT EXTRACT(YEAR FROM "2011-02-32 8:46:06.23434");
+SELECT EXTRACT(MONTH FROM "2011-02-32 8:46:06.23434");
+SELECT EXTRACT(DAY FROM "2011-02-32 8:46:06.23434");
+SELECT EXTRACT(HOUR FROM "2011-02-32 8:46:06.23434");
+
+--echo # This still parses as DATE
+
+SELECT EXTRACT(YEAR FROM '2001/02/03');
+SELECT EXTRACT(MONTH FROM '2001/02/03');
+SELECT EXTRACT(DAY FROM '2001/02/03');
+
+SELECT EXTRACT(YEAR FROM '01/02/03');
+SELECT EXTRACT(MONTH FROM '01/02/03');
+SELECT EXTRACT(DAY FROM '01/02/03');
+
+SELECT EXTRACT(YEAR FROM '01-02-03');
+SELECT EXTRACT(MONTH FROM '01-02-03');
+SELECT EXTRACT(DAY FROM '01-02-03');
+
+SELECT EXTRACT(YEAR FROM '1-2-3');
+SELECT EXTRACT(MONTH FROM '1-2-3');
+SELECT EXTRACT(DAY FROM '1-2-3');
+SELECT EXTRACT(HOUR FROM '1-2-3');
+
+SELECT EXTRACT(DAY FROM '2024-01-03 garbage /////');
+SELECT EXTRACT(DAY FROM '24-01-03 garbage /////');
+SELECT EXTRACT(DAY FROM '01-02-03');
+
+SELECT EXTRACT(DAY FROM '24:02:03T');
+SELECT EXTRACT(DAY FROM '24-02-03');
+SELECT EXTRACT(DAY FROM '24/02/03');
+
+SELECT EXTRACT(DAY FROM '11111');
+
+SELECT TIME('2001-01-01T'), TIME('2001-01-01T ');
+SELECT TIME('2001/01/01T'), TIME('2001/01/01T ');
+SELECT TIME('2001:01:01T'), TIME('2001:01:01T ');
+
+SELECT EXTRACT(DAY FROM '2001-01-01T'), EXTRACT(DAY FROM '2001-01-01T ');
+SELECT EXTRACT(DAY FROM '2001/01/01T'), EXTRACT(DAY FROM '2001/01/01T ');
+SELECT EXTRACT(DAY FROM '2001:01:01T'), EXTRACT(DAY FROM '2001:01:01T ');
+
+
+SELECT TIME('2001:01:01T'), TIME('2001:01:01T ');
+SELECT EXTRACT(HOUR FROM '2001-01-01T'), EXTRACT(HOUR FROM '2001-01-01T ');
+SELECT EXTRACT(HOUR FROM '2001/01/01T'), EXTRACT(HOUR FROM '2001/01/01T ');
+SELECT EXTRACT(HOUR FROM '2001:01:01T'), EXTRACT(HOUR FROM '2001:01:01T ');
+
+--echo # This still parses as DATE and returns NULL (without trying TIME)
+SELECT EXTRACT(DAY FROM '100000:02:03T');
+SELECT EXTRACT(DAY FROM '100000/02/03');
+SELECT EXTRACT(DAY FROM '100000-02-03');
+
+SELECT EXTRACT(DAY FROM '1111');
+SELECT EXTRACT(DAY FROM '111');
+SELECT EXTRACT(DAY FROM '11');
+SELECT EXTRACT(DAY FROM '1');
+
+
+--echo # This still parses as TIME
+
+SELECT EXTRACT(HOUR FROM '11111');
+SELECT EXTRACT(HOUR FROM '1111');
+SELECT EXTRACT(HOUR FROM '111');
+SELECT EXTRACT(HOUR FROM '11');
+SELECT EXTRACT(HOUR FROM '1');
+
+SELECT TIME('01:02:03:');
+SELECT TIME('01:02:03-');
+SELECT TIME('01:02:03;');
+SELECT TIME('01:02:03/');
+
+SELECT EXTRACT(HOUR FROM '01:02:03:');
+SELECT EXTRACT(HOUR FROM '01:02:03-');
+SELECT EXTRACT(HOUR FROM '01:02:03;');
+SELECT EXTRACT(HOUR FROM '01:02:03/');
+
+--echo # Backward compatibility preserved for YEAR and MONTH only
+--echo # (behavior has changed for DAY, see below)
+SELECT EXTRACT(YEAR FROM '01:02:03');
+SELECT EXTRACT(MONTH FROM '01:02:03');
+
+SELECT EXTRACT(YEAR FROM '24:01:03 garbage /////');
+SELECT EXTRACT(MONTH FROM '24:01:03 garbage /////');
+
+--echo # This still parses as TIME 00:20:01
+
+SELECT TIME('2001/01/01');
+SELECT TIME('2001-01-01');
+
+--echo # This still parses as TIME and overflows to '838:59:59'
+SELECT TIME('2001:01:01');
+
+
+--echo # This used to parse as DATE, now parses as TIME interval
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2024:01:03 garbage /////'),
+('24:01:03 garbage /////'),
+('01:01:03 garbage /////'),
+('2024:02:03'),
+('100000:02:03'),
+('24:02:03'),
+('01:02:03'),
+('01:02:03:'),
+('01:02:03-'),
+('01:02:03;'),
+('01:02:03/'),
+('20 10:20:30');
+
+SELECT
+ EXTRACT(DAY FROM a),
+ EXTRACT(DAY_SECOND FROM a), a,
+ CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm
+FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/main/func_group_innodb.result b/mysql-test/main/func_group_innodb.result
index 5be46ed95b3..a4c9b574585 100644
--- a/mysql-test/main/func_group_innodb.result
+++ b/mysql-test/main/func_group_innodb.result
@@ -251,8 +251,32 @@ MIN(c)
0
EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL b 263 NULL 3 Using index for group-by
+1 SIMPLE t1 range NULL b 263 NULL 2 Using index for group-by
DROP TABLE t1;
+#
+# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
+#
+CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
+KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
+explain
+SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
+MIN(t1.v1)
+king
+drop table t1;
+CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES ('king'), ('bad');
+explain
+SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
+SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
+MIN(x.v1)
+NULL
+drop table t1;
End of 5.5 tests
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test
index 0aa657badc1..6141b4d85ed 100644
--- a/mysql-test/main/func_group_innodb.test
+++ b/mysql-test/main/func_group_innodb.test
@@ -201,6 +201,25 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
DROP TABLE t1;
+--echo #
+--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
+--echo #
+
+CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
+ KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
+explain
+SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
+SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
+drop table t1;
+
+CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES ('king'), ('bad');
+explain
+SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
+SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
+drop table t1;
+
--echo End of 5.5 tests
set global innodb_stats_persistent= @innodb_stats_persistent_save;
diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result
index a86fd8d1d6f..129d49776a8 100644
--- a/mysql-test/main/func_hybrid_type.result
+++ b/mysql-test/main/func_hybrid_type.result
@@ -3753,6 +3753,24 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
+# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
+#
+SET sql_mode='';
+CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT
+IFNULL(SLEEP(0.01), NULL DIV d) AS f0,
+IFNULL(SLEEP(0.01), '' DIV d) AS f1
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f0` decimal(1,0) DEFAULT NULL,
+ `f1` decimal(1,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+#
# End of 10.3 tests
#
#
diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test
index 6b32f331d34..5281d846584 100644
--- a/mysql-test/main/func_hybrid_type.test
+++ b/mysql-test/main/func_hybrid_type.test
@@ -612,6 +612,22 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
+--echo #
+
+SET sql_mode='';
+CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT
+ IFNULL(SLEEP(0.01), NULL DIV d) AS f0,
+ IFNULL(SLEEP(0.01), '' DIV d) AS f1
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index cc9fd146e63..3eae5be2492 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -811,6 +811,26 @@ SELECT JSON_MERGE('[1]', '[]');
JSON_MERGE('[1]', '[]')
[1]
#
+# MDEV-16174 Assertion `0' failed in Type_handler_string_result::
+# make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
+#
+SET sql_mode='';
+CREATE TABLE t1 (fld varchar(16) NOT NULL);
+CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(25) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+SET sql_mode=default;
+#
+# MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
+#
+select JSON_VALID( '{"a":1]' );
+JSON_VALID( '{"a":1]' )
+0
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 9a0699ac23d..09ae35ad653 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -467,6 +467,24 @@ SET @`json` := NULL, @`value` := NULL;
SELECT JSON_MERGE('[1]', '[]');
--echo #
+--echo # MDEV-16174 Assertion `0' failed in Type_handler_string_result::
+--echo # make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
+--echo #
+
+SET sql_mode='';
+CREATE TABLE t1 (fld varchar(16) NOT NULL);
+CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+SET sql_mode=default;
+
+--echo #
+--echo # MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
+--echo #
+
+select JSON_VALID( '{"a":1]' );
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result
index 832ca69d3ea..251979dba03 100644
--- a/mysql-test/main/func_math.result
+++ b/mysql-test/main/func_math.result
@@ -1285,3 +1285,43 @@ E59B9BE4BA94E585AD 2914501801
E4B883E585ABE4B99D 2374586519
DROP TABLE t1;
SET NAMES default;
+#
+# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
+#
+SET sql_mode='';
+CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT
+NULL DIV d AS d_null,
+'' DIV d AS d_empty_string,
+X'32' DIV d AS d_hex_string2,
+X'3232' DIV d AS d_hex_string4,
+TIME(0) DIV d AS d_time,
+CURRENT_DATE DIV d AS d_date,
+CURRENT_TIMESTAMP DIV d AS d_datetime
+FROM t1;
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: ''
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `d_null` int(1) unsigned DEFAULT NULL,
+ `d_empty_string` int(1) unsigned DEFAULT NULL,
+ `d_hex_string2` int(1) unsigned DEFAULT NULL,
+ `d_hex_string4` int(2) unsigned DEFAULT NULL,
+ `d_time` int(7) unsigned DEFAULT NULL,
+ `d_date` int(8) unsigned DEFAULT NULL,
+ `d_datetime` bigint(14) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+#
+# MDEV-18150 Assertion `decimals_to_set <= 38' failed in Item_func_round::fix_length_and_dec_decimal
+#
+CREATE TABLE t1 (i INT(23));
+SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
+f
+DROP TABLE t1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test
index a2c54b58a67..5d7c593a63d 100644
--- a/mysql-test/main/func_math.test
+++ b/mysql-test/main/func_math.test
@@ -897,3 +897,36 @@ LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t1 CHARACTER SET
SELECT HEX(a), CRC32(a) from t1;
DROP TABLE t1;
SET NAMES default;
+
+--echo #
+--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
+--echo #
+
+SET sql_mode='';
+CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 AS SELECT
+ NULL DIV d AS d_null,
+ '' DIV d AS d_empty_string,
+ X'32' DIV d AS d_hex_string2,
+ X'3232' DIV d AS d_hex_string4,
+ TIME(0) DIV d AS d_time,
+ CURRENT_DATE DIV d AS d_date,
+ CURRENT_TIMESTAMP DIV d AS d_datetime
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+
+
+--echo #
+--echo # MDEV-18150 Assertion `decimals_to_set <= 38' failed in Item_func_round::fix_length_and_dec_decimal
+--echo #
+
+CREATE TABLE t1 (i INT(23));
+SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/func_set.result b/mysql-test/main/func_set.result
index 73e121f5f2b..3bd9f5e0c9a 100644
--- a/mysql-test/main/func_set.result
+++ b/mysql-test/main/func_set.result
@@ -172,8 +172,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
-Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1
-Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2
+Warning 1292 Incorrect datetime value: '10' for column `test`.`t1`.`pk` at row 1
+Warning 1292 Incorrect datetime value: '11' for column `test`.`t1`.`pk` at row 2
DROP TABLE t1;
#
# End of 5.3 tests
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index 484127a7414..e66d0ca5e3f 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -4961,3 +4961,15 @@ DROP TABLE t1;
#
# End of 10.3 tests
#
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
+#
+SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;
+f
+2019-01-01 00:00:00F}^i
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test
index 4165e147768..4809b0e872b 100644
--- a/mysql-test/main/func_str.test
+++ b/mysql-test/main/func_str.test
@@ -1951,3 +1951,19 @@ DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
+--echo #
+
+SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;
+
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result
index a6e1ed9cb19..007f5585c27 100644
--- a/mysql-test/main/func_time.result
+++ b/mysql-test/main/func_time.result
@@ -367,9 +367,7 @@ extract(DAY_MINUTE FROM "02 10:11:12")
21011
select extract(DAY_SECOND FROM "225 10:11:12");
extract(DAY_SECOND FROM "225 10:11:12")
-34225959
-Warnings:
-Warning 1292 Truncated incorrect time value: '225 10:11:12'
+225101112
select extract(HOUR FROM "1999-01-02 10:11:12");
extract(HOUR FROM "1999-01-02 10:11:12")
10
@@ -1033,9 +1031,7 @@ Note 1105 Cast to unsigned converted negative integer to it's positive complemen
Warning 1292 Truncated incorrect time value: '18446744073709551615:00:00'
SELECT EXTRACT(HOUR FROM '10000:02:03');
EXTRACT(HOUR FROM '10000:02:03')
-22
-Warnings:
-Warning 1292 Truncated incorrect time value: '10000:02:03'
+16
CREATE TABLE t1(f1 TIME);
INSERT IGNORE INTO t1 VALUES('916:00:00 a');
Warnings:
@@ -3432,7 +3428,61 @@ DROP TABLE t1,t2;
# End of 10.1 tests
#
#
-# Start of 10.3 tests
+# MDEV-16217: Assertion `!table || (!table->read_set ||
+# bitmap_is_set(table->read_set, field_index))'
+# failed in Field_num::get_date
+#
+CREATE TABLE t1 (pk int default 0, a1 date);
+INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL);
+CREATE VIEW v1 AS
+SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1;
+SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1;
+a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk))
+0
+NULL
+NULL
+NULL
+SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1;
+a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk))
+0
+NULL
+NULL
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '18446744073709551615'
+CREATE TABLE t2 (pk int default 1, a1 date);
+INSERT INTO t2 VALUES (4,NULL);
+CREATE view v2 as SELECT default(t1.pk), default(t2.pk), t1.pk from t1,t2;
+select * from v2;
+default(t1.pk) default(t2.pk) pk
+0 1 1
+0 1 2
+0 1 3
+0 1 4
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select default(`t1`.`pk`) AS `default(t1.pk)`,default(`t2`.`pk`) AS `default(t2.pk)`,`t1`.`pk` AS `pk` from (`t1` join `t2`) latin1 latin1_swedish_ci
+CREATE view v3 as SELECT default(pk) from t2;
+select * from v3;
+default(pk)
+1
+explain extended select * from v3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual
+explain extended select default(pk) from t2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select default(`t2`.`pk`) AS `default(pk)` from `t2` latin1 latin1_swedish_ci
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;
+#
+# End of 10.2 tests
#
#
# MDEV-12515 Wrong value when storing DATE_ADD() and ADDTIME() to a numeric field
@@ -3753,8 +3803,10 @@ CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;
c1 c2 c3
2018-08-31 00:00:00 00:00:00
+#
# End of 10.3 tests
#
+#
# MDEV-14032 SEC_TO_TIME executes side effect two times
#
SET @a=10000000;
@@ -6243,3 +6295,14 @@ Warning 1292 Truncated incorrect time value: '50326 garbage'
SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00');
TIME('- 01:00:00') TIME('- 1 01:00:00')
-01:00:00 -25:00:00
+#
+# MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time
+#
+SET time_zone='+00:00';
+SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14');
+NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14')
+1970-01-01 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: 'foo'
+Warning 1292 Truncated incorrect DECIMAL value: 'foo'
+SET time_zone=DEFAULT;
diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test
index 4c9315629f1..630083ef97e 100644
--- a/mysql-test/main/func_time.test
+++ b/mysql-test/main/func_time.test
@@ -1914,9 +1914,36 @@ DROP TABLE t1,t2;
--echo # End of 10.1 tests
--echo #
+--echo #
+--echo # MDEV-16217: Assertion `!table || (!table->read_set ||
+--echo # bitmap_is_set(table->read_set, field_index))'
+--echo # failed in Field_num::get_date
+--echo #
+CREATE TABLE t1 (pk int default 0, a1 date);
+INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL);
+
+CREATE VIEW v1 AS
+SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1;
+
+SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1;
+SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1;
+
+CREATE TABLE t2 (pk int default 1, a1 date);
+INSERT INTO t2 VALUES (4,NULL);
+CREATE view v2 as SELECT default(t1.pk), default(t2.pk), t1.pk from t1,t2;
+select * from v2;
+show create view v2;
+CREATE view v3 as SELECT default(pk) from t2;
+select * from v3;
+explain extended select * from v3;
+explain extended select default(pk) from t2;
+show create view v3;
+
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;
--echo #
---echo # Start of 10.3 tests
+--echo # End of 10.2 tests
--echo #
--echo #
@@ -2217,7 +2244,9 @@ SELECT
CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;
+--echo #
--echo # End of 10.3 tests
+--echo #
--echo #
--echo # MDEV-14032 SEC_TO_TIME executes side effect two times
@@ -3094,3 +3123,12 @@ SELECT
CAST('50326 garbage' as time);
SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00');
+
+
+--echo #
+--echo # MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time
+--echo #
+
+SET time_zone='+00:00';
+SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14');
+SET time_zone=DEFAULT;
diff --git a/mysql-test/main/func_time_round.result b/mysql-test/main/func_time_round.result
new file mode 100644
index 00000000000..b335cf393ba
--- /dev/null
+++ b/mysql-test/main/func_time_round.result
@@ -0,0 +1,1374 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+CREATE TABLE t1_datetime_in_varchar (id SERIAL, a VARCHAR(64));
+INSERT INTO t1_datetime_in_varchar (a) VALUES
+('2000-12-31 23:59:59'),
+('2000-12-31 23:59:59.9'),
+('2000-12-31 23:59:59.99'),
+('2000-12-31 23:59:59.999'),
+('2000-12-31 23:59:59.9999'),
+('2000-12-31 23:59:59.99999'),
+('2000-12-31 23:59:59.999999'),
+('2000-12-31 23:59:59.9999999');
+CREATE TABLE t1_datetime_in_decimal (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_datetime_in_decimal (a) VALUES
+(20001231235959),
+(20001231235959.9),
+(20001231235959.99),
+(20001231235959.999),
+(20001231235959.9999),
+(20001231235959.99999),
+(20001231235959.999999),
+(20001231235959.9999999);
+CREATE TABLE t1_time_in_varchar (id SERIAL, a VARCHAR(64));
+INSERT INTO t1_time_in_varchar (a) VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.99'),
+('00:00:00.999'),
+('00:00:00.9999'),
+('00:00:00.99999'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+INSERT INTO t1_time_in_varchar (a) VALUES
+('837:59:59.9999999'),
+('838:59:59'),
+('838:59:59.9'),
+('838:59:59.99'),
+('838:59:59.999'),
+('838:59:59.9999'),
+('838:59:59.99999'),
+('838:59:59.999999'),
+('838:59:59.9999999'),
+('839:59:59.9999999'),
+('87649414:59:59.999999'),
+('87649414:59:59.9999999'),
+('87649415:59:59.999999'),
+('87649415:59:59.9999999');
+CREATE TABLE t1_time_in_decimal (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_time_in_decimal (a) VALUES
+(0),
+(0.9),
+(0.99),
+(0.999),
+(0.9999),
+(0.99999),
+(0.999999),
+(0.9999999);
+INSERT INTO t1_time_in_decimal (a) VALUES
+(8375959.9999999),
+(8385959),
+(8385959.9),
+(8385959.99),
+(8385959.999),
+(8385959.9999),
+(8385959.99999),
+(8385959.999999),
+(8385959.9999999),
+(8395959.9999999),
+(876494145959.999999),
+(876494145959.9999999),
+(876494155959.999999),
+(876494155959.9999999);
+#
+# TIME: LEAST/GREATEST
+#
+SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_varchar;
+GREATEST(TIME'00:00:00', a)
+00:00:00.000000
+00:00:00.900000
+00:00:00.990000
+00:00:00.999000
+00:00:00.999900
+00:00:00.999990
+00:00:00.999999
+00:00:01.000000
+838:00:00.000000
+838:59:59.000000
+838:59:59.900000
+838:59:59.990000
+838:59:59.999000
+838:59:59.999900
+838:59:59.999990
+838:59:59.999999
+838:59:59.999999
+838:59:59.999999
+838:59:59.999999
+838:59:59.999999
+838:59:59.999999
+838:59:59.999999
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '838:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '839:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649414:59:59.999999'
+Warning 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_decimal;
+GREATEST(TIME'00:00:00', a)
+00:00:00.000000
+00:00:00.900000
+00:00:00.990000
+00:00:00.999000
+00:00:00.999900
+00:00:00.999990
+00:00:00.999999
+00:00:01.000000
+838:00:00.000000
+838:59:59.000000
+838:59:59.900000
+838:59:59.990000
+838:59:59.999000
+838:59:59.999900
+838:59:59.999990
+838:59:59.999999
+838:59:59.999999
+838:59:59.999999
+NULL
+NULL
+NULL
+NULL
+Warnings:
+Warning 1292 Incorrect time value: '8385959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 17
+Warning 1292 Incorrect time value: '8395959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 18
+Warning 1292 Incorrect time value: '876494145959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 19
+Warning 1292 Incorrect time value: '876494145959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 20
+Warning 1292 Incorrect time value: '876494155959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 21
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+SELECT GREATEST(TIME'00:00:00', '00:00:00.0000004');
+GREATEST(TIME'00:00:00', '00:00:00.0000004')
+00:00:00.000000
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.0000004'
+SELECT GREATEST(TIME'00:00:00', 0.0000004);
+GREATEST(TIME'00:00:00', 0.0000004)
+00:00:00.000000
+SELECT GREATEST(TIME'00:00:00', '00:00:00.0000005');
+GREATEST(TIME'00:00:00', '00:00:00.0000005')
+00:00:00.000001
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.0000005'
+SELECT GREATEST(TIME'00:00:00', 0.0000005);
+GREATEST(TIME'00:00:00', 0.0000005)
+00:00:00.000001
+#
+# Functions with a single TIME input, conversion from DATETIME-in-VARCHAR
+#
+SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+SECOND(a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 2000-12-31 23:59:59
+59 23:59:59.900000 2000-12-31 23:59:59.9
+59 23:59:59.990000 2000-12-31 23:59:59.99
+59 23:59:59.999000 2000-12-31 23:59:59.999
+59 23:59:59.999900 2000-12-31 23:59:59.9999
+59 23:59:59.999990 2000-12-31 23:59:59.99999
+59 23:59:59.999999 2000-12-31 23:59:59.999999
+0 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+MINUTE(a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 2000-12-31 23:59:59
+59 23:59:59.900000 2000-12-31 23:59:59.9
+59 23:59:59.990000 2000-12-31 23:59:59.99
+59 23:59:59.999000 2000-12-31 23:59:59.999
+59 23:59:59.999900 2000-12-31 23:59:59.9999
+59 23:59:59.999990 2000-12-31 23:59:59.99999
+59 23:59:59.999999 2000-12-31 23:59:59.999999
+0 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+HOUR(a) CAST(a AS TIME(6)) a
+23 23:59:59.000000 2000-12-31 23:59:59
+23 23:59:59.900000 2000-12-31 23:59:59.9
+23 23:59:59.990000 2000-12-31 23:59:59.99
+23 23:59:59.999000 2000-12-31 23:59:59.999
+23 23:59:59.999900 2000-12-31 23:59:59.9999
+23 23:59:59.999990 2000-12-31 23:59:59.99999
+23 23:59:59.999999 2000-12-31 23:59:59.999999
+0 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+EXTRACT(SECOND FROM a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 2000-12-31 23:59:59
+59 23:59:59.900000 2000-12-31 23:59:59.9
+59 23:59:59.990000 2000-12-31 23:59:59.99
+59 23:59:59.999000 2000-12-31 23:59:59.999
+59 23:59:59.999900 2000-12-31 23:59:59.9999
+59 23:59:59.999990 2000-12-31 23:59:59.99999
+59 23:59:59.999999 2000-12-31 23:59:59.999999
+0 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+EXTRACT(MINUTE FROM a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 2000-12-31 23:59:59
+59 23:59:59.900000 2000-12-31 23:59:59.9
+59 23:59:59.990000 2000-12-31 23:59:59.99
+59 23:59:59.999000 2000-12-31 23:59:59.999
+59 23:59:59.999900 2000-12-31 23:59:59.9999
+59 23:59:59.999990 2000-12-31 23:59:59.99999
+59 23:59:59.999999 2000-12-31 23:59:59.999999
+0 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+EXTRACT(HOUR FROM a) CAST(a AS TIME(6)) a
+23 23:59:59.000000 2000-12-31 23:59:59
+23 23:59:59.900000 2000-12-31 23:59:59.9
+23 23:59:59.990000 2000-12-31 23:59:59.99
+23 23:59:59.999000 2000-12-31 23:59:59.999
+23 23:59:59.999900 2000-12-31 23:59:59.9999
+23 23:59:59.999990 2000-12-31 23:59:59.99999
+23 23:59:59.999999 2000-12-31 23:59:59.999999
+0 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+TIME_TO_SEC(a) CAST(a AS TIME(6)) a
+86399.000000 23:59:59.000000 2000-12-31 23:59:59
+86399.900000 23:59:59.900000 2000-12-31 23:59:59.9
+86399.990000 23:59:59.990000 2000-12-31 23:59:59.99
+86399.999000 23:59:59.999000 2000-12-31 23:59:59.999
+86399.999900 23:59:59.999900 2000-12-31 23:59:59.9999
+86399.999990 23:59:59.999990 2000-12-31 23:59:59.99999
+86399.999999 23:59:59.999999 2000-12-31 23:59:59.999999
+0.000000 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+#
+# Functions with a single TIME input, conversion from DATETIME-in-DECIMAL
+#
+SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+SECOND(a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 20001231235959.0000000000
+59 23:59:59.900000 20001231235959.9000000000
+59 23:59:59.990000 20001231235959.9900000000
+59 23:59:59.999000 20001231235959.9990000000
+59 23:59:59.999900 20001231235959.9999000000
+59 23:59:59.999990 20001231235959.9999900000
+59 23:59:59.999999 20001231235959.9999990000
+0 00:00:00.000000 20001231235959.9999999000
+SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+MINUTE(a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 20001231235959.0000000000
+59 23:59:59.900000 20001231235959.9000000000
+59 23:59:59.990000 20001231235959.9900000000
+59 23:59:59.999000 20001231235959.9990000000
+59 23:59:59.999900 20001231235959.9999000000
+59 23:59:59.999990 20001231235959.9999900000
+59 23:59:59.999999 20001231235959.9999990000
+0 00:00:00.000000 20001231235959.9999999000
+SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+HOUR(a) CAST(a AS TIME(6)) a
+23 23:59:59.000000 20001231235959.0000000000
+23 23:59:59.900000 20001231235959.9000000000
+23 23:59:59.990000 20001231235959.9900000000
+23 23:59:59.999000 20001231235959.9990000000
+23 23:59:59.999900 20001231235959.9999000000
+23 23:59:59.999990 20001231235959.9999900000
+23 23:59:59.999999 20001231235959.9999990000
+0 00:00:00.000000 20001231235959.9999999000
+SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+EXTRACT(SECOND FROM a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 20001231235959.0000000000
+59 23:59:59.900000 20001231235959.9000000000
+59 23:59:59.990000 20001231235959.9900000000
+59 23:59:59.999000 20001231235959.9990000000
+59 23:59:59.999900 20001231235959.9999000000
+59 23:59:59.999990 20001231235959.9999900000
+59 23:59:59.999999 20001231235959.9999990000
+0 00:00:00.000000 20001231235959.9999999000
+SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+EXTRACT(MINUTE FROM a) CAST(a AS TIME(6)) a
+59 23:59:59.000000 20001231235959.0000000000
+59 23:59:59.900000 20001231235959.9000000000
+59 23:59:59.990000 20001231235959.9900000000
+59 23:59:59.999000 20001231235959.9990000000
+59 23:59:59.999900 20001231235959.9999000000
+59 23:59:59.999990 20001231235959.9999900000
+59 23:59:59.999999 20001231235959.9999990000
+0 00:00:00.000000 20001231235959.9999999000
+SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+EXTRACT(HOUR FROM a) CAST(a AS TIME(6)) a
+23 23:59:59.000000 20001231235959.0000000000
+23 23:59:59.900000 20001231235959.9000000000
+23 23:59:59.990000 20001231235959.9900000000
+23 23:59:59.999000 20001231235959.9990000000
+23 23:59:59.999900 20001231235959.9999000000
+23 23:59:59.999990 20001231235959.9999900000
+23 23:59:59.999999 20001231235959.9999990000
+0 00:00:00.000000 20001231235959.9999999000
+SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+TIME_TO_SEC(a) CAST(a AS TIME(6)) a
+86399.000000 23:59:59.000000 20001231235959.0000000000
+86399.900000 23:59:59.900000 20001231235959.9000000000
+86399.990000 23:59:59.990000 20001231235959.9900000000
+86399.999000 23:59:59.999000 20001231235959.9990000000
+86399.999900 23:59:59.999900 20001231235959.9999000000
+86399.999990 23:59:59.999990 20001231235959.9999900000
+86399.999999 23:59:59.999999 20001231235959.9999990000
+0.000000 00:00:00.000000 20001231235959.9999999000
+#
+# Functions with a single TIME interval input, conversion from TIME-interval-in-VARCHAR
+#
+SELECT
+EXTRACT(DAY FROM a),
+EXTRACT(HOUR FROM a),
+EXTRACT(MINUTE FROM a),
+EXTRACT(SECOND FROM a),
+EXTRACT(MICROSECOND FROM a),
+CAST(a AS INTERVAL DAY_SECOND(6)),
+a
+FROM t1_time_in_varchar ORDER BY id;
+EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) CAST(a AS INTERVAL DAY_SECOND(6)) a
+0 0 0 0 0 00:00:00.000000 00:00:00
+0 0 0 0 900000 00:00:00.900000 00:00:00.9
+0 0 0 0 990000 00:00:00.990000 00:00:00.99
+0 0 0 0 999000 00:00:00.999000 00:00:00.999
+0 0 0 0 999900 00:00:00.999900 00:00:00.9999
+0 0 0 0 999990 00:00:00.999990 00:00:00.99999
+0 0 0 0 999999 00:00:00.999999 00:00:00.999999
+0 0 0 1 0 00:00:01.000000 00:00:00.9999999
+34 22 0 0 0 34 22:00:00.000000 837:59:59.9999999
+34 22 59 59 0 34 22:59:59.000000 838:59:59
+34 22 59 59 900000 34 22:59:59.900000 838:59:59.9
+34 22 59 59 990000 34 22:59:59.990000 838:59:59.99
+34 22 59 59 999000 34 22:59:59.999000 838:59:59.999
+34 22 59 59 999900 34 22:59:59.999900 838:59:59.9999
+34 22 59 59 999990 34 22:59:59.999990 838:59:59.99999
+34 22 59 59 999999 34 22:59:59.999999 838:59:59.999999
+34 23 0 0 0 34 23:00:00.000000 838:59:59.9999999
+35 0 0 0 0 35 00:00:00.000000 839:59:59.9999999
+3652058 22 59 59 999999 3652058 22:59:59.999999 87649414:59:59.999999
+3652058 23 0 0 0 3652058 23:00:00.000000 87649414:59:59.9999999
+3652058 23 59 59 999999 3652058 23:59:59.999999 87649415:59:59.999999
+3652058 23 59 59 999999 3652058 23:59:59.999999 87649415:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '837:59:59.9999999'
+Note 1292 Truncated incorrect time value: '838:59:59.9999999'
+Note 1292 Truncated incorrect time value: '838:59:59.9999999'
+Note 1292 Truncated incorrect time value: '838:59:59.9999999'
+Note 1292 Truncated incorrect time value: '838:59:59.9999999'
+Note 1292 Truncated incorrect time value: '838:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '838:59:59.9999999'
+Note 1292 Truncated incorrect time value: '839:59:59.9999999'
+Note 1292 Truncated incorrect time value: '839:59:59.9999999'
+Note 1292 Truncated incorrect time value: '839:59:59.9999999'
+Note 1292 Truncated incorrect time value: '839:59:59.9999999'
+Note 1292 Truncated incorrect time value: '839:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.9999999'
+Note 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Note 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Note 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Note 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Note 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '87649414:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649415:59:59.9999999'
+SELECT
+TIME_TO_SEC(a),
+CAST(a AS TIME(6)),
+a
+FROM t1_time_in_varchar ORDER BY id;
+TIME_TO_SEC(a) CAST(a AS TIME(6)) a
+0.000000 00:00:00.000000 00:00:00
+0.900000 00:00:00.900000 00:00:00.9
+0.990000 00:00:00.990000 00:00:00.99
+0.999000 00:00:00.999000 00:00:00.999
+0.999900 00:00:00.999900 00:00:00.9999
+0.999990 00:00:00.999990 00:00:00.99999
+0.999999 00:00:00.999999 00:00:00.999999
+1.000000 00:00:01.000000 00:00:00.9999999
+3016800.000000 838:00:00.000000 837:59:59.9999999
+3020399.000000 838:59:59.000000 838:59:59
+3020399.900000 838:59:59.900000 838:59:59.9
+3020399.990000 838:59:59.990000 838:59:59.99
+3020399.999000 838:59:59.999000 838:59:59.999
+3020399.999900 838:59:59.999900 838:59:59.9999
+3020399.999990 838:59:59.999990 838:59:59.99999
+3020399.999999 838:59:59.999999 838:59:59.999999
+3020399.999999 838:59:59.999999 838:59:59.9999999
+3020399.999999 838:59:59.999999 839:59:59.9999999
+3020399.999999 838:59:59.999999 87649414:59:59.999999
+3020399.999999 838:59:59.999999 87649414:59:59.9999999
+3020399.999999 838:59:59.999999 87649415:59:59.999999
+3020399.999999 838:59:59.999999 87649415:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Note 1292 Truncated incorrect time value: '837:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '838:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '838:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '839:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '839:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649414:59:59.999999'
+Warning 1292 Truncated incorrect time value: '87649414:59:59.999999'
+Warning 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649414:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999'
+#
+# Functions with a single TIME interval input, conversion from TIME-interval-in-DECIMAL
+#
+SELECT
+EXTRACT(DAY FROM a),
+EXTRACT(HOUR FROM a),
+EXTRACT(MINUTE FROM a),
+EXTRACT(SECOND FROM a),
+EXTRACT(MICROSECOND FROM a),
+CAST(a AS INTERVAL DAY_SECOND(6)),
+a
+FROM t1_time_in_decimal ORDER BY id;
+EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) CAST(a AS INTERVAL DAY_SECOND(6)) a
+0 0 0 0 0 00:00:00.000000 0.0000000000
+0 0 0 0 900000 00:00:00.900000 0.9000000000
+0 0 0 0 990000 00:00:00.990000 0.9900000000
+0 0 0 0 999000 00:00:00.999000 0.9990000000
+0 0 0 0 999900 00:00:00.999900 0.9999000000
+0 0 0 0 999990 00:00:00.999990 0.9999900000
+0 0 0 0 999999 00:00:00.999999 0.9999990000
+0 0 0 1 0 00:00:01.000000 0.9999999000
+34 22 0 0 0 34 22:00:00.000000 8375959.9999999000
+34 22 59 59 0 34 22:59:59.000000 8385959.0000000000
+34 22 59 59 900000 34 22:59:59.900000 8385959.9000000000
+34 22 59 59 990000 34 22:59:59.990000 8385959.9900000000
+34 22 59 59 999000 34 22:59:59.999000 8385959.9990000000
+34 22 59 59 999900 34 22:59:59.999900 8385959.9999000000
+34 22 59 59 999990 34 22:59:59.999990 8385959.9999900000
+34 22 59 59 999999 34 22:59:59.999999 8385959.9999990000
+34 23 0 0 0 34 23:00:00.000000 8385959.9999999000
+35 0 0 0 0 35 00:00:00.000000 8395959.9999999000
+3652058 22 59 59 999999 3652058 22:59:59.999999 876494145959.9999990000
+3652058 23 0 0 0 3652058 23:00:00.000000 876494145959.9999999000
+3652058 23 59 59 999999 3652058 23:59:59.999999 876494155959.9999990000
+3652058 23 59 59 999999 3652058 23:59:59.999999 876494155959.9999999000
+Warnings:
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.0000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9900000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9990000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999900000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999990000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999999000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8375959.9999999000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.0000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9900000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9990000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999900000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999990000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999999000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.9999999000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494145959.9999990000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494145959.9999999000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494155959.9999990000'
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '876494155959.9999999000'
+SELECT
+TIME_TO_SEC(a),
+CAST(a AS TIME(6)),
+a
+FROM t1_time_in_decimal ORDER BY id;
+TIME_TO_SEC(a) CAST(a AS TIME(6)) a
+0.000000 00:00:00.000000 0.0000000000
+0.900000 00:00:00.900000 0.9000000000
+0.990000 00:00:00.990000 0.9900000000
+0.999000 00:00:00.999000 0.9990000000
+0.999900 00:00:00.999900 0.9999000000
+0.999990 00:00:00.999990 0.9999900000
+0.999999 00:00:00.999999 0.9999990000
+1.000000 00:00:01.000000 0.9999999000
+3016800.000000 838:00:00.000000 8375959.9999999000
+3020399.000000 838:59:59.000000 8385959.0000000000
+3020399.900000 838:59:59.900000 8385959.9000000000
+3020399.990000 838:59:59.990000 8385959.9900000000
+3020399.999000 838:59:59.999000 8385959.9990000000
+3020399.999900 838:59:59.999900 8385959.9999000000
+3020399.999990 838:59:59.999990 8385959.9999900000
+3020399.999999 838:59:59.999999 8385959.9999990000
+3020399.999999 838:59:59.999999 8385959.9999999000
+3020399.999999 838:59:59.999999 8395959.9999999000
+NULL NULL 876494145959.9999990000
+NULL NULL 876494145959.9999999000
+NULL NULL 876494155959.9999990000
+NULL NULL 876494155959.9999999000
+Warnings:
+Warning 1292 Incorrect time value: '8385959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 17
+Warning 1292 Incorrect time value: '8385959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 17
+Warning 1292 Incorrect time value: '8395959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 18
+Warning 1292 Incorrect time value: '8395959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 18
+Warning 1292 Incorrect time value: '876494145959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 19
+Warning 1292 Incorrect time value: '876494145959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 19
+Warning 1292 Incorrect time value: '876494145959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 20
+Warning 1292 Incorrect time value: '876494145959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 20
+Warning 1292 Incorrect time value: '876494155959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 21
+Warning 1292 Incorrect time value: '876494155959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 21
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22
+#
+# Functions with a single DATE input, conversion from DATETIME-in-VARCHAR
+#
+SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+QUARTER(a) CAST(a AS DATE) a
+4 2000-12-31 2000-12-31 23:59:59
+4 2000-12-31 2000-12-31 23:59:59.9
+4 2000-12-31 2000-12-31 23:59:59.99
+4 2000-12-31 2000-12-31 23:59:59.999
+4 2000-12-31 2000-12-31 23:59:59.9999
+4 2000-12-31 2000-12-31 23:59:59.99999
+4 2000-12-31 2000-12-31 23:59:59.999999
+1 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+DAY(a) CAST(a AS DATE) a
+31 2000-12-31 2000-12-31 23:59:59
+31 2000-12-31 2000-12-31 23:59:59.9
+31 2000-12-31 2000-12-31 23:59:59.99
+31 2000-12-31 2000-12-31 23:59:59.999
+31 2000-12-31 2000-12-31 23:59:59.9999
+31 2000-12-31 2000-12-31 23:59:59.99999
+31 2000-12-31 2000-12-31 23:59:59.999999
+1 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+MONTH(a) CAST(a AS DATE) a
+12 2000-12-31 2000-12-31 23:59:59
+12 2000-12-31 2000-12-31 23:59:59.9
+12 2000-12-31 2000-12-31 23:59:59.99
+12 2000-12-31 2000-12-31 23:59:59.999
+12 2000-12-31 2000-12-31 23:59:59.9999
+12 2000-12-31 2000-12-31 23:59:59.99999
+12 2000-12-31 2000-12-31 23:59:59.999999
+1 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+YEAR(a) CAST(a AS DATE) a
+2000 2000-12-31 2000-12-31 23:59:59
+2000 2000-12-31 2000-12-31 23:59:59.9
+2000 2000-12-31 2000-12-31 23:59:59.99
+2000 2000-12-31 2000-12-31 23:59:59.999
+2000 2000-12-31 2000-12-31 23:59:59.9999
+2000 2000-12-31 2000-12-31 23:59:59.99999
+2000 2000-12-31 2000-12-31 23:59:59.999999
+2001 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+DAYNAME(a) CAST(a AS DATE) a
+Sunday 2000-12-31 2000-12-31 23:59:59
+Sunday 2000-12-31 2000-12-31 23:59:59.9
+Sunday 2000-12-31 2000-12-31 23:59:59.99
+Sunday 2000-12-31 2000-12-31 23:59:59.999
+Sunday 2000-12-31 2000-12-31 23:59:59.9999
+Sunday 2000-12-31 2000-12-31 23:59:59.99999
+Sunday 2000-12-31 2000-12-31 23:59:59.999999
+Monday 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+MONTHNAME(a) CAST(a AS DATE) a
+December 2000-12-31 2000-12-31 23:59:59
+December 2000-12-31 2000-12-31 23:59:59.9
+December 2000-12-31 2000-12-31 23:59:59.99
+December 2000-12-31 2000-12-31 23:59:59.999
+December 2000-12-31 2000-12-31 23:59:59.9999
+December 2000-12-31 2000-12-31 23:59:59.99999
+December 2000-12-31 2000-12-31 23:59:59.999999
+January 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+LAST_DAY(a) CAST(a AS DATE) a
+2000-12-31 2000-12-31 2000-12-31 23:59:59
+2000-12-31 2000-12-31 2000-12-31 23:59:59.9
+2000-12-31 2000-12-31 2000-12-31 23:59:59.99
+2000-12-31 2000-12-31 2000-12-31 23:59:59.999
+2000-12-31 2000-12-31 2000-12-31 23:59:59.9999
+2000-12-31 2000-12-31 2000-12-31 23:59:59.99999
+2000-12-31 2000-12-31 2000-12-31 23:59:59.999999
+2000-12-31 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+TO_DAYS(a) CAST(a AS DATE) a
+730850 2000-12-31 2000-12-31 23:59:59
+730850 2000-12-31 2000-12-31 23:59:59.9
+730850 2000-12-31 2000-12-31 23:59:59.99
+730850 2000-12-31 2000-12-31 23:59:59.999
+730850 2000-12-31 2000-12-31 23:59:59.9999
+730850 2000-12-31 2000-12-31 23:59:59.99999
+730850 2000-12-31 2000-12-31 23:59:59.999999
+730851 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+DAYOFYEAR(a) CAST(a AS DATE) a
+366 2000-12-31 2000-12-31 23:59:59
+366 2000-12-31 2000-12-31 23:59:59.9
+366 2000-12-31 2000-12-31 23:59:59.99
+366 2000-12-31 2000-12-31 23:59:59.999
+366 2000-12-31 2000-12-31 23:59:59.9999
+366 2000-12-31 2000-12-31 23:59:59.99999
+366 2000-12-31 2000-12-31 23:59:59.999999
+1 2000-12-31 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+CREATE TABLE t1 (a VARCHAR(32));
+INSERT INTO t1 VALUES
+('2002-01-05 23:59:59'),
+('2002-01-05 23:59:59.999999'),
+('2002-01-05 23:59:59.9999999');
+SELECT YEARWEEK(a), a FROM t1;
+YEARWEEK(a) a
+200152 2002-01-05 23:59:59
+200152 2002-01-05 23:59:59.999999
+200201 2002-01-05 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2002-01-05 23:59:59.9999999'
+SELECT WEEK(a), a FROM t1;
+WEEK(a) a
+0 2002-01-05 23:59:59
+0 2002-01-05 23:59:59.999999
+1 2002-01-05 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2002-01-05 23:59:59.9999999'
+SELECT WEEKDAY(a), a FROM t1;
+WEEKDAY(a) a
+5 2002-01-05 23:59:59
+5 2002-01-05 23:59:59.999999
+6 2002-01-05 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2002-01-05 23:59:59.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,9));
+INSERT INTO t1 VALUES
+(20020105235959),
+(20020105235959.999999),
+(20020105235959.9999999);
+SELECT YEARWEEK(a), a FROM t1;
+YEARWEEK(a) a
+200152 20020105235959.000000000
+200152 20020105235959.999999000
+200201 20020105235959.999999900
+SELECT WEEK(a), a FROM t1;
+WEEK(a) a
+0 20020105235959.000000000
+0 20020105235959.999999000
+1 20020105235959.999999900
+SELECT WEEKDAY(a), a FROM t1;
+WEEKDAY(a) a
+5 20020105235959.000000000
+5 20020105235959.999999000
+6 20020105235959.999999900
+DROP TABLE t1;
+#
+# Functions with a single DATE input, conversion from DATETIME-in-DECIMAL
+#
+SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+QUARTER(a) CAST(a AS DATE) a
+4 2000-12-31 20001231235959.0000000000
+4 2000-12-31 20001231235959.9000000000
+4 2000-12-31 20001231235959.9900000000
+4 2000-12-31 20001231235959.9990000000
+4 2000-12-31 20001231235959.9999000000
+4 2000-12-31 20001231235959.9999900000
+4 2000-12-31 20001231235959.9999990000
+1 2000-12-31 20001231235959.9999999000
+SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+DAY(a) CAST(a AS DATE) a
+31 2000-12-31 20001231235959.0000000000
+31 2000-12-31 20001231235959.9000000000
+31 2000-12-31 20001231235959.9900000000
+31 2000-12-31 20001231235959.9990000000
+31 2000-12-31 20001231235959.9999000000
+31 2000-12-31 20001231235959.9999900000
+31 2000-12-31 20001231235959.9999990000
+1 2000-12-31 20001231235959.9999999000
+SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+MONTH(a) CAST(a AS DATE) a
+12 2000-12-31 20001231235959.0000000000
+12 2000-12-31 20001231235959.9000000000
+12 2000-12-31 20001231235959.9900000000
+12 2000-12-31 20001231235959.9990000000
+12 2000-12-31 20001231235959.9999000000
+12 2000-12-31 20001231235959.9999900000
+12 2000-12-31 20001231235959.9999990000
+1 2000-12-31 20001231235959.9999999000
+SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+YEAR(a) CAST(a AS DATE) a
+2000 2000-12-31 20001231235959.0000000000
+2000 2000-12-31 20001231235959.9000000000
+2000 2000-12-31 20001231235959.9900000000
+2000 2000-12-31 20001231235959.9990000000
+2000 2000-12-31 20001231235959.9999000000
+2000 2000-12-31 20001231235959.9999900000
+2000 2000-12-31 20001231235959.9999990000
+2001 2000-12-31 20001231235959.9999999000
+SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+DAYNAME(a) CAST(a AS DATE) a
+Sunday 2000-12-31 20001231235959.0000000000
+Sunday 2000-12-31 20001231235959.9000000000
+Sunday 2000-12-31 20001231235959.9900000000
+Sunday 2000-12-31 20001231235959.9990000000
+Sunday 2000-12-31 20001231235959.9999000000
+Sunday 2000-12-31 20001231235959.9999900000
+Sunday 2000-12-31 20001231235959.9999990000
+Monday 2000-12-31 20001231235959.9999999000
+SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+MONTHNAME(a) CAST(a AS DATE) a
+December 2000-12-31 20001231235959.0000000000
+December 2000-12-31 20001231235959.9000000000
+December 2000-12-31 20001231235959.9900000000
+December 2000-12-31 20001231235959.9990000000
+December 2000-12-31 20001231235959.9999000000
+December 2000-12-31 20001231235959.9999900000
+December 2000-12-31 20001231235959.9999990000
+January 2000-12-31 20001231235959.9999999000
+SELECT YEARWEEK(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+YEARWEEK(a) CAST(a AS DATE) a
+200053 2000-12-31 20001231235959.0000000000
+200053 2000-12-31 20001231235959.9000000000
+200053 2000-12-31 20001231235959.9900000000
+200053 2000-12-31 20001231235959.9990000000
+200053 2000-12-31 20001231235959.9999000000
+200053 2000-12-31 20001231235959.9999900000
+200053 2000-12-31 20001231235959.9999990000
+200053 2000-12-31 20001231235959.9999999000
+SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+LAST_DAY(a) CAST(a AS DATE) a
+2000-12-31 2000-12-31 20001231235959.0000000000
+2000-12-31 2000-12-31 20001231235959.9000000000
+2000-12-31 2000-12-31 20001231235959.9900000000
+2000-12-31 2000-12-31 20001231235959.9990000000
+2000-12-31 2000-12-31 20001231235959.9999000000
+2000-12-31 2000-12-31 20001231235959.9999900000
+2000-12-31 2000-12-31 20001231235959.9999990000
+2000-12-31 2000-12-31 20001231235959.9999999000
+SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+TO_DAYS(a) CAST(a AS DATE) a
+730850 2000-12-31 20001231235959.0000000000
+730850 2000-12-31 20001231235959.9000000000
+730850 2000-12-31 20001231235959.9900000000
+730850 2000-12-31 20001231235959.9990000000
+730850 2000-12-31 20001231235959.9999000000
+730850 2000-12-31 20001231235959.9999900000
+730850 2000-12-31 20001231235959.9999990000
+730851 2000-12-31 20001231235959.9999999000
+SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+DAYOFYEAR(a) CAST(a AS DATE) a
+366 2000-12-31 20001231235959.0000000000
+366 2000-12-31 20001231235959.9000000000
+366 2000-12-31 20001231235959.9900000000
+366 2000-12-31 20001231235959.9990000000
+366 2000-12-31 20001231235959.9999000000
+366 2000-12-31 20001231235959.9999900000
+366 2000-12-31 20001231235959.9999990000
+1 2000-12-31 20001231235959.9999999000
+SELECT DAYOFMONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+DAYOFMONTH(a) CAST(a AS DATE) a
+31 2000-12-31 20001231235959.0000000000
+31 2000-12-31 20001231235959.9000000000
+31 2000-12-31 20001231235959.9900000000
+31 2000-12-31 20001231235959.9990000000
+31 2000-12-31 20001231235959.9999000000
+31 2000-12-31 20001231235959.9999900000
+31 2000-12-31 20001231235959.9999990000
+1 2000-12-31 20001231235959.9999999000
+#
+# Functions with a single DATETIME input, conversion from DATETIME-in-VARCHAR
+#
+SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+TO_SECONDS(a) CAST(a AS DATETIME(6)) a
+63145526399 2000-12-31 23:59:59.000000 2000-12-31 23:59:59
+63145526399 2000-12-31 23:59:59.900000 2000-12-31 23:59:59.9
+63145526399 2000-12-31 23:59:59.990000 2000-12-31 23:59:59.99
+63145526399 2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999
+63145526399 2000-12-31 23:59:59.999900 2000-12-31 23:59:59.9999
+63145526399 2000-12-31 23:59:59.999990 2000-12-31 23:59:59.99999
+63145526399 2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999
+63145526400 2001-01-01 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SET time_zone='+00:00';
+SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+UNIX_TIMESTAMP(a) CAST(a AS DATETIME(6)) a
+978307199.000000 2000-12-31 23:59:59.000000 2000-12-31 23:59:59
+978307199.900000 2000-12-31 23:59:59.900000 2000-12-31 23:59:59.9
+978307199.990000 2000-12-31 23:59:59.990000 2000-12-31 23:59:59.99
+978307199.999000 2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999
+978307199.999900 2000-12-31 23:59:59.999900 2000-12-31 23:59:59.9999
+978307199.999990 2000-12-31 23:59:59.999990 2000-12-31 23:59:59.99999
+978307199.999999 2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999
+978307200.000000 2001-01-01 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SET time_zone=DEFAULT;
+SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+CONVERT_TZ(a, '+00:00','+00:00') CAST(a AS DATETIME(6)) a
+2000-12-31 23:59:59.000000 2000-12-31 23:59:59.000000 2000-12-31 23:59:59
+2000-12-31 23:59:59.900000 2000-12-31 23:59:59.900000 2000-12-31 23:59:59.9
+2000-12-31 23:59:59.990000 2000-12-31 23:59:59.990000 2000-12-31 23:59:59.99
+2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999
+2000-12-31 23:59:59.999900 2000-12-31 23:59:59.999900 2000-12-31 23:59:59.9999
+2000-12-31 23:59:59.999990 2000-12-31 23:59:59.999990 2000-12-31 23:59:59.99999
+2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999
+2001-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 2000-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+#
+# Functions with a single DATETIME input, conversion from DATETIME-in-DECIMAL
+#
+SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+TO_SECONDS(a) CAST(a AS DATETIME(6)) a
+63145526399 2000-12-31 23:59:59.000000 20001231235959.0000000000
+63145526399 2000-12-31 23:59:59.900000 20001231235959.9000000000
+63145526399 2000-12-31 23:59:59.990000 20001231235959.9900000000
+63145526399 2000-12-31 23:59:59.999000 20001231235959.9990000000
+63145526399 2000-12-31 23:59:59.999900 20001231235959.9999000000
+63145526399 2000-12-31 23:59:59.999990 20001231235959.9999900000
+63145526399 2000-12-31 23:59:59.999999 20001231235959.9999990000
+63145526400 2001-01-01 00:00:00.000000 20001231235959.9999999000
+SET time_zone='+00:00';
+SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+UNIX_TIMESTAMP(a) CAST(a AS DATETIME(6)) a
+978307199.000000 2000-12-31 23:59:59.000000 20001231235959.0000000000
+978307199.900000 2000-12-31 23:59:59.900000 20001231235959.9000000000
+978307199.990000 2000-12-31 23:59:59.990000 20001231235959.9900000000
+978307199.999000 2000-12-31 23:59:59.999000 20001231235959.9990000000
+978307199.999900 2000-12-31 23:59:59.999900 20001231235959.9999000000
+978307199.999990 2000-12-31 23:59:59.999990 20001231235959.9999900000
+978307199.999999 2000-12-31 23:59:59.999999 20001231235959.9999990000
+978307200.000000 2001-01-01 00:00:00.000000 20001231235959.9999999000
+SET time_zone=DEFAULT;
+SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+CONVERT_TZ(a, '+00:00','+00:00') CAST(a AS DATETIME(6)) a
+2000-12-31 23:59:59.000000 2000-12-31 23:59:59.000000 20001231235959.0000000000
+2000-12-31 23:59:59.900000 2000-12-31 23:59:59.900000 20001231235959.9000000000
+2000-12-31 23:59:59.990000 2000-12-31 23:59:59.990000 20001231235959.9900000000
+2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999000 20001231235959.9990000000
+2000-12-31 23:59:59.999900 2000-12-31 23:59:59.999900 20001231235959.9999000000
+2000-12-31 23:59:59.999990 2000-12-31 23:59:59.999990 20001231235959.9999900000
+2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999 20001231235959.9999990000
+2001-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 20001231235959.9999999000
+DROP TABLE t1_datetime_in_varchar;
+DROP TABLE t1_datetime_in_decimal;
+DROP TABLE t1_time_in_varchar;
+DROP TABLE t1_time_in_decimal;
+#
+# Functions that construct DATETIME
+#
+SET time_zone='+00:00';
+CREATE TABLE t1_unix_timestamp (id SERIAL, a DECIMAL(30,10));
+INSERT INTO t1_unix_timestamp (a) VALUES
+(980639999),
+(980639999.9),
+(980639999.999999),
+(980639999.9999999),
+(2147483647),
+(2147483647.9),
+(2147483647.999999),
+(2147483647.9999999);
+SELECT a, FROM_UNIXTIME(a) FROM t1_unix_timestamp ORDER BY id;
+a FROM_UNIXTIME(a)
+980639999.0000000000 2001-01-27 23:59:59.000000
+980639999.9000000000 2001-01-27 23:59:59.900000
+980639999.9999990000 2001-01-27 23:59:59.999999
+980639999.9999999000 2001-01-28 00:00:00.000000
+2147483647.0000000000 2038-01-19 03:14:07.000000
+2147483647.9000000000 2038-01-19 03:14:07.900000
+2147483647.9999990000 2038-01-19 03:14:07.999999
+2147483647.9999999000 NULL
+DROP TABLE t1_unix_timestamp;
+SET time_zone=DEFAULT;
+#
+# Functions that construct TIME
+#
+CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_sec (a) VALUES
+(59),
+(59.9),
+(59.999999),
+(59.9999999),
+(3020398),
+(3020398.999999),
+(3020398.9999999),
+(3020399),
+(3020399.999999),
+(3020399.9999999),
+(9223372036854775807),
+(9223372036854775807.9),
+(9223372036854775807.999999),
+(9223372036854775807.9999999),
+(18446744073709551615),
+(18446744073709551615.9),
+(18446744073709551615.999999),
+(18446744073709551615.9999999);
+SELECT a, SEC_TO_TIME(a) FROM t1_sec ORDER BY id;
+a SEC_TO_TIME(a)
+59.0000000000 00:00:59.000000
+59.9000000000 00:00:59.900000
+59.9999990000 00:00:59.999999
+59.9999999000 00:01:00.000000
+3020398.0000000000 838:59:58.000000
+3020398.9999990000 838:59:58.999999
+3020398.9999999000 838:59:59.000000
+3020399.0000000000 838:59:59.000000
+3020399.9999990000 838:59:59.999999
+3020399.9999999000 838:59:59.999999
+9223372036854775807.0000000000 838:59:59.999999
+9223372036854775807.9000000000 838:59:59.999999
+9223372036854775807.9999990000 838:59:59.999999
+9223372036854775807.9999999000 838:59:59.999999
+18446744073709551615.0000000000 838:59:59.999999
+18446744073709551615.9000000000 838:59:59.999999
+18446744073709551615.9999990000 838:59:59.999999
+18446744073709551615.9999999000 838:59:59.999999
+Warnings:
+Warning 1292 Truncated incorrect seconds value: '3020400'
+Warning 1292 Truncated incorrect seconds value: '9223372036854775807.0000000000'
+Warning 1292 Truncated incorrect seconds value: '9223372036854775807.9000000000'
+Warning 1292 Truncated incorrect seconds value: '9223372036854775807.9999990000'
+Warning 1292 Truncated incorrect seconds value: '9223372036854775807.9999999000'
+Warning 1292 Truncated incorrect seconds value: '18446744073709551615.0000000000'
+Warning 1292 Truncated incorrect seconds value: '18446744073709551615.9000000000'
+Warning 1292 Truncated incorrect seconds value: '18446744073709551615.9999990000'
+Warning 1292 Truncated incorrect seconds value: '18446744073709551615.9999999000'
+DROP TABLE t1_sec;
+CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_sec (a) VALUES
+(0),
+(0.9),
+(0.999999),
+(0.9999999);
+SELECT a, MAKETIME(0, 0, a) FROM t1_sec ORDER BY id;
+a MAKETIME(0, 0, a)
+0.0000000000 00:00:00.000000
+0.9000000000 00:00:00.900000
+0.9999990000 00:00:00.999999
+0.9999999000 00:00:01.000000
+DROP TABLE t1_sec;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+SELECT
+'----',
+a,
+DATE_FORMAT(a, '%Y') AS yyyy,
+DATE_FORMAT(a, '%Y-%m-%d') AS d,
+DATE_FORMAT(a, '%H:%i:%s') AS t0,
+DATE_FORMAT(a, '%H:%i:%s.%f') AS t6,
+DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0,
+DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6
+FROM t1;
+---- ----
+a 2017-12-31 23:59:59
+yyyy 2017
+d 2017-12-31
+t0 23:59:59
+t6 23:59:59.000000
+dt0 2017-12-31 23:59:59
+dt6 2017-12-31 23:59:59.000000
+---- ----
+a 2017-12-31 23:59:59.9
+yyyy 2017
+d 2017-12-31
+t0 23:59:59
+t6 23:59:59.900000
+dt0 2017-12-31 23:59:59
+dt6 2017-12-31 23:59:59.900000
+---- ----
+a 2017-12-31 23:59:59.999999
+yyyy 2017
+d 2017-12-31
+t0 23:59:59
+t6 23:59:59.999999
+dt0 2017-12-31 23:59:59
+dt6 2017-12-31 23:59:59.999999
+---- ----
+a 2017-12-31 23:59:59.9999999
+yyyy 2018
+d 2018-01-01
+t0 00:00:00
+t6 00:00:00.000000
+dt0 2018-01-01 00:00:00
+dt6 2018-01-01 00:00:00.000000
+Warnings:
+Level Note
+Code 1292
+Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Level Note
+Code 1292
+Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Level Note
+Code 1292
+Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Level Note
+Code 1292
+Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Level Note
+Code 1292
+Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Level Note
+Code 1292
+Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,9));
+INSERT INTO t1 VALUES
+(20171231235959),
+(20171231235959.9),
+(20171231235959.999999),
+(20171231235959.9999999);
+SELECT
+'----',
+a,
+DATE_FORMAT(a, '%Y') AS yyyy,
+DATE_FORMAT(a, '%Y-%m-%d') AS d,
+DATE_FORMAT(a, '%H:%i:%s') AS t0,
+DATE_FORMAT(a, '%H:%i:%s.%f') AS t6,
+DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0,
+DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6
+FROM t1;
+---- ----
+a 20171231235959.000000000
+yyyy 2017
+d 2017-12-31
+t0 23:59:59
+t6 23:59:59.000000
+dt0 2017-12-31 23:59:59
+dt6 2017-12-31 23:59:59.000000
+---- ----
+a 20171231235959.900000000
+yyyy 2017
+d 2017-12-31
+t0 23:59:59
+t6 23:59:59.900000
+dt0 2017-12-31 23:59:59
+dt6 2017-12-31 23:59:59.900000
+---- ----
+a 20171231235959.999999000
+yyyy 2017
+d 2017-12-31
+t0 23:59:59
+t6 23:59:59.999999
+dt0 2017-12-31 23:59:59
+dt6 2017-12-31 23:59:59.999999
+---- ----
+a 20171231235959.999999900
+yyyy 2018
+d 2018-01-01
+t0 00:00:00
+t6 00:00:00.000000
+dt0 2018-01-01 00:00:00
+dt6 2018-01-01 00:00:00.000000
+DROP TABLE t1;
+#
+# Functions with two temporal parameters that round nanoseconds in both parameters in MySQL
+#
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+INSERT INTO t2 VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+SELECT TIMESTAMP(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+TIMESTAMP(t1.a, t2.a) a a
+2017-12-31 23:59:59.000000 2017-12-31 23:59:59 00:00:00
+2017-12-31 23:59:59.900000 2017-12-31 23:59:59 00:00:00.9
+2017-12-31 23:59:59.999999 2017-12-31 23:59:59 00:00:00.999999
+2018-01-01 00:00:00.000000 2017-12-31 23:59:59 00:00:00.9999999
+2017-12-31 23:59:59.900000 2017-12-31 23:59:59.9 00:00:00
+2018-01-01 00:00:00.800000 2017-12-31 23:59:59.9 00:00:00.9
+2018-01-01 00:00:00.899999 2017-12-31 23:59:59.9 00:00:00.999999
+2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9 00:00:00.9999999
+2017-12-31 23:59:59.999999 2017-12-31 23:59:59.999999 00:00:00
+2018-01-01 00:00:00.899999 2017-12-31 23:59:59.999999 00:00:00.9
+2018-01-01 00:00:00.999998 2017-12-31 23:59:59.999999 00:00:00.999999
+2018-01-01 00:00:00.999999 2017-12-31 23:59:59.999999 00:00:00.9999999
+2018-01-01 00:00:00.000000 2017-12-31 23:59:59.9999999 00:00:00
+2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9999999 00:00:00.9
+2018-01-01 00:00:00.999999 2017-12-31 23:59:59.9999999 00:00:00.999999
+2018-01-01 00:00:01.000000 2017-12-31 23:59:59.9999999 00:00:00.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+SELECT ADDTIME(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+ADDTIME(t1.a, t2.a) a a
+2017-12-31 23:59:59 2017-12-31 23:59:59 00:00:00
+2017-12-31 23:59:59.900000 2017-12-31 23:59:59 00:00:00.9
+2017-12-31 23:59:59.999999 2017-12-31 23:59:59 00:00:00.999999
+2018-01-01 00:00:00 2017-12-31 23:59:59 00:00:00.9999999
+2017-12-31 23:59:59.900000 2017-12-31 23:59:59.9 00:00:00
+2018-01-01 00:00:00.800000 2017-12-31 23:59:59.9 00:00:00.9
+2018-01-01 00:00:00.899999 2017-12-31 23:59:59.9 00:00:00.999999
+2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9 00:00:00.9999999
+2017-12-31 23:59:59.999999 2017-12-31 23:59:59.999999 00:00:00
+2018-01-01 00:00:00.899999 2017-12-31 23:59:59.999999 00:00:00.9
+2018-01-01 00:00:00.999998 2017-12-31 23:59:59.999999 00:00:00.999999
+2018-01-01 00:00:00.999999 2017-12-31 23:59:59.999999 00:00:00.9999999
+2018-01-01 00:00:00 2017-12-31 23:59:59.9999999 00:00:00
+2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9999999 00:00:00.9
+2018-01-01 00:00:00.999999 2017-12-31 23:59:59.9999999 00:00:00.999999
+2018-01-01 00:00:01 2017-12-31 23:59:59.9999999 00:00:00.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999'
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('23:59:59'),
+('23:59:59.9'),
+('23:59:59.999999'),
+('23:59:59.9999999');
+INSERT INTO t2 VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+TIMEDIFF(t1.a, t2.a) a a
+23:59:59.000000 23:59:59 00:00:00
+23:59:58.100000 23:59:59 00:00:00.9
+23:59:58.000001 23:59:59 00:00:00.999999
+23:59:58.000000 23:59:59 00:00:00.9999999
+23:59:59.900000 23:59:59.9 00:00:00
+23:59:59.000000 23:59:59.9 00:00:00.9
+23:59:58.900001 23:59:59.9 00:00:00.999999
+23:59:58.900000 23:59:59.9 00:00:00.9999999
+23:59:59.999999 23:59:59.999999 00:00:00
+23:59:59.099999 23:59:59.999999 00:00:00.9
+23:59:59.000000 23:59:59.999999 00:00:00.999999
+23:59:58.999999 23:59:59.999999 00:00:00.9999999
+24:00:00.000000 23:59:59.9999999 00:00:00
+23:59:59.100000 23:59:59.9999999 00:00:00.9
+23:59:59.000001 23:59:59.9999999 00:00:00.999999
+23:59:59.000000 23:59:59.9999999 00:00:00.9999999
+Warnings:
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2001-12-31 23:59:59'),
+('2001-12-31 23:59:59.9'),
+('2001-12-31 23:59:59.999999'),
+('2001-12-31 23:59:59.9999999');
+INSERT INTO t2 VALUES
+('2001-12-31 23:59:59'),
+('2001-12-31 23:59:59.9'),
+('2001-12-31 23:59:59.999999'),
+('2001-12-31 23:59:59.9999999');
+SELECT TIMESTAMPDIFF(MICROSECOND,t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+TIMESTAMPDIFF(MICROSECOND,t1.a, t2.a) a a
+0 2001-12-31 23:59:59 2001-12-31 23:59:59
+900000 2001-12-31 23:59:59 2001-12-31 23:59:59.9
+999999 2001-12-31 23:59:59 2001-12-31 23:59:59.999999
+1000000 2001-12-31 23:59:59 2001-12-31 23:59:59.9999999
+-900000 2001-12-31 23:59:59.9 2001-12-31 23:59:59
+0 2001-12-31 23:59:59.9 2001-12-31 23:59:59.9
+99999 2001-12-31 23:59:59.9 2001-12-31 23:59:59.999999
+100000 2001-12-31 23:59:59.9 2001-12-31 23:59:59.9999999
+-999999 2001-12-31 23:59:59.999999 2001-12-31 23:59:59
+-99999 2001-12-31 23:59:59.999999 2001-12-31 23:59:59.9
+0 2001-12-31 23:59:59.999999 2001-12-31 23:59:59.999999
+1 2001-12-31 23:59:59.999999 2001-12-31 23:59:59.9999999
+-1000000 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59
+-100000 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59.9
+-1 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59.999999
+0 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999'
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('23:59:59'),
+('23:59:59.9'),
+('23:59:59.999999'),
+('23:59:59.9999999');
+INSERT INTO t2 VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+TIMEDIFF(t1.a, t2.a) a a
+23:59:59.000000 23:59:59 00:00:00
+23:59:58.100000 23:59:59 00:00:00.9
+23:59:58.000001 23:59:59 00:00:00.999999
+23:59:58.000000 23:59:59 00:00:00.9999999
+23:59:59.900000 23:59:59.9 00:00:00
+23:59:59.000000 23:59:59.9 00:00:00.9
+23:59:58.900001 23:59:59.9 00:00:00.999999
+23:59:58.900000 23:59:59.9 00:00:00.9999999
+23:59:59.999999 23:59:59.999999 00:00:00
+23:59:59.099999 23:59:59.999999 00:00:00.9
+23:59:59.000000 23:59:59.999999 00:00:00.999999
+23:59:58.999999 23:59:59.999999 00:00:00.9999999
+24:00:00.000000 23:59:59.9999999 00:00:00
+23:59:59.100000 23:59:59.9999999 00:00:00.9
+23:59:59.000001 23:59:59.9999999 00:00:00.999999
+23:59:59.000000 23:59:59.9999999 00:00:00.9999999
+Warnings:
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+Note 1292 Truncated incorrect time value: '23:59:59.9999999'
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+DROP TABLE t1, t2;
+#
+# STR_TO_DATE behaviour is questionable in MySQL 5.6 (MySQL Bug #92474)
+#
+# It truncates nanoseconds, but this may change in the future.
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+SELECT
+a,
+STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s') AS c0,
+STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s.%f') AS c6
+FROM t1;
+a c0 c6
+2017-12-31 23:59:59 2017-12-31 23:59:59 2017-12-31 23:59:59.000000
+2017-12-31 23:59:59.9 2017-12-31 23:59:59 2017-12-31 23:59:59.900000
+2017-12-31 23:59:59.999999 2017-12-31 23:59:59 2017-12-31 23:59:59.999999
+2017-12-31 23:59:59.9999999 2017-12-31 23:59:59 2017-12-31 23:59:59.999999
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9'
+Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.999999'
+Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+DROP TABLE t1;
+#
+# DATE_ADD behaviour is questionable in MySQL 5.6 (MySQL Bug#92473)
+# It rounds nanoseconds in the first argument, but truncates nanoseconds in the second argument.
+# This may change in the future, to round both arguments.
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+CREATE TABLE t2 (b DECIMAL(32,9));
+INSERT INTO t2 VALUES
+(0),
+(0.9),
+(0.999999),
+(0.9999999);
+SELECT a, b, DATE_ADD(a, INTERVAL b SECOND) FROM t1,t2 ORDER BY a,b;
+a b DATE_ADD(a, INTERVAL b SECOND)
+2017-12-31 23:59:59 0.000000000 2017-12-31 23:59:59.000000
+2017-12-31 23:59:59 0.900000000 2017-12-31 23:59:59.900000
+2017-12-31 23:59:59 0.999999000 2017-12-31 23:59:59.999999
+2017-12-31 23:59:59 0.999999900 2017-12-31 23:59:59.999999
+2017-12-31 23:59:59.9 0.000000000 2017-12-31 23:59:59.900000
+2017-12-31 23:59:59.9 0.900000000 2018-01-01 00:00:00.800000
+2017-12-31 23:59:59.9 0.999999000 2018-01-01 00:00:00.899999
+2017-12-31 23:59:59.9 0.999999900 2018-01-01 00:00:00.899999
+2017-12-31 23:59:59.999999 0.000000000 2017-12-31 23:59:59.999999
+2017-12-31 23:59:59.999999 0.900000000 2018-01-01 00:00:00.899999
+2017-12-31 23:59:59.999999 0.999999000 2018-01-01 00:00:00.999998
+2017-12-31 23:59:59.999999 0.999999900 2018-01-01 00:00:00.999998
+2017-12-31 23:59:59.9999999 0.000000000 2018-01-01 00:00:00.000000
+2017-12-31 23:59:59.9999999 0.900000000 2018-01-01 00:00:00.900000
+2017-12-31 23:59:59.9999999 0.999999000 2018-01-01 00:00:00.999999
+2017-12-31 23:59:59.9999999 0.999999900 2018-01-01 00:00:00.999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999'
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/func_time_round.test b/mysql-test/main/func_time_round.test
new file mode 100644
index 00000000000..12d3a50a10f
--- /dev/null
+++ b/mysql-test/main/func_time_round.test
@@ -0,0 +1,461 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+
+CREATE TABLE t1_datetime_in_varchar (id SERIAL, a VARCHAR(64));
+INSERT INTO t1_datetime_in_varchar (a) VALUES
+('2000-12-31 23:59:59'),
+('2000-12-31 23:59:59.9'),
+('2000-12-31 23:59:59.99'),
+('2000-12-31 23:59:59.999'),
+('2000-12-31 23:59:59.9999'),
+('2000-12-31 23:59:59.99999'),
+('2000-12-31 23:59:59.999999'),
+('2000-12-31 23:59:59.9999999');
+
+CREATE TABLE t1_datetime_in_decimal (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_datetime_in_decimal (a) VALUES
+(20001231235959),
+(20001231235959.9),
+(20001231235959.99),
+(20001231235959.999),
+(20001231235959.9999),
+(20001231235959.99999),
+(20001231235959.999999),
+(20001231235959.9999999);
+
+
+CREATE TABLE t1_time_in_varchar (id SERIAL, a VARCHAR(64));
+INSERT INTO t1_time_in_varchar (a) VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.99'),
+('00:00:00.999'),
+('00:00:00.9999'),
+('00:00:00.99999'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+INSERT INTO t1_time_in_varchar (a) VALUES
+('837:59:59.9999999'),
+('838:59:59'),
+('838:59:59.9'),
+('838:59:59.99'),
+('838:59:59.999'),
+('838:59:59.9999'),
+('838:59:59.99999'),
+('838:59:59.999999'),
+('838:59:59.9999999'),
+('839:59:59.9999999'),
+('87649414:59:59.999999'),
+('87649414:59:59.9999999'),
+('87649415:59:59.999999'),
+('87649415:59:59.9999999');
+
+
+CREATE TABLE t1_time_in_decimal (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_time_in_decimal (a) VALUES
+(0),
+(0.9),
+(0.99),
+(0.999),
+(0.9999),
+(0.99999),
+(0.999999),
+(0.9999999);
+INSERT INTO t1_time_in_decimal (a) VALUES
+(8375959.9999999),
+(8385959),
+(8385959.9),
+(8385959.99),
+(8385959.999),
+(8385959.9999),
+(8385959.99999),
+(8385959.999999),
+(8385959.9999999),
+(8395959.9999999),
+(876494145959.999999),
+(876494145959.9999999),
+(876494155959.999999),
+(876494155959.9999999);
+
+--echo #
+--echo # TIME: LEAST/GREATEST
+--echo #
+
+SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_varchar;
+SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_decimal;
+
+SELECT GREATEST(TIME'00:00:00', '00:00:00.0000004');
+SELECT GREATEST(TIME'00:00:00', 0.0000004);
+
+SELECT GREATEST(TIME'00:00:00', '00:00:00.0000005');
+SELECT GREATEST(TIME'00:00:00', 0.0000005);
+
+
+--echo #
+--echo # Functions with a single TIME input, conversion from DATETIME-in-VARCHAR
+--echo #
+
+SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+
+SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+
+SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+
+
+--echo #
+--echo # Functions with a single TIME input, conversion from DATETIME-in-DECIMAL
+--echo #
+
+
+SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+
+SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+
+SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+
+
+--echo #
+--echo # Functions with a single TIME interval input, conversion from TIME-interval-in-VARCHAR
+--echo #
+
+SELECT
+ EXTRACT(DAY FROM a),
+ EXTRACT(HOUR FROM a),
+ EXTRACT(MINUTE FROM a),
+ EXTRACT(SECOND FROM a),
+ EXTRACT(MICROSECOND FROM a),
+ CAST(a AS INTERVAL DAY_SECOND(6)),
+ a
+FROM t1_time_in_varchar ORDER BY id;
+
+SELECT
+ TIME_TO_SEC(a),
+ CAST(a AS TIME(6)),
+ a
+FROM t1_time_in_varchar ORDER BY id;
+
+--echo #
+--echo # Functions with a single TIME interval input, conversion from TIME-interval-in-DECIMAL
+--echo #
+
+SELECT
+ EXTRACT(DAY FROM a),
+ EXTRACT(HOUR FROM a),
+ EXTRACT(MINUTE FROM a),
+ EXTRACT(SECOND FROM a),
+ EXTRACT(MICROSECOND FROM a),
+ CAST(a AS INTERVAL DAY_SECOND(6)),
+ a
+FROM t1_time_in_decimal ORDER BY id;
+
+SELECT
+ TIME_TO_SEC(a),
+ CAST(a AS TIME(6)),
+ a
+FROM t1_time_in_decimal ORDER BY id;
+
+
+--echo #
+--echo # Functions with a single DATE input, conversion from DATETIME-in-VARCHAR
+--echo #
+
+SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+
+SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+
+SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id;
+
+
+CREATE TABLE t1 (a VARCHAR(32));
+INSERT INTO t1 VALUES
+('2002-01-05 23:59:59'),
+('2002-01-05 23:59:59.999999'),
+('2002-01-05 23:59:59.9999999');
+SELECT YEARWEEK(a), a FROM t1;
+SELECT WEEK(a), a FROM t1;
+SELECT WEEKDAY(a), a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,9));
+INSERT INTO t1 VALUES
+(20020105235959),
+(20020105235959.999999),
+(20020105235959.9999999);
+SELECT YEARWEEK(a), a FROM t1;
+SELECT WEEK(a), a FROM t1;
+SELECT WEEKDAY(a), a FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Functions with a single DATE input, conversion from DATETIME-in-DECIMAL
+--echo #
+
+SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+
+SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT YEARWEEK(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+
+SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+SELECT DAYOFMONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id;
+
+
+--echo #
+--echo # Functions with a single DATETIME input, conversion from DATETIME-in-VARCHAR
+--echo #
+
+SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+
+SET time_zone='+00:00';
+SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+SET time_zone=DEFAULT;
+
+SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id;
+
+
+--echo #
+--echo # Functions with a single DATETIME input, conversion from DATETIME-in-DECIMAL
+--echo #
+
+SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+
+SET time_zone='+00:00';
+SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+SET time_zone=DEFAULT;
+
+SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id;
+
+DROP TABLE t1_datetime_in_varchar;
+DROP TABLE t1_datetime_in_decimal;
+DROP TABLE t1_time_in_varchar;
+DROP TABLE t1_time_in_decimal;
+
+
+--echo #
+--echo # Functions that construct DATETIME
+--echo #
+
+SET time_zone='+00:00';
+CREATE TABLE t1_unix_timestamp (id SERIAL, a DECIMAL(30,10));
+INSERT INTO t1_unix_timestamp (a) VALUES
+(980639999),
+(980639999.9),
+(980639999.999999),
+(980639999.9999999),
+(2147483647),
+(2147483647.9),
+(2147483647.999999),
+(2147483647.9999999);
+SELECT a, FROM_UNIXTIME(a) FROM t1_unix_timestamp ORDER BY id;
+DROP TABLE t1_unix_timestamp;
+SET time_zone=DEFAULT;
+
+
+--echo #
+--echo # Functions that construct TIME
+--echo #
+
+CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_sec (a) VALUES
+(59),
+(59.9),
+(59.999999),
+(59.9999999),
+(3020398),
+(3020398.999999),
+(3020398.9999999),
+(3020399),
+(3020399.999999),
+(3020399.9999999),
+(9223372036854775807),
+(9223372036854775807.9),
+(9223372036854775807.999999),
+(9223372036854775807.9999999),
+(18446744073709551615),
+(18446744073709551615.9),
+(18446744073709551615.999999),
+(18446744073709551615.9999999);
+SELECT a, SEC_TO_TIME(a) FROM t1_sec ORDER BY id;
+DROP TABLE t1_sec;
+
+
+CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10));
+INSERT INTO t1_sec (a) VALUES
+(0),
+(0.9),
+(0.999999),
+(0.9999999);
+SELECT a, MAKETIME(0, 0, a) FROM t1_sec ORDER BY id;
+DROP TABLE t1_sec;
+
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+--vertical_results
+SELECT
+ '----',
+ a,
+ DATE_FORMAT(a, '%Y') AS yyyy,
+ DATE_FORMAT(a, '%Y-%m-%d') AS d,
+ DATE_FORMAT(a, '%H:%i:%s') AS t0,
+ DATE_FORMAT(a, '%H:%i:%s.%f') AS t6,
+ DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0,
+ DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6
+FROM t1;
+--horizontal_results
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,9));
+INSERT INTO t1 VALUES
+(20171231235959),
+(20171231235959.9),
+(20171231235959.999999),
+(20171231235959.9999999);
+--vertical_results
+SELECT
+ '----',
+ a,
+ DATE_FORMAT(a, '%Y') AS yyyy,
+ DATE_FORMAT(a, '%Y-%m-%d') AS d,
+ DATE_FORMAT(a, '%H:%i:%s') AS t0,
+ DATE_FORMAT(a, '%H:%i:%s.%f') AS t6,
+ DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0,
+ DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6
+FROM t1;
+--horizontal_results
+DROP TABLE t1;
+
+
+--echo #
+--echo # Functions with two temporal parameters that round nanoseconds in both parameters in MySQL
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+INSERT INTO t2 VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+
+SELECT TIMESTAMP(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+SELECT ADDTIME(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+
+DROP TABLE t1, t2;
+
+
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('23:59:59'),
+('23:59:59.9'),
+('23:59:59.999999'),
+('23:59:59.9999999');
+INSERT INTO t2 VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+DROP TABLE t1, t2;
+
+
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2001-12-31 23:59:59'),
+('2001-12-31 23:59:59.9'),
+('2001-12-31 23:59:59.999999'),
+('2001-12-31 23:59:59.9999999');
+INSERT INTO t2 VALUES
+('2001-12-31 23:59:59'),
+('2001-12-31 23:59:59.9'),
+('2001-12-31 23:59:59.999999'),
+('2001-12-31 23:59:59.9999999');
+SELECT TIMESTAMPDIFF(MICROSECOND,t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (a VARCHAR(64));
+CREATE TABLE t2 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('23:59:59'),
+('23:59:59.9'),
+('23:59:59.999999'),
+('23:59:59.9999999');
+INSERT INTO t2 VALUES
+('00:00:00'),
+('00:00:00.9'),
+('00:00:00.999999'),
+('00:00:00.9999999');
+SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a;
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # STR_TO_DATE behaviour is questionable in MySQL 5.6 (MySQL Bug #92474)
+--echo #
+
+--echo # It truncates nanoseconds, but this may change in the future.
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+
+SELECT
+ a,
+ STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s') AS c0,
+ STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s.%f') AS c6
+FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # DATE_ADD behaviour is questionable in MySQL 5.6 (MySQL Bug#92473)
+--echo # It rounds nanoseconds in the first argument, but truncates nanoseconds in the second argument.
+--echo # This may change in the future, to round both arguments.
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('2017-12-31 23:59:59'),
+('2017-12-31 23:59:59.9'),
+('2017-12-31 23:59:59.999999'),
+('2017-12-31 23:59:59.9999999');
+CREATE TABLE t2 (b DECIMAL(32,9));
+INSERT INTO t2 VALUES
+(0),
+(0.9),
+(0.999999),
+(0.9999999);
+SELECT a, b, DATE_ADD(a, INTERVAL b SECOND) FROM t1,t2 ORDER BY a,b;
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/gis-rtree.result b/mysql-test/main/gis-rtree.result
index 5d4708dd111..2ef8757339e 100644
--- a/mysql-test/main/gis-rtree.result
+++ b/mysql-test/main/gis-rtree.result
@@ -744,6 +744,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result
index 05e6e41852a..7695cef15c5 100644
--- a/mysql-test/main/gis.result
+++ b/mysql-test/main/gis.result
@@ -1679,7 +1679,7 @@ NULL
#
create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
-ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
+ERROR 22007: Incorrect POINT value: 'POLYGON' for column `test`.`t1`.`pt` at row 1
drop table t1;
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
diff --git a/mysql-test/main/gis2.result b/mysql-test/main/gis2.result
index c0b476e080b..cb919ecdeb1 100644
--- a/mysql-test/main/gis2.result
+++ b/mysql-test/main/gis2.result
@@ -27,12 +27,12 @@ drop table t1;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
set timestamp=10;
insert into t1 values(default);
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
set timestamp=10;
alter table t1 add column i int;
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`(temporary)`.`p` at row 1
drop table t1;
SET timestamp=default;
diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result
index 74f86edd4ea..46d87a4777f 100644
--- a/mysql-test/main/grant.result
+++ b/mysql-test/main/grant.result
@@ -2,6 +2,7 @@ set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
drop table if exists t1;
drop database if exists mysqltest;
connect master,localhost,root,,;
@@ -298,12 +299,7 @@ ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
select 1;
1
1
-insert into mysql.user (host, user) values ('localhost', 'test11');
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
+insert into mysql.global_priv (host, user) values ('localhost', 'test11');
insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
@@ -842,9 +838,6 @@ drop database db27515;
End of 4.1 tests
use test;
create table t1 (a int);
-create table t2 as select * from mysql.user where user='';
-delete from mysql.user where user='';
-flush privileges;
create user mysqltest_8@'';
create user mysqltest_8@host8;
create user mysqltest_8@'';
@@ -854,7 +847,7 @@ ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%'
create user mysqltest_8@host8;
ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'host8'
select user, QUOTE(host) from mysql.user where user="mysqltest_8";
-user QUOTE(host)
+User QUOTE(host)
mysqltest_8 '%'
mysqltest_8 'host8'
Schema privileges
@@ -1044,9 +1037,6 @@ ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%'
drop user mysqltest_8@host8;
show grants for mysqltest_8@host8;
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host 'host8'
-insert into mysql.user select * from t2;
-flush privileges;
-drop table t2;
drop table t1;
connection master;
CREATE DATABASE mysqltest3;
@@ -1453,7 +1443,6 @@ CURRENT_USER()
root@localhost
SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
-update mysql.user set plugin='';
# Bug#57952
@@ -1925,7 +1914,7 @@ DROP DATABASE db2;
grant usage on Foo.* to myuser@Localhost identified by 'foo';
grant select on Foo.* to myuser@localhost;
select host,user from mysql.user where User='myuser';
-host user
+Host User
localhost myuser
revoke select on Foo.* from myuser@localhost;
delete from mysql.user where User='myuser';
@@ -2733,7 +2722,7 @@ DROP USER untrusted@localhost;
DROP DATABASE secret;
set GLOBAL sql_mode=default;
#
-# Start of 10.2 tests
+# End of 10.1 tests
#
#
# MDEV-10134 Add full support for DEFAULT
@@ -2762,3 +2751,24 @@ DROP USER dummy@localhost;
#
# End of 10.2 tests
#
+#
+# MDEV-17932 : Assertion upon double RENAME USER
+#
+CREATE USER foo@localhost;
+CREATE USER bar2@localhost;
+RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost;
+DROP USER bar2@localhost;
+DROP USER bar3@localhost;
+#
+# MDEV-17946 : Unsorted acl_dbs after RENAME USER
+#
+CREATE USER foo;
+GRANT SELECT ON test.* TO foo;
+RENAME USER '' TO 'name';
+GRANT UPDATE ON test.* TO foo;
+RENAME USER 'name' to '';
+DROP USER foo;
+#
+# End of 10.4 tests
+#
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test
index f54c4bd981d..8ae64c9ad4d 100644
--- a/mysql-test/main/grant.test
+++ b/mysql-test/main/grant.test
@@ -10,6 +10,7 @@ set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
# Cleanup
--disable_warnings
@@ -131,7 +132,7 @@ select 1; # To test that the previous command didn't cause problems
#
# Bug#4898 User privileges depending on ORDER BY Settings of table db
#
-insert into mysql.user (host, user) values ('localhost', 'test11');
+insert into mysql.global_priv (host, user) values ('localhost', 'test11');
insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
@@ -581,12 +582,6 @@ drop database db27515;
use test;
create table t1 (a int);
-# Backup anonymous users and remove them. (They get in the way of
-# the one we test with here otherwise.)
-create table t2 as select * from mysql.user where user='';
-delete from mysql.user where user='';
-flush privileges;
-
# Create some users with different hostnames
create user mysqltest_8@'';
create user mysqltest_8@host8;
@@ -700,10 +695,6 @@ drop user mysqltest_8@host8;
--error ER_NONEXISTING_GRANT
show grants for mysqltest_8@host8;
-# Restore the anonymous users.
-insert into mysql.user select * from t2;
-flush privileges;
-drop table t2;
drop table t1;
#
@@ -1265,9 +1256,6 @@ SELECT CURRENT_USER();
SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
-#cleanup after MDEV-16238
-update mysql.user set plugin='';
-
#
# Bug#57952: privilege change is not taken into account by EXECUTE.
#
@@ -2233,7 +2221,7 @@ set GLOBAL sql_mode=default;
--source include/wait_until_count_sessions.inc
--echo #
---echo # Start of 10.2 tests
+--echo # End of 10.1 tests
--echo #
--echo #
@@ -2258,3 +2246,28 @@ DROP USER dummy@localhost;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # MDEV-17932 : Assertion upon double RENAME USER
+--echo #
+CREATE USER foo@localhost;
+CREATE USER bar2@localhost;
+RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost;
+DROP USER bar2@localhost;
+DROP USER bar3@localhost;
+
+--echo #
+--echo # MDEV-17946 : Unsorted acl_dbs after RENAME USER
+--echo #
+CREATE USER foo;
+GRANT SELECT ON test.* TO foo;
+RENAME USER '' TO 'name';
+GRANT UPDATE ON test.* TO foo;
+RENAME USER 'name' to '';
+DROP USER foo;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
+
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
diff --git a/mysql-test/main/grant2.result b/mysql-test/main/grant2.result
index 4fd1a6c3fe7..5d168a04455 100644
--- a/mysql-test/main/grant2.result
+++ b/mysql-test/main/grant2.result
@@ -1,3 +1,4 @@
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET NAMES binary;
@@ -182,10 +183,10 @@ grant insert on test.* to 'mysqltest_2';
grant update on test.t1 to 'mysqltest_2';
grant update (c2) on test.t2 to 'mysqltest_2';
select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%';
-host user password plugin authentication_string
+Host User Password plugin authentication_string
% mysqltest_1 mysql_native_password
-% mysqltest_2 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1
-% mysqltest_3 mysql_native_password fffffffffffffffffffffffffffffffffffffffff
+% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1
+% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff
select host,db,user from mysql.db where user like 'mysqltest_%';
host db user
% test mysqltest_2
@@ -207,9 +208,9 @@ GRANT UPDATE (c2) ON "test"."t2" TO 'mysqltest_2'@'%'
GRANT UPDATE ON "test"."t1" TO 'mysqltest_2'@'%'
drop user 'mysqltest_1';
select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%';
-host user password plugin authentication_string
-% mysqltest_2 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1
-% mysqltest_3 mysql_native_password fffffffffffffffffffffffffffffffffffffffff
+Host User Password plugin authentication_string
+% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1
+% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff
select host,db,user from mysql.db where user like 'mysqltest_%';
host db user
% test mysqltest_2
@@ -224,9 +225,9 @@ show grants for 'mysqltest_1';
ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%'
rename user 'mysqltest_2' to 'mysqltest_1';
select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ;
-host user password plugin authentication_string
-% mysqltest_1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1
-% mysqltest_3 mysql_native_password fffffffffffffffffffffffffffffffffffffffff
+Host User Password plugin authentication_string
+% mysqltest_1 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1
+% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff
select host,db,user from mysql.db where user like 'mysqltest_%' ;
host db user
% test mysqltest_1
@@ -328,12 +329,7 @@ GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
GRANT INSERT, UPDATE, DELETE ON `mysql`.* TO 'mysqltest_3'@'localhost'
select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 'user'
-insert into mysql.user set host='%', user='mysqltest_B';
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
+insert into mysql.global_priv set host='%', user='mysqltest_B';
create user mysqltest_A@'%';
rename user mysqltest_B@'%' to mysqltest_C@'%';
drop user mysqltest_C@'%';
@@ -373,7 +369,7 @@ set password = password('changed');
disconnect b12302;
connection default;
select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1';
-host length(authentication_string)
+Host length(authentication_string)
127.0.0.1 41
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1';
delete from mysql.user where user like 'mysqltest\_1';
@@ -388,7 +384,7 @@ set password = password('changed');
disconnect b12302_2;
connection default;
select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1';
-host length(authentication_string)
+Host length(authentication_string)
127.0.0.0/255.0.0.0 41
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0';
delete from mysql.user where user like 'mysqltest\_1';
@@ -428,15 +424,10 @@ disconnect con2root;
disconnect con3root;
create database TESTDB;
create table t2(a int);
-create temporary table t1 as select * from mysql.user;
-delete from mysql.user where host='localhost';
-INSERT INTO mysql.user (host, user, password) VALUES
-('%','mysqltest_1',password('password'));
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
+create temporary table t1 as select * from mysql.global_priv;
+delete from mysql.global_priv where host='localhost';
+INSERT INTO mysql.global_priv (host, user, priv) VALUES
+('%','mysqltest_1',json_object('authentication_string', password('password')));
INSERT INTO mysql.db (host, db, user, select_priv) VALUES
('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
@@ -445,9 +436,9 @@ create database TEStdb;
Got one of the listed errors
connection default;
disconnect con1;
-delete from mysql.user;
+delete from mysql.global_priv;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
-insert into mysql.user select * from t1;
+insert into mysql.global_priv select * from t1;
drop table t1, t2;
drop database TESTDB;
flush privileges;
@@ -556,25 +547,17 @@ USE mysql;
SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u;
SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h;
SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-user host password plugin authentication_string insert_priv
+User Host Password plugin authentication_string Insert_priv
root localhost Y
-UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
-SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-user host password plugin authentication_string insert_priv
-root localhost N
GRANT INSERT ON *.* TO CURRENT_USER();
SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-user host password plugin authentication_string insert_priv
+User Host Password plugin authentication_string Insert_priv
root localhost mysql_native_password Y
-UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose';
SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-user host password plugin authentication_string insert_priv
-root localhost mysql_native_password *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y
-UPDATE user SET plugin='', authentication_string='' WHERE user=@u AND host=@h;
-SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-user host password plugin authentication_string insert_priv
-root localhost Y
+User Host Password plugin authentication_string Insert_priv
+root localhost *0BB7188CF0DE9B403BA66E9DD810D82652D002EB mysql_native_password *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y
+UPDATE global_priv SET priv=@root_priv;
FLUSH PRIVILEGES;
USE test;
End of 5.1 tests
diff --git a/mysql-test/main/grant2.test b/mysql-test/main/grant2.test
index f0b58da4cb5..b33d7d63992 100644
--- a/mysql-test/main/grant2.test
+++ b/mysql-test/main/grant2.test
@@ -4,7 +4,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
-
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET NAMES binary;
@@ -361,7 +361,7 @@ connection user4;
show grants;
--error ER_TABLEACCESS_DENIED_ERROR
select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ;
-insert into mysql.user set host='%', user='mysqltest_B';
+insert into mysql.global_priv set host='%', user='mysqltest_B';
create user mysqltest_A@'%';
rename user mysqltest_B@'%' to mysqltest_C@'%';
drop user mysqltest_C@'%';
@@ -481,10 +481,10 @@ disconnect con3root;
create database TESTDB;
create table t2(a int);
-create temporary table t1 as select * from mysql.user;
-delete from mysql.user where host='localhost';
-INSERT INTO mysql.user (host, user, password) VALUES
-('%','mysqltest_1',password('password'));
+create temporary table t1 as select * from mysql.global_priv;
+delete from mysql.global_priv where host='localhost';
+INSERT INTO mysql.global_priv (host, user, priv) VALUES
+('%','mysqltest_1',json_object('authentication_string', password('password')));
INSERT INTO mysql.db (host, db, user, select_priv) VALUES
('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
@@ -500,9 +500,9 @@ create database TEStdb;
# Clean-up
connection default;
disconnect con1;
-delete from mysql.user;
+delete from mysql.global_priv;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
-insert into mysql.user select * from t1;
+insert into mysql.global_priv select * from t1;
drop table t1, t2;
drop database TESTDB;
flush privileges;
@@ -661,22 +661,15 @@ SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h;
# show current privs.
SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-# toggle INSERT
-UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
-SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-
# show that GRANT ... TO CURRENT_USER() no longer crashes
GRANT INSERT ON *.* TO CURRENT_USER();
SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
# show that GRANT ... TO CURRENT_USER() IDENTIFIED BY ... works now
GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose';
SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-UPDATE user SET plugin='', authentication_string='' WHERE user=@u AND host=@h;
-SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h;
-
+UPDATE global_priv SET priv=@root_priv;
FLUSH PRIVILEGES;
USE test;
diff --git a/mysql-test/main/grant3.result b/mysql-test/main/grant3.result
index 4c99fb02f19..1bc6e7572c5 100644
--- a/mysql-test/main/grant3.result
+++ b/mysql-test/main/grant3.result
@@ -29,7 +29,7 @@ grant select on test.* to CUser@localhost;
grant select on test.* to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
@@ -37,14 +37,14 @@ CUser localhost test Y
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
@@ -56,7 +56,7 @@ grant select on test.t1 to CUser@localhost;
grant select on test.t1 to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
@@ -64,14 +64,14 @@ CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
@@ -82,7 +82,7 @@ grant select(a) on test.t1 to CUser@localhost;
grant select(a) on test.t1 to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
@@ -90,14 +90,14 @@ CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-user host
+User Host
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
@@ -109,7 +109,7 @@ grant select on test.* to CUser2@localhost;
grant select on test.* to CUser2@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
-user host
+User Host
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
@@ -117,7 +117,7 @@ CUser2 localhost test Y
REVOKE SELECT ON test.* FROM 'CUser2'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
-user host
+User Host
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
@@ -125,7 +125,7 @@ REVOKE SELECT ON test.* FROM 'CUser2'@'localhost';
ERROR 42000: There is no such grant defined for user 'CUser2' on host 'localhost'
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
-user host
+User Host
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
diff --git a/mysql-test/main/grant4.result b/mysql-test/main/grant4.result
index 735b8260fce..9aad70205ec 100644
--- a/mysql-test/main/grant4.result
+++ b/mysql-test/main/grant4.result
@@ -198,15 +198,15 @@ grant select on test.* to foo6 identified by password '2222222222222222';
grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111';
grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222';
select user,password,plugin,authentication_string from mysql.user where user like 'foo%';
-user password plugin authentication_string
-foo1 mysql_native_password 11111111111111111111111111111111111111111
-foo2 mysql_old_password 2222222222222222
-foo3 mysql_native_password 11111111111111111111111111111111111111111
-foo4 mysql_old_password 2222222222222222
-foo5 mysql_native_password 11111111111111111111111111111111111111111
-foo6 mysql_old_password 2222222222222222
-foo7 mysql_native_password 11111111111111111111111111111111111111111
-foo8 mysql_old_password 2222222222222222
+User Password plugin authentication_string
+foo1 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111
+foo2 2222222222222222 mysql_old_password 2222222222222222
+foo3 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111
+foo4 2222222222222222 mysql_old_password 2222222222222222
+foo5 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111
+foo6 2222222222222222 mysql_old_password 2222222222222222
+foo7 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111
+foo8 2222222222222222 mysql_old_password 2222222222222222
drop user foo1;
drop user foo2;
drop user foo3;
diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result
index af7b75277b8..5bf7b2d1934 100644
--- a/mysql-test/main/grant5.result
+++ b/mysql-test/main/grant5.result
@@ -18,6 +18,13 @@ ERROR 42000: Access denied for user 'test'@'%' to database 'mysql'
connection default;
drop user test, foo;
drop role foo;
+CREATE TABLE t1 (a INT);
+LOCK TABLE t1 WRITE;
+REVOKE EXECUTE ON PROCEDURE sp FROM u;
+ERROR HY000: Table 'procs_priv' was not locked with LOCK TABLES
+REVOKE PROCESS ON *.* FROM u;
+ERROR HY000: Table 'db' was not locked with LOCK TABLES
+DROP TABLE t1;
create user u1@h identified with 'mysql_native_password' using 'pwd';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
create user u1@h identified with 'mysql_native_password' using password('pwd');
@@ -38,19 +45,19 @@ ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password for u7@h = old_password('pwd');
create user u8@h identified with 'mysql_old_password';
set password for u8@h = '78a302dd267f6044';
-select user,host,password,plugin,authentication_string from mysql.user where host='h';
-user host password plugin authentication_string
-u1 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
-u2 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
-u3 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
-u4 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
-u5 h mysql_old_password 78a302dd267f6044
-u6 h mysql_old_password 78a302dd267f6044
-u7 h mysql_old_password 78a302dd267f6044
-u8 h mysql_old_password 78a302dd267f6044
-update mysql.user set authentication_string='bad' where user='u1';
-update mysql.user set authentication_string='bad' where user='u5';
-update mysql.user set plugin='nonexistent' where user='u8';
+select user,host,plugin,authentication_string from mysql.user where host='h';
+User Host plugin authentication_string
+u1 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
+u2 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
+u3 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
+u4 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
+u5 h mysql_old_password 78a302dd267f6044
+u6 h mysql_old_password 78a302dd267f6044
+u7 h mysql_old_password 78a302dd267f6044
+u8 h mysql_old_password 78a302dd267f6044
+update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u1';
+update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5';
+update mysql.global_priv set priv=json_set(priv, '$.plugin', 'nonexistent') where user='u8';
flush privileges;
Warnings:
Error 1372 Password hash should be a 41-digit hexadecimal number
@@ -89,7 +96,7 @@ grant select on *.* to u7@h;
grant select on *.* to u8@h;
ERROR 28000: Can't find any matching row in the user table
select user,select_priv,plugin,authentication_string from mysql.user where user like 'u_';
-user select_priv plugin authentication_string
+User Select_priv plugin authentication_string
u1 N mysql_native_password bad
u2 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
u3 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD
diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test
index 1ab68b82066..daf972dbe4b 100644
--- a/mysql-test/main/grant5.test
+++ b/mysql-test/main/grant5.test
@@ -24,6 +24,17 @@ drop user test, foo;
drop role foo;
#
+# MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE
+#
+CREATE TABLE t1 (a INT);
+LOCK TABLE t1 WRITE;
+--error ER_TABLE_NOT_LOCKED
+REVOKE EXECUTE ON PROCEDURE sp FROM u;
+--error ER_TABLE_NOT_LOCKED
+REVOKE PROCESS ON *.* FROM u;
+DROP TABLE t1;
+
+#
# MDEV-12321 authentication plugin: SET PASSWORD support
#
error ER_PASSWD_LENGTH;
@@ -49,11 +60,11 @@ set password for u7@h = old_password('pwd');
create user u8@h identified with 'mysql_old_password';
eval set password for u8@h = '$p';
sorted_result;
-select user,host,password,plugin,authentication_string from mysql.user where host='h';
+select user,host,plugin,authentication_string from mysql.user where host='h';
# test with invalid entries
-update mysql.user set authentication_string='bad' where user='u1';
-update mysql.user set authentication_string='bad' where user='u5';
-update mysql.user set plugin='nonexistent' where user='u8';
+update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u1';
+update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5';
+update mysql.global_priv set priv=json_set(priv, '$.plugin', 'nonexistent') where user='u8';
flush privileges;
# invalid entries are skipped, users don't exist
error ER_PASSWORD_NO_MATCH;
diff --git a/mysql-test/main/grant_4332.result b/mysql-test/main/grant_4332.result
index b62ca1a20cc..af6b23088f5 100644
--- a/mysql-test/main/grant_4332.result
+++ b/mysql-test/main/grant_4332.result
@@ -1,5 +1,5 @@
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
+set global sql_mode="";
+set local sql_mode="";
alter table mysql.user modify User char(16) binary not null default '';
alter table mysql.db modify User char(16) binary not null default '';
alter table mysql.tables_priv modify User char(16) binary not null default '';
@@ -32,4 +32,4 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def user() 253 141 14 N 1 39 8
user()
root@localhost
-set GLOBAL sql_mode=default;
+set global sql_mode=default;
diff --git a/mysql-test/main/grant_4332.test b/mysql-test/main/grant_4332.test
index 41e0b822f98..f723e4afe44 100644
--- a/mysql-test/main/grant_4332.test
+++ b/mysql-test/main/grant_4332.test
@@ -6,8 +6,9 @@
#
--source include/not_embedded.inc
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
+--source include/switch_to_mysql_user.inc
+set global sql_mode="";
+set local sql_mode="";
alter table mysql.user modify User char(16) binary not null default '';
alter table mysql.db modify User char(16) binary not null default '';
@@ -42,4 +43,5 @@ flush privileges;
select user();
--disable_metadata
-set GLOBAL sql_mode=default;
+set global sql_mode=default;
+--source include/switch_to_mysql_global_priv.inc
diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result
index 5cf79b0de4e..a6878e8c3a1 100644
--- a/mysql-test/main/group_by.result
+++ b/mysql-test/main/group_by.result
@@ -536,17 +536,17 @@ a b
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
a b
1 3
+1 1
3 1
2 2
-1 1
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-1 SIMPLE t2 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
-1 SIMPLE t2 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (1, 4),(10, 40),(1, 4),(10, 43),(1, 4),(10, 41),(1, 4),(10, 43),(1, 4);
@@ -1330,6 +1330,7 @@ INSERT INTO t1 SELECT a + 64,b FROM t1;
INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT a FROM t1 WHERE a < 2;
id select_type table type possible_keys key key_len ref rows Extra
@@ -2753,6 +2754,7 @@ create table t2 (c int, col1 int, key(c));
insert into t2 select t1.a, 100000 from t1;
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
explain
select
@@ -2836,6 +2838,16 @@ select distinct 1 from t1 group by a,b with rollup limit 1;
1
1
drop table t1;
+CREATE TABLE t1 ( pk int, i1 int, v1 varchar(1));
+explain
+SELECT 1 FROM t1
+GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+SELECT 1 FROM t1
+GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
+1
+drop table t1;
#
# MDEV-16170
# Server crashes in Item_null_result::type_handler on SELECT with ROLLUP
diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test
index c14023f817a..6686166e00e 100644
--- a/mysql-test/main/group_by.test
+++ b/mysql-test/main/group_by.test
@@ -1950,6 +1950,19 @@ insert into t1 values(-126,7),(1,1),(0,0),(-1,1),(351,65534);
select distinct 1 from t1 group by a,b with rollup limit 1;
drop table t1;
+#
+# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
+# or Invalid write in JOIN::make_aggr_tables_info
+#
+
+CREATE TABLE t1 ( pk int, i1 int, v1 varchar(1));
+explain
+SELECT 1 FROM t1
+GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
+SELECT 1 FROM t1
+GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
+drop table t1;
+
--echo #
--echo # MDEV-16170
--echo # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP
diff --git a/mysql-test/main/group_by_innodb.result b/mysql-test/main/group_by_innodb.result
index 034866b63d5..f935d4da45b 100644
--- a/mysql-test/main/group_by_innodb.result
+++ b/mysql-test/main/group_by_innodb.result
@@ -151,6 +151,7 @@ KEY idx3 (a, b)
INSERT INTO t1 (a, b) SELECT t01.a, t02.a FROM t0 t01, t0 t02;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result
index 4667c4b6daa..7a49dbdf3f8 100644
--- a/mysql-test/main/group_min_max.result
+++ b/mysql-test/main/group_min_max.result
@@ -40,6 +40,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c);
create index idx_t1_2 on t1 (a1,a2,b);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
drop table if exists t2;
create table t2 (
@@ -68,6 +69,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c);
create index idx_t2_2 on t2 (a1,a2,b);
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
drop table if exists t3;
create table t3 (
@@ -130,6 +132,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c);
create index idx_t3_2 on t3 (a1,a2,b);
analyze table t3;
Table Op Msg_type Msg_text
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
explain select a1, min(a2) from t1 group by a1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -684,10 +687,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by
+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by
explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by
+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by
@@ -804,10 +807,10 @@ b h212 e212
c h312 e312
explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by
+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by
explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL idx_t2_1 146 NULL 5 Using where; Using index for group-by
+1 SIMPLE t2 range NULL idx_t2_1 146 NULL 6 Using where; Using index for group-by
explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
@@ -1662,7 +1665,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
explain select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL idx_t2_1 163 NULL # Using where; Using index
+1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
explain select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
@@ -1713,7 +1716,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index
+1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 0.39 Using where; Using index
Warnings:
Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 'a' and `test`.`t1`.`c` = 'i121' and `test`.`t1`.`a2` >= 'b'
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
@@ -1730,7 +1733,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index
+1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 0.28 Using where; Using index
Warnings:
Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`b` = 'a' and `test`.`t2`.`c` = 'i121' and `test`.`t2`.`a2` >= 'b'
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
@@ -1876,7 +1879,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL idx_t2_1 163 NULL # Using where; Using index
+1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
@@ -2075,19 +2078,19 @@ id select_type table type possible_keys key key_len ref rows Extra
explain extended select a1,a2,min(b),max(b) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 85.71 Using where; Using index
+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
explain extended select a1,a2,b,min(c),max(c) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 51.56 Using where; Using temporary; Using filesort
+1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 40.10 Using where; Using temporary; Using filesort
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain extended select a1,a2,b,c from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 51.56 Using where; Using temporary; Using filesort
+1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 40.10 Using where; Using temporary; Using filesort
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
@@ -2095,7 +2098,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 85.71 Using where; Using index
+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
@@ -2286,6 +2289,7 @@ INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
@@ -2353,6 +2357,7 @@ INSERT INTO t1 VALUES
(1,-1),(1,-2),(1,-3),(1,-4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
@@ -2377,10 +2382,11 @@ INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL a 5 NULL 4 Using index for group-by
+1 SIMPLE t1 index NULL a 10 NULL 15 Using index
FLUSH STATUS;
SELECT max(b), a FROM t1 GROUP BY a;
max(b) a
@@ -2390,18 +2396,18 @@ max(b) a
6 4
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 8
-Handler_read_next 0
+Handler_read_key 0
+Handler_read_next 15
Handler_read_retry 0
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL a 5 NULL 4 Using index for group-by
+1 SIMPLE t1 index NULL a 10 NULL 15 Using index
FLUSH STATUS;
CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 8
-Handler_read_next 0
+Handler_read_key 0
+Handler_read_next 15
Handler_read_retry 0
FLUSH STATUS;
SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b;
@@ -2412,8 +2418,8 @@ max(b) a
6 4
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 8
-Handler_read_next 0
+Handler_read_key 0
+Handler_read_next 15
Handler_read_retry 0
FLUSH STATUS;
(SELECT max(b), a FROM t1 GROUP BY a) UNION
@@ -2425,20 +2431,20 @@ max(b) a
6 4
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 16
-Handler_read_next 0
+Handler_read_key 0
+Handler_read_next 30
Handler_read_retry 0
EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION
(SELECT max(b), a FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 range NULL a 5 NULL 4 Using index for group-by
-2 UNION t1 range NULL a 5 NULL 4 Using index for group-by
+1 PRIMARY t1 index NULL a 10 NULL 15 Using index
+2 UNION t1 index NULL a 10 NULL 15 Using index
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
-2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
@@ -2448,38 +2454,38 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 4
-1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 4 Using index
-2 MATERIALIZED t1 range NULL a 5 NULL 4 Using index for group-by
+1 PRIMARY t1_outer index a a 10 NULL 15 Using where; Using index
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1_outer.a 1
+2 MATERIALIZED t1 index NULL a 10 NULL 15 Using index
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1_outer range NULL a 5 NULL 4 Using index for group-by
-2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by
+1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
AND t1_outer1.b = t1_outer2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join)
-2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index
2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index
-3 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by
+3 SUBQUERY t1 index NULL a 10 NULL 15 Using index
CREATE TABLE t3 LIKE t1;
FLUSH STATUS;
INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 8
-Handler_read_next 0
+Handler_read_key 5
+Handler_read_next 15
Handler_read_retry 0
DELETE FROM t3;
FLUSH STATUS;
@@ -2487,15 +2493,15 @@ INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2)
FROM t1 LIMIT 1;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 8
-Handler_read_next 0
+Handler_read_key 0
+Handler_read_next 15
Handler_read_retry 0
FLUSH STATUS;
DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 8
-Handler_read_next 0
+Handler_read_key 0
+Handler_read_next 15
Handler_read_retry 0
FLUSH STATUS;
DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
@@ -2503,8 +2509,8 @@ FROM t1) > 10000;
ERROR 21000: Subquery returns more than 1 row
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
-Handler_read_key 8
-Handler_read_next 1
+Handler_read_key 0
+Handler_read_next 16
Handler_read_retry 0
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a int, INDEX idx(a));
@@ -2513,6 +2519,7 @@ INSERT INTO t1 VALUES
(4), (2), (1), (2), (2), (4), (1), (4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT DISTINCT(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -2537,6 +2544,7 @@ INSERT INTO t1 SELECT a + 1, b FROM t1;
INSERT INTO t1 SELECT a + 2, b FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN
SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
@@ -2666,6 +2674,7 @@ INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
id select_type table type possible_keys key key_len ref rows Extra
@@ -2685,6 +2694,7 @@ INSERT INTO t SELECT * FROM t;
INSERT INTO t SELECT * FROM t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
# test MIN
#should use range with index for group by
@@ -2712,7 +2722,7 @@ INSERT INTO t SELECT a, 2 FROM t;
EXPLAIN
SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t range NULL a 10 NULL 3 Using where; Using index for group-by
+1 SIMPLE t range NULL a 10 NULL 2 Using where; Using index for group-by
#should return 1 row
SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a;
a MAX(b)
@@ -2745,6 +2755,7 @@ CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b));
INSERT INTO t1 VALUES(1,1),(2,1);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b;
c b
@@ -3323,7 +3334,9 @@ CREATE TABLE t2 (c int) ;
INSERT INTO t2 VALUES (0),(1);
ANALYZE TABLE t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN
SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
@@ -3377,7 +3390,9 @@ INSERT INTO t2 SELECT a, b + 4, c,d,e,f FROM t2;
INSERT INTO t2 SELECT a + 1, b, c,d,e,f FROM t2;
ANALYZE TABLE t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN SELECT COUNT(DISTINCT a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -3658,6 +3673,7 @@ CREATE TABLE t (a INT, b INT, KEY(a,b));
INSERT INTO t VALUES (1,1), (2,2), (3,3), (4,4), (1,0), (3,2), (4,5);
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a;
a SUM(DISTINCT a) MIN(b)
@@ -3736,6 +3752,7 @@ INSERT INTO t1 SELECT a + 1, b FROM t1;
INSERT INTO t1 SELECT a + 2, b FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE INDEX break_it ON t1 (a, b);
EXPLAIN
@@ -3795,6 +3812,7 @@ INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
INSERT INTO t1 SELECT * FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
set @save_use_stat_tables= @@use_stat_tables;
@@ -3802,18 +3820,18 @@ set @@optimizer_use_condition_selectivity=4;
set @@use_stat_tables=PREFERABLY;
explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 4 100.00
-1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 8 100.00 Using index
-2 MATERIALIZED t1 range NULL a 5 NULL 4 100.00 Using index for group-by
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 100.00
+1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 7 100.00 Using index
+2 MATERIALIZED t1 range NULL a 5 NULL 5 100.00 Using index for group-by
Warnings:
Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from <materialize> (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @@use_stat_tables=@save_use_stat_tables;
explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 4 100.00
-1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 8 100.00 Using index
-2 MATERIALIZED t1 range NULL a 5 NULL 4 100.00 Using index for group-by
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 100.00
+1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 7 100.00 Using index
+2 MATERIALIZED t1 range NULL a 5 NULL 5 100.00 Using index for group-by
Warnings:
Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from <materialize> (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`
drop table t1;
@@ -3845,6 +3863,7 @@ INSERT INTO t1 VALUES (4,'2001-01-03');
INSERT INTO t1 VALUES (4,'2001-01-04');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id;
id select_type table type possible_keys key key_len ref rows Extra
@@ -3899,6 +3918,7 @@ INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
id MIN(a) MAX(a)
diff --git a/mysql-test/main/group_min_max_innodb.result b/mysql-test/main/group_min_max_innodb.result
index ed90c137b33..3586ad5237f 100644
--- a/mysql-test/main/group_min_max_innodb.result
+++ b/mysql-test/main/group_min_max_innodb.result
@@ -46,6 +46,7 @@ create index idx12672_1 on t4 (a1,a2,b,c);
create index idx12672_2 on t4 (a1,a2,b);
analyze table t4;
Table Op Msg_type Msg_text
+test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
select distinct a1 from t4 where pk_col not in (1,2,3,4);
a1
diff --git a/mysql-test/main/handlersocket.result b/mysql-test/main/handlersocket.result
index 1b3fc573548..8ef9b289cd0 100644
--- a/mysql-test/main/handlersocket.result
+++ b/mysql-test/main/handlersocket.result
@@ -5,7 +5,7 @@ plugin_version 1.0
plugin_status ACTIVE
plugin_type DAEMON
plugin_library handlersocket.so
-plugin_library_version 1.13
+plugin_library_version 1.14
plugin_author higuchi dot akira at dena dot jp
plugin_description Direct access into InnoDB
plugin_license BSD
diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result
index f37cc48772e..a220068bc38 100644
--- a/mysql-test/main/having.result
+++ b/mysql-test/main/having.result
@@ -835,6 +835,7 @@ INSERT INTO t1 VALUES(10, 10), (11, 11), (12, 12), (12, 13),(14, 15), (15, 16),
(16, 17), (17, 17);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t)
GROUP BY t HAVING r = 1 ORDER BY t1.u;
diff --git a/mysql-test/main/huge_frm-6224.result b/mysql-test/main/huge_frm-6224.result
index 3772317c04d..bbb650bc5b4 100644
--- a/mysql-test/main/huge_frm-6224.result
+++ b/mysql-test/main/huge_frm-6224.result
@@ -1 +1,6 @@
+set global max_allowed_packet=1024*1024*10;
+connect con1,localhost,root;
ERROR HY000: The definition for table `t1` is too big
+connection default;
+disconnect con1;
+set global max_allowed_packet=default;
diff --git a/mysql-test/main/huge_frm-6224.test b/mysql-test/main/huge_frm-6224.test
index 418722a7b51..322abd01738 100644
--- a/mysql-test/main/huge_frm-6224.test
+++ b/mysql-test/main/huge_frm-6224.test
@@ -4,17 +4,24 @@
# verify that huge frms are rejected during creation, not on opening
#
--source include/have_partition.inc
+set global max_allowed_packet=1024*1024*10;
+connect con1,localhost,root;
-let $n=5646;
+let $n=8164;
let $a=create table t1 (a int) engine=myisam partition by hash(a) partitions $n (;
dec $n;
while ($n)
{
- let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n,;
+ let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n COMMENT 'partition p01234567890123456789012345678901234567890123456789012345678$n',;
dec $n;
}
--disable_query_log
--error ER_TABLE_DEFINITION_TOO_BIG
eval $a partition foo);
+--enable_query_log
+
+connection default;
+disconnect con1;
+set global max_allowed_packet=default;
diff --git a/mysql-test/main/index_merge_innodb.result b/mysql-test/main/index_merge_innodb.result
index 26b51ba444b..1562fa84c34 100644
--- a/mysql-test/main/index_merge_innodb.result
+++ b/mysql-test/main/index_merge_innodb.result
@@ -107,6 +107,7 @@ insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select count(*) from t1;
count(*)
@@ -314,6 +315,7 @@ alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
id select_type table type possible_keys key key_len ref rows Extra
@@ -700,8 +702,8 @@ SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX(primary,idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6145
-2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6145 Using sort_union(idx,PRIMARY); Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL #
+2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL # Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX(primary,idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
diff --git a/mysql-test/main/index_merge_innodb.test b/mysql-test/main/index_merge_innodb.test
index e8dc8378ffe..2581cccced0 100644
--- a/mysql-test/main/index_merge_innodb.test
+++ b/mysql-test/main/index_merge_innodb.test
@@ -73,6 +73,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off';
# We have to use FORCE INDEX here as Innodb gives inconsistent estimates
# which causes different query plans.
+--replace_column 9 #
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX(primary,idx)
diff --git a/mysql-test/main/index_merge_myisam.result b/mysql-test/main/index_merge_myisam.result
index 8e83bdf6bbb..77d6ae22aa4 100644
--- a/mysql-test/main/index_merge_myisam.result
+++ b/mysql-test/main/index_merge_myisam.result
@@ -19,6 +19,7 @@ alter table t0 add key8 int not null, add index i8(key8);
update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1;
analyze table t0;
Table Op Msg_type Msg_text
+test.t0 analyze status Engine-independent statistics collected
test.t0 analyze status OK
explain select * from t0 where key1 < 3 or key1 > 920 and key1 < 924;
id select_type table type possible_keys key key_len ref rows Extra
@@ -950,6 +951,7 @@ insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select count(*) from t1;
count(*)
@@ -1157,6 +1159,7 @@ alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
id select_type table type possible_keys key key_len ref rows Extra
@@ -1751,6 +1754,7 @@ alter table t0 add key8 int not null, add index i8(key8);
update t0 set key2=key1,key3=key1,key8=1024-key1;
analyze table t0;
Table Op Msg_type Msg_text
+test.t0 analyze status Engine-independent statistics collected
test.t0 analyze status OK
set @optimizer_switch_save=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result
index b6e331a0382..b76d9f64a9f 100644
--- a/mysql-test/main/information_schema.result
+++ b/mysql-test/main/information_schema.result
@@ -96,6 +96,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
@@ -563,6 +564,7 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
select * from information_schema.views;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM
+def mysql user select `mysql`.`global_priv`.`Host` AS `Host`,`mysql`.`global_priv`.`User` AS `User`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,'N' AS `password_expired`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `mysql`.`global_priv` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
def test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
def test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
def test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
@@ -593,6 +595,7 @@ information_schema.tables;
s1
10
11
+NULL
drop table t1;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
@@ -664,7 +667,7 @@ proc body longblob
proc definer char(141)
proc created timestamp
proc modified timestamp
-proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT')
+proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL')
proc comment text
proc character_set_client char(32)
proc collation_connection char(32)
@@ -824,7 +827,7 @@ NULL
select table_type from information_schema.tables
where table_schema="mysql" and table_name="user";
table_type
-BASE TABLE
+VIEW
show open tables where `table` like "user";
Database Table In_use Name_locked
mysql user 0 0
@@ -874,6 +877,14 @@ information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST
information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT
information_schema VIEWS VIEW_DEFINITION
+mysql global_priv Priv
+mysql user Password
+mysql user ssl_cipher
+mysql user x509_issuer
+mysql user x509_subject
+mysql user plugin
+mysql user authentication_string
+mysql user default_role
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime' and table_name not like 'innodb_%'
order by binary table_name, ordinal_position;
@@ -1253,7 +1264,7 @@ CREATE VIEW v1 AS SELECT 1 FROM t1
WHERE f3 = (SELECT func2 ());
SELECT func1();
func1()
-1
+2
DROP TABLE t1;
DROP VIEW v1;
DROP FUNCTION func1;
@@ -1404,6 +1415,7 @@ create table t2 (f1 int, f2 int);
create view v2 as select f1+1 as a, f2 as b from t2;
select table_name, is_updatable from information_schema.views order by table_name;
table_name is_updatable
+user YES
v1 NO
v2 YES
delete from v1;
@@ -1957,8 +1969,9 @@ lock table t1 read;
connect con1, localhost, root,,;
connection con1;
flush tables;
+flush tables t1;
connection default;
-select * from information_schema.views;
+select * from information_schema.views where table_schema='test';
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME v1
diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test
index 1f72d0b6129..95b6f253058 100644
--- a/mysql-test/main/information_schema.test
+++ b/mysql-test/main/information_schema.test
@@ -8,6 +8,10 @@
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
+# Without aria_used_for_temp_tables some I_S tables will be MyISAM,
+# while the test expects them to be Aria
+-- source include/have_aria_used_for_temp_tables.inc
+
-- source include/have_innodb.inc
# Save the initial number of concurrent sessions
@@ -1618,15 +1622,16 @@ alter table t1 change b c int;
lock table t1 read;
connect(con1, localhost, root,,);
connection con1;
-send flush tables;
+flush tables;
+send flush tables t1;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables";
+ where state = "Waiting for table metadata lock" and
+ info = "flush tables t1";
--source include/wait_condition.inc
--vertical_results
-select * from information_schema.views;
+select * from information_schema.views where table_schema='test';
--horizontal_results
unlock tables;
diff --git a/mysql-test/main/information_schema_all_engines.result b/mysql-test/main/information_schema_all_engines.result
index 0ce9f15f753..2916858b5a6 100644
--- a/mysql-test/main/information_schema_all_engines.result
+++ b/mysql-test/main/information_schema_all_engines.result
@@ -460,4 +460,4 @@ Wildcard: inf_rmation_schema
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 65
-mysql 30
+mysql 31
diff --git a/mysql-test/main/init_file_set_password-7656.result b/mysql-test/main/init_file_set_password-7656.result
index 99a16a395d7..fba65b036fd 100644
--- a/mysql-test/main/init_file_set_password-7656.result
+++ b/mysql-test/main/init_file_set_password-7656.result
@@ -1,8 +1,8 @@
create user foo@localhost;
select user,host,password from mysql.user where user='foo';
-user host password
+User Host Password
foo localhost
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
-user host password plugin authentication_string
-foo localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
+User Host Password plugin authentication_string
+foo localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
drop user foo@localhost;
diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result
index 3339e00e7bf..b6fd9b040f1 100644
--- a/mysql-test/main/innodb_ext_key.result
+++ b/mysql-test/main/innodb_ext_key.result
@@ -877,7 +877,9 @@ alter table t3 add primary key (pk1, pk2);
alter table t3 add key (col1, col2);
analyze table t1,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
set optimizer_switch='extended_keys=off';
explain
@@ -1098,6 +1100,7 @@ from
t0 A, t0 B, t0 C;
drop table t0,t1;
#
+#
# MDEV-10360: Extended keys: index properties depend on index order
#
create table t0 (a int);
@@ -1180,7 +1183,7 @@ EXPLAIN
"key_length": "3070",
"used_key_parts": ["f2", "pk1"],
"rows": 1,
- "filtered": 100,
+ "filtered": 50,
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
"attached_condition": "t1.f1 <= '3'"
}
@@ -1210,7 +1213,7 @@ EXPLAIN
"key_length": "3011",
"used_key_parts": ["pk1", "f2", "pk2"],
"rows": 1,
- "filtered": 100,
+ "filtered": 50,
"index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
"attached_condition": "t1.f1 <= '3'"
}
diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test
index 9ec9f569210..333214ed0be 100644
--- a/mysql-test/main/innodb_ext_key.test
+++ b/mysql-test/main/innodb_ext_key.test
@@ -735,6 +735,7 @@ if ($rows < 2)
drop table t0,t1;
--echo #
+--echo #
--echo # MDEV-10360: Extended keys: index properties depend on index order
--echo #
create table t0 (a int);
diff --git a/mysql-test/main/innodb_icp.result b/mysql-test/main/innodb_icp.result
index c65e4d1f7f2..07d317925cd 100644
--- a/mysql-test/main/innodb_icp.result
+++ b/mysql-test/main/innodb_icp.result
@@ -597,7 +597,9 @@ PRIMARY KEY (pk)
INSERT INTO t2 VALUES (4,1);
ANALYZE TABLE t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
@@ -806,7 +808,9 @@ INSERT INTO t2 (g,h) VALUES
(7,'f'),(5,'j'),(3,'e'),(1,'u'),(4,'v'),(9,'u');
ANALYZE TABLE t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SET @save_optimize_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on';
@@ -817,7 +821,7 @@ AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b)
OR a = 0 AND h < 'z' );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where
-1 PRIMARY t2 ref g g 5 test.t.c 9 Using where
+1 PRIMARY t2 ref g g 5 test.t.c 18 Using where
2 DEPENDENT SUBQUERY t1 index PRIMARY d 3 NULL 64 Using where; Using index
2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where
SELECT COUNT(*) FROM t1 AS t, t2
@@ -864,7 +868,7 @@ DROP TABLE t1;
create table t1 (a int,b char(5),primary key (a), key (b(1)));
insert ignore into t1 values ('a','b');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`a` at row 1
select 1 from t1 where a and b >= 'aa';
1
drop table t1;
diff --git a/mysql-test/main/innodb_mysql_sync.result b/mysql-test/main/innodb_mysql_sync.result
index a8a264d6580..3f284edde86 100644
--- a/mysql-test/main/innodb_mysql_sync.result
+++ b/mysql-test/main/innodb_mysql_sync.result
@@ -489,7 +489,9 @@ DROP TABLE t1;
SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded';
#Setup a table with FULLTEXT index.
connection default;
-CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1)) ENGINE= INNODB;
+CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1), FULLTEXT(fld1)) ENGINE= INNODB;
+Warnings:
+Note 1831 Duplicate index `fld1_2`. This is deprecated and will be disallowed in a future release
INSERT INTO t1 VALUES("String1");
#OPTIMIZE TABLE operation.
OPTIMIZE TABLE t1;
diff --git a/mysql-test/main/innodb_mysql_sync.test b/mysql-test/main/innodb_mysql_sync.test
index 66935f811d7..4026080c4b4 100644
--- a/mysql-test/main/innodb_mysql_sync.test
+++ b/mysql-test/main/innodb_mysql_sync.test
@@ -650,7 +650,7 @@ SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded';
--echo #Setup a table with FULLTEXT index.
--connection default
-CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1)) ENGINE= INNODB;
+CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1), FULLTEXT(fld1)) ENGINE= INNODB;
INSERT INTO t1 VALUES("String1");
--echo #OPTIMIZE TABLE operation.
diff --git a/mysql-test/main/insert.result b/mysql-test/main/insert.result
index 736aa917cae..4aea81262d2 100644
--- a/mysql-test/main/insert.result
+++ b/mysql-test/main/insert.result
@@ -92,14 +92,14 @@ create table t1(number int auto_increment primary key, original_value varchar(50
set @value= "aa";
insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1366 Incorrect double value: 'aa' for column 'f_double' at row 1
-Warning 1366 Incorrect double value: 'aa' for column 'f_float' at row 1
-Warning 1366 Incorrect double value: 'aa' for column 'f_double_7_2' at row 1
-Warning 1366 Incorrect double value: 'aa' for column 'f_float_4_3' at row 1
-Warning 1366 Incorrect double value: 'aa' for column 'f_double_u' at row 1
-Warning 1366 Incorrect double value: 'aa' for column 'f_float_u' at row 1
-Warning 1366 Incorrect double value: 'aa' for column 'f_double_15_1_u' at row 1
-Warning 1366 Incorrect double value: 'aa' for column 'f_float_3_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double` at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float` at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double_7_2` at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float_4_3` at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double_u` at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float_u` at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double_15_1_u` at row 1
+Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float_3_1_u` at row 1
select * from t1 where number =last_insert_id();
number 1
original_value aa
@@ -136,14 +136,14 @@ f_float_3_1_u 1.0
set @value= "aa1";
insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1366 Incorrect double value: 'aa1' for column 'f_double' at row 1
-Warning 1366 Incorrect double value: 'aa1' for column 'f_float' at row 1
-Warning 1366 Incorrect double value: 'aa1' for column 'f_double_7_2' at row 1
-Warning 1366 Incorrect double value: 'aa1' for column 'f_float_4_3' at row 1
-Warning 1366 Incorrect double value: 'aa1' for column 'f_double_u' at row 1
-Warning 1366 Incorrect double value: 'aa1' for column 'f_float_u' at row 1
-Warning 1366 Incorrect double value: 'aa1' for column 'f_double_15_1_u' at row 1
-Warning 1366 Incorrect double value: 'aa1' for column 'f_float_3_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double` at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float` at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double_7_2` at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float_4_3` at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double_u` at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float_u` at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double_15_1_u` at row 1
+Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float_3_1_u` at row 1
select * from t1 where number =last_insert_id();
number 3
original_value aa1
diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result
index 8090258c081..36e62645ef2 100644
--- a/mysql-test/main/invisible_field.result
+++ b/mysql-test/main/invisible_field.result
@@ -404,8 +404,8 @@ b int(11) YES NULL
c int(11) YES NULL
explain select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 10
-1 SIMPLE t1 ALL b,c NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL b,c NULL NULL NULL 10
+1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
a a b c
1 1 1 1
diff --git a/mysql-test/main/invisible_field_debug.result b/mysql-test/main/invisible_field_debug.result
index 64f1d7f720e..32eb3a274d8 100644
--- a/mysql-test/main/invisible_field_debug.result
+++ b/mysql-test/main/invisible_field_debug.result
@@ -17,6 +17,8 @@ a invisible
1 9
insert into t1(a, invisible) values(99,99);
ERROR 42S22: Unknown column 'invisible' in 'field list'
+select default(invisible) from t1;
+ERROR 42S22: Unknown column 'invisible' in 'field list'
insert into t1(invisible) values(99);
ERROR 42S22: Unknown column 'invisible' in 'field list'
insert into t_tmp select a, invisible from t1;
diff --git a/mysql-test/main/invisible_field_debug.test b/mysql-test/main/invisible_field_debug.test
index 48cccb1d2cc..77e65cf7a6b 100644
--- a/mysql-test/main/invisible_field_debug.test
+++ b/mysql-test/main/invisible_field_debug.test
@@ -13,6 +13,8 @@ select a , invisible from t1;
--error ER_BAD_FIELD_ERROR
insert into t1(a, invisible) values(99,99);
--error ER_BAD_FIELD_ERROR
+select default(invisible) from t1;
+--error ER_BAD_FIELD_ERROR
insert into t1(invisible) values(99);
insert into t_tmp select a, invisible from t1;
--error ER_WRONG_VALUE_COUNT_ON_ROW
diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result
index 0a0afe6c71d..57ed343ca7b 100644
--- a/mysql-test/main/join.result
+++ b/mysql-test/main/join.result
@@ -260,8 +260,8 @@ PRIMARY KEY (id)
INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5');
select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2;
t1_id t2_id type cost_unit min_value max_value t3_id item_id id name
-22 1 Percent Cost 100 -1 6 291 1 s1
-23 1 Percent Cost 100 -1 21 291 1 s1
+12 5 Percent Cost -1 0 -1 -1 5 s5
+14 4 Percent Cost -1 0 -1 -1 4 s4
drop table t1,t2;
CREATE TABLE t1 (
siteid varchar(25) NOT NULL default '',
@@ -755,10 +755,10 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause'
select
statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT,
columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT
-from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user';
+from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='global_priv';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA COLUMN_COMMENT
-user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql '' NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
-user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql '' NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI
+global_priv Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql '' NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
+global_priv User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql '' NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test
index ffb997260cd..6b0481d859b 100644
--- a/mysql-test/main/join.test
+++ b/mysql-test/main/join.test
@@ -555,7 +555,7 @@ select * from v1a join v1b on t1.b = t2.b;
select
statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT,
columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT
- from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user';
+ from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='global_priv';
drop table t1;
drop table t2;
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index d079cc8ba3a..681d6f1fca2 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -84,9 +84,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join)
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -162,9 +162,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
-1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (incremental, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -241,8 +241,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
-1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -319,8 +319,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
-1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (incremental, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -502,9 +502,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -580,9 +580,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (incremental, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -658,9 +658,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
-1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE Country hash_ALL NULL #hash#$hj 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -736,9 +736,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
-1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE Country hash_ALL NULL #hash#$hj 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -853,9 +853,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1053,9 +1053,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1283,7 +1283,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -1312,9 +1312,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1323,41 +1323,41 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
-La Matanza Argentina Spanish
Lomas de Zamora Argentina Spanish
+La Matanza Argentina Spanish
Lauro de Freitas Brazil Portuguese
Los Angeles Chile Spanish
Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
Lleida (Lérida) Spain Spanish
+L´Hospitalet de Llobregat Spain Spanish
Liupanshui China Chinese
-Lianyungang China Chinese
Liangcheng China Chinese
+Lianyungang China Chinese
Lengshuijiang China Chinese
Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
Las Margaritas Mexico Spanish
Lashio (Lasho) Myanmar Burmese
Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
Leverkusen Germany German
+Ludwigshafen am Rhein Germany German
Luchou Taiwan Min
Lungtan Taiwan Min
Lower Hutt New Zealand English
Los Teques Venezuela Spanish
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
Long Beach United States English
Lexington-Fayette United States English
Louisville United States English
Little Rock United States English
+Los Angeles United States English
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -1480,7 +1480,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -1509,9 +1509,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1520,41 +1520,41 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
-La Matanza Argentina Spanish
Lomas de Zamora Argentina Spanish
+La Matanza Argentina Spanish
Lauro de Freitas Brazil Portuguese
Los Angeles Chile Spanish
Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
Lleida (Lérida) Spain Spanish
+L´Hospitalet de Llobregat Spain Spanish
Liupanshui China Chinese
-Lianyungang China Chinese
Liangcheng China Chinese
Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
-Lagos de Moreno Mexico Spanish
+Lianyungang China Chinese
Las Margaritas Mexico Spanish
+Lagos de Moreno Mexico Spanish
+Lázaro Cárdenas Mexico Spanish
Lashio (Lasho) Myanmar Burmese
Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
Leverkusen Germany German
+Ludwigshafen am Rhein Germany German
Luchou Taiwan Min
Lungtan Taiwan Min
Lower Hutt New Zealand English
Los Teques Venezuela Spanish
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
-Lexington-Fayette United States English
-Louisville United States English
Little Rock United States English
+Louisville United States English
+Lexington-Fayette United States English
+Long Beach United States English
+Los Angeles United States English
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -1677,7 +1677,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -1706,9 +1706,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1721,37 +1721,37 @@ La Matanza Argentina Spanish
Lomas de Zamora Argentina Spanish
Lauro de Freitas Brazil Portuguese
Los Angeles Chile Spanish
+Lleida (Lérida) Spain Spanish
Las Palmas de Gran Canaria Spain Spanish
L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
Lianyungang China Chinese
Liangcheng China Chinese
Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
+Liupanshui China Chinese
Lagos de Moreno Mexico Spanish
Las Margaritas Mexico Spanish
+Lázaro Cárdenas Mexico Spanish
Lashio (Lasho) Myanmar Burmese
Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
Leverkusen Germany German
+Ludwigshafen am Rhein Germany German
Luchou Taiwan Min
Lungtan Taiwan Min
Lower Hutt New Zealand English
Los Teques Venezuela Spanish
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
Lexington-Fayette United States English
Louisville United States English
+Los Angeles United States English
Little Rock United States English
+Long Beach United States English
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -1874,7 +1874,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -1903,9 +1903,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1918,28 +1918,28 @@ La Matanza Argentina Spanish
Lomas de Zamora Argentina Spanish
Lauro de Freitas Brazil Portuguese
Los Angeles Chile Spanish
+Lleida (Lérida) Spain Spanish
Las Palmas de Gran Canaria Spain Spanish
L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
Lianyungang China Chinese
Liangcheng China Chinese
Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
+Liupanshui China Chinese
Lagos de Moreno Mexico Spanish
+Lázaro Cárdenas Mexico Spanish
Las Margaritas Mexico Spanish
Lashio (Lasho) Myanmar Burmese
Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
Leverkusen Germany German
+Ludwigshafen am Rhein Germany German
Luchou Taiwan Min
Lungtan Taiwan Min
Lower Hutt New Zealand English
Los Teques Venezuela Spanish
Leninsk-Kuznetski Russian Federation Russian
+Lexington-Fayette United States English
Los Angeles United States English
Long Beach United States English
-Lexington-Fayette United States English
Louisville United States English
Little Rock United States English
EXPLAIN
@@ -1948,7 +1948,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -2104,9 +2104,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2208,9 +2208,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2283,7 +2283,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -2312,9 +2312,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2357,7 +2357,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -2387,7 +2387,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -2416,9 +2416,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2461,7 +2461,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -2491,7 +2491,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -2520,9 +2520,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2539,12 +2539,12 @@ Las Palmas de Gran Canaria Spain Spanish
L´Hospitalet de Llobregat Spain Spanish
Lleida (Lérida) Spain Spanish
Liupanshui China Chinese
-Lianyungang China Chinese
Liangcheng China Chinese
+Lianyungang China Chinese
Lengshuijiang China Chinese
Lázaro Cárdenas Mexico Spanish
-Lagos de Moreno Mexico Spanish
Las Margaritas Mexico Spanish
+Lagos de Moreno Mexico Spanish
Lashio (Lasho) Myanmar Burmese
Lalitapur Nepal Nepali
Ludwigshafen am Rhein Germany German
@@ -2554,9 +2554,9 @@ Lungtan Taiwan Min
Lower Hutt New Zealand English
Los Teques Venezuela Spanish
Leninsk-Kuznetski Russian Federation Russian
+Lexington-Fayette United States English
Los Angeles United States English
Long Beach United States English
-Lexington-Fayette United States English
Louisville United States English
Little Rock United States English
EXPLAIN
@@ -2565,7 +2565,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -2595,7 +2595,7 @@ WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -2624,9 +2624,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
-1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
+1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2669,7 +2669,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN
City.Population > 100000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan
-1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
City.Population > 100000;
@@ -3670,8 +3670,8 @@ where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
1 SIMPLE t2 ref idx idx 5 test.t1.b 1
-1 SIMPLE t3 ref idx idx 5 test.t1.d 1
1 SIMPLE t4 ref idx idx 5 test.t1.c 1
+1 SIMPLE t3 ref idx idx 5 test.t1.d 1
select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4
where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
a b c d e f g
@@ -3683,8 +3683,8 @@ where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
1 SIMPLE t2 ref idx idx 5 test.t1.b 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE t3 ref idx idx 5 test.t1.d 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t4 ref idx idx 5 test.t1.c 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t3 ref idx idx 5 test.t1.d 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4
where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
a b c d e f g
@@ -6042,12 +6042,12 @@ drop table t1;
SET join_cache_level = 3;
# The following should have
# - table order PROFILING,user,
-# - table user accessed with hash_ALL:
+# - table db accessed with hash_ALL:
explain
-SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR;
+SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL Using where
-1 SIMPLE user hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 4 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE db hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 2 Using where; Using join buffer (flat, BNLH join)
set join_cache_level=default;
create table t1 (c1 date not null, key (c1)) engine=innodb;
insert t1 values ('2017-12-27');
diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test
index 82c438a96c1..b69be56a435 100644
--- a/mysql-test/main/join_cache.test
+++ b/mysql-test/main/join_cache.test
@@ -3979,9 +3979,9 @@ drop table t1;
SET join_cache_level = 3;
--echo # The following should have
--echo # - table order PROFILING,user,
---echo # - table user accessed with hash_ALL:
+--echo # - table db accessed with hash_ALL:
explain
-SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR;
+SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR;
set join_cache_level=default;
diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result
index 11bc380e6e6..6e59d8845a8 100644
--- a/mysql-test/main/join_outer.result
+++ b/mysql-test/main/join_outer.result
@@ -1790,8 +1790,11 @@ insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101);
insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101);
analyze table t1,t2,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
flush status;
select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null;
@@ -1800,7 +1803,7 @@ sum(t3.b)
show status like "handler_read%";
Variable_name Value
Handler_read_first 0
-Handler_read_key 4
+Handler_read_key 10
Handler_read_last 0
Handler_read_next 5
Handler_read_prev 0
@@ -1815,7 +1818,7 @@ sum(t3.b)
show status like "handler_read%";
Variable_name Value
Handler_read_first 0
-Handler_read_key 4
+Handler_read_key 6
Handler_read_last 0
Handler_read_next 5
Handler_read_prev 0
diff --git a/mysql-test/main/join_outer_innodb.result b/mysql-test/main/join_outer_innodb.result
index 6f3fb09329d..9ab8bde1236 100644
--- a/mysql-test/main/join_outer_innodb.result
+++ b/mysql-test/main/join_outer_innodb.result
@@ -440,18 +440,18 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
-1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
-1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
+1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
-1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where
@@ -462,18 +462,18 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
-1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
-1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
+1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
-1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
drop view v1;
drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
#
diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result
index bca340ad2cc..0b8c9fa93a5 100644
--- a/mysql-test/main/join_outer_jcl6.result
+++ b/mysql-test/main/join_outer_jcl6.result
@@ -1801,8 +1801,11 @@ insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101);
insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101);
analyze table t1,t2,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
flush status;
select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null;
@@ -1811,7 +1814,7 @@ sum(t3.b)
show status like "handler_read%";
Variable_name Value
Handler_read_first 0
-Handler_read_key 4
+Handler_read_key 10
Handler_read_last 0
Handler_read_next 5
Handler_read_prev 0
@@ -1826,7 +1829,7 @@ sum(t3.b)
show status like "handler_read%";
Variable_name Value
Handler_read_first 0
-Handler_read_key 4
+Handler_read_key 6
Handler_read_last 0
Handler_read_next 5
Handler_read_prev 0
diff --git a/mysql-test/main/kill.result b/mysql-test/main/kill.result
index dc1cb9252da..4775d111b79 100644
--- a/mysql-test/main/kill.result
+++ b/mysql-test/main/kill.result
@@ -324,7 +324,7 @@ connection blocker;
lock tables t1 read;
connection ddl;
# Let us mark locked table t1 as old
-flush tables;
+flush tables t1;
connection dml;
select * from t1;
connection default;
diff --git a/mysql-test/main/kill.test b/mysql-test/main/kill.test
index b6000ffced1..059d8d40b11 100644
--- a/mysql-test/main/kill.test
+++ b/mysql-test/main/kill.test
@@ -538,18 +538,18 @@ connection blocker;
lock tables t1 read;
connection ddl;
--echo # Let us mark locked table t1 as old
---send flush tables
+--send flush tables t1
connection dml;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables";
+ where state = "Waiting for table metadata lock" and
+ info = "flush tables t1";
--source include/wait_condition.inc
--send select * from t1
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
+ where state = "Waiting for table metadata lock" and
info = "select * from t1";
--source include/wait_condition.inc
--replace_result $ID2 ID2
diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result
index 8458e063d97..71b99d066ff 100644
--- a/mysql-test/main/limit_rows_examined.result
+++ b/mysql-test/main/limit_rows_examined.result
@@ -49,10 +49,11 @@ explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index
-1 SIMPLE t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
+cc cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
set @@join_cache_level=6;
@@ -69,10 +70,11 @@ explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index
-1 SIMPLE t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
+cc cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Mix LIMIT ROWS EXAMINED with LIMIT
@@ -254,12 +256,13 @@ where c1 IN (select * from t2i where c2 > ' ')
LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index
-1 PRIMARY t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index
select * from t1i
where c1 IN (select * from t2i where c2 > ' ')
LIMIT ROWS EXAMINED 6;
c1
bb
+cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Subqueries with IN-TO-EXISTS
@@ -836,7 +839,7 @@ WHERE c = (SELECT MAX(b) FROM t2)
LIMIT ROWS EXAMINED 3;
(SELECT MAX(c) FROM t1, t2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 10 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
drop table t1, t2;
MDEV-178: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*) on the
diff --git a/mysql-test/main/loaddata.result b/mysql-test/main/loaddata.result
index 98b8f2de4a5..4c5cee0aa25 100644
--- a/mysql-test/main/loaddata.result
+++ b/mysql-test/main/loaddata.result
@@ -45,10 +45,10 @@ load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
+Warning 1366 Incorrect integer value: 'error ' for column `test`.`t1`.`a` at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
Note 1265 Data truncated for column 'a' at row 4
-Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
+Warning 1366 Incorrect integer value: 'wrong end ' for column `test`.`t1`.`a` at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from t1;
a b
@@ -64,7 +64,7 @@ Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: '
-' for column 'a' at row 4
+' for column `test`.`t1`.`a` at row 4
Warning 1261 Row 4 doesn't contain data for all columns
select * from t1;
a b
diff --git a/mysql-test/main/lock.result b/mysql-test/main/lock.result
index 339cfcaa441..6edb86bfa3f 100644
--- a/mysql-test/main/lock.result
+++ b/mysql-test/main/lock.result
@@ -457,6 +457,7 @@ connection default;
LOCK TABLE t1 WRITE;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
connection con2;
LOCK TABLE t2 WRITE;
@@ -499,7 +500,7 @@ connect con1,localhost,root,,test;
LOCK TABLE t2 WRITE;
SET lock_wait_timeout= 1;
FLUSH TABLES;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+FLUSH TABLES t2;
UNLOCK TABLES;
disconnect con1;
connection default;
diff --git a/mysql-test/main/lock.test b/mysql-test/main/lock.test
index ff77b4991c0..8a59f4082b1 100644
--- a/mysql-test/main/lock.test
+++ b/mysql-test/main/lock.test
@@ -609,8 +609,8 @@ LOCK TABLE t1 READ;
--connect (con1,localhost,root,,test)
LOCK TABLE t2 WRITE;
SET lock_wait_timeout= 1;
---error ER_LOCK_WAIT_TIMEOUT
FLUSH TABLES;
+FLUSH TABLES t2;
# Cleanup
UNLOCK TABLES;
diff --git a/mysql-test/main/lock_multi.result b/mysql-test/main/lock_multi.result
index 52b4608fdd2..30cd63e60ed 100644
--- a/mysql-test/main/lock_multi.result
+++ b/mysql-test/main/lock_multi.result
@@ -118,17 +118,17 @@ LOCK TABLES columns_priv WRITE, db WRITE, user WRITE;
FLUSH TABLES;
connection reader;
USE mysql;
-SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
+SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1;
connection locker;
-OPTIMIZE TABLES columns_priv, db, user;
+OPTIMIZE TABLES columns_priv, db, global_priv;
Table Op Msg_type Msg_text
mysql.columns_priv optimize status OK
mysql.db optimize status OK
-mysql.user optimize status OK
+mysql.global_priv optimize status OK
UNLOCK TABLES;
connection reader;
-Select_priv
-N
+host
+localhost
USE test;
connection locker;
use test;
@@ -218,6 +218,7 @@ connection con2;
unlock tables;
connection con3;
a
+connection con4;
connection default;
disconnect con5;
disconnect con4;
@@ -247,6 +248,7 @@ flush table t2;
connection default;
unlock tables;
connection con1;
+connection con2;
#
# LOCK TABLES .. WRITE
#
@@ -299,7 +301,7 @@ connection default;
alter table t1 add column j int;
connect insert,localhost,root,,test,,;
connection insert;
-insert into t1 values (1,2);;
+insert into t1 values (1,2);
connection default;
unlock tables;
connection flush;
@@ -531,8 +533,9 @@ connect con3, localhost, root;
connection default;
LOCK TABLE t1 READ;
connection con3;
-# Sending:
FLUSH TABLES;
+# Sending:
+FLUSH TABLES t1;
connection con2;
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
diff --git a/mysql-test/main/lock_multi.test b/mysql-test/main/lock_multi.test
index ce901126ce5..5cc7219b01d 100644
--- a/mysql-test/main/lock_multi.test
+++ b/mysql-test/main/lock_multi.test
@@ -191,18 +191,18 @@ connection reader;
USE mysql;
# Note: This must be a multi-table select, otherwise the deadlock will not occur
send
-SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
+SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1;
#
connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND info =
- "SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1";
+ "SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1";
--source include/wait_condition.inc
# Make test case independent from earlier grants.
--replace_result "Table is already up to date" "OK"
-OPTIMIZE TABLES columns_priv, db, user;
+OPTIMIZE TABLES columns_priv, db, global_priv;
UNLOCK TABLES;
#
connection reader;
@@ -229,7 +229,7 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
# This must not block.
@@ -261,7 +261,7 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
--error ER_TABLE_NOT_LOCKED
@@ -298,10 +298,10 @@ DROP DATABASE mysqltest_1;
# When fixed: Reject dropping db because of the read lock.
connection con1;
# Wait a bit so that the session con2 is in state
-# "Waiting for global read lock"
+# "Waiting for backup lock"
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock"
+ where state = "Waiting for backup lock"
and info = "DROP DATABASE mysqltest_1";
--source include/wait_condition.inc
--error ER_CANT_UPDATE_WITH_READLOCK
@@ -377,7 +377,7 @@ send flush tables with read lock;
connection con5;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
--echo # global read lock is taken
@@ -386,14 +386,19 @@ send select * from t2 for update;
connection con5;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "select * from t2 for update";
--source include/wait_condition.inc
--echo # waiting for release of read lock
connection con4;
--echo # would hang and later cause a deadlock
-flush tables t2;
+--send flush tables t2
connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "flush tables t2";
+--source include/wait_condition.inc
--echo # clean up
unlock tables;
connection con2;
@@ -401,6 +406,8 @@ connection con2;
unlock tables;
connection con3;
--reap
+connection con4;
+--reap
connection default;
disconnect con5;
disconnect con4;
@@ -432,16 +439,23 @@ send update t2 set a = 1;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "update t2 set a = 1";
--source include/wait_condition.inc
--echo # statement is waiting for release of read lock
connection con2;
-flush table t2;
+--send flush table t2
connection default;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "flush table t2";
+--source include/wait_condition.inc
unlock tables;
connection con1;
--reap
+connection con2;
+--reap
--echo #
--echo # LOCK TABLES .. WRITE
@@ -454,7 +468,7 @@ send lock tables t2 write;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "lock tables t2 write";
--source include/wait_condition.inc
--echo # statement is waiting for release of read lock
@@ -542,7 +556,7 @@ connection flush;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
alter table t1 add column j int;
@@ -550,14 +564,14 @@ connect (insert,localhost,root,,test,,);
connection insert;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
---send insert into t1 values (1,2);
+--send insert into t1 values (1,2)
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for table metadata lock" and
info = "insert into t1 values (1,2)";
--source include/wait_condition.inc
unlock tables;
@@ -565,7 +579,7 @@ connection flush;
--reap
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
+ where state = "Waiting for backup lock" and
info = "insert into t1 values (1,2)";
--source include/wait_condition.inc
select * from t1;
@@ -598,12 +612,12 @@ connection flush;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
+ where state = "Waiting for backup lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
+ where state = "Waiting for backup lock";
--source include/wait_condition.inc
unlock tables;
connection flush;
@@ -664,12 +678,12 @@ connection flush;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
+ where state = "Waiting for backup lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
+ where state = "Waiting for backup lock";
--source include/wait_condition.inc
drop table t1;
connection flush;
@@ -931,13 +945,19 @@ connection default;
LOCK TABLE t1 READ;
connection con3;
+
+# first test that flush tables doesn't block
+FLUSH TABLES;
+
+# Check the FLUSH TABLES t1 waits until table lock is released
+
--echo # Sending:
---send FLUSH TABLES
+--send FLUSH TABLES t1
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table flush" AND info = "FLUSH TABLES";
+ WHERE state = "Waiting for table metadata lock" AND info = "FLUSH TABLES t1";
--source include/wait_condition.inc
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result
index 93182399958..bbdc1d43ba5 100644
--- a/mysql-test/main/lock_sync.result
+++ b/mysql-test/main/lock_sync.result
@@ -782,7 +782,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL dropped';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# Sending:
-FLUSH TABLES;
+FLUSH TABLES t1;
connection default;
# Waiting for FLUSH TABLES to be blocked.
SET DEBUG_SYNC= 'now SIGNAL dropped';
diff --git a/mysql-test/main/lock_sync.test b/mysql-test/main/lock_sync.test
index af8435f7fbb..1a8cd7bdbd3 100644
--- a/mysql-test/main/lock_sync.test
+++ b/mysql-test/main/lock_sync.test
@@ -974,12 +974,12 @@ SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL dropped';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
--echo # Sending:
---send FLUSH TABLES
+--send FLUSH TABLES t1
connection default;
--echo # Waiting for FLUSH TABLES to be blocked.
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES';
+ WHERE state= 'Waiting for table metadata lock' AND info= 'FLUSH TABLES t1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL dropped';
diff --git a/mysql-test/main/log_tables_upgrade.result b/mysql-test/main/log_tables_upgrade.result
index df6ea72f3ca..8d7b08a11bd 100644
--- a/mysql-test/main/log_tables_upgrade.result
+++ b/mysql-test/main/log_tables_upgrade.result
@@ -19,6 +19,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -42,9 +43,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
diff --git a/mysql-test/main/lowercase_fs_off.result b/mysql-test/main/lowercase_fs_off.result
index e05fd50caeb..6ff8c1b7f93 100644
--- a/mysql-test/main/lowercase_fs_off.result
+++ b/mysql-test/main/lowercase_fs_off.result
@@ -94,6 +94,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -122,7 +123,6 @@ mysql.time_zone_transition_type OK
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-mysql.user OK
Repairing tables
mysql.innodb_index_stats
@@ -136,6 +136,7 @@ Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
diff --git a/mysql-test/main/max_password_errors.result b/mysql-test/main/max_password_errors.result
new file mode 100644
index 00000000000..020761b4f2e
--- /dev/null
+++ b/mysql-test/main/max_password_errors.result
@@ -0,0 +1,45 @@
+set @old_max_password_errors=@@max_password_errors;
+set global max_password_errors=2;
+create user u identified by 'good_pass';
+connect(localhost,u,bas_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, u, bas_pass;
+ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
+connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, u, bad_pass;
+ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
+connect(localhost,u,good_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, u, good_pass;
+ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'
+connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, u, bad_pass;
+ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'
+FLUSH PRIVILEGES;
+connect con1, localhost, u, good_pass;
+disconnect con1;
+connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, u, bad_pass;
+ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
+connect con1, localhost, u, good_pass;
+disconnect con1;
+connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, u, bad_pass;
+ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
+connect con1, localhost, u, good_pass;
+ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
+ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
+ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'
+disconnect con1;
+connection default;
+FLUSH PRIVILEGES;
+connect(localhost,root,bas_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, root, bas_pass;
+ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
+connect(localhost,root,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
+connect con1, localhost, root, bad_pass;
+ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
+connect con1, localhost, u, good_pass;
+disconnect con1;
+connection default;
+DROP USER u;
+FLUSH PRIVILEGES;
+set global max_password_errors=@old_max_password_errors;
diff --git a/mysql-test/main/max_password_errors.test b/mysql-test/main/max_password_errors.test
new file mode 100644
index 00000000000..1debca0258d
--- /dev/null
+++ b/mysql-test/main/max_password_errors.test
@@ -0,0 +1,64 @@
+--source include/not_embedded.inc
+set @old_max_password_errors=@@max_password_errors;
+set global max_password_errors=2;
+create user u identified by 'good_pass';
+
+# Test that user is blocked after 'max_password_errors' bad passwords
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+connect(con1, localhost, u, bas_pass);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+connect (con1, localhost, u, bad_pass);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_USER_IS_BLOCKED;
+connect(con1, localhost, u, good_pass);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_USER_IS_BLOCKED;
+connect(con1, localhost, u, bad_pass);
+
+
+# Test that FLUSH PRIVILEGES clears the error
+FLUSH PRIVILEGES;
+connect (con1, localhost, u, good_pass);
+disconnect con1;
+
+# Test that good login clears the error
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+connect (con1, localhost, u, bad_pass);
+connect (con1, localhost, u, good_pass);
+disconnect con1;
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+connect (con1, localhost, u, bad_pass);
+connect (con1, localhost, u, good_pass);
+
+# Test the behavior of change_user
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+change_user u,bad_pass;
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+change_user u,bad_pass;
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_USER_IS_BLOCKED;
+change_user u,good_pass;
+disconnect con1;
+
+connection default;
+FLUSH PRIVILEGES;
+
+#Test that root@localhost is not blocked, with password errors
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+connect(con1, localhost, root, bas_pass);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_ERROR;
+connect (con1, localhost, root, bad_pass);
+connect (con1, localhost, u, good_pass);
+disconnect con1;
+connection default;
+DROP USER u;
+FLUSH PRIVILEGES;
+set global max_password_errors=@old_max_password_errors; \ No newline at end of file
diff --git a/mysql-test/main/mdev-504.result b/mysql-test/main/mdev-504.result
index 9b8b6795e0f..e34e57be6ed 100644
--- a/mysql-test/main/mdev-504.result
+++ b/mysql-test/main/mdev-504.result
@@ -1,3 +1,4 @@
+set @save_use_stat_tables=@@global.use_stat_tables;
SET GLOBAL net_write_timeout = 900;
CREATE TABLE A (
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
@@ -20,5 +21,5 @@ connection default;
DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
-SET GLOBAL use_stat_tables = DEFAULT;
+SET GLOBAL use_stat_tables = @save_use_stat_tables;
SET GLOBAL net_write_timeout = DEFAULT;
diff --git a/mysql-test/main/mdev-504.test b/mysql-test/main/mdev-504.test
index 551c21c37d0..277b5a038a0 100644
--- a/mysql-test/main/mdev-504.test
+++ b/mysql-test/main/mdev-504.test
@@ -1,6 +1,8 @@
--source include/not_valgrind.inc
--source include/no_protocol.inc
+set @save_use_stat_tables=@@global.use_stat_tables;
+
SET GLOBAL net_write_timeout = 900;
CREATE TABLE A (
@@ -76,5 +78,5 @@ while ($trial)
DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
-SET GLOBAL use_stat_tables = DEFAULT;
+SET GLOBAL use_stat_tables = @save_use_stat_tables;
SET GLOBAL net_write_timeout = DEFAULT;
diff --git a/mysql-test/main/mdev13607.result b/mysql-test/main/mdev13607.result
index 0d573b06b93..43fc473c84d 100644
--- a/mysql-test/main/mdev13607.result
+++ b/mysql-test/main/mdev13607.result
@@ -14,8 +14,11 @@ CREATE TABLE t3 (id INT) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1),(2);
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
explain SELECT * FROM
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_1
diff --git a/mysql-test/main/mdl.result b/mysql-test/main/mdl.result
index d93bfd5c729..883f35674c0 100644
--- a/mysql-test/main/mdl.result
+++ b/mysql-test/main/mdl.result
@@ -6,17 +6,85 @@
# failed in MDL_context::upgrade_shared_lock
#
CREATE TABLE t1(a INT) ENGINE=InnoDB;
+CREATE TABLE t3(a INT) ENGINE=myisam;
LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-MDL_INTENTION_EXCLUSIVE Global read lock
+MDL_BACKUP_TRANS_DML Backup lock
MDL_SHARED_NO_READ_WRITE Table metadata lock test t1
UNLOCK TABLES;
LOCK TABLES t1 AS t2 READ, t1 WRITE CONCURRENT;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
-MDL_INTENTION_EXCLUSIVE Global read lock
+MDL_BACKUP_TRANS_DML Backup lock
MDL_SHARED_WRITE Table metadata lock test t1
MDL_SHARED_READ_ONLY Table metadata lock test t1
UNLOCK TABLES;
-DROP TABLE t1;
+LOCK TABLES t1 WRITE CONCURRENT, t3 WRITE;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_DDL Backup lock
+MDL_BACKUP_DML Backup lock
+MDL_SHARED_WRITE Table metadata lock test t1
+MDL_SHARED_NO_READ_WRITE Table metadata lock test t3
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+UNLOCK TABLES;
+LOCK TABLES t3 WRITE, t1 WRITE CONCURRENT;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_DDL Backup lock
+MDL_BACKUP_DML Backup lock
+MDL_SHARED_WRITE Table metadata lock test t1
+MDL_SHARED_NO_READ_WRITE Table metadata lock test t3
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+UNLOCK TABLES;
+LOCK TABLES t1 WRITE, mysql.user WRITE;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_DDL Backup lock
+MDL_SHARED_NO_READ_WRITE Table metadata lock mysql user
+MDL_SHARED_NO_READ_WRITE Table metadata lock test t1
+MDL_INTENTION_EXCLUSIVE Schema metadata lock mysql
+MDL_SHARED_NO_READ_WRITE Table metadata lock mysql global_priv
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+UNLOCK TABLES;
+LOCK TABLES mysql.general_log WRITE;
+ERROR HY000: You can't use locks with log tables
+LOCK TABLES t1 WRITE,information_schema.tables READ;
+UNLOCK TABLES;
+DROP TABLE t1,t3;
+#
+# Check MDL locks taken for different kind of tables by open
+#
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+CREATE TABLE t3(a INT) ENGINE=myisam;
+connect locker,localhost,root,,;
+connection default;
+FLUSH TABLES WITH READ LOCK;
+connection locker;
+insert into t1 values (1);
+connection default;
+connection default;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_FTWRL2 Backup lock
+MDL_SHARED_WRITE Table metadata lock test t1
+unlock tables;
+connection locker;
+unlock tables;
+connection default;
+FLUSH TABLES WITH READ LOCK;
+connection locker;
+insert into t3 values (2);
+connection default;
+connection default;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_FTWRL2 Backup lock
+MDL_SHARED_WRITE Table metadata lock test t3
+unlock tables;
+connection locker;
+unlock tables;
+connection default;
+disconnect locker;
+DROP TABLE t1,t3;
diff --git a/mysql-test/main/mdl.test b/mysql-test/main/mdl.test
index b90c74a8f7f..23a862f5212 100644
--- a/mysql-test/main/mdl.test
+++ b/mysql-test/main/mdl.test
@@ -10,10 +10,72 @@
--echo #
CREATE TABLE t1(a INT) ENGINE=InnoDB;
+CREATE TABLE t3(a INT) ENGINE=myisam;
LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
UNLOCK TABLES;
LOCK TABLES t1 AS t2 READ, t1 WRITE CONCURRENT;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
UNLOCK TABLES;
-DROP TABLE t1;
+LOCK TABLES t1 WRITE CONCURRENT, t3 WRITE;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+UNLOCK TABLES;
+LOCK TABLES t3 WRITE, t1 WRITE CONCURRENT;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+UNLOCK TABLES;
+LOCK TABLES t1 WRITE, mysql.user WRITE;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+UNLOCK TABLES;
+--error ER_CANT_LOCK_LOG_TABLE
+LOCK TABLES mysql.general_log WRITE;
+# The following may work in embedded server
+--error 0,ER_DBACCESS_DENIED_ERROR
+LOCK TABLES t1 WRITE,information_schema.tables READ;
+UNLOCK TABLES;
+DROP TABLE t1,t3;
+
+--echo #
+--echo # Check MDL locks taken for different kind of tables by open
+--echo #
+
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+CREATE TABLE t3(a INT) ENGINE=myisam;
+connect (locker,localhost,root,,);
+connection default;
+
+FLUSH TABLES WITH READ LOCK;
+connection locker;
+--send insert into t1 values (1)
+connection default;
+# Wait till above update gets blocked on a user lock.
+let $wait_condition=
+ select count(*) > 0 from information_schema.processlist
+ where state = "Waiting for backup lock";
+--source include/wait_condition.inc
+connection default;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+unlock tables;
+connection locker;
+--reap
+unlock tables;
+connection default;
+
+FLUSH TABLES WITH READ LOCK;
+connection locker;
+--send insert into t3 values (2)
+connection default;
+# Wait till above update gets blocked on a user lock.
+let $wait_condition=
+ select count(*) > 0 from information_schema.processlist
+ where state = "Waiting for backup lock";
+--source include/wait_condition.inc
+connection default;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+unlock tables;
+connection locker;
+--reap
+unlock tables;
+connection default;
+
+disconnect locker;
+DROP TABLE t1,t3;
diff --git a/mysql-test/main/mdl_sync.result b/mysql-test/main/mdl_sync.result
index 3880fc5ef91..5203fdddb2d 100644
--- a/mysql-test/main/mdl_sync.result
+++ b/mysql-test/main/mdl_sync.result
@@ -2146,10 +2146,11 @@ flush tables t1, t2 with read lock;
connection con1;
# Wait till FLUSH TABLES <list> WITH READ LOCK stops.
set debug_sync='now WAIT_FOR parked';
+flush tables;
# Start a statement which will flush all tables and thus
# invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK.
# Sending:
-flush tables;
+flush tables t1;
connection default;
# Wait till the above FLUSH TABLES blocks.
# Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2
@@ -2513,6 +2514,12 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_DDL Backup lock
+MDL_EXCLUSIVE Stored procedure metadata lock test p1
+MDL_INTENTION_EXCLUSIVE Schema metadata lock test
+MDL_SHARED_WRITE Table metadata lock mysql proc
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
connection default;
@@ -2527,6 +2534,43 @@ connection con2;
UNLOCK TABLES;
connection default;
SET DEBUG_SYNC= 'RESET';
+#
+# UPDATE should wait for FTWRL with non transactional table second
+#
+create table t1 (a int) engine=myisam;
+create table t2 (a int) engine=innodb;
+insert into t1 values (1);
+insert into t2 values (1);
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
+update t1,t2 set t1.a=2,t2.a=3;
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'now SIGNAL grlwait';
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
+FLUSH TABLES WITH READ LOCK;
+connection default;
+# Reaping UPDATE
+connection con2;
+UNLOCK TABLES;
+connection default;
+SET DEBUG_SYNC= 'RESET';
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
+update t2,t1 set t1.a=2,t2.a=3;
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'now SIGNAL grlwait';
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
+FLUSH TABLES WITH READ LOCK;
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_BACKUP_FTWRL2 Backup lock
+unlock tables;
+connection default;
+# Reaping UPDATE
+SET DEBUG_SYNC= 'RESET';
+drop table t1,t2;
disconnect con2;
#
# Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'
@@ -2534,7 +2578,6 @@ disconnect con2;
#
# Supress warnings written to the log file
call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock");
-DROP TABLE IF EXISTS t1, t2;
connect con1,localhost,root;
connect con2,localhost,root;
connect con3,localhost,root;
@@ -3055,7 +3098,7 @@ disconnect con3;
#
CREATE TABLE t1(a INT) ENGINE=InnoDB;
SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
-SELECT * FROM t1;
+INSERT INTO t1 values (1);
connect con1,localhost,root,,;
SET debug_sync='now WAIT_FOR ready';
SET lock_wait_timeout=1;
@@ -3063,7 +3106,21 @@ FLUSH TABLES WITH READ LOCK;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET debug_sync='now SIGNAL go';
connection default;
+# After MDEV-5536, SELECT will not block FLUSH TABLES
+SET debug_sync='RESET';
+SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
+SELECT * FROM t1;
+connection con1;
+SET debug_sync='now WAIT_FOR ready';
+SET lock_wait_timeout=1;
+FLUSH TABLES WITH READ LOCK;
+SET debug_sync='now SIGNAL go';
+connection default;
a
+1
+connection con1;
+unlock tables;
+connection default;
SET debug_sync='RESET';
DROP TABLE t1;
disconnect con1;
diff --git a/mysql-test/main/mdl_sync.test b/mysql-test/main/mdl_sync.test
index fbecd6bf547..2a1e488ab44 100644
--- a/mysql-test/main/mdl_sync.test
+++ b/mysql-test/main/mdl_sync.test
@@ -2,6 +2,7 @@
# We need the Debug Sync Facility.
#
--source include/have_debug_sync.inc
+--source include/have_metadata_lock_info.inc
# We need InnoDB tables for some of the tests.
--source include/have_innodb.inc
@@ -2690,17 +2691,20 @@ connection con1;
--echo # Wait till FLUSH TABLES <list> WITH READ LOCK stops.
set debug_sync='now WAIT_FOR parked';
+# Simple flush tables should not block
+flush tables;
+
--echo # Start a statement which will flush all tables and thus
--echo # invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK.
--echo # Sending:
-send flush tables;
+send flush tables t1;
connection default;
--echo # Wait till the above FLUSH TABLES blocks.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables";
+ where state = "Waiting for table metadata lock" and
+ info = "flush tables t1";
--source include/wait_condition.inc
--echo # Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2
@@ -3245,6 +3249,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
--echo # Check that FLUSH must wait to get the GRL
--echo # and let DROP PROCEDURE continue
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
--send FLUSH TABLES WITH READ LOCK
@@ -3261,12 +3266,63 @@ connection con2;
--echo # Reaping FTWRL.
--reap
UNLOCK TABLES;
+connection default;
+SET DEBUG_SYNC= 'RESET';
+
+--echo #
+--echo # UPDATE should wait for FTWRL with non transactional table second
+--echo #
+
+create table t1 (a int) engine=myisam;
+create table t2 (a int) engine=innodb;
+insert into t1 values (1);
+insert into t2 values (1);
+
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
+--send update t1,t2 set t1.a=2,t2.a=3
+
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'now SIGNAL grlwait';
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
+FLUSH TABLES WITH READ LOCK;
+
+connection default;
+--echo # Reaping UPDATE
+--reap
+
+connection con2;
+UNLOCK TABLES;
connection default;
SET DEBUG_SYNC= 'RESET';
-disconnect con2;
+# This will cause a wait as we first get lock for innodb table t2 but FTWRL
+# will cause lock for t1 to wait
+
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
+--send update t2,t1 set t1.a=2,t2.a=3
+
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'now SIGNAL grlwait';
+SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
+FLUSH TABLES WITH READ LOCK;
+let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info;
+--source include/wait_condition.inc
+SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
+
+unlock tables;
+
+connection default;
+--echo # Reaping UPDATE
+--reap
+SET DEBUG_SYNC= 'RESET';
+drop table t1,t2;
+disconnect con2;
--echo #
--echo # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'
@@ -3275,9 +3331,6 @@ disconnect con2;
--echo # Supress warnings written to the log file
call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock");
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
connect (con1,localhost,root);
connect (con2,localhost,root);
@@ -3966,7 +4019,7 @@ connection con2;
connection default;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for global read lock'
+ WHERE state='Waiting for backup lock'
AND info='CREATE TABLE db1.t2(a INT)';
--source include/wait_condition.inc
UNLOCK TABLES;
@@ -3984,7 +4037,7 @@ connection con2;
connection default;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for global read lock'
+ WHERE state='Waiting for backup lock'
AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
--source include/wait_condition.inc
UNLOCK TABLES;
@@ -4079,9 +4132,10 @@ disconnect con3;
--echo # MDEV-12620 - set lock_wait_timeout = 1;flush tables with read lock;
--echo # lock not released after timeout
--echo #
+
CREATE TABLE t1(a INT) ENGINE=InnoDB;
SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
-send SELECT * FROM t1;
+send INSERT INTO t1 values (1);
connect (con1,localhost,root,,);
SET debug_sync='now WAIT_FOR ready';
@@ -4093,12 +4147,31 @@ SET debug_sync='now SIGNAL go';
connection default;
reap;
+
+--echo # After MDEV-5536, SELECT will not block FLUSH TABLES
+
+SET debug_sync='RESET';
+SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
+send SELECT * FROM t1;
+
+connection con1;
+SET debug_sync='now WAIT_FOR ready';
+# lock_wait_timeout should be 0 in 10.3, so that we don't have to wait at all
+SET lock_wait_timeout=1;
+FLUSH TABLES WITH READ LOCK;
+SET debug_sync='now SIGNAL go';
+
+connection default;
+reap;
+connection con1;
+unlock tables;
+connection default;
+
SET debug_sync='RESET';
DROP TABLE t1;
disconnect con1;
-
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/main/merge.result b/mysql-test/main/merge.result
index b3cc731a6a9..7891ffa1723 100644
--- a/mysql-test/main/merge.result
+++ b/mysql-test/main/merge.result
@@ -2117,6 +2117,7 @@ CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES(0),(1),(2),(3),(4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE TABLE m1(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
@@ -3818,11 +3819,15 @@ CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1);
PREPARE stmt FROM "ANALYZE TABLE tmerge, t1";
EXECUTE stmt;
Table Op Msg_type Msg_text
+test.tmerge analyze status Engine-independent statistics collected
test.tmerge analyze note The storage engine for the table doesn't support analyze
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
EXECUTE stmt;
Table Op Msg_type Msg_text
+test.tmerge analyze status Engine-independent statistics collected
test.tmerge analyze note The storage engine for the table doesn't support analyze
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
DEALLOCATE PREPARE stmt;
DROP TABLE t1, tmerge;
diff --git a/mysql-test/main/mix2_myisam.result b/mysql-test/main/mix2_myisam.result
index 34764466d2a..5acec2616fa 100644
--- a/mysql-test/main/mix2_myisam.result
+++ b/mysql-test/main/mix2_myisam.result
@@ -211,6 +211,7 @@ create index skr on t1 (a);
insert into t1 values (3,""), (4,"testing");
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result
index 9f9af8f79f8..d2a33619900 100644
--- a/mysql-test/main/multi_update.result
+++ b/mysql-test/main/multi_update.result
@@ -998,8 +998,8 @@ a b c a b c
set optimizer_switch='firstmatch=off';
explain update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c< t2.c) order by t2.c, t1.c limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
-1 PRIMARY t1 ALL a NULL NULL NULL 10 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary; Using filesort
+1 PRIMARY t1 ref a a 5 test.t2.a 1
1 PRIMARY t3 ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary
update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c<=t2.c) order by t2.c, t1.c limit 5;
select * from t2;
diff --git a/mysql-test/main/myisam.result b/mysql-test/main/myisam.result
index 498536c1862..b4ad9121ea6 100644
--- a/mysql-test/main/myisam.result
+++ b/mysql-test/main/myisam.result
@@ -676,6 +676,7 @@ insert into t1 values (0),(1),(2),(3),(4);
insert into t1 select NULL from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -696,6 +697,7 @@ insert into t1 values (11);
delete from t1 where a=11;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -707,7 +709,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-t1 1 a 1 a A 5 NULL NULL YES BTREE
+t1 1 a 1 a A 10 NULL NULL YES BTREE
set myisam_stats_method=DEFAULT;
show variables like 'myisam_stats_method';
Variable_name Value
@@ -716,6 +718,7 @@ insert into t1 values (11);
delete from t1 where a=11;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -743,6 +746,7 @@ insert into t1 values ('bce','def1', 'yuu', NULL);
insert into t1 values ('bce','def2', NULL, 'quux');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -753,6 +757,7 @@ t1 1 a 4 d A 4 NULL NULL YES BTREE
delete from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -1801,6 +1806,7 @@ create table t1 (a int, key(a));
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/mysql-test/main/myisam_explain_non_select_all.result b/mysql-test/main/myisam_explain_non_select_all.result
index 939d6c417eb..bfc8370a218 100644
--- a/mysql-test/main/myisam_explain_non_select_all.result
+++ b/mysql-test/main/myisam_explain_non_select_all.result
@@ -28,10 +28,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
@@ -58,6 +60,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10;
@@ -67,14 +70,17 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
Handler_delete 3
+Handler_read_key 2
Handler_read_rnd_next 4
DROP TABLE t1;
@@ -97,6 +103,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1;
@@ -106,14 +113,17 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
Handler_delete 1
+Handler_read_key 2
Handler_read_rnd_next 4
DROP TABLE t1;
@@ -150,10 +160,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 8
# Status of testing query execution:
Variable_name Value
@@ -196,10 +208,12 @@ Warnings:
Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` = 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 8
# Status of testing query execution:
Variable_name Value
@@ -242,11 +256,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 5
Handler_read_rnd_next 8
# Status of testing query execution:
Variable_name Value
@@ -290,10 +305,12 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 8
# Status of testing query execution:
Variable_name Value
@@ -340,11 +357,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` where `test`.`t2`.`b` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 3
+Handler_read_key 7
Handler_read_rnd_next 12
# Status of testing query execution:
Variable_name Value
@@ -388,10 +406,12 @@ Warnings:
Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 8
# Status of testing query execution:
Variable_name Value
@@ -438,11 +458,13 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t11`.`a` AS `a`,1 AS `1` from `test`.`t1` `t11`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 1
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 5
# Status of testing query execution:
Variable_name Value
@@ -486,10 +508,12 @@ Warnings:
Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` > 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 8
# Status of testing query execution:
Variable_name Value
@@ -516,6 +540,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 1 LIMIT 1;
@@ -525,14 +550,17 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1 limit 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 2
# Status of testing query execution:
Variable_name Value
Handler_delete 1
+Handler_read_key 2
Handler_read_rnd_next 2
DROP TABLE t1;
@@ -555,6 +583,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 0;
@@ -564,12 +593,15 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
# Status of testing query execution:
Variable_name Value
+Handler_read_key 2
DROP TABLE t1;
#13
@@ -591,6 +623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 0;
@@ -600,12 +633,15 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
# Status of testing query execution:
Variable_name Value
+Handler_read_key 2
DROP TABLE t1;
#14
@@ -627,6 +663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 5
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 3;
@@ -636,16 +673,16 @@ Warnings:
Note 1003 select 3 AS `a`,3 AS `b` from `test`.`t1` where 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
-Handler_read_key 1
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 6
# Status of testing query execution:
Variable_name Value
Handler_delete 1
-Handler_read_key 1
+Handler_read_key 6
DROP TABLE t1;
#15
@@ -667,6 +704,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 5
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 3;
@@ -676,14 +714,15 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 5
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 6
# Status of testing query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 6
DROP TABLE t1;
#16
@@ -704,6 +743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 3
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
@@ -713,14 +753,17 @@ Warnings:
Note 1003 select NULL AS `a` from `test`.`t1` where 0 order by NULL
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Handler_read_rnd_next 1
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 3
Handler_read_rnd_next 1
# Status of testing query execution:
Variable_name Value
+Handler_read_key 3
INSERT INTO t1 VALUES (1), (2), (3), (-1), (-2), (-3);
#
@@ -739,6 +782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 3
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
@@ -748,16 +792,17 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 4
Handler_read_next 3
# Status of testing query execution:
Variable_name Value
Handler_delete 3
-Handler_read_key 1
+Handler_read_key 4
Handler_read_next 3
DROP TABLE t1;
@@ -780,6 +825,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 3
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1;
@@ -789,15 +835,18 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where @a:=`test`.`t1`.`a` order by `test`.`t1`.`a` limit 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_first 1
+Handler_read_key 3
# Status of testing query execution:
Variable_name Value
Handler_delete 1
Handler_read_first 1
+Handler_read_key 3
DROP TABLE t1;
#18
@@ -820,6 +869,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 7
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 ORDER BY a ASC, b ASC LIMIT 1;
@@ -829,10 +879,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` order by `test`.`t1`.`a`,`test`.`t1`.`b` limit 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 7
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 7
Handler_read_rnd_next 11
Sort_priority_queue_sorts 1
Sort_rows 1
@@ -840,6 +892,7 @@ Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 1
+Handler_read_key 7
Handler_read_rnd 1
Handler_read_rnd_next 11
Sort_rows 10
@@ -873,6 +926,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 13
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3;
@@ -884,17 +938,18 @@ Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a2` = `test`.`t1`.`a1` and `test`.`t3`.`a3` = `test`.`t2`.`b2` and `test`.`t3`.`b3` = `test`.`t1`.`b1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 13
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 6
+Handler_read_key 19
Handler_read_next 3
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
Handler_delete 8
-Handler_read_key 6
+Handler_read_key 19
Handler_read_next 3
Handler_read_rnd 5
Handler_read_rnd_next 4
@@ -934,11 +989,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 3
+Handler_read_key 7
Handler_read_rnd_next 8
# Status of testing query execution:
Variable_name Value
@@ -970,6 +1026,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2);
@@ -980,15 +1037,17 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(/* select#2 */ select `test`.`t2`.`a2` from `test`.`t2` where `test`.`t2`.`a2` > 2 and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`a2`)))
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 5
+Handler_read_key 9
Handler_read_rnd_next 30
# Status of testing query execution:
Variable_name Value
Handler_delete 3
+Handler_read_key 4
Handler_read_rnd_next 30
SET @@optimizer_switch= @save_optimizer_switch;
@@ -1012,6 +1071,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2);
@@ -1022,14 +1082,17 @@ Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a2` > 2 and `test`.`t1`.`a1` = `test`.`t2`.`a2`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 12
# Status of testing query execution:
Variable_name Value
Handler_delete 3
+Handler_read_key 4
Handler_read_rnd_next 30
DROP TABLE t1, t2;
@@ -1061,10 +1124,12 @@ Warnings:
Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`j` AS `j` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 3
Handler_read_rnd_next 6
# Status of testing query execution:
Variable_name Value
@@ -1091,6 +1156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL 5 NULL Deleting all rows
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 3
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1;
@@ -1100,13 +1166,16 @@ Warnings:
Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`j` AS `j` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 3
Handler_read_rnd_next 6
# Status of testing query execution:
Variable_name Value
+Handler_read_key 3
DROP TABLE t1;
#24
@@ -1133,6 +1202,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 8
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
@@ -1142,16 +1212,19 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_first 1
+Handler_read_key 8
Handler_read_next 4
# Status of testing query execution:
Variable_name Value
Handler_delete 5
Handler_read_first 1
+Handler_read_key 8
Handler_read_next 4
DROP TABLE t1, t2;
@@ -1175,6 +1248,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1;
@@ -1184,13 +1258,16 @@ Warnings:
Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 4
Handler_write 3
@@ -1215,6 +1292,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1;
@@ -1224,13 +1302,16 @@ Warnings:
Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 4
Handler_write 3
@@ -1251,8 +1332,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
# Status of testing query execution:
Variable_name Value
+Handler_read_key 2
Handler_write 1
DROP TABLE t1;
@@ -1272,8 +1355,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
# Status of testing query execution:
Variable_name Value
+Handler_read_key 2
Handler_write 1
DROP TABLE t1;
@@ -1298,6 +1383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
@@ -1307,16 +1393,17 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 5
Handler_read_next 4
# Status of testing query execution:
Variable_name Value
Handler_delete 5
-Handler_read_key 1
+Handler_read_key 5
Handler_read_next 4
DROP TABLE t1;
@@ -1341,6 +1428,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
@@ -1350,10 +1438,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 5
@@ -1361,6 +1451,7 @@ Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 5
+Handler_read_key 4
Handler_read_rnd 5
Handler_read_rnd_next 27
Sort_rows 8
@@ -1390,6 +1481,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 8
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
@@ -1399,10 +1491,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 8
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 1
@@ -1410,6 +1504,7 @@ Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 1
+Handler_read_key 8
Handler_read_rnd 1
Handler_read_rnd_next 27
Sort_rows 1
@@ -1440,6 +1535,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 8
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
@@ -1449,16 +1545,19 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_first 1
+Handler_read_key 8
Handler_read_next 4
# Status of testing query execution:
Variable_name Value
Handler_delete 5
Handler_read_first 1
+Handler_read_key 8
Handler_read_next 4
DROP TABLE t1, t2;
@@ -1485,6 +1584,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 8
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
@@ -1494,10 +1594,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 8
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 1
@@ -1505,6 +1607,7 @@ Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 1
+Handler_read_key 8
Handler_read_rnd 1
Handler_read_rnd_next 27
Sort_rows 1
@@ -1535,6 +1638,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 8
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
@@ -1544,10 +1648,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 8
Handler_read_rnd 1
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
@@ -1556,6 +1662,7 @@ Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 1
+Handler_read_key 8
Handler_read_rnd 1
Handler_read_rnd_next 27
Sort_rows 1
@@ -1586,6 +1693,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 6
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
@@ -1595,11 +1703,12 @@ Warnings:
Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 2
+Handler_read_key 8
Handler_read_next 7
Handler_read_rnd 4
Sort_range 1
@@ -1607,7 +1716,7 @@ Sort_rows 4
# Status of testing query execution:
Variable_name Value
Handler_delete 4
-Handler_read_key 2
+Handler_read_key 8
Handler_read_next 7
Handler_read_rnd 8
Sort_range 1
@@ -1637,6 +1746,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
@@ -1646,16 +1756,17 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 5
Handler_read_prev 4
# Status of testing query execution:
Variable_name Value
Handler_delete 5
-Handler_read_key 1
+Handler_read_key 5
Handler_read_prev 4
DROP TABLE t1, t2;
@@ -1682,6 +1793,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 6
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5;
@@ -1691,10 +1803,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 6
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 5
@@ -1702,6 +1816,7 @@ Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 5
+Handler_read_key 6
Handler_read_rnd 5
Handler_read_rnd_next 27
Sort_rows 26
@@ -1732,6 +1847,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 6 NULL 5 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 6
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
@@ -1741,15 +1857,18 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 6
Handler_read_last 1
Handler_read_prev 4
# Status of testing query execution:
Variable_name Value
Handler_delete 5
+Handler_read_key 6
Handler_read_last 1
Handler_read_prev 4
@@ -1786,11 +1905,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 5
Handler_read_next 4
# Status of testing query execution:
Variable_name Value
@@ -1832,10 +1952,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 5
@@ -1882,10 +2004,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 8
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 1
@@ -1933,11 +2057,13 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_first 1
+Handler_read_key 8
Handler_read_next 4
# Status of testing query execution:
Variable_name Value
@@ -1979,10 +2105,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 8
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 1
@@ -2029,10 +2157,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 8
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 8
Handler_read_rnd 1
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
@@ -2080,11 +2210,12 @@ Warnings:
Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 2
+Handler_read_key 8
Handler_read_next 7
Handler_read_rnd 4
Sort_range 1
@@ -2131,11 +2262,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 5
Handler_read_prev 4
# Status of testing query execution:
Variable_name Value
@@ -2177,10 +2309,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 6
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 5
@@ -2228,10 +2362,12 @@ Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 6
Handler_read_last 1
Handler_read_prev 4
# Status of testing query execution:
@@ -2276,11 +2412,12 @@ Warnings:
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 7
Handler_read_next 2
Sort_priority_queue_sorts 1
Sort_range 1
@@ -2311,6 +2448,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 6
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
@@ -2320,11 +2458,12 @@ Warnings:
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 7
Handler_read_next 2
Sort_priority_queue_sorts 1
Sort_range 1
@@ -2332,7 +2471,7 @@ Sort_rows 2
# Status of testing query execution:
Variable_name Value
Handler_delete 2
-Handler_read_key 1
+Handler_read_key 7
Handler_read_next 2
Handler_read_rnd 2
Sort_range 1
@@ -2367,11 +2506,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 34
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 1
+Handler_read_key 4
Handler_read_next 2
# Status of testing query execution:
Variable_name Value
@@ -2414,11 +2554,13 @@ Warnings:
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 7
Handler_read_rnd_next 1
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 7
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
@@ -2453,11 +2595,13 @@ Warnings:
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 7
Handler_read_rnd_next 1
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 7
Handler_read_rnd_next 4
# Status of testing query execution:
Variable_name Value
@@ -2501,11 +2645,12 @@ Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
Note 1003 /* select#1 */ select <expr_cache><`test`.`t1`.`f1`>((/* select#2 */ select max(`test`.`t2`.`f4`) from `test`.`t2` where `test`.`t2`.`f3` = `test`.`t1`.`f1`)) AS `(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1)` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 7
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 2
+Handler_read_key 9
Handler_read_rnd_next 9
# Status of testing query execution:
Variable_name Value
@@ -2568,10 +2713,12 @@ Warnings:
Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` > 0
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 6
# Status of testing query execution:
Variable_name Value
@@ -2610,10 +2757,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` = `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 9
# Status of testing query execution:
Variable_name Value
@@ -2644,6 +2793,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 3
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM v1 WHERE a < 4;
@@ -2653,16 +2803,19 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 4
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_first 1
+Handler_read_key 3
Handler_read_next 3
# Status of testing query execution:
Variable_name Value
Handler_delete 3
Handler_read_first 1
+Handler_read_key 3
Handler_read_next 3
DROP TABLE t1;
@@ -2691,6 +2844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 6
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2, v1 WHERE t2.x = v1.a;
@@ -2701,16 +2855,17 @@ Warnings:
Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 4
+Handler_read_key 10
Handler_read_rnd_next 5
# Status of testing query execution:
Variable_name Value
Handler_delete 4
-Handler_read_key 4
+Handler_read_key 10
Handler_read_rnd 4
Handler_read_rnd_next 5
@@ -2740,6 +2895,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 6
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t2, v1 WHERE t2.x = v1.a;
@@ -2750,16 +2906,17 @@ Warnings:
Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 6
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 4
+Handler_read_key 10
Handler_read_rnd_next 5
# Status of testing query execution:
Variable_name Value
Handler_delete 4
-Handler_read_key 4
+Handler_read_key 10
Handler_read_rnd 4
Handler_read_rnd_next 5
@@ -2782,6 +2939,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 2
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT NULL;
@@ -2795,6 +2953,7 @@ Variable_name Value
Variable_name Value
# Status of testing query execution:
Variable_name Value
+Handler_read_key 2
Handler_write 1
DROP TABLE t1;
@@ -2820,6 +2979,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
# Status of EXPLAIN EXTENDED query
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 1
FLUSH STATUS;
FLUSH TABLES;
@@ -2830,14 +2990,17 @@ Warnings:
Note 1003 select NULL AS `a` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 1
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 2
Handler_read_rnd_next 1
# Status of testing query execution:
Variable_name Value
+Handler_read_key 4
Handler_read_rnd_next 1
DROP TABLE t1, t2;
@@ -2885,11 +3048,12 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) where 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 3
+Handler_read_key 7
Handler_read_rnd_next 10
Sort_priority_queue_sorts 1
Sort_rows 3
@@ -2940,11 +3104,12 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) join `test`.`t2` where 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 3
+Handler_read_key 7
Handler_read_rnd_next 10
Sort_priority_queue_sorts 1
Sort_rows 3
@@ -2996,11 +3161,12 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join ((/* select#4 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) join `test`.`t2` where 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 4
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
-Handler_read_key 3
+Handler_read_key 7
Handler_read_rnd_next 10
Sort_priority_queue_sorts 1
Sort_rows 3
@@ -3068,11 +3234,13 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_first 1
+Handler_read_key 3
Handler_read_next 5
# Status of testing query execution:
Variable_name Value
@@ -3104,10 +3272,12 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 order by `test`.`t1`.`a` + 20
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
+Handler_read_key 3
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
# Status of "equivalent" SELECT query execution:
Variable_name Value
+Handler_read_key 3
Handler_read_rnd_next 6
Sort_scan 1
# Status of testing query execution:
diff --git a/mysql-test/main/myisam_icp.result b/mysql-test/main/myisam_icp.result
index b9b4926455c..804a039a35c 100644
--- a/mysql-test/main/myisam_icp.result
+++ b/mysql-test/main/myisam_icp.result
@@ -857,7 +857,7 @@ DROP TABLE t1;
create table t1 (a int,b char(5),primary key (a), key (b(1)));
insert ignore into t1 values ('a','b');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`a` at row 1
select 1 from t1 where a and b >= 'aa';
1
drop table t1;
diff --git a/mysql-test/main/mysql_install_db_win.result b/mysql-test/main/mysql_install_db_win.result
new file mode 100644
index 00000000000..63c922a9184
--- /dev/null
+++ b/mysql-test/main/mysql_install_db_win.result
@@ -0,0 +1,13 @@
+Running bootstrap
+Removing default user
+Allowing remote access for user root
+Setting root password
+Creating my.ini file
+Creation of the database was successful
+# Kill the server
+connect root,localhost,root,foo;
+SELECT @@datadir;
+@@datadir
+DATADIR/
+# Kill the server
+connection default;
diff --git a/mysql-test/main/mysql_install_db_win.test b/mysql-test/main/mysql_install_db_win.test
new file mode 100644
index 00000000000..7bf62903219
--- /dev/null
+++ b/mysql-test/main/mysql_install_db_win.test
@@ -0,0 +1,24 @@
+--source include/windows.inc
+
+# Create database in tmp directory using mysql_install_db.exe,
+# and start server from this directory.
+let $ddir= $MYSQLTEST_VARDIR/tmp/ddir;
+exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R;
+
+--source include/kill_mysqld.inc
+let $restart_parameters=--datadir=$ddir --loose-innodb;
+--source include/start_mysqld.inc
+
+connect root,localhost,root,foo;
+# Smoke test - check that we're actually using datadir
+# we've created (i.e restart_parameters worked)
+--replace_result $ddir DATADIR
+SELECT @@datadir;
+
+# restart in the original datadir again
+--source include/kill_mysqld.inc
+rmdir $ddir;
+let $restart_parameters=;
+connection default;
+--source include/start_mysqld.inc
+
diff --git a/mysql-test/main/mysql_upgrade-6984.result b/mysql-test/main/mysql_upgrade-6984.result
index a7b5bcb86bf..87f3c1a5359 100644
--- a/mysql-test/main/mysql_upgrade-6984.result
+++ b/mysql-test/main/mysql_upgrade-6984.result
@@ -1,4 +1,4 @@
-update mysql.user set password=password("foo") where user='root';
+update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo'));
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
@@ -7,6 +7,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -35,7 +36,6 @@ mysql.time_zone_transition_type OK
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-mysql.user OK
Repairing tables
mysql.innodb_index_stats
@@ -49,6 +49,7 @@ Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -62,6 +63,6 @@ test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
connect con1,localhost,root,foo,,,;
-update mysql.user set password='' where user='root';
+update mysql.global_priv set priv=json_remove(priv, '$.plugin', '$.authentication_string');
flush privileges;
set global event_scheduler=OFF;
diff --git a/mysql-test/main/mysql_upgrade-6984.test b/mysql-test/main/mysql_upgrade-6984.test
index 9bbfbeb3f87..a036b7a08a0 100644
--- a/mysql-test/main/mysql_upgrade-6984.test
+++ b/mysql-test/main/mysql_upgrade-6984.test
@@ -11,13 +11,13 @@
# In this setup MYSQL_UPGRADE cannot continue after issuing FLUSH PRIVILEGES
#
-update mysql.user set password=password("foo") where user='root';
+update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo'));
--exec $MYSQL_UPGRADE
connect(con1,localhost,root,foo,,,);
-update mysql.user set password='' where user='root';
+update mysql.global_priv set priv=json_remove(priv, '$.plugin', '$.authentication_string');
flush privileges;
# Load event table
set global event_scheduler=OFF;
diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result
index 54146787123..a99895f53d7 100644
--- a/mysql-test/main/mysql_upgrade.result
+++ b/mysql-test/main/mysql_upgrade.result
@@ -8,6 +8,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -30,9 +31,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -46,7 +47,7 @@ test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
Run it again - should say already completed
-This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
+This installation of MariaDB is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of whether it has been run before
Phase 1/7: Checking and upgrading mysql database
Processing databases
@@ -56,6 +57,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -78,9 +80,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -104,6 +106,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -126,9 +129,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -157,6 +160,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -179,9 +183,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -211,6 +215,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -233,9 +238,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -268,6 +273,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -290,9 +296,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -320,6 +326,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -342,7 +349,6 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views... Skipped
Phase 4/7: Running 'mysql_fix_privilege_tables'
@@ -364,6 +370,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -386,9 +393,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -429,6 +436,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -451,9 +459,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -511,6 +519,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -533,9 +542,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
@@ -566,7 +575,7 @@ Start of 10.3 tests
# Ensure that mysql_upgrade correctly sets truncate_versioning_priv
# on upgrade from 10.2
#
-flush privileges;
+drop view mysql.user_bak;
CREATE USER 'user3'@'%';
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
@@ -580,3 +589,5 @@ GRANT USAGE ON *.* TO 'user3'@'%'
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
update mysql.db set Delete_history_priv='Y' where db like 'test%';
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test
index 0171fe6c7ba..d4a3d864c21 100644
--- a/mysql-test/main/mysql_upgrade.test
+++ b/mysql-test/main/mysql_upgrade.test
@@ -227,7 +227,8 @@ SET GLOBAL enforce_storage_engine=NULL;
--echo # on upgrade from 10.2
--echo #
-flush privileges;
+--source include/switch_to_mysql_user.inc
+drop view mysql.user_bak;
CREATE USER 'user3'@'%';
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
@@ -241,3 +242,5 @@ flush privileges;
SHOW GRANTS FOR 'user3'@'%';
DROP USER 'user3'@'%';
update mysql.db set Delete_history_priv='Y' where db like 'test%';
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
diff --git a/mysql-test/main/mysql_upgrade_no_innodb.result b/mysql-test/main/mysql_upgrade_no_innodb.result
index 90e96800bff..35b55bb45e0 100644
--- a/mysql-test/main/mysql_upgrade_no_innodb.result
+++ b/mysql-test/main/mysql_upgrade_no_innodb.result
@@ -7,6 +7,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -35,7 +36,6 @@ mysql.time_zone_transition_type OK
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-mysql.user OK
Repairing tables
mysql.innodb_index_stats
diff --git a/mysql-test/main/mysql_upgrade_noengine.result b/mysql-test/main/mysql_upgrade_noengine.result
index 5dfe8aeb289..79ad04e1849 100644
--- a/mysql-test/main/mysql_upgrade_noengine.result
+++ b/mysql-test/main/mysql_upgrade_noengine.result
@@ -1,3 +1,4 @@
+drop view mysql.user_bak;
install soname 'ha_blackhole';
install soname 'ha_archive';
create table t1 (a int) engine=blackhole;
@@ -61,6 +62,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv_bak OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -140,6 +142,9 @@ Warnings:
Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
+drop view mysql.user_bak;
alter table mysql.user drop column default_role, drop column max_statement_time;
Phase 1/7: Checking and upgrading mysql database
Processing databases
@@ -149,6 +154,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv_bak OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -228,6 +234,9 @@ Warnings:
Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
+drop view mysql.user_bak;
alter table mysql.user drop column default_role, drop column max_statement_time;
Phase 1/7: Checking and upgrading mysql database
Processing databases
@@ -237,6 +246,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv_bak OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -303,3 +313,5 @@ table_comment
drop table t1, t2;
uninstall plugin blackhole;
uninstall plugin archive;
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
diff --git a/mysql-test/main/mysql_upgrade_noengine.test b/mysql-test/main/mysql_upgrade_noengine.test
index 1d65e7ffa1c..e3c3e718591 100644
--- a/mysql-test/main/mysql_upgrade_noengine.test
+++ b/mysql-test/main/mysql_upgrade_noengine.test
@@ -11,6 +11,9 @@ if (!$HA_ARCHIVE_SO) {
skip Need Archive plugin;
}
+source include/switch_to_mysql_user.inc;
+drop view mysql.user_bak;
+
let $datadir= `select @@datadir`;
install soname 'ha_blackhole';
@@ -33,6 +36,11 @@ exec $MYSQL_UPGRADE 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
+source include/switch_to_mysql_user.inc;
+drop view mysql.user_bak;
+
# pretend it's an upgrade from 10.0
alter table mysql.user drop column default_role, drop column max_statement_time;
@@ -47,6 +55,11 @@ exec $MYSQL_UPGRADE 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
+source include/switch_to_mysql_user.inc;
+drop view mysql.user_bak;
+
alter table mysql.user drop column default_role, drop column max_statement_time;
remove_file $datadir/mysql_upgrade_info;
@@ -60,3 +73,6 @@ drop table t1, t2;
remove_file $datadir/mysql_upgrade_info;
uninstall plugin blackhole;
uninstall plugin archive;
+
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
diff --git a/mysql-test/main/mysql_upgrade_ssl.result b/mysql-test/main/mysql_upgrade_ssl.result
index 6c6d0859016..ff911e9f54b 100644
--- a/mysql-test/main/mysql_upgrade_ssl.result
+++ b/mysql-test/main/mysql_upgrade_ssl.result
@@ -9,6 +9,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -31,9 +32,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
diff --git a/mysql-test/main/mysql_upgrade_view.result b/mysql-test/main/mysql_upgrade_view.result
index 3d885c569bb..d22298c6ed0 100644
--- a/mysql-test/main/mysql_upgrade_view.result
+++ b/mysql-test/main/mysql_upgrade_view.result
@@ -71,6 +71,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -99,7 +100,6 @@ mysql.time_zone_transition_type OK
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-mysql.user OK
Repairing tables
mysql.innodb_index_stats
@@ -113,6 +113,7 @@ Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
+mysql.user OK
test.v1 OK
test.v1badcheck OK
test.v2 OK
@@ -210,7 +211,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
show create view v4;
View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
-MySQL upgrade detected
+MariaDB upgrade detected
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
@@ -220,6 +221,7 @@ mysql.db OK
mysql.ev_bk OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -248,7 +250,6 @@ mysql.time_zone_transition_type OK
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-mysql.user OK
Repairing tables
mysql.innodb_index_stats
@@ -262,6 +263,7 @@ Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views from mysql
+mysql.user OK
test.v1 OK
test.v2 OK
test.v3 OK
@@ -334,7 +336,7 @@ drop view v1,v2,v3,v4;
rename table mysql.event to mysql.ev_bk;
flush tables;
The --upgrade-system-tables option was used, user tables won't be touched.
-MySQL upgrade detected
+MariaDB upgrade detected
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
@@ -344,6 +346,7 @@ mysql.db OK
mysql.ev_bk OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -372,7 +375,6 @@ mysql.time_zone_transition_type OK
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
-mysql.user OK
Repairing tables
mysql.innodb_index_stats
@@ -386,6 +388,7 @@ Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views from mysql
+mysql.user OK
test.v1 OK
test.v2 OK
test.v3 OK
diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result
index 705683322f8..8cf52f5b826 100644
--- a/mysql-test/main/mysqlbinlog_row_compressed.result
+++ b/mysql-test/main/mysqlbinlog_row_compressed.result
@@ -61,7 +61,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
#<date> server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 899
-#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -90,7 +90,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
#<date> server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1214
-#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=11 /* INT meta=0 nullable=0 is_null=0 */
@@ -119,7 +119,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1530
-#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=12 /* INT meta=0 nullable=0 is_null=0 */
@@ -148,7 +148,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1842
-#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
@@ -177,7 +177,7 @@ BEGIN
#Q> INSERT INTO t2 SELECT * FROM t1
#<date> server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2134
-#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F
### INSERT INTO `test`.`t2`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -239,7 +239,7 @@ BEGIN
#Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
#<date> server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2462
-#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 31 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F
### UPDATE `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -320,7 +320,7 @@ BEGIN
#Q> DELETE FROM t1
#<date> server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 2769
-#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -382,7 +382,7 @@ BEGIN
#Q> DELETE FROM t2
#<date> server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 3069
-#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F
+#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F
### DELETE FROM `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result
index a030f202f45..680fd8196a8 100644
--- a/mysql-test/main/mysqlbinlog_row_minimal.result
+++ b/mysql-test/main/mysqlbinlog_row_minimal.result
@@ -59,7 +59,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
#<date> server id 1 end_log_pos 946 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 946
-#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -88,7 +88,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
#<date> server id 1 end_log_pos 1262 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1262
-#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=11 /* INT meta=0 nullable=0 is_null=0 */
@@ -117,7 +117,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1579 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1579
-#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=12 /* INT meta=0 nullable=0 is_null=0 */
@@ -146,7 +146,7 @@ BEGIN
#Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1892 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1892
-#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
@@ -175,7 +175,7 @@ BEGIN
#Q> INSERT INTO t2 SELECT * FROM t1
#<date> server id 1 end_log_pos 2187 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2187
-#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 33 flags: STMT_END_F
### INSERT INTO `test`.`t2`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -237,7 +237,7 @@ BEGIN
#Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
#<date> server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2591
-#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F
### UPDATE `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -273,7 +273,7 @@ BEGIN
#Q> DELETE FROM t1
#<date> server id 1 end_log_pos 2873 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 2873
-#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -303,7 +303,7 @@ BEGIN
#Q> DELETE FROM t2
#<date> server id 1 end_log_pos 3135 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 3135
-#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F
+#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F
### DELETE FROM `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
diff --git a/mysql-test/main/mysqlcheck.result b/mysql-test/main/mysqlcheck.result
index 2b4d4cb5647..063560e388e 100644
--- a/mysql-test/main/mysqlcheck.result
+++ b/mysql-test/main/mysqlcheck.result
@@ -9,6 +9,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -31,7 +32,6 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
mtr.global_suppressions Table is already up to date
mtr.test_suppressions Table is already up to date
mysql.column_stats OK
@@ -39,6 +39,7 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -67,12 +68,12 @@ mysql.time_zone_transition_type OK
mysql.transaction_registry
note : Table does not support optimize, doing recreate + analyze instead
status : OK
-mysql.user OK
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
+mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
@@ -95,12 +96,12 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
-mysql.user OK
mysql.column_stats Table is already up to date
mysql.columns_priv Table is already up to date
mysql.db Table is already up to date
mysql.event Table is already up to date
mysql.func Table is already up to date
+mysql.global_priv Table is already up to date
mysql.gtid_slave_pos Table is already up to date
mysql.help_category Table is already up to date
mysql.help_keyword Table is already up to date
@@ -129,7 +130,6 @@ mysql.time_zone_transition_type Table is already up to date
mysql.transaction_registry
note : Table does not support optimize, doing recreate + analyze instead
status : OK
-mysql.user Table is already up to date
create table t1 (a int) engine=myisam;
create view v1 as select * from t1;
test.t1 OK
@@ -429,6 +429,7 @@ mysql.columns_priv Table is already up to date
mysql.db Table is already up to date
mysql.event Table is already up to date
mysql.func Table is already up to date
+mysql.global_priv Table is already up to date
mysql.gtid_slave_pos Table is already up to date
mysql.help_category Table is already up to date
mysql.help_keyword Table is already up to date
@@ -451,7 +452,6 @@ mysql.time_zone_name Table is already up to date
mysql.time_zone_transition Table is already up to date
mysql.time_zone_transition_type Table is already up to date
mysql.transaction_registry OK
-mysql.user Table is already up to date
mysqltest1.t1
warning : Table is marked as crashed
warning : Size of datafile is: 4 Should be: 0
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index 68ed55c7e60..528ee68fb9c 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -294,6 +294,15 @@ The following specify which files/extra groups are read (specified before remain
--group-concat-max-len=#
The maximum length of the result of function
GROUP_CONCAT()
+ --gtid-cleanup-batch-size=#
+ Normally does not need tuning. How many old rows must
+ accumulate in the mysql.gtid_slave_pos table before a
+ background job will be run to delete them. Can be
+ increased to reduce number of commits if using many
+ different engines with --gtid_pos_auto_engines, or to
+ reduce CPU overhead if using a huge number of different
+ gtid_domain_ids. Can be decreased to reduce number of old
+ rows in the table.
--gtid-domain-id=# Used with global transaction ID to identify logically
independent replication streams. When events can
propagate through multiple parallel paths (for example
@@ -537,6 +546,10 @@ The following specify which files/extra groups are read (specified before remain
The maximum BLOB length to send to server from
mysql_send_long_data API. Deprecated option; use
max_allowed_packet instead.
+ --max-password-errors=#
+ If there is more than this number of failed connect
+ attempts due to invalid password, user will be blocked
+ from further connections until FLUSH_PRIVILEGES.
--max-prepared-stmt-count=#
Maximum number of prepared statements in the server
--max-recursive-iterations[=#]
@@ -1211,7 +1224,8 @@ The following specify which files/extra groups are read (specified before remain
ERROR_FOR_DIVISION_BY_ZERO, TRADITIONAL,
NO_AUTO_CREATE_USER, HIGH_NOT_PRECEDENCE,
NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH,
- EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT
+ EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT,
+ TIME_ROUND_FRACTIONAL
--sql-safe-updates If set to 1, UPDATEs and DELETEs need either a key in the
WHERE clause, or a LIMIT clause, or else they will
aborted. Prevents the common mistake of accidentally
@@ -1350,7 +1364,8 @@ The following specify which files/extra groups are read (specified before remain
(usually get from GUI tools)
--use-stat-tables=name
Specifies how to use system statistics tables. One of:
- NEVER, COMPLEMENTARY, PREFERABLY
+ NEVER, COMPLEMENTARY, PREFERABLY,
+ COMPLEMENTARY_FOR_QUERIES, PREFERABLY_FOR_QUERIES
-u, --user=name Run mysqld daemon as user.
--userstat Enables statistics gathering for USER_STATISTICS,
CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
@@ -1415,7 +1430,7 @@ encrypt-binlog FALSE
encrypt-tmp-disk-tables FALSE
encrypt-tmp-files FALSE
enforce-storage-engine (No default value)
-eq-range-index-dive-limit 0
+eq-range-index-dive-limit 10
event-scheduler OFF
expensive-subquery-limit 100
expire-logs-days 0
@@ -1435,6 +1450,7 @@ gdb FALSE
general-log FALSE
getopt-prefix-matching FALSE
group-concat-max-len 1048576
+gtid-cleanup-batch-size 64
gtid-domain-id 0
gtid-ignore-duplicates FALSE
gtid-pos-auto-engines
@@ -1508,6 +1524,7 @@ max-heap-table-size 16777216
max-join-size 18446744073709551615
max-length-for-sort-data 1024
max-long-data-size 16777216
+max-password-errors 18446744073709551615
max-prepared-stmt-count 16382
max-recursive-iterations 18446744073709551615
max-relay-log-size 1073741824
@@ -1549,7 +1566,7 @@ optimizer-prune-level 1
optimizer-search-depth 62
optimizer-selectivity-sampling-limit 100
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on
-optimizer-use-condition-selectivity 1
+optimizer-use-condition-selectivity 4
performance-schema FALSE
performance-schema-accounts-size -1
performance-schema-consumer-events-stages-current FALSE
@@ -1586,7 +1603,7 @@ performance-schema-max-rwlock-instances -1
performance-schema-max-socket-classes 10
performance-schema-max-socket-instances -1
performance-schema-max-stage-classes 160
-performance-schema-max-statement-classes 200
+performance-schema-max-statement-classes 202
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
performance-schema-max-thread-classes 50
@@ -1715,7 +1732,7 @@ transaction-isolation REPEATABLE-READ
transaction-prealloc-size 4096
transaction-read-only FALSE
updatable-views-with-limit YES
-use-stat-tables NEVER
+use-stat-tables PREFERABLY_FOR_QUERIES
userstat FALSE
verbose TRUE
wait-timeout 28800
diff --git a/mysql-test/main/mysqld_option_err.test b/mysql-test/main/mysqld_option_err.test
index 0c38eba7ca9..e9655fd4bfe 100644
--- a/mysql-test/main/mysqld_option_err.test
+++ b/mysql-test/main/mysqld_option_err.test
@@ -56,4 +56,6 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err;
--error 2
--exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+rmdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err;
+
--echo Done.
diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result
index 28b37eb6644..c40aa271465 100644
--- a/mysql-test/main/mysqldump.result
+++ b/mysql-test/main/mysqldump.result
@@ -4335,13 +4335,12 @@ second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL E
show create event ee1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci
-create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
-Warnings:
-Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation
+create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
drop database second;
create database third;
@@ -4349,6 +4348,7 @@ use third;
show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
drop database third;
set time_zone = 'SYSTEM';
diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test
index 57462fcf2e2..e2d9cc74d32 100644
--- a/mysql-test/main/mysqldump.test
+++ b/mysql-test/main/mysqldump.test
@@ -1810,7 +1810,7 @@ show create event ee1;
## prove three works (with spaces and tabs on the end)
# start with one from the previous restore
-create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
+create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
show events;
--exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
diff --git a/mysql-test/main/not_embedded_server.result b/mysql-test/main/not_embedded_server.result
index ba68ca8619b..bc794ce48c8 100644
--- a/mysql-test/main/not_embedded_server.result
+++ b/mysql-test/main/not_embedded_server.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES");
+call mtr.add_suppression("Can't open and lock privilege tables: Table 'db' was not locked with LOCK TABLES");
SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors OFF
@@ -16,7 +16,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT);
LOCK TABLES t1 READ;
FLUSH PRIVILEGES;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'db' was not locked with LOCK TABLES
UNLOCK TABLES;
DROP TABLE t1;
#
diff --git a/mysql-test/main/not_embedded_server.test b/mysql-test/main/not_embedded_server.test
index b2cbdba6850..20f75db25d5 100644
--- a/mysql-test/main/not_embedded_server.test
+++ b/mysql-test/main/not_embedded_server.test
@@ -6,7 +6,7 @@
# End of 4.1 tests
-call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES");
+call mtr.add_suppression("Can't open and lock privilege tables: Table 'db' was not locked with LOCK TABLES");
#
# Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors
diff --git a/mysql-test/main/null_key.result b/mysql-test/main/null_key.result
index 525a12100e5..8eca97d5e70 100644
--- a/mysql-test/main/null_key.result
+++ b/mysql-test/main/null_key.result
@@ -405,8 +405,11 @@ INSERT INTO t3 SELECT * FROM t4;
INSERT INTO t3 VALUES (2), (3);
ANALYZE table t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SELECT COUNT(*) FROM t3;
COUNT(*)
diff --git a/mysql-test/main/old-mode.result b/mysql-test/main/old-mode.result
index 73ad613048a..e0a3412bbdf 100644
--- a/mysql-test/main/old-mode.result
+++ b/mysql-test/main/old-mode.result
@@ -180,3 +180,44 @@ a unix_timestamp(a)
2010-10-31 02:25:26 1288481126
drop table t1, t2;
set time_zone=DEFAULT;
+#
+# MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+#
+SET global mysql56_temporal_format=false;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP(0));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1;
+a COALESCE(a) UNIX_TIMESTAMP(a)
+2010-10-31 02:25:26 2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:25 2010-10-31 02:25:25 1288481125
+SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1;
+MIN(a) a
+2010-10-31 02:25:26 1288477526
+SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
+MAX(a) a
+2010-10-31 02:25:25 1288481125
+SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a;
+a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a)
+2010-10-31 02:25:26 1288477526 2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:25 1288481125 2010-10-31 02:25:25 1288481125
+ALTER TABLE t1 MODIFY a TIMESTAMP(1);
+SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1;
+a COALESCE(a) UNIX_TIMESTAMP(a)
+2010-10-31 02:25:26.0 2010-10-31 02:25:26.0 1288477526.0
+2010-10-31 02:25:25.0 2010-10-31 02:25:25.0 1288481125.0
+SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1;
+MIN(a) a
+2010-10-31 02:25:26.0 1288477526.0
+SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
+MAX(a) a
+2010-10-31 02:25:25.0 1288481125.0
+SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a;
+a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a)
+2010-10-31 02:25:26.0 1288477526.0 2010-10-31 02:25:26.0 1288477526.0
+2010-10-31 02:25:25.0 1288481125.0 2010-10-31 02:25:25.0 1288481125.0
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+SET global mysql56_temporal_format=true;
diff --git a/mysql-test/main/old-mode.test b/mysql-test/main/old-mode.test
index d7e8ce8ee55..7ec2092009b 100644
--- a/mysql-test/main/old-mode.test
+++ b/mysql-test/main/old-mode.test
@@ -119,3 +119,32 @@ insert t2 select a from t1;
select a, unix_timestamp(a) from t2;
drop table t1, t2;
set time_zone=DEFAULT;
+
+
+--echo #
+--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+--echo #
+
+# This tests:
+# Field_timestamp::val_native()
+# Field_timestamp_hires::val_native()
+# Type_handler_timestamp_common::type_handler_for_native_format()
+
+SET global mysql56_temporal_format=false;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP(0));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1;
+SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1;
+SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
+SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a;
+ALTER TABLE t1 MODIFY a TIMESTAMP(1);
+SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1;
+SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1;
+SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
+SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+SET global mysql56_temporal_format=true;
diff --git a/mysql-test/main/openssl_1.result b/mysql-test/main/openssl_1.result
index 3f0483b1e64..96b1895d57b 100644
--- a/mysql-test/main/openssl_1.result
+++ b/mysql-test/main/openssl_1.result
@@ -4,52 +4,38 @@ drop table if exists t1;
create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
-grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
-grant select on test.* to ssl_user4@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB";
-grant select on test.* to ssl_user5@localhost require cipher "AES256-SHA" AND SUBJECT "xxx";
+grant select on test.* to ssl_user3@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
+grant select on test.* to ssl_user4@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB";
+grant select on test.* to ssl_user5@localhost require SUBJECT "xxx";
flush privileges;
-connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA;
-connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET);
-connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA;
-ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO)
-connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA;
-connect con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA;
-connect con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA;
+connect con1,localhost,ssl_user1,,,,,SSL;
+connect con3,localhost,ssl_user3,,,,,SSL;
+connect con4,localhost,ssl_user4,,,,,SSL;
connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET);
-connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA;
+connect con5,localhost,ssl_user5,,,,,SSL;
ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO)
connection con1;
-SHOW STATUS LIKE 'Ssl_cipher';
-Variable_name Value
-Ssl_cipher AES256-SHA
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
+have_ssl
+1
select * from t1;
f1
5
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1'
-connection con2;
-SHOW STATUS LIKE 'Ssl_cipher';
-Variable_name Value
-Ssl_cipher AES256-SHA
-select * from t1;
-f1
-5
-delete from t1;
-ERROR 42000: DELETE command denied to user 'ssl_user2'@'localhost' for table 't1'
connection con3;
-SHOW STATUS LIKE 'Ssl_cipher';
-Variable_name Value
-Ssl_cipher AES256-SHA
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
+have_ssl
+1
select * from t1;
f1
5
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1'
connection con4;
-SHOW STATUS LIKE 'Ssl_cipher';
-Variable_name Value
-Ssl_cipher AES256-SHA
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
+have_ssl
+1
select * from t1;
f1
5
@@ -57,20 +43,15 @@ delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1'
connection default;
disconnect con1;
-disconnect con2;
disconnect con3;
disconnect con4;
-drop user ssl_user1@localhost, ssl_user2@localhost,
-ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
+drop user ssl_user1@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
drop table t1;
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
-SHOW STATUS LIKE 'Ssl_cipher';
-Variable_name Value
-Ssl_cipher AES256-SHA
have_ssl
1
End of 5.0 tests
@@ -94,13 +75,7 @@ SSL_ACCEPTS #
SSL_CALLBACK_CACHE_HITS #
DROP TABLE thread_status;
SET GLOBAL event_scheduler=0;
-SHOW STATUS LIKE 'Ssl_cipher';
-Variable_name Value
-Ssl_cipher AES128-SHA
-SHOW STATUS LIKE 'Ssl_cipher';
-Variable_name Value
-Ssl_cipher AES128-SHA
-mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxxCREATE TABLE t1(a int);
+CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@@ -204,19 +179,12 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-mysqldump: Got error: 2026: SSL connection error: xxxx
+mysqldump: Got error: 2026: "SSL connection error: xxxx
DROP TABLE t1;
-Variable_name Value
-Ssl_cipher AES256-SHA
-Variable_name Value
-Ssl_cipher AES128-SHA
-select 'is still running; no cipher request crashed the server' as result from dual;
-result
-is still running; no cipher request crashed the server
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES;
connect con1,localhost,bug42158,,,,,SSL;
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl
1
disconnect con1;
diff --git a/mysql-test/main/openssl_1.test b/mysql-test/main/openssl_1.test
index dce4f88b6bb..27eeb0198b1 100644
--- a/mysql-test/main/openssl_1.test
+++ b/mysql-test/main/openssl_1.test
@@ -19,58 +19,45 @@ create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
-grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
-grant select on test.* to ssl_user4@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB";
-grant select on test.* to ssl_user5@localhost require cipher "AES256-SHA" AND SUBJECT "xxx";
+grant select on test.* to ssl_user3@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
+grant select on test.* to ssl_user4@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB";
+grant select on test.* to ssl_user5@localhost require SUBJECT "xxx";
flush privileges;
-connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA);
+connect (con1,localhost,ssl_user1,,,,,SSL);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA);
-connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA);
-connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA);
-connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA);
+connect (con3,localhost,ssl_user3,,,,,SSL);
+connect (con4,localhost,ssl_user4,,,,,SSL);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR
-connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA);
+connect (con5,localhost,ssl_user5,,,,,SSL);
connection con1;
# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
-select * from t1;
---error ER_TABLEACCESS_DENIED_ERROR
-delete from t1;
-
-connection con2;
-# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
select * from t1;
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con3;
# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
select * from t1;
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con4;
# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
select * from t1;
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection default;
disconnect con1;
-disconnect con2;
disconnect con3;
disconnect con4;
-drop user ssl_user1@localhost, ssl_user2@localhost,
-ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
+drop user ssl_user1@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
drop table t1;
@@ -124,21 +111,13 @@ drop table t1;
--echo
#
-# Bug#21611 Slave can't connect when master-ssl-cipher specified
-# - Apparently selecting a cipher doesn't work at all
-# - Use a cipher that both yaSSL and OpenSSL supports
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
---exec $MYSQL_TEST --ssl-cipher=AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-#
# Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23
#
# Test that we can open encrypted connection to server without
# verification of servers certificate by setting both ca certificate
# and ca path to NULL
#
---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1
+--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1
--echo End of 5.0 tests
#
@@ -180,25 +159,6 @@ DROP TABLE thread_status;
SET GLOBAL event_scheduler=0;
#
-# Test to connect using a list of ciphers
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
---exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER:AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-
-# Test to connect using a specifi cipher
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
---exec $MYSQL_TEST --ssl-cipher=AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-# Test to connect using an unknown cipher
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit" > $MYSQLTEST_VARDIR/tmp/test.sql
---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
---error 1
---exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-#
# Bug#27669 mysqldump: SSL connection error when trying to connect
#
@@ -214,7 +174,7 @@ INSERT INTO t1 VALUES (1), (2);
# With wrong parameters
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump
---replace_regex /\"SSL connection error.*/SSL connection error: xxxx/
+--replace_regex /SSL connection error.*/SSL connection error: xxxx/
--error 2
--exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
--echo
@@ -222,36 +182,13 @@ DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/test.sql
#
-# Bug#39172 Asking for DH+non-RSA key with server set to use other key caused
-# YaSSL to crash the server.
-#
-
-# Common ciphers to openssl and yassl
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES128-SHA
---disable_query_log
---disable_result_log
-
-# Below here caused crashes. ################
---error 1,0
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST
-# These probably exist but the server's keys can't be used to accept these kinds of connections.
---error 1,0
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=AES128-RMD
-
-# If this gives a result, then the bug is fixed.
---enable_result_log
---enable_query_log
-select 'is still running; no cipher request crashed the server' as result from dual;
-
-#
# Bug#42158: leak: SSL_get_peer_certificate() doesn't have matching X509_free()
#
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES;
connect(con1,localhost,bug42158,,,,,SSL);
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
+SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
disconnect con1;
connection default;
DROP USER bug42158@localhost;
diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result
index 6e1518f327c..f5bae1c85a4 100644
--- a/mysql-test/main/order_by.result
+++ b/mysql-test/main/order_by.result
@@ -3329,3 +3329,40 @@ Warnings:
Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id`
set optimizer_switch= @save_optimizer_switch;
DROP TABLE books, wings;
+#
+# MDEV-17761: Odd optimizer choice with ORDER BY LIMIT and condition selectivity
+#
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2(a int);
+insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C;
+create table t3(a int);
+insert into t3 select A.a + 1000 *B.a from t2 A, t1 B;
+create table t4 (
+a int,
+b int,
+c int,
+filler1 char(255),
+filler2 char(255),
+key(a)
+);
+insert into t4 select a,a,a, a,a from t3;
+set @tmp_h=@@histogram_size, @tmp_u=@@use_stat_tables,
+@tmp_o=@@optimizer_use_condition_selectivity;
+set histogram_size=100;
+set use_stat_tables=preferably;
+set optimizer_use_condition_selectivity=4;
+analyze table t4 persistent for columns(b) indexes ();
+Table Op Msg_type Msg_text
+test.t4 analyze status Engine-independent statistics collected
+test.t4 analyze status Table is already up to date
+# rows must be around 1200, not 600:
+explain extended
+select * from t4 where b < 5000 order by a limit 600;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 index NULL a 5 NULL 1188 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`filler1` AS `filler1`,`test`.`t4`.`filler2` AS `filler2` from `test`.`t4` where `test`.`t4`.`b` < 5000 order by `test`.`t4`.`a` limit 600
+set histogram_size=@tmp_h, use_stat_tables=@tmp_u,
+optimizer_use_condition_selectivity=@tmp_o;
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test
index e0c00aee583..f639f2fdc60 100644
--- a/mysql-test/main/order_by.test
+++ b/mysql-test/main/order_by.test
@@ -2188,3 +2188,40 @@ eval explain extended $q;
set optimizer_switch= @save_optimizer_switch;
DROP TABLE books, wings;
+
+--echo #
+--echo # MDEV-17761: Odd optimizer choice with ORDER BY LIMIT and condition selectivity
+--echo #
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2(a int);
+insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C;
+create table t3(a int);
+insert into t3 select A.a + 1000 *B.a from t2 A, t1 B;
+
+create table t4 (
+ a int,
+ b int,
+ c int,
+ filler1 char(255),
+ filler2 char(255),
+ key(a)
+);
+insert into t4 select a,a,a, a,a from t3;
+
+set @tmp_h=@@histogram_size, @tmp_u=@@use_stat_tables,
+ @tmp_o=@@optimizer_use_condition_selectivity;
+set histogram_size=100;
+set use_stat_tables=preferably;
+set optimizer_use_condition_selectivity=4;
+analyze table t4 persistent for columns(b) indexes ();
+
+--echo # rows must be around 1200, not 600:
+explain extended
+select * from t4 where b < 5000 order by a limit 600;
+
+set histogram_size=@tmp_h, use_stat_tables=@tmp_u,
+ optimizer_use_condition_selectivity=@tmp_o;
+
+drop table t1,t2,t3,t4;
+
diff --git a/mysql-test/main/outfile_loaddata.result b/mysql-test/main/outfile_loaddata.result
index 0ea692f3ab5..4356f8b113e 100644
--- a/mysql-test/main/outfile_loaddata.result
+++ b/mysql-test/main/outfile_loaddata.result
@@ -211,7 +211,7 @@ a b c
# latin1 charset (INTO OUTFILE warning is expected):
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET latin1 FROM t1;
Warnings:
-Warning 1366 Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 1
+Warning 1366 Data truncated for column 'b' at row 1
##################################################
1 ABC-??? DEF-ÂÃÄ
2 \N \N
@@ -226,7 +226,7 @@ a b c
# KOI8-R charset (INTO OUTFILE warning is expected):
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET koi8r FROM t1;
Warnings:
-Warning 1366 Incorrect string value: '\xC2\xC3\xC4' for column 'c' at row 1
+Warning 1366 Data truncated for column 'c' at row 1
##################################################
1 ABC-áâ÷ DEF-???
2 \N \N
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index 4a3a9ed2380..34c119a322e 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1704,4 +1704,69 @@ SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
(SELECT
1
+#
+# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
+#
+CREATE TABLE names (names INT);
+SELECT names FROM names AS names;
+names
+DROP TABLE names;
+CREATE TABLE password (password INT);
+SELECT password FROM password AS password;
+password
+DROP TABLE password;
+CREATE TABLE role (role INT);
+SELECT role FROM role AS role;
+role
+DROP TABLE role;
+BEGIN NOT ATOMIC
+DECLARE names VARCHAR(32) DEFAULT '[names]';
+DECLARE password VARCHAR(32) DEFAULT '[password]';
+DECLARE role VARCHAR(32) DEFAULT '[role]';
+names:
+LOOP
+SELECT names;
+LEAVE names;
+END LOOP;
+password:
+LOOP
+SELECT password;
+LEAVE password;
+END LOOP;
+role:
+LOOP
+SELECT role;
+LEAVE role;
+END LOOP;
+END;
+$$
+names
+[names]
+password
+[password]
+role
+[role]
+BEGIN NOT ATOMIC
+DECLARE names VARCHAR(32);
+SET names='[names]';
+END;
+$$
+ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
+BEGIN NOT ATOMIC
+DECLARE password VARCHAR(32);
+SET password='[password]';
+END;
+$$
+ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
+BEGIN NOT ATOMIC
+DECLARE role VARCHAR(32);
+SET role='[role]';
+END;
+$$
+SELECT @@GLOBAL.names;
+ERROR HY000: Unknown system variable 'names'
+SELECT @@GLOBAL.password;
+ERROR HY000: Unknown system variable 'password'
+SELECT @@GLOBAL.role;
+ERROR HY000: Unknown system variable 'role'
End of 10.3 tests
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index 1806816ca5d..3a7c4f6467e 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1462,4 +1462,78 @@ DROP PROCEDURE p1;
(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
+
+--echo #
+--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
+--echo #
+
+CREATE TABLE names (names INT);
+SELECT names FROM names AS names;
+DROP TABLE names;
+
+CREATE TABLE password (password INT);
+SELECT password FROM password AS password;
+DROP TABLE password;
+
+CREATE TABLE role (role INT);
+SELECT role FROM role AS role;
+DROP TABLE role;
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE names VARCHAR(32) DEFAULT '[names]';
+ DECLARE password VARCHAR(32) DEFAULT '[password]';
+ DECLARE role VARCHAR(32) DEFAULT '[role]';
+names:
+ LOOP
+ SELECT names;
+ LEAVE names;
+ END LOOP;
+password:
+ LOOP
+ SELECT password;
+ LEAVE password;
+ END LOOP;
+role:
+ LOOP
+ SELECT role;
+ LEAVE role;
+ END LOOP;
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+--error ER_SP_BAD_VAR_SHADOW
+BEGIN NOT ATOMIC
+ DECLARE names VARCHAR(32);
+ SET names='[names]';
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+--error ER_SP_BAD_VAR_SHADOW
+BEGIN NOT ATOMIC
+ DECLARE password VARCHAR(32);
+ SET password='[password]';
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE role VARCHAR(32);
+ SET role='[role]';
+END;
+$$
+DELIMITER ;$$
+
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.names;
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.password;
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.role;
+
--echo End of 10.3 tests
diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result
index 680b0a953d1..16a7ff6b564 100644
--- a/mysql-test/main/partition.result
+++ b/mysql-test/main/partition.result
@@ -286,6 +286,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 1 a 1 a A NULL NULL NULL YES BTREE
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -1029,6 +1030,7 @@ PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
drop table t1;
create table t1
@@ -1824,6 +1826,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze note The storage engine for the table doesn't support analyze
drop table t1;
drop procedure if exists mysqltest_1;
@@ -2060,6 +2063,7 @@ ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXTENDED' at line 1
ALTER TABLE t1 ANALYZE PARTITION p1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 CHECK PARTITION p1;
Table Op Msg_type Msg_text
@@ -2649,6 +2653,106 @@ Note 1517 Duplicate partition name p2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
#
+# MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+create table t2 (
+part_key int,
+a int,
+b int
+) partition by list(part_key) (
+partition p0 values in (0),
+partition p1 values in (1),
+partition p2 values in (2),
+partition p3 values in (3),
+partition p4 values in (4)
+);
+insert into t2
+select mod(a,5), a/100, mod(a,5) from t1;
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+#
+# Tests using stats provided by the storage engine
+#
+explain extended select * from t2 where part_key=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1
+explain partitions select * from t2 where part_key=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where
+explain extended select * from t2 where part_key in (1,2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2)
+explain partitions select * from t2 where part_key in (1,2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where
+explain extended select * from t2 where b=5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5
+explain partitions select * from t2 where b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where
+explain extended select * from t2 partition(p0) where b=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1
+set @save_histogram_size=@@histogram_size;
+set @@histogram_size=100;
+set @@use_stat_tables= PREFERABLY;
+set @@optimizer_use_condition_selectivity=4;
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+#
+# Tests using EITS
+#
+# filtered should be 100
+explain extended select * from t2 where part_key=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1
+explain partitions select * from t2 where part_key=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where
+# filtered should be 100
+explain extended select * from t2 where part_key in (1,2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2)
+explain partitions select * from t2 where part_key in (1,2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where
+explain extended select * from t2 where b=5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 19.80 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5
+explain partitions select * from t2 where b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where
+explain extended select * from t2 partition(p0) where b=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 19.80 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set @@histogram_size= @save_histogram_size;
+drop table t0,t1,t2;
+#
# End of 10.0 tests
#
#
diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test
index 7b7d1457426..42929796f6b 100644
--- a/mysql-test/main/partition.test
+++ b/mysql-test/main/partition.test
@@ -2901,6 +2901,68 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo #
+--echo # MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY
+--echo #
+
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1(a int);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+
+
+create table t2 (
+ part_key int,
+ a int,
+ b int
+) partition by list(part_key) (
+ partition p0 values in (0),
+ partition p1 values in (1),
+ partition p2 values in (2),
+ partition p3 values in (3),
+ partition p4 values in (4)
+);
+insert into t2
+select mod(a,5), a/100, mod(a,5) from t1;
+
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+--echo #
+--echo # Tests using stats provided by the storage engine
+--echo #
+explain extended select * from t2 where part_key=1;
+explain partitions select * from t2 where part_key=1;
+explain extended select * from t2 where part_key in (1,2);
+explain partitions select * from t2 where part_key in (1,2);
+explain extended select * from t2 where b=5;
+explain partitions select * from t2 where b=5;
+explain extended select * from t2 partition(p0) where b=1;
+
+
+set @save_histogram_size=@@histogram_size;
+set @@histogram_size=100;
+set @@use_stat_tables= PREFERABLY;
+set @@optimizer_use_condition_selectivity=4;
+analyze table t2;
+--echo #
+--echo # Tests using EITS
+--echo #
+--echo # filtered should be 100
+explain extended select * from t2 where part_key=1;
+explain partitions select * from t2 where part_key=1;
+--echo # filtered should be 100
+explain extended select * from t2 where part_key in (1,2);
+explain partitions select * from t2 where part_key in (1,2);
+explain extended select * from t2 where b=5;
+explain partitions select * from t2 where b=5;
+explain extended select * from t2 partition(p0) where b=1;
+
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set @@histogram_size= @save_histogram_size;
+drop table t0,t1,t2;
+
+--echo #
--echo # End of 10.0 tests
--echo #
diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test
index 62a3e1c0777..91ae67e2f7b 100644
--- a/mysql-test/main/partition_alter.test
+++ b/mysql-test/main/partition_alter.test
@@ -79,7 +79,6 @@ partition p1 values less than ('2016-10-18'),
partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10);
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CONSTRAINT_FAILED
alter table t1 add check (b in (0, 1));
alter table t1 add check (b in (0, 10));
@@ -96,7 +95,6 @@ partition p1 values less than ('2016-10-18'),
partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10);
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CONSTRAINT_FAILED
alter table t1 add check (b in (0, 1));
alter table t1 add check (b in (0, 10));
diff --git a/mysql-test/main/partition_binlog.result b/mysql-test/main/partition_binlog.result
index 21eca8f1c00..3e6100b51d8 100644
--- a/mysql-test/main/partition_binlog.result
+++ b/mysql-test/main/partition_binlog.result
@@ -27,6 +27,7 @@ Table Op Msg_type Msg_text
test.t1 repair error Error in list of partitions to test.t1
ALTER TABLE t1 ANALYZE PARTITION p0;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 CHECK PARTITION p0;
Table Op Msg_type Msg_text
diff --git a/mysql-test/main/partition_explicit_prune.result b/mysql-test/main/partition_explicit_prune.result
index 8780c75eba4..9c1174c5414 100644
--- a/mysql-test/main/partition_explicit_prune.result
+++ b/mysql-test/main/partition_explicit_prune.result
@@ -233,6 +233,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
+HANDLER_READ_KEY 6
HANDLER_TMP_WRITE 24
HANDLER_WRITE 2
# Should be 1 commit
@@ -315,6 +316,7 @@ a b
1000 `p100-99999`(-subp6)
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata;
SET @@global.innodb_stats_on_metadata=ON;
@@ -348,6 +350,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 1
+HANDLER_READ_KEY 6
HANDLER_TMP_WRITE 24
# Should be 1 commit
# 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock)
@@ -1058,6 +1061,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 5
+HANDLER_READ_KEY 6
HANDLER_READ_NEXT 5
HANDLER_TMP_WRITE 24
HANDLER_WRITE 10
@@ -1077,6 +1081,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_READ_FIRST 5
+HANDLER_READ_KEY 6
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 1
@@ -1104,6 +1109,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 5
+HANDLER_READ_KEY 6
HANDLER_READ_NEXT 5
HANDLER_TMP_WRITE 24
HANDLER_WRITE 10
diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result
index 46353c63ce3..ed79bbbe48d 100644
--- a/mysql-test/main/partition_innodb.result
+++ b/mysql-test/main/partition_innodb.result
@@ -34,6 +34,7 @@ INSERT INTO t1 SELECT a + 120, b FROM t1 WHERE a >= 0;
INSERT INTO t1 SELECT a + 240, b FROM t1 WHERE a >= 0;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
id select_type table type possible_keys key key_len ref rows Extra
@@ -909,6 +910,35 @@ ERROR HY000: Table definition has changed, please retry transaction
disconnect con1;
DROP TABLE t1;
#
+# MDEV-11167: InnoDB: Warning: using a partial-field key prefix
+# in search, results in assertion failure or "Can't find record" error
+#
+set @save_sql_mode = @@sql_mode;
+set sql_mode="";
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2;
+CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION;
+INSERT INTO t1 VALUES (1),(2);
+INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4);
+Warnings:
+Warning 1366 Incorrect integer value: 'three' for column `test`.`t2`.`b` at row 2
+UPDATE v SET a = NULL;
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'foo'
+DROP view v;
+DROP TABLE t1, t2;
+SET @save_isp=@@innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent= ON;
+CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2;
+INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66);
+CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION;
+UPDATE v SET f2 = NULL;
+ERROR 44000: CHECK OPTION failed `test`.`v`
+SET GLOBAL innodb_stats_persistent= @save_isp;
+DROP view v;
+DROP TABLE t;
+set sql_mode= @save_sql_mode;
+#
# Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
# MYSQL.INNODB_TABLE_STATS
#
@@ -938,3 +968,37 @@ DROP DATABASE test_jfg;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
+create table t1 (a int) engine=innodb;
+create table t2 (
+b int,
+c int,
+d bit not null default 0,
+v bit as (d) virtual,
+key (b,v)
+) engine=innodb partition by hash (b);
+insert into t1 values (1),(2);
+insert into t2 (b,c,d) values (1,1,0),(2,2,0);
+explain select t1.* from t1 join t2 on (v = a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+select t1.* from t1 join t2 on (v = a);
+a
+drop table t1, t2;
+#
+# End of 10.2 tests
+#
+#
+# MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z))
+WITH SYSTEM VERSIONING
+PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
+INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL);
+SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
+COUNT(*)
+2
+DROP TABLE t1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test
index a8bbb7ceed5..e09a2b4f9d3 100644
--- a/mysql-test/main/partition_innodb.test
+++ b/mysql-test/main/partition_innodb.test
@@ -1001,6 +1001,38 @@ SELECT b FROM t1 WHERE b = 0;
DROP TABLE t1;
--echo #
+--echo # MDEV-11167: InnoDB: Warning: using a partial-field key prefix
+--echo # in search, results in assertion failure or "Can't find record" error
+--echo #
+
+set @save_sql_mode = @@sql_mode;
+set sql_mode="";
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2;
+CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION;
+
+INSERT INTO t1 VALUES (1),(2);
+INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4);
+UPDATE v SET a = NULL;
+
+DROP view v;
+DROP TABLE t1, t2;
+
+SET @save_isp=@@innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent= ON;
+
+CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2;
+INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66);
+CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION;
+--error ER_VIEW_CHECK_FAILED
+UPDATE v SET f2 = NULL;
+
+SET GLOBAL innodb_stats_persistent= @save_isp;
+DROP view v;
+DROP TABLE t;
+set sql_mode= @save_sql_mode;
+
+--echo #
--echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
--echo # MYSQL.INNODB_TABLE_STATS
--echo #
@@ -1031,3 +1063,37 @@ DROP DATABASE test_jfg;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
+#
+# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column
+#
+create table t1 (a int) engine=innodb;
+create table t2 (
+ b int,
+ c int,
+ d bit not null default 0,
+ v bit as (d) virtual,
+ key (b,v)
+) engine=innodb partition by hash (b);
+insert into t1 values (1),(2);
+insert into t2 (b,c,d) values (1,1,0),(2,2,0);
+explain select t1.* from t1 join t2 on (v = a);
+select t1.* from t1 join t2 on (v = a);
+drop table t1, t2;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
+--echo #
+CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z))
+WITH SYSTEM VERSIONING
+PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
+INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL);
+SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/perror-win.result b/mysql-test/main/perror-win.result
index 139b566757f..0e9d2e48a99 100644
--- a/mysql-test/main/perror-win.result
+++ b/mysql-test/main/perror-win.result
@@ -1,7 +1,7 @@
-MySQL error code 150: Foreign key constraint is incorrectly formed
+MariaDB error code 150: Foreign key constraint is incorrectly formed
Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
OS error code 23: Too many open files in system
Win32 error code 23: Data error (cyclic redundancy check).
-MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
+MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
Win32 error code 1062: The service has not been started.
Illegal error code: 30000
diff --git a/mysql-test/main/perror.result b/mysql-test/main/perror.result
index 46554442721..ad2106524e5 100644
--- a/mysql-test/main/perror.result
+++ b/mysql-test/main/perror.result
@@ -1,6 +1,6 @@
Illegal error code: 10000
-MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
-MySQL error code 1408 (ER_STARTUP): %s: ready for connections.
+MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
+MariaDB error code 1408 (ER_STARTUP): %s: ready for connections.
Version: '%s' socket: '%s' port: %d %s
-MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it!
-MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u)
+MariaDB error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it!
+MariaDB error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u)
diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result
index 38a03920039..fde2550ad81 100644
--- a/mysql-test/main/plugin.result
+++ b/mysql-test/main/plugin.result
@@ -12,7 +12,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.13
+PLUGIN_LIBRARY_VERSION 1.14
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
@@ -25,7 +25,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE DAEMON
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.13
+PLUGIN_LIBRARY_VERSION 1.14
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Unusable Daemon
PLUGIN_LICENSE GPL
@@ -64,7 +64,7 @@ PLUGIN_STATUS DELETED
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.13
+PLUGIN_LIBRARY_VERSION 1.14
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
diff --git a/mysql-test/main/plugin_auth.result b/mysql-test/main/plugin_auth.result
index 899e0292142..7c3d029ad7d 100644
--- a/mysql-test/main/plugin_auth.result
+++ b/mysql-test/main/plugin_auth.result
@@ -362,6 +362,7 @@ uplain@localhost uplain@localhost
connection default;
disconnect cleartext_con;
DROP USER uplain@localhost;
+drop view mysql.user_bak;
#
# Bug #59038 : mysql.user.authentication_string column
# causes configuration wizard to fail
@@ -443,6 +444,8 @@ ORDER BY COLUMN_NAME;
IS_NULLABLE COLUMN_NAME
NO authentication_string
NO plugin
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
#
# Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN
# .-> USING PASSWORD: NO
diff --git a/mysql-test/main/plugin_auth.test b/mysql-test/main/plugin_auth.test
index c3c18b7e427..9af8f25d153 100644
--- a/mysql-test/main/plugin_auth.test
+++ b/mysql-test/main/plugin_auth.test
@@ -445,6 +445,10 @@ connection default;
disconnect cleartext_con;
DROP USER uplain@localhost;
+# prepare for two tests that use mysql.user table
+source include/switch_to_mysql_user.inc;
+drop view mysql.user_bak;
+
--echo #
--echo # Bug #59038 : mysql.user.authentication_string column
--echo # causes configuration wizard to fail
@@ -502,7 +506,6 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_SCHEMA='mysql'
ORDER BY COLUMN_NAME;
-
--echo #
--echo # Bug #11936829: diff. between mysql.user (authentication_string)
--echo # in fresh and upgraded 5.5.11
@@ -524,7 +527,8 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
ORDER BY COLUMN_NAME;
let $datadir= `select @@datadir`;
remove_file $datadir/mysql_upgrade_info;
-
+drop table mysql.global_priv;
+rename table mysql.global_priv_bak to mysql.global_priv;
--echo #
--echo # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN
diff --git a/mysql-test/main/plugin_auth_qa.result b/mysql-test/main/plugin_auth_qa.result
index 2353bc80f84..e00ac1a4c96 100644
--- a/mysql-test/main/plugin_auth_qa.result
+++ b/mysql-test/main/plugin_auth_qa.result
@@ -1,38 +1,38 @@
set sql_mode="";
CREATE DATABASE test_user_db;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
========== test 1.1 ======================================================
CREATE USER plug IDENTIFIED WITH test_plugin_server;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server
REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
DROP USER plug;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server
REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
DROP USER plug;
CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server
REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
DROP USER plug;
@@ -100,62 +100,62 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
========== test 1.1.1.6/1.1.2.5 ============================
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug, plug_dest;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
DROP USER plug;
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug_dest;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug, plug_dest;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
DROP USER plug;
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug_dest;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug, plug_dest;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plug_dest
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug_dest;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
@@ -170,12 +170,12 @@ ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
DROP USER plug;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
+User plugin authentication_string Password
plug test_plugin_server plug_dest
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
-plug mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
+User plugin authentication_string Password
+plug mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
@@ -184,18 +184,18 @@ DROP USER plug;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
+User plugin authentication_string Password
plug test_plugin_server plug_dest
plug_dest test_plugin_server plug_dest
DROP USER plug,plug_dest;
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
+User plugin authentication_string Password
plug test_plugin_server plug_dest
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
+User plugin authentication_string Password
plug test_plugin_server plug_dest
plug_dest test_plugin_server plug_dest
DROP USER plug,plug_dest;
@@ -203,23 +203,23 @@ DROP USER plug,plug_dest;
SET NAMES utf8;
CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plüg test_plugin_server plüg_dest
DROP USER plüg;
CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plüg_dest;
SET NAMES ascii;
CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
pl??g test_plugin_server pl??g_dest
DROP USER 'plüg';
CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
pl??g_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER 'plüg_dest';
SET NAMES latin1;
@@ -228,12 +228,12 @@ CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
ERROR HY000: Plugin 'test_plügin_server' is not loaded
CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server plüg_dest
DROP USER 'plug';
CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER 'plüg_dest';
SET NAMES utf8;
@@ -241,22 +241,22 @@ CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
ERROR HY000: Plugin 'test_plügin_server' is not loaded
CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plüg test_plugin_server plüg_dest
DROP USER 'plüg';
CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER 'plüg_dest';
CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plüg test_plugin_server plüg_dest
DROP USER plüg;
CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER plüg_dest;
========== test 1.1.1.2/1.1.2.2=============================
@@ -271,12 +271,12 @@ CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
ERROR HY000: Plugin 'hh's_test_plugin_server' is not loaded
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug test_plugin_server hh's_plug_dest
DROP USER plug;
CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
hh's_plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
DROP USER 'hh''s_plug_dest';
========== test 1.1.1.4 ====================================
@@ -285,13 +285,13 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
========== test 1.1.3.1 ====================================
GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
grant_user test_plugin_server plug_dest
CREATE USER plug_dest;
DROP USER plug_dest;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
grant_user test_plugin_server plug_dest
plug_dest mysql_native_password
DROP USER grant_user,plug_dest;
@@ -299,7 +299,7 @@ set @save_sql_mode= @@sql_mode;
SET @@sql_mode=no_auto_create_user;
GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
grant_user test_plugin_server plug_dest
CREATE USER plug_dest;
DROP USER plug_dest;
@@ -308,19 +308,19 @@ ERROR 28000: Can't find any matching row in the user table
DROP USER grant_user;
GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
grant_user test_plugin_server plug_dest
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
+User plugin authentication_string Password
grant_user test_plugin_server plug_dest
-plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
+plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 *939AEE68989794C0F408277411C26055CDF41119
DROP USER plug_dest;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
+User plugin authentication_string Password
grant_user test_plugin_server plug_dest
-plug_dest mysql_native_password *560881EB651416CEF77314D07D55EDCD5FC1BD6D
+plug_dest mysql_native_password *560881EB651416CEF77314D07D55EDCD5FC1BD6D *560881EB651416CEF77314D07D55EDCD5FC1BD6D
DROP USER grant_user,plug_dest;
set @@sql_mode= @save_sql_mode;
DROP DATABASE test_user_db;
diff --git a/mysql-test/main/plugin_auth_qa_1.result b/mysql-test/main/plugin_auth_qa_1.result
index b04483722b8..dd709fee04c 100644
--- a/mysql-test/main/plugin_auth_qa_1.result
+++ b/mysql-test/main/plugin_auth_qa_1.result
@@ -1,6 +1,6 @@
CREATE DATABASE test_user_db;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
========== test 1.1.3.2 ====================================
CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
@@ -19,7 +19,7 @@ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
plug_user test_plugin_server plug_dest
1)
@@ -70,7 +70,7 @@ ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using passwo
GRANT PROXY ON new_dest TO plug_user;
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
plug_user test_plugin_server plug_dest
DROP USER plug_user,new_dest;
@@ -88,7 +88,7 @@ ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using passwo
GRANT PROXY ON new_dest TO plug_user;
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
plug_user test_plugin_server plug_dest
DROP USER plug_user,new_dest;
@@ -109,14 +109,14 @@ USER() CURRENT_USER()
new_user@localhost plug_dest@%
connection default;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_user test_plugin_server plug_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
disconnect plug_user;
-UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
+UPDATE mysql.global_priv SET user='plug_user' WHERE user='new_user';
FLUSH PRIVILEGES;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
plug_user test_plugin_server plug_dest
DROP USER plug_dest,plug_user;
@@ -132,36 +132,36 @@ plug_user@localhost plug_dest@%
connection default;
disconnect plug_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
plug_user test_plugin_server plug_dest
-UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
+UPDATE mysql.global_priv SET user='new_user' WHERE user='plug_user';
FLUSH PRIVILEGES;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_user test_plugin_server plug_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
-UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
+UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.authentication_string', 'new_dest') WHERE user='new_user';
FLUSH PRIVILEGES;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_user test_plugin_server new_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
-UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
+UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'new_plugin_server') WHERE user='new_user';
FLUSH PRIVILEGES;
Warnings:
Warning 1524 Plugin 'new_plugin_server' is not loaded
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_user new_plugin_server new_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
ERROR 28000: Access denied for user 'new_user'@'localhost' (using password: YES)
-UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
-UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
+UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'test_plugin_server') WHERE user='new_user';
+UPDATE mysql.global_priv SET user='new_dest' WHERE user='plug_dest';
FLUSH PRIVILEGES;
GRANT PROXY ON new_dest TO new_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
new_user test_plugin_server new_dest
connect plug_user,localhost,new_user,new_dest;
@@ -170,11 +170,11 @@ USER() CURRENT_USER()
new_user@localhost new_dest@%
connection default;
disconnect plug_user;
-UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
+UPDATE mysql.global_priv SET user='plug_dest' WHERE user='new_dest';
FLUSH PRIVILEGES;
CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
new_dest mysql_native_password *01422E86A6FFF84618914AF149F9AEF64B84170A
new_user test_plugin_server new_dest
plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119
@@ -190,7 +190,7 @@ DROP USER new_user,new_dest,plug_dest;
CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
test_plugin_server proxied_user
proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD
connect proxy_con,localhost,proxied_user,proxied_user_passwd;
@@ -226,7 +226,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%'
IDENTIFIED WITH test_plugin_server AS 'proxied_user';
CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
test_plugin_server proxied_user
proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD
connect proxy_con,localhost,proxied_user,proxied_user_passwd;
@@ -268,7 +268,7 @@ GRANT PROXY ON proxied_user_3 TO ''@'%%';
GRANT PROXY ON proxied_user_4 TO ''@'%%';
GRANT PROXY ON proxied_user_5 TO ''@'%%';
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
test_plugin_server proxied_user
proxied_user_1 mysql_native_password *551D5A5177FCC3340F7D2FB0F4D8D1EEA7F7EF71
proxied_user_2 mysql_native_password *3D948F77C6A988AFDCA9755AB2A6724362557220
diff --git a/mysql-test/main/plugin_auth_qa_1.test b/mysql-test/main/plugin_auth_qa_1.test
index 4f45a8aced6..81a9155a390 100644
--- a/mysql-test/main/plugin_auth_qa_1.test
+++ b/mysql-test/main/plugin_auth_qa_1.test
@@ -110,7 +110,7 @@ connection default;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
disconnect plug_user;
-UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
+UPDATE mysql.global_priv SET user='plug_user' WHERE user='new_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -128,15 +128,15 @@ connection default;
disconnect plug_user;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
+UPDATE mysql.global_priv SET user='new_user' WHERE user='plug_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
+UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.authentication_string', 'new_dest') WHERE user='new_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
+UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'new_plugin_server') WHERE user='new_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -144,8 +144,8 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--error ER_ACCESS_DENIED_ERROR
connect(plug_user,localhost,new_user,new_dest);
--enable_query_log
-UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
-UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
+UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'test_plugin_server') WHERE user='new_user';
+UPDATE mysql.global_priv SET user='new_dest' WHERE user='plug_dest';
FLUSH PRIVILEGES;
GRANT PROXY ON new_dest TO new_user;
--sorted_result
@@ -154,7 +154,7 @@ connect(plug_user,localhost,new_user,new_dest);
select USER(),CURRENT_USER();
connection default;
disconnect plug_user;
-UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
+UPDATE mysql.global_priv SET user='plug_dest' WHERE user='new_dest';
FLUSH PRIVILEGES;
CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
--sorted_result
diff --git a/mysql-test/main/plugin_auth_qa_2.result b/mysql-test/main/plugin_auth_qa_2.result
index ec62840ac4a..e71132e2bc9 100644
--- a/mysql-test/main/plugin_auth_qa_2.result
+++ b/mysql-test/main/plugin_auth_qa_2.result
@@ -6,7 +6,7 @@ CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
qa_test_1_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_1_user qa_auth_interface qa_test_1_dest
SELECT @@proxy_user;
@@ -19,7 +19,7 @@ exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_
current_user() user() @@local.proxy_user @@local.external_user
qa_test_1_user@% qa_test_1_user@localhost NULL NULL
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
qa_test_1_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_1_user qa_auth_interface qa_test_1_dest
DROP USER qa_test_1_user;
@@ -32,7 +32,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_pas
GRANT PROXY ON qa_test_2_dest TO qa_test_2_user;
GRANT PROXY ON authenticated_as TO qa_test_2_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
authenticated_as mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_2_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_2_user qa_auth_interface qa_test_2_dest
@@ -46,7 +46,7 @@ exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_
current_user() user() @@local.proxy_user @@local.external_user
authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
authenticated_as mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_2_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_2_user qa_auth_interface qa_test_2_dest
@@ -82,9 +82,9 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_pas
GRANT PROXY ON qa_test_5_dest TO qa_test_5_user;
GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
- mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
-qa_test_5_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+User plugin authentication_string Password
+ mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_5_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_5_user qa_auth_interface qa_test_5_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES)
@@ -97,21 +97,21 @@ CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
-qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+User plugin authentication_string Password
+qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES)
GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
-qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+User plugin authentication_string Password
+qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
REVOKE PROXY ON qa_test_6_dest FROM root;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-user plugin authentication_string
+User plugin authentication_string
qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest
exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
@@ -120,7 +120,7 @@ DROP USER qa_test_6_user;
DROP USER qa_test_6_dest;
DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-user plugin authentication_string password
+User plugin authentication_string Password
=== Test of the --default_auth option for clients ====
CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest';
CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
diff --git a/mysql-test/main/processlist.result b/mysql-test/main/processlist.result
index b8e2271530d..ab518d961ef 100644
--- a/mysql-test/main/processlist.result
+++ b/mysql-test/main/processlist.result
@@ -39,7 +39,7 @@ utf8mb4_string xxx😎yyy
Warnings:
Level Warning
Code 1366
-Message Incorrect string value: '\xF0\x9F\x98\x8Eyy...' for column 'INFO' at row 1
+Message Incorrect string value: '\xF0\x9F\x98\x8Eyy...' for column `information_schema`.`(temporary)`.`INFO` at row 1
#
# End of 10.1 tests
#
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result
index d619b213508..a72b6660288 100644
--- a/mysql-test/main/ps.result
+++ b/mysql-test/main/ps.result
@@ -1381,9 +1381,11 @@ test.t1 optimize status Table is already up to date
prepare stmt from "analyze table t1";
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
prepare stmt from "repair table t1, t2, t3";
execute stmt;
@@ -1410,13 +1412,19 @@ test.t3 optimize status Table is already up to date
prepare stmt from "analyze table t1, t2, t3";
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
prepare stmt from "repair table t1, t4, t3";
execute stmt;
@@ -1449,11 +1457,13 @@ execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze Error Table 'test.t4' doesn't exist
test.t4 analyze status Operation failed
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze Error Table 'test.t4' doesn't exist
test.t4 analyze status Operation failed
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
deallocate prepare stmt;
drop table t1, t2, t3;
@@ -1520,6 +1530,7 @@ Field Type Null Key Default Extra
i int(11) YES NULL
execute stmt_analyze;
Table Op Msg_type Msg_text
+mysqltest_long_database_name_to_thrash_heap.t1 analyze status Engine-independent statistics collected
mysqltest_long_database_name_to_thrash_heap.t1 analyze status Table is already up to date
execute stmt_optimize;
Table Op Msg_type Msg_text
@@ -2136,7 +2147,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
call proc_1();
show open tables from mysql;
@@ -2146,7 +2161,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
call proc_1();
show open tables from mysql;
@@ -2156,7 +2175,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
call proc_1();
show open tables from mysql;
@@ -2166,7 +2189,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
flush tables;
create function func_1() returns int begin flush tables; return 1; end|
@@ -2181,7 +2208,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
prepare abc from "flush tables";
execute abc;
@@ -2192,7 +2223,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
execute abc;
show open tables from mysql;
@@ -2202,7 +2237,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
execute abc;
show open tables from mysql;
@@ -2212,7 +2251,11 @@ select Host, User from mysql.user limit 0;
Host User
show open tables from mysql;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql global_priv 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
mysql user 0 0
flush tables;
deallocate prepare abc;
@@ -5122,13 +5165,13 @@ DECLARE a DATETIME;
CALL p1(a);
END;
$$
-ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
+ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1
BEGIN NOT ATOMIC
DECLARE a DATETIME;
EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
END;
$$
-ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
+ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1
BEGIN NOT ATOMIC
DECLARE a DATETIME;
PREPARE stmt FROM 'CALL p1(?)';
@@ -5136,7 +5179,7 @@ EXECUTE stmt USING a;
DEALLOCATE PREPARE stmt;
END;
$$
-ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
+ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1
DROP PROCEDURE p1;
#
# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
@@ -5221,6 +5264,7 @@ CREATE PROCEDURE p1(tn VARCHAR(32))
EXECUTE IMMEDIATE CONCAT('ANALYZE TABLE ',tn);
CALL p1('t1');
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
DROP PROCEDURE p1;
DROP TABLE t1;
diff --git a/mysql-test/main/ps_ddl.result b/mysql-test/main/ps_ddl.result
index 402dc840479..c5c5b5a9ac0 100644
--- a/mysql-test/main/ps_ddl.result
+++ b/mysql-test/main/ps_ddl.result
@@ -769,11 +769,12 @@ deallocate prepare stmt;
#
# Test 3: View referencing an Information schema table
#
-create view t1 as select table_name from information_schema.views;
+create view t1 as select table_name from information_schema.views order by table_name;
prepare stmt from "select * from t1";
execute stmt;
table_name
t1
+user
call p_verify_reprepare_count(0);
SUCCESS
@@ -781,6 +782,7 @@ create temporary table t1 (a int);
execute stmt;
table_name
t1
+user
call p_verify_reprepare_count(0);
SUCCESS
@@ -1405,6 +1407,7 @@ SUCCESS
prepare stmt from "analyze table t1";
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
drop table t1;
create table t1 (a1 int, a2 int);
@@ -1412,14 +1415,17 @@ insert into t1 values (1, 10), (2, 20), (3, 30);
# t1 has changed, and it's not a problem
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
alter table t1 add column b varchar(50) default NULL;
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
alter table t1 drop column b;
execute stmt;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
call p_verify_reprepare_count(0);
SUCCESS
diff --git a/mysql-test/main/ps_ddl.test b/mysql-test/main/ps_ddl.test
index 90226d379bf..dafb5b5dea3 100644
--- a/mysql-test/main/ps_ddl.test
+++ b/mysql-test/main/ps_ddl.test
@@ -699,7 +699,7 @@ deallocate prepare stmt;
--echo #
--echo # Test 3: View referencing an Information schema table
--echo #
-create view t1 as select table_name from information_schema.views;
+create view t1 as select table_name from information_schema.views order by table_name;
prepare stmt from "select * from t1";
execute stmt;
diff --git a/mysql-test/main/ps_error.result b/mysql-test/main/ps_error.result
new file mode 100644
index 00000000000..c3c312e82f5
--- /dev/null
+++ b/mysql-test/main/ps_error.result
@@ -0,0 +1,73 @@
+#
+# MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS
+#
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+EXECUTE stmt;
+ERROR 22007: Truncated incorrect INTEGER value: 'foo'
+SELECT a FROM t1 GROUP BY NULL WITH ROLLUP;
+a
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+EXECUTE stmt;
+ERROR 22007: Truncated incorrect INTEGER value: 'foo'
+SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ;
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
+# MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS
+#
+SET SQL_MODE='STRICT_ALL_TABLES';
+PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+EXECUTE stmt;
+ERROR 22007: Truncated incorrect INTEGER value: 'foo'
+SELECT 'All done';
+All done
+All done
+SET SQL_MODE=DEFAULT;
+SET SQL_MODE='STRICT_ALL_TABLES';
+PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+EXECUTE stmt;
+ERROR 22007: Truncated incorrect INTEGER value: 'foo'
+DEALLOCATE PREPARE stmt;
+SELECT 'All done';
+All done
+All done
+SET SQL_MODE=DEFAULT;
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+EXECUTE stmt;
+ERROR 22007: Truncated incorrect INTEGER value: 'foo'
+SELECT a FROM t1 GROUP BY a;
+a
+SELECT * FROM t1;
+a
+DROP TABLE t1;
+SET SQL_MODE=DEFAULT;
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+EXECUTE stmt;
+ERROR 22007: Truncated incorrect INTEGER value: 'foo'
+SELECT a FROM t1 GROUP BY a;
+a
+INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq;
+DROP TABLE t1;
+SET SQL_MODE=DEFAULT;
diff --git a/mysql-test/main/ps_error.test b/mysql-test/main/ps_error.test
new file mode 100644
index 00000000000..5efb5d36137
--- /dev/null
+++ b/mysql-test/main/ps_error.test
@@ -0,0 +1,66 @@
+#
+# Tests related to PS returning errors rather than doing successfull execution
+#
+
+--echo #
+--echo # MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS
+--echo #
+
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+--error ER_TRUNCATED_WRONG_VALUE
+EXECUTE stmt;
+SELECT a FROM t1 GROUP BY NULL WITH ROLLUP;
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+--error ER_TRUNCATED_WRONG_VALUE
+EXECUTE stmt;
+SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ;
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+
+--echo #
+--echo # MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS
+--echo #
+
+SET SQL_MODE='STRICT_ALL_TABLES';
+PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
+--error ER_TRUNCATED_WRONG_VALUE
+EXECUTE stmt;
+--source include/restart_mysqld.inc
+SELECT 'All done';
+SET SQL_MODE=DEFAULT;
+
+SET SQL_MODE='STRICT_ALL_TABLES';
+PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
+--error ER_TRUNCATED_WRONG_VALUE
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+SELECT 'All done';
+SET SQL_MODE=DEFAULT;
+
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+--error ER_TRUNCATED_WRONG_VALUE
+EXECUTE stmt;
+SELECT a FROM t1 GROUP BY a;
+SELECT * FROM t1;
+DROP TABLE t1;
+SET SQL_MODE=DEFAULT;
+
+SET SQL_MODE= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
+--error ER_TRUNCATED_WRONG_VALUE
+EXECUTE stmt;
+SELECT a FROM t1 GROUP BY a;
+INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq;
+DROP TABLE t1;
+SET SQL_MODE=DEFAULT;
diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result
index 83237a9d2d4..8bef87d303b 100644
--- a/mysql-test/main/range.result
+++ b/mysql-test/main/range.result
@@ -421,7 +421,9 @@ count(*)
1026
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1938,6 +1940,7 @@ alter table t1 add key2 int not null, add index i2(key2);
update t1 set key2=key1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
create table t2 (a int);
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8);
@@ -2112,22 +2115,22 @@ SELECT * FROM t1 WHERE fd='ðŸ˜';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
SELECT * FROM t1 WHERE fd='ðŸ˜';
id fd
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
# The following must not use range access:
explain select count(*) from t1 where fd <'ðŸ˜';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 where fd <'ðŸ˜';
count(*)
40960
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 ignore index (ix_fd) where fd <'ðŸ˜';
count(*)
40960
@@ -2140,6 +2143,7 @@ insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
a b
@@ -2349,7 +2353,7 @@ EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
#
# MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in
@@ -2529,7 +2533,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["d"],
"rows": 3,
- "filtered": 100,
+ "filtered": 60,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))"
},
@@ -2585,8 +2589,8 @@ insert into t2 values
explain select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range idx idx 5 NULL 6 Using index condition
-1 SIMPLE t2 ref|filter idx1,idx2 idx1|idx2 5|5 test.t1.a 12 (14%) Using where; Using filter
+1 SIMPLE t2 range|filter idx1,idx2 idx1|idx2 5|5 NULL 8 (14%) Using index condition; Using where; Using filter
+1 SIMPLE t1 ref idx idx 5 test.t2.d 8
explain format=json select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
EXPLAIN
@@ -2594,24 +2598,12 @@ EXPLAIN
"query_block": {
"select_id": 1,
"table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 6,
- "filtered": 100,
- "index_condition": "t1.a is not null"
- },
- "table": {
"table_name": "t2",
- "access_type": "ref",
+ "access_type": "range",
"possible_keys": ["idx1", "idx2"],
"key": "idx1",
"key_length": "5",
"used_key_parts": ["d"],
- "ref": ["test.t1.a"],
"rowid_filter": {
"range": {
"key": "idx2",
@@ -2620,9 +2612,21 @@ EXPLAIN
"rows": 15,
"selectivity_pct": 14.423
},
- "rows": 12,
- "filtered": 100,
- "attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
+ "rows": 8,
+ "filtered": 14.423,
+ "index_condition": "t2.d is not null",
+ "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
}
}
}
@@ -2630,16 +2634,16 @@ select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
a b c d e f
3 2 uuuw 3 3 i
-3 2 uuuw 3 3 i
-3 2 uuua 3 3 i
3 2 uuua 3 3 i
3 3 zzzz 3 3 i
-3 3 zzzz 3 3 i
-3 3 zyxw 3 3 i
3 3 zyxw 3 3 i
3 3 zzza 3 3 i
-3 3 zzza 3 3 i
3 3 zyxa 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
3 3 zyxa 3 3 i
7 7 xxxyy 7 7 h
7 7 xxxya 7 7 h
@@ -2650,16 +2654,16 @@ where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1";
execute stmt;
a b c d e f
3 2 uuuw 3 3 i
-3 2 uuuw 3 3 i
-3 2 uuua 3 3 i
3 2 uuua 3 3 i
3 3 zzzz 3 3 i
-3 3 zzzz 3 3 i
-3 3 zyxw 3 3 i
3 3 zyxw 3 3 i
3 3 zzza 3 3 i
-3 3 zzza 3 3 i
3 3 zyxa 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
3 3 zyxa 3 3 i
7 7 xxxyy 7 7 h
7 7 xxxya 7 7 h
@@ -2668,16 +2672,16 @@ a b c d e f
execute stmt;
a b c d e f
3 2 uuuw 3 3 i
-3 2 uuuw 3 3 i
-3 2 uuua 3 3 i
3 2 uuua 3 3 i
3 3 zzzz 3 3 i
-3 3 zzzz 3 3 i
-3 3 zyxw 3 3 i
3 3 zyxw 3 3 i
3 3 zzza 3 3 i
-3 3 zzza 3 3 i
3 3 zyxa 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
3 3 zyxa 3 3 i
7 7 xxxyy 7 7 h
7 7 xxxya 7 7 h
@@ -2714,7 +2718,7 @@ EXPLAIN
"selectivity_pct": 6.7308
},
"rows": 7,
- "filtered": 100,
+ "filtered": 6.7308,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
},
@@ -3066,6 +3070,7 @@ insert into t1 select a+15, concat(b,'yy') from t1;
insert into t1 select a+100, concat(b,'xx') from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select cast(count(a)/count(distinct a) as unsigned) as rec_per_key from t1;
rec_per_key
@@ -3084,7 +3089,7 @@ a b
set eq_range_index_dive_limit=2;
explain select * from t1 where a in (8, 15, 31, 1, 9);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range idx idx 5 NULL 10 Using index condition
+1 SIMPLE t1 range idx idx 5 NULL 5 Using index condition
select * from t1 where a in (8, 15, 31, 1, 9);
a b
1 yy
diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result
index 794e6c7b3cc..30161a2711d 100644
--- a/mysql-test/main/range_innodb.result
+++ b/mysql-test/main/range_innodb.result
@@ -30,6 +30,7 @@ repeat('0123456789', 10)
from t1;
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
# The following must not use "Range checked for each record":
explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
@@ -37,3 +38,45 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10
1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
drop table t0,t1,t2;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
+KEY(f1), KEY(f2)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
+(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
+(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
+(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
+CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
+SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
+WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
+pk f1 f2 f3 pk f1 f2 f3 f4 f5
+1 4 v NULL 14 1 q NULL 4 q
+2 6 v NULL 14 1 q NULL 4 q
+3 7 c NULL 14 1 q NULL 4 q
+drop table t1,t2;
+#
+# MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND'
+# failed in handler::ha_rnd_end upon SELECT from partitioned table
+#
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='index_merge_sort_intersection=off';
+create table t0 (a int)engine=innodb;
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (
+a int, b int, c int,
+key(a),key(b),key(c)
+)engine=innodb;
+insert into t1
+select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a
+from t0 A, t0 B, t0 C, t0 D where D.a<5;
+set @@global.debug_dbug="+d,ha_index_init_fail";
+explain select * from t1 where a=10 and b=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where
+select * from t1 where a=10 and b=10;
+ERROR HY000: Table definition has changed, please retry transaction
+DROP TABLE t0,t1;
+set @@global.debug_dbug="-d";
+set @@optimizer_switch= @optimizer_switch_save;
diff --git a/mysql-test/main/range_innodb.test b/mysql-test/main/range_innodb.test
index f76794814ef..a17ef3f1146 100644
--- a/mysql-test/main/range_innodb.test
+++ b/mysql-test/main/range_innodb.test
@@ -3,6 +3,7 @@
--echo #
--source include/have_innodb.inc
+--source include/have_debug.inc
--disable_warnings
drop table if exists t0, t1, t2;
@@ -45,3 +46,44 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
drop table t0,t1,t2;
+CREATE TABLE t1 (
+ pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
+ KEY(f1), KEY(f2)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
+(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
+(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
+(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
+
+CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
+
+SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
+WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND'
+--echo # failed in handler::ha_rnd_end upon SELECT from partitioned table
+--echo #
+
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='index_merge_sort_intersection=off';
+create table t0 (a int)engine=innodb;
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (
+ a int, b int, c int,
+ key(a),key(b),key(c)
+)engine=innodb;
+insert into t1
+select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a
+from t0 A, t0 B, t0 C, t0 D where D.a<5;
+set @@global.debug_dbug="+d,ha_index_init_fail";
+explain select * from t1 where a=10 and b=10;
+--error ER_TABLE_DEF_CHANGED
+select * from t1 where a=10 and b=10;
+DROP TABLE t0,t1;
+set @@global.debug_dbug="-d";
+set @@optimizer_switch= @optimizer_switch_save;
diff --git a/mysql-test/main/range_mrr_icp.result b/mysql-test/main/range_mrr_icp.result
index a4a64dd1bbe..5d55a820673 100644
--- a/mysql-test/main/range_mrr_icp.result
+++ b/mysql-test/main/range_mrr_icp.result
@@ -424,7 +424,9 @@ count(*)
1026
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1941,6 +1943,7 @@ alter table t1 add key2 int not null, add index i2(key2);
update t1 set key2=key1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
create table t2 (a int);
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8);
@@ -2115,22 +2118,22 @@ SELECT * FROM t1 WHERE fd='ðŸ˜';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
SELECT * FROM t1 WHERE fd='ðŸ˜';
id fd
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
# The following must not use range access:
explain select count(*) from t1 where fd <'ðŸ˜';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 where fd <'ðŸ˜';
count(*)
40960
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 ignore index (ix_fd) where fd <'ðŸ˜';
count(*)
40960
@@ -2143,6 +2146,7 @@ insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
a b
@@ -2352,7 +2356,7 @@ EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
#
# MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in
@@ -2535,7 +2539,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["d"],
"rows": 3,
- "filtered": 100,
+ "filtered": 60,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))",
"mrr_type": "Rowid-ordered scan"
@@ -2592,8 +2596,8 @@ insert into t2 values
explain select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range idx idx 5 NULL 6 Using index condition; Rowid-ordered scan
-1 SIMPLE t2 ref idx1,idx2 idx1 5 test.t1.a 12 Using where
+1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 8 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE t1 ref idx idx 5 test.t2.d 8
explain format=json select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
EXPLAIN
@@ -2601,88 +2605,88 @@ EXPLAIN
"query_block": {
"select_id": 1,
"table": {
- "table_name": "t1",
+ "table_name": "t2",
"access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
"key_length": "5",
- "used_key_parts": ["a"],
- "rows": 6,
- "filtered": 100,
- "index_condition": "t1.a is not null",
+ "used_key_parts": ["d"],
+ "rows": 8,
+ "filtered": 14.423,
+ "index_condition": "t2.d is not null",
+ "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1",
"mrr_type": "Rowid-ordered scan"
},
"table": {
- "table_name": "t2",
+ "table_name": "t1",
"access_type": "ref",
- "possible_keys": ["idx1", "idx2"],
- "key": "idx1",
+ "possible_keys": ["idx"],
+ "key": "idx",
"key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 12,
- "filtered": 100,
- "attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
}
}
}
select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
a b c d e f
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
3 3 zzzz 3 3 i
-3 3 zzzz 3 3 i
-7 8 xxxxx 7 7 h
-7 7 xxxyy 7 7 h
-3 3 zyxw 3 3 i
3 3 zyxw 3 3 i
-3 2 uuuw 3 3 i
-3 2 uuuw 3 3 i
-3 3 zzza 3 3 i
3 3 zzza 3 3 i
-7 8 xxxxa 7 7 h
-7 7 xxxya 7 7 h
-3 3 zyxa 3 3 i
3 3 zyxa 3 3 i
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+3 2 uuuw 3 3 i
3 2 uuua 3 3 i
-3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
prepare stmt from "select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1";
execute stmt;
a b c d e f
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
3 3 zzzz 3 3 i
-3 3 zzzz 3 3 i
-7 8 xxxxx 7 7 h
-7 7 xxxyy 7 7 h
-3 3 zyxw 3 3 i
3 3 zyxw 3 3 i
-3 2 uuuw 3 3 i
-3 2 uuuw 3 3 i
-3 3 zzza 3 3 i
3 3 zzza 3 3 i
-7 8 xxxxa 7 7 h
-7 7 xxxya 7 7 h
-3 3 zyxa 3 3 i
3 3 zyxa 3 3 i
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+3 2 uuuw 3 3 i
3 2 uuua 3 3 i
-3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
execute stmt;
a b c d e f
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
3 3 zzzz 3 3 i
-3 3 zzzz 3 3 i
-7 8 xxxxx 7 7 h
-7 7 xxxyy 7 7 h
3 3 zyxw 3 3 i
-3 3 zyxw 3 3 i
-3 2 uuuw 3 3 i
-3 2 uuuw 3 3 i
3 3 zzza 3 3 i
-3 3 zzza 3 3 i
-7 8 xxxxa 7 7 h
-7 7 xxxya 7 7 h
3 3 zyxa 3 3 i
-3 3 zyxa 3 3 i
-3 2 uuua 3 3 i
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+3 2 uuuw 3 3 i
3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
deallocate prepare stmt;
insert into t1 select * from t1;
# join order: (t2,t1) with ref access of t1
@@ -2706,7 +2710,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["d"],
"rows": 7,
- "filtered": 100,
+ "filtered": 6.7308,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1",
"mrr_type": "Rowid-ordered scan"
@@ -3063,6 +3067,7 @@ insert into t1 select a+15, concat(b,'yy') from t1;
insert into t1 select a+100, concat(b,'xx') from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select cast(count(a)/count(distinct a) as unsigned) as rec_per_key from t1;
rec_per_key
@@ -3081,7 +3086,7 @@ a b
set eq_range_index_dive_limit=2;
explain select * from t1 where a in (8, 15, 31, 1, 9);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range idx idx 5 NULL 10 Using index condition; Rowid-ordered scan
+1 SIMPLE t1 range idx idx 5 NULL 5 Using index condition; Rowid-ordered scan
select * from t1 where a in (8, 15, 31, 1, 9);
a b
1 yy
diff --git a/mysql-test/main/range_vs_index_merge.result b/mysql-test/main/range_vs_index_merge.result
index d332156659f..82d2358cebc 100644
--- a/mysql-test/main/range_vs_index_merge.result
+++ b/mysql-test/main/range_vs_index_merge.result
@@ -1079,7 +1079,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE
(Name='Samara' AND Country='RUS') OR
(Name='Seattle' AND Country='USA');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 28 Using sort_union(CountryName,CityName); Using where
+1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where
SELECT Name, Country, Population FROM City WHERE
(Name='Manila' AND Country='PHL') OR
(Name='Addis Abeba' AND Country='ETH') OR
@@ -1110,32 +1110,32 @@ SELECT Name, Country, Population FROM City WHERE
(Name='Seattle' AND Country='USA');
Name Country Population
Addis Abeba ETH 2495000
-Manila PHL 1581082
-Jakarta IDN 9604900
-Delhi IND 7206704
+Ankara TUR 3038159
Bangalore IND 2660088
-Teheran IRN 6758845
-Roma ITA 2643581
-Venezia ITA 277305
-Tokyo JPN 7980230
-Toronto CAN 688275
-Vancouver CAN 514008
-Peking CHN 7472000
-Seoul KOR 9981619
+Basel CHE 166700
+Caracas VEN 1975294
+Dakar SEN 785071
+Delhi IND 7206704
+Dresden DEU 476668
+Jakarta IDN 9604900
Kaunas LTU 412639
-Rabat MAR 623457
-Tijuana MEX 1212232
Lagos NGA 1518000
+Lugansk UKR 469000
+Manila PHL 1581082
Paris FRA 2125246
-Dresden DEU 476668
-Dakar SEN 785071
-Basel CHE 166700
+Peking CHN 7472000
Praha CZE 1181126
-Ankara TUR 3038159
-Lugansk UKR 469000
-Caracas VEN 1975294
+Rabat MAR 623457
+Roma ITA 2643581
Samara RUS 1156100
Seattle USA 563374
+Seoul KOR 9981619
+Teheran IRN 6758845
+Tijuana MEX 1212232
+Tokyo JPN 7980230
+Toronto CAN 688275
+Vancouver CAN 514008
+Venezia ITA 277305
set optimizer_switch='index_merge=off';
EXPLAIN SELECT Name, Country, Population FROM City WHERE
(Name='Manila' AND Country='PHL') OR
@@ -1166,7 +1166,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE
(Name='Samara' AND Country='RUS') OR
(Name='Seattle' AND Country='USA');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 28 Using index condition; Using where
+1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where
SELECT Name, Country, Population FROM City WHERE
(Name='Manila' AND Country='PHL') OR
(Name='Addis Abeba' AND Country='ETH') OR
@@ -1196,33 +1196,33 @@ SELECT Name, Country, Population FROM City WHERE
(Name='Samara' AND Country='RUS') OR
(Name='Seattle' AND Country='USA');
Name Country Population
-Toronto CAN 688275
-Vancouver CAN 514008
-Basel CHE 166700
-Peking CHN 7472000
-Praha CZE 1181126
-Dresden DEU 476668
Addis Abeba ETH 2495000
-Paris FRA 2125246
-Jakarta IDN 9604900
+Ankara TUR 3038159
Bangalore IND 2660088
+Basel CHE 166700
+Caracas VEN 1975294
+Dakar SEN 785071
Delhi IND 7206704
-Teheran IRN 6758845
-Roma ITA 2643581
-Venezia ITA 277305
-Tokyo JPN 7980230
-Seoul KOR 9981619
+Dresden DEU 476668
+Jakarta IDN 9604900
Kaunas LTU 412639
-Rabat MAR 623457
-Tijuana MEX 1212232
Lagos NGA 1518000
+Lugansk UKR 469000
Manila PHL 1581082
+Paris FRA 2125246
+Peking CHN 7472000
+Praha CZE 1181126
+Rabat MAR 623457
+Roma ITA 2643581
Samara RUS 1156100
-Dakar SEN 785071
-Ankara TUR 3038159
-Lugansk UKR 469000
Seattle USA 563374
-Caracas VEN 1975294
+Seoul KOR 9981619
+Teheran IRN 6758845
+Tijuana MEX 1212232
+Tokyo JPN 7980230
+Toronto CAN 688275
+Vancouver CAN 514008
+Venezia ITA 277305
set optimizer_switch=@save_optimizer_switch;
#
# Bug mdev-585: range vs index-merge with ORDER BY ... LIMIT n
@@ -1343,6 +1343,38 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
+set @tmp_mdev585=@@optimizer_use_condition_selectivity;
+set optimizer_use_condition_selectivity=1;
+EXPLAIN
+SELECT * FROM City
+WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
+AND (Population >= 100000 AND Population < 120000)
+ORDER BY Population LIMIT 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where
+FLUSH STATUS;
+SELECT * FROM City
+WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
+AND (Population >= 100000 AND Population < 120000)
+ORDER BY Population LIMIT 5;
+ID Name Country Population
+519 Worthing GBR 100000
+638 al-Arish EGY 100447
+518 Basildon GBR 100924
+707 Marbella ESP 101144
+3792 Tartu EST 101246
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_last 0
+Handler_read_next 59
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+set optimizer_use_condition_selectivity=@tmp_mdev585;
set optimizer_switch='index_merge=off';
EXPLAIN
SELECT * FROM City
@@ -1430,6 +1462,7 @@ insert into t1(account_id, login, home_state, work_state)
select 1, 'pw', 'ak', 'ak' from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select count(*) from t1 where account_id = 1;
count(*)
@@ -1491,6 +1524,7 @@ insert into t1 (c2, c3, c4, c5, cp)
select c2, c3, c4, c5, cp from t1 where cp = 4;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain
select * from t1 where (c2=1 and c3=1) or (c4=2 and c5=1);
@@ -1543,6 +1577,7 @@ insert into t1 (c2,c3,c4) select c2,c3,3 from t1 where c2 != 'a';
insert into t1 (c2,c3,c4) select c2,c3,4 from t1 where c2 != 'a';
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select count(*) from t1 where (c2='e' OR c3='q');
count(*)
@@ -1582,6 +1617,7 @@ update t1 set c1=lpad(id+1000, 12, ' '), c2=lpad(id+10000, 15, ' ');
alter table t1 add unique index (c1), add unique index (c2), add index (c3);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
explain
select * from t1 where (c1=' 100000' or c2=' 2000000');
@@ -1715,6 +1751,7 @@ INSERT INTO t1 VALUES
(0,72,321,-7),(0,73,0,3),(0,74,5,25),(0,75,5,3);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET SESSION optimizer_switch='index_merge_sort_union=off';
EXPLAIN
@@ -1795,6 +1832,7 @@ INSERT INTO t1 VALUES
;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN
SELECT * FROM t1 FORCE KEY (state,capital)
@@ -1862,23 +1900,23 @@ Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
Country='ITA' AND Name IN ('Napoli', 'Venezia');
ID Name Country Population
175 Antwerpen BEL 446525
-176 Gent BEL 224180
+2808 Bergen NOR 230948
3068 Berlin DEU 3386667
3087 Bonn DEU 301048
+2918 Braga PRT 90535
+176 Gent BEL 224180
3242 Lahti FIN 96921
-2974 Paris FRA 2125246
+3580 Moscow RUS 8389200
1466 Napoli ITA 1002619
-1474 Venezia ITA 277305
-2808 Bergen NOR 230948
2807 Oslo NOR 508726
-2928 Warszawa POL 1615369
-2931 Wroclaw POL 636765
-2918 Braga PRT 90535
+2974 Paris FRA 2125246
2915 Porto PRT 273060
-3580 Moscow RUS 8389200
3581 St Petersburg RUS 4694000
3048 Stockholm SWE 750348
3051 Uppsala SWE 189569
+1474 Venezia ITA 277305
+2928 Warszawa POL 1615369
+2931 Wroclaw POL 636765
explain select * from City
where
Country='FIN' AND Name IN ('Lahti','Imatra') OR
@@ -1892,6 +1930,6 @@ Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
Country='ITA' AND Name IN ('Napoli', 'Venezia');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range CountryName,Name CountryName 38 NULL 20 Using index condition; Using where
+1 SIMPLE City range CountryName,Name Name 35 NULL 20 Using index condition; Using where
DROP DATABASE world;
set session optimizer_switch='index_merge_sort_intersection=default';
diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test
index 0cff070fe68..7f7915ad6b4 100644
--- a/mysql-test/main/range_vs_index_merge.test
+++ b/mysql-test/main/range_vs_index_merge.test
@@ -718,6 +718,23 @@ SELECT * FROM City
ORDER BY Population LIMIT 5;
SHOW STATUS LIKE 'Handler_read_%';
+set @tmp_mdev585=@@optimizer_use_condition_selectivity;
+set optimizer_use_condition_selectivity=1;
+--replace_column 9 #
+EXPLAIN
+SELECT * FROM City
+ WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
+ AND (Population >= 100000 AND Population < 120000)
+ORDER BY Population LIMIT 5;
+
+FLUSH STATUS;
+SELECT * FROM City
+ WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
+ AND (Population >= 100000 AND Population < 120000)
+ORDER BY Population LIMIT 5;
+SHOW STATUS LIKE 'Handler_read_%';
+
+set optimizer_use_condition_selectivity=@tmp_mdev585;
set optimizer_switch='index_merge=off';
diff --git a/mysql-test/main/range_vs_index_merge_innodb.result b/mysql-test/main/range_vs_index_merge_innodb.result
index 8b592c710a8..f085cf792ab 100644
--- a/mysql-test/main/range_vs_index_merge_innodb.result
+++ b/mysql-test/main/range_vs_index_merge_innodb.result
@@ -1349,6 +1349,38 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
+set @tmp_mdev585=@@optimizer_use_condition_selectivity;
+set optimizer_use_condition_selectivity=1;
+EXPLAIN
+SELECT * FROM City
+WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
+AND (Population >= 100000 AND Population < 120000)
+ORDER BY Population LIMIT 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where
+FLUSH STATUS;
+SELECT * FROM City
+WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
+AND (Population >= 100000 AND Population < 120000)
+ORDER BY Population LIMIT 5;
+ID Name Country Population
+519 Worthing GBR 100000
+638 al-Arish EGY 100447
+518 Basildon GBR 100924
+707 Marbella ESP 101144
+3792 Tartu EST 101246
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_last 0
+Handler_read_next 59
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+set optimizer_use_condition_selectivity=@tmp_mdev585;
set optimizer_switch='index_merge=off';
EXPLAIN
SELECT * FROM City
@@ -1436,6 +1468,7 @@ insert into t1(account_id, login, home_state, work_state)
select 1, 'pw', 'ak', 'ak' from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select count(*) from t1 where account_id = 1;
count(*)
@@ -1497,6 +1530,7 @@ insert into t1 (c2, c3, c4, c5, cp)
select c2, c3, c4, c5, cp from t1 where cp = 4;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain
select * from t1 where (c2=1 and c3=1) or (c4=2 and c5=1);
@@ -1549,6 +1583,7 @@ insert into t1 (c2,c3,c4) select c2,c3,3 from t1 where c2 != 'a';
insert into t1 (c2,c3,c4) select c2,c3,4 from t1 where c2 != 'a';
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select count(*) from t1 where (c2='e' OR c3='q');
count(*)
@@ -1588,6 +1623,7 @@ update t1 set c1=lpad(id+1000, 12, ' '), c2=lpad(id+10000, 15, ' ');
alter table t1 add unique index (c1), add unique index (c2), add index (c3);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain
select * from t1 where (c1=' 100000' or c2=' 2000000');
diff --git a/mysql-test/main/read_only.result b/mysql-test/main/read_only.result
index 2029413c0f0..83dfada5f29 100644
--- a/mysql-test/main/read_only.result
+++ b/mysql-test/main/read_only.result
@@ -170,11 +170,24 @@ flush privileges;
drop database mysqltest_db1;
set global read_only= @start_read_only;
#
+# MDEV-16987 - ALTER DATABASE possible in read-only mode
+#
+CREATE USER user1@localhost;
+GRANT ALTER ON test1.* TO user1@localhost;
+CREATE DATABASE test1;
+SET GLOBAL read_only=1;
+ALTER DATABASE test1 CHARACTER SET utf8;
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+SET GLOBAL read_only=0;
+DROP DATABASE test1;
+DROP USER user1@localhost;
+USE test;
+# End of 5.5 tests
+#
# WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
#
#
# Test interaction with read_only system variable.
-DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
CREATE USER user1;
@@ -211,3 +224,4 @@ connection default;
DROP USER user1;
SET GLOBAL read_only= 0;
DROP TABLE t1;
+# End of 10.0 tests
diff --git a/mysql-test/main/read_only.test b/mysql-test/main/read_only.test
index a05f813346e..5314b11154f 100644
--- a/mysql-test/main/read_only.test
+++ b/mysql-test/main/read_only.test
@@ -283,6 +283,23 @@ flush privileges;
drop database mysqltest_db1;
set global read_only= @start_read_only;
+--echo #
+--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode
+--echo #
+CREATE USER user1@localhost;
+GRANT ALTER ON test1.* TO user1@localhost;
+CREATE DATABASE test1;
+SET GLOBAL read_only=1;
+change_user user1;
+--error ER_OPTION_PREVENTS_STATEMENT
+ALTER DATABASE test1 CHARACTER SET utf8;
+change_user root;
+SET GLOBAL read_only=0;
+DROP DATABASE test1;
+DROP USER user1@localhost;
+USE test;
+
+--echo # End of 5.5 tests
--echo #
--echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
@@ -291,10 +308,6 @@ set global read_only= @start_read_only;
--echo #
--echo # Test interaction with read_only system variable.
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
@@ -344,3 +357,5 @@ DROP TABLE t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+
+--echo # End of 10.0 tests
diff --git a/mysql-test/main/row.result b/mysql-test/main/row.result
index 2d4ebc35b84..40d3e2640f0 100644
--- a/mysql-test/main/row.result
+++ b/mysql-test/main/row.result
@@ -483,7 +483,7 @@ select * from t1,t2 where (a,b) = (c,d);
a b c d
abc 1 abc 1
select host,user from mysql.user where (host,user) = ('localhost','test');
-host user
+Host User
drop table t1,t2;
#
# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result
index 220f500e37a..230bef68467 100644
--- a/mysql-test/main/select.result
+++ b/mysql-test/main/select.result
@@ -3453,6 +3453,7 @@ create table t2 (a int, b int, c int, e int, primary key(a,b,c));
insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
Z
@@ -3749,12 +3750,14 @@ CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDAT
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result
index bc86a27bce9..a27585ce0c4 100644
--- a/mysql-test/main/select_jcl6.result
+++ b/mysql-test/main/select_jcl6.result
@@ -3464,6 +3464,7 @@ create table t2 (a int, b int, c int, e int, primary key(a,b,c));
insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
Z
@@ -3760,12 +3761,14 @@ CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDAT
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result
index 220f500e37a..230bef68467 100644
--- a/mysql-test/main/select_pkeycache.result
+++ b/mysql-test/main/select_pkeycache.result
@@ -3453,6 +3453,7 @@ create table t2 (a int, b int, c int, e int, primary key(a,b,c));
insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
Z
@@ -3749,12 +3750,14 @@ CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDAT
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
diff --git a/mysql-test/main/select_safe.result b/mysql-test/main/select_safe.result
index 60364b8c4ec..649e2dc484e 100644
--- a/mysql-test/main/select_safe.result
+++ b/mysql-test/main/select_safe.result
@@ -62,19 +62,20 @@ a b
5 a
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
insert into t1 values (null,"b"),(null,"b"),(null,"c"),(null,"c"),(null,"d"),(null,"d"),(null,"e"),(null,"e"),(null,"a"),(null,"e");
insert into t1 values (null,"x"),(null,"x"),(null,"y"),(null,"y"),(null,"z"),(null,"z"),(null,"v"),(null,"v"),(null,"a"),(null,"v");
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL b NULL NULL NULL 41 Using where
-1 SIMPLE t2 ref b b 21 test.t1.b 6
+1 SIMPLE t1 ALL b NULL NULL NULL 11
+1 SIMPLE t2 ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join)
set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL b NULL NULL NULL 41 Using where
-1 SIMPLE t2 ref b b 21 test.t1.b 6
+1 SIMPLE t1 ALL b NULL NULL NULL 11
+1 SIMPLE t2 ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join)
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result
index 921bd20fc69..93917065722 100644
--- a/mysql-test/main/selectivity_innodb.result
+++ b/mysql-test/main/selectivity_innodb.result
@@ -1150,7 +1150,6 @@ alter table t1 change column a a int;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
-test.t1 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t1 analyze status OK
flush table t1;
explain extended select * from t1 where a between 5 and 7;
diff --git a/mysql-test/main/session_tracker_last_gtid.result b/mysql-test/main/session_tracker_last_gtid.result
index deffeca1333..795d0aaa2a2 100644
--- a/mysql-test/main/session_tracker_last_gtid.result
+++ b/mysql-test/main/session_tracker_last_gtid.result
@@ -2,13 +2,7 @@
# MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
#
SET gtid_seq_no=1000;
--- Tracker : SESSION_TRACK_SCHEMA
--- test
-
SET @@session.session_track_system_variables='last_gtid';
--- Tracker : SESSION_TRACK_SCHEMA
--- test
-
create table t1 (a int) engine=innodb;
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- last_gtid
diff --git a/mysql-test/main/set_password.result b/mysql-test/main/set_password.result
index 82154c6ae8c..bb1124e09d4 100644
--- a/mysql-test/main/set_password.result
+++ b/mysql-test/main/set_password.result
@@ -8,13 +8,13 @@ create user oldpass@localhost identified by password '378b243e220ca493';
create user oldpassold@localhost identified with 'mysql_old_password';
set password for oldpassold@localhost = '378b243e220ca493';
select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
-user host password plugin authentication_string
-natauth localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
-newpass localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
-newpassnat localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
-oldauth localhost mysql_old_password 378b243e220ca493
-oldpass localhost mysql_old_password 378b243e220ca493
-oldpassold localhost mysql_old_password 378b243e220ca493
+User Host Password plugin authentication_string
+natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
+newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
+newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
+oldauth localhost 378b243e220ca493 mysql_old_password 378b243e220ca493
+oldpass localhost 378b243e220ca493 mysql_old_password 378b243e220ca493
+oldpassold localhost 378b243e220ca493 mysql_old_password 378b243e220ca493
connect con,localhost,natauth,test,;
select current_user();
current_user()
@@ -85,13 +85,13 @@ set password for oldauth@localhost = PASSWORD('test2');
set password for oldpass@localhost = PASSWORD('test2');
set password for oldpassold@localhost = PASSWORD('test2');
select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
-user host password plugin authentication_string
-natauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
-newpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
-newpassnat localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
-oldauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
-oldpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
-oldpassold localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
+User Host Password plugin authentication_string
+natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
+newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
+newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
+oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
+oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
+oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
connect con,localhost,natauth,test2,;
select current_user();
current_user()
diff --git a/mysql-test/main/set_password.test b/mysql-test/main/set_password.test
index fc1ecb5ef5c..c67dc22dc81 100644
--- a/mysql-test/main/set_password.test
+++ b/mysql-test/main/set_password.test
@@ -132,6 +132,7 @@ set global secure_auth=default;
#
# MDEV-16238 root/localhost authn prioritizes authentication_string over Password
#
+--source include/switch_to_mysql_user.inc
create user foo@localhost identified with mysql_native_password;
update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost';
set password for 'foo'@'localhost' = password('bar');
@@ -145,3 +146,4 @@ select user,host,password,plugin,authentication_string from mysql.user where use
set password for 'foo'@'localhost' = '';
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
drop user foo@localhost;
+--source include/switch_to_mysql_global_priv.inc
diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result
index f4e2047414c..741514b99b1 100644
--- a/mysql-test/main/show_check.result
+++ b/mysql-test/main/show_check.result
@@ -162,8 +162,9 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 39 8
def Op 253 10 7 Y 0 39 8
def Msg_type 253 10 6 Y 0 39 8
-def Msg_text 250 393216 2 Y 0 39 8
+def Msg_text 250 393216 39 Y 0 39 8
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -261,7 +262,10 @@ create table t1(n int);
insert into t1 values (1);
show open tables;
Database Table In_use Name_locked
+mysql column_stats 0 0
mysql general_log 0 0
+mysql index_stats 0 0
+mysql table_stats 0 0
test t1 0 0
drop table t1;
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
diff --git a/mysql-test/main/show_grants_with_plugin-7985.result b/mysql-test/main/show_grants_with_plugin-7985.result
deleted file mode 100644
index 14d7b98bcf4..00000000000
--- a/mysql-test/main/show_grants_with_plugin-7985.result
+++ /dev/null
@@ -1,197 +0,0 @@
-call mtr.add_suppression("password and an authentication plugin");
-#
-# Create a user with mysql_native_password plugin.
-# The user has no password or auth_string set.
-#
-create user u1;
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password;
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-user host password plugin authentication_string
-u1 % mysql_native_password
-#
-# The user's grants should show no password at all.
-#
-show grants for u1;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-#
-# Test to see if connecting with no password is succesful.
-#
-connect con1, localhost, u1,,;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Test after flushing privileges.
-#
-flush privileges;
-connect con1, localhost, u1,,;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Now add a mysql_native password string in authentication_string.
-#
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
-USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-user host password plugin authentication_string
-u1 % mysql_native_password *7AFEFD08B6B720E781FB000CAA418F54FA662626
-#
-# Test to see if connecting with password is succesful.
-#
-connect con1, localhost, u1,'SOMETHING',;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Test after flushing privileges.
-#
-flush privileges;
-connect con1, localhost, u1,'SOMETHING',;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Now we also set a password for the user.
-#
-set password for u1 = PASSWORD('SOMETHINGELSE');
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-user host password plugin authentication_string
-u1 % mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
-#
-# Here we should use the password field, as that primes over
-# the authentication_string field.
-#
-show grants for u1;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-#
-# Logging in with the user's password should work.
-#
-connect con1, localhost, u1,'SOMETHINGELSE',;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Reload privileges and test logging in again.
-#
-flush privileges;
-show grants for u1;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-#
-# Here we connect via the user's password again.
-#
-connect con1, localhost, u1,'SOMETHINGELSE',;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Now we remove the authentication plugin password, flush privileges and
-# try again.
-#
-update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-user host password plugin authentication_string
-u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
-flush privileges;
-show grants for u1;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-#
-# Here we connect via the user's password.
-#
-connect con1, localhost, u1,'SOMETHINGELSE',;
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-user host password plugin authentication_string
-u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
-disconnect con1;
-connection default;
-#
-# Try and set a wrong auth_string password, with mysql_native_password.
-# Make sure it fails.
-#
-GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd';
-ERROR HY000: Password hash should be a 41-digit hexadecimal number
-#
-# Now set a correct password.
-#
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
-USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
-show grants for u1;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-#
-# Test if the user can now use that password instead.
-#
-connect con1, localhost, u1,'SOMETHING',;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-#
-# Test if the user can now use that password instead, after flushing privileges;
-#
-connection default;
-flush privileges;
-connect con1, localhost, u1,'SOMETHING',;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Clear all passwords from the user.
-#
-set password for u1 = '';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-user host password plugin authentication_string
-u1 % mysql_native_password
-#
-# Test no password connect.
-#
-connect con1, localhost, u1,,;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-#
-# Test no password connect, after flushing privileges.
-#
-flush privileges;
-connect con1, localhost, u1,,;
-show grants;
-Grants for u1@%
-GRANT USAGE ON *.* TO 'u1'@'%'
-GRANT SELECT ON `mysql`.* TO 'u1'@'%'
-disconnect con1;
-connection default;
-drop user u1;
diff --git a/mysql-test/main/show_grants_with_plugin-7985.test b/mysql-test/main/show_grants_with_plugin-7985.test
deleted file mode 100644
index 85952870254..00000000000
--- a/mysql-test/main/show_grants_with_plugin-7985.test
+++ /dev/null
@@ -1,160 +0,0 @@
---source include/not_embedded.inc
-call mtr.add_suppression("password and an authentication plugin");
-
---echo #
---echo # Create a user with mysql_native_password plugin.
---echo # The user has no password or auth_string set.
---echo #
-
-create user u1;
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password;
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-
---echo #
---echo # The user's grants should show no password at all.
---echo #
-show grants for u1;
---echo #
---echo # Test to see if connecting with no password is succesful.
---echo #
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
-
---connection default
---echo #
---echo # Test after flushing privileges.
---echo #
-flush privileges;
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
-
---connection default
---echo #
---echo # Now add a mysql_native password string in authentication_string.
---echo #
-# Password string is SOMETHING
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
-USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
---echo #
---echo # Test to see if connecting with password is succesful.
---echo #
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
-
---connection default
---echo #
---echo # Test after flushing privileges.
---echo #
-flush privileges;
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Now we also set a password for the user.
---echo #
-set password for u1 = PASSWORD('SOMETHINGELSE');
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-
---echo #
---echo # Here we should use the password field, as that primes over
---echo # the authentication_string field.
---echo #
-show grants for u1;
-
---echo #
---echo # Logging in with the user's password should work.
---echo #
---connect (con1, localhost, u1,'SOMETHINGELSE',)
-show grants;
---disconnect con1
---connection default
---echo #
---echo # Reload privileges and test logging in again.
---echo #
-flush privileges;
-show grants for u1;
---echo #
---echo # Here we connect via the user's password again.
---echo #
---connect (con1, localhost, u1,'SOMETHINGELSE',)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Now we remove the authentication plugin password, flush privileges and
---echo # try again.
---echo #
-update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-flush privileges;
-show grants for u1;
---echo #
---echo # Here we connect via the user's password.
---echo #
---connect (con1, localhost, u1,'SOMETHINGELSE',)
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
---disconnect con1
---connection default
-
---echo #
---echo # Try and set a wrong auth_string password, with mysql_native_password.
---echo # Make sure it fails.
---echo #
---error ER_PASSWD_LENGTH
-GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd';
---echo #
---echo # Now set a correct password.
---echo #
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
-USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
-show grants for u1;
-
---echo #
---echo # Test if the user can now use that password instead.
---echo #
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
-
---echo #
---echo # Test if the user can now use that password instead, after flushing privileges;
---echo #
---connection default
-flush privileges;
-
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Clear all passwords from the user.
---echo #
-set password for u1 = '';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-
---echo #
---echo # Test no password connect.
---echo #
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Test no password connect, after flushing privileges.
---echo #
-flush privileges;
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
---connection default
-
-drop user u1;
diff --git a/mysql-test/main/sp-code.result b/mysql-test/main/sp-code.result
index c3af01d19e8..0ff30ba7764 100644
--- a/mysql-test/main/sp-code.result
+++ b/mysql-test/main/sp-code.result
@@ -1020,8 +1020,8 @@ i
SHOW PROCEDURE CODE p1;
Pos Instruction
0 set i@0 1
-1 set [upper_bound]@1 3
-2 jump_if_not 6(6) i@0 <= [upper_bound]@1
+1 set [target_bound]@1 3
+2 jump_if_not 6(6) i@0 <= [target_bound]@1
3 stmt 0 "SELECT i"
4 set i@0 i@0 + 1
5 jump 2
@@ -1058,11 +1058,11 @@ i j
SHOW PROCEDURE CODE p1;
Pos Instruction
0 set i@0 1
-1 set [upper_bound]@1 3
-2 jump_if_not 17(17) i@0 <= [upper_bound]@1
+1 set [target_bound]@1 3
+2 jump_if_not 17(17) i@0 <= [target_bound]@1
3 set j@2 1
-4 set [upper_bound]@3 3
-5 jump_if_not 13(13) j@2 <= [upper_bound]@3
+4 set [target_bound]@3 3
+5 jump_if_not 13(13) j@2 <= [target_bound]@3
6 jump_if_not 8(8) i@0 = 3
7 jump 17
8 jump_if_not 10(10) j@2 = 3
diff --git a/mysql-test/main/sp-cursor.result b/mysql-test/main/sp-cursor.result
index f1dd8ed5eaa..2656ef8821d 100644
--- a/mysql-test/main/sp-cursor.result
+++ b/mysql-test/main/sp-cursor.result
@@ -172,7 +172,7 @@ CALL p1('b1');
v_a
0
Warnings:
-Warning 1366 Incorrect integer value: 'b1' for column 'p_a' at row 1
+Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 1
DROP PROCEDURE p1;
SET sql_mode=DEFAULT;
#
@@ -713,3 +713,27 @@ END;
$$
CALL p1;
DROP PROCEDURE p1;
+#
+# MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
+#
+CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
+INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
+CREATE PROCEDURE p1()
+BEGIN
+FOR rec IN (SELECT en1 FROM t1)
+DO
+SELECT rec.en1;
+END FOR;
+END;
+$$
+CALL p1();
+rec.en1
+aaa
+rec.en1
+a
+rec.en1
+b
+rec.en1
+c
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/main/sp-cursor.test b/mysql-test/main/sp-cursor.test
index 735514ff376..97483ef9caf 100644
--- a/mysql-test/main/sp-cursor.test
+++ b/mysql-test/main/sp-cursor.test
@@ -723,3 +723,24 @@ $$
DELIMITER ;$$
CALL p1;
DROP PROCEDURE p1;
+
+
+--echo #
+--echo # MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
+--echo #
+
+CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
+INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ FOR rec IN (SELECT en1 FROM t1)
+ DO
+ SELECT rec.en1;
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/main/sp-error.result b/mysql-test/main/sp-error.result
index 74723f832a7..3d4e7895fa4 100644
--- a/mysql-test/main/sp-error.result
+++ b/mysql-test/main/sp-error.result
@@ -2784,7 +2784,7 @@ END|
CALL p1()|
Warnings:
-Warning 1366 Incorrect integer value: 'string' for column 'var1' at row 1
+Warning 1366 Incorrect integer value: 'string' for column ``.``.`var1` at row 1
SET sql_mode = DEFAULT;
CREATE PROCEDURE p2()
diff --git a/mysql-test/main/sp-for-loop.result b/mysql-test/main/sp-for-loop.result
index 0da09586df5..d62d6ae3612 100644
--- a/mysql-test/main/sp-for-loop.result
+++ b/mysql-test/main/sp-for-loop.result
@@ -80,7 +80,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURNS INT
BEGIN
DECLARE total INT DEFAULT 0;
fori:
-FOR i IN REVERSE a..1
+FOR i IN REVERSE 1..a
DO
SET total= total + i;
IF i = b THEN
diff --git a/mysql-test/main/sp-for-loop.test b/mysql-test/main/sp-for-loop.test
index 6350e9fb9d3..420ab58aaa7 100644
--- a/mysql-test/main/sp-for-loop.test
+++ b/mysql-test/main/sp-for-loop.test
@@ -86,7 +86,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURNS INT
BEGIN
DECLARE total INT DEFAULT 0;
fori:
- FOR i IN REVERSE a..1
+ FOR i IN REVERSE 1..a
DO
SET total= total + i;
IF i = b THEN
diff --git a/mysql-test/main/sp-security.result b/mysql-test/main/sp-security.result
index 051fbf3a7e8..662d52902d0 100644
--- a/mysql-test/main/sp-security.result
+++ b/mysql-test/main/sp-security.result
@@ -507,7 +507,7 @@ GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO
user19857@localhost;
SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857';
-Host User Plugin Authentication_string
+Host User plugin authentication_string
localhost user19857 mysql_native_password *82DC221D557298F6CE9961037DB1C90604792F5C
connect mysqltest_2_con,localhost,user19857,meow,test;
connection mysqltest_2_con;
@@ -534,7 +534,7 @@ DROP PROCEDURE IF EXISTS test.sp19857;
connection con1root;
disconnect mysqltest_2_con;
SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857';
-Host User Plugin Authentication_string
+Host User plugin authentication_string
localhost user19857 mysql_native_password *82DC221D557298F6CE9961037DB1C90604792F5C
DROP USER user19857@localhost;
disconnect con1root;
@@ -765,21 +765,23 @@ connection default;
disconnect conn1;
drop user bug12602983_user@localhost;
drop database mysqltest_db;
+create user u1@localhost;
+grant all privileges on *.* to u1@localhost with grant option;
+connect u1, localhost, u1;
set password=password('foobar');
create procedure sp1() select 1;
show grants;
-Grants for root@localhost
-GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION
-GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+Grants for u1@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'u1'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION
grant execute on procedure sp1 to current_user() identified by 'barfoo';
show grants;
-Grants for root@localhost
-GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION
-GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost'
-GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+Grants for u1@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'u1'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION
+GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'u1'@'localhost'
drop procedure sp1;
-set password='';
-update mysql.user set plugin='';
+disconnect u1;
+connection default;
+drop user u1@localhost;
#
# MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
#
diff --git a/mysql-test/main/sp-security.test b/mysql-test/main/sp-security.test
index dd917eed671..7a87fae4097 100644
--- a/mysql-test/main/sp-security.test
+++ b/mysql-test/main/sp-security.test
@@ -1035,15 +1035,18 @@ drop database mysqltest_db;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+create user u1@localhost;
+grant all privileges on *.* to u1@localhost with grant option;
+connect u1, localhost, u1;
set password=password('foobar');
create procedure sp1() select 1;
show grants;
grant execute on procedure sp1 to current_user() identified by 'barfoo';
show grants;
drop procedure sp1;
-set password='';
-#cleanup after MDEV-16238
-update mysql.user set plugin='';
+disconnect u1;
+connection default;
+drop user u1@localhost;
--echo #
--echo # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
diff --git a/mysql-test/main/sp-vars.result b/mysql-test/main/sp-vars.result
index 0d4d18c577d..236695a6c0f 100644
--- a/mysql-test/main/sp-vars.result
+++ b/mysql-test/main/sp-vars.result
@@ -140,7 +140,7 @@ SELECT sp_vars_check_ret3();
sp_vars_check_ret3()
0
Warnings:
-Warning 1366 Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
+Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1
SELECT sp_vars_check_ret4();
sp_vars_check_ret4()
154.12
@@ -195,7 +195,7 @@ SELECT sp_vars_check_ret3();
sp_vars_check_ret3()
0
Warnings:
-Warning 1366 Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
+Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1
SELECT sp_vars_check_ret4();
sp_vars_check_ret4()
154.12
@@ -314,7 +314,7 @@ ERROR 22003: Out of range value for column 'sp_vars_check_ret1()' at row 1
SELECT sp_vars_check_ret2();
ERROR 22003: Out of range value for column 'sp_vars_check_ret2()' at row 1
SELECT sp_vars_check_ret3();
-ERROR 22007: Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
+ERROR 22007: Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1
SELECT sp_vars_check_ret4();
sp_vars_check_ret4()
154.12
@@ -896,7 +896,7 @@ sp_var
@user_var
0
Warnings:
-Warning 1366 Incorrect integer value: 'Hello, world!' for column 'sp_var' at row 1
+Warning 1366 Incorrect integer value: 'Hello, world!' for column ``.``.`sp_var` at row 1
DROP PROCEDURE p1;
DROP TABLE t1;
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index 16b0b1d60e5..39bc09e21d6 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -2293,9 +2293,11 @@ create procedure bug3843()
analyze table t1|
call bug3843()|
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
call bug3843()|
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
select 1+2|
1+2
@@ -2442,7 +2444,7 @@ drop procedure if exists bug4904|
create procedure bug4904()
begin
declare continue handler for sqlstate 'HY000' begin end;
-create table t2 as select * from t3;
+create table not_existing_table as select * from t3;
end|
call bug4904()|
ERROR 42S02: Table 'test.t3' doesn't exist
@@ -4331,8 +4333,11 @@ test.t3 optimize status OK
test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
@@ -4350,8 +4355,11 @@ test.t3 optimize status OK
test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
@@ -4369,8 +4377,11 @@ test.t3 optimize status OK
test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
@@ -4579,7 +4590,7 @@ call bug15231_3()|
Result
Missed it (correct)
Level Code Message
-Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
+Warning 1366 Incorrect decimal value: 'zap' for column ``.``.`x` at row 1
Result
Caught it (correct)
call bug15231_5()|
@@ -6444,7 +6455,7 @@ DROP TABLE t1;
CALL p2('text');
Warnings:
-Warning 1366 Incorrect integer value: 'text' for column 'v' at row 1
+Warning 1366 Incorrect integer value: 'text' for column ``.``.`v` at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -8363,7 +8374,7 @@ FETCH c INTO a;
CLOSE c;
END;
$$
-ERROR 22007: Incorrect integer value: 'y' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: 'y' for column ``.``.`a` at row 1
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
@@ -8559,11 +8570,11 @@ RETURN a = timestamp'2038-01-19 03:14:07.999999'
END
$$
SELECT f1(e) FROM t1;
-ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30'
+ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30.000000'
SELECT f2(e) FROM t1;
-ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30'
+ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30.000000'
SELECT f3(e) FROM t1;
-ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30'
+ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30.000000'
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
@@ -8697,3 +8708,38 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP FUNCTION f1;
+#
+# MDEV-16036: Debug assertion failed in resignal on create
+# temporary table
+#
+set @save_sql_mode= @@sql_mode;
+set sql_mode='ORACLE';
+CREATE or replace procedure p4()
+AS
+CONTINUE HANDLER FOR SQLWARNING
+BEGIN
+NULL;
+END;
+EXIT HANDLER FOR OTHERS -- SQLEXCEPTION
+BEGIN
+GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
+SELECT @sqlstate, @errno, @text;
+SHOW WARNINGS;
+RESIGNAL; -- cause DBG_ASSERT failed
+END;
+BEGIN
+CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL);
+END
+/
+call p4();
+call p4();
+@sqlstate @errno @text
+42S01 1050 Table 't1' already exists
+Level Code Message
+Note 1050 Table 't1' already exists
+Warnings:
+Note 1050 Table 't1' already exists
+drop procedure p4;
+drop table t1;
+set @@sql_mode=@save_sql_mode;
+# End of 10.3 tests
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index 4f520f321c5..230e9c8bb18 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -2918,7 +2918,7 @@ create procedure bug4904()
begin
declare continue handler for sqlstate 'HY000' begin end;
- create table t2 as select * from t3;
+ create table not_existing_table as select * from t3;
end|
-- error 1146
@@ -10239,3 +10239,37 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3;
SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP FUNCTION f1;
+
+--echo #
+--echo # MDEV-16036: Debug assertion failed in resignal on create
+--echo # temporary table
+--echo #
+
+set @save_sql_mode= @@sql_mode;
+set sql_mode='ORACLE';
+delimiter /;
+CREATE or replace procedure p4()
+AS
+ CONTINUE HANDLER FOR SQLWARNING
+ BEGIN
+ NULL;
+ END;
+ EXIT HANDLER FOR OTHERS -- SQLEXCEPTION
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
+ SELECT @sqlstate, @errno, @text;
+ SHOW WARNINGS;
+ RESIGNAL; -- cause DBG_ASSERT failed
+ END;
+BEGIN
+ CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL);
+END
+/
+delimiter ;/
+call p4();
+call p4();
+drop procedure p4;
+drop table t1;
+set @@sql_mode=@save_sql_mode;
+
+--echo # End of 10.3 tests
diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result
index 860f82ebd93..3883225e9bc 100644
--- a/mysql-test/main/sp_notembedded.result
+++ b/mysql-test/main/sp_notembedded.result
@@ -231,8 +231,6 @@ CREATE PROCEDURE p1(i INT) BEGIN END;
disconnect con1;
connection default;
DROP PROCEDURE p1;
-DELETE FROM mysql.user WHERE User='mysqltest_1';
-FLUSH PRIVILEGES;
#
# Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
#
diff --git a/mysql-test/main/sp_notembedded.test b/mysql-test/main/sp_notembedded.test
index 64f1daeaeb9..2f1c4cd92f5 100644
--- a/mysql-test/main/sp_notembedded.test
+++ b/mysql-test/main/sp_notembedded.test
@@ -305,6 +305,7 @@ set session low_priority_updates=default;
#
# Bug#44798 MySQL engine crashes when creating stored procedures with execute_priv=N
#
+--source include/switch_to_mysql_user.inc
INSERT IGNORE INTO mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv,
Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv,
Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv,
@@ -323,10 +324,7 @@ CREATE PROCEDURE p1(i INT) BEGIN END;
disconnect con1;
connection default;
DROP PROCEDURE p1;
-
-DELETE FROM mysql.user WHERE User='mysqltest_1';
-FLUSH PRIVILEGES;
-
+--source include/switch_to_mysql_global_priv.inc
--echo #
--echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
@@ -464,6 +462,7 @@ DROP EVENT teste_bug11763507;
# A case of SHOW GRANTS
# (creating a new procedure changes the password)
#
+--source include/switch_to_mysql_user.inc
grant create routine on test.* to foo1@localhost identified by 'foo';
update mysql.user set authentication_string = replace(authentication_string, '*', '-') where user='foo1';
--connect (foo,localhost,foo1,foo)
@@ -479,6 +478,7 @@ show grants;
--disconnect foo
drop procedure spfoo;
drop user foo1@localhost;
+--source include/switch_to_mysql_global_priv.inc
#
# Restore global concurrent_insert value. Keep in the end of the test file.
diff --git a/mysql-test/main/sql_mode.result b/mysql-test/main/sql_mode.result
index 238bae2efd8..25a90703bf5 100644
--- a/mysql-test/main/sql_mode.result
+++ b/mysql-test/main/sql_mode.result
@@ -476,10 +476,14 @@ select @@sql_mode;
@@sql_mode
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
set sql_mode=2147483648*2*2*2;
-ERROR 42000: Variable 'sql_mode' can't be set to the value of '17179869184'
select @@sql_mode;
@@sql_mode
-REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
+TIME_ROUND_FRACTIONAL
+set sql_mode=2147483648*2*2*2*2;
+ERROR 42000: Variable 'sql_mode' can't be set to the value of '34359738368'
+select @@sql_mode;
+@@sql_mode
+TIME_ROUND_FRACTIONAL
set sql_mode=PAD_CHAR_TO_FULL_LENGTH;
create table t1 (a int auto_increment primary key, b char(5));
insert into t1 (b) values('a'),('b\t'),('c ');
diff --git a/mysql-test/main/sql_mode.test b/mysql-test/main/sql_mode.test
index 8cf50f73f6f..97f5cf42791 100644
--- a/mysql-test/main/sql_mode.test
+++ b/mysql-test/main/sql_mode.test
@@ -263,8 +263,10 @@ set sql_mode=4194304;
select @@sql_mode;
set sql_mode=16384+(65536*4);
select @@sql_mode;
+set sql_mode=2147483648*2*2*2;
+select @@sql_mode;
--error 1231
-set sql_mode=2147483648*2*2*2; # that mode does not exist
+set sql_mode=2147483648*2*2*2*2; # that mode does not exist
select @@sql_mode;
#
diff --git a/mysql-test/main/ssl-crl-revoked-crl.result b/mysql-test/main/ssl-crl-revoked-crl.result
deleted file mode 100644
index 8ecc6a509d3..00000000000
--- a/mysql-test/main/ssl-crl-revoked-crl.result
+++ /dev/null
@@ -1 +0,0 @@
-# try logging in with a certificate in the server's --ssl-crl : should fail
diff --git a/mysql-test/main/ssl.result b/mysql-test/main/ssl.result
index 5de9e5174d8..8de36f55ecf 100644
--- a/mysql-test/main/ssl.result
+++ b/mysql-test/main/ssl.result
@@ -4,10 +4,10 @@ have_ssl
1
SHOW STATUS LIKE 'Ssl_server_not_before';
Variable_name Value
-Ssl_server_not_before Apr 25 20:52:21 2017 GMT
+Ssl_server_not_before Jan 27 10:11:10 2019 GMT
SHOW STATUS LIKE 'Ssl_server_not_after';
Variable_name Value
-Ssl_server_not_after Apr 20 20:52:21 2037 GMT
+Ssl_server_not_after Jan 22 10:11:10 2039 GMT
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -2175,8 +2175,3 @@ still connected?
still connected?
connection default;
disconnect ssl_con;
-create user mysqltest_1@localhost;
-grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
-Variable_name Value
-Ssl_cipher AES256-SHA
-drop user mysqltest_1@localhost;
diff --git a/mysql-test/main/ssl.test b/mysql-test/main/ssl.test
index f2ac288db7a..67db668a1c2 100644
--- a/mysql-test/main/ssl.test
+++ b/mysql-test/main/ssl.test
@@ -32,10 +32,5 @@ select 'still connected?';
connection default;
disconnect ssl_con;
-create user mysqltest_1@localhost;
-grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
---exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1
-drop user mysqltest_1@localhost;
-
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/main/ssl_cert_verify.result b/mysql-test/main/ssl_cert_verify.result
deleted file mode 100644
index 1da77329509..00000000000
--- a/mysql-test/main/ssl_cert_verify.result
+++ /dev/null
@@ -1,5 +0,0 @@
-#T1: Host name (/CN=localhost/) as OU name in the server certificate, server certificate verification should fail.
-#T2: Host name (localhost) as common name in the server certificate, server certificate verification should pass.
-Variable_name Value
-Ssl_version TLS_VERSION
-# restart server using restart
diff --git a/mysql-test/main/ssl_cert_verify.test b/mysql-test/main/ssl_cert_verify.test
deleted file mode 100644
index 83f621b7ca9..00000000000
--- a/mysql-test/main/ssl_cert_verify.test
+++ /dev/null
@@ -1,43 +0,0 @@
-# Want to skip this test from Valgrind execution
---source include/no_valgrind_without_big.inc
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_ssl_communication.inc
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-let $ssl_verify_fail_path = --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-key-verify-fail.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert-verify-fail.pem;
-let $ssl_verify_pass_path = --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-key-verify-pass.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert-verify-pass.pem;
-
---echo #T1: Host name (/CN=localhost/) as OU name in the server certificate, server certificate verification should fail.
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart:" $ssl_verify_fail_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
-
---error 1
---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'"
-
---echo #T2: Host name (localhost) as common name in the server certificate, server certificate verification should pass.
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart:" $ssl_verify_pass_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
-
---replace_result TLSv1.2 TLS_VERSION TLSv1.1 TLS_VERSION TLSv1 TLS_VERSION
---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'"
-
---echo # restart server using restart
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart: " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
diff --git a/mysql-test/main/ssl_cipher-master.opt b/mysql-test/main/ssl_cipher-master.opt
deleted file mode 100644
index d750c46ba5c..00000000000
--- a/mysql-test/main/ssl_cipher-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-ssl-cipher=AES128-SHA
diff --git a/mysql-test/main/ssl_cipher.result b/mysql-test/main/ssl_cipher.result
index 79998dfca80..266c9f9322a 100644
--- a/mysql-test/main/ssl_cipher.result
+++ b/mysql-test/main/ssl_cipher.result
@@ -1,6 +1,61 @@
-#
-# BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'"
-#
+create user ssl_user1@localhost require SSL;
+create user ssl_user2@localhost require cipher 'AES256-SHA';
+create user ssl_user3@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client';
+create user ssl_user4@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client' ISSUER '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB';
+create user ssl_user5@localhost require cipher 'AES256-SHA' AND SUBJECT 'xxx';
+connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA;
+connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET);
+connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA;
+ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO)
+connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA;
+connect con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA;
+connect con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA;
+connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET);
+connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA;
+ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO)
+connection con1;
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES256-SHA
+disconnect con1;
+connection con2;
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES256-SHA
+disconnect con2;
+connection con3;
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES256-SHA
+disconnect con3;
+connection con4;
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES256-SHA
+disconnect con4;
+connection default;
+drop user ssl_user1@localhost, ssl_user2@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES256-SHA
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES128-SHA
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES128-SHA
+mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxxVariable_name Value
+Ssl_cipher AES256-SHA
+Variable_name Value
+Ssl_cipher AES128-SHA
+select 'is still running; no cipher request crashed the server' as result from dual;
+result
+is still running; no cipher request crashed the server
+create user mysqltest_1@localhost;
+grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
+Variable_name Value
+Ssl_cipher AES256-SHA
+drop user mysqltest_1@localhost;
connect ssl_con,localhost,root,,,,,SSL;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
@@ -8,5 +63,5 @@ Ssl_cipher AES128-SHA
SHOW STATUS LIKE 'Ssl_cipher_list';
Variable_name Value
Ssl_cipher_list AES128-SHA
-connection default;
disconnect ssl_con;
+connection default;
diff --git a/mysql-test/main/ssl_cipher.test b/mysql-test/main/ssl_cipher.test
index cf249343324..27854654a9f 100644
--- a/mysql-test/main/ssl_cipher.test
+++ b/mysql-test/main/ssl_cipher.test
@@ -1,23 +1,103 @@
-# Turn on ssl between the client and server
-# and run a number of tests
+#
+# Various tests that require setting of a specific ssl_cipher
+# which currently doesn't work in OpenSSL 1.1.1
+#
+--source include/have_ssl_communication.inc
---echo #
---echo # BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'"
---echo #
+if (`select @@version_ssl_library like 'OpenSSL 1.1.1%'`) {
+ skip OpenSSL 1.1.1;
+}
--- source include/have_ssl_communication.inc
+create user ssl_user1@localhost require SSL;
+create user ssl_user2@localhost require cipher 'AES256-SHA';
+create user ssl_user3@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client';
+create user ssl_user4@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client' ISSUER '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB';
+create user ssl_user5@localhost require cipher 'AES256-SHA' AND SUBJECT 'xxx';
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
+connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA);
+connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA);
+connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA);
+connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA);
-connect (ssl_con,localhost,root,,,,,SSL);
+connection con1;
+SHOW STATUS LIKE 'Ssl_cipher';
+disconnect con1;
+connection con2;
+SHOW STATUS LIKE 'Ssl_cipher';
+disconnect con2;
+connection con3;
+SHOW STATUS LIKE 'Ssl_cipher';
+disconnect con3;
+connection con4;
+SHOW STATUS LIKE 'Ssl_cipher';
+disconnect con4;
+connection default;
+drop user ssl_user1@localhost, ssl_user2@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
-# Check Cipher Name and Cipher List
+#
+# Bug#21611 Slave can't connect when master-ssl-cipher specified
+# - Apparently selecting a cipher doesn't work at all
+# - Use a cipher that both yaSSL and OpenSSL supports
+#
+--write_file $MYSQLTEST_VARDIR/tmp/test.sql
SHOW STATUS LIKE 'Ssl_cipher';
-SHOW STATUS LIKE 'Ssl_cipher_list';
+EOF
+--exec $MYSQL_TEST --ssl-cipher=AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+# Test to connect using a list of ciphers
+--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER:AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+# Test to connect using a specifi cipher
+--exec $MYSQL_TEST --ssl-cipher=AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+# Test to connect using an unknown cipher
+--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
+--error 1
+--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+--remove_file $MYSQLTEST_VARDIR/tmp/test.sql
-connection default;
-disconnect ssl_con;
+#
+# Bug#39172 Asking for DH+non-RSA key with server set to use other key caused
+# YaSSL to crash the server.
+#
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
+# Common ciphers to openssl and yassl
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES128-SHA
+--disable_query_log
+--disable_result_log
+
+# Below here caused crashes. ################
+--error 0,1
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST
+# These probably exist but the server's keys can't be used to accept these kinds of connections.
+--error 0,1
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=AES128-RMD
+
+# If this gives a result, then the bug is fixed.
+--enable_result_log
+--enable_query_log
+select 'is still running; no cipher request crashed the server' as result from dual;
+
+#
+# MDEV-10054 Secure login fails when CIPHER is required
+#
+create user mysqltest_1@localhost;
+grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
+--exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1
+drop user mysqltest_1@localhost;
+
+#
+# BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'"
+# it was a bug in yaSSL, fixed in d2e36e4258bb
+#
+let $restart_parameters=--ssl-cipher=AES128-SHA;
+source include/restart_mysqld.inc;
+connect (ssl_con,localhost,root,,,,,SSL);
+SHOW STATUS LIKE 'Ssl_cipher';
+SHOW STATUS LIKE 'Ssl_cipher_list';
+disconnect ssl_con;
+connection default;
diff --git a/mysql-test/main/ssl_crl-master.opt b/mysql-test/main/ssl_crl-master.opt
deleted file mode 100644
index 8500f8cd6e7..00000000000
--- a/mysql-test/main/ssl_crl-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem
---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
diff --git a/mysql-test/main/ssl_crl.combinations b/mysql-test/main/ssl_crl.combinations
new file mode 100644
index 00000000000..abeec480510
--- /dev/null
+++ b/mysql-test/main/ssl_crl.combinations
@@ -0,0 +1,5 @@
+[file]
+ssl-crl=$MYSQL_TEST_DIR/std_data/client-cert.crl
+
+[path]
+ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir
diff --git a/mysql-test/main/ssl_crl.result b/mysql-test/main/ssl_crl.result
index 570dd9cab06..598774bd772 100644
--- a/mysql-test/main/ssl_crl.result
+++ b/mysql-test/main/ssl_crl.result
@@ -1,23 +1,5 @@
-# test --crl for the client : should connect
+# try logging in with a certificate not in the server's --ssl-crl : should succeed
Variable_name Value
-have_openssl YES
-have_ssl YES
-ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
-ssl_capath
-ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem
-ssl_cipher
-ssl_crl MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
-ssl_crlpath
-ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem
-# test --crlpath for the client : should connect
-Variable_name Value
-have_openssl YES
-have_ssl YES
-ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
-ssl_capath
-ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem
-ssl_cipher
-ssl_crl MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
-ssl_crlpath
-ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem
+Ssl_version TLS_VERSION
# try logging in with a certificate in the server's --ssl-crl : should fail
+ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked
diff --git a/mysql-test/main/ssl_crl.test b/mysql-test/main/ssl_crl.test
index 65c14837e50..dc30a9b5934 100644
--- a/mysql-test/main/ssl_crl.test
+++ b/mysql-test/main/ssl_crl.test
@@ -2,15 +2,12 @@
-- source include/not_embedded.inc
-- source include/have_openssl.inc
---echo # test --crl for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';"
-
---echo # test --crlpath for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';"
+--echo # try logging in with a certificate not in the server's --ssl-crl : should succeed
+--replace_result TLSv1.3 TLS_VERSION TLSv1.2 TLS_VERSION TLSv1.1 TLS_VERSION TLSv1 TLS_VERSION
+--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-new-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-new-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'"
--echo # try logging in with a certificate in the server's --ssl-crl : should fail
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+# OpenSSL 1.1.1a correctly rejects the certificate, but the error message is wrong
+--replace_result "ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0" "ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked"
--error 1
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';"
+--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
diff --git a/mysql-test/main/ssl_crl_clients-master.opt b/mysql-test/main/ssl_crl_clients-master.opt
deleted file mode 100644
index fa885a61a0c..00000000000
--- a/mysql-test/main/ssl_crl_clients-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem
---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
diff --git a/mysql-test/main/ssl_crl_clients-valid.result b/mysql-test/main/ssl_crl_clients-valid.result
deleted file mode 100644
index f3f47d51846..00000000000
--- a/mysql-test/main/ssl_crl_clients-valid.result
+++ /dev/null
@@ -1,24 +0,0 @@
-# Test clients with and without CRL lists
-############ Test mysql ##############
-# Test mysql connecting to a server with an empty crl
-Variable_name Value
-have_openssl YES
-have_ssl YES
-ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
-ssl_capath
-ssl_cert MYSQL_TEST_DIR/std_data/crl-client-cert.pem
-ssl_cipher
-ssl_crl
-ssl_crlpath
-ssl_key MYSQL_TEST_DIR/std_data/crl-client-key.pem
-# Test mysql connecting to a server with a certificate revoked by -crl
-# Test mysql connecting to a server with a certificate revoked by -crlpath
-############ Test mysqladmin ##############
-# Test mysqladmin connecting to a server with an empty crl
-mysqld is alive
-# Test mysqladmin connecting to a server with a certificate revoked by -crl
-mysqladmin: connect to server at 'localhost' failed
-error: 'SSL connection error: Failed to set ciphers to use'
-# Test mysqladmin connecting to a server with a certificate revoked by -crlpath
-mysqladmin: connect to server at 'localhost' failed
-error: 'SSL connection error: error:00000005:lib(0):func(0):DH lib'
diff --git a/mysql-test/main/ssl_crl_clients.result b/mysql-test/main/ssl_crl_clients.result
index 3bb9b4ee7e2..0d8ed9a4158 100644
--- a/mysql-test/main/ssl_crl_clients.result
+++ b/mysql-test/main/ssl_crl_clients.result
@@ -1,7 +1,13 @@
# Test clients with and without CRL lists
############ Test mysql ##############
# Test mysql connecting to a server with a certificate revoked by -crl
+ERROR 2026 (HY000): SSL connection error: certificate revoked
# Test mysql connecting to a server with a certificate revoked by -crlpath
+ERROR 2026 (HY000): SSL connection error: certificate revoked
############ Test mysqladmin ##############
# Test mysqladmin connecting to a server with a certificate revoked by -crl
+mysqladmin: connect to server at 'localhost' failed
+error: 'SSL connection error: certificate revoked'
# Test mysqladmin connecting to a server with a certificate revoked by -crlpath
+mysqladmin: connect to server at 'localhost' failed
+error: 'SSL connection error: certificate revoked'
diff --git a/mysql-test/main/ssl_crl_clients.test b/mysql-test/main/ssl_crl_clients.test
index 7c05f498fbe..fc954a2fc38 100644
--- a/mysql-test/main/ssl_crl_clients.test
+++ b/mysql-test/main/ssl_crl_clients.test
@@ -4,38 +4,33 @@
--echo # Test clients with and without CRL lists
-let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem;
-let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl;
-let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir;
+let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem --ssl-verify-server-cert;
+let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/server-cert.crl;
+let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TMP_DIR;
+# See `openssl x509 -in server-cert.pem -noout -issuer_hash`
+copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0;
--echo ############ Test mysql ##############
--echo # Test mysql connecting to a server with a certificate revoked by -crl
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';"
+--exec $MYSQL $ssl_crl test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
--echo # Test mysql connecting to a server with a certificate revoked by -crlpath
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
---exec $MYSQL $ssl_crlpath test -e "SHOW VARIABLES like '%ssl%';"
+--exec $MYSQL $ssl_crlpath test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
--echo ############ Test mysqladmin ##############
-let $admin_prefix = --no-defaults;
let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping;
--echo # Test mysqladmin connecting to a server with a certificate revoked by -crl
---disable_result_log
---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/
---error 2
---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1
---enable_result_log
+--replace_regex /.*mysqladmin.*:/mysqladmin:/
+--error 1
+--exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1
---disable_result_log
--echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath
---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/
---error 2
---exec $MYSQLADMIN $admin_prefix $ssl_crlpath $admin_suffix 2>&1
---enable_result_log
+--replace_regex /.*mysqladmin.*:/mysqladmin:/
+--error 1
+--exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1
diff --git a/mysql-test/main/ssl_crl_clients_valid-master.opt b/mysql-test/main/ssl_crl_clients_valid-master.opt
deleted file mode 100644
index 258df564eba..00000000000
--- a/mysql-test/main/ssl_crl_clients_valid-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem
---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
diff --git a/mysql-test/main/ssl_crl_clients_valid.result b/mysql-test/main/ssl_crl_clients_valid.result
deleted file mode 100644
index 32ee72d5c39..00000000000
--- a/mysql-test/main/ssl_crl_clients_valid.result
+++ /dev/null
@@ -1,16 +0,0 @@
-# Test clients with and without CRL lists
-############ Test mysql ##############
-# Test mysql connecting to a server with an empty crl
-Variable_name Value
-have_openssl YES
-have_ssl YES
-ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
-ssl_capath
-ssl_cert MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem
-ssl_cipher
-ssl_crl MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
-ssl_crlpath
-ssl_key MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem
-############ Test mysqladmin ##############
-# Test mysqladmin connecting to a server with an empty crl
-mysqld is alive
diff --git a/mysql-test/main/ssl_crl_clients_valid.test b/mysql-test/main/ssl_crl_clients_valid.test
deleted file mode 100644
index f08fbf09397..00000000000
--- a/mysql-test/main/ssl_crl_clients_valid.test
+++ /dev/null
@@ -1,23 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_openssl.inc
-
---echo # Test clients with and without CRL lists
-
-let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem;
-let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl;
-let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir;
-
-
---echo ############ Test mysql ##############
-
---echo # Test mysql connecting to a server with an empty crl
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';" 2>&1
-
---echo ############ Test mysqladmin ##############
-let $admin_prefix = --no-defaults;
-let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping;
-
---echo # Test mysqladmin connecting to a server with an empty crl
---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1
diff --git a/mysql-test/main/ssl_crl_clrpath-master.opt b/mysql-test/main/ssl_crl_clrpath-master.opt
deleted file mode 100644
index b1f486a322b..00000000000
--- a/mysql-test/main/ssl_crl_clrpath-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem
---ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir
diff --git a/mysql-test/main/ssl_crl_clrpath.result b/mysql-test/main/ssl_crl_clrpath.result
deleted file mode 100644
index b4b4d13eca1..00000000000
--- a/mysql-test/main/ssl_crl_clrpath.result
+++ /dev/null
@@ -1,23 +0,0 @@
-# test --crl for the client : should connect
-Variable_name Value
-have_openssl YES
-have_ssl YES
-ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
-ssl_capath
-ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem
-ssl_cipher
-ssl_crl
-ssl_crlpath MYSQL_TEST_DIR/std_data/crldir
-ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem
-# test --crlpath for the client : should connect
-Variable_name Value
-have_openssl YES
-have_ssl YES
-ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
-ssl_capath
-ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem
-ssl_cipher
-ssl_crl
-ssl_crlpath MYSQL_TEST_DIR/std_data/crldir
-ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem
-# try logging in with a certificate in the server's --ssl-crlpath : should fail
diff --git a/mysql-test/main/ssl_crl_clrpath.test b/mysql-test/main/ssl_crl_clrpath.test
deleted file mode 100644
index 50d84ad175e..00000000000
--- a/mysql-test/main/ssl_crl_clrpath.test
+++ /dev/null
@@ -1,16 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_openssl.inc
-
---echo # test --crl for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';"
-
---echo # test --crlpath for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';"
-
---echo # try logging in with a certificate in the server's --ssl-crlpath : should fail
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';"
diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result
index 9a5c023a72f..56efb53aab9 100644
--- a/mysql-test/main/stat_tables.result
+++ b/mysql-test/main/stat_tables.result
@@ -64,12 +64,12 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 179 Using where; Using temporary; Using filesort
-1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
-1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
-1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
+1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5
+1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1
+1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6
+1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
-1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
from customer, orders, lineitem, supplier, nation, region
where c_custkey = o_custkey and l_orderkey = o_orderkey
@@ -80,7 +80,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
n_name revenue
-PERU 321915.8715
+PERU 321915.87150000007
ARGENTINA 69817.1451
set optimizer_switch=@save_optimizer_switch;
delete from mysql.index_stats;
@@ -171,12 +171,12 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 179 Using where; Using temporary; Using filesort
-1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
-1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
-1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
+1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5
+1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1
+1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6
+1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
-1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
from customer, orders, lineitem, supplier, nation, region
where c_custkey = o_custkey and l_orderkey = o_orderkey
@@ -187,7 +187,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
n_name revenue
-PERU 321915.8715
+PERU 321915.87150000007
ARGENTINA 69817.1451
set optimizer_switch=@save_optimizer_switch;
EXPLAIN select o_year,
@@ -207,14 +207,14 @@ and o_orderdate between date '1995-01-01' and date '1996-12-31'
group by o_year
order by o_year;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort
-1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
-1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
-1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
-1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_partkey 1 Using where
+1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
+1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 5 dbt3_s001.part.p_partkey 30 Using index condition
1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1
+1 SIMPLE orders eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
+1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1
+1 SIMPLE n1 ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 Using where
select o_year,
sum(case when nation = 'UNITED STATES' then volume else 0 end) /
sum(volume) as mkt_share
@@ -587,10 +587,29 @@ explain
SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL
-1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
+1 SIMPLE global_priv ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
#
+# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
+#
+set @@use_stat_tables= PREFERABLY;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @save_use_stat_tables= @@use_stat_tables;
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+analyze table t1 persistent for columns (a) indexes ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from t1 where a=1 and b=3;
+a b
+1 3
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set use_stat_tables=@save_use_stat_tables;
+drop table t1;
+#
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
#
SET use_stat_tables= PREFERABLY;
@@ -606,3 +625,59 @@ MAX(pk)
NULL
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
+#
+# MDEV-17255: New optimizer defaults and ANALYZE TABLE
+#
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+set use_stat_tables= preferably_for_queries;
+#
+# with use_stat_tables= PREFERABLY_FOR_QUERIES
+# analyze table t1 will not collect statistics
+#
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select * from mysql.column_stats;
+db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
+analyze
+select * from t1 where a = 1 and b=3;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+#
+# with use_stat_tables= PREFERABLY_FOR_QUERIES
+# analyze table t1 will collect statistics if we use PERSISTENT
+# for columns, indexes or everything
+#
+analyze table t1 persistent for columns (a) indexes ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status Table is already up to date
+select * from mysql.column_stats;
+db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
+test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL
+# filtered shows that we used the data from stat tables
+analyze
+select * from t1 where a = 1 and b=3;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where
+#
+# with use_stat_tables= PREFERABLY
+# analyze table t1 will collect statistics
+#
+set use_stat_tables=PREFERABLY;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status Table is already up to date
+select * from mysql.column_stats;
+db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
+test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL
+test t1 b 2 10 0.0000 4.0000 1.1111 0 NULL NULL
+# filtered shows that we used the data from stat tables
+analyze
+select * from t1 where a=1 and b=3;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where
+drop table t1;
+set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/main/stat_tables.test b/mysql-test/main/stat_tables.test
index 19bc0fa2f46..2c1d53a2583 100644
--- a/mysql-test/main/stat_tables.test
+++ b/mysql-test/main/stat_tables.test
@@ -370,6 +370,23 @@ set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectiv
set use_stat_tables=@save_use_stat_tables;
--echo #
+--echo # MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
+--echo #
+
+set @@use_stat_tables= PREFERABLY;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @save_use_stat_tables= @@use_stat_tables;
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+
+analyze table t1 persistent for columns (a) indexes ();
+select * from t1 where a=1 and b=3;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set use_stat_tables=@save_use_stat_tables;
+drop table t1;
+
+--echo #
--echo # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
--echo #
@@ -383,5 +400,47 @@ CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, t TEXT);
SELECT MAX(pk) FROM t1;
DROP TABLE t1;
+set use_stat_tables=@save_use_stat_tables;
+--echo #
+--echo # MDEV-17255: New optimizer defaults and ANALYZE TABLE
+--echo #
+
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+set use_stat_tables= preferably_for_queries;
+--echo #
+--echo # with use_stat_tables= PREFERABLY_FOR_QUERIES
+--echo # analyze table t1 will not collect statistics
+--echo #
+
+analyze table t1;
+select * from mysql.column_stats;
+analyze
+select * from t1 where a = 1 and b=3;
+
+--echo #
+--echo # with use_stat_tables= PREFERABLY_FOR_QUERIES
+--echo # analyze table t1 will collect statistics if we use PERSISTENT
+--echo # for columns, indexes or everything
+--echo #
+
+analyze table t1 persistent for columns (a) indexes ();
+select * from mysql.column_stats;
+--echo # filtered shows that we used the data from stat tables
+analyze
+select * from t1 where a = 1 and b=3;
+
+--echo #
+--echo # with use_stat_tables= PREFERABLY
+--echo # analyze table t1 will collect statistics
+--echo #
+
+set use_stat_tables=PREFERABLY;
+analyze table t1;
+select * from mysql.column_stats;
+--echo # filtered shows that we used the data from stat tables
+analyze
+select * from t1 where a=1 and b=3;
+drop table t1;
set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/main/stat_tables_disabled.result b/mysql-test/main/stat_tables_disabled.result
index b1c37169f02..c974bba5a4b 100644
--- a/mysql-test/main/stat_tables_disabled.result
+++ b/mysql-test/main/stat_tables_disabled.result
@@ -6,10 +6,10 @@ set global innodb_stats_persistent_sample_pages=100;
SET SESSION STORAGE_ENGINE='InnoDB';
select @@global.use_stat_tables;
@@global.use_stat_tables
-NEVER
+PREFERABLY
select @@session.use_stat_tables;
@@session.use_stat_tables
-NEVER
+PREFERABLY
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
DROP DATABASE IF EXISTS dbt3_s001;
diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result
index 69c07b0932f..feb7a4c65b1 100644
--- a/mysql-test/main/stat_tables_innodb.result
+++ b/mysql-test/main/stat_tables_innodb.result
@@ -72,11 +72,11 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort
-1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
-1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
-1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index
-1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
+1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5
+1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index
+1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
+1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using filter
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
from customer, orders, lineitem, supplier, nation, region
@@ -88,7 +88,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
n_name revenue
-PERU 321915.8715
+PERU 321915.87150000007
ARGENTINA 69817.1451
set optimizer_switch=@save_optimizer_switch;
delete from mysql.index_stats;
@@ -203,11 +203,11 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort
-1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
-1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
-1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index
-1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
+1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5
+1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index
+1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
+1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using filter
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
from customer, orders, lineitem, supplier, nation, region
@@ -219,7 +219,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
n_name revenue
-PERU 321915.8715
+PERU 321915.87150000007
ARGENTINA 69817.1451
set optimizer_switch=@save_optimizer_switch;
EXPLAIN select o_year,
@@ -239,14 +239,14 @@ and o_orderdate between date '1995-01-01' and date '1996-12-31'
group by o_year
order by o_year;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort
-1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
-1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
-1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
-1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_partkey 1 Using where
+1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort
+1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 5 dbt3_s001.part.p_partkey 30 Using index condition
1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1
+1 SIMPLE orders eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
+1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
+1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where
select o_year,
sum(case when nation = 'UNITED STATES' then volume else 0 end) /
sum(volume) as mkt_share
@@ -619,10 +619,29 @@ explain
SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL
-1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
+1 SIMPLE global_priv ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
#
+# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
+#
+set @@use_stat_tables= PREFERABLY;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @save_use_stat_tables= @@use_stat_tables;
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+analyze table t1 persistent for columns (a) indexes ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from t1 where a=1 and b=3;
+a b
+1 3
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set use_stat_tables=@save_use_stat_tables;
+drop table t1;
+#
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
#
SET use_stat_tables= PREFERABLY;
@@ -638,6 +657,62 @@ MAX(pk)
NULL
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
+#
+# MDEV-17255: New optimizer defaults and ANALYZE TABLE
+#
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+set use_stat_tables= preferably_for_queries;
+#
+# with use_stat_tables= PREFERABLY_FOR_QUERIES
+# analyze table t1 will not collect statistics
+#
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select * from mysql.column_stats;
+db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
+analyze
+select * from t1 where a = 1 and b=3;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+#
+# with use_stat_tables= PREFERABLY_FOR_QUERIES
+# analyze table t1 will collect statistics if we use PERSISTENT
+# for columns, indexes or everything
+#
+analyze table t1 persistent for columns (a) indexes ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from mysql.column_stats;
+db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
+test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL
+# filtered shows that we used the data from stat tables
+analyze
+select * from t1 where a = 1 and b=3;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where
+#
+# with use_stat_tables= PREFERABLY
+# analyze table t1 will collect statistics
+#
+set use_stat_tables=PREFERABLY;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from mysql.column_stats;
+db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
+test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL
+test t1 b 2 10 0.0000 4.0000 1.1111 0 NULL NULL
+# filtered shows that we used the data from stat tables
+analyze
+select * from t1 where a=1 and b=3;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where
+drop table t1;
+set use_stat_tables=@save_use_stat_tables;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
diff --git a/mysql-test/main/stat_tables_rbr.result b/mysql-test/main/stat_tables_rbr.result
index 7ae7ade4398..130d1f6da9a 100644
--- a/mysql-test/main/stat_tables_rbr.result
+++ b/mysql-test/main/stat_tables_rbr.result
@@ -1,15 +1,15 @@
#
# Bug mdev-463: assertion failure when running ANALYZE with RBR on
#
-SET GLOBAL use_stat_tables = PREFERABLY;
connect con1,localhost,root,,;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+set use_stat_tables= PREFERABLY;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
-SET GLOBAL use_stat_tables = DEFAULT;
+SET use_stat_tables = DEFAULT;
disconnect con1;
connection default;
SET use_stat_tables = PREFERABLY;
diff --git a/mysql-test/main/stat_tables_rbr.test b/mysql-test/main/stat_tables_rbr.test
index 29f7c4e6622..1b6a9603743 100644
--- a/mysql-test/main/stat_tables_rbr.test
+++ b/mysql-test/main/stat_tables_rbr.test
@@ -6,15 +6,14 @@
--echo # Bug mdev-463: assertion failure when running ANALYZE with RBR on
--echo #
-SET GLOBAL use_stat_tables = PREFERABLY;
-
--connect (con1,localhost,root,,)
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+set use_stat_tables= PREFERABLY;
ANALYZE TABLE t1;
# Cleanup
DROP TABLE t1;
-SET GLOBAL use_stat_tables = DEFAULT;
+SET use_stat_tables = DEFAULT;
--disconnect con1
--connection default
diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result
index 574eb5f4727..34a17cf049c 100644
--- a/mysql-test/main/statistics.result
+++ b/mysql-test/main/statistics.result
@@ -1086,9 +1086,6 @@ test t2 idx4 3 1.1304
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -1149,11 +1146,6 @@ test t2 idx4 4 1.0000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
-test.t2 analyze Note Data truncated for column 'avg_length' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -1179,8 +1171,6 @@ test t2 idx3 1 8.5000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
diff --git a/mysql-test/main/status.result b/mysql-test/main/status.result
index 688d8acee1a..37c551328f0 100644
--- a/mysql-test/main/status.result
+++ b/mysql-test/main/status.result
@@ -324,7 +324,7 @@ Handler_mrr_key_refills 0
Handler_mrr_rowid_refills 0
Handler_prepare 0
Handler_read_first 0
-Handler_read_key 4
+Handler_read_key 9
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
@@ -403,9 +403,9 @@ Table_open_cache_overflows 0
SHOW STATUS LIKE 'Table_open_cache%';
Variable_name Value
Table_open_cache_active_instances 1
-Table_open_cache_hits 30
-Table_open_cache_misses 15
-Table_open_cache_overflows 5
+Table_open_cache_hits 72
+Table_open_cache_misses 18
+Table_open_cache_overflows 8
FLUSH TABLES;
FLUSH STATUS;
SET @@global.table_open_cache= @old_table_open_cache;
diff --git a/mysql-test/main/str_to_datetime_457.result b/mysql-test/main/str_to_datetime_457.result
index a024b30944c..e365c303c81 100644
--- a/mysql-test/main/str_to_datetime_457.result
+++ b/mysql-test/main/str_to_datetime_457.result
@@ -17,10 +17,7 @@ Warnings:
Warning 1292 Incorrect datetime value: '0'
select extract(hour from '100000:02:03'), extract(hour from '100000:02:03 ');
extract(hour from '100000:02:03') extract(hour from '100000:02:03 ')
-NULL NULL
-Warnings:
-Warning 1292 Incorrect time value: '100000:02:03'
-Warning 1292 Incorrect time value: '100000:02:03 '
+16 16
#
# backward compatibility craziness
#
diff --git a/mysql-test/main/strict.result b/mysql-test/main/strict.result
index 315bb9dc1b5..b9db4166398 100644
--- a/mysql-test/main/strict.result
+++ b/mysql-test/main/strict.result
@@ -8,43 +8,43 @@ CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
INSERT INTO t1 VALUES('0000-10-31');
INSERT INTO t1 VALUES('2004-0-31');
-ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-0-31' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
-ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 2
+ERROR 22007: Incorrect date value: '2004-0-31' for column `test`.`t1`.`col1` at row 2
INSERT INTO t1 VALUES('2004-10-0');
-ERROR 22007: Incorrect date value: '2004-10-0' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-10-0' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-09-31');
-ERROR 22007: Incorrect date value: '2004-09-31' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-09-31' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-10-32');
-ERROR 22007: Incorrect date value: '2004-10-32' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-10-32' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2003-02-29');
-ERROR 22007: Incorrect date value: '2003-02-29' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2003-02-29' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-13-15');
-ERROR 22007: Incorrect date value: '2004-13-15' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-13-15' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('0000-00-00');
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES ('59');
-ERROR 22007: Incorrect date value: '59' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '59' for column `test`.`t1`.`col1` at row 1
set @@sql_mode='STRICT_ALL_TABLES';
INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31');
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
INSERT INTO t1 VALUES('2004-0-30');
-ERROR 22007: Incorrect date value: '2004-0-30' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-0-30' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05');
-ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 2
+ERROR 22007: Incorrect date value: '2004-0-31' for column `test`.`t1`.`col1` at row 2
INSERT INTO t1 VALUES('0000-00-00');
INSERT IGNORE INTO t1 VALUES('2004-0-29');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
INSERT INTO t1 VALUES('0000-00-00');
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`col1` at row 1
INSERT IGNORE INTO t1 VALUES('0000-00-00');
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('2004-0-30');
INSERT INTO t1 VALUES ('2004-2-30');
-ERROR 22007: Incorrect date value: '2004-2-30' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-2-30' for column `test`.`t1`.`col1` at row 1
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
INSERT INTO t1 VALUES ('2004-2-30');
set @@sql_mode='ansi,traditional';
@@ -73,7 +73,7 @@ drop table t1;
set @@sql_mode='strict_trans_tables';
CREATE TABLE t1 (col1 date) engine=myisam;
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
-ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-13-31' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 2
@@ -81,7 +81,7 @@ INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT INTO t1 VALUES ('2003-02-29');
-ERROR 22007: Incorrect date value: '2003-02-29' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2003-02-29' for column `test`.`t1`.`col1` at row 1
INSERT ignore INTO t1 VALUES('2003-02-30');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
@@ -100,14 +100,14 @@ drop table t1;
set @@sql_mode='strict_trans_tables';
CREATE TABLE t1 (col1 date) engine=innodb;
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
-ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-13-31' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3');
-ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 2
+ERROR 22007: Incorrect date value: '2004-13-31' for column `test`.`t1`.`col1` at row 2
INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT INTO t1 VALUES ('2003-02-29');
-ERROR 22007: Incorrect date value: '2003-02-29' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2003-02-29' for column `test`.`t1`.`col1` at row 1
INSERT ignore INTO t1 VALUES('2003-02-30');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
@@ -125,21 +125,21 @@ CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-09-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
-ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('0000-00-00 15:30:00');
-ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES ('59');
-ERROR 22007: Incorrect datetime value: '59' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '59' for column `test`.`t1`.`col1` at row 1
select * from t1;
col1
2004-10-31 15:30:00
@@ -149,49 +149,49 @@ drop table t1;
CREATE TABLE t1 (col1 timestamp);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-09-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
-ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-02-29 25:30:00');
-ERROR 22007: Incorrect datetime value: '2004-02-29 25:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-02-29 25:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-02-29 15:65:00');
-ERROR 22007: Incorrect datetime value: '2004-02-29 15:65:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-02-29 15:65:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-02-29 15:31:61');
-ERROR 22007: Incorrect datetime value: '2004-02-29 15:31:61' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-02-29 15:31:61' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('0000-00-00 15:30:00');
-ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`col1` at row 1
INSERT IGNORE INTO t1 VALUES('0000-00-00 00:00:00');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT INTO t1 VALUES ('59');
-ERROR 22007: Incorrect datetime value: '59' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '59' for column `test`.`t1`.`col1` at row 1
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
-ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('2004-02-30 15:30:04');
-ERROR 22007: Incorrect datetime value: '2004-02-30 15:30:04' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '2004-02-30 15:30:04' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`col1` at row 1
set @@sql_mode='ansi,traditional';
SELECT * FROM t1;
col1
@@ -214,11 +214,11 @@ ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_dat
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
@@ -228,27 +228,27 @@ ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_dat
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1
+ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col2` at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1
+ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col2` at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col3` at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col3` at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' at row 1
+ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col3` at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
@@ -273,7 +273,7 @@ ERROR 22007: Incorrect datetime value: '2004-0-10 15:30'
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col3` at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-0 15:30'
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -291,7 +291,7 @@ ERROR 22007: Incorrect datetime value: '2004-10-0'
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
ERROR 22007: Incorrect datetime value: '2004-0-10'
INSERT INTO t1 (col1) VALUES('2004-0-10');
-ERROR 22007: Incorrect date value: '2004-0-10' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '2004-0-10' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
@@ -302,7 +302,7 @@ ERROR 22007: Incorrect datetime value: '2004-0-10 15:30'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col3` at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-0 15:30'
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
@@ -366,9 +366,9 @@ Warnings:
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -449,9 +449,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -533,9 +533,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -617,9 +617,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -699,9 +699,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -786,9 +786,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect decimal value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect decimal value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect decimal value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -853,9 +853,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect double value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -903,9 +903,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
+ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect double value: 'a59b' for column `test`.`t1`.`col1` at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -1135,9 +1135,9 @@ NULL 10
drop table t1;
create table t1 (col1 date, col2 datetime, col3 timestamp);
insert into t1 values (0,0,0);
-ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '0' for column `test`.`t1`.`col1` at row 1
insert into t1 values (0.0,0.0,0.0);
-ERROR 22007: Incorrect date value: '0.0' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '0.0' for column `test`.`t1`.`col1` at row 1
insert into t1 (col1) values (convert('0000-00-00',date));
ERROR 22007: Incorrect datetime value: '0000-00-00'
insert into t1 (col1) values (cast('0000-00-00' as date));
@@ -1160,7 +1160,7 @@ insert ignore into t1 values ('0000-00-00');
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
insert into t1 select * from t1;
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`col1` at row 1
insert ignore into t1 values ('0000-00-00');
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
@@ -1168,15 +1168,15 @@ insert ignore into t1 (col1) values (cast('0000-00-00' as date));
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00'
insert into t1 select * from t1;
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column ``.`(temporary)`.`col1` at row 1
alter table t1 modify col1 datetime;
-ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00' for column `test`.`t1`.`col1` at row 1
alter ignore table t1 modify col1 datetime;
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
Warning 1264 Out of range value for column 'col1' at row 2
insert into t1 select * from t1;
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column ``.`(temporary)`.`col1` at row 1
select * from t1;
col1
0000-00-00 00:00:00
@@ -1256,12 +1256,12 @@ drop table t1;
set @@sql_mode='traditional';
create table t1 (d date);
insert into t1 values ('2000-10-00');
-ERROR 22007: Incorrect date value: '2000-10-00' for column 'd' at row 1
+ERROR 22007: Incorrect date value: '2000-10-00' for column `test`.`t1`.`d` at row 1
insert into t1 values (1000);
-ERROR 22007: Incorrect date value: '1000' for column 'd' at row 1
+ERROR 22007: Incorrect date value: '1000' for column `test`.`t1`.`d` at row 1
insert into t1 values ('2000-10-01');
update t1 set d = 1100;
-ERROR 22007: Incorrect date value: '1100' for column 'd' at row 1
+ERROR 22007: Incorrect date value: '1100' for column `test`.`t1`.`d` at row 1
select * from t1;
d
2000-10-01
@@ -1457,34 +1457,34 @@ col5 mediumint, col6 mediumint unsigned,
col7 int, col8 int unsigned,
col9 bigint, col10 bigint unsigned);
insert into t1(col1) values('-');
-ERROR 22007: Incorrect integer value: '-' for column 'col1' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col1` at row 1
insert into t1(col2) values('+');
-ERROR 22007: Incorrect integer value: '+' for column 'col2' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col2` at row 1
insert into t1(col3) values('-');
-ERROR 22007: Incorrect integer value: '-' for column 'col3' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col3` at row 1
insert into t1(col4) values('+');
-ERROR 22007: Incorrect integer value: '+' for column 'col4' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col4` at row 1
insert into t1(col5) values('-');
-ERROR 22007: Incorrect integer value: '-' for column 'col5' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col5` at row 1
insert into t1(col6) values('+');
-ERROR 22007: Incorrect integer value: '+' for column 'col6' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col6` at row 1
insert into t1(col7) values('-');
-ERROR 22007: Incorrect integer value: '-' for column 'col7' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col7` at row 1
insert into t1(col8) values('+');
-ERROR 22007: Incorrect integer value: '+' for column 'col8' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col8` at row 1
insert into t1(col9) values('-');
-ERROR 22007: Incorrect integer value: '-' for column 'col9' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col9` at row 1
insert into t1(col10) values('+');
-ERROR 22007: Incorrect integer value: '+' for column 'col10' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col10` at row 1
drop table t1;
set sql_mode='traditional';
create table t1(a year);
insert into t1 values ('-');
-ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1
insert into t1 values ('+');
-ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1
insert into t1 values ('');
-ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1
insert into t1 values ('2000a');
ERROR 01000: Data truncated for column 'a' at row 1
insert into t1 values ('2E3x');
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index 6f9fd458892..393e9be8c22 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -344,7 +344,7 @@ patient_uq clinic_uq
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
-1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
@@ -1441,7 +1441,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1451,7 +1451,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1461,8 +1461,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
+1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
@@ -1630,7 +1630,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -7023,8 +7023,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_exists2in.result b/mysql-test/main/subselect_exists2in.result
index 95fc1c19b82..029ac22a486 100644
--- a/mysql-test/main/subselect_exists2in.result
+++ b/mysql-test/main/subselect_exists2in.result
@@ -142,6 +142,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c);
create index idx_t1_2 on t1 (a1,a2,b);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
create table t2 (
a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
@@ -169,6 +170,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c);
create index idx_t2_2 on t2 (a1,a2,b);
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
create table t3 (
a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
@@ -230,6 +232,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c);
create index idx_t3_2 on t3 (a1,a2,b);
analyze table t3;
Table Op Msg_type Msg_text
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
explain select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2
@@ -330,7 +333,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
-Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1
@@ -344,7 +347,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
-Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1
diff --git a/mysql-test/main/subselect_exists2in_costmat.result b/mysql-test/main/subselect_exists2in_costmat.result
index 98a949ece6d..1c9574aafd3 100644
--- a/mysql-test/main/subselect_exists2in_costmat.result
+++ b/mysql-test/main/subselect_exists2in_costmat.result
@@ -65,7 +65,7 @@ Name LIKE 'L%') AND
surfacearea > 1000000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country ALL Name,SurfaceArea NULL NULL NULL 239 Using where
-2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4080 Using where
+2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4079 Using where
SELECT Name FROM Country
WHERE (EXISTS (select 1 from City where City.Population > 100000 and
Code = Country) OR
diff --git a/mysql-test/main/subselect_extra.result b/mysql-test/main/subselect_extra.result
index a3a0f1f9a15..edae4abfb3d 100644
--- a/mysql-test/main/subselect_extra.result
+++ b/mysql-test/main/subselect_extra.result
@@ -132,6 +132,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c);
create index idx_t1_2 on t1 (a1,a2,b);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
create table t2 (
a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
@@ -159,6 +160,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c);
create index idx_t2_2 on t2 (a1,a2,b);
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
create table t3 (
a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
@@ -220,6 +222,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c);
create index idx_t3_2 on t3 (a1,a2,b);
analyze table t3;
Table Op Msg_type Msg_text
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
explain select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2
@@ -302,6 +305,7 @@ INSERT INTO t1 SELECT a + 64,b FROM t1;
INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT 1 FROM t1 WHERE a IN
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
diff --git a/mysql-test/main/subselect_extra_no_semijoin.result b/mysql-test/main/subselect_extra_no_semijoin.result
index ec9ddb0452e..8aca24b6097 100644
--- a/mysql-test/main/subselect_extra_no_semijoin.result
+++ b/mysql-test/main/subselect_extra_no_semijoin.result
@@ -136,6 +136,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c);
create index idx_t1_2 on t1 (a1,a2,b);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
create table t2 (
a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
@@ -163,6 +164,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c);
create index idx_t2_2 on t2 (a1,a2,b);
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
create table t3 (
a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
@@ -224,6 +226,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c);
create index idx_t3_2 on t3 (a1,a2,b);
analyze table t3;
Table Op Msg_type Msg_text
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
explain select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2
@@ -306,6 +309,7 @@ INSERT INTO t1 SELECT a + 64,b FROM t1;
INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT 1 FROM t1 WHERE a IN
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result
index ec7f2c0a3d5..799adf1d116 100644
--- a/mysql-test/main/subselect_innodb.result
+++ b/mysql-test/main/subselect_innodb.result
@@ -561,6 +561,7 @@ update t2 set key2=key1;
alter table t2 add key(key2);
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
flush tables;
# Table tsubq must use 'ref' + Using filesort (not 'index' w/o filesort)
diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result
index 4592b1d5f70..1850742c437 100644
--- a/mysql-test/main/subselect_mat.result
+++ b/mysql-test/main/subselect_mat.result
@@ -1693,8 +1693,8 @@ DROP TABLE t1,t2,t3,t4,t5;
CREATE TABLE t2 (a int);
INSERT IGNORE INTO t2 VALUES ('a'),('a');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'a' at row 2
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 2
CREATE TABLE t4 (a varchar(1));
INSERT INTO t4 VALUES ('m'),('o');
CREATE TABLE t3 (a varchar(1) , b varchar(1) ) ;
@@ -2552,7 +2552,7 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b);
show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 5000
+Handler_read_key 5004
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
diff --git a/mysql-test/main/subselect_mat_cost.result b/mysql-test/main/subselect_mat_cost.result
index 5acf8cbee37..9b0578b62b1 100644
--- a/mysql-test/main/subselect_mat_cost.result
+++ b/mysql-test/main/subselect_mat_cost.result
@@ -67,7 +67,7 @@ Name LIKE 'L%') AND
surfacearea > 1000000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country ALL Name,SurfaceArea NULL NULL NULL 239 Using where
-2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4080 Using where
+2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4079 Using where
SELECT Name FROM Country
WHERE (Code IN (select Country from City where City.Population > 100000) OR
Name LIKE 'L%') AND
@@ -113,7 +113,7 @@ Name LIKE 'L%') AND
surfacearea > 10*1000000;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country range Name,SurfaceArea SurfaceArea 4 NULL 5 Using index condition; Using where; Rowid-ordered scan
-2 DEPENDENT SUBQUERY City index_subquery Population,Country Country 3 func 18 Using where
+2 DEPENDENT SUBQUERY City index_subquery Population,Country Country 3 func 17 Using where
SELECT Name FROM Country
WHERE (Code IN (select Country from City where City.Population > 100000) OR
Name LIKE 'L%') AND
@@ -135,7 +135,7 @@ Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND
City.name LIKE '%Island%');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where
-1 PRIMARY City ref Country Country 3 world.Country.Code 18 Using where
+1 PRIMARY City ref Country Country 3 world.Country.Code 17 Using where
2 MATERIALIZED CountryLanguage ALL Percentage,Language NULL NULL NULL 984 Using where
SELECT *
FROM Country, City
@@ -160,7 +160,7 @@ Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND
Country.name LIKE '%Island%');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where
-1 PRIMARY City ref Country Country 3 world.Country.Code 18
+1 PRIMARY City ref Country Country 3 world.Country.Code 17
2 DEPENDENT SUBQUERY CountryLanguage index_subquery Percentage,Language Language 30 func 2 Using where
SELECT *
FROM Country, City
@@ -205,7 +205,7 @@ OR
(select Country, Language from CountryLanguage));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where
-1 PRIMARY City ref Country Country 3 world.Country.Code 18 Using where
+1 PRIMARY City ref Country Country 3 world.Country.Code 17 Using where
3 MATERIALIZED CountryLanguage index PRIMARY,Language PRIMARY 33 NULL 984 Using index
2 DEPENDENT SUBQUERY CountryLanguage unique_subquery PRIMARY,Percentage,Language PRIMARY 33 func,func 1 Using where
SELECT City.Name, Country.Name
@@ -234,7 +234,7 @@ select count(*) from City
where City.id not in (select capital from Country
where capital is not null and population < 100000);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY City index NULL PRIMARY 4 NULL 4080 Using where; Using index
+1 PRIMARY City index NULL PRIMARY 4 NULL 4079 Using where; Using index
2 MATERIALIZED Country ALL NULL NULL NULL NULL 239 Using where
Q2.2e:
@@ -375,7 +375,7 @@ FROM City LEFT JOIN Country ON (Country = Code)
HAVING City.Name LIKE "Santa%");
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY CountryLanguage index NULL PRIMARY 33 NULL 984 Using where; Using index
-2 MATERIALIZED City ALL NULL NULL NULL NULL 4080
+2 MATERIALIZED City ALL NULL NULL NULL NULL 4079
2 MATERIALIZED Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using index
select count(*)
from CountryLanguage
@@ -433,7 +433,7 @@ capital is null);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country ALL NULL NULL NULL NULL 239 Using where
1 PRIMARY City eq_ref PRIMARY PRIMARY 4 world.Country.Capital 1 Using where
-2 MATERIALIZED City index NULL CityName 35 NULL 4080 Using index
+2 MATERIALIZED City index NULL CityName 35 NULL 4079 Using index
select * from Country, City
where capital = id and
(City.name in (SELECT name FROM City
@@ -454,7 +454,7 @@ WHERE Country.Code NOT IN
(SELECT Country FROM City GROUP BY Name HAVING COUNT(Name) = 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country ALL NULL NULL NULL NULL 239 Using where
-2 MATERIALIZED City ALL NULL NULL NULL NULL 4080 Using temporary
+2 MATERIALIZED City ALL NULL NULL NULL NULL 4079 Using temporary
SELECT Name
FROM Country
WHERE Country.Code NOT IN
@@ -517,7 +517,7 @@ GROUP BY City.Name
HAVING City.Name IN (select Name from Country where population < 1000000);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY Country index PRIMARY PRIMARY 3 NULL 239 Using index; Using temporary; Using filesort
-1 PRIMARY City ref Country Country 3 world.Country.Code 18
+1 PRIMARY City ref Country Country 3 world.Country.Code 17
2 MATERIALIZED Country ALL Name NULL NULL NULL 239 Using where
SELECT City.Name, City.Population
FROM City JOIN Country ON City.Country = Country.Code
@@ -542,7 +542,7 @@ SELECT Name, round(Population/1000)
FROM City
WHERE Country = "IND" AND Population < 100000);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY City ALL NULL NULL NULL NULL 4080 Using where
+1 PRIMARY City ALL NULL NULL NULL NULL 4079 Using where
2 DEPENDENT SUBQUERY City ref Population,Country,CityName CityName 35 func 1 Using where
3 DEPENDENT UNION City ref Population,Country,CityName CityName 35 func 1 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
diff --git a/mysql-test/main/subselect_mat_cost_bugs.result b/mysql-test/main/subselect_mat_cost_bugs.result
index 6377ae556d2..2c696ed36fd 100644
--- a/mysql-test/main/subselect_mat_cost_bugs.result
+++ b/mysql-test/main/subselect_mat_cost_bugs.result
@@ -310,6 +310,7 @@ create index key3 on t2 (kp2);
SET @@optimizer_switch='materialization=off,semijoin=off,in_to_exists=on';
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain
select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index 8b1438db530..46b6dd0b8f4 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -1445,7 +1445,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1455,7 +1455,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1465,8 +1465,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
+1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
@@ -1634,7 +1634,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -7023,8 +7023,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index 979b1ab5d47..d7b72eb5579 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -351,7 +351,7 @@ patient_uq clinic_uq
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
-1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
@@ -1448,7 +1448,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1458,7 +1458,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1468,8 +1468,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
+1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
@@ -1637,7 +1637,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index a43c4f031cf..0b528a7d3c1 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -1633,7 +1633,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -7014,8 +7014,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index f016f5e6b3c..5062c04af54 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -350,7 +350,7 @@ patient_uq clinic_uq
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
-1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
@@ -1447,7 +1447,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1457,7 +1457,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1467,8 +1467,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
-1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00
+1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a`
drop table t1, t2, t3;
@@ -1636,7 +1636,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
-2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -7029,8 +7029,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index 8e348100cb4..fa1312e5cda 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -7014,8 +7014,8 @@ SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
-2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 test.t2.c 1
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t1
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result
index 03de4072815..b16cdc21a0b 100644
--- a/mysql-test/main/subselect_sj.result
+++ b/mysql-test/main/subselect_sj.result
@@ -3097,7 +3097,9 @@ insert into t2 select b+10 from t2;
insert into t2 select b+10 from t2;
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain
select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result
index 65dfddce34d..c05db8d801f 100644
--- a/mysql-test/main/subselect_sj2_mat.result
+++ b/mysql-test/main/subselect_sj2_mat.result
@@ -76,8 +76,11 @@ insert into t3 select a,a, a,a,a from t0;
insert into t3 select a,a, a+100,a+100,a+100 from t0;
analyze table t1,t2,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
explain select * from t3 where b in (select a from t1);
id select_type table type possible_keys key key_len ref rows Extra
@@ -935,7 +938,9 @@ INSERT INTO t2 VALUES
(15,'g',6),(16,'x',7),(17,'f',8);
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain
SELECT * FROM t1 WHERE b IN (
@@ -970,6 +975,7 @@ INSERT INTO t1 VALUES
('q','q'),('w','w'),('d','d'),('e','e');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
# This query returned 6 rows instead of 19
@@ -1006,6 +1012,7 @@ INSERT INTO t2 SELECT * FROM t1;
INSERT INTO t2 SELECT * FROM t1;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN
SELECT * FROM t2
@@ -1255,8 +1262,11 @@ INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(
INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3);
ANALYZE TABLE t1,t2,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
set @tmp7474= @@optimizer_search_depth;
SET SESSION optimizer_search_depth = 1;
@@ -1875,12 +1885,17 @@ INSERT INTO `t5` VALUES
(677),(679),(680),(681),(682),(683),(684),(685),(686);
ANALYZE TABLE t1,t2,t3,t,t5;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t analyze Error Table 'test.t' doesn't exist
test.t analyze status Operation failed
+test.t5 analyze status Engine-independent statistics collected
test.t5 analyze status OK
+set optimizer_switch='rowid_filter=off';
explain
SELECT * FROM t3
JOIN t4 ON (t4.id_product = t3.id_product AND t4.id_shop = 1)
@@ -1893,20 +1908,21 @@ AND t3.id_product IN (SELECT id_product FROM t2 t2_3 WHERE t2_3.id_t2 = 18 OR t2
AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23)
AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using index
-1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.id_product 1 Using index
+1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 12
+1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t2_2.id_product 1 Using where; Using index
1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where
-1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t1.id_product,const 1 Using where; Using index
-1 PRIMARY <subquery6> eq_ref distinct_key distinct_key 4 func 1 Using where
1 PRIMARY t5 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <subquery6> eq_ref distinct_key distinct_key 4 func 1 Using where
+1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t3.id_product,const 1 Using where; Using index
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where
+1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where
+1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using where; Using index; Using join buffer (flat, BNL join)
+3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12 Using where
5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where
-4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where
-3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12
-2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 51
6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 31 Using index condition; Using where
+2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 51
+4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where
+set optimizer_switch='rowid_filter=default';
drop table t1,t2,t3,t4,t5;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
diff --git a/mysql-test/main/subselect_sj2_mat.test b/mysql-test/main/subselect_sj2_mat.test
index 47e48283b44..91057f0b201 100644
--- a/mysql-test/main/subselect_sj2_mat.test
+++ b/mysql-test/main/subselect_sj2_mat.test
@@ -475,6 +475,8 @@ INSERT INTO `t5` VALUES
(677),(679),(680),(681),(682),(683),(684),(685),(686);
ANALYZE TABLE t1,t2,t3,t,t5;
+
+set optimizer_switch='rowid_filter=off';
explain
SELECT * FROM t3
@@ -488,6 +490,8 @@ AND t3.id_product IN (SELECT id_product FROM t2 t2_3 WHERE t2_3.id_t2 = 18 OR t2
AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23)
AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26);
+set optimizer_switch='rowid_filter=default';
+
drop table t1,t2,t3,t4,t5;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result
index 92719507742..ca6eaeb8e4e 100644
--- a/mysql-test/main/subselect_sj_jcl6.result
+++ b/mysql-test/main/subselect_sj_jcl6.result
@@ -3111,7 +3111,9 @@ insert into t2 select b+10 from t2;
insert into t2 select b+10 from t2;
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain
select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result
index 3f99d340af8..ee45627749c 100644
--- a/mysql-test/main/subselect_sj_mat.result
+++ b/mysql-test/main/subselect_sj_mat.result
@@ -328,7 +328,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 16 func,func 1 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
-3 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join)
+3 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t2`.`b1` > '0' and `test`.`t3`.`c2` > '0'
@@ -370,7 +370,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00
5 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
-5 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join)
+5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
@@ -396,7 +396,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
5 MATERIALIZED t3c ALL NULL NULL NULL NULL 4 100.00 Using where
-5 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join)
+5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3c.c1,test.t3c.c2 2 100.00 Using index
4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
@@ -429,7 +429,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery5> eq_ref distinct_key # # # 1 100.00 #
1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 #
5 MATERIALIZED t3 ALL NULL # # # 4 100.00 #
-5 MATERIALIZED t2i index it2i1,it2i2,it2i3 # # # 5 80.00 #
+5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 #
2 MATERIALIZED t2 ALL NULL # # # 5 100.00 #
4 MATERIALIZED t3 ALL NULL # # # 4 100.00 #
3 MATERIALIZED t3 ALL NULL # # # 4 100.00 #
@@ -464,7 +464,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 16 func,func 1 100.00
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
-4 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join)
+4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
@@ -485,15 +485,15 @@ where (c1, c2) in (select b1, b2 from t2i where b2 > '0')) and
a1 = c1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 PRIMARY <subquery4> ALL distinct_key NULL NULL NULL 4 100.00 Using where
1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 16 func,func 1 100.00
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
-4 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join)
+4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0'
+Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t3`.`c2` = `test`.`t3`.`c2` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0'
select * from t1, t3
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
(c1, c2) in (select c1, c2 from t3
@@ -1730,8 +1730,8 @@ DROP TABLE t1,t2,t3,t4,t5;
CREATE TABLE t2 (a int);
INSERT IGNORE INTO t2 VALUES ('a'),('a');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'a' at row 2
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 2
CREATE TABLE t4 (a varchar(1));
INSERT INTO t4 VALUES ('m'),('o');
CREATE TABLE t3 (a varchar(1) , b varchar(1) ) ;
@@ -2592,7 +2592,7 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b);
show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 5000
+Handler_read_key 5004
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
diff --git a/mysql-test/main/system_mysql_db.result b/mysql-test/main/system_mysql_db.result
index a4c414888ca..e7cd9bc628b 100644
--- a/mysql-test/main/system_mysql_db.result
+++ b/mysql-test/main/system_mysql_db.result
@@ -6,6 +6,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
@@ -60,57 +61,8 @@ db CREATE TABLE `db` (
KEY `User` (`User`)
) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges'
show create table user;
-Table Create Table
-user CREATE TABLE `user` (
- `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
- `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
- `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `Delete_history_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
- `ssl_cipher` blob NOT NULL,
- `x509_issuer` blob NOT NULL,
- `x509_subject` blob NOT NULL,
- `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
- `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
- `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
- `max_user_connections` int(11) NOT NULL DEFAULT 0,
- `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
- `authentication_string` text COLLATE utf8_bin NOT NULL,
- `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
- `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
- `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
- PRIMARY KEY (`Host`,`User`)
-) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges'
+View Create View character_set_client collation_connection
+user CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `global_priv`.`Host` AS `Host`,`global_priv`.`User` AS `User`,if(json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,'N' AS `password_expired`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci
show create table func;
Table Create Table
func CREATE TABLE `func` (
@@ -120,6 +72,14 @@ func CREATE TABLE `func` (
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions'
+show create table global_priv;
+Table Create Table
+global_priv CREATE TABLE `global_priv` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)),
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
@@ -191,7 +151,7 @@ proc CREATE TABLE `proc` (
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
@@ -217,7 +177,7 @@ event CREATE TABLE `event` (
`ends` datetime DEFAULT NULL,
`status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`originator` int(10) unsigned NOT NULL,
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
diff --git a/mysql-test/main/no_password_column-mdev-11170.result b/mysql-test/main/system_mysql_db_507.result
index 94d49a4e762..1fa4af66719 100644
--- a/mysql-test/main/no_password_column-mdev-11170.result
+++ b/mysql-test/main/system_mysql_db_507.result
@@ -3,8 +3,6 @@
# Fatal error: mysql.user table is damaged or in
# unsupported 3.20 format
#
-create table backup_user like mysql.user;
-insert into backup_user select * from mysql.user;
#
# Original mysql.user table
#
@@ -60,7 +58,12 @@ max_statement_time decimal(12,6) NO 0.000000
#
# Drop the password column.
#
-alter table mysql.user drop column password;
+alter table mysql.user drop column password,
+drop column is_role,
+drop column default_role,
+add column password_last_changed timestamp null default null after password_expired,
+add column password_lifetime smallint unsigned after password_last_changed,
+add column account_locked enum('n','y') character set utf8 not null default 'n' after password_lifetime;
flush privileges;
#
# Create users without the password column present.
@@ -164,6 +167,3 @@ ioo % Y mysql_old_password 7a8f886d28473e85
#
# Reset to final original state.
#
-drop table mysql.user;
-rename table backup_user to mysql.user;
-flush privileges;
diff --git a/mysql-test/main/no_password_column-mdev-11170.test b/mysql-test/main/system_mysql_db_507.test
index 2cc4ba82ee8..b57a2a09c8e 100644
--- a/mysql-test/main/no_password_column-mdev-11170.test
+++ b/mysql-test/main/system_mysql_db_507.test
@@ -5,9 +5,7 @@
--echo # unsupported 3.20 format
--echo #
-
-create table backup_user like mysql.user;
-insert into backup_user select * from mysql.user;
+--source include/switch_to_mysql_user.inc
--echo #
--echo # Original mysql.user table
@@ -17,7 +15,12 @@ describe mysql.user;
--echo #
--echo # Drop the password column.
--echo #
-alter table mysql.user drop column password;
+alter table mysql.user drop column password,
+ drop column is_role,
+ drop column default_role,
+ add column password_last_changed timestamp null default null after password_expired,
+ add column password_lifetime smallint unsigned after password_last_changed,
+ add column account_locked enum('n','y') character set utf8 not null default 'n' after password_lifetime;
flush privileges;
--echo #
@@ -85,11 +88,7 @@ select user, host, select_priv, plugin, authentication_string from mysql.user
where user like "%oo"
order by user;
-
--echo #
--echo # Reset to final original state.
--echo #
-drop table mysql.user;
-rename table backup_user to mysql.user;
-
-flush privileges;
+--source include/switch_to_mysql_global_priv.inc
diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result
index d76a2ef923e..c4c4d3df706 100644
--- a/mysql-test/main/system_mysql_db_fix40123.result
+++ b/mysql-test/main/system_mysql_db_fix40123.result
@@ -6,6 +6,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
@@ -121,6 +122,14 @@ func CREATE TABLE `func` (
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions'
+show create table global_priv;
+Table Create Table
+global_priv CREATE TABLE `global_priv` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)),
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
@@ -192,7 +201,7 @@ proc CREATE TABLE `proc` (
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
@@ -218,7 +227,7 @@ event CREATE TABLE `event` (
`ends` datetime DEFAULT NULL,
`status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`originator` int(10) unsigned NOT NULL,
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
diff --git a/mysql-test/main/system_mysql_db_fix40123.test b/mysql-test/main/system_mysql_db_fix40123.test
index 2d17a0964e5..3f313c4ec1f 100644
--- a/mysql-test/main/system_mysql_db_fix40123.test
+++ b/mysql-test/main/system_mysql_db_fix40123.test
@@ -72,7 +72,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL,
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv;
-- enable_query_log
diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result
index fdc708db313..3a79afb04f0 100644
--- a/mysql-test/main/system_mysql_db_fix50030.result
+++ b/mysql-test/main/system_mysql_db_fix50030.result
@@ -6,6 +6,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
@@ -121,6 +122,14 @@ func CREATE TABLE `func` (
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions'
+show create table global_priv;
+Table Create Table
+global_priv CREATE TABLE `global_priv` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)),
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
@@ -192,7 +201,7 @@ proc CREATE TABLE `proc` (
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
@@ -218,7 +227,7 @@ event CREATE TABLE `event` (
`ends` datetime DEFAULT NULL,
`status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`originator` int(10) unsigned NOT NULL,
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
diff --git a/mysql-test/main/system_mysql_db_fix50030.test b/mysql-test/main/system_mysql_db_fix50030.test
index 9506c3465e7..33dcc873615 100644
--- a/mysql-test/main/system_mysql_db_fix50030.test
+++ b/mysql-test/main/system_mysql_db_fix50030.test
@@ -79,7 +79,7 @@ INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','r
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv;
-- enable_query_log
diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result
index d76a2ef923e..c4c4d3df706 100644
--- a/mysql-test/main/system_mysql_db_fix50117.result
+++ b/mysql-test/main/system_mysql_db_fix50117.result
@@ -6,6 +6,7 @@ db
event
func
general_log
+global_priv
gtid_slave_pos
help_category
help_keyword
@@ -121,6 +122,14 @@ func CREATE TABLE `func` (
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions'
+show create table global_priv;
+Table Create Table
+global_priv CREATE TABLE `global_priv` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)),
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
@@ -192,7 +201,7 @@ proc CREATE TABLE `proc` (
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
@@ -218,7 +227,7 @@ event CREATE TABLE `event` (
`ends` datetime DEFAULT NULL,
`status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '',
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`originator` int(10) unsigned NOT NULL,
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
diff --git a/mysql-test/main/system_mysql_db_fix50117.test b/mysql-test/main/system_mysql_db_fix50117.test
index f8bef3da162..2fe6869d761 100644
--- a/mysql-test/main/system_mysql_db_fix50117.test
+++ b/mysql-test/main/system_mysql_db_fix50117.test
@@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
-- disable_query_log
# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv;
-- enable_query_log
diff --git a/mysql-test/main/temp_table_frm.result b/mysql-test/main/temp_table_frm.result
index 19c66380af2..a9c59ff5969 100644
--- a/mysql-test/main/temp_table_frm.result
+++ b/mysql-test/main/temp_table_frm.result
@@ -1,3 +1,7 @@
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=1;
+set @@use_stat_tables= NEVER;
set @@session.max_heap_table_size=16*1024*1024;
create table t1 select * from information_schema.session_status where variable_name like 'Opened%';
create temporary table t2 (a int) engine=memory;
@@ -18,4 +22,6 @@ OPENED_PLUGIN_LIBRARIES 0
OPENED_TABLE_DEFINITIONS 2
OPENED_TABLES 1
OPENED_VIEWS 0
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1;
diff --git a/mysql-test/main/temp_table_frm.test b/mysql-test/main/temp_table_frm.test
index 178bd15004b..ddc4ffa575c 100644
--- a/mysql-test/main/temp_table_frm.test
+++ b/mysql-test/main/temp_table_frm.test
@@ -3,6 +3,11 @@
#
# Ensure we don't overflow the internal heap table size in the join
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+
+set @@optimizer_use_condition_selectivity=1;
+set @@use_stat_tables= NEVER;
set @@session.max_heap_table_size=16*1024*1024;
create table t1 select * from information_schema.session_status where variable_name like 'Opened%';
create temporary table t2 (a int) engine=memory;
@@ -13,4 +18,6 @@ let $tmpdir= `select @@tmpdir`;
truncate table t2;
select variable_name, session_status.variable_value - t1.variable_value
from information_schema.session_status join t1 using (variable_name);
-drop table t1;
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+drop table t1; \ No newline at end of file
diff --git a/mysql-test/main/temporal_literal.result b/mysql-test/main/temporal_literal.result
index d2417d7f9eb..2197b990f3b 100644
--- a/mysql-test/main/temporal_literal.result
+++ b/mysql-test/main/temporal_literal.result
@@ -294,17 +294,17 @@ SELECT TIMESTAMP'2001-00-00 00:00:00.9999999';
TIMESTAMP'2001-00-00 00:00:00.9999999'
2001-00-00 00:00:00.999999
Warnings:
-Note 1292 Truncated incorrect datetime value: '2001-00-00 00:00:00.9999999'
+Note 1292 Truncated incorrect DATETIME value: '2001-00-00 00:00:00.9999999'
SELECT TIMESTAMP'2001-00-01 00:00:00.9999999';
TIMESTAMP'2001-00-01 00:00:00.9999999'
2001-00-01 00:00:00.999999
Warnings:
-Note 1292 Truncated incorrect datetime value: '2001-00-01 00:00:00.9999999'
+Note 1292 Truncated incorrect DATETIME value: '2001-00-01 00:00:00.9999999'
SELECT TIMESTAMP'2001-01-00 00:00:00.9999999';
TIMESTAMP'2001-01-00 00:00:00.9999999'
2001-01-00 00:00:00.999999
Warnings:
-Note 1292 Truncated incorrect datetime value: '2001-01-00 00:00:00.9999999'
+Note 1292 Truncated incorrect DATETIME value: '2001-01-00 00:00:00.9999999'
#
# String literal with bad dates and nanoseconds to DATETIME(N)
#
@@ -416,7 +416,7 @@ SELECT TIME'10:10:10.1234567';
TIME'10:10:10.1234567'
10:10:10.123456
Warnings:
-Note 1292 Truncated incorrect time value: '10:10:10.1234567'
+Note 1292 Truncated incorrect TIME value: '10:10:10.1234567'
SELECT TIME('10:10:10.1234567');
TIME('10:10:10.1234567')
10:10:10.123456
@@ -440,7 +440,7 @@ SELECT TIMESTAMP'2001-01-01 10:10:10.1234567';
TIMESTAMP'2001-01-01 10:10:10.1234567'
2001-01-01 10:10:10.123456
Warnings:
-Note 1292 Truncated incorrect datetime value: '2001-01-01 10:10:10.1234567'
+Note 1292 Truncated incorrect DATETIME value: '2001-01-01 10:10:10.1234567'
SELECT TIMESTAMP('2001-01-01 10:10:10.1234567');
TIMESTAMP('2001-01-01 10:10:10.1234567')
2001-01-01 10:10:10.123456
@@ -463,7 +463,7 @@ Warning 1292 Truncated incorrect datetime value: '2001-01-01 10:10:10.1234567xyz
CREATE TABLE t1 (a TIME(6));
INSERT INTO t1 VALUES (TIME'10:20:30.1234567');
Warnings:
-Note 1292 Truncated incorrect time value: '10:20:30.1234567'
+Note 1292 Truncated incorrect TIME value: '10:20:30.1234567'
INSERT INTO t1 VALUES (TIME('10:20:30.1234567'));
Warnings:
Note 1292 Truncated incorrect time value: '10:20:30.1234567'
diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result
index 6de62d7ea30..dd137045d1a 100644
--- a/mysql-test/main/timezone2.result
+++ b/mysql-test/main/timezone2.result
@@ -353,5 +353,207 @@ Warning 1292 Truncated incorrect datetime value: '00:00:00'
SET old_mode=DEFAULT;
SET timestamp=DEFAULT;
#
+# MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+#
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT a, UNIX_TIMESTAMP(a) FROM t1;
+a UNIX_TIMESTAMP(a)
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:25 1288481125
+SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
+a
+1288481125
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t2 SELECT MAX(a) AS a FROM t1;
+SELECT a, UNIX_TIMESTAMP(a) FROM t2;
+a UNIX_TIMESTAMP(a)
+2010-10-31 02:25:25 1288481125
+DROP TABLE t2;
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/);
+INSERT INTO t2 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT UNIX_TIMESTAMP(t1.a), UNIX_TIMESTAMP(t2.a) FROM t1,t2;
+UNIX_TIMESTAMP(t1.a) UNIX_TIMESTAMP(t2.a)
+1288477526 1288481125
+SELECT * FROM t1,t2 WHERE t1.a < t2.a;
+a a
+2010-10-31 02:25:26 2010-10-31 02:25:25
+DROP TABLE t1,t2;
+BEGIN NOT ATOMIC
+DECLARE a,b TIMESTAMP;
+SET time_zone='+00:00';
+SET a=FROM_UNIXTIME(1288477526);
+SET b=FROM_UNIXTIME(1288481125);
+SELECT a < b;
+SET time_zone='Europe/Moscow';
+SELECT a < b;
+END;
+$$
+a < b
+1
+a < b
+1
+CREATE OR REPLACE FUNCTION f1(uts INT) RETURNS TIMESTAMP
+BEGIN
+DECLARE ts TIMESTAMP;
+DECLARE tz VARCHAR(64) DEFAULT @@time_zone;
+SET time_zone='+00:00';
+SET ts=FROM_UNIXTIME(uts);
+SET time_zone=tz;
+RETURN ts;
+END;
+$$
+SET time_zone='+00:00';
+SELECT f1(1288477526) < f1(1288481125);
+f1(1288477526) < f1(1288481125)
+1
+SET time_zone='Europe/Moscow';
+SELECT f1(1288477526) < f1(1288481125);
+f1(1288477526) < f1(1288481125)
+1
+DROP FUNCTION f1;
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP);
+SET time_zone='+00:00';
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/,
+FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
+SELECT *, LEAST(a,b) FROM t1;
+a b LEAST(a,b)
+2010-10-30 22:25:26 2010-10-30 23:25:25 2010-10-30 22:25:26
+SET time_zone='Europe/Moscow';
+SELECT *, LEAST(a,b) FROM t1;
+a b LEAST(a,b)
+2010-10-31 02:25:26 2010-10-31 02:25:25 2010-10-31 02:25:26
+SELECT UNIX_TIMESTAMP(a), UNIX_TIMESTAMP(b), UNIX_TIMESTAMP(LEAST(a,b)) FROM t1;
+UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) UNIX_TIMESTAMP(LEAST(a,b))
+1288477526 1288481125 1288477526
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP,c TIMESTAMP);
+SET time_zone='+00:00';
+INSERT INTO t1 VALUES (
+FROM_UNIXTIME(1288477526) /*summer time in Moscow*/,
+FROM_UNIXTIME(1288481125) /*winter time in Moscow*/,
+FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SELECT b BETWEEN a AND c FROM t1;
+b BETWEEN a AND c
+1
+SET time_zone='Europe/Moscow';
+SELECT b BETWEEN a AND c FROM t1;
+b BETWEEN a AND c
+1
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
+SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+a UNIX_TIMESTAMP(a)
+2010-10-30 22:25:26 1288477526
+2010-10-30 23:25:25 1288481125
+SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+a UNIX_TIMESTAMP(a)
+2010-10-30 22:25:26 1288477526
+2010-10-30 23:25:25 1288481125
+SET time_zone='Europe/Moscow';
+SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+a UNIX_TIMESTAMP(a)
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:25 1288481125
+SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+a UNIX_TIMESTAMP(a)
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:25 1288481125
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT a, UNIX_TIMESTAMP(a) FROM t1 GROUP BY a;
+a UNIX_TIMESTAMP(a)
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288481126
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
+UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x
+1288477526 1288481126 ne
+SET time_zone='Europe/Moscow';
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
+UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x
+1288477526 1288481126 ne
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP,c TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126),FROM_UNIXTIME(1288481127));
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
+UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x
+1288477526 1288481126 0
+SET time_zone='Europe/Moscow';
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
+UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x
+1288477526 1288481126 0
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+a b
+SET time_zone='Europe/Moscow';
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+a b
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000000),FROM_UNIXTIME(1200000000));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000001),FROM_UNIXTIME(1200000001));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000000),FROM_UNIXTIME(1400000000));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000001),FROM_UNIXTIME(1400000001));
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+a b
+SET time_zone='Europe/Moscow';
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+a b
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+a b
+DROP TABLE t1;
+#
+# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+#
+SET time_zone='+00:00';
+CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts;
+SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2;
+ts cts uts ucts
+2010-10-31 02:25:26 2010-10-31 02:25:26 1288481126 1288481126
+DROP TABLE t1,t2;
+SET time_zone=DEFAULT;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test
index 773b40ec86c..db515653651 100644
--- a/mysql-test/main/timezone2.test
+++ b/mysql-test/main/timezone2.test
@@ -325,5 +325,184 @@ SET old_mode=DEFAULT;
SET timestamp=DEFAULT;
--echo #
+--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+--echo #
+
+# MAX()
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT a, UNIX_TIMESTAMP(a) FROM t1;
+SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t2 SELECT MAX(a) AS a FROM t1;
+SELECT a, UNIX_TIMESTAMP(a) FROM t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+
+# Comparison
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/);
+INSERT INTO t2 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT UNIX_TIMESTAMP(t1.a), UNIX_TIMESTAMP(t2.a) FROM t1,t2;
+SELECT * FROM t1,t2 WHERE t1.a < t2.a;
+DROP TABLE t1,t2;
+
+
+# SP variable comparison
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a,b TIMESTAMP;
+ SET time_zone='+00:00';
+ SET a=FROM_UNIXTIME(1288477526);
+ SET b=FROM_UNIXTIME(1288481125);
+ SELECT a < b;
+ SET time_zone='Europe/Moscow';
+ SELECT a < b;
+END;
+$$
+DELIMITER ;$$
+
+
+# SP function comparison
+DELIMITER $$;
+CREATE OR REPLACE FUNCTION f1(uts INT) RETURNS TIMESTAMP
+BEGIN
+ DECLARE ts TIMESTAMP;
+ DECLARE tz VARCHAR(64) DEFAULT @@time_zone;
+ SET time_zone='+00:00';
+ SET ts=FROM_UNIXTIME(uts);
+ SET time_zone=tz;
+ RETURN ts;
+END;
+$$
+DELIMITER ;$$
+SET time_zone='+00:00';
+SELECT f1(1288477526) < f1(1288481125);
+SET time_zone='Europe/Moscow';
+SELECT f1(1288477526) < f1(1288481125);
+DROP FUNCTION f1;
+
+
+# LEAST()
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP);
+SET time_zone='+00:00';
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/,
+ FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
+SELECT *, LEAST(a,b) FROM t1;
+SET time_zone='Europe/Moscow';
+SELECT *, LEAST(a,b) FROM t1;
+SELECT UNIX_TIMESTAMP(a), UNIX_TIMESTAMP(b), UNIX_TIMESTAMP(LEAST(a,b)) FROM t1;
+DROP TABLE t1;
+
+
+# BETWEEN
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP,c TIMESTAMP);
+SET time_zone='+00:00';
+INSERT INTO t1 VALUES (
+ FROM_UNIXTIME(1288477526) /*summer time in Moscow*/,
+ FROM_UNIXTIME(1288481125) /*winter time in Moscow*/,
+ FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SELECT b BETWEEN a AND c FROM t1;
+SET time_zone='Europe/Moscow';
+SELECT b BETWEEN a AND c FROM t1;
+DROP TABLE t1;
+
+
+# ORDER BY
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
+SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+SET time_zone='Europe/Moscow';
+SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+
+# GROUP BY
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+SELECT a, UNIX_TIMESTAMP(a) FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+
+# CASE
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
+SET time_zone='Europe/Moscow';
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
+DROP TABLE t1;
+
+
+# IN
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP,c TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126),FROM_UNIXTIME(1288481127));
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
+SET time_zone='Europe/Moscow';
+SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
+DROP TABLE t1;
+
+# Comparison and IN in combination with a subquery (with one row)
+
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+
+SET time_zone='Europe/Moscow';
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+DROP TABLE t1;
+
+# Comparison and IN in combinarion with a subquery (with multiple rows)
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000000),FROM_UNIXTIME(1200000000));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000001),FROM_UNIXTIME(1200000001));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000000),FROM_UNIXTIME(1400000000));
+INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000001),FROM_UNIXTIME(1400000001));
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+
+SET time_zone='Europe/Moscow';
+SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
+SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
+SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+--echo #
+
+SET time_zone='+00:00';
+CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts;
+SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2;
+DROP TABLE t1,t2;
+SET time_zone=DEFAULT;
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result
index 72d0658386d..1adf3c68a08 100644
--- a/mysql-test/main/trigger.result
+++ b/mysql-test/main/trigger.result
@@ -622,7 +622,7 @@ drop table t1;
set sql_mode="traditional";
create table t1 (a date);
insert into t1 values ('2004-01-00');
-ERROR 22007: Incorrect date value: '2004-01-00' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '2004-01-00' for column `test`.`t1`.`a` at row 1
set sql_mode="";
create trigger t1_bi before insert on t1 for each row set new.a = '2004-01-00';
set sql_mode="traditional";
@@ -2146,7 +2146,7 @@ insert into t2 values (1),(2);
delete from t1 where i=1;
show status like 'Opened_tables';
Variable_name Value
-Opened_tables 3
+Opened_tables 6
select * from t1;
i
2
diff --git a/mysql-test/main/trigger_notembedded.test b/mysql-test/main/trigger_notembedded.test
index a31594826e7..051cd43f16f 100644
--- a/mysql-test/main/trigger_notembedded.test
+++ b/mysql-test/main/trigger_notembedded.test
@@ -907,7 +907,7 @@ connection flush;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
+ where state = "Waiting for backup lock";
--source include/wait_condition.inc
create trigger t1_bi before insert on t1 for each row begin end;
unlock tables;
diff --git a/mysql-test/main/truncate_coverage.result b/mysql-test/main/truncate_coverage.result
index 078de1ef3ab..9a343832b69 100644
--- a/mysql-test/main/truncate_coverage.result
+++ b/mysql-test/main/truncate_coverage.result
@@ -40,7 +40,7 @@ TRUNCATE TABLE m1;
connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# Sending:
-FLUSH TABLES;
+FLUSH TABLES m1;
connection default;
# Waiting for FLUSH TABLES to be blocked.
SET DEBUG_SYNC= 'now SIGNAL dropped';
diff --git a/mysql-test/main/truncate_coverage.test b/mysql-test/main/truncate_coverage.test
index 3351ce84232..1b793c6638c 100644
--- a/mysql-test/main/truncate_coverage.test
+++ b/mysql-test/main/truncate_coverage.test
@@ -81,12 +81,12 @@ SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR
connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
--echo # Sending:
---send FLUSH TABLES
+--send FLUSH TABLES m1
connection default;
--echo # Waiting for FLUSH TABLES to be blocked.
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES';
+ WHERE state= 'Waiting for table metadata lock' AND info= 'FLUSH TABLES m1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL dropped';
diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result
index 3515312d5b7..149fafb57f4 100644
--- a/mysql-test/main/type_date.result
+++ b/mysql-test/main/type_date.result
@@ -108,7 +108,7 @@ DROP TABLE t1, t2, t3;
CREATE TABLE t1 (y YEAR);
INSERT IGNORE INTO t1 VALUES ('abc');
Warnings:
-Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`y` at row 1
SELECT * FROM t1;
y
0000
@@ -221,7 +221,7 @@ a
0000-00-00
0000-00-00
INSERT INTO t1 VALUES ('0000-00-00');
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`a` at row 1
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
CREATE TABLE t1 (a DATE);
@@ -250,7 +250,7 @@ a
1000-00-00
1000-00-00
INSERT INTO t1 VALUES ('1000-00-00');
-ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '1000-00-00' for column `test`.`t1`.`a` at row 1
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
CREATE TABLE t1 SELECT curdate() AS f1;
@@ -504,7 +504,7 @@ SET sql_mode=DEFAULT;
CREATE TABLE t1 (a DATE DEFAULT '0000-00-00');
SET sql_mode=TRADITIONAL;
INSERT INTO t1 VALUES ('0000-00-00');
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`a` at row 1
INSERT INTO t1 VALUES ();
ERROR 22007: Incorrect default value '0000-00-00' for column 'a'
INSERT INTO t1 VALUES (DEFAULT);
@@ -545,7 +545,7 @@ CREATE TABLE t1 (a DATE);;
INSERT INTO t1 VALUES (0);
SET sql_mode='TRADITIONAL';
CREATE TABLE t2 AS SELECT * FROM t1;
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t2`.`a` at row 1
DROP TABLE t1;
#
# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
@@ -819,9 +819,9 @@ DATE(a) DATE(b) DATE(c)
NULL NULL NULL
2001-01-01 2001-01-01 2001-01-01
Warnings:
-Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1
-Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1
-Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`a` at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`b` at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`c` at row 1
SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c))
NULL NULL NULL
@@ -839,9 +839,9 @@ DATE(a) DATE(b) DATE(c)
NULL NULL NULL
2001-01-01 2001-01-01 2001-01-01
Warnings:
-Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1
-Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1
-Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`a` at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`b` at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`c` at row 1
SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c))
NULL NULL NULL
diff --git a/mysql-test/main/type_date_round.result b/mysql-test/main/type_date_round.result
new file mode 100644
index 00000000000..0da78c6afe5
--- /dev/null
+++ b/mysql-test/main/type_date_round.result
@@ -0,0 +1,174 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+#
+# DATE: SET
+#
+CREATE TABLE t1 (a DATE, b DATETIME(4));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+UPDATE t1 SET a=b;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SELECT a FROM t1;
+a
+2000-12-31
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999');
+UPDATE t1 SET a=b;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+2000-12-31
+2000-12-31
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,20001231235959.9999);
+INSERT INTO t1 VALUES(NULL,20001231235959.9999999);
+UPDATE t1 SET a=b;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+2000-12-31
+2000-12-31
+DROP TABLE t1;
+#
+# DATE: ALTER
+#
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+ALTER TABLE t1 MODIFY a DATE;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SELECT a FROM t1;
+a
+2000-12-31
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+ALTER TABLE t1 MODIFY a DATE;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+2000-12-31
+2000-12-31
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+ALTER TABLE t1 MODIFY a DATE;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+2000-12-31
+2000-12-31
+DROP TABLE t1;
+#
+# DATE: CAST
+#
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+SELECT a, CAST(a AS DATE) FROM t1;
+a CAST(a AS DATE)
+2000-12-31 23:59:59.9999 2000-12-31
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+SELECT a, CAST(a AS DATE) FROM t1;
+a CAST(a AS DATE)
+2000-12-31 23:59:59.9999 2000-12-31
+2000-12-31 23:59:59.9999999 2000-12-31
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+SELECT a, CAST(a AS DATE) FROM t1;
+a CAST(a AS DATE)
+20001231235959.9999000000 2000-12-31
+20001231235959.9999999000 2000-12-31
+DROP TABLE t1;
+#
+# Equal field propagation
+#
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES (20010101);
+INSERT INTO t1 VALUES (20010102);
+SELECT * FROM t1 WHERE a= 20010101235959.9999999;
+a
+2001-01-02
+SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999';
+a
+2001-01-02
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999';
+a
+2001-01-02
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02';
+a
+2001-01-02
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-02'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-02'
+DROP TABLE t1;
+#
+# Comparing non-temporal to DATE
+#
+# Although conversion from non-temporal to DATE (e.g. on SET) does not round,
+# comparison between non-temporal to DATE is performed as DATETIME.
+# So rounding does happen here.
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('2001-01-01 23:59:59.9999999');
+SELECT * FROM t1 WHERE a=DATE'2001-01-02';
+a
+2001-01-01 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1 WHERE CONCAT(a)=DATE'2001-01-02';
+a
+2001-01-01 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02';
+a
+2001-01-01 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (20010101235959.9999999);
+SELECT * FROM t1 WHERE a=DATE'2001-01-02';
+a
+20010101235959.9999999
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02';
+a
+20010101235959.9999999
+DROP TABLE t1;
diff --git a/mysql-test/main/type_date_round.test b/mysql-test/main/type_date_round.test
new file mode 100644
index 00000000000..61e1d0a401c
--- /dev/null
+++ b/mysql-test/main/type_date_round.test
@@ -0,0 +1,113 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+
+--echo #
+--echo # DATE: SET
+--echo #
+
+CREATE TABLE t1 (a DATE, b DATETIME(4));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATE, b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATE, b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,20001231235959.9999);
+INSERT INTO t1 VALUES(NULL,20001231235959.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # DATE: ALTER
+--echo #
+
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+ALTER TABLE t1 MODIFY a DATE;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+ALTER TABLE t1 MODIFY a DATE;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+ALTER TABLE t1 MODIFY a DATE;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # DATE: CAST
+--echo #
+
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+SELECT a, CAST(a AS DATE) FROM t1;
+DROP TABLE t1;
+
+# This truncates microseconds but rounds nanoseconds (MySQL Bug #92475)
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+SELECT a, CAST(a AS DATE) FROM t1;
+DROP TABLE t1;
+
+# This truncates microseconds but rounds nanoseconds (MySQL Bug #92475)
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+SELECT a, CAST(a AS DATE) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Equal field propagation
+--echo #
+
+CREATE TABLE t1 (a DATE);
+INSERT INTO t1 VALUES (20010101);
+INSERT INTO t1 VALUES (20010102);
+# DATE is compared to non-temporal as DATETIME
+# In the below queries nanoseconds should round to microseconds
+SELECT * FROM t1 WHERE a= 20010101235959.9999999;
+SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999';
+SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999';
+SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02';
+DROP TABLE t1;
+
+
+--echo #
+--echo # Comparing non-temporal to DATE
+--echo #
+
+--echo # Although conversion from non-temporal to DATE (e.g. on SET) does not round,
+--echo # comparison between non-temporal to DATE is performed as DATETIME.
+--echo # So rounding does happen here.
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('2001-01-01 23:59:59.9999999');
+SELECT * FROM t1 WHERE a=DATE'2001-01-02';
+SELECT * FROM t1 WHERE CONCAT(a)=DATE'2001-01-02';
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (20010101235959.9999999);
+SELECT * FROM t1 WHERE a=DATE'2001-01-02';
+SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02';
+DROP TABLE t1;
diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result
index 4a95556db55..64c523f26ce 100644
--- a/mysql-test/main/type_datetime.result
+++ b/mysql-test/main/type_datetime.result
@@ -216,7 +216,7 @@ insert into t1 set dt='2007-03-23 13:49:38',da=dt;
Warnings:
Note 1265 Data truncated for column 'da' at row 1
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
-ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
+ERROR 22007: Incorrect date value: '2007-03-32' for column `test`.`t1`.`da` at row 1
select * from t1;
da dt
1962-03-03 1962-03-03 00:00:00
@@ -610,7 +610,7 @@ insert into t1 set dt='2007-03-23 13:49:38',da=dt;
Warnings:
Note 1265 Data truncated for column 'da' at row 1
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
-ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
+ERROR 22007: Incorrect date value: '2007-03-32' for column `test`.`t1`.`da` at row 1
select * from t1;
da dt
1962-03-03 1962-03-03 00:00:00
@@ -854,7 +854,7 @@ SET sql_mode=DEFAULT;
CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00');
SET sql_mode=TRADITIONAL;
INSERT INTO t1 VALUES ('0000-00-00 00:00:00');
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1
INSERT INTO t1 VALUES ();
ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a'
INSERT INTO t1 VALUES (DEFAULT);
@@ -895,7 +895,7 @@ CREATE TABLE t1 (a DATETIME);;
INSERT INTO t1 VALUES (0);
SET sql_mode='TRADITIONAL';
CREATE TABLE t2 AS SELECT * FROM t1;
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t2`.`a` at row 1
DROP TABLE t1;
#
# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
diff --git a/mysql-test/main/type_datetime_round.result b/mysql-test/main/type_datetime_round.result
new file mode 100644
index 00000000000..c6584223268
--- /dev/null
+++ b/mysql-test/main/type_datetime_round.result
@@ -0,0 +1,205 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+#
+# DATETIME: SET
+#
+CREATE TABLE t1 (a DATETIME(3), b DATETIME(4));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME(3), b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999');
+UPDATE t1 SET a=b;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME(3), b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,20001231235959.9999);
+INSERT INTO t1 VALUES(NULL,20001231235959.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+#
+# DATETIME: ALTER
+#
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+ALTER TABLE t1 MODIFY a DATETIME(3);
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+ALTER TABLE t1 MODIFY a DATETIME(3);
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+ALTER TABLE t1 MODIFY a DATETIME(3);
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+#
+# Corner case:
+# ALTER DATETIME to a shorter DATETIME
+# All values round, maximum possible value truncates.
+#
+SET time_zone='+00:00';
+CREATE TABLE t1 (ID INT, a DATETIME(6), comment VARCHAR(64));
+INSERT INTO t1 VALUES (0, '9999-12-30 23:59:58.999999', 'Should round');
+INSERT INTO t1 VALUES (1, '9999-12-31 22:59:59.999999', 'Should round');
+INSERT INTO t1 VALUES (2, '9999-12-31 23:59:58.999999', 'Should round');
+INSERT INTO t1 VALUES (3, '9999-12-31 23:59:59.999999', 'Should truncate');
+ALTER TABLE t1 MODIFY a DATETIME(5);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 4
+SELECT * FROM t1;
+ID a comment
+0 9999-12-30 23:59:59.00000 Should round
+1 9999-12-31 23:00:00.00000 Should round
+2 9999-12-31 23:59:59.00000 Should round
+3 9999-12-31 23:59:59.99999 Should truncate
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+#
+# NOW
+#
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+CREATE OR REPLACE TABLE t1 (id SERIAL, a DATETIME(4));
+INSERT INTO t1 (a) VALUES (now(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIME(6));
+SELECT * FROM t1;
+id a
+1 2011-01-01 00:00:00.0000
+2 2011-01-01 00:00:00.0000
+3 2011-01-01 00:00:00.0000
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+#
+# DATETIME: CAST
+#
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+SELECT a, CAST(a AS DATETIME(3)) FROM t1;
+a CAST(a AS DATETIME(3))
+2000-12-31 23:59:59.9999 2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+SELECT a, CAST(a AS DATETIME(3)) FROM t1;
+a CAST(a AS DATETIME(3))
+2000-12-31 23:59:59.9999 2001-01-01 00:00:00.000
+2000-12-31 23:59:59.9999999 2001-01-01 00:00:00.000
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+SELECT a, CAST(a AS DATETIME(3)) FROM t1;
+a CAST(a AS DATETIME(3))
+20001231235959.9999000000 2001-01-01 00:00:00.000
+20001231235959.9999999000 2001-01-01 00:00:00.000
+DROP TABLE t1;
+#
+# Equal field propagation
+#
+CREATE TABLE t1 (a DATETIME(6));
+INSERT INTO t1 VALUES (20010101235959.999999);
+INSERT INTO t1 VALUES (20010101235959.9999999);
+SELECT * FROM t1 WHERE a=20010101235959.9999999;
+a
+2001-01-02 00:00:00.000000
+SELECT * FROM t1 WHERE a='20010101235959.9999999';
+a
+2001-01-02 00:00:00.000000
+Warnings:
+Note 1292 Truncated incorrect datetime value: '20010101235959.9999999'
+SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999';
+a
+2001-01-02 00:00:00.000000
+Warnings:
+Note 1292 Truncated incorrect datetime value: '20010101235959.9999999'
+Note 1292 Truncated incorrect datetime value: '20010101235959.9999999'
+SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000';
+a
+2001-01-02 00:00:00.000000
+Warnings:
+Note 1292 Truncated incorrect datetime value: '20010101235959.9999999'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1292 Truncated incorrect datetime value: '20010101235959.9999999'
+Note 1292 Truncated incorrect datetime value: '20010101235959.9999999'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-02 00:00:00'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1292 Truncated incorrect datetime value: '20010101235959.9999999'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-02 00:00:00'
+DROP TABLE t1;
+#
+# Comparing non-temporal to DATETIME
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('2001-01-01 23:59:59.9999999');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00';
+a
+2001-01-01 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1 WHERE CONCAT(a)=TIMESTAMP'2001-01-02 00:00:00';
+a
+2001-01-01 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00';
+a
+2001-01-01 23:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (20010101235959.9999999);
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00';
+a
+20010101235959.9999999
+SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00';
+a
+20010101235959.9999999
+DROP TABLE t1;
+#
+# Literal corner case
+#
+SELECT TIMESTAMP'9999-12-31 23:59:59.999999';
+TIMESTAMP'9999-12-31 23:59:59.999999'
+9999-12-31 23:59:59.999999
+SELECT TIME'9999-12-31 23:59:59.9999999';
+ERROR HY000: Incorrect TIME value: '9999-12-31 23:59:59.9999999'
diff --git a/mysql-test/main/type_datetime_round.test b/mysql-test/main/type_datetime_round.test
new file mode 100644
index 00000000000..15aec2cf4e0
--- /dev/null
+++ b/mysql-test/main/type_datetime_round.test
@@ -0,0 +1,147 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+
+--echo #
+--echo # DATETIME: SET
+--echo #
+
+CREATE TABLE t1 (a DATETIME(3), b DATETIME(4));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATETIME(3), b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATETIME(3), b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,20001231235959.9999);
+INSERT INTO t1 VALUES(NULL,20001231235959.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # DATETIME: ALTER
+--echo #
+
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+ALTER TABLE t1 MODIFY a DATETIME(3);
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+ALTER TABLE t1 MODIFY a DATETIME(3);
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+ALTER TABLE t1 MODIFY a DATETIME(3);
+SELECT a FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Corner case:
+--echo # ALTER DATETIME to a shorter DATETIME
+--echo # All values round, maximum possible value truncates.
+--echo #
+
+SET time_zone='+00:00';
+CREATE TABLE t1 (ID INT, a DATETIME(6), comment VARCHAR(64));
+INSERT INTO t1 VALUES (0, '9999-12-30 23:59:58.999999', 'Should round');
+INSERT INTO t1 VALUES (1, '9999-12-31 22:59:59.999999', 'Should round');
+INSERT INTO t1 VALUES (2, '9999-12-31 23:59:58.999999', 'Should round');
+INSERT INTO t1 VALUES (3, '9999-12-31 23:59:59.999999', 'Should truncate');
+ALTER TABLE t1 MODIFY a DATETIME(5);
+SELECT * FROM t1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+
+
+--echo #
+--echo # NOW
+--echo #
+
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+CREATE OR REPLACE TABLE t1 (id SERIAL, a DATETIME(4));
+INSERT INTO t1 (a) VALUES (now(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIME(6));
+SELECT * FROM t1;
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+
+
+--echo #
+--echo # DATETIME: CAST
+--echo #
+
+CREATE TABLE t1 (a DATETIME(4));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+SELECT a, CAST(a AS DATETIME(3)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+SELECT a, CAST(a AS DATETIME(3)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+SELECT a, CAST(a AS DATETIME(3)) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Equal field propagation
+--echo #
+
+CREATE TABLE t1 (a DATETIME(6));
+INSERT INTO t1 VALUES (20010101235959.999999);
+INSERT INTO t1 VALUES (20010101235959.9999999);
+SELECT * FROM t1 WHERE a=20010101235959.9999999;
+SELECT * FROM t1 WHERE a='20010101235959.9999999';
+SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999';
+SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000';
+DROP TABLE t1;
+
+--echo #
+--echo # Comparing non-temporal to DATETIME
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('2001-01-01 23:59:59.9999999');
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00';
+SELECT * FROM t1 WHERE CONCAT(a)=TIMESTAMP'2001-01-02 00:00:00';
+SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (20010101235959.9999999);
+SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00';
+SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00';
+DROP TABLE t1;
+
+--echo #
+--echo # Literal corner case
+--echo #
+
+SELECT TIMESTAMP'9999-12-31 23:59:59.999999';
+--error ER_WRONG_VALUE
+SELECT TIME'9999-12-31 23:59:59.9999999';
diff --git a/mysql-test/main/type_decimal.result b/mysql-test/main/type_decimal.result
index dadaa5a4b77..769c59b197d 100644
--- a/mysql-test/main/type_decimal.result
+++ b/mysql-test/main/type_decimal.result
@@ -176,9 +176,9 @@ Note 1265 Data truncated for column 'a' at row 2
insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'a' at row 2
+Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2
Note 1265 Data truncated for column 'a' at row 3
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
+Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4
insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result
index bd1a722f80b..0ce54c0126c 100644
--- a/mysql-test/main/type_float.result
+++ b/mysql-test/main/type_float.result
@@ -498,7 +498,7 @@ Warnings:
Warning 1265 Data truncated for column 'f' at row 1
INSERT IGNORE INTO t1 VALUES ('.');
Warnings:
-Warning 1366 Incorrect double value: '.' for column 'f' at row 1
+Warning 1366 Incorrect double value: '.' for column `test`.`t1`.`f` at row 1
SELECT * FROM t1 ORDER BY f;
f
0
diff --git a/mysql-test/main/type_interval.result b/mysql-test/main/type_interval.result
new file mode 100644
index 00000000000..65c84022210
--- /dev/null
+++ b/mysql-test/main/type_interval.result
@@ -0,0 +1,83 @@
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-17776 CAST(x AS INTERVAL DAY_SECOND(N))
+#
+CREATE TABLE t1 (a VARCHAR(128));
+INSERT INTO t1 VALUES
+('00:00:00'),
+('+00:00:01'),
+('-00:00:01'),
+('838:59:59'),
+('839:00:00'),
+('2018:01:02'),
+('87649415:59:59'),
+('3652058 23:59:59'),
+('87649416:00:00'),
+('3652059 00:00:00');
+SELECT
+EXTRACT(DAY FROM a) AS d,
+EXTRACT(HOUR FROM a) AS h,
+a,
+CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds
+FROM t1;
+d h a cast_itds
+0 0 00:00:00 00:00:00.000000
+0 0 +00:00:01 00:00:01.000000
+0 0 -00:00:01 -00:00:01.000000
+34 22 838:59:59 34 22:59:59.000000
+34 23 839:00:00 34 23:00:00.000000
+84 2 2018:01:02 84 02:01:02.000000
+3652058 23 87649415:59:59 3652058 23:59:59.000000
+3652058 23 3652058 23:59:59 3652058 23:59:59.000000
+NULL NULL 87649416:00:00 NULL
+NULL NULL 3652059 00:00:00 NULL
+Warnings:
+Warning 1292 Incorrect interval value: '87649416:00:00'
+Warning 1292 Incorrect interval value: '87649416:00:00'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649416:00:00'
+Warning 1292 Incorrect interval value: '3652059 00:00:00'
+Warning 1292 Incorrect interval value: '3652059 00:00:00'
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '3652059 00:00:00'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,9));
+INSERT INTO t1 VALUES
+(0),
+(1),
+(-1),
+(8385959),
+(8390000),
+(20180102),
+(876494155959),
+(876494160000);
+SELECT
+EXTRACT(DAY FROM a) AS d,
+EXTRACT(HOUR FROM a) AS h,
+a,
+CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds
+FROM t1;
+d h a cast_itds
+0 0 0.000000000 00:00:00.000000
+0 0 1.000000000 00:00:01.000000
+0 0 -1.000000000 -00:00:01.000000
+34 22 8385959.000000000 34 22:59:59.000000
+34 23 8390000.000000000 34 23:00:00.000000
+84 2 20180102.000000000 84 02:01:02.000000
+3652058 23 876494155959.000000000 3652058 23:59:59.000000
+NULL NULL 876494160000.000000000 NULL
+Warnings:
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '1.000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '-1.000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8390000.000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '20180102.000000000'
+Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494155959.000000000'
+Warning 1292 Incorrect interval value: '876494160000.000000000' for column `test`.`t1`.`a` at row 8
+Warning 1292 Incorrect interval value: '876494160000.000000000' for column `test`.`t1`.`a` at row 8
+Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '876494160000.000000000'
+DROP TABLE t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/type_interval.test b/mysql-test/main/type_interval.test
new file mode 100644
index 00000000000..15999dc609d
--- /dev/null
+++ b/mysql-test/main/type_interval.test
@@ -0,0 +1,54 @@
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-17776 CAST(x AS INTERVAL DAY_SECOND(N))
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(128));
+INSERT INTO t1 VALUES
+('00:00:00'),
+('+00:00:01'),
+('-00:00:01'),
+('838:59:59'),
+('839:00:00'),
+('2018:01:02'),
+('87649415:59:59'),
+('3652058 23:59:59'),
+('87649416:00:00'),
+('3652059 00:00:00');
+
+SELECT
+ EXTRACT(DAY FROM a) AS d,
+ EXTRACT(HOUR FROM a) AS h,
+ a,
+ CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds
+FROM t1;
+
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a DECIMAL(32,9));
+INSERT INTO t1 VALUES
+(0),
+(1),
+(-1),
+(8385959),
+(8390000),
+(20180102),
+(876494155959),
+(876494160000);
+
+SELECT
+ EXTRACT(DAY FROM a) AS d,
+ EXTRACT(HOUR FROM a) AS h,
+ a,
+ CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds
+FROM t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result
index 140f36b1261..44f200c229b 100644
--- a/mysql-test/main/type_newdecimal.result
+++ b/mysql-test/main/type_newdecimal.result
@@ -825,7 +825,7 @@ Warning 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT INTO Sow6_2f VALUES ('a59b');
-ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect decimal value: 'a59b' for column `test`.`Sow6_2f`.`col1` at row 1
drop table Sow6_2f;
select 10.3330000000000/12.34500000;
10.3330000000000/12.34500000
diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test
index d2d64b0baee..56273a47b44 100644
--- a/mysql-test/main/type_newdecimal.test
+++ b/mysql-test/main/type_newdecimal.test
@@ -837,6 +837,7 @@ UPDATE Sow6_2f SET col1 = col1 / 0 WHERE col1 > 0;
#-- should return SQLSTATE 22012 division by zero
SELECT MOD(col1,0) FROM Sow6_2f;
#-- should return SQLSTATE 22012 division by zero
+--replace_result sow Sow
-- error 1366
INSERT INTO Sow6_2f VALUES ('a59b');
#-- should return SQLSTATE 22018 invalid character value for cast
diff --git a/mysql-test/main/type_num.result b/mysql-test/main/type_num.result
index 966d94ee385..2dadb4f1f8d 100644
--- a/mysql-test/main/type_num.result
+++ b/mysql-test/main/type_num.result
@@ -42,171 +42,171 @@ Note 1265 Data truncated for column 'a' at row 1
DROP TABLE t1;
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES ('');
-ERROR 22007: Incorrect double value: '' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES ('');
-ERROR 22007: Incorrect double value: '' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a TINYINT);
INSERT INTO t1 VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES ('');
-ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL);
INSERT INTO t1 VALUES ('');
-ERROR 22007: Incorrect decimal value: '' for column 'a' at row 1
+ERROR 22007: Incorrect decimal value: '' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES ('x');
-ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1
+ERROR 22007: Incorrect double value: 'x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES ('x');
-ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1
+ERROR 22007: Incorrect double value: 'x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a TINYINT);
INSERT INTO t1 VALUES ('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES ('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES ('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES ('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL);
INSERT INTO t1 VALUES ('x');
-ERROR 22007: Incorrect decimal value: 'x' for column 'a' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES (' x');
-ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1
+ERROR 22007: Incorrect double value: ' x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (' x');
-ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1
+ERROR 22007: Incorrect double value: ' x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a TINYINT);
INSERT INTO t1 VALUES (' x');
-ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES (' x');
-ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (' x');
-ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES (' x');
-ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL);
INSERT INTO t1 VALUES (' x');
-ERROR 22007: Incorrect decimal value: ' x' for column 'a' at row 1
+ERROR 22007: Incorrect decimal value: ' x' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES ('.');
-ERROR 22007: Incorrect double value: '.' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '.' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES ('.');
-ERROR 22007: Incorrect double value: '.' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '.' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a TINYINT);
INSERT INTO t1 VALUES ('.');
-ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES ('.');
-ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES ('.');
-ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES ('.');
-ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL);
INSERT INTO t1 VALUES ('.');
-ERROR 22007: Incorrect decimal value: '.' for column 'a' at row 1
+ERROR 22007: Incorrect decimal value: '.' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES ('-');
-ERROR 22007: Incorrect double value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '-' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES ('-');
-ERROR 22007: Incorrect double value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '-' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a TINYINT);
INSERT INTO t1 VALUES ('-');
-ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES ('-');
-ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES ('-');
-ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES ('-');
-ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL);
INSERT INTO t1 VALUES ('-');
-ERROR 22007: Incorrect decimal value: '-' for column 'a' at row 1
+ERROR 22007: Incorrect decimal value: '-' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES ('+');
-ERROR 22007: Incorrect double value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '+' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES ('+');
-ERROR 22007: Incorrect double value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect double value: '+' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a TINYINT);
INSERT INTO t1 VALUES ('+');
-ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a SMALLINT);
INSERT INTO t1 VALUES ('+');
-ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES ('+');
-ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES ('+');
-ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL);
INSERT INTO t1 VALUES ('+');
-ERROR 22007: Incorrect decimal value: '+' for column 'a' at row 1
+ERROR 22007: Incorrect decimal value: '+' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES ('1x');
@@ -425,58 +425,58 @@ Note 1265 Data truncated for column 'i8' at row 1
Note 1265 Data truncated for column 'd' at row 1
INSERT IGNORE INTO t1 VALUES ('','','','','','','');
Warnings:
-Warning 1366 Incorrect double value: '' for column 'f4' at row 1
-Warning 1366 Incorrect double value: '' for column 'f8' at row 1
-Warning 1366 Incorrect integer value: '' for column 'i1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'i2' at row 1
-Warning 1366 Incorrect integer value: '' for column 'i4' at row 1
-Warning 1366 Incorrect integer value: '' for column 'i8' at row 1
-Warning 1366 Incorrect decimal value: '' for column 'd' at row 1
+Warning 1366 Incorrect double value: '' for column `test`.`t1`.`f4` at row 1
+Warning 1366 Incorrect double value: '' for column `test`.`t1`.`f8` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i2` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i4` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i8` at row 1
+Warning 1366 Incorrect decimal value: '' for column `test`.`t1`.`d` at row 1
INSERT IGNORE INTO t1 VALUES ('x','x','x','x','x','x','x');
Warnings:
-Warning 1366 Incorrect double value: 'x' for column 'f4' at row 1
-Warning 1366 Incorrect double value: 'x' for column 'f8' at row 1
-Warning 1366 Incorrect integer value: 'x' for column 'i1' at row 1
-Warning 1366 Incorrect integer value: 'x' for column 'i2' at row 1
-Warning 1366 Incorrect integer value: 'x' for column 'i4' at row 1
-Warning 1366 Incorrect integer value: 'x' for column 'i8' at row 1
-Warning 1366 Incorrect decimal value: 'x' for column 'd' at row 1
+Warning 1366 Incorrect double value: 'x' for column `test`.`t1`.`f4` at row 1
+Warning 1366 Incorrect double value: 'x' for column `test`.`t1`.`f8` at row 1
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i1` at row 1
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i2` at row 1
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i4` at row 1
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i8` at row 1
+Warning 1366 Incorrect decimal value: 'x' for column `test`.`t1`.`d` at row 1
INSERT IGNORE INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x');
Warnings:
-Warning 1366 Incorrect double value: ' x' for column 'f4' at row 1
-Warning 1366 Incorrect double value: ' x' for column 'f8' at row 1
-Warning 1366 Incorrect integer value: ' x' for column 'i1' at row 1
-Warning 1366 Incorrect integer value: ' x' for column 'i2' at row 1
-Warning 1366 Incorrect integer value: ' x' for column 'i4' at row 1
-Warning 1366 Incorrect integer value: ' x' for column 'i8' at row 1
-Warning 1366 Incorrect decimal value: ' x' for column 'd' at row 1
+Warning 1366 Incorrect double value: ' x' for column `test`.`t1`.`f4` at row 1
+Warning 1366 Incorrect double value: ' x' for column `test`.`t1`.`f8` at row 1
+Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i1` at row 1
+Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i2` at row 1
+Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i4` at row 1
+Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i8` at row 1
+Warning 1366 Incorrect decimal value: ' x' for column `test`.`t1`.`d` at row 1
INSERT IGNORE INTO t1 VALUES ('.','.','.','.','.','.','.');
Warnings:
-Warning 1366 Incorrect double value: '.' for column 'f4' at row 1
-Warning 1366 Incorrect double value: '.' for column 'f8' at row 1
-Warning 1366 Incorrect integer value: '.' for column 'i1' at row 1
-Warning 1366 Incorrect integer value: '.' for column 'i2' at row 1
-Warning 1366 Incorrect integer value: '.' for column 'i4' at row 1
-Warning 1366 Incorrect integer value: '.' for column 'i8' at row 1
-Warning 1366 Incorrect decimal value: '.' for column 'd' at row 1
+Warning 1366 Incorrect double value: '.' for column `test`.`t1`.`f4` at row 1
+Warning 1366 Incorrect double value: '.' for column `test`.`t1`.`f8` at row 1
+Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i1` at row 1
+Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i2` at row 1
+Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i4` at row 1
+Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i8` at row 1
+Warning 1366 Incorrect decimal value: '.' for column `test`.`t1`.`d` at row 1
INSERT IGNORE INTO t1 VALUES ('-','-','-','-','-','-','-');
Warnings:
-Warning 1366 Incorrect double value: '-' for column 'f4' at row 1
-Warning 1366 Incorrect double value: '-' for column 'f8' at row 1
-Warning 1366 Incorrect integer value: '-' for column 'i1' at row 1
-Warning 1366 Incorrect integer value: '-' for column 'i2' at row 1
-Warning 1366 Incorrect integer value: '-' for column 'i4' at row 1
-Warning 1366 Incorrect integer value: '-' for column 'i8' at row 1
-Warning 1366 Incorrect decimal value: '-' for column 'd' at row 1
+Warning 1366 Incorrect double value: '-' for column `test`.`t1`.`f4` at row 1
+Warning 1366 Incorrect double value: '-' for column `test`.`t1`.`f8` at row 1
+Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i1` at row 1
+Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i2` at row 1
+Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i4` at row 1
+Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i8` at row 1
+Warning 1366 Incorrect decimal value: '-' for column `test`.`t1`.`d` at row 1
INSERT IGNORE INTO t1 VALUES ('+','+','+','+','+','+','+');
Warnings:
-Warning 1366 Incorrect double value: '+' for column 'f4' at row 1
-Warning 1366 Incorrect double value: '+' for column 'f8' at row 1
-Warning 1366 Incorrect integer value: '+' for column 'i1' at row 1
-Warning 1366 Incorrect integer value: '+' for column 'i2' at row 1
-Warning 1366 Incorrect integer value: '+' for column 'i4' at row 1
-Warning 1366 Incorrect integer value: '+' for column 'i8' at row 1
-Warning 1366 Incorrect decimal value: '+' for column 'd' at row 1
+Warning 1366 Incorrect double value: '+' for column `test`.`t1`.`f4` at row 1
+Warning 1366 Incorrect double value: '+' for column `test`.`t1`.`f8` at row 1
+Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i1` at row 1
+Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i2` at row 1
+Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i4` at row 1
+Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i8` at row 1
+Warning 1366 Incorrect decimal value: '+' for column `test`.`t1`.`d` at row 1
INSERT IGNORE INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x');
Warnings:
Warning 1265 Data truncated for column 'f4' at row 1
diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result
index fe72f2dc576..a448c5fb702 100644
--- a/mysql-test/main/type_time.result
+++ b/mysql-test/main/type_time.result
@@ -320,7 +320,7 @@ DROP TABLE t2,t1;
SET sql_mode=traditional;
CREATE TABLE t1 (a TIME(6));
INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED));
-ERROR 22007: Incorrect time value: '18446744069414584320' for column 'a' at row 1
+ERROR 22007: Incorrect time value: '18446744069414584320' for column `test`.`t1`.`a` at row 1
SET sql_mode=DEFAULT;
INSERT IGNORE INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED));
Warnings:
@@ -1179,7 +1179,7 @@ SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1;
CAST(a AS TIME) CAST(-9223372036854775808 AS TIME)
-838:59:59 -838:59:59
Warnings:
-Warning 1292 Incorrect time value: '-9223372036854775808' for column 'a' at row 1
+Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1`.`a` at row 1
Warning 1292 Truncated incorrect time value: '-9223372036854775808'
DROP TABLE t1;
CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
@@ -1196,12 +1196,12 @@ a TIME(a) TIME(b) TIME(c)
9 00:00:09 00:00:09 00:00:09.000000
9000000 838:59:59 838:59:59 838:59:59.999999
Warnings:
-Warning 1292 Incorrect time value: '-9000000' for column 'a' at row 1
-Warning 1292 Incorrect time value: '-9000000' for column 'b' at row 1
-Warning 1292 Incorrect time value: '-9000000' for column 'c' at row 1
-Warning 1292 Incorrect time value: '9000000' for column 'a' at row 6
-Warning 1292 Incorrect time value: '9000000' for column 'b' at row 6
-Warning 1292 Incorrect time value: '9000000' for column 'c' at row 6
+Warning 1292 Incorrect time value: '-9000000' for column `test`.`t1`.`a` at row 1
+Warning 1292 Incorrect time value: '-9000000' for column `test`.`t1`.`b` at row 1
+Warning 1292 Incorrect time value: '-9000000' for column `test`.`t1`.`c` at row 1
+Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`a` at row 6
+Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`b` at row 6
+Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`c` at row 6
DROP TABLE t1;
CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9);
@@ -1213,9 +1213,9 @@ a TIME(a) TIME(b) TIME(c)
9 00:00:09 00:00:09 00:00:09.000000
9000000 838:59:59 838:59:59 838:59:59.999999
Warnings:
-Warning 1292 Incorrect time value: '9000000' for column 'a' at row 4
-Warning 1292 Incorrect time value: '9000000' for column 'b' at row 4
-Warning 1292 Incorrect time value: '9000000' for column 'c' at row 4
+Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`a` at row 4
+Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`b` at row 4
+Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`c` at row 4
DROP TABLE t1;
#
# MDEV-8862 Wrong field type for MAX(COALESCE(datetime_column))
@@ -2168,5 +2168,23 @@ Warning 1292 Truncated incorrect datetime value: 'z'
Warning 1292 Truncated incorrect datetime value: 'z'
Warning 1292 Truncated incorrect time value: 'z'
#
+# MDEV-17319 Assertion `ts_type != MYSQL_TIMESTAMP_TIME' failed upon inserting into TIME field
+#
+CREATE TABLE t1 (t TIME);
+SET SESSION SQL_MODE='TRADITIONAL';
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00'),('0000-00-00 00:00:00');
+ERROR 22007: Incorrect time value: '0000-00-00 00:00:00' for column `test`.`t1`.`t` at row 1
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+#
+# MDEV-18070 Assertion `nanoseconds <= 1000000000' failed in Temporal::add_nanoseconds_ssff with TIME_ROUND_FRACTIONAL
+#
+CREATE TABLE t1 (t TIME);
+SET SQL_MODE= 'TIME_ROUND_FRACTIONAL';
+INSERT INTO t1 VALUES (3e19);
+Warnings:
+Warning 1264 Out of range value for column 't' at row 1
+DROP TABLE t1;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_time.test b/mysql-test/main/type_time.test
index 5e4090f48a4..7eb75b95af2 100644
--- a/mysql-test/main/type_time.test
+++ b/mysql-test/main/type_time.test
@@ -1410,5 +1410,26 @@ SELECT TIMESTAMP(0)='z', DATE(0)='z', TIME(0)='z';
--echo #
+--echo # MDEV-17319 Assertion `ts_type != MYSQL_TIMESTAMP_TIME' failed upon inserting into TIME field
+--echo #
+
+CREATE TABLE t1 (t TIME);
+SET SESSION SQL_MODE='TRADITIONAL';
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00'),('0000-00-00 00:00:00');
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-18070 Assertion `nanoseconds <= 1000000000' failed in Temporal::add_nanoseconds_ssff with TIME_ROUND_FRACTIONAL
+--echo #
+
+CREATE TABLE t1 (t TIME);
+SET SQL_MODE= 'TIME_ROUND_FRACTIONAL';
+INSERT INTO t1 VALUES (3e19);
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/type_time_round.result b/mysql-test/main/type_time_round.result
new file mode 100644
index 00000000000..31e97c888db
--- /dev/null
+++ b/mysql-test/main/type_time_round.result
@@ -0,0 +1,260 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+#
+# TIME: SET
+#
+CREATE TABLE t1 (a TIME(3), b TIME(4));
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME(3), b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999');
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999999');
+UPDATE t1 SET a=b;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+00:00:01.000
+00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME(3), b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,0.9999);
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+00:00:01.000
+00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME(3), b DOUBLE);
+INSERT INTO t1 VALUES(NULL,0.9999);
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+00:00:01.000
+00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME(6), b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999999');
+UPDATE t1 SET a=b;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SELECT a FROM t1;
+a
+00:00:01.000000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME(6), b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+00:00:01.000000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME(6), b DOUBLE);
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+00:00:01.000000
+DROP TABLE t1;
+#
+# TIME: ALTER
+#
+CREATE TABLE t1 (a TIME(4));
+INSERT INTO t1 VALUES('00:00:00.9999');
+ALTER TABLE t1 MODIFY a TIME(3);
+SELECT a FROM t1;
+a
+00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('00:00:00.9999');
+INSERT INTO t1 VALUES('00:00:00.9999999');
+ALTER TABLE t1 MODIFY a TIME(3);
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+SELECT a FROM t1;
+a
+00:00:01.000
+00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+ALTER TABLE t1 MODIFY a TIME(3);
+SELECT a FROM t1;
+a
+00:00:01.000
+00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+ALTER TABLE t1 MODIFY a TIME(3);
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+00:00:01.000
+00:00:01.000
+DROP TABLE t1;
+#
+# TIME: CAST
+#
+CREATE TABLE t1 (a TIME(4));
+INSERT INTO t1 VALUES('00:00:00.9999');
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+a CAST(a AS TIME(3))
+00:00:00.9999 00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('00:00:00.9999');
+INSERT INTO t1 VALUES('00:00:00.9999999');
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+a CAST(a AS TIME(3))
+00:00:00.9999 00:00:01.000
+00:00:00.9999999 00:00:01.000
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+a CAST(a AS TIME(3))
+0.9999000000 00:00:01.000
+0.9999999000 00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+a CAST(a AS TIME(3))
+0.9999 00:00:01.000
+0.9999999 00:00:01.000
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('00:00:00.9999999');
+SELECT a, CAST(a AS TIME(6)) FROM t1;
+a CAST(a AS TIME(6))
+00:00:00.9999999 00:00:01.000000
+Warnings:
+Note 1292 Truncated incorrect time value: '00:00:00.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(6)) FROM t1;
+a CAST(a AS TIME(6))
+0.9999999000 00:00:01.000000
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(6)) FROM t1;
+a CAST(a AS TIME(6))
+0.9999999 00:00:01.000000
+DROP TABLE t1;
+#
+# NOW
+#
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+CREATE OR REPLACE TABLE t1 (id SERIAL, a TIME(4));
+INSERT INTO t1 (a) VALUES (now(6));
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6));
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+INSERT INTO t1 (a) VALUES (CURRENT_TIME(6));
+SELECT * FROM t1;
+id a
+1 24:00:00.0000
+2 24:00:00.0000
+3 24:00:00.0000
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+#
+# Equal field propagation
+#
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES (0.999999);
+INSERT INTO t1 VALUES (0.9999999);
+SELECT * FROM t1 WHERE a=0.9999999;
+a
+00:00:01.000000
+SELECT * FROM t1 WHERE a='0.9999999';
+a
+00:00:01.000000
+Warnings:
+Note 1292 Truncated incorrect time value: '0.9999999'
+SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999';
+a
+00:00:01.000000
+Warnings:
+Note 1292 Truncated incorrect time value: '0.9999999'
+Note 1292 Truncated incorrect time value: '0.9999999'
+SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000';
+a
+00:00:01.000000
+Warnings:
+Note 1292 Truncated incorrect time value: '0.9999999'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1292 Truncated incorrect time value: '0.9999999'
+Note 1292 Truncated incorrect time value: '0.9999999'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:01'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1292 Truncated incorrect time value: '0.9999999'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:01'
+DROP TABLE t1;
+#
+# Comparing non-temporal to TIME
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('22:59:59.9999999');
+SELECT * FROM t1 WHERE a=TIME'23:00:00';
+a
+22:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect time value: '22:59:59.9999999'
+SELECT * FROM t1 WHERE CONCAT(a)=TIME'23:00:00';
+a
+22:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect time value: '22:59:59.9999999'
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00';
+a
+22:59:59.9999999
+Warnings:
+Note 1292 Truncated incorrect time value: '22:59:59.9999999'
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (225959.9999999);
+SELECT * FROM t1 WHERE a=TIME'23:00:00';
+a
+225959.9999999
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00';
+a
+225959.9999999
+DROP TABLE t1;
+#
+# Literal corner case
+#
+SELECT TIME'838:59:59.999999';
+TIME'838:59:59.999999'
+838:59:59.999999
+SELECT TIME'838:59:59.9999999';
+ERROR HY000: Incorrect TIME value: '838:59:59.9999999'
+SELECT TIME'839:00:00';
+ERROR HY000: Incorrect TIME value: '839:00:00'
diff --git a/mysql-test/main/type_time_round.test b/mysql-test/main/type_time_round.test
new file mode 100644
index 00000000000..6d4b2d8947a
--- /dev/null
+++ b/mysql-test/main/type_time_round.test
@@ -0,0 +1,184 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+
+--echo #
+--echo # TIME: SET
+--echo #
+
+CREATE TABLE t1 (a TIME(3), b TIME(4));
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(3), b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999');
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(3), b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,0.9999);
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(3), b DOUBLE);
+INSERT INTO t1 VALUES(NULL,0.9999);
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(6), b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'00:00:00.9999999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(6), b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(6), b DOUBLE);
+INSERT INTO t1 VALUES(NULL,0.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # TIME: ALTER
+--echo #
+
+CREATE TABLE t1 (a TIME(4));
+INSERT INTO t1 VALUES('00:00:00.9999');
+ALTER TABLE t1 MODIFY a TIME(3);
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('00:00:00.9999');
+INSERT INTO t1 VALUES('00:00:00.9999999');
+ALTER TABLE t1 MODIFY a TIME(3);
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+ALTER TABLE t1 MODIFY a TIME(3);
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+ALTER TABLE t1 MODIFY a TIME(3);
+SELECT a FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # TIME: CAST
+--echo #
+
+CREATE TABLE t1 (a TIME(4));
+INSERT INTO t1 VALUES('00:00:00.9999');
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('00:00:00.9999');
+INSERT INTO t1 VALUES('00:00:00.9999999');
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES(0.9999);
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(3)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('00:00:00.9999999');
+SELECT a, CAST(a AS TIME(6)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(6)) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES(0.9999999);
+SELECT a, CAST(a AS TIME(6)) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # NOW
+--echo #
+
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+CREATE OR REPLACE TABLE t1 (id SERIAL, a TIME(4));
+INSERT INTO t1 (a) VALUES (now(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIME(6));
+SELECT * FROM t1;
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+
+
+--echo #
+--echo # Equal field propagation
+--echo #
+
+CREATE TABLE t1 (a TIME(6));
+INSERT INTO t1 VALUES (0.999999);
+INSERT INTO t1 VALUES (0.9999999);
+SELECT * FROM t1 WHERE a=0.9999999;
+SELECT * FROM t1 WHERE a='0.9999999';
+SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999';
+SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000';
+DROP TABLE t1;
+
+
+--echo #
+--echo # Comparing non-temporal to TIME
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('22:59:59.9999999');
+SELECT * FROM t1 WHERE a=TIME'23:00:00';
+SELECT * FROM t1 WHERE CONCAT(a)=TIME'23:00:00';
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (225959.9999999);
+SELECT * FROM t1 WHERE a=TIME'23:00:00';
+SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00';
+DROP TABLE t1;
+
+--echo #
+--echo # Literal corner case
+--echo #
+
+SELECT TIME'838:59:59.999999';
+--error ER_WRONG_VALUE
+SELECT TIME'838:59:59.9999999';
+--error ER_WRONG_VALUE
+SELECT TIME'839:00:00';
diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result
index e8bd81a7df5..57fdcdf9af9 100644
--- a/mysql-test/main/type_timestamp.result
+++ b/mysql-test/main/type_timestamp.result
@@ -778,7 +778,7 @@ SET sql_mode=DEFAULT;
CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00');
SET sql_mode=TRADITIONAL;
INSERT INTO t1 VALUES ('0000-00-00 00:00:00');
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1
INSERT INTO t1 VALUES ();
ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a'
INSERT INTO t1 VALUES (DEFAULT);
@@ -819,7 +819,7 @@ CREATE TABLE t1 (a TIMESTAMP);;
INSERT INTO t1 VALUES (0);
SET sql_mode='TRADITIONAL';
CREATE TABLE t2 AS SELECT * FROM t1;
-ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t2`.`a` at row 1
DROP TABLE t1;
#
# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
@@ -1045,5 +1045,136 @@ CREATE TABLE t1 (a TIMESTAMP);
INSERT INTO t1 SELECT CAST(20010101 AS UNSIGNED);
DROP TABLE t1;
#
+# MDEV-17928 Conversion from TIMESTAMP to VARCHAR SP variables does not work well on fractional digits
+#
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456');
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE ts10 TIMESTAMP(1) DEFAULT NOW();
+DECLARE ts16 TIMESTAMP(1) DEFAULT NOW(6);
+DECLARE dt10 DATETIME(1) DEFAULT NOW();
+DECLARE dt16 DATETIME(1) DEFAULT NOW(6);
+DECLARE vts10 VARCHAR(32) DEFAULT ts10;
+DECLARE vts16 VARCHAR(32) DEFAULT ts16;
+DECLARE vdt10 VARCHAR(32) DEFAULT dt10;
+DECLARE vdt16 VARCHAR(32) DEFAULT dt16;
+DECLARE tts10 TEXT(32) DEFAULT ts10;
+DECLARE tts16 TEXT(32) DEFAULT ts16;
+DECLARE tdt10 TEXT(32) DEFAULT dt10;
+DECLARE tdt16 TEXT(32) DEFAULT dt16;
+SELECT vts10, vts16, vdt10, vdt16;
+SELECT tts10, tts16, tdt10, tdt16;
+END;
+$$
+CALL p1;
+vts10 2001-01-01 10:20:30.0
+vts16 2001-01-01 10:20:30.1
+vdt10 2001-01-01 10:20:30.0
+vdt16 2001-01-01 10:20:30.1
+tts10 2001-01-01 10:20:30.0
+tts16 2001-01-01 10:20:30.1
+tdt10 2001-01-01 10:20:30.0
+tdt16 2001-01-01 10:20:30.1
+DROP PROCEDURE p1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+#
+# MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+#
+# Testing Item_func_rollup_const::val_native()
+# There is a bug in the below output (MDEV-16612)
+# Please remove this comment when MDEV-16612 is fixed and results are re-recorded
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2);
+BEGIN NOT ATOMIC
+DECLARE v TIMESTAMP DEFAULT '2001-01-01 10:20:30'; -- "v" will be wrapped into Item_func_rollup_const
+SELECT id, v AS v, COUNT(*) FROM t1 GROUP BY id,v WITH ROLLUP;
+END;
+$$
+id v COUNT(*)
+1 2001-01-01 10:20:30 1
+1 2001-01-01 10:20:30 1
+2 2001-01-01 10:20:30 1
+2 2001-01-01 10:20:30 1
+NULL 2001-01-01 10:20:30 2
+DROP TABLE t1;
+#
+# Testing Type_handler_timestamp_common::Item_save_in_field()
+# "txt" is expected to have three fractional digits
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456');
+CREATE TABLE t1 (ts1 TIMESTAMP(1) NOT NULL, ts2 TIMESTAMP(3) NOT NULL, txt TEXT);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', '0000-00-00 00:00:00',COALESCE(ts1,ts2));
+INSERT INTO t1 VALUES (NOW(),NOW(),COALESCE(ts1,ts2));
+INSERT INTO t1 VALUES (NOW(1),NOW(3),COALESCE(ts1,ts2));
+SELECT * FROM t1;
+ts1 ts2 txt
+0000-00-00 00:00:00.0 0000-00-00 00:00:00.000 0000-00-00 00:00:00.000
+2001-01-01 10:20:30.0 2001-01-01 10:20:30.000 2001-01-01 10:20:30.000
+2001-01-01 10:20:30.1 2001-01-01 10:20:30.123 2001-01-01 10:20:30.100
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+#
+# Testing Field_timestamp::store_native
+#
+SET sql_mode='';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00','0000-00-00 00:00:00');
+SET sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
+UPDATE t1 SET a=b;
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1
+UPDATE t1 SET a=COALESCE(b);
+ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
+# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+#
+CREATE TABLE t1 (a INT, b TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'2018-06-19 00:00:00');
+SELECT NULLIF(b, 'N/A') AS f, MAX(a) FROM t1 GROUP BY f;
+f MAX(a)
+2018-06-19 00:00:00 1
+Warnings:
+Warning 1292 Truncated incorrect datetime value: 'N/A'
+DROP TABLE t1;
+#
+# MDEV-17972 Assertion `is_valid_value_slow()' failed in Datetime::Datetime
+#
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP(6)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30');
+FLUSH TABLES;
+MYD
+FF77777777FFFFFF
+SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1;
+a dt0 dt6
+2033-07-07 03:01:11.999999 2033-07-07 03:01:11 2033-07-07 03:01:11.999999
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+#
+# MDEV-18072 Assertion `is_null() == item->null_value || conv' failed in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null upon query with GROUP BY
+#
+CREATE TABLE t1 (t TIMESTAMP);
+INSERT INTO t1 () VALUES (),();
+SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo';
+f
+NULL
+DROP TABLE t1;
+#
+# MDEV-18145 Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+CREATE TABLE t3 (pk INT PRIMARY KEY, b TIMESTAMP) ENGINE=MyISAM;
+SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk);
+sq
+NULL
+NULL
+DROP TABLE t1, t2, t3;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test
index 0a3ffb2b899..6b1447e5108 100644
--- a/mysql-test/main/type_timestamp.test
+++ b/mysql-test/main/type_timestamp.test
@@ -629,6 +629,142 @@ CREATE TABLE t1 (a TIMESTAMP);
INSERT INTO t1 SELECT CAST(20010101 AS UNSIGNED);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17928 Conversion from TIMESTAMP to VARCHAR SP variables does not work well on fractional digits
+--echo #
+
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456');
+DELIMITER $$;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE ts10 TIMESTAMP(1) DEFAULT NOW();
+ DECLARE ts16 TIMESTAMP(1) DEFAULT NOW(6);
+ DECLARE dt10 DATETIME(1) DEFAULT NOW();
+ DECLARE dt16 DATETIME(1) DEFAULT NOW(6);
+ DECLARE vts10 VARCHAR(32) DEFAULT ts10;
+ DECLARE vts16 VARCHAR(32) DEFAULT ts16;
+ DECLARE vdt10 VARCHAR(32) DEFAULT dt10;
+ DECLARE vdt16 VARCHAR(32) DEFAULT dt16;
+ DECLARE tts10 TEXT(32) DEFAULT ts10;
+ DECLARE tts16 TEXT(32) DEFAULT ts16;
+ DECLARE tdt10 TEXT(32) DEFAULT dt10;
+ DECLARE tdt16 TEXT(32) DEFAULT dt16;
+
+ SELECT vts10, vts16, vdt10, vdt16;
+ SELECT tts10, tts16, tdt10, tdt16;
+END;
+$$
+DELIMITER ;$$
+--vertical_results
+CALL p1;
+--horizontal_results
+DROP PROCEDURE p1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+
+--echo #
+--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+--echo #
+
+--echo # Testing Item_func_rollup_const::val_native()
+
+--echo # There is a bug in the below output (MDEV-16612)
+--echo # Please remove this comment when MDEV-16612 is fixed and results are re-recorded
+
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2);
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE v TIMESTAMP DEFAULT '2001-01-01 10:20:30'; -- "v" will be wrapped into Item_func_rollup_const
+ SELECT id, v AS v, COUNT(*) FROM t1 GROUP BY id,v WITH ROLLUP;
+END;
+$$
+DELIMITER ;$$
+DROP TABLE t1;
+
+--echo #
+--echo # Testing Type_handler_timestamp_common::Item_save_in_field()
+--echo # "txt" is expected to have three fractional digits
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456');
+CREATE TABLE t1 (ts1 TIMESTAMP(1) NOT NULL, ts2 TIMESTAMP(3) NOT NULL, txt TEXT);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', '0000-00-00 00:00:00',COALESCE(ts1,ts2));
+INSERT INTO t1 VALUES (NOW(),NOW(),COALESCE(ts1,ts2));
+INSERT INTO t1 VALUES (NOW(1),NOW(3),COALESCE(ts1,ts2));
+SELECT * FROM t1;
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+
+--echo #
+--echo # Testing Field_timestamp::store_native
+--echo #
+
+SET sql_mode='';
+CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00','0000-00-00 00:00:00');
+SET sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET a=b;
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t1 SET a=COALESCE(b);
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+--echo #
+--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+--echo #
+
+CREATE TABLE t1 (a INT, b TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'2018-06-19 00:00:00');
+SELECT NULLIF(b, 'N/A') AS f, MAX(a) FROM t1 GROUP BY f;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17972 Assertion `is_valid_value_slow()' failed in Datetime::Datetime
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a TIMESTAMP(6)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30');
+FLUSH TABLES;
+--remove_file $MYSQLD_DATADIR/test/t1.MYD
+--disable_query_log
+# Write a data file with one record:
+# 0xFF - record flags
+# 0x77777777 - TIMESTAMP integer part
+# 0xFFFFFF - TIMESTAMP bad fractional part
+--eval SELECT CONCAT(0xFF,0x77777777,0xFFFFFF) INTO OUTFILE '$MYSQLD_DATADIR/test/t1.MYD' FIELDS TERMINATED BY '' ESCAPED BY '' LINES TERMINATED BY ''
+--eval SELECT HEX(LOAD_FILE('$MYSQLD_DATADIR/test/t1.MYD')) AS MYD
+--enable_query_log
+SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+
+--echo #
+--echo # MDEV-18072 Assertion `is_null() == item->null_value || conv' failed in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null upon query with GROUP BY
+--echo #
+
+CREATE TABLE t1 (t TIMESTAMP);
+INSERT INTO t1 () VALUES (),();
+SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo';
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-18145 Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+CREATE TABLE t3 (pk INT PRIMARY KEY, b TIMESTAMP) ENGINE=MyISAM;
+SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk);
+DROP TABLE t1, t2, t3;
+
+
--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/type_timestamp_round.result b/mysql-test/main/type_timestamp_round.result
new file mode 100644
index 00000000000..7931aa0ff5b
--- /dev/null
+++ b/mysql-test/main/type_timestamp_round.result
@@ -0,0 +1,191 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+#
+# TIMESTAMP: SET
+#
+CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b TIMESTAMP(4) NULL DEFAULT NULL);
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999');
+UPDATE t1 SET a=b;
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,20001231235959.9999);
+INSERT INTO t1 VALUES(NULL,20001231235959.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+#
+# TIMESTAMP: ALTER
+#
+CREATE TABLE t1 (a TIMESTAMP(4) NULL DEFAULT NULL);
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL;
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL;
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999'
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL;
+SELECT a FROM t1;
+a
+2001-01-01 00:00:00.000
+2001-01-01 00:00:00.000
+DROP TABLE t1;
+#
+# Corner case:
+# ALTER TIMESTAMP to a shorter TIMESTAMP
+# All values round, maximum possible value truncates.
+#
+SET time_zone='+00:00';
+CREATE TABLE t1 (ID INT, a TIMESTAMP(6), comment VARCHAR(64));
+INSERT INTO t1 VALUES (0, '2038-01-18 23:59:59.999999', 'Should round');
+INSERT INTO t1 VALUES (1, '2038-01-19 03:14:06.999999', 'Should round');
+INSERT INTO t1 VALUES (2, '2038-01-19 03:14:07.999999', 'Should truncate');
+ALTER TABLE t1 MODIFY a TIMESTAMP(5);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 3
+SELECT * FROM t1;
+ID a comment
+0 2038-01-19 00:00:00.00000 Should round
+1 2038-01-19 03:14:07.00000 Should round
+2 2038-01-19 03:14:07.99999 Should truncate
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+#
+# NOW
+#
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+CREATE OR REPLACE TABLE t1 (id SERIAL, a TIMESTAMP(4));
+INSERT INTO t1 (a) VALUES (now(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIME(6));
+SELECT * FROM t1;
+id a
+1 2011-01-01 00:00:00.0000
+2 2011-01-01 00:00:00.0000
+3 2011-01-01 00:00:00.0000
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+#
+# DATETIME to TIMESTAMP conversion with DST change
+#
+SET sql_mode=IF(@@version LIKE '%MariaDB%',
+'STRICT_ALL_TABLES,TIME_ROUND_FRACTIONAL',
+'STRICT_ALL_TABLES');
+SET time_zone='Europe/Moscow';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */);
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap */);
+ERROR 22007: Incorrect datetime value: '2010-03-28 01:59:59.9' for column `test`.`t1`.`a` at row 1
+SELECT * FROM t1;
+a
+2010-03-28 01:59:59
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+SET sql_mode=@default_sql_mode;
+SET sql_mode=IF(@@version LIKE '%MariaDB%','TIME_ROUND_FRACTIONAL','');
+SET time_zone='Europe/Moscow';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */);
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap, then gets fixed to the first second of the summer time */);
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
+SELECT a, UNIX_TIMESTAMP(a) FROM t1;
+a UNIX_TIMESTAMP(a)
+2010-03-28 01:59:59 1269730799
+2010-03-28 03:00:00 1269730800
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+SET sql_mode=@default_sql_mode;
+#
+# Comparing non-temporal to TIMESTAMP
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('2001-01-01 23:59:59.9999999');
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t2 VALUES ('2001-01-02 00:00:00');
+SELECT * FROM t1,t2 WHERE t1.a=t2.a;
+a a
+2001-01-01 23:59:59.9999999 2001-01-02 00:00:00
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1,t2 WHERE CONCAT(t1.a)=t2.a;
+a a
+2001-01-01 23:59:59.9999999 2001-01-02 00:00:00
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a;
+a a
+2001-01-01 23:59:59.9999999 2001-01-02 00:00:00
+Warnings:
+Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999'
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (20010101235959.9999999);
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t2 VALUES ('2001-01-02 00:00:00');
+SELECT * FROM t1,t2 WHERE t1.a=t2.a;
+a a
+20010101235959.9999999 2001-01-02 00:00:00
+SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a;
+a a
+20010101235959.9999999 2001-01-02 00:00:00
+DROP TABLE t1,t2;
+#
+# MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+#
+# Test Field_timestamp::store_native()
+#
+SET sql_mode=@default_sql_mode;
+SET time_zone='+00:00';
+CREATE TABLE t1 (ts0 TIMESTAMP, ts1 TIMESTAMP(1));
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', '2001-01-01 10:20:30.9');
+SELECT * FROM t1;
+ts0 ts1
+2001-01-01 10:20:30 2001-01-01 10:20:30.9
+# This should round
+UPDATE t1 SET ts0=COALESCE(ts1);
+SELECT * FROM t1;
+ts0 ts1
+2001-01-01 10:20:31 2001-01-01 10:20:30.9
+# Corner case
+UPDATE t1 SET ts1=FROM_UNIXTIME(2147483647.9);
+UPDATE t1 SET ts0=COALESCE(ts1);
+Warnings:
+Warning 1264 Out of range value for column 'ts0' at row 1
+SELECT * FROM t1;
+ts0 ts1
+2038-01-19 03:14:07 2038-01-19 03:14:07.9
+DROP TABLE t1;
+SET time_zone=DEFAULT;
diff --git a/mysql-test/main/type_timestamp_round.test b/mysql-test/main/type_timestamp_round.test
new file mode 100644
index 00000000000..19e0ea86da5
--- /dev/null
+++ b/mysql-test/main/type_timestamp_round.test
@@ -0,0 +1,160 @@
+SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', '');
+SET @default_sql_mode=@@sql_mode;
+
+--echo #
+--echo # TIMESTAMP: SET
+--echo #
+
+CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b TIMESTAMP(4) NULL DEFAULT NULL);
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b VARCHAR(64));
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999');
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b DECIMAL(38,10));
+INSERT INTO t1 VALUES(NULL,20001231235959.9999);
+INSERT INTO t1 VALUES(NULL,20001231235959.9999999);
+UPDATE t1 SET a=b;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # TIMESTAMP: ALTER
+--echo #
+
+CREATE TABLE t1 (a TIMESTAMP(4) NULL DEFAULT NULL);
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999');
+INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999');
+ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(38,10));
+INSERT INTO t1 VALUES(20001231235959.9999);
+INSERT INTO t1 VALUES(20001231235959.9999999);
+ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Corner case:
+--echo # ALTER TIMESTAMP to a shorter TIMESTAMP
+--echo # All values round, maximum possible value truncates.
+--echo #
+
+SET time_zone='+00:00';
+CREATE TABLE t1 (ID INT, a TIMESTAMP(6), comment VARCHAR(64));
+INSERT INTO t1 VALUES (0, '2038-01-18 23:59:59.999999', 'Should round');
+INSERT INTO t1 VALUES (1, '2038-01-19 03:14:06.999999', 'Should round');
+INSERT INTO t1 VALUES (2, '2038-01-19 03:14:07.999999', 'Should truncate');
+ALTER TABLE t1 MODIFY a TIMESTAMP(5);
+SELECT * FROM t1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+
+--echo #
+--echo # NOW
+--echo #
+
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+CREATE OR REPLACE TABLE t1 (id SERIAL, a TIMESTAMP(4));
+INSERT INTO t1 (a) VALUES (now(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6));
+INSERT INTO t1 (a) VALUES (CURRENT_TIME(6));
+SELECT * FROM t1;
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+SET time_zone=DEFAULT;
+
+
+--echo #
+--echo # DATETIME to TIMESTAMP conversion with DST change
+--echo #
+
+--disable_warnings
+SET sql_mode=IF(@@version LIKE '%MariaDB%',
+ 'STRICT_ALL_TABLES,TIME_ROUND_FRACTIONAL',
+ 'STRICT_ALL_TABLES');
+--enable_warnings
+SET time_zone='Europe/Moscow';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap */);
+SELECT * FROM t1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+--disable_warnings
+SET sql_mode=@default_sql_mode;
+--enable_warnings
+
+SET sql_mode=IF(@@version LIKE '%MariaDB%','TIME_ROUND_FRACTIONAL','');
+SET time_zone='Europe/Moscow';
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */);
+INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap, then gets fixed to the first second of the summer time */);
+SELECT a, UNIX_TIMESTAMP(a) FROM t1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+--disable_warnings
+SET sql_mode=@default_sql_mode;
+--enable_warnings
+
+
+--echo #
+--echo # Comparing non-temporal to TIMESTAMP
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT t1 VALUES ('2001-01-01 23:59:59.9999999');
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t2 VALUES ('2001-01-02 00:00:00');
+SELECT * FROM t1,t2 WHERE t1.a=t2.a;
+SELECT * FROM t1,t2 WHERE CONCAT(t1.a)=t2.a;
+SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a;
+DROP TABLE t1,t2;
+
+CREATE TABLE t1 (a DECIMAL(32,7));
+INSERT t1 VALUES (20010101235959.9999999);
+CREATE TABLE t2 (a TIMESTAMP);
+INSERT INTO t2 VALUES ('2001-01-02 00:00:00');
+SELECT * FROM t1,t2 WHERE t1.a=t2.a;
+SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a;
+DROP TABLE t1,t2;
+
+
+--echo #
+--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change
+--echo #
+--echo # Test Field_timestamp::store_native()
+--echo #
+
+SET sql_mode=@default_sql_mode;
+SET time_zone='+00:00';
+CREATE TABLE t1 (ts0 TIMESTAMP, ts1 TIMESTAMP(1));
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', '2001-01-01 10:20:30.9');
+SELECT * FROM t1;
+--echo # This should round
+UPDATE t1 SET ts0=COALESCE(ts1);
+SELECT * FROM t1;
+--echo # Corner case
+UPDATE t1 SET ts1=FROM_UNIXTIME(2147483647.9);
+UPDATE t1 SET ts0=COALESCE(ts1);
+SELECT * FROM t1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result
index 6af6b167511..6655982a38f 100644
--- a/mysql-test/main/udf.result
+++ b/mysql-test/main/udf.result
@@ -465,3 +465,122 @@ a b
Hello HL
DROP FUNCTION METAPHON;
DROP TABLE t1;
+#
+# MDEV-15424: Unreasonal SQL Error (1356) on select from view
+#
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+create table t1(a int , b int);
+insert into t1 values(100, 54), (200, 199);
+create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1;
+select * from v1;
+myfunc_int(max(a) over (order by b) , b)
+154
+399
+drop view v1;
+drop function myfunc_int;
+drop table t1;
+
+MDEV-15073: Generic UDAF parser code in server for windows functions
+
+CREATE AGGREGATE FUNCTION avgcost
+RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+CREATE AGGREGATE FUNCTION avg2
+RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+create table t1(pk int primary key,
+a int,
+sum int,
+price float(24));
+insert into t1 values
+(1, 1, 100, 50.00),
+(2, 1, 100, 100.00),
+(3, 1, 100, 50.00),
+(4, 1, 100, 50.00),
+(5, 1, 100, 50.00),
+(6, 1, 100, NULL),
+(7, 1, NULL, NULL),
+(8, 2, 2, 2),
+(9, 2, 4, 4);
+select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+pk a sum price avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+1 1 100 50 75.0000
+2 1 100 100 66.6667
+3 1 100 50 66.6667
+4 1 100 50 50.0000
+5 1 100 50 50.0000
+6 1 100 NULL 50.0000
+7 1 NULL NULL 0.0000
+8 2 2 2 3.3333
+9 2 4 4 3.3333
+select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+pk a sum price avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+1 1 100 50 50.0000
+2 1 100 100 75.0000
+3 1 100 50 75.0000
+4 1 100 50 50.0000
+5 1 100 50 50.0000
+6 1 100 NULL 50.0000
+7 1 NULL NULL 0.0000
+8 2 2 2 2.0000
+9 2 4 4 3.3333
+select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+pk a sum price avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+1 1 100 50 0.7500
+2 1 100 100 0.6667
+3 1 100 50 0.6667
+4 1 100 50 0.5000
+5 1 100 50 0.5000
+6 1 100 NULL 0.5000
+7 1 NULL NULL 0.0000
+8 2 2 2 1.0000
+9 2 4 4 1.0000
+select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+pk a sum price avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+1 1 100 50 0.5000
+2 1 100 100 0.7500
+3 1 100 50 0.7500
+4 1 100 50 0.5000
+5 1 100 50 0.5000
+6 1 100 NULL 0.5000
+7 1 NULL NULL 0.0000
+8 2 2 2 1.0000
+9 2 4 4 1.0000
+select pk, a, sum, price, tttttttt(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from ' at line 1
+select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from ' at line 1
+select pk, a, sum, price, round(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from ' at line 1
+select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from ' at line 1
+set @save_sql_mode = @@sql_mode;
+set sql_mode="oracle";
+select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+pk a sum price avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+1 1 100 50 0.5000
+2 1 100 100 0.7500
+3 1 100 50 0.7500
+4 1 100 50 0.5000
+5 1 100 50 0.5000
+6 1 100 NULL 0.5000
+7 1 NULL NULL 0.0000
+8 2 2 2 1.0000
+9 2 4 4 1.0000
+set sql_mode= @save_sql_mode;
+drop table t1;
+DROP FUNCTION avgcost;
+DROP FUNCTION avg2;
+DROP FUNCTION myfunc_double;
diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test
index c3a25c6bcce..bb8493135aa 100644
--- a/mysql-test/main/udf.test
+++ b/mysql-test/main/udf.test
@@ -528,3 +528,82 @@ DROP FUNCTION METAPHON;
#INSERT INTO t1 (a) VALUES ('Hello');
#SELECT * FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view
+--echo #
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
+create table t1(a int , b int);
+insert into t1 values(100, 54), (200, 199);
+create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1;
+select * from v1;
+drop view v1;
+drop function myfunc_int;
+drop table t1;
+
+--echo
+--echo MDEV-15073: Generic UDAF parser code in server for windows functions
+--echo
+
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval CREATE AGGREGATE FUNCTION avgcost
+ RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval CREATE AGGREGATE FUNCTION avg2
+ RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
+
+create table t1(pk int primary key,
+ a int,
+ sum int,
+ price float(24));
+insert into t1 values
+ (1, 1, 100, 50.00),
+ (2, 1, 100, 100.00),
+ (3, 1, 100, 50.00),
+ (4, 1, 100, 50.00),
+ (5, 1, 100, 50.00),
+ (6, 1, 100, NULL),
+ (7, 1, NULL, NULL),
+ (8, 2, 2, 2),
+ (9, 2, 4, 4);
+
+--sorted_result
+select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+--sorted_result
+select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+
+--sorted_result
+select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+--sorted_result
+select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+--error ER_PARSE_ERROR
+select pk, a, sum, price, tttttttt(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+--error ER_PARSE_ERROR
+select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+--error ER_PARSE_ERROR
+select pk, a, sum, price, round(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+--error ER_PARSE_ERROR
+select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+
+set @save_sql_mode = @@sql_mode;
+set sql_mode="oracle";
+--sorted_result
+select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING)
+from t1;
+set sql_mode= @save_sql_mode;
+
+drop table t1;
+DROP FUNCTION avgcost;
+DROP FUNCTION avg2;
+DROP FUNCTION myfunc_double;
diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result
index 0c6ddd3675a..7ad588114b6 100644
--- a/mysql-test/main/union.result
+++ b/mysql-test/main/union.result
@@ -564,7 +564,7 @@ explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
-2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index; Using join buffer (flat, BNL join)
+2 UNION t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
explain (select * from t1 where a=1) union (select * from t1 where b=1);
id select_type table type possible_keys key key_len ref rows Extra
@@ -2165,6 +2165,44 @@ select @advertAcctId as a from dual union all select 1.0 from dual;
a
1000003.0
1.0
+#
+# MDEV-13784: query causes seg fault
+#
+CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL);
+INSERT INTO t1 VALUES (45199,1184);
+CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`));
+INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582);
+CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64));
+CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255));
+INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo');
+CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64));
+explain select
+(
+select login_name from t4 where userId = (
+select userid from t2 where product_id = t1.product_id
+union
+select userid from t2 where product_id = (
+select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
+) as x from t1 where (t1.bug_id=45199);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
+2 SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 func 1 Using where
+3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 3 Using index
+4 UNION t2 ref PRIMARY PRIMARY 4 func 1 Using where; Using index
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
+select
+(
+select login_name from t4 where userId = (
+select userid from t2 where product_id = t1.product_id
+union
+select userid from t2 where product_id = (
+select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
+) as x from t1 where (t1.bug_id=45199);
+x
+foo
+drop table t1, t2, t3, t4, t5;
End of 5.5 tests
#
# WL#1763 Avoid creating temporary table in UNION ALL
diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test
index ca14731600e..dc9a4617fb3 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -1495,6 +1495,41 @@ eval SET NAMES $old_charset;
SET @advertAcctId = 1000003;
select @advertAcctId as a from dual union all select 1.0 from dual;
+--echo #
+--echo # MDEV-13784: query causes seg fault
+--echo #
+
+CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL);
+INSERT INTO t1 VALUES (45199,1184);
+
+CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`));
+INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582);
+
+CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64));
+
+
+CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255));
+INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo');
+CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64));
+
+explain select
+(
+ select login_name from t4 where userId = (
+ select userid from t2 where product_id = t1.product_id
+ union
+ select userid from t2 where product_id = (
+ select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
+) as x from t1 where (t1.bug_id=45199);
+select
+(
+ select login_name from t4 where userId = (
+ select userid from t2 where product_id = t1.product_id
+ union
+ select userid from t2 where product_id = (
+ select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
+) as x from t1 where (t1.bug_id=45199);
+drop table t1, t2, t3, t4, t5;
+
--echo End of 5.5 tests
--echo #
diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result
index ccf2f4451ea..ab6596e8bf1 100644
--- a/mysql-test/main/update.result
+++ b/mysql-test/main/update.result
@@ -234,7 +234,9 @@ insert into t2 values ( 1, 'abcd1e');
insert into t2 values ( 2, 'abcd2e');
analyze table t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
update t1, t2 set t1.a = t2.a where t2.b = t1.b;
show warnings;
@@ -326,7 +328,7 @@ delete from t1 order by a limit 1;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 0
+Handler_read_key 4
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
diff --git a/mysql-test/main/update_use_source.result b/mysql-test/main/update_use_source.result
index e5585fcee5d..9e43b54d81c 100644
--- a/mysql-test/main/update_use_source.result
+++ b/mysql-test/main/update_use_source.result
@@ -1177,6 +1177,7 @@ insert t1 (c1,c2,c3) select 3,seq,seq%10 from seq_1_to_200;
create index t1_idx1 on t1(c3);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
update t1 set c1=2 where exists (select 'x' from t1);
select count(*) from t1 where c1=2;
diff --git a/mysql-test/main/userstat.result b/mysql-test/main/userstat.result
index 2c8a3d3e97d..0067149691a 100644
--- a/mysql-test/main/userstat.result
+++ b/mysql-test/main/userstat.result
@@ -119,7 +119,7 @@ Handler_mrr_key_refills 0
Handler_mrr_rowid_refills 0
Handler_prepare 18
Handler_read_first 0
-Handler_read_key 9
+Handler_read_key 17
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
@@ -137,7 +137,7 @@ Handler_update 5
Handler_write 7
select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key";
handler_read_key
-9
+17
disconnect ssl_con;
set @@global.userstat=0;
select * from information_schema.index_statistics;
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index eed9b224e2e..bbe1d9b69d7 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -615,6 +615,7 @@ select is_updatable from information_schema.views;
is_updatable
YES
YES
+YES
select * from t1;
col1 col2
5 Hello, view world
@@ -1279,10 +1280,10 @@ load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields term
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
+Warning 1366 Incorrect integer value: 'error ' for column `test`.`t1`.`a` at row 3
Warning 1369 CHECK OPTION failed `test`.`v1`
Note 1265 Data truncated for column 'a' at row 3
-Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
+Warning 1366 Incorrect integer value: 'wrong end ' for column `test`.`t1`.`a` at row 4
Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1 order by a,b;
a b
@@ -4624,7 +4625,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or <cache>(NULL is null)) having trigcond(NULL is null))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or 1) having trigcond(NULL is null))))
SELECT * FROM t1, t2
WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
WHERE t4.a >= t1.a);
@@ -4640,7 +4641,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or <cache>(NULL is null)) having trigcond(NULL is null))))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or 1) having trigcond(NULL is null))))
SELECT * FROM v1, t2
WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
WHERE t4.a >= v1.a);
diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result
index eeb507ecad2..df1429eaa4d 100644
--- a/mysql-test/main/view_grant.result
+++ b/mysql-test/main/view_grant.result
@@ -562,11 +562,6 @@ use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
-drop view if exists v1;
-drop table if exists t1;
-create table t1 as select * from mysql.user where user='';
-delete from mysql.user where user='';
-flush privileges;
create user 'test14256'@'%';
grant all on test.* to 'test14256'@'%';
connect test14256,localhost,test14256,,test;
@@ -592,9 +587,6 @@ test14256@% test14256@% 1
connection root;
disconnect test14256;
drop user test14256;
-insert into mysql.user select * from t1;
-flush privileges;
-drop table t1;
connection root;
create database mysqltest;
use mysqltest;
diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test
index a70241138aa..65757e95fb3 100644
--- a/mysql-test/main/view_grant.test
+++ b/mysql-test/main/view_grant.test
@@ -669,16 +669,6 @@ drop database mysqltest;
#
# Bug#14256 definer in view definition is not fully qualified
#
---disable_warnings
-drop view if exists v1;
-drop table if exists t1;
---enable_warnings
-
-# Backup anonymous users and remove them. (They get in the way of
-# the one we test with here otherwise.)
-create table t1 as select * from mysql.user where user='';
-delete from mysql.user where user='';
-flush privileges;
# Create the test user
create user 'test14256'@'%';
@@ -708,12 +698,6 @@ connection root;
disconnect test14256;
drop user test14256;
-# Restore the anonymous users.
-insert into mysql.user select * from t1;
-flush privileges;
-
-drop table t1;
-
#
# Bug#14726 freeing stack variable in case of an error of opening a view when
# we have locked tables with LOCK TABLES statement.
diff --git a/mysql-test/main/warnings.result b/mysql-test/main/warnings.result
index 7c7e049ff2d..db3ef5f17d2 100644
--- a/mysql-test/main/warnings.result
+++ b/mysql-test/main/warnings.result
@@ -31,19 +31,19 @@ Error 1064 You have an error in your SQL syntax; check the manual that correspon
insert into t1 values (1);
insert ignore into t1 values ("hej");
Warnings:
-Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
+Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1
insert ignore into t1 values ("hej"),("då");
Warnings:
-Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
-Warning 1366 Incorrect integer value: 'då' for column 'a' at row 2
+Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect integer value: 'då' for column `test`.`t1`.`a` at row 2
set SQL_WARNINGS=1;
insert ignore into t1 values ("hej");
Warnings:
-Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
+Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1
insert ignore into t1 values ("hej"),("då");
Warnings:
-Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
-Warning 1366 Incorrect integer value: 'då' for column 'a' at row 2
+Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect integer value: 'då' for column `test`.`t1`.`a` at row 2
drop table t1;
set SQL_WARNINGS=0;
drop temporary table if exists not_exists;
@@ -171,44 +171,44 @@ create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
update ignore t1 set a='abc';
Warnings:
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 1
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 2
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 3
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 4
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 5
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 6
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 7
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 8
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 9
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10
show warnings limit 2, 1;
Level Code Message
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 3
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 3
show warnings limit 0, 10;
Level Code Message
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 1
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 2
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 3
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 4
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 5
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 6
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 7
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 8
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 9
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 3
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 4
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 5
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 6
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 7
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 8
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 9
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10
show warnings limit 9, 1;
Level Code Message
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10
show warnings limit 10, 1;
Level Code Message
show warnings limit 9, 2;
Level Code Message
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10
show warnings limit 0, 0;
Level Code Message
show warnings limit 1;
Level Code Message
-Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 1
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 1
show warnings limit 0;
Level Code Message
show warnings limit 1, 0;
@@ -254,13 +254,13 @@ SELECT f1 INTO x FROM t3 LIMIT 1;
END//
CALL sp1();
Warnings:
-Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1
+Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1
CALL sp2();
Warnings:
-Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1
+Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1
CALL sp3();
Warnings:
-Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1
+Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1
SET sql_mode = DEFAULT;
DROP PROCEDURE IF EXISTS sp1;
SET sql_mode = '';
@@ -271,7 +271,7 @@ SELECT f1 into x from t2 limit 1;
END//
CALL sp1();
Warnings:
-Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1
+Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1
SET sql_mode = DEFAULT;
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 2f757756117..279404968bf 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -3362,7 +3362,134 @@ Kaolin Tuning 88 68.7500
Tatiana Tuning 83 68.7500
drop table t1;
#
-# Start of 10.3 tests
+# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
+# or Invalid write in JOIN::make_aggr_tables_info
+#
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100) order by 1+2;
+BIT_OR(100) OVER ()
+100
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT * FROM (
+SELECT
+ROW_NUMBER() OVER(), i, sum(i)
+FROM t1
+WHERE 1=0
+limit 0
+) AS sq;
+ROW_NUMBER() OVER() i sum(i)
+SELECT * FROM (
+SELECT
+ROW_NUMBER() OVER(), i, sum(i)
+FROM t1
+WHERE 1=0
+GROUP BY i
+) AS sq;
+ROW_NUMBER() OVER() i sum(i)
+drop table t1;
+create table t1 (a int);
+explain
+select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
+1 row_number() over (order by 1)
+drop table t1;
+explain
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
+HAVING @A := 'qwerty';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
+HAVING @A := 'qwerty';
+BIT_OR(100) OVER ()
+explain
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100)
+HAVING @A := 'qwerty';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100)
+HAVING @A := 'qwerty';
+BIT_OR(100) OVER ()
+create table t1 (a int);
+explain
+SELECT DISTINCT BIT_OR(100) OVER () FROM t1
+GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
+drop table t1;
+#
+# MDEV-13170: Database service (MySQL) stops after update with trigger
+#
+CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ;
+INSERT INTO t1 VALUES (1,1,8884),(2,1,8885);
+CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int);
+CREATE TABLE t3 (id1 int, id2 int, d1 int);
+CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin
+CREATE OR REPLACE TEMPORARY TABLE trg_u AS
+WITH l AS
+(SELECT a.*,
+Max(t2.col_id) over (PARTITION BY a.d1),
+Max(t2.new_val) over (PARTITION BY a.d1)
+FROM
+(SELECT d1 , id1, id2 FROM t3) a
+JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr))
+SELECT 1;
+END;//
+update t1 set ml_id=8884 where point_id=1;
+ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u'
+update t1 set ml_id=8884 where point_id=1;
+ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u'
+drop table t1, t2,t3;
+CREATE TABLE t1 (i INT, a char);
+INSERT INTO t1 VALUES (1, 'a'),(2, 'b');
+create view v1 as select * from t1;
+PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1";
+execute stmt;
+i row_number() over (partition by i order by i)
+1 1
+2 1
+deallocate prepare stmt;
+drop table t1;
+drop view v1;
+#
+# MDEV-17676: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init
+#
+CREATE TABLE t1 (b1 text NOT NULL);
+INSERT INTO t1 VALUES ('2'),('1');
+EXPLAIN
+SELECT DISTINCT MIN(b1) OVER () FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary
+SELECT DISTINCT MIN(b1) OVER () FROM t1;
+MIN(b1) OVER ()
+1
+drop table t1;
+#
+# MDEV-15424: Unreasonal SQL Error (1356) on select from view
+#
+create table t1 (id int, n1 int);
+insert into t1 values (1,1), (2,1), (3,2), (4,4);
+create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1;
+explain select * from v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
+2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary
+select * from v1;
+ifnull(max(n1) over (partition by n1),'aaa')
+1
+1
+2
+4
+drop table t1;
+drop view v1;
+#
+# End of 10.2 tests
#
#
# MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]'
@@ -3382,6 +3509,9 @@ d x
00:00:02 NULL
DROP TABLE t1;
#
+# End of 10.3 tests
+#
+#
# MDEV-16722: Assertion `type() != NULL_ITEM' failed
#
create table t1 (a int);
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index cd340a17a0d..19e83ea8c41 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -2121,7 +2121,128 @@ ORDER BY test, name;
drop table t1;
--echo #
---echo # Start of 10.3 tests
+--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
+--echo # or Invalid write in JOIN::make_aggr_tables_info
+--echo #
+
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100) order by 1+2;
+
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+
+SELECT * FROM (
+ SELECT
+ ROW_NUMBER() OVER(), i, sum(i)
+ FROM t1
+ WHERE 1=0
+ limit 0
+) AS sq;
+
+SELECT * FROM (
+ SELECT
+ ROW_NUMBER() OVER(), i, sum(i)
+ FROM t1
+ WHERE 1=0
+ GROUP BY i
+) AS sq;
+drop table t1;
+
+create table t1 (a int);
+explain
+select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
+select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
+drop table t1;
+
+explain
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
+HAVING @A := 'qwerty';
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
+HAVING @A := 'qwerty';
+
+explain
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100)
+HAVING @A := 'qwerty';
+SELECT DISTINCT BIT_OR(100) OVER () FROM dual
+GROUP BY LEFT('2018-08-24', 100)
+HAVING @A := 'qwerty';
+
+create table t1 (a int);
+explain
+SELECT DISTINCT BIT_OR(100) OVER () FROM t1
+GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0;
+drop table t1;
+
+--echo #
+--echo # MDEV-13170: Database service (MySQL) stops after update with trigger
+--echo #
+
+CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ;
+INSERT INTO t1 VALUES (1,1,8884),(2,1,8885);
+
+CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int);
+CREATE TABLE t3 (id1 int, id2 int, d1 int);
+
+delimiter //;
+
+CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin
+CREATE OR REPLACE TEMPORARY TABLE trg_u AS
+WITH l AS
+ (SELECT a.*,
+ Max(t2.col_id) over (PARTITION BY a.d1),
+ Max(t2.new_val) over (PARTITION BY a.d1)
+ FROM
+ (SELECT d1 , id1, id2 FROM t3) a
+ JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr))
+SELECT 1;
+
+ END;//
+
+ delimiter ;//
+--error 1062
+update t1 set ml_id=8884 where point_id=1;
+--error 1062
+update t1 set ml_id=8884 where point_id=1;
+drop table t1, t2,t3;
+
+CREATE TABLE t1 (i INT, a char);
+INSERT INTO t1 VALUES (1, 'a'),(2, 'b');
+create view v1 as select * from t1;
+PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1";
+execute stmt;
+deallocate prepare stmt;
+drop table t1;
+drop view v1;
+
+--echo #
+--echo # MDEV-17676: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init
+--echo #
+
+CREATE TABLE t1 (b1 text NOT NULL);
+INSERT INTO t1 VALUES ('2'),('1');
+EXPLAIN
+SELECT DISTINCT MIN(b1) OVER () FROM t1;
+SELECT DISTINCT MIN(b1) OVER () FROM t1;
+drop table t1;
+
+--echo #
+--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view
+--echo #
+
+create table t1 (id int, n1 int);
+insert into t1 values (1,1), (2,1), (3,2), (4,4);
+
+create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1;
+explain select * from v1;
+select * from v1;
+drop table t1;
+drop view v1;
+
+--echo #
+--echo # End of 10.2 tests
--echo #
--echo #
@@ -2139,6 +2260,10 @@ SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1;
DROP TABLE t1;
--echo #
+--echo # End of 10.3 tests
+--echo #
+
+--echo #
--echo # MDEV-16722: Assertion `type() != NULL_ITEM' failed
--echo #
diff --git a/mysql-test/main/win_big-mdev-11697.result b/mysql-test/main/win_big-mdev-11697.result
index e5dc271839c..ec9d2243c88 100644
--- a/mysql-test/main/win_big-mdev-11697.result
+++ b/mysql-test/main/win_big-mdev-11697.result
@@ -12,6 +12,7 @@ select * from data_generator
commit;
analyze table test_table;
Table Op Msg_type Msg_text
+test.test_table analyze status Engine-independent statistics collected
test.test_table analyze status OK
explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -44,6 +45,7 @@ select * from data_generator
commit;
analyze table test_table;
Table Op Msg_type Msg_text
+test.test_table analyze status Engine-independent statistics collected
test.test_table analyze status OK
explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 361724e5c57..56e265d9eef 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -102,6 +102,7 @@ use mtr_unique;
use mtr_results;
use IO::Socket::INET;
use IO::Select;
+use Time::HiRes qw(gettimeofday);
require "mtr_process.pl";
require "mtr_io.pl";
@@ -2292,6 +2293,10 @@ sub environment_setup {
$ENV{'EXE_MYSQL'}= $exe_mysql;
$ENV{'MYSQL_PLUGIN'}= $exe_mysql_plugin;
$ENV{'MYSQL_EMBEDDED'}= $exe_mysql_embedded;
+ if(IS_WINDOWS)
+ {
+ $ENV{'MYSQL_INSTALL_DB_EXE'}= mtr_exe_exists("$bindir/sql$opt_vs_config/mysql_install_db");
+ }
my $client_config_exe=
mtr_exe_maybe_exists(
@@ -2891,15 +2896,44 @@ sub mysql_server_start($) {
# Save this test case information, so next can examine it
$mysqld->{'started_tinfo'}= $tinfo;
}
+
+ # If wsrep is on, we need to wait until the first
+ # server starts and bootstraps the cluster before
+ # starting other servers. The bootsrap server in the
+ # configuration should always be the first which has
+ # wsrep_on=ON
+ if (wsrep_on($mysqld) && wsrep_is_bootstrap_server($mysqld))
+ {
+ mtr_verbose("Waiting for wsrep bootstrap server to start");
+ if ($mysqld->{WAIT}->($mysqld))
+ {
+ return 1;
+ }
+ }
}
sub mysql_server_wait {
- my ($mysqld) = @_;
+ my ($mysqld, $tinfo) = @_;
- return not sleep_until_file_created($mysqld->value('pid-file'),
- $opt_start_timeout,
- $mysqld->{'proc'},
- $warn_seconds);
+ if (!sleep_until_file_created($mysqld->value('pid-file'),
+ $opt_start_timeout,
+ $mysqld->{'proc'},
+ $warn_seconds))
+ {
+ $tinfo->{comment}= "Failed to start ".$mysqld->name() . "\n";
+ return 1;
+ }
+
+ if (wsrep_on($mysqld))
+ {
+ mtr_verbose("Waiting for wsrep server " . $mysqld->name() . " to be ready");
+ if (!wait_wsrep_ready($tinfo, $mysqld))
+ {
+ return 1;
+ }
+ }
+
+ return 0;
}
sub create_config_file_for_extern {
@@ -3258,7 +3292,7 @@ sub mysql_install_db {
# Remove anonymous users
mtr_tofile($bootstrap_sql_file,
- "DELETE FROM mysql.user where user= '';\n");
+ "DELETE FROM mysql.global_priv where user= '';\n");
# Create mtr database
mtr_tofile($bootstrap_sql_file,
@@ -3281,6 +3315,7 @@ sub mysql_install_db {
# Create directories mysql and test
mkpath("$install_datadir/mysql");
+ my $realtime= gettimeofday();
if ( My::SafeProcess->run
(
name => "bootstrap",
@@ -3298,6 +3333,10 @@ sub mysql_install_db {
"Could not install system database from $bootstrap_sql_file\n" .
"The $path_bootstrap_log file contains:\n$data\n");
}
+ else
+ {
+ mtr_verbose("Spent " . sprintf("%.3f", (gettimeofday() - $realtime)) . " seconds in bootstrap");
+ }
}
@@ -5304,6 +5343,7 @@ sub server_need_restart {
{
delete $server->{'restart_opts'};
my $use_dynamic_option_switch= 0;
+ delete $server->{'restart_opts'};
if (!$use_dynamic_option_switch)
{
mtr_verbose_restart($server, "running with different options '" .
@@ -5398,6 +5438,118 @@ sub stop_servers($$) {
}
}
+#
+# run_query_output
+#
+# Run a query against a server using mysql client. The output of
+# the query will be written into outfile.
+#
+sub run_query_output {
+ my ($mysqld, $query, $outfile)= @_;
+ my $args;
+
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
+ mtr_add_arg($args, "--silent");
+ mtr_add_arg($args, "--execute=%s", $query);
+
+ my $res= My::SafeProcess->run
+ (
+ name => "run_query_output -> ".$mysqld->name(),
+ path => $exe_mysql,
+ args => \$args,
+ output => $outfile,
+ error => $outfile
+ );
+
+ return $res
+}
+
+
+#
+# wsrep_wait_ready
+#
+# Wait until the server has been joined to the cluster and is
+# ready for operation.
+#
+# RETURN
+# 1 Server is ready
+# 0 Server didn't transition to ready state within start timeout
+#
+sub wait_wsrep_ready($$) {
+ my ($tinfo, $mysqld)= @_;
+
+ my $sleeptime= 100; # Milliseconds
+ my $loops= ($opt_start_timeout * 1000) / $sleeptime;
+
+ my $name= $mysqld->name();
+ my $outfile= "$opt_vardir/tmp/$name.wsrep_ready";
+ my $query= "SET SESSION wsrep_sync_wait = 0;
+ SELECT VARIABLE_NAME, VARIABLE_VALUE
+ FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+ WHERE VARIABLE_NAME = 'wsrep_ready'";
+
+ for (my $loop= 1; $loop <= $loops; $loop++)
+ {
+ # Careful... if MTR runs with option 'verbose' then the
+ # file contains also SafeProcess verbose output
+ if (run_query_output($mysqld, $query, $outfile) == 0 &&
+ mtr_grab_file($outfile) =~ /WSREP_READY\s+ON/)
+ {
+ unlink($outfile);
+ return 1;
+ }
+ mtr_milli_sleep($sleeptime);
+ }
+
+ $tinfo->{logfile}= "WSREP did not transition to state READY";
+ return 0;
+}
+
+#
+# wsrep_is_bootstrap_server
+#
+# Check if the server is the first one to be started in the
+# cluster.
+#
+# RETURN
+# 1 The server is a bootstrap server
+# 0 The server is not a bootstrap server
+#
+sub wsrep_is_bootstrap_server($) {
+ my $mysqld= shift;
+
+ my $cluster_address= $mysqld->if_exist('wsrep-cluster-address') ||
+ $mysqld->if_exist('wsrep_cluster_address');
+ if (defined $cluster_address)
+ {
+ return $cluster_address eq "gcomm://" || $cluster_address eq "'gcomm://'";
+ }
+ return 0;
+}
+
+#
+# wsrep_on
+#
+# Check if wsrep has been enabled for a server.
+#
+# RETURN
+# 1 Wsrep has been enabled
+# 0 Wsrep is not enabled
+#
+sub wsrep_on($) {
+ my $mysqld= shift;
+ #check if wsrep_on= is set in configuration
+ if ($mysqld->if_exist('wsrep-on')) {
+ my $on= "".$mysqld->value('wsrep-on');
+ if ($on eq "1" || $on eq "ON") {
+ return 1;
+ }
+ }
+ return 0;
+}
+
#
# start_servers
@@ -5417,8 +5569,7 @@ sub start_servers($) {
for (all_servers()) {
next unless $_->{WAIT} and started($_);
- if ($_->{WAIT}->($_)) {
- $tinfo->{comment}= "Failed to start ".$_->name() . "\n";
+ if ($_->{WAIT}->($_, $tinfo)) {
return 1;
}
}
diff --git a/mysql-test/std_data/ca-cert-verify.pem b/mysql-test/std_data/ca-cert-verify.pem
deleted file mode 100644
index 21d6264a0ad..00000000000
--- a/mysql-test/std_data/ca-cert-verify.pem
+++ /dev/null
@@ -1,20 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDWzCCAkOgAwIBAgIJAO/QdKLEDQdXMA0GCSqGSIb3DQEBCwUAMEQxCzAJBgNV
-BAYTAklOMREwDwYDVQQIDAhLYXJuYXRrYTESMBAGA1UEBwwJQmFuZ2Fsb3JlMQ4w
-DAYDVQQKDAVNeVNRTDAeFw0xNjAxMDUxMDA1MDhaFw0yNTExMTMxMDA1MDhaMEQx
-CzAJBgNVBAYTAklOMREwDwYDVQQIDAhLYXJuYXRrYTESMBAGA1UEBwwJQmFuZ2Fs
-b3JlMQ4wDAYDVQQKDAVNeVNRTDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAKdOCuS2CzfBTJ2x8SAzY0J7cYJfNJvMDF1cvANnhkIhtnkWt/HZ5DJ9NxeX
-q5h7FJLAi4gddqdk/tvQJw0V6gZepJr/mKVnMPivF5+oHPc9ZJQMX6B3FBNwWylm
-ACd5GKx8I/H/MXyuhQTcoV//Ab+2pI8RHeYbBsm3lHH+tX7bRU6mUFjneqMpiCkb
-JHt6BWZiWR10O6pMuGQ9+dDdsLhEV1fj3CctEPwW6rs4IZzD8xl5n+8cy7qu6eYH
-Wt/snwsTzkrufeMRqTtqelxON9eoQwYOR1oH3vNEVlcbuoJAvaWOqBROUBdf12SP
-TYSdP9nlRh7lTKQOywN4kYt6LqUCAwEAAaNQME4wHQYDVR0OBBYEFJ4c9tKaUU0P
-EjBq5G207jjXI7RAMB8GA1UdIwQYMBaAFJ4c9tKaUU0PEjBq5G207jjXI7RAMAwG
-A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBABRnUyj21oFi0SGJg/K5+8Lc
-4n6OwVU/NgLOysIB0baIP/Rqeaze59xG/v9FPQgBlWcJK3RabOywx5bxAxdcus+1
-yp5j4h37Qq1/qkgqmevvdSAPa0OBQbLb+58/naV+ywUpCYZ6flLdCMH3fXuDSlSq
-qrCznextjojtWbnzrBmCmJmXWGd2gSaJDvb90ZZp/Elt3vN1sgjW0M/JEkb4MJ1r
-6nfD/FHr2lUwBHm2yk7Blovx7x4d/Ip3pglk63cNO/Rn0SBTdoVDS2LB9du3Phq2
-TZiL3NrRMGUNwmdaavyrJxaPq5D+Sfa4LYP3MMYD4KhLogNzIl299n5joyizlJw=
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/cacert.pem b/mysql-test/std_data/cacert.pem
index cc5d9100e30..23dda2318e1 100644
--- a/mysql-test/std_data/cacert.pem
+++ b/mysql-test/std_data/cacert.pem
@@ -2,78 +2,78 @@ Certificate:
Data:
Version: 3 (0x2)
Serial Number:
- e5:b1:e3:71:e9:6f:a9:e1
+ d0:4d:23:85:ee:59:b3:fa
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Apr 25 20:52:21 2017 GMT
- Not After : Apr 20 20:52:21 2037 GMT
+ Not Before: Jan 27 10:11:10 2019 GMT
+ Not After : Jan 22 10:11:10 2039 GMT
Subject: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
- 00:a0:ad:d5:b1:ec:45:6f:d6:33:fc:5a:03:29:14:
- f1:8e:78:d5:27:53:79:e0:92:7c:10:3b:79:a0:d7:
- b6:9d:a8:5c:4d:fa:68:11:b3:03:9e:ee:5e:20:79:
- 23:d8:9c:49:34:9c:1d:c4:6e:53:1f:9a:92:1f:08:
- c1:15:e2:ad:cf:59:cd:1e:55:84:79:f9:09:ca:36:
- 8a:50:83:c6:38:48:c6:d3:fa:f6:f2:2a:4f:bd:5d:
- 60:9d:eb:21:c4:8c:f2:dd:2d:49:10:63:46:47:de:
- 2d:59:a0:4a:e0:58:e6:c0:ae:d8:d4:5e:9a:f8:f5:
- 68:1d:ea:80:8a:d6:01:b0:d5:5f:30:4d:88:5a:c5:
- 1f:81:92:c1:40:54:c8:bb:a6:a1:43:de:81:3c:4b:
- 79:95:82:bb:52:da:a3:a4:a0:69:ff:7e:00:8c:86:
- 85:ec:af:03:68:a8:83:48:a0:e4:1d:31:a9:5c:47:
- 99:9d:3a:3f:b5:3e:12:7c:4d:47:15:72:f1:11:5c:
- 4a:ef:08:1c:7b:8f:e6:03:06:07:4f:94:21:b0:5e:
- 27:fa:93:8c:b4:cc:56:34:3b:6d:c4:4a:14:57:b2:
- 21:1a:3e:2f:c5:9e:47:1a:59:05:22:0e:56:b1:a7:
- e8:80:9b:82:c3:54:57:12:05:94:79:a2:03:d9:64:
- 3c:63
+ 00:e8:0e:a7:84:d3:75:30:06:30:b2:10:b9:d1:88:
+ 36:2b:5e:f8:c8:44:57:cb:67:72:ab:96:95:33:d5:
+ 88:d1:8f:23:50:98:ba:6d:20:00:80:bd:35:d5:c1:
+ bf:98:49:c4:0a:15:4a:34:a6:21:9b:2e:8c:15:09:
+ f0:63:81:02:c2:7c:e2:53:e0:f7:a1:1a:40:5e:8f:
+ 41:4a:4c:56:d4:20:f1:d5:a7:c1:53:2e:ff:7e:37:
+ 17:cc:7e:74:bd:e2:22:33:ce:8c:77:62:a4:c5:3f:
+ 44:35:7b:7e:b9:f5:7d:8c:7a:27:58:fd:2c:42:86:
+ 2e:e7:6b:01:99:7b:fe:7d:a7:a1:4f:3e:39:39:54:
+ 1f:61:de:74:66:d1:77:4f:43:1b:66:70:29:85:de:
+ fc:8f:8e:1b:7b:a2:66:48:26:7f:9b:a6:fd:4a:e4:
+ dc:eb:ed:bd:f8:e3:f1:57:98:13:6f:f1:a3:2a:e3:
+ 73:bd:8d:7c:6f:4b:59:35:bc:b5:42:3e:99:a7:13:
+ 8d:be:2e:5c:9a:c6:5b:ab:ae:bf:00:e9:c8:ee:05:
+ 22:8e:d5:67:1a:47:9a:6d:9c:f9:42:3e:15:34:f8:
+ 31:ec:b4:7e:d3:92:95:b0:b8:f9:66:f3:bd:1d:31:
+ 2c:b1:90:62:a1:f8:4e:a6:5d:26:22:f0:e1:fe:16:
+ 2b:69
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
- 1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12
+ CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Authority Key Identifier:
- keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12
+ keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha256WithRSAEncryption
- 0d:4b:21:52:fa:49:34:56:14:db:83:ae:1c:3d:a7:4d:3e:ea:
- 55:7e:1a:37:7a:65:89:ee:19:05:94:9d:3a:ad:59:c4:38:16:
- b2:bd:02:ee:5a:a6:7e:e2:b1:21:a3:ad:af:8c:ae:c3:30:71:
- ad:d7:d2:24:0f:c4:d9:47:80:c5:95:05:1d:7c:8a:49:0a:7d:
- 8b:61:ca:b5:68:3d:3e:4e:f1:c7:45:62:c8:cc:a9:2f:f3:12:
- f1:3f:92:34:7f:07:ab:d3:ac:ab:af:2d:c9:69:63:8a:b2:e5:
- 35:ea:7d:b8:17:38:72:82:5f:96:3d:dc:8d:e5:11:bb:ae:f3:
- 02:2d:20:77:5c:64:59:18:a6:e7:fa:c7:89:e8:30:12:14:04:
- 40:5b:e9:b1:8f:86:81:b9:0d:6c:b6:fc:98:f9:b7:52:ab:8f:
- 7e:53:c8:a0:05:e4:cd:0d:6b:d2:74:9f:17:7a:a1:c3:76:5e:
- f3:29:1c:c6:be:56:ab:02:f7:5d:e1:c9:21:27:6d:66:7a:41:
- 29:49:a3:f8:f5:2a:e7:03:2a:7c:52:4b:f5:46:58:45:be:a4:
- 4c:a0:65:37:1d:d8:ac:f8:1f:81:ca:9c:79:f0:ff:22:8c:1d:
- ce:2b:d0:1e:ce:99:f2:db:fa:66:84:e6:86:6f:19:3b:10:f1:
- 92:ac:57:b2
+ df:fd:74:29:5b:5e:9a:8b:09:02:40:59:73:cb:71:47:3f:97:
+ 3d:a9:fd:c4:8c:01:29:c9:86:b8:71:55:ff:72:0e:50:dc:c8:
+ b5:e6:91:41:52:47:21:30:cc:4d:e7:3b:4b:db:55:ea:7d:46:
+ eb:53:e0:b7:1b:80:7c:b1:0c:d3:d1:bc:a0:73:ae:96:1f:fd:
+ 05:52:7e:54:d5:03:52:69:7b:34:5f:27:d7:98:da:98:76:73:
+ e6:bb:50:59:2a:94:90:67:03:1c:a4:76:2f:ee:ef:59:60:09:
+ 48:33:03:2b:52:ed:83:42:f8:71:19:7f:d8:be:40:ed:20:01:
+ 90:3c:7e:1c:8b:d2:9f:f3:2f:09:1f:50:c8:10:e1:8a:d9:a5:
+ 49:9c:0b:74:17:b9:2b:68:f6:1e:73:c2:73:10:38:b3:35:e2:
+ 87:91:1b:a1:d1:9b:81:9d:1b:32:cc:03:6e:4c:82:95:81:11:
+ 42:56:e2:16:2b:22:65:db:40:2c:ca:dc:03:f4:d5:07:cf:f5:
+ 13:b2:cf:51:5b:24:cd:c7:d1:9b:42:8e:f9:df:5d:1e:5a:09:
+ a3:4f:a9:0b:f4:21:c5:bb:ff:02:93:67:e8:2d:ee:ab:d9:59:
+ 76:03:2c:a1:bd:fb:dc:af:b6:82:94:71:85:53:a8:18:0d:3a:
+ 9e:42:eb:59
-----BEGIN CERTIFICATE-----
-MIIDfzCCAmegAwIBAgIJAOWx43Hpb6nhMA0GCSqGSIb3DQEBCwUAMFYxDzANBgNV
+MIIDfzCCAmegAwIBAgIJANBNI4XuWbP6MA0GCSqGSIb3DQEBCwUAMFYxDzANBgNV
BAMMBmNhY2VydDELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYD
-VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xNzA0MjUyMDUyMjFa
-Fw0zNzA0MjAyMDUyMjFaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx
+VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xOTAxMjcxMDExMTBa
+Fw0zOTAxMjIxMDExMTBaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx
ETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhIZWxzaW5raTEQMA4GA1UECgwH
-TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKCt1bHsRW/W
-M/xaAykU8Y541SdTeeCSfBA7eaDXtp2oXE36aBGzA57uXiB5I9icSTScHcRuUx+a
-kh8IwRXirc9ZzR5VhHn5Cco2ilCDxjhIxtP69vIqT71dYJ3rIcSM8t0tSRBjRkfe
-LVmgSuBY5sCu2NRemvj1aB3qgIrWAbDVXzBNiFrFH4GSwUBUyLumoUPegTxLeZWC
-u1Lao6Sgaf9+AIyGheyvA2iog0ig5B0xqVxHmZ06P7U+EnxNRxVy8RFcSu8IHHuP
-5gMGB0+UIbBeJ/qTjLTMVjQ7bcRKFFeyIRo+L8WeRxpZBSIOVrGn6ICbgsNUVxIF
-lHmiA9lkPGMCAwEAAaNQME4wHQYDVR0OBBYEFBzHK6obsbsumvQPsYZgVzjCQQUS
-MB8GA1UdIwQYMBaAFBzHK6obsbsumvQPsYZgVzjCQQUSMAwGA1UdEwQFMAMBAf8w
-DQYJKoZIhvcNAQELBQADggEBAA1LIVL6STRWFNuDrhw9p00+6lV+Gjd6ZYnuGQWU
-nTqtWcQ4FrK9Au5apn7isSGjra+MrsMwca3X0iQPxNlHgMWVBR18ikkKfYthyrVo
-PT5O8cdFYsjMqS/zEvE/kjR/B6vTrKuvLclpY4qy5TXqfbgXOHKCX5Y93I3lEbuu
-8wItIHdcZFkYpuf6x4noMBIUBEBb6bGPhoG5DWy2/Jj5t1Krj35TyKAF5M0Na9J0
-nxd6ocN2XvMpHMa+VqsC913hySEnbWZ6QSlJo/j1KucDKnxSS/VGWEW+pEygZTcd
-2Kz4H4HKnHnw/yKMHc4r0B7OmfLb+maE5oZvGTsQ8ZKsV7I=
+TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOgOp4TTdTAG
+MLIQudGINite+MhEV8tncquWlTPViNGPI1CYum0gAIC9NdXBv5hJxAoVSjSmIZsu
+jBUJ8GOBAsJ84lPg96EaQF6PQUpMVtQg8dWnwVMu/343F8x+dL3iIjPOjHdipMU/
+RDV7frn1fYx6J1j9LEKGLudrAZl7/n2noU8+OTlUH2HedGbRd09DG2ZwKYXe/I+O
+G3uiZkgmf5um/Urk3Ovtvfjj8VeYE2/xoyrjc72NfG9LWTW8tUI+macTjb4uXJrG
+W6uuvwDpyO4FIo7VZxpHmm2c+UI+FTT4Mey0ftOSlbC4+WbzvR0xLLGQYqH4TqZd
+JiLw4f4WK2kCAwEAAaNQME4wHQYDVR0OBBYEFMpxmYnwcqt1ZrtlagMEcqV7laaT
+MB8GA1UdIwQYMBaAFMpxmYnwcqt1ZrtlagMEcqV7laaTMAwGA1UdEwQFMAMBAf8w
+DQYJKoZIhvcNAQELBQADggEBAN/9dClbXpqLCQJAWXPLcUc/lz2p/cSMASnJhrhx
+Vf9yDlDcyLXmkUFSRyEwzE3nO0vbVep9RutT4LcbgHyxDNPRvKBzrpYf/QVSflTV
+A1JpezRfJ9eY2ph2c+a7UFkqlJBnAxykdi/u71lgCUgzAytS7YNC+HEZf9i+QO0g
+AZA8fhyL0p/zLwkfUMgQ4YrZpUmcC3QXuSto9h5zwnMQOLM14oeRG6HRm4GdGzLM
+A25MgpWBEUJW4hYrImXbQCzK3AP01QfP9ROyz1FbJM3H0ZtCjvnfXR5aCaNPqQv0
+IcW7/wKTZ+gt7qvZWXYDLKG9+9yvtoKUcYVTqBgNOp5C61k=
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/cakey.pem b/mysql-test/std_data/cakey.pem
index 88e251f00e2..0e2f7dce244 100644
--- a/mysql-test/std_data/cakey.pem
+++ b/mysql-test/std_data/cakey.pem
@@ -1,28 +1,28 @@
-----BEGIN PRIVATE KEY-----
-MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgrdWx7EVv1jP8
-WgMpFPGOeNUnU3ngknwQO3mg17adqFxN+mgRswOe7l4geSPYnEk0nB3EblMfmpIf
-CMEV4q3PWc0eVYR5+QnKNopQg8Y4SMbT+vbyKk+9XWCd6yHEjPLdLUkQY0ZH3i1Z
-oErgWObArtjUXpr49Wgd6oCK1gGw1V8wTYhaxR+BksFAVMi7pqFD3oE8S3mVgrtS
-2qOkoGn/fgCMhoXsrwNoqINIoOQdMalcR5mdOj+1PhJ8TUcVcvERXErvCBx7j+YD
-BgdPlCGwXif6k4y0zFY0O23EShRXsiEaPi/FnkcaWQUiDlaxp+iAm4LDVFcSBZR5
-ogPZZDxjAgMBAAECggEAWmy6AGFpSmEP7IpzkOEaeAWEX5dY1YtaioAOGPiM6vje
-yXuMqblG5mBbVIcYJ0T85cCd9/fmi7ifVxvEHh7tle2Bw/p4jXQbkFNVT655FR/P
-1Wg9JVeufHFaeETlQgnYe6SKo9BaswNUHkZZHRyq7/D2Ub3UFRt2tq9MG9YIKY1m
-rP9s7E+EDuH9UhYmaWdQfNm8muIXWK8WjicI5+PX0CQ1NtUy6vS7qBzcBzvT0chC
-Jtja29S6Nvg12A96nHsRmQyUaQjRlqosSwiagpc5mZmNeCEUoY+3deIdYIUMSQnf
-judZOKVPq0GOW5Y1U068LGODWaifPkinGBj+04VH0QKBgQDOp/jVCOUdEeqFJ/8m
-wEsfsRIrXvtGJHgbDXcVJ69FwlX+yaKGEuC+4f21uyxPn6GoFw+NKAyTmGKH7VAX
-OFQLrMQ/DMlNbZrCAAFcXMqrnLaVwqMeIIoVNfKAa8u15K40qc+B0it61Nlay5wq
-wvXoSZrdqXSgsI29pav20+8pTQKBgQDHC3l1+gMZ1rCar+5KdVBN1Wq4Xh7cwZw6
-FxEvyrDCJePEU2L7FpH1pFuB4WpXdBu3CPo70ZgwfqBXn4qLOOI3gTtDHActyiUm
-+WRG62O+5Ye7aLB4xy0MfnKNA2g/yHj1ozwM8kA5JRptAzDnzWfVE0k47/pVAVzt
-E2bZuSykbwKBgQCL6SkMgjMr1T9j20phn/q8gBN/DZUtTe+K0Tj4N5/wqLuz/its
-fkdutG4ipZBAcCDwPnym4qBxJNBAmqiIr/gm11ceILgBFd2azoodUC1etoDfL6Fj
-+j/CUH3X+CM5CJPwz67Pg80wIf7t+7/FK611ELAqtllhmWa9KPcd6yqWWQKBgHh5
-Xnvk5kmWY3BNOgrBNOjXWu/asA1n9lpGqfVmVlQ8wL6MxiU5xQCMCYL0X/ws37WK
-boMUWmxHyF8gxqd7t5hm1OrKpSG274PGgUZXpRjfLqdlNyLzUzXztvvY6xloCqaK
-tYcUfYDZD0SaINi8v7L9KF2ZCsi2uXsZOjBf30BrAoGAXPPotkw/CkcPQBS13cha
-ZWeeH5NDKBADWXfLfcRUs108c9xw4BYr5yGilSPscN2ZP0/iWONKp/c6/STS54t5
-lkOKKUbkAFbQu8UKa1J7zrnHZv+Mr4I/iBBy6VkN8Spp2vBI3Ng6jhPIJg3Gum9p
-943wWtAnIhe/UqCRT3a/GZg=
+MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDoDqeE03UwBjCy
+ELnRiDYrXvjIRFfLZ3KrlpUz1YjRjyNQmLptIACAvTXVwb+YScQKFUo0piGbLowV
+CfBjgQLCfOJT4PehGkBej0FKTFbUIPHVp8FTLv9+NxfMfnS94iIzzox3YqTFP0Q1
+e3659X2MeidY/SxChi7nawGZe/59p6FPPjk5VB9h3nRm0XdPQxtmcCmF3vyPjht7
+omZIJn+bpv1K5Nzr7b344/FXmBNv8aMq43O9jXxvS1k1vLVCPpmnE42+Llyaxlur
+rr8A6cjuBSKO1WcaR5ptnPlCPhU0+DHstH7TkpWwuPlm870dMSyxkGKh+E6mXSYi
+8OH+FitpAgMBAAECggEBAMSw7yKxjSnIhWvYq3fDiY6XcC1naDb7FwIDn7GQs+hT
+9+3vlky6jFKSjdgB4iD1nVmilAQuMFv1Rzzp8LyWdD1fVwMbsyj1NEwyBngwXoRs
+7C5Zg467Tkmv7tcg9FiiHLVmxD7I+LpLlsfyRgbe4qy4OTO/W82DKKx0UaXDqIDd
+gIiBM5Vj9s1Lzoi7r2lXtuuEeRCH0mf9sAygqAkmj50i0vI05kQtIzJluU8KufPy
+DbQryaz5CWvXr4wdN3KbrVw5yRk9wz8JsIW1CRQshmVb5hZ+sS97eO11WKumen0I
+wXP8Z3s6NhTaeJvW/AsPZ2xm/vM/rLo1634tUZzzQ4UCgYEA+zIJ/TQ7Rfot30lu
+oz3d8moXW6B5iDUYQ6VuFY/0qImlFkR91BPp/XtZ0FyiVHEvF8hUQQc6jzCQylot
+QHOuW/hRWxFrVZndVhhgtAd4tFd39yOa8pkFifj8Wkdq6q0KuA+/qtCnVDwEEe+n
+U4xZXJmZ8schLRy9A5Js9NNckhcCgYEA7H7oCVBhNQRfcylBs5Y41qmIvokpU76B
+u6Pk7OwhVoe9aO41VXXjPwLJaPw7U2270CEuKB0YhVY1cpqFZdkuUsfwYh6ju6xY
+AIzeZuGw7LAXM+DabHnc6NKKAG6b9uBEh3f+N93NnLM8yPJheCbRGcC67gbEIB+Q
+7Z3TX8QtHn8CgYEAqSv9EDriBHHF/Q/uZCAhXsZWbs33q2Ter4g1SG5H/k2dEg8U
+kwTKXH17cllAtg/4AFNZcuYUaSTzDmSG/1YpQiVNXUCxAdh6+SW30ucJQqN51sZy
+7xlhYpd+FKrudZgOlQF+OuMFHjTBJPc6wIjQEg4cYSX80O3+2e3+VTAXswcCgYEA
+hfur58LzH383uF2yTFUaJHtt7kx07m3qv+ytgJCSnpxOcckqzBz6vrMMen8T+UMc
++WAi7zT0tG3P3/qtArOVK+78QAqNxoBwZvdn9K9+dcmZi5mjBXvQ7NKCvpXrpGUQ
+ThNsIih2GYXuNQYktFaBdm6bOMj6ihx4FjapDwNscG8CgYAnGxSNAgAsoMzfhSbp
+fYQYqGlufvTHknavHW1tQagxFdew9tsYYA9XQJtwB4pnYZ6vEGOnp74g4Y6i2VPx
+1T4T5ctDX0oydWe1lNZR8iszU9Fes9YnWviS2KWE0s3NDii/3UDUDqc4ZmgRUOIs
+gcAXPXgP9Kgz6kRH/9VkzAFfkQ==
-----END PRIVATE KEY-----
diff --git a/mysql-test/std_data/client-cert.crl b/mysql-test/std_data/client-cert.crl
new file mode 100644
index 00000000000..1f737bf790b
--- /dev/null
+++ b/mysql-test/std_data/client-cert.crl
@@ -0,0 +1,12 @@
+-----BEGIN X509 CRL-----
+MIIBxTCBrgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNlcnQxCzAJ
+BgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kx
+EDAOBgNVBAoMB01hcmlhREIXDTE5MDEyNzEwMTExNVoXDTM5MDEyMjEwMTExNVow
+FDASAgEFFw0xOTAxMjcxMDExMTVaoA4wDDAKBgNVHRQEAwIBAjANBgkqhkiG9w0B
+AQsFAAOCAQEAI0yg8tW6n8m/3g4FO5fjrtwEB1HYnJVLbKT2fOSKs7WN/t6M4ZWo
+hSolEpNozd0yP+20srCMzsg7PuiYV/jMJn0bCw+Q6G7IP2GBlBURRErJ6UNZ+Upe
+Gc+o5tWvb7ROwMj76UBzK5tDsmDapk5102k0sfaIbD51OmA+RxnxbKsGNvAVp9EH
+yN+irF6vfVmbP1WPzGZa6x2s70kiC3peQlnZFOUnhycwVdiRprcUd+ZfMLJ3Ov2b
+oa9P+ntTW/0ijg0QYH6gSQVOl9ZiVhnRR/eO6SrkrevgtAM3pXl4aDdvFyoIXXkh
+mCkYfW7LkH/+OYWyZ1W99cnISM2F+yC1yQ==
+-----END X509 CRL-----
diff --git a/mysql-test/std_data/client-cert.pem b/mysql-test/std_data/client-cert.pem
index 9f6f0cfde7c..dbd94f57702 100644
--- a/mysql-test/std_data/client-cert.pem
+++ b/mysql-test/std_data/client-cert.pem
@@ -1,26 +1,35 @@
Certificate:
Data:
Version: 3 (0x2)
- Serial Number: 3 (0x3)
+ Serial Number: 5 (0x5)
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Apr 25 20:52:33 2017 GMT
- Not After : Apr 20 20:52:33 2037 GMT
+ Not Before: Jan 27 10:11:15 2019 GMT
+ Not After : Jan 22 10:11:15 2039 GMT
Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=client
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (1024 bit)
+ Public-Key: (2048 bit)
Modulus:
- 00:a1:10:ea:cc:8e:2c:73:6b:33:1a:5e:26:19:b6:
- 4b:4c:bc:04:b8:c2:e2:33:eb:67:a2:7a:27:af:3f:
- f7:ef:49:5f:c1:d2:b9:d9:71:fe:17:a0:93:da:dc:
- f1:47:de:fa:1f:c3:c1:d1:a5:2a:06:cb:b3:e8:9a:
- c1:bd:78:77:68:45:c1:55:cd:b1:c1:d3:df:8c:12:
- 4f:c2:3a:0d:b7:58:dc:ca:13:08:b9:fb:12:24:90:
- aa:b7:4e:04:eb:43:0d:45:be:1c:17:d6:a8:b1:af:
- 10:3c:39:d6:08:45:ed:a9:7e:3a:69:ae:70:22:86:
- 7e:71:1f:f1:0e:d0:0d:32:c3
+ 00:a9:10:77:b5:42:8f:e8:ad:69:2a:03:e9:56:f5:
+ 2d:d5:ba:92:06:cc:7f:c8:d2:0f:c5:47:fd:3e:db:
+ e1:5b:2b:40:ca:f8:05:9c:12:55:ef:0c:4a:92:3d:
+ 01:ac:0a:21:72:c4:b4:d9:59:82:75:1d:0c:63:fe:
+ 5a:20:7f:c5:53:b2:b9:05:88:60:c7:d9:fd:0f:ce:
+ 8f:10:a3:23:74:8f:21:70:56:73:c2:07:f0:79:20:
+ 52:1d:e0:30:9d:ed:0d:5a:f2:68:1b:0c:9e:2d:62:
+ d6:5c:e3:72:2d:92:79:aa:d0:f0:3a:ed:d6:52:30:
+ 3a:e7:91:5e:98:4e:2f:a0:07:d7:73:78:42:02:7d:
+ c4:2c:d3:63:03:b7:72:a5:33:da:f7:e9:3f:93:c9:
+ 37:19:9f:33:62:4f:1a:03:c3:a6:4b:f4:f5:51:e4:
+ ef:af:d6:a7:9a:55:5f:bc:d3:a9:77:90:59:8c:29:
+ b5:2d:3d:ef:ba:cd:21:54:24:79:6e:91:be:08:b6:
+ b1:9c:78:be:6d:2f:56:72:10:69:91:ee:b3:bd:eb:
+ 77:b3:c1:bf:c7:28:c6:ad:70:37:68:da:42:8a:7f:
+ dc:3b:40:78:d5:f2:a5:c1:43:c3:61:8e:bb:d0:b8:
+ 2d:05:41:7e:f2:b2:49:86:8b:ad:d7:fb:e0:9b:48:
+ 7d:af
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -28,42 +37,45 @@ Certificate:
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- 0C:20:76:A1:80:9C:2F:30:3D:F7:AB:8D:31:19:AD:E2:F7:E2:8D:12
+ CE:F4:DF:1F:F9:52:2E:37:2D:3D:8A:B6:DE:41:8C:13:F6:14:4E:57
X509v3 Authority Key Identifier:
- keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12
+ keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
Signature Algorithm: sha256WithRSAEncryption
- 39:c0:90:13:19:85:47:9d:c6:ab:8c:c6:c9:0f:33:11:19:f7:
- 01:2c:1b:08:f6:81:98:11:ab:48:05:d9:b2:29:56:32:9c:ba:
- e5:40:df:85:5e:6d:fd:6e:36:9a:14:eb:90:50:57:de:2f:ed:
- 2d:89:a6:8a:40:1c:41:84:9b:da:e1:6d:e6:7c:46:b2:e0:90:
- 93:02:1c:52:2e:af:b4:d4:a1:d8:9d:19:cf:0a:67:bf:c3:3e:
- 2e:02:f4:3e:bc:2e:59:57:30:85:8a:32:ab:22:88:72:37:6e:
- ee:ed:f8:53:72:c9:28:87:50:47:81:1b:80:4c:f8:80:ce:2f:
- 47:ca:78:ce:38:51:70:ec:df:ee:fc:ea:5a:40:1e:4d:1c:fd:
- 4e:f6:74:d0:22:a4:7e:57:df:16:1a:a0:8d:be:fe:ee:f2:07:
- 2e:39:a1:97:40:19:f9:3b:b8:e7:c4:98:6e:1d:1a:27:d3:19:
- 4c:5c:c9:c3:31:98:c1:3c:27:0e:6a:de:cf:88:72:cf:e4:65:
- c9:0d:33:32:f1:ea:f7:dd:5b:9d:42:6d:ee:c7:a8:b7:85:d2:
- 41:e0:84:38:ce:86:81:ba:6e:7d:d5:ad:7a:00:58:d7:c5:83:
- 9e:5c:1d:38:32:72:49:f5:42:4b:e7:c6:5c:12:6d:e1:5d:51:
- 2c:f5:52:f0
+ 65:61:98:4c:62:3c:25:3b:12:2b:4d:78:9a:81:20:e2:4d:1e:
+ 1e:c3:78:ca:1b:5b:84:13:7b:11:da:f3:ad:d0:19:f0:02:0c:
+ 99:44:d8:52:89:e5:ee:61:9d:8e:ac:30:7a:dc:fc:7e:73:e3:
+ 28:39:25:00:78:f2:00:66:63:96:3a:10:af:2b:35:b5:3e:09:
+ 87:99:97:dd:29:0b:23:eb:95:fe:a8:f4:f5:4f:db:dd:ac:96:
+ 94:7b:b1:ef:47:15:54:6f:d8:1b:43:39:00:34:9f:ad:49:fb:
+ 21:26:94:74:20:61:ce:c5:b3:3d:5f:51:46:58:56:dc:2c:8c:
+ c3:74:97:83:63:3d:ad:0b:f6:81:63:4d:cb:30:af:45:ce:28:
+ fe:e0:68:c4:8f:1a:61:80:7e:56:8d:fc:31:5a:9f:33:37:1f:
+ ae:4e:0d:6c:25:e3:0e:13:af:01:1b:82:41:95:a1:83:47:61:
+ 40:dd:d4:36:fb:73:7a:98:61:d1:e2:5f:1e:a1:a1:a8:ea:e3:
+ 30:c8:74:c2:d2:82:6d:30:e5:e8:8f:b0:2d:1a:93:8e:ab:6b:
+ a6:17:36:a3:a2:0c:86:9c:b2:4e:1f:d7:6f:ef:04:f9:05:20:
+ b7:4f:e5:e3:9b:58:38:06:aa:d3:64:15:9a:bf:8a:97:fd:39:
+ b7:5f:e2:9e
-----BEGIN CERTIFICATE-----
-MIIDHjCCAgagAwIBAgIBAzANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
+MIIDojCCAoqgAwIBAgIBBTANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
-c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjMzWhcNMzcwNDIw
-MjA1MjMzWjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTE1WhcNMzkwMTIy
+MTAxMTE1WjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMQ8wDQYDVQQDDAZjbGllbnQw
-gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKEQ6syOLHNrMxpeJhm2S0y8BLjC
-4jPrZ6J6J68/9+9JX8HSudlx/hegk9rc8Ufe+h/DwdGlKgbLs+iawb14d2hFwVXN
-scHT34wST8I6DbdY3MoTCLn7EiSQqrdOBOtDDUW+HBfWqLGvEDw51ghF7al+Ommu
-cCKGfnEf8Q7QDTLDAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8W
-HU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBQMIHahgJwv
-MD33q40xGa3i9+KNEjAfBgNVHSMEGDAWgBQcxyuqG7G7Lpr0D7GGYFc4wkEFEjAN
-BgkqhkiG9w0BAQsFAAOCAQEAOcCQExmFR53Gq4zGyQ8zERn3ASwbCPaBmBGrSAXZ
-silWMpy65UDfhV5t/W42mhTrkFBX3i/tLYmmikAcQYSb2uFt5nxGsuCQkwIcUi6v
-tNSh2J0Zzwpnv8M+LgL0PrwuWVcwhYoyqyKIcjdu7u34U3LJKIdQR4EbgEz4gM4v
-R8p4zjhRcOzf7vzqWkAeTRz9TvZ00CKkflffFhqgjb7+7vIHLjmhl0AZ+Tu458SY
-bh0aJ9MZTFzJwzGYwTwnDmrez4hyz+RlyQ0zMvHq991bnUJt7seot4XSQeCEOM6G
-gbpufdWtegBY18WDnlwdODJySfVCS+fGXBJt4V1RLPVS8A==
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpEHe1Qo/orWkqA+lW9S3V
+upIGzH/I0g/FR/0+2+FbK0DK+AWcElXvDEqSPQGsCiFyxLTZWYJ1HQxj/logf8VT
+srkFiGDH2f0Pzo8QoyN0jyFwVnPCB/B5IFId4DCd7Q1a8mgbDJ4tYtZc43Itknmq
+0PA67dZSMDrnkV6YTi+gB9dzeEICfcQs02MDt3KlM9r36T+TyTcZnzNiTxoDw6ZL
+9PVR5O+v1qeaVV+806l3kFmMKbUtPe+6zSFUJHlukb4ItrGceL5tL1ZyEGmR7rO9
+63ezwb/HKMatcDdo2kKKf9w7QHjV8qXBQ8NhjrvQuC0FQX7yskmGi63X++CbSH2v
+AgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2Vu
+ZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTO9N8f+VIuNy09irbeQYwT9hRO
+VzAfBgNVHSMEGDAWgBTKcZmJ8HKrdWa7ZWoDBHKle5WmkzANBgkqhkiG9w0BAQsF
+AAOCAQEAZWGYTGI8JTsSK014moEg4k0eHsN4yhtbhBN7EdrzrdAZ8AIMmUTYUonl
+7mGdjqwwetz8fnPjKDklAHjyAGZjljoQrys1tT4Jh5mX3SkLI+uV/qj09U/b3ayW
+lHux70cVVG/YG0M5ADSfrUn7ISaUdCBhzsWzPV9RRlhW3CyMw3SXg2M9rQv2gWNN
+yzCvRc4o/uBoxI8aYYB+Vo38MVqfMzcfrk4NbCXjDhOvARuCQZWhg0dhQN3UNvtz
+ephh0eJfHqGhqOrjMMh0wtKCbTDl6I+wLRqTjqtrphc2o6IMhpyyTh/Xb+8E+QUg
+t0/l45tYOAaq02QVmr+Kl/05t1/ing==
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/client-key.pem b/mysql-test/std_data/client-key.pem
index b6b5507cd15..726cb5f5132 100644
--- a/mysql-test/std_data/client-key.pem
+++ b/mysql-test/std_data/client-key.pem
@@ -1,15 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQChEOrMjixzazMaXiYZtktMvAS4wuIz62eieievP/fvSV/B0rnZ
-cf4XoJPa3PFH3vofw8HRpSoGy7PomsG9eHdoRcFVzbHB09+MEk/COg23WNzKEwi5
-+xIkkKq3TgTrQw1FvhwX1qixrxA8OdYIRe2pfjpprnAihn5xH/EO0A0ywwIDAQAB
-AoGAaJMqT+vTcpDcmjcct78DPuwoiKmH4rvqCrUTRRbcbJGQSbD/F+6KUl7hAM5J
-Hifo8GzST8LT+ZuS0OiB9/naVGJjcLzpV+us+keMctB/cjmsPAAsRdeA8Xk0jTWv
-v+5a5ZWSSbRXycuUtywtoESY1RLEyB0k3Dcxvk6SD3LnNMkCQQDTyDJfP+eirhgC
-mKiNvHJjLtlRT11IMLMVTELEntsyKqzVgficZCWGkFRoF9iEO1OyCJaug7RZsuxs
-Z3lk/gq1AkEAwrHwzVPU+dTqsZ8tYHlq+d0xy+6eTtYy7e/5qH3AUz10us6BG/LY
-XVTwRFAOKQOciKZ/zPQa4oYeAc0oozSalwJBAIuMbyS0Rz262bdcQDSk5/rS8//P
-+/eFn3t5NMW6p1T3KcvGSLtEgjWZBQVSMSlwrkWxwxhbUIuKip8jz6nse8ECQDgm
-g5FkLRdEfc9uXfLl8aFQVu0+y29nPVb8D9+1LMOVBNZfekLqPdZlCcpZ4EuZ3ApZ
-IqCkgiB0l7DjT2YKZM8CQQCp8z1JvoNRwhIuojh7JajY5QBkXtvHootXr+vDUHNf
-SgR5BRmqZb0F5/BK4/7JbumiHI11QUULxhOnNtlS7DDt
+MIIEpQIBAAKCAQEAqRB3tUKP6K1pKgPpVvUt1bqSBsx/yNIPxUf9PtvhWytAyvgF
+nBJV7wxKkj0BrAohcsS02VmCdR0MY/5aIH/FU7K5BYhgx9n9D86PEKMjdI8hcFZz
+wgfweSBSHeAwne0NWvJoGwyeLWLWXONyLZJ5qtDwOu3WUjA655FemE4voAfXc3hC
+An3ELNNjA7dypTPa9+k/k8k3GZ8zYk8aA8OmS/T1UeTvr9anmlVfvNOpd5BZjCm1
+LT3vus0hVCR5bpG+CLaxnHi+bS9WchBpke6zvet3s8G/xyjGrXA3aNpCin/cO0B4
+1fKlwUPDYY670LgtBUF+8rJJhout1/vgm0h9rwIDAQABAoIBAQCAMnODZ+C13+DR
+sjua67mAysN2ElWHUvoQb2Ex7At7VVYBUob2bNTqulhFgasl6FyqqUw1T/Fjms5N
+eI6g/CIGMIyqDFrO0JZbCRdk1z/IX8xMYdHPPLP1NTPvYZOb/SfWYd/dOvkqkzrX
+HsTyl5JYm6y+EqEkm1vfQlUHiqoEXxG7hkYSIU6uXmRgeHHfw0Nuy/DizQFVZTAi
+yPoYQlMm13S1oIhr1cQRAHS41aWGl4dmprbS0Drqqr8kl2xrFEgZ/YLcwYKjAMzi
+UbkgOBU11DuLd0E+J/9iUhK5YTsMxo1TO89p7yNLHvT4NBhV3cuicq9aaWYeSijf
+VhDo+k4hAoGBAN1jlrElHmJcxI6JpA7BfX2BI5XTiQrq07jNkNMD1IlUe3zAnnq0
+DbwtXWYcolapYA9SbsXgHoEDhBjFJsz8fjqX/RKpBy0XZQuWImP0sYBficyWkKSQ
+yO0I9RNq6zERKSCP/wJMBGuRAVjlgrY6mBNVr2NmyqvVLzNNNUeCTcC/AoGBAMN+
+vrALUkMrJ8Oh5ay4IW+5toOu6/4TUyOK7zN23jGaObbPy/tLcgvpZ1xQsvuhvesG
+ubIr98st7J9+V/+mGMrvf5s4TlHUtB26E56wZrque98tBe8IG7Wh5dYut9PLw31K
+npT9fAYy8nsY2c7g5cs/vfJ+ixFj5ytsiYgjjI8RAoGBAMz32xh/CTaANOrSvDV9
+JrX/zfZ1NrgI2aSLjb4QGcJbmUjS/OcVtHG4fnR/pj0d63XEGBLTgOppWu+j+Fxo
+mGWfOgsAu0ggFMk5YvWwInZ7/ZSRAbGa6quqU1x67O0suisPpkV2I9GDGwA23WHh
+tdKQziT1kkasxVp17RIbrej5AoGAHMki5uUj3cQS/Nlv6jjKo5ri5wzwrt7FlSw2
+AIv2N7OP3/1E+eGoD1z03UD8udSdFGhPG48h04cVmn6OEpSwfeE6Fu75iU8anm3x
+yaIL3l0m3DvS7dlxyxLltt32L3eHd4FvTFzu0DLcRYfpOm8fJwhhvb0oWQ0u0tQO
+hD9HySECgYEAnLQnpkmFfr+1Gfg19N28Pvgh9NJMxvt4zVP+MZ8xR8gI+peqjZLp
+KDGtIlQ7bPnjMopeWojf7mOnlsvR4mChXJ6Uw1XGZjgMQnQtOrrHSuzdoWDJDteu
+8ftYoxWkqclzIrytpsOxon/Epq9i/D019V3+p+IhJ7NKiwqh0Ui66co=
-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/crl-ca-cert.pem b/mysql-test/std_data/crl-ca-cert.pem
deleted file mode 100644
index abe7bc469fc..00000000000
--- a/mysql-test/std_data/crl-ca-cert.pem
+++ /dev/null
@@ -1,63 +0,0 @@
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number:
- a5:85:ec:60:b1:68:44:22
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate
- Validity
- Not Before: Jun 17 07:27:51 2011 GMT
- Not After : Jun 15 07:27:51 2016 GMT
- Subject: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:9b:08:0b:96:19:57:fb:21:79:f4:16:c9:b8:2c:
- 13:2e:e1:fe:5f:6b:18:7d:d4:c4:d7:cd:66:a6:62:
- 0e:b7:28:b1:39:76:62:6e:5a:4a:80:f6:0e:8e:84:
- 3e:cf:2f:91:0d:36:6d:8b:b5:f9:78:96:f0:5f:82:
- a2:b2:d8:fc:b3:46:b5:30:24:b3:a8:77:60:6c:05:
- c9:8f:82:fd:ad:9f:26:23:29:56:5b:02:6f:f2:00:
- 31:86:60:b7:8c:56:b3:95:a8:8d:a9:bb:6b:91:fd:
- 5d:f5:6a:21:45:85:63:78:0e:0f:0e:03:6d:53:73:
- 0d:6c:aa:5b:f9:fc:fa:fd:f7
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Subject Key Identifier:
- C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8
- X509v3 Authority Key Identifier:
- keyid:C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8
- DirName:/C=BG/ST=Plovdiv/O=Oracle/OU=MySQL/CN=MySQL CRL test CA certificate
- serial:A5:85:EC:60:B1:68:44:22
-
- X509v3 Basic Constraints:
- CA:TRUE
- Signature Algorithm: sha1WithRSAEncryption
- 73:dd:2e:76:71:25:c2:fe:7a:c5:46:ca:f2:c7:a0:43:f0:c7:
- 3c:24:8d:a6:bd:8d:f2:7c:db:03:1b:2b:8a:c8:23:ae:ef:71:
- 25:33:5b:10:61:e7:7d:89:30:a8:67:25:2e:e0:06:30:77:da:
- b8:87:e5:91:cd:c7:8f:c9:7b:3d:9e:86:80:44:02:6b:d1:06:
- 85:5d:28:78:cc:a7:a8:35:ac:f7:77:6d:e2:c7:a3:37:bc:9f:
- d3:bf:4a:ca:09:dc:d0:78:0c:59:c7:db:4b:67:f1:09:6d:a9:
- 7a:50:2f:1d:2c:a6:b8:81:0e:e6:4b:ee:d9:be:ae:a5:6a:d7:
- 56:c4
------BEGIN CERTIFICATE-----
-MIIDHDCCAoWgAwIBAgIJAKWF7GCxaEQiMA0GCSqGSIb3DQEBBQUAMGgxCzAJBgNV
-BAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNV
-BAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0
-ZTAeFw0xMTA2MTcwNzI3NTFaFw0xNjA2MTUwNzI3NTFaMGgxCzAJBgNVBAYTAkJH
-MRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNVBAsTBU15
-U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0ZTCBnzAN
-BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAmwgLlhlX+yF59BbJuCwTLuH+X2sYfdTE
-181mpmIOtyixOXZiblpKgPYOjoQ+zy+RDTZti7X5eJbwX4Kistj8s0a1MCSzqHdg
-bAXJj4L9rZ8mIylWWwJv8gAxhmC3jFazlaiNqbtrkf1d9WohRYVjeA4PDgNtU3MN
-bKpb+fz6/fcCAwEAAaOBzTCByjAdBgNVHQ4EFgQUxB0saD9fKVHsxVRhzhYT0nJd
-Y+gwgZoGA1UdIwSBkjCBj4AUxB0saD9fKVHsxVRhzhYT0nJdY+ihbKRqMGgxCzAJ
-BgNVBAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAM
-BgNVBAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZp
-Y2F0ZYIJAKWF7GCxaEQiMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEA
-c90udnElwv56xUbK8segQ/DHPCSNpr2N8nzbAxsrisgjru9xJTNbEGHnfYkwqGcl
-LuAGMHfauIflkc3Hj8l7PZ6GgEQCa9EGhV0oeMynqDWs93dt4sejN7yf079Kygnc
-0HgMWcfbS2fxCW2pelAvHSymuIEO5kvu2b6upWrXVsQ=
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/crl-client-cert.pem b/mysql-test/std_data/crl-client-cert.pem
deleted file mode 100644
index 260e8bf4647..00000000000
--- a/mysql-test/std_data/crl-client-cert.pem
+++ /dev/null
@@ -1,62 +0,0 @@
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number:
- a5:85:ec:60:b1:68:44:24
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate
- Validity
- Not Before: Jun 17 07:32:32 2011 GMT
- Not After : Jun 16 07:32:32 2014 GMT
- Subject: C=BG, ST=Plovdiv, L=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test client certificate
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:bd:18:bf:c5:37:7e:f7:8a:1d:22:c0:4f:5a:70:
- 51:ea:df:56:4f:29:e9:c7:a5:8a:ab:5a:48:b5:f9:
- bf:cd:2a:73:f8:fa:13:20:fd:33:17:11:93:51:f0:
- 4f:fa:a5:6a:bc:37:94:92:de:7d:c1:09:c6:43:c0:
- f7:cd:dd:ac:06:bf:fe:0c:9f:fc:ec:5b:83:a1:1e:
- 34:d8:af:50:17:4d:84:51:20:44:76:81:d1:12:76:
- 06:fb:05:29:59:47:0f:9d:97:f1:41:2f:92:0d:e4:
- b6:c1:fb:cf:75:95:a9:0f:cf:b3:4f:69:a3:d1:14:
- e9:6b:cf:be:53:bd:4e:3f:5d
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints:
- CA:FALSE
- Netscape Comment:
- OpenSSL Generated Certificate
- X509v3 Subject Key Identifier:
- 39:37:9C:0B:9F:E4:8E:48:48:71:23:2B:CA:F0:C1:F9:0B:F2:0A:D0
- X509v3 Authority Key Identifier:
- keyid:C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8
-
- Signature Algorithm: sha1WithRSAEncryption
- 18:03:42:13:af:86:c3:eb:9c:40:4a:d8:9e:e7:25:e1:43:7b:
- 2f:55:1b:e6:ec:bf:9b:56:b3:c7:cb:78:cd:d2:00:46:39:96:
- d8:f8:cd:9d:0e:e7:97:51:93:f8:5b:ed:4f:5a:16:6b:56:fb:
- c0:d1:58:3c:7f:e9:64:aa:11:03:ff:3b:5e:9d:6d:c8:53:a8:
- 4a:30:f7:a6:ae:7c:e0:ed:16:c4:a0:07:9c:75:1a:23:58:13:
- 70:9e:aa:cc:b8:1d:70:26:85:ad:e1:f3:34:83:1b:e0:72:44:
- c4:28:d5:c5:6a:43:83:47:fe:8b:ab:ac:07:55:ff:2c:d9:0f:
- 5f:c7
------BEGIN CERTIFICATE-----
-MIIC3zCCAkigAwIBAgIJAKWF7GCxaEQkMA0GCSqGSIb3DQEBBQUAMGgxCzAJBgNV
-BAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNV
-BAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0
-ZTAeFw0xMTA2MTcwNzMyMzJaFw0xNDA2MTYwNzMyMzJaMH4xCzAJBgNVBAYTAkJH
-MRAwDgYDVQQIEwdQbG92ZGl2MRAwDgYDVQQHEwdQbG92ZGl2MQ8wDQYDVQQKEwZP
-cmFjbGUxDjAMBgNVBAsTBU15U1FMMSowKAYDVQQDEyFNeVNRTCBDUkwgdGVzdCBj
-bGllbnQgY2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL0Y
-v8U3fveKHSLAT1pwUerfVk8p6celiqtaSLX5v80qc/j6EyD9MxcRk1HwT/qlarw3
-lJLefcEJxkPA983drAa//gyf/Oxbg6EeNNivUBdNhFEgRHaB0RJ2BvsFKVlHD52X
-8UEvkg3ktsH7z3WVqQ/Ps09po9EU6WvPvlO9Tj9dAgMBAAGjezB5MAkGA1UdEwQC
-MAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRl
-MB0GA1UdDgQWBBQ5N5wLn+SOSEhxIyvK8MH5C/IK0DAfBgNVHSMEGDAWgBTEHSxo
-P18pUezFVGHOFhPScl1j6DANBgkqhkiG9w0BAQUFAAOBgQAYA0ITr4bD65xAStie
-5yXhQ3svVRvm7L+bVrPHy3jN0gBGOZbY+M2dDueXUZP4W+1PWhZrVvvA0Vg8f+lk
-qhED/ztenW3IU6hKMPemrnzg7RbEoAecdRojWBNwnqrMuB1wJoWt4fM0gxvgckTE
-KNXFakODR/6Lq6wHVf8s2Q9fxw==
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/crl-client-key.pem b/mysql-test/std_data/crl-client-key.pem
deleted file mode 100644
index dea4a9cea56..00000000000
--- a/mysql-test/std_data/crl-client-key.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQC9GL/FN373ih0iwE9acFHq31ZPKenHpYqrWki1+b/NKnP4+hMg
-/TMXEZNR8E/6pWq8N5SS3n3BCcZDwPfN3awGv/4Mn/zsW4OhHjTYr1AXTYRRIER2
-gdESdgb7BSlZRw+dl/FBL5IN5LbB+891lakPz7NPaaPRFOlrz75TvU4/XQIDAQAB
-AoGAYMe37rIWk47mlpCijIEMDA++Vsn20q2RKV4N9MUcO19M99LV036DlXzzT26V
-II1k8Wvo6Lpi1lewV6D9symPDwuxO3L/lSwInVSbAaCkRYq7BlpL+ShxsUpWT788
-ealwFTj3TeM1MCHpFwvO0xGBqFVk+ZadCNZjvwdQi44JCykCQQDqJgOTPPniq5Lk
-J6d+KWiCPVAEnEWk5lR0jQ2NZhSm4fFmCd0v6bNYhztk7dizSOiIrXnPLXx9Z8v0
-rwKr5WrHAkEAzr5ps9d/t4V60vAJCK+Sq1b+Qj42yEnH2eIjKAUFO63jkPtpOv9h
-nzYJTqajvEkHbYJ92elpzGx47FuSOjzAuwJAYpZC5xnDdSccoCf6I+q3cC70pBxQ
-TpAUe0ZwsFqM039KrtX0ZZoWw22dGm/yz/ogvnucUBks03iCrbGKhGoCPQJAdlhj
-U5I5Rsl+vH6w/Srbz37Vvv+0BkTNxPiA3Wi6TSZGDPkNjLshm6yn+UDEm4RGXzaC
-ahoF+QHi2pG0i+e4/wJBAOmbrYbjE2LAzIBy0NvRHslPABTK4zn1L9lzU5XIjV9r
-y8JiMfGNC5r7To/ERlFUlMbaPA5Zm9XNrZhDROMZLTc=
------END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/crl-client-revoked.crl b/mysql-test/std_data/crl-client-revoked.crl
deleted file mode 100644
index 80c4b1254d4..00000000000
--- a/mysql-test/std_data/crl-client-revoked.crl
+++ /dev/null
@@ -1,10 +0,0 @@
------BEGIN X509 CRL-----
-MIIBbDCB1gIBATANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJCRzEQMA4GA1UE
-CBMHUGxvdmRpdjEPMA0GA1UEChMGT3JhY2xlMQ4wDAYDVQQLEwVNeVNRTDEmMCQG
-A1UEAxMdTXlTUUwgQ1JMIHRlc3QgQ0EgY2VydGlmaWNhdGUXDTExMDgxOTEwMDQ1
-MFoXDTE3MDIwODEwMDQ1MFowKjAoAgkApYXsYLFoRCQXDTExMDYxNzA3Mzc1OVow
-DDAKBgNVHRUEAwoBBaAOMAwwCgYDVR0UBAMCAQMwDQYJKoZIhvcNAQEFBQADgYEA
-BXAwYBjHUHG6MQ22/+1hvOaRtSYfj/E5bhKbBB8JlKSRFO+xIOF2i2H1AigunWpC
-R10NicSS7qjsr6yDyBaywZmi0TCNGksR7b3m1m97RnhrxkVRlr/i7L+o04ZwWo/b
-z9zoTX6RTj8rHgQtEdIOi/EArCvDv+wqYmkI+XMScGI=
------END X509 CRL-----
diff --git a/mysql-test/std_data/crl-server-cert.pem b/mysql-test/std_data/crl-server-cert.pem
deleted file mode 100644
index 312bce0e0b6..00000000000
--- a/mysql-test/std_data/crl-server-cert.pem
+++ /dev/null
@@ -1,62 +0,0 @@
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number:
- a5:85:ec:60:b1:68:44:23
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate
- Validity
- Not Before: Jun 17 07:29:11 2011 GMT
- Not After : Jun 16 07:29:11 2014 GMT
- Subject: C=BG, ST=Plovdiv, L=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test server certificate
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:c4:c6:01:29:db:e6:62:40:07:bd:43:ce:37:8e:
- 90:0e:3c:86:cc:6a:0c:40:8e:8e:30:27:f2:84:d3:
- 59:e8:7d:e7:97:1e:0d:36:08:0b:cc:28:bb:86:b0:
- 0a:64:8c:55:33:f6:ce:19:00:08:b9:93:ca:84:7e:
- 9a:4e:81:91:e2:56:32:2a:de:b5:1f:82:b9:8f:33:
- f4:87:f8:10:84:69:69:9a:79:58:08:9a:29:dc:09:
- 79:27:90:ec:af:c8:2d:5f:2e:c1:e1:4a:f1:52:21:
- 37:58:d4:f9:ef:49:ce:a9:9d:eb:dc:f4:34:30:40:
- d0:d7:38:54:94:2e:d1:ac:25
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints:
- CA:FALSE
- Netscape Comment:
- OpenSSL Generated Certificate
- X509v3 Subject Key Identifier:
- 4A:18:8F:0C:A3:CF:D7:4A:38:83:07:FC:26:E3:EB:96:32:73:FA:8C
- X509v3 Authority Key Identifier:
- keyid:C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8
-
- Signature Algorithm: sha1WithRSAEncryption
- 61:74:cc:62:70:9e:1f:3e:96:ac:cd:54:4f:34:60:1c:27:51:
- f4:d5:f8:2e:d7:18:11:86:4e:b5:52:8c:a1:ef:28:c9:43:d7:
- 23:2a:22:15:4a:a3:e7:ff:76:fa:25:be:ed:30:05:ea:12:aa:
- 3f:c8:ab:a7:22:02:ea:cf:50:d4:43:31:5f:51:de:4c:e1:fa:
- 31:ba:2e:4e:d8:a4:3d:80:ad:17:83:67:0f:1b:6f:0b:74:43:
- ce:36:cb:2f:17:9e:6e:ae:c6:eb:ec:93:70:69:82:42:04:b3:
- a7:31:1f:65:70:ff:06:ce:9c:22:8a:dc:7d:92:bc:04:24:ca:
- 20:66
------BEGIN CERTIFICATE-----
-MIIC3zCCAkigAwIBAgIJAKWF7GCxaEQjMA0GCSqGSIb3DQEBBQUAMGgxCzAJBgNV
-BAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNV
-BAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0
-ZTAeFw0xMTA2MTcwNzI5MTFaFw0xNDA2MTYwNzI5MTFaMH4xCzAJBgNVBAYTAkJH
-MRAwDgYDVQQIEwdQbG92ZGl2MRAwDgYDVQQHEwdQbG92ZGl2MQ8wDQYDVQQKEwZP
-cmFjbGUxDjAMBgNVBAsTBU15U1FMMSowKAYDVQQDEyFNeVNRTCBDUkwgdGVzdCBz
-ZXJ2ZXIgY2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMTG
-ASnb5mJAB71DzjeOkA48hsxqDECOjjAn8oTTWeh955ceDTYIC8wou4awCmSMVTP2
-zhkACLmTyoR+mk6BkeJWMiretR+CuY8z9If4EIRpaZp5WAiaKdwJeSeQ7K/ILV8u
-weFK8VIhN1jU+e9Jzqmd69z0NDBA0Nc4VJQu0awlAgMBAAGjezB5MAkGA1UdEwQC
-MAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRl
-MB0GA1UdDgQWBBRKGI8Mo8/XSjiDB/wm4+uWMnP6jDAfBgNVHSMEGDAWgBTEHSxo
-P18pUezFVGHOFhPScl1j6DANBgkqhkiG9w0BAQUFAAOBgQBhdMxicJ4fPpaszVRP
-NGAcJ1H01fgu1xgRhk61Uoyh7yjJQ9cjKiIVSqPn/3b6Jb7tMAXqEqo/yKunIgLq
-z1DUQzFfUd5M4foxui5O2KQ9gK0Xg2cPG28LdEPONssvF55ursbr7JNwaYJCBLOn
-MR9lcP8Gzpwiitx9krwEJMogZg==
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/crl-server-key.pem b/mysql-test/std_data/crl-server-key.pem
deleted file mode 100644
index fa8a61695c1..00000000000
--- a/mysql-test/std_data/crl-server-key.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDExgEp2+ZiQAe9Q843jpAOPIbMagxAjo4wJ/KE01nofeeXHg02
-CAvMKLuGsApkjFUz9s4ZAAi5k8qEfppOgZHiVjIq3rUfgrmPM/SH+BCEaWmaeVgI
-mincCXknkOyvyC1fLsHhSvFSITdY1PnvSc6pnevc9DQwQNDXOFSULtGsJQIDAQAB
-AoGAfecnZW4jWegYS5xv/RJF0CYgJfkQv9m21s8omJ5W37B3lzSORW0eh1Hkswg+
-jhlQhwA63Lot2vfaU65h8ytqeGSxUSj0X8bVCsG+7aoQOxeowZs+CLgWPHmXbXw8
-BI9mFbfkIQ/1x5yMSTv0BNRGUtg+t5FGPsmWxSUtfTme4CECQQDxQGEoesrJ25uE
-MUcrTSeVpNmzqA8e41+8YIzbyi8nmwzp5gbsgIIF6/P5iMo1T7nIal/8N+FQMft4
-Ebzb0ZFNAkEA0M2JmH/ctyDQ7RbQx5lVwiHYn9a3inusvsV47kfH24kdRZYSymI8
-of7O8SGkHFJNeYsJmM3UrsNDlbSd+sCaOQJBAKoM+i8hVp2weU9VuNex28wkVfvH
-41ifZtUOrVsjidd9+D1KkejUsFHiPqfOntGzL74wFRZggSYZBStePWQotSUCQH29
-aMDnLtkw79/2v1+TnSs9CqCmwvyoIYz4iiykGVzBI1mGWGZ75ht/wMtBAPz1Kyao
-be0Q9qUPfaGnlQMt/TECQGrMh32zFPFR98yNS6JDVAVib+d5SaJsV5HXXqKCYxQR
-u1sv7YeF4/Y+TPKpBSasDNZHQ3zex0M9YOgI+9eEBHk=
------END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/crldir/ed1f42db.r0 b/mysql-test/std_data/crldir/ed1f42db.r0
new file mode 100644
index 00000000000..1f737bf790b
--- /dev/null
+++ b/mysql-test/std_data/crldir/ed1f42db.r0
@@ -0,0 +1,12 @@
+-----BEGIN X509 CRL-----
+MIIBxTCBrgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNlcnQxCzAJ
+BgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kx
+EDAOBgNVBAoMB01hcmlhREIXDTE5MDEyNzEwMTExNVoXDTM5MDEyMjEwMTExNVow
+FDASAgEFFw0xOTAxMjcxMDExMTVaoA4wDDAKBgNVHRQEAwIBAjANBgkqhkiG9w0B
+AQsFAAOCAQEAI0yg8tW6n8m/3g4FO5fjrtwEB1HYnJVLbKT2fOSKs7WN/t6M4ZWo
+hSolEpNozd0yP+20srCMzsg7PuiYV/jMJn0bCw+Q6G7IP2GBlBURRErJ6UNZ+Upe
+Gc+o5tWvb7ROwMj76UBzK5tDsmDapk5102k0sfaIbD51OmA+RxnxbKsGNvAVp9EH
+yN+irF6vfVmbP1WPzGZa6x2s70kiC3peQlnZFOUnhycwVdiRprcUd+ZfMLJ3Ov2b
+oa9P+ntTW/0ijg0QYH6gSQVOl9ZiVhnRR/eO6SrkrevgtAM3pXl4aDdvFyoIXXkh
+mCkYfW7LkH/+OYWyZ1W99cnISM2F+yC1yQ==
+-----END X509 CRL-----
diff --git a/mysql-test/std_data/crldir/fc725416.r0 b/mysql-test/std_data/crldir/fc725416.r0
deleted file mode 100644
index 80c4b1254d4..00000000000
--- a/mysql-test/std_data/crldir/fc725416.r0
+++ /dev/null
@@ -1,10 +0,0 @@
------BEGIN X509 CRL-----
-MIIBbDCB1gIBATANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJCRzEQMA4GA1UE
-CBMHUGxvdmRpdjEPMA0GA1UEChMGT3JhY2xlMQ4wDAYDVQQLEwVNeVNRTDEmMCQG
-A1UEAxMdTXlTUUwgQ1JMIHRlc3QgQ0EgY2VydGlmaWNhdGUXDTExMDgxOTEwMDQ1
-MFoXDTE3MDIwODEwMDQ1MFowKjAoAgkApYXsYLFoRCQXDTExMDYxNzA3Mzc1OVow
-DDAKBgNVHRUEAwoBBaAOMAwwCgYDVR0UBAMCAQMwDQYJKoZIhvcNAQEFBQADgYEA
-BXAwYBjHUHG6MQ22/+1hvOaRtSYfj/E5bhKbBB8JlKSRFO+xIOF2i2H1AigunWpC
-R10NicSS7qjsr6yDyBaywZmi0TCNGksR7b3m1m97RnhrxkVRlr/i7L+o04ZwWo/b
-z9zoTX6RTj8rHgQtEdIOi/EArCvDv+wqYmkI+XMScGI=
------END X509 CRL-----
diff --git a/mysql-test/std_data/galera-cert.pem b/mysql-test/std_data/galera-cert.pem
deleted file mode 100644
index 2996b330cc0..00000000000
--- a/mysql-test/std_data/galera-cert.pem
+++ /dev/null
@@ -1,26 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDWTCCAkGgAwIBAgIJAIlW4JmZGnU4MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV
-BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg
-Q29tcGFueSBMdGQwIBcNMTQxMDI0MDc1MTU1WhgPMzAxNDAyMjQwNzUxNTVaMEIx
-CzAJBgNVBAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl
-ZmF1bHQgQ29tcGFueSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
-AQDDzU6xLZDD5rZENsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2Qa
-MyTkvyjzf7bSFsDt9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BW
-B3lcoKXXJgMnWw0WGrt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5
-kdcIbDRVw81J4eAZ6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrM
-mhOeL8kuQV0fI8v2xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWX
-Qo98swTu7mb89qVYmR71d3L3AgMBAAGjUDBOMB0GA1UdDgQWBBRdWet/kGNTyvXK
-wuBdP/eSldOgWjAfBgNVHSMEGDAWgBRdWet/kGNTyvXKwuBdP/eSldOgWjAMBgNV
-HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCcJpP+DR4AJxVelNTSZa+V38c+
-jgrMD2Ku2eU8NQlsjgMfNEU5Md/g7FpP8aCFzVf0kAAT7DxZmSE3uWXQbMXyVJmy
-bF+qXinf71QzdWULm6sASoshC6wbHnXL9ZjWQ3gh1nqVgo3MmLQYrb3eJfKaaLoc
-wpjhYxVxGFOx1ITN3jED64lUfoLHvR6NFbESYKAuAAzSNqX4HOQ3uGk2THM8JocZ
-oH2+38d81Kd4HQ7DDDKS/isG0+rR60Ti1cMgu7OT7p1dZCwT/KQuI5eGjE9lubkc
-yAJjaod4rVLdBri3XVvtySfS2+/75qUgv2TF7d/s7mxMq4DDt29yeKSUhZCs
------END CERTIFICATE-----
------BEGIN DH PARAMETERS-----
-MIGHAoGBAJWyvKjE+s7OP4Lj1jXKGlJGWT4Vd5YaxPljihTsRe1aXkWAgsuwISXk
-/TQ8Rx5Zmze7rtwtU0PoYxvuam9FMXYqhw2dVe4qRdeSX78DSiL/YBkQzaxlfWVy
-RE9+9dzHbCtRVDlN7K1kA+mGWH4/r7NAu4Qm/003V0NTtMwQSqebAgEC
------END DH PARAMETERS-----
-
diff --git a/mysql-test/std_data/galera-key.pem b/mysql-test/std_data/galera-key.pem
deleted file mode 100644
index c88c613cacf..00000000000
--- a/mysql-test/std_data/galera-key.pem
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PRIVATE KEY-----
-MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDDzU6xLZDD5rZE
-NsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2QaMyTkvyjzf7bSFsDt
-9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BWB3lcoKXXJgMnWw0W
-Grt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5kdcIbDRVw81J4eAZ
-6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrMmhOeL8kuQV0fI8v2
-xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWXQo98swTu7mb89qVY
-mR71d3L3AgMBAAECggEBAIMT0UdZSp1quL/nrYqNGa9kuSuDz4uCM3+3jNcGZVU4
-vCYHxpmINLi0UK8W5ROJA3zC4AZKjDgOlW93NXK5iKyyiUTIN3hiJi4jiVDuGbh2
-DZtH7mmAKAU1zCx2y2osLLmurfbe8qOJF7ShhrZfgWsHFujFhhUdU92dsTkhZ7EU
-2NF8ScxCo4PbOJoHC3j0ApfwCMxUMAKZF5+08EeKYqK7OAXI79HeIvEbHn3cUDGm
-bvg6ykwlz2UUO4sg+xdCmn1Bt36HF/4e973Y5fkE/vd9mryHIlu9t7GJgWyUiPr8
-BGEoAWDSpPOMd/b9ivtxh9Gd+LW/uitMuBIfrRPgz9kCgYEA+JqeeD2xqF2IzZyq
-i1UqgKe3su2U2zhkgbu1h/1M/reNIZGylF0wFs3P+kNIB2NavmHjXcgSjdJzqRL9
-XEWfFJRmeARo9RTEQEVd8zp1Eo8ISeiksGgvbL4rrNIRR5V5MZytfISRiGCWN6jx
-ulJ6EieQk5EcvknGlWpJY/bBsQ0CgYEAyaCLqrR38gVl2Z0t6YlhW/HWAwGt+lf4
-apN1AS4uykx7wRW2B0y9QUDfsrYeVlbbeRPP4UzPmJez+J2cweoIIeFFyo3KP2L7
-79E3EVYywjXhPg52F7OjFA4Bp970XclIC5Al7kDufSgwZmWdceSx4Jjc5ixyQEC8
-Ad0ThgP6yxMCgYAvC4OFmZcvF1Q2JLmZWGqMojB/KbqLqaZLbqwxqduSMEYC3kF/
-FgttpVEAOQ8+ZqzbbkbKjnwEXpkIm9FaTsqF6HdjquH5zw48Y2QeDSfudSbKZb4U
-rAKdf3dgYvhmJYEjxFSIRcYMmsqSieQEsGrtWJNheYqI8AkmaVCuHBoXWQKBgQCj
-daelNffD2wJuQNI28axfiRjSiSsNuQHpDTCfS1ydnxH5QGu5UUphO4HfdWv03SfC
-6f/vDIGEmQBLvyOVxfDf3qzhAMCFUO8kxj1ZrcMq1dmMoNa2cmj0WkKXYNZFrmfd
-D/jgRf3Ss6FBcoIJErnudp8nb8MUOibxb9RjIpjQxwKBgEliKaGN+/QkPTNJ4vXz
-609CIilxpE+YVTzlv3YeZP5HqsJTJPS2ARIUr/Pjpbl3LHfYNeeGDCwgkJIK0JJH
-iA1M51q6t3zG2y9gKmC15FF0jShoZkRgqBxqrSHAnrCo5t2C48ElxJ3FEU8T75sz
-dlGTbkmR0Wm43Kh++dWICJ3g
------END PRIVATE KEY-----
diff --git a/mysql-test/std_data/galera-upgrade-ca-cert.pem b/mysql-test/std_data/galera-upgrade-ca-cert.pem
deleted file mode 100644
index 13d27e84bb3..00000000000
--- a/mysql-test/std_data/galera-upgrade-ca-cert.pem
+++ /dev/null
@@ -1,40 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDWTCCAkGgAwIBAgIJAIlW4JmZGnU4MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV
-BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg
-Q29tcGFueSBMdGQwIBcNMTQxMDI0MDc1MTU1WhgPMzAxNDAyMjQwNzUxNTVaMEIx
-CzAJBgNVBAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl
-ZmF1bHQgQ29tcGFueSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
-AQDDzU6xLZDD5rZENsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2Qa
-MyTkvyjzf7bSFsDt9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BW
-B3lcoKXXJgMnWw0WGrt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5
-kdcIbDRVw81J4eAZ6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrM
-mhOeL8kuQV0fI8v2xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWX
-Qo98swTu7mb89qVYmR71d3L3AgMBAAGjUDBOMB0GA1UdDgQWBBRdWet/kGNTyvXK
-wuBdP/eSldOgWjAfBgNVHSMEGDAWgBRdWet/kGNTyvXKwuBdP/eSldOgWjAMBgNV
-HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCcJpP+DR4AJxVelNTSZa+V38c+
-jgrMD2Ku2eU8NQlsjgMfNEU5Md/g7FpP8aCFzVf0kAAT7DxZmSE3uWXQbMXyVJmy
-bF+qXinf71QzdWULm6sASoshC6wbHnXL9ZjWQ3gh1nqVgo3MmLQYrb3eJfKaaLoc
-wpjhYxVxGFOx1ITN3jED64lUfoLHvR6NFbESYKAuAAzSNqX4HOQ3uGk2THM8JocZ
-oH2+38d81Kd4HQ7DDDKS/isG0+rR60Ti1cMgu7OT7p1dZCwT/KQuI5eGjE9lubkc
-yAJjaod4rVLdBri3XVvtySfS2+/75qUgv2TF7d/s7mxMq4DDt29yeKSUhZCs
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIIDVzCCAj+gAwIBAgIJALBO5bqmtlYkMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV
-BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg
-Q29tcGFueSBMdGQwHhcNMTUwNjI2MDcxMjQ1WhcNMjUwNTA0MDcxMjQ1WjBCMQsw
-CQYDVQQGEwJGSTEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZh
-dWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
-1DlcztIzSngGeTUFibj9GZ4ZO78ASpgYySZv/DRIVn/3hbF41ZRD/6uJlb5rf1R7
-fpFsurbXNDDxeap7b/Gz2XSQy96Dbm0SbsFSZttV/R2WtlT1Wf5n9ix6RLqhKSbg
-nPyL2fsDaxtZh2uywGJEXhwXFtdx3deIo/tYivDfl5Tcsv0NnZY8Vg0boBRP+FEn
-ReJOdSa5LLn+QJN2Xa+wutbLHe0hI6huKUXU2YUeBfgyk1nWol5241ZUDCgDsoaW
-8r2YeJNHmNInd3wERbqFgFHsR4N1+Atcyrfn/uQSj9zrTPO/Pp51KpjWf/gjxjXP
-biu5De50qZ4+U4no20EIOwIDAQABo1AwTjAdBgNVHQ4EFgQU3kSPGchrOoQJ5gq1
-mmV2HEra6GswHwYDVR0jBBgwFoAU3kSPGchrOoQJ5gq1mmV2HEra6GswDAYDVR0T
-BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAfoBD64FJ9fAR19+vwueFGmpWNIqF
-PzN7QmEpCMduV3DXuxYO73q2ikXgrVO5HWFz9IjNvzXbSRmWNzJGaZ3QYZ+Xx1JJ
-8MrAOUr6djWuyD659f64dh/2jMxiQNoEHrknXm9HSqR5oJVwndFyr/zvSkYSRexE
-KFciIprb9LOba9G3ZMBYBdqK+f3Ky16BMjaD6XfaTx+xjHk/8peSueXIQl+v2biz
-zSfpEUa0dKCIxckrzD4JknDHFimTsrzlRftcg8t8piOXwZomFcnVunyGs2bJ/Npj
-25c2e6sx7XSc5bUgPGuQcSGflZPLg9zWyJ69sVYUNAz+gqfvWfOOJuzPNg==
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/galera-upgrade-server-cert.pem b/mysql-test/std_data/galera-upgrade-server-cert.pem
deleted file mode 100644
index 3af8b1ae7dd..00000000000
--- a/mysql-test/std_data/galera-upgrade-server-cert.pem
+++ /dev/null
@@ -1,20 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDVzCCAj+gAwIBAgIJALBO5bqmtlYkMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV
-BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg
-Q29tcGFueSBMdGQwHhcNMTUwNjI2MDcxMjQ1WhcNMjUwNTA0MDcxMjQ1WjBCMQsw
-CQYDVQQGEwJGSTEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZh
-dWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
-1DlcztIzSngGeTUFibj9GZ4ZO78ASpgYySZv/DRIVn/3hbF41ZRD/6uJlb5rf1R7
-fpFsurbXNDDxeap7b/Gz2XSQy96Dbm0SbsFSZttV/R2WtlT1Wf5n9ix6RLqhKSbg
-nPyL2fsDaxtZh2uywGJEXhwXFtdx3deIo/tYivDfl5Tcsv0NnZY8Vg0boBRP+FEn
-ReJOdSa5LLn+QJN2Xa+wutbLHe0hI6huKUXU2YUeBfgyk1nWol5241ZUDCgDsoaW
-8r2YeJNHmNInd3wERbqFgFHsR4N1+Atcyrfn/uQSj9zrTPO/Pp51KpjWf/gjxjXP
-biu5De50qZ4+U4no20EIOwIDAQABo1AwTjAdBgNVHQ4EFgQU3kSPGchrOoQJ5gq1
-mmV2HEra6GswHwYDVR0jBBgwFoAU3kSPGchrOoQJ5gq1mmV2HEra6GswDAYDVR0T
-BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAfoBD64FJ9fAR19+vwueFGmpWNIqF
-PzN7QmEpCMduV3DXuxYO73q2ikXgrVO5HWFz9IjNvzXbSRmWNzJGaZ3QYZ+Xx1JJ
-8MrAOUr6djWuyD659f64dh/2jMxiQNoEHrknXm9HSqR5oJVwndFyr/zvSkYSRexE
-KFciIprb9LOba9G3ZMBYBdqK+f3Ky16BMjaD6XfaTx+xjHk/8peSueXIQl+v2biz
-zSfpEUa0dKCIxckrzD4JknDHFimTsrzlRftcg8t8piOXwZomFcnVunyGs2bJ/Npj
-25c2e6sx7XSc5bUgPGuQcSGflZPLg9zWyJ69sVYUNAz+gqfvWfOOJuzPNg==
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/galera-upgrade-server-key.pem b/mysql-test/std_data/galera-upgrade-server-key.pem
deleted file mode 100644
index d243c9e0381..00000000000
--- a/mysql-test/std_data/galera-upgrade-server-key.pem
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PRIVATE KEY-----
-MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDUOVzO0jNKeAZ5
-NQWJuP0Znhk7vwBKmBjJJm/8NEhWf/eFsXjVlEP/q4mVvmt/VHt+kWy6ttc0MPF5
-qntv8bPZdJDL3oNubRJuwVJm21X9HZa2VPVZ/mf2LHpEuqEpJuCc/IvZ+wNrG1mH
-a7LAYkReHBcW13Hd14ij+1iK8N+XlNyy/Q2dljxWDRugFE/4USdF4k51Jrksuf5A
-k3Zdr7C61ssd7SEjqG4pRdTZhR4F+DKTWdaiXnbjVlQMKAOyhpbyvZh4k0eY0id3
-fARFuoWAUexHg3X4C1zKt+f+5BKP3OtM878+nnUqmNZ/+CPGNc9uK7kN7nSpnj5T
-iejbQQg7AgMBAAECggEBAJ4m7VG3db+uOGzFJY5fzEX1+qn6ibYNKJNmUJfrQmkr
-zgLUoc7QQehbJhnwoN1v0OQebZ+rOC7NtnZLpNdkkPmhk3JKLTnykIT3DnhWRftt
-vG2+XGUnYMQkmy1ywz0Omt6CmZnlJMQByrNPgBM8Z+SWHGLKRTHkOBCz82T/YjDr
-wqug1Yv6W0wMNM/cikgoBldVG7hABCJuShjffIbUgVysK3dEPNywNAC78neoGECm
-evPZOaIkWEr86SpAlwA6Yh+zTQZ03CXATcGonJdWJ015DvlKRv6QyRR0Q/Y1ONwb
-f115kll15MJBEspFdSyhlMcVJlwO8WMaZ2qIzlQZmdECgYEA//P469QzX00L/urK
-7IRvtSVu5CP/A/Wui90U4KoP7XgXIeExnEtzLVs1K7vjuzdpTyq+68XuC40gPcJW
-RvoX229m6gRV8nC53UiV71jM8IvkyEqFYT/gfZC9KQCMSRJLtVnDMpZ3gMxAY6/5
-p20o616Au8DKFFetQV0aD4Hj1/MCgYEA1ENV1WkgvN6yItB77E9kN/vbKLRh0hrg
-9xj0SmMXGYyDM9NpjbgbgJIZo3ukkBtp3kEY8P9JQZRcd1EcnnSrwTB7ChdInWkR
-m/LpIZBEMqNQbeu4QSzZYYS6z4tcGGx43aHqzzNBZdnQnqhYL1CvlLwhkgX6oQCo
-woXqyfMNKJkCgYEA63gD1NGPwWkcVBSlQxpDup8JeZE0Fux6++kUP+u0Y39LqLuH
-7IXtHBkAvY9JXv8HPvHQWw/og2/97VNQFFQYhqPiRgBfIX9bPpx8c4l6YQISI8GL
-G4CsglgZ7hK2/LJ8PAascWnD3xYJVqyaPNFMB90VCaW/Qx+2IKAKTaHtfskCgYBu
-1f5C4pMqrCpeTXj4Cvis1wE4PwB5QnnH7SrakOVl/N4huLn8O2948lEa8Zwbd4UP
-ffR1Gwh4iuzBjQQhpZBt30/QFBphv5RnVy7uzLMfsfF0hEqBFdcoubMGXqGnSzTN
-nhfLO9thQJxTzFnH0xzr0FTDOAYH/h0g/eZ8r0JmuQKBgQDjhXM+hJ3Pkwua+Fnl
-nZfY5MeSzkJki/9iwVo8rSDwmZS9Nsc83oZnddM7c2x63t+zYOAcMxsVCiByMDzo
-5IB781HWRBGcU8TnW1b0bAnZimjKp/qsZ/Szr38rvImqG8TjzbcSD7w0SpyRQ/Ot
-A7SZFkWYfem8/q/VImjU/CNbOQ==
------END PRIVATE KEY-----
diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYD b/mysql-test/std_data/mdev17909#P#p20181029.MYD
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mysql-test/std_data/mdev17909#P#p20181029.MYD
diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYI b/mysql-test/std_data/mdev17909#P#p20181029.MYI
new file mode 100644
index 00000000000..dcdd088b4dc
--- /dev/null
+++ b/mysql-test/std_data/mdev17909#P#p20181029.MYI
Binary files differ
diff --git a/mysql-test/std_data/mdev17909#P#p20181128.MYD b/mysql-test/std_data/mdev17909#P#p20181128.MYD
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mysql-test/std_data/mdev17909#P#p20181128.MYD
diff --git a/mysql-test/std_data/mdev17909#P#p20181128.MYI b/mysql-test/std_data/mdev17909#P#p20181128.MYI
new file mode 100644
index 00000000000..dcdd088b4dc
--- /dev/null
+++ b/mysql-test/std_data/mdev17909#P#p20181128.MYI
Binary files differ
diff --git a/mysql-test/std_data/mdev17909.frm b/mysql-test/std_data/mdev17909.frm
new file mode 100644
index 00000000000..575ecd2c70f
--- /dev/null
+++ b/mysql-test/std_data/mdev17909.frm
Binary files differ
diff --git a/mysql-test/std_data/mdev17909.par b/mysql-test/std_data/mdev17909.par
new file mode 100644
index 00000000000..d9141dd0dee
--- /dev/null
+++ b/mysql-test/std_data/mdev17909.par
Binary files differ
diff --git a/mysql-test/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001 b/mysql-test/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001
new file mode 100644
index 00000000000..5010e164e43
--- /dev/null
+++ b/mysql-test/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001
Binary files differ
diff --git a/mysql-test/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001 b/mysql-test/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001
new file mode 100644
index 00000000000..4d582fdf5bb
--- /dev/null
+++ b/mysql-test/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001
Binary files differ
diff --git a/mysql-test/std_data/server-cert-verify-fail.pem b/mysql-test/std_data/server-cert-verify-fail.pem
deleted file mode 100644
index 4203425a344..00000000000
--- a/mysql-test/std_data/server-cert-verify-fail.pem
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDJzCCAg8CAQEwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCSU4xETAPBgNV
-BAgMCEthcm5hdGthMRIwEAYDVQQHDAlCYW5nYWxvcmUxDjAMBgNVBAoMBU15U1FM
-MB4XDTE2MDEwNTEwMDgyN1oXDTI1MTExMzEwMDgyN1owbzELMAkGA1UEBhMCSU4x
-EjAQBgNVBAgMCTpLYXJuYXRrYTETMBEGA1UEBwwKOkJhbmdhbG9yZTEPMA0GA1UE
-CgwGOk15U1FMMRcwFQYDVQQLDA4vQ049bG9jYWxob3N0LzENMAsGA1UEAwwEZmFp
-bDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3wnWuJodzZYq9TAJRm
-HU7995FA3TEWdUinYTgGP79aTVQ4M9aeINlB6whWXOI8seh9Ja7C6kMzqOgYbgCl
-WlDPAVJWktFYeWXOLxbpzh1KWkS6jBkWT02t7H7JcYbil7xjlJUxLz4UOOUDUDIP
-6yqdA9VE3osESttjzj57Zm2xPqzbIHVJfORn7EexH4pryS7439p6i4XtfL31NJ8V
-07M3j3a8GqbcEqXYvcUCrLnywDQ1igP817b6ta52nbgYWiqdn0mJs535UJ/p/rSl
-D4Ae/6G3BSEY7whir6xY6vsd4KJ6w+wRCHnY0ky6OdDJVJLH1iqh7si7P3RBGkxw
-Y7MCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAggbw1jj2b7H5KDdeGJGIoOGkQAcs
-GNSJussCfdk7qnzYXKmjyNppC86jjaOrXona5f+SNCuujdu86Tv8V69EH57k4lUc
-DW7J4AD3vUb/tBzB0tsI/76Z4gm1XoCsnCGGpWd8GQAg/QNn/ZfJB2Vb/9ObN6rH
-0HV7ouB6OGZSsb71+grKiN6mDyB1lZynCGvqBxOCKFISfcRbCNFHo/pONlHaNGPE
-vjDH1bPZbEHj8owYgkdcQe0a8EbJYeQfm6fH8V8bmUcG7N60DrCnq4l1qwwVkh1S
-7RpIDgrWkU+esIIdYZIIbtDxQP1Sm7kUh++7b+bcHnyw3KtDVSCw7MIedA==
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/server-cert-verify-pass.pem b/mysql-test/std_data/server-cert-verify-pass.pem
deleted file mode 100644
index f8780f1f94e..00000000000
--- a/mysql-test/std_data/server-cert-verify-pass.pem
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDEzCCAfsCAQEwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCSU4xETAPBgNV
-BAgMCEthcm5hdGthMRIwEAYDVQQHDAlCYW5nYWxvcmUxDjAMBgNVBAoMBU15U1FM
-MB4XDTE2MDEwNTEwMDU1OVoXDTI1MTExMzEwMDU1OVowWzELMAkGA1UEBhMCSU4x
-EjAQBgNVBAgMCTpLYXJuYXRrYTETMBEGA1UEBwwKOkJhbmdhbG9yZTEPMA0GA1UE
-CgwGOk15U1FMMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUA
-A4IBDwAwggEKAoIBAQDAmkbUwDe+nrqL8A8uwlIZk74HHCDjUAWrskKF9leEIQsB
-5exFZ8JEo1u6mdR4laQWsxizGdTPqIEidkDyyEMh4+joHgyQEPD/G3rFVW8yEFHb
-42O04O96BEPFXNPDRuX3MxI+lGbYDjxTS/WhVub4/3SqLjC28FJmEUXIHA0/A+c5
-hlYXK0u+aPAqXxHIjBgB4BxxHXZKqecmvR3LhXoVmhJmndsVfKajB27nDKc8/OTI
-H2SXb6h3nRPDXRfwB/C5i+004tEsVeIgkYshcCgLSyDdeVieUP2pm3EAmDSjmtLF
-6CgY/EBSfH+JCKFUk75bA4k8CCGzBfIeOcsKHwgFAgMBAAEwDQYJKoZIhvcNAQEL
-BQADggEBAInDuHtDkeT6dkWmRJCP56c4xiQqib2QuYUuMSrAhf07xlLHc6iHnD2X
-hCWCrja6uwF90DnPjeouKMAUe5txq/uKA8/Y/NfXN6nPiAeHLI0qnTv7Mr9TQ8zU
-DNDwRz6onlI2cS4GhrwAnlpiaxu7AjMUWHtfBFGFrgn3PawjDQpsBZNcxw1QsLc0
-E0hFrWLOd0vDETEhoRge88N7a0jqK0Rd9cvRWnvjI+IsjQMLZzKufivIHPzI9K+9
-Wtp8iRHcaBr5DpsBjgsO7dqVRbsNyaWsdHdLt+CQSGXpv7P6fq3K6nJFTBeIgSfS
-gflrHVKYZRkKDDDpX4yHNdnIqrvy4RU=
------END CERTIFICATE-----
diff --git a/mysql-test/std_data/server-cert.crl b/mysql-test/std_data/server-cert.crl
new file mode 100644
index 00000000000..c841c893c57
--- /dev/null
+++ b/mysql-test/std_data/server-cert.crl
@@ -0,0 +1,12 @@
+-----BEGIN X509 CRL-----
+MIIBxTCBrgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNlcnQxCzAJ
+BgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kx
+EDAOBgNVBAoMB01hcmlhREIXDTE5MDEyNzEwMTExNVoXDTM5MDEyMjEwMTExNVow
+FDASAgEBFw0xOTAxMjcxMDExMTVaoA4wDDAKBgNVHRQEAwIBATANBgkqhkiG9w0B
+AQsFAAOCAQEAERRidERQcCHOE3ltJeftBHhZL4xi/NuOH0KlYK6I00Resrwz4UUm
+cvBzNBb7LqLw24tRvhAGXrSxDEKVsUc+54VBRfPrHbUR15/9eseCA7lIKRS0ub8q
+0fvtwinxyr4Y9hcP9ew9bUZxf99yegc6rNC7/8xZCnIOdvQQ5BpelPGmZ71tnBeg
+6UkW6IG0/BG1MlxRJenAlILtxwu+Q6lgRvVrAtSQJJxTCzCof6oM7vTDvlTHH1LL
+F11xIXP9rjNGw0qBJmxLT4J8tB++eV5u7MpSlbwQNga44zyyvBqdRuSyhFufXPBi
+hqUmVskfdZs9HYrqIWz9ipkFiMNXEzGNxA==
+-----END X509 CRL-----
diff --git a/mysql-test/std_data/server-cert.pem b/mysql-test/std_data/server-cert.pem
index b874f129ce3..068d7200c3e 100644
--- a/mysql-test/std_data/server-cert.pem
+++ b/mysql-test/std_data/server-cert.pem
@@ -5,22 +5,31 @@ Certificate:
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Apr 25 20:52:21 2017 GMT
- Not After : Apr 20 20:52:21 2037 GMT
+ Not Before: Jan 27 10:11:10 2019 GMT
+ Not After : Jan 22 10:11:10 2039 GMT
Subject: C=FI, ST=state or province within country, in other certificates in this file it is the same as L, L=location, usually an address but often ambiguously used, O=organization name, typically a company name, OU=organizational unit name, a division name within an organization, CN=localhost
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (1024 bit)
+ Public-Key: (2048 bit)
Modulus:
- 00:c9:fe:83:3f:0b:38:89:1d:43:15:93:5c:26:b9:
- 80:65:41:bd:2f:63:66:5e:db:fa:33:20:d9:c7:e1:
- 35:f3:14:3c:c8:b4:f7:09:d8:f5:b5:44:8f:6b:7e:
- a0:a4:3b:45:5f:e6:f4:0f:08:67:f8:5a:4c:49:e4:
- e5:39:31:69:8c:cf:25:78:93:a6:7f:58:e9:90:9c:
- 61:cb:2e:14:b1:57:b2:15:9c:ea:8d:6f:96:20:fe:
- 29:ed:2c:71:b8:4f:1f:e0:05:6c:04:b1:7e:e0:bc:
- 42:8e:bf:95:5e:a9:5e:c9:c9:a4:64:c2:1f:59:94:
- 14:c2:06:44:79:bc:d2:65:2d
+ 00:eb:7c:4f:59:f0:40:37:ed:38:b2:e8:30:69:4e:
+ 95:c9:00:59:d1:60:3b:8a:aa:28:a1:20:40:ee:bf:
+ 1c:f3:b0:a6:40:8e:57:a4:79:81:c9:70:9f:8c:3d:
+ f4:5c:b0:f9:58:55:d9:62:b2:4b:69:e1:1a:73:bf:
+ 03:0e:8b:ca:d3:0d:f2:12:ea:68:1e:b8:f5:ba:29:
+ 02:b0:15:7f:76:52:9a:7d:ee:6d:7e:2c:f5:5a:d0:
+ 8c:a7:c9:53:d8:8c:ce:e3:be:c7:bb:4a:ae:7c:f9:
+ f1:6d:07:ac:3b:55:cd:83:3d:e4:ef:96:8e:a9:c9:
+ 1c:cb:84:99:cf:37:f5:53:57:e7:94:78:97:12:04:
+ 1f:dc:31:f8:f0:bf:7c:9b:ef:8a:25:02:1f:1b:ab:
+ cd:f9:bd:a9:de:df:e1:3d:b2:fb:92:44:93:59:ab:
+ f7:c2:a6:e1:05:19:49:fb:f8:02:5d:3e:d0:50:26:
+ 5b:e3:26:ac:fb:cf:ab:f1:52:0a:12:36:16:3d:b5:
+ 9e:12:f3:c3:69:e2:9b:89:70:b2:31:56:9a:9b:91:
+ a4:c6:39:01:56:e4:b5:8b:35:70:4e:eb:45:1b:70:
+ 7d:1a:52:2f:a5:37:32:80:ae:50:d0:da:4a:85:6a:
+ 3c:66:e7:41:85:c8:3a:dd:25:d8:4c:32:85:cb:12:
+ bc:81
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -28,47 +37,50 @@ Certificate:
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- CB:22:3B:E6:DA:B8:3D:7E:39:61:18:38:50:C8:4D:B4:C8:9A:3E:2B
+ 0B:18:61:66:8F:12:44:81:60:0D:80:D6:0A:6A:9E:DE:D7:69:56:B0
X509v3 Authority Key Identifier:
- keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12
+ keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
Signature Algorithm: sha256WithRSAEncryption
- 8e:b7:3d:cc:2b:e5:27:49:49:5a:d4:3c:83:9b:2f:7d:11:de:
- 6b:0f:b4:51:02:e4:37:d0:c4:b5:7b:4b:e3:42:93:75:32:d1:
- eb:41:a2:27:fe:4d:91:ae:2b:a0:8b:3b:7f:e9:1b:47:85:73:
- 9f:b7:05:74:34:eb:62:12:d8:f2:24:6a:b4:24:58:7a:6a:55:
- 3e:ba:54:f9:51:de:54:0e:19:06:f6:01:23:32:0a:6c:81:e2:
- 57:8a:9e:71:c5:ba:ca:c3:0f:18:d4:ef:54:4b:e1:ee:7c:3a:
- f3:4d:c3:a3:44:21:9f:c8:ef:85:01:ab:fe:a9:7b:36:05:10:
- 25:5e:61:b8:1d:7c:40:8a:5d:5b:c1:bb:7c:79:45:6e:84:63:
- b5:3f:51:e9:9c:57:01:de:2d:1e:85:cb:83:f0:16:6d:78:bb:
- 12:01:a5:e5:a2:a7:80:fa:54:8f:9a:5c:de:1c:52:a2:bd:00:
- 49:e4:04:65:30:f9:b9:fc:4f:94:e2:d8:39:89:b6:a5:a5:2d:
- db:25:a3:0d:5b:f9:e1:2a:13:19:5e:d7:1a:33:89:5b:ac:bd:
- 29:26:da:1a:90:7e:08:19:dd:59:4b:50:fd:46:c3:0b:91:33:
- 8b:c6:70:d1:22:18:37:a3:8b:d3:8f:f8:68:cf:38:8e:e1:ef:
- ac:17:88:ca
+ ac:6b:15:7d:68:74:9d:ce:e2:ed:80:9c:f6:36:b5:54:8b:60:
+ 38:d3:cd:43:5c:97:44:1b:c8:6d:73:e2:1d:6a:68:07:bf:c4:
+ 0c:bf:ae:b9:f1:12:28:1b:07:6d:86:2e:8d:4d:1c:56:3e:e7:
+ d7:62:a1:a2:de:9b:7b:1a:8a:b4:7f:76:f1:cf:d3:b5:b0:95:
+ 91:ce:7e:49:45:0f:11:a6:96:6b:7b:42:07:cc:8d:28:13:d2:
+ 30:19:5a:c3:31:16:f6:0a:9a:d7:cd:8e:6f:be:8c:aa:91:40:
+ 68:fa:4d:ff:9f:10:d6:3d:27:27:54:f7:64:fa:7a:89:d9:67:
+ 4b:63:2b:da:cc:95:f1:30:10:e8:5e:cd:ce:43:c9:72:ad:32:
+ b6:06:cc:a9:02:dd:4d:9c:00:97:fc:99:80:84:bf:e3:54:5a:
+ e8:2c:a5:b3:30:8e:30:cb:3c:5f:74:18:43:a3:42:36:53:78:
+ 62:4f:08:56:11:80:c2:12:1a:da:70:18:10:7f:3d:15:b4:73:
+ 29:26:69:7d:3b:ec:f8:18:01:f7:ac:c2:8f:f2:37:8d:8d:fc:
+ 78:87:bc:d4:cb:1d:c1:14:c7:9c:3b:dc:a9:fd:e8:86:2a:32:
+ 51:fe:8d:89:cd:6a:9d:7a:6f:0c:52:4b:b2:4d:d3:dc:02:39:
+ 8d:2d:25:6e
-----BEGIN CERTIFICATE-----
-MIIEETCCAvmgAwIBAgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
+MIIElTCCA32gAwIBAgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
-c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjIxWhcNMzcwNDIw
-MjA1MjIxWjCCAUcxCzAJBgNVBAYTAkZJMWEwXwYDVQQIDFhzdGF0ZSBvciBwcm92
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTEwWhcNMzkwMTIy
+MTAxMTEwWjCCAUcxCzAJBgNVBAYTAkZJMWEwXwYDVQQIDFhzdGF0ZSBvciBwcm92
aW5jZSB3aXRoaW4gY291bnRyeSwgaW4gb3RoZXIgY2VydGlmaWNhdGVzIGluIHRo
aXMgZmlsZSBpdCBpcyB0aGUgc2FtZSBhcyBMMUAwPgYDVQQHDDdsb2NhdGlvbiwg
dXN1YWxseSBhbiBhZGRyZXNzIGJ1dCBvZnRlbiBhbWJpZ3VvdXNseSB1c2VkMTQw
MgYDVQQKDCtvcmdhbml6YXRpb24gbmFtZSwgdHlwaWNhbGx5IGEgY29tcGFueSBu
YW1lMUkwRwYDVQQLDEBvcmdhbml6YXRpb25hbCB1bml0IG5hbWUsIGEgZGl2aXNp
b24gbmFtZSB3aXRoaW4gYW4gb3JnYW5pemF0aW9uMRIwEAYDVQQDDAlsb2NhbGhv
-c3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMn+gz8LOIkdQxWTXCa5gGVB
-vS9jZl7b+jMg2cfhNfMUPMi09wnY9bVEj2t+oKQ7RV/m9A8IZ/haTEnk5TkxaYzP
-JXiTpn9Y6ZCcYcsuFLFXshWc6o1vliD+Ke0scbhPH+AFbASxfuC8Qo6/lV6pXsnJ
-pGTCH1mUFMIGRHm80mUtAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgEN
-BB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTLIjvm
-2rg9fjlhGDhQyE20yJo+KzAfBgNVHSMEGDAWgBQcxyuqG7G7Lpr0D7GGYFc4wkEF
-EjANBgkqhkiG9w0BAQsFAAOCAQEAjrc9zCvlJ0lJWtQ8g5svfRHeaw+0UQLkN9DE
-tXtL40KTdTLR60GiJ/5Nka4roIs7f+kbR4Vzn7cFdDTrYhLY8iRqtCRYempVPrpU
-+VHeVA4ZBvYBIzIKbIHiV4qeccW6ysMPGNTvVEvh7nw6803Do0Qhn8jvhQGr/ql7
-NgUQJV5huB18QIpdW8G7fHlFboRjtT9R6ZxXAd4tHoXLg/AWbXi7EgGl5aKngPpU
-j5pc3hxSor0ASeQEZTD5ufxPlOLYOYm2paUt2yWjDVv54SoTGV7XGjOJW6y9KSba
-GpB+CBndWUtQ/UbDC5Ezi8Zw0SIYN6OL04/4aM84juHvrBeIyg==
+c3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDrfE9Z8EA37Tiy6DBp
+TpXJAFnRYDuKqiihIEDuvxzzsKZAjlekeYHJcJ+MPfRcsPlYVdlisktp4RpzvwMO
+i8rTDfIS6mgeuPW6KQKwFX92Upp97m1+LPVa0IynyVPYjM7jvse7Sq58+fFtB6w7
+Vc2DPeTvlo6pyRzLhJnPN/VTV+eUeJcSBB/cMfjwv3yb74olAh8bq835vane3+E9
+svuSRJNZq/fCpuEFGUn7+AJdPtBQJlvjJqz7z6vxUgoSNhY9tZ4S88Np4puJcLIx
+VpqbkaTGOQFW5LWLNXBO60UbcH0aUi+lNzKArlDQ2kqFajxm50GFyDrdJdhMMoXL
+EryBAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wg
+R2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBQLGGFmjxJEgWANgNYKap7e
+12lWsDAfBgNVHSMEGDAWgBTKcZmJ8HKrdWa7ZWoDBHKle5WmkzANBgkqhkiG9w0B
+AQsFAAOCAQEArGsVfWh0nc7i7YCc9ja1VItgONPNQ1yXRBvIbXPiHWpoB7/EDL+u
+ufESKBsHbYYujU0cVj7n12Khot6bexqKtH928c/TtbCVkc5+SUUPEaaWa3tCB8yN
+KBPSMBlawzEW9gqa182Ob76MqpFAaPpN/58Q1j0nJ1T3ZPp6idlnS2Mr2syV8TAQ
+6F7NzkPJcq0ytgbMqQLdTZwAl/yZgIS/41Ra6CylszCOMMs8X3QYQ6NCNlN4Yk8I
+VhGAwhIa2nAYEH89FbRzKSZpfTvs+BgB96zCj/I3jY38eIe81MsdwRTHnDvcqf3o
+hioyUf6Nic1qnXpvDFJLsk3T3AI5jS0lbg==
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/server-key-verify-fail.pem b/mysql-test/std_data/server-key-verify-fail.pem
deleted file mode 100644
index af1ae1e3ae1..00000000000
--- a/mysql-test/std_data/server-key-verify-fail.pem
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEpQIBAAKCAQEAvfCda4mh3Nlir1MAlGYdTv33kUDdMRZ1SKdhOAY/v1pNVDgz
-1p4g2UHrCFZc4jyx6H0lrsLqQzOo6BhuAKVaUM8BUlaS0Vh5Zc4vFunOHUpaRLqM
-GRZPTa3sfslxhuKXvGOUlTEvPhQ45QNQMg/rKp0D1UTeiwRK22POPntmbbE+rNsg
-dUl85GfsR7EfimvJLvjf2nqLhe18vfU0nxXTszePdrwaptwSpdi9xQKsufLANDWK
-A/zXtvq1rnaduBhaKp2fSYmznflQn+n+tKUPgB7/obcFIRjvCGKvrFjq+x3gonrD
-7BEIedjSTLo50MlUksfWKqHuyLs/dEEaTHBjswIDAQABAoIBAQCSUyNzDPydXvsf
-hhoUOParPAvU4tuETYDdD9Vdi7Lgf3jDQOjulbNIq/ec3KuBvrBwIrk9APvn+YxO
-AUP9S2Vgi5jBDeDdVgNv4n90b3pSJk2UVQJI8V72wN5Ibnf/KeErSKvWo6V5daq/
-AuZtKsZIdd3WFtA62HuyuBjTGc23Alj1C0EKnN0Rx1uBwDvx/OVQ266Us/x8jJqW
-ZxIOfcvfNzBQEa5hAzbQCReVaC+rBLRAcMM2yGP7aDa+8cRkwuVlSqpX8CXBdLoU
-PqmU49etcW72Rb1AFt9WgEu1Oh9UYbHFSB+FEbO8IGcGBsuYHf9zkxQyjpy/iKyT
-H5dTu7YBAoGBAOWqEGepZVrfB+P6X18n3vbJhgYmF0sa0mCmwkFYgk36yNqsZ8at
-lQjm5mbn4wjEKHIcQ/T1taq73W471M+PxMnn0WTwoG5jsyarZGgy6/95YXiyZtQe
-qgA4P3aKkCteRP22DjG7uxmm9Hoqx8Z31vfRTLAHN1IEHPHHkg/J3gPTAoGBANO4
-aqKeY4vcDvVkvxVbADrw++tZGwA+RuxfO4HKKru59VdA2PsAxhXwb3Dfejwj7hYW
-yE9edHjGpMr1+dpf8YJYs7qjajHe1HxBOYqQGHycIdw+Gv56R4HpaS9eW3x8l/Pi
-b4xnAodv2qIriACOe7br+rll4wKX46Wt64zdvpShAoGAT0r3HQM0Vjp4u/J+qRjX
-9za+yjKuiiS5i9snaG5JlujGHhG2Rrc5pHgsBk17alRnbnZp1BJdZZQ1MFEB+aO2
-mssp1YLqsRJFEU3NfdhO+MaMq6JUtFnd8fN5ndDbU83ZXgtUPUGGqKWm9OL+VHyd
-wLQHmSL0q6F16Ngxirf0qjcCgYEAtSmiJVA+gdhk/FmeoBlkEwtNpM50Kjsf2PaM
-Jrzk4Al5A5Y7lFvPI8q+sOio4XklKsWH1VJPe2EOdZUQnGlocE6SS+u03MN9Mm1l
-XUl7inTXDGwgEQx0z5b4KE4nHlhGdauWI5+pLFbrz8RL9Z32AkneGnIyU2/AnW46
-lijQAMECgYEAmgp/88ndIw49RCtMhYhtXQ87AsEAP6kzXQyKppDkn0os+xI5igIL
-i/UDxB33hx3yjrUZwoGDV9MwlMhZNX5Tf5bwjPmmh1NR6KdEpPt5AkklX4s6uil2
-Bxl1P5l1jl/PbEYtv5LDZKIPANWRzViMSIWqjUWlbdqE7/vjx+Oo+cc=
------END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/server-key-verify-pass.pem b/mysql-test/std_data/server-key-verify-pass.pem
deleted file mode 100644
index 7ecc44f6d48..00000000000
--- a/mysql-test/std_data/server-key-verify-pass.pem
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAwJpG1MA3vp66i/APLsJSGZO+Bxwg41AFq7JChfZXhCELAeXs
-RWfCRKNbupnUeJWkFrMYsxnUz6iBInZA8shDIePo6B4MkBDw/xt6xVVvMhBR2+Nj
-tODvegRDxVzTw0bl9zMSPpRm2A48U0v1oVbm+P90qi4wtvBSZhFFyBwNPwPnOYZW
-FytLvmjwKl8RyIwYAeAccR12SqnnJr0dy4V6FZoSZp3bFXymowdu5wynPPzkyB9k
-l2+od50Tw10X8AfwuYvtNOLRLFXiIJGLIXAoC0sg3XlYnlD9qZtxAJg0o5rSxego
-GPxAUnx/iQihVJO+WwOJPAghswXyHjnLCh8IBQIDAQABAoIBAHPQUSc9LkgBSks7
-XuXPE28t1+aOk3gcdkx4NGg5aQaal/PcPea+LaL4WAAs4AZidPjxWLjZn43+1SfT
-09opcbS/Rx3Mc+FtTn0YGQrwBJ0mExMV+K6bU2Ubi2TyHKQfzciHfUEEG5Nve/ba
-hikuCFVRxuVOQRzABcw6NqvNsmlg892lfw6/+RDwMBcz7ocwzmiOUoIxgjyFo9G4
-aJvRmHLij5892H6qveik+A/Xr+8leGQHiQET2wW/F9MFP5ypIT7aeE6remeZH7fG
-f4/Zfei/TE4xK2ElNR/91byzeKIVY4vjtTndAiBuqpfYuICb40MC02LNW5Oe6VN2
-3mQ6EgECgYEA7O4ndBnbs/00gyTGyNg6I+3wRTibhNH4R8RZFJiLfKRKOlUiLhUo
-+bQeO4bCQ6YY++TYDvMEXTlA3jow9R9Mj2AWc6bNmQmJd/065QyFHftywT66I+V4
-rz1ohSJyHXcv4DxqNk3o3Vb4N8GFjZKcodSgTv2Lk+9ipDYFcQiZop0CgYEA0BrF
-SIyLTnjoVht/7RbIGEqhMQUiz5mx7qQ1TPB+YTG77G2xXJNg5d6S7WT4LN+cqbxN
-YdndIbW4NdV7bH7FlG9q7jfkuZ+AY2BPU047tcDeyO0HYYEhVY+EyZqHci/26mvt
-JrawdqS5HQS1y/rKfytm7YBGTvqoNZHvOHc6aokCgYEAxcjlbJkte+pyzMuFmiJP
-HrFBczeXM+BoJ9j0GCpjvvAS+vEYsGl/pDvFRSHwx7I/hv/5kTkzOnNSAHGJbwbq
-zYGEHJVxakC43k6pvI2gDnBa0pD/qHmmLnvP5dvkcU6Oy90DOUP+kc9JNJo7V/y8
-/qdWD7q+qwcaTETAdCSexE0CgYA/DN1Y7bwHOnqqHArWOmDFe1b7EyNI4rgWJYpA
-lVy09eyJ5XInKj/hZV3+rujCL723b2XCj89/tx7osJWEeaRDJL6xDh4uXzT25uch
-xkIw/w6Asc/aqtT+p00EB92hqwaUX76qTA+K4r1zHUo3UvSnMu8sZgDnTOpJ0L05
-zmXUgQKBgDT+IFrAzOty4B0mJncTCC/TulpW704bEZwNJfQSdtiBQr/vqoXygBQc
-bHfpncpSfhzHB5lhRUv02TqXgl53D70nM7JD5nx98WYTTBxsbvxPlt4gBRZkfgq5
-tHKclAArc1SbfW5Z8oYyl7h33LQJK116QSyiIIGieH5VXNPwnqUs
------END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/server-key.pem b/mysql-test/std_data/server-key.pem
index feb7fbaf535..125c4efa587 100644
--- a/mysql-test/std_data/server-key.pem
+++ b/mysql-test/std_data/server-key.pem
@@ -1,15 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQDJ/oM/CziJHUMVk1wmuYBlQb0vY2Ze2/ozINnH4TXzFDzItPcJ
-2PW1RI9rfqCkO0Vf5vQPCGf4WkxJ5OU5MWmMzyV4k6Z/WOmQnGHLLhSxV7IVnOqN
-b5Yg/intLHG4Tx/gBWwEsX7gvEKOv5VeqV7JyaRkwh9ZlBTCBkR5vNJlLQIDAQAB
-AoGAZzoeMJW3arr9kYUhTtj1+MlDuXf+1PNuRbrAERnSzErHVXrF1M5/owdKlBC+
-X6+6oGwSxavyFkVvP0QusK/D1DxSs60Mk1p3Ax5nVpNYiBdeBULcYiXCSUbKItYL
-vzyECIc02t+auWf/wp3Wy3g6sU6FoT2QCPSsy0qRC48VBzECQQD79P9w0XjJGk8y
-3zPc4JOr3a1UUu4VLjFdFDR2eZZRE02NcXfLHE0+Idk3TYnNDRLoWDJjdfZ0thZZ
-KuJ58wIDAkEAzTxGYmT/aieDC3G8sHMqLUvjN30TfTocv7mWlpxWo7zbRbQm7jsB
-S5weRKtu3yVmdb6rW+5IZSCazc/j4T5tDwJAUgDRSpTCrSFE+Zevt4nYRi2mBjXf
-i0E3i8XRtWWpSMXxjcGKba7ObRRzMA6qdPR2XOynqbtw9Vd2Ops8jthKpQJBAJJm
-8tZxsXlqIiLhyXYdUPLq9XS5tlNYRvXFT9S0RWGb8NbyQesjEDN9dGIL4JUxurs3
-fkmf2ui4r3UtXSNqQqUCQQDjatAhBdibh5UawO5VpI87OJMzATCkY/mX3R+TnbOm
-MkdydjF022P0M4N24DiM+2nBTDp+F45LwtQLa4vmB2No
+MIIEpQIBAAKCAQEA63xPWfBAN+04sugwaU6VyQBZ0WA7iqoooSBA7r8c87CmQI5X
+pHmByXCfjD30XLD5WFXZYrJLaeEac78DDovK0w3yEupoHrj1uikCsBV/dlKafe5t
+fiz1WtCMp8lT2IzO477Hu0qufPnxbQesO1XNgz3k75aOqckcy4SZzzf1U1fnlHiX
+EgQf3DH48L98m++KJQIfG6vN+b2p3t/hPbL7kkSTWav3wqbhBRlJ+/gCXT7QUCZb
+4yas+8+r8VIKEjYWPbWeEvPDaeKbiXCyMVaam5GkxjkBVuS1izVwTutFG3B9GlIv
+pTcygK5Q0NpKhWo8ZudBhcg63SXYTDKFyxK8gQIDAQABAoIBAADaATt1B/Zr0DGt
+b0diNl50tt5v96cnuF/kyvdSD5u9/svq99wraFG/K4SJUNHo/e3Y2aFmvakTXFIg
+1bT+wmwC9+YjnN7HknPq5AyY904JPG/KJfE33mdGq8uLidcVo0XlkblWqsze5oWb
+an8Ib2bTGXnYVIm+pXEC+L9sF2IGxJP3kWQyFjX1UEp7YDhmtMVm7ONeli3/LPYF
+TqWF6ScoI0AexKVo7Jgfx+oDlUASSup90Om07YyjlbIzgiTYPzDqM9XhDQNDaMLJ
+zi3N4INohRRG0R/DQ4nqP/YWat6/q1FuRznWdOzzNIR5YrbyFRgX7rMPCjeF3cRt
+mK9xKXECgYEA+Qo7ixk0giXZj2ZkJ/OsqT2CnK1jUuJGxtyGCpXbM7hXe8bRq8AA
+BVVzLIFR5wY1LKoLYxoMSAn3B1F7y2iVgj7VlBehLTWC2mrsrPse1yRSl8TGOpJB
+wP40lfH6/L2mXI4TfnDEgfzkFdpgsHVazpz48A5nSKB+xrJX4JkDos0CgYEA8hEa
+GBvwqYum/tMWhYF0YVPXxRUySMYRZX9cW7Mfa/bG2KUyCwIJJipiBe/Zq2AsN917
+wA1TXdnwC3i63iVssPxKKkx1RNpDpNJKzot9oawjhR/OKG/24f6mQJ1W8cX7viT8
+F7IXIX4/drfuDlz4s89NmMRaKuC/mWJfYi77yIUCgYEAkvIUvDi9IOZQfyq9gk1n
+3dyriuNMLgXSGVjZxrkxxEzLYf+ojB0YZg1LjkEoIJcrHRWg7nLaOE+Y8TqFPzqQ
+rW+B+oYO1mwyr8pTqKXsRqnqCh9TkA/ouIXGZYuIu0T0OryiiALmEIU12Cco0jYM
+xMkeohb9nn8FDx0AeUgQOykCgYEArpehL4Rvd4ovf5p2owJ1E4Hqnc6k/xJFF+Td
+k5JFdpR+ZWH5DzF/sdRd8RRG9jGekwifqiyyVX3Mgimo9nMdyyWcxJdy+Z9HrMi0
+hfbcPVCwKeN/yXDAK86E0RPq0uVOpp18agbcYh7x3UnaXOe3xdEekbIFqumBqDro
+uyNSHRUCgYEAy3xDAESUEXhYGN4WRpWn58Pb0NUsbc/l9P42Z7tog7YmPLpJuY1O
+qKW3uwTzxmk65JsiBEsOL7UT7xbq15uaUINC3FRfcMQz7+TW8rUBguVRUjxLTHlx
+SlgU3Oxz1oQ/J7GL+x0MxBtTjRW9/7Adv2j1Du8QtlWgr/wOHarPjh4=
-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/server-new-cert.pem b/mysql-test/std_data/server-new-cert.pem
new file mode 100644
index 00000000000..fb203d7c0a2
--- /dev/null
+++ b/mysql-test/std_data/server-new-cert.pem
@@ -0,0 +1,81 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 2 (0x2)
+ Signature Algorithm: sha256WithRSAEncryption
+ Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
+ Validity
+ Not Before: Jan 27 10:11:10 2019 GMT
+ Not After : Jan 23 10:11:10 2039 GMT
+ Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server-new
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (2048 bit)
+ Modulus:
+ 00:d8:52:35:3e:4b:0e:fe:cc:17:1f:b8:79:5c:35:
+ d6:a0:e3:c5:11:23:5b:12:7f:c3:a4:4d:0f:35:71:
+ e1:94:87:49:11:e2:f4:b3:80:dc:33:c0:65:f4:1b:
+ 24:21:b1:c4:e5:d6:b8:1e:83:f6:3f:6b:7f:aa:2a:
+ 18:a0:49:6c:87:ee:b4:df:cc:58:19:0f:7f:06:b3:
+ 93:ce:8c:de:46:69:80:e9:ac:9e:79:05:bd:e2:c6:
+ bc:80:3f:44:7e:a8:ca:09:72:e3:e4:b0:a4:54:79:
+ 08:9c:f8:b0:ed:56:3b:21:da:dd:8b:06:12:df:fb:
+ b6:2e:0e:ca:27:c4:de:8b:55:e2:93:d6:ff:09:aa:
+ f0:a9:8e:83:be:92:fb:9d:a8:c4:b6:27:e2:63:03:
+ 3c:0d:6b:4a:05:f9:6f:1c:14:de:f3:c3:ef:60:9f:
+ b4:21:d6:74:6f:a3:a5:6a:c0:b0:4e:7b:37:95:0d:
+ f6:43:06:95:cf:c0:93:13:d0:81:83:5a:aa:bf:81:
+ 98:ca:4f:70:46:79:42:84:12:32:74:e4:7f:4e:84:
+ 13:83:54:15:49:45:1d:d1:40:bf:e1:5f:11:de:94:
+ d0:4a:5e:8b:a2:26:03:61:55:41:45:86:45:00:d8:
+ ea:34:f7:1f:21:64:f7:85:6b:a6:47:3e:f9:81:e4:
+ a6:6b
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints:
+ CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
+ X509v3 Subject Key Identifier:
+ 20:CD:11:1F:57:C3:33:FC:17:16:2D:32:48:16:47:B8:0F:42:2D:53
+ X509v3 Authority Key Identifier:
+ keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
+
+ Signature Algorithm: sha256WithRSAEncryption
+ b3:2d:b3:4f:a0:9a:48:ec:a9:06:97:8d:b4:af:93:13:a8:58:
+ 8f:4e:43:f1:4f:7b:13:59:d5:c6:dc:f0:f7:b8:f2:e8:47:28:
+ e0:94:2d:cb:d1:de:58:a8:31:e7:41:f1:c3:9b:6e:21:c4:3e:
+ 2c:56:f7:8b:36:1e:b5:c9:40:aa:15:8b:32:33:29:e6:8e:3c:
+ a2:db:ad:02:c2:cb:46:fa:4d:2b:43:51:97:00:bc:ad:83:b1:
+ e9:69:7b:83:31:a8:ce:18:c9:a2:d3:a2:17:f5:f4:b2:3c:59:
+ 36:2d:6d:ee:21:bd:fa:24:cd:c5:96:26:41:66:6b:8a:ba:ff:
+ 25:60:44:64:43:f5:4d:df:61:4d:a1:7f:16:27:63:a4:9c:61:
+ fc:d1:9e:9f:aa:e0:dd:dd:4f:64:2e:89:03:cd:a7:f4:b8:d0:
+ d7:a5:72:46:fa:33:13:84:0f:a2:e1:fa:9a:a1:e4:6f:f4:30:
+ fb:30:24:df:ac:d0:52:94:8d:92:3b:26:fe:1d:a0:30:da:23:
+ 05:3f:ef:f1:79:a8:b7:f9:73:42:5f:da:9d:f8:a8:28:b8:4f:
+ e3:6e:50:81:46:e1:b4:a1:7e:ec:78:10:8c:be:2e:bc:21:6d:
+ 1a:78:df:3f:f9:a8:8e:67:0e:b6:cb:1e:fd:ed:d3:28:68:59:
+ e3:d4:59:a8
+-----BEGIN CERTIFICATE-----
+MIIDpjCCAo6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
+cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTEwWhcNMzkwMTIz
+MTAxMTEwWjBaMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
+BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMRMwEQYDVQQDDApzZXJ2ZXIt
+bmV3MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2FI1PksO/swXH7h5
+XDXWoOPFESNbEn/DpE0PNXHhlIdJEeL0s4DcM8Bl9BskIbHE5da4HoP2P2t/qioY
+oElsh+6038xYGQ9/BrOTzozeRmmA6ayeeQW94sa8gD9EfqjKCXLj5LCkVHkInPiw
+7VY7IdrdiwYS3/u2Lg7KJ8Tei1Xik9b/CarwqY6DvpL7najEtifiYwM8DWtKBflv
+HBTe88PvYJ+0IdZ0b6OlasCwTns3lQ32QwaVz8CTE9CBg1qqv4GYyk9wRnlChBIy
+dOR/ToQTg1QVSUUd0UC/4V8R3pTQSl6LoiYDYVVBRYZFANjqNPcfIWT3hWumRz75
+geSmawIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NM
+IEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUIM0RH1fDM/wXFi0ySBZH
+uA9CLVMwHwYDVR0jBBgwFoAUynGZifByq3Vmu2VqAwRypXuVppMwDQYJKoZIhvcN
+AQELBQADggEBALMts0+gmkjsqQaXjbSvkxOoWI9OQ/FPexNZ1cbc8Pe48uhHKOCU
+LcvR3lioMedB8cObbiHEPixW94s2HrXJQKoVizIzKeaOPKLbrQLCy0b6TStDUZcA
+vK2Dselpe4MxqM4YyaLTohf19LI8WTYtbe4hvfokzcWWJkFma4q6/yVgRGRD9U3f
+YU2hfxYnY6ScYfzRnp+q4N3dT2QuiQPNp/S40Nelckb6MxOED6Lh+pqh5G/0MPsw
+JN+s0FKUjZI7Jv4doDDaIwU/7/F5qLf5c0Jf2p34qCi4T+NuUIFG4bShfux4EIy+
+LrwhbRp43z/5qI5nDrbLHv3t0yhoWePUWag=
+-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/server-new-key.pem b/mysql-test/std_data/server-new-key.pem
new file mode 100644
index 00000000000..40f6138157d
--- /dev/null
+++ b/mysql-test/std_data/server-new-key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpQIBAAKCAQEA2FI1PksO/swXH7h5XDXWoOPFESNbEn/DpE0PNXHhlIdJEeL0
+s4DcM8Bl9BskIbHE5da4HoP2P2t/qioYoElsh+6038xYGQ9/BrOTzozeRmmA6aye
+eQW94sa8gD9EfqjKCXLj5LCkVHkInPiw7VY7IdrdiwYS3/u2Lg7KJ8Tei1Xik9b/
+CarwqY6DvpL7najEtifiYwM8DWtKBflvHBTe88PvYJ+0IdZ0b6OlasCwTns3lQ32
+QwaVz8CTE9CBg1qqv4GYyk9wRnlChBIydOR/ToQTg1QVSUUd0UC/4V8R3pTQSl6L
+oiYDYVVBRYZFANjqNPcfIWT3hWumRz75geSmawIDAQABAoIBAQDMUdGidejC92g7
++NUAKIYBz0Ear+dccLsMnBBqbZcg4Cs/LrvsNCFI7EggKeaVwL/2Szn68K+NNW8O
+/dXmx5MwTWIgJHVtrjpPzRwlst5baVlu3TGNo8O3x/jRtXBvpeO2ywK/xaxhcTSW
+dzs94P3XO0+X+XOohaqMlEGTEJsWxJoSnZGL/QJAqccUEZMQeAkHOGVIDAlynHPi
+Y1zE+7QpeoNDKPPUS+niNouloRWJqhps11UhNHMHelXLWkiO78HNfQuMU8RUjzVu
+niRQ5cxn3aj2WrFqTtg8UJH0QEEnvpZnk8ptZoMI8lFALDTjCVTIrRS2b5TT2YOz
+UB+G0CGhAoGBAPjNUMBMz7uH+a8rIwS3zGEgHmpQY1vBw1uxH/vDdSgY28BXKEMw
+4ofGjyT1tXi6sdUFzWHybwCPoaaTb46Vo3G9lZoTX6k9Sp5HatGqa7gJwcU1UjUQ
+KLkokmwFi9nupCjOze4cP+uykQME6RBIBDGSeG4kn2ZPhYsXbxI15tz7AoGBAN6U
+VOgAu2/EgB/TD7k4Be3uKVgtSSAAmDe4DdT2WdeUYy/YQ5avpvayd1kjlMeybMia
+PM27VJr8pXnCcfabvwC9vP5KjX7Z45NeTqgUsY4nGASEQpECVVWjOyL3yyPSUDyG
+s4yMsrJ5N4cAFodZ2uvZtdez/Msdrd0Icyqqp0FRAoGBALGyOiVN9uPSRuLz5Sve
+dcs8nFyEE6KaLgQT6mru+4Lq1jB2T1xF0tT0XJIiJz0V4iLp5Pk6pEr7SpHlJTzp
+5PU8WVfU1HLUQrHvAfzDQfIMjedioNcjNmKf9ovOHkdFaNt4cJ3KcWDOhUFpxWeK
+d+xL11WbNHlm/FMOJpcUBlH3AoGBANwto6g1QTWZDp1srjss/kCVvfRqJ9IuhGVp
+/tTSNaGaOlwT9RhU/jc/5+wX1I+PIyl12fwx+cmvbwn5nb6z5sgW6aQrn7kCVats
+OSbwAYx7g7jEFQ1ZX4ztggxfT2ZKH/Ef1vGMJSGD47f6EE8oRfXVUZrlg4Zx/5GN
+UE++rOFhAoGAdjQrHtlHx7woHOwwgnfF6TlSp99TZWLvn+ethpIA8qET+xGAOi8H
+gVWSA/Yq9fjc8W2niJG05EB8FbwSaAA6HH13E3B5+KWYGwgC1osSkF/JDKInTilC
+/fvUW6clvoXQoJPymwtFpSK5NygJfASujZaAetSQFiG2oAdgQW1rjlY=
+-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/server8k-cert.pem b/mysql-test/std_data/server8k-cert.pem
index df27c77e8e0..a2878516020 100644
--- a/mysql-test/std_data/server8k-cert.pem
+++ b/mysql-test/std_data/server8k-cert.pem
@@ -1,86 +1,86 @@
Certificate:
Data:
Version: 3 (0x2)
- Serial Number: 2 (0x2)
+ Serial Number: 3 (0x3)
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Apr 25 20:52:33 2017 GMT
- Not After : Apr 20 20:52:33 2037 GMT
+ Not Before: Jan 27 10:11:15 2019 GMT
+ Not After : Jan 22 10:11:15 2039 GMT
Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server8k
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (8192 bit)
Modulus:
- 00:b3:a7:81:cf:a3:9b:3c:57:2a:8e:de:13:08:a6:
- 15:6a:68:08:ce:a1:a0:ef:fc:32:95:5a:9a:b5:cc:
- 84:bb:a3:15:a0:fc:29:bb:71:0e:f3:40:20:97:35:
- 92:92:89:36:6a:5f:be:a5:24:5a:c8:0e:f7:53:a8:
- e0:74:05:90:38:21:a5:25:72:2b:56:70:74:aa:d6:
- 30:25:e0:95:dd:3d:4a:48:4b:25:a7:a8:c4:eb:e5:
- d6:10:4f:95:42:91:b0:cb:68:2f:bf:96:0f:0a:9b:
- 2b:01:0d:03:ae:3f:b7:7e:f6:1e:c1:14:42:04:7f:
- 09:21:e8:3e:87:c0:b3:d7:dd:4f:7e:95:b6:83:33:
- 8f:cc:f4:bb:11:8e:66:5f:b4:32:22:8b:8e:34:93:
- 82:0f:02:d1:6f:85:b2:a7:7e:36:0c:f3:0d:91:46:
- f9:a5:91:dc:60:4a:0d:eb:e5:37:e3:76:d8:13:bb:
- 55:33:23:4c:b3:90:df:6a:b6:80:3d:f6:bd:9d:bd:
- ef:d3:8d:7a:9a:61:ac:02:3d:10:b5:c2:53:d2:7e:
- ee:1c:90:a5:b0:e8:db:71:8f:d3:53:e4:80:b0:b6:
- cc:b0:f2:eb:46:c3:d9:3c:48:01:1d:3a:5c:d0:f2:
- 17:9c:9a:8e:fc:2a:36:e7:1c:59:41:66:ad:e1:d3:
- 82:d8:95:ee:ae:dc:ab:72:94:cb:0b:8a:df:ef:70:
- f7:f9:e2:77:76:64:67:2d:02:dc:1a:db:02:e9:5e:
- 63:3f:3e:07:e9:65:e4:02:78:62:55:e1:52:18:5a:
- a3:9c:56:dd:cd:d3:f7:f2:55:45:62:20:ce:fd:41:
- 93:b9:c2:20:90:23:a4:41:4f:30:5c:5e:a0:97:6f:
- a4:1f:87:6a:97:87:70:f9:d5:56:b7:6a:cc:f1:28:
- d2:26:34:57:65:9c:2d:41:43:8b:6c:bd:15:6f:ec:
- ce:3e:9f:4d:2f:a6:21:d8:f7:4d:d1:63:4f:f0:9e:
- 04:c3:82:33:58:34:20:4b:81:0d:42:0d:44:62:48:
- 1b:4c:cf:e0:69:e4:c8:f8:9c:98:1f:74:37:3a:3f:
- 23:40:3a:88:80:c2:9c:9b:ba:6a:b9:2c:3a:67:a6:
- b6:5c:83:fd:93:3f:6e:53:19:48:e3:3d:fa:f5:8e:
- 03:40:8f:e6:af:c5:de:aa:f8:70:77:36:2b:6e:3a:
- df:bc:d7:f6:c7:4f:02:7f:a1:ad:2f:3c:e9:08:45:
- 2f:57:1a:f1:5b:9c:27:07:3a:44:43:3e:05:b1:4a:
- 1b:42:a4:90:ab:ce:4b:f7:c1:9b:d7:dd:6f:05:11:
- f9:e8:a3:a1:99:6c:2e:27:3d:b1:54:6f:eb:b2:e8:
- f8:e6:12:6f:8a:69:05:cc:c6:f6:c4:2d:b0:06:b6:
- 21:50:28:50:dc:8c:b2:8c:65:ce:d9:2b:51:b8:62:
- 56:70:b4:46:4d:e4:4c:a1:86:31:3d:e3:07:7f:73:
- e3:09:6e:ee:a7:29:2a:80:23:8a:b6:0c:22:9e:43:
- 1c:a9:8c:47:2c:02:6d:13:ef:88:a7:d7:d1:60:d9:
- 6b:28:80:97:8a:b7:ff:62:6b:28:54:0d:ab:63:3a:
- ac:57:9e:2f:95:2b:f4:a0:3d:a1:60:a0:57:1a:09:
- 23:ee:fc:4d:9b:45:83:f2:0a:1f:b3:77:0e:98:20:
- b3:16:fc:97:03:30:fc:ab:3e:7e:fc:3e:76:64:cb:
- 4b:4d:c9:6c:8f:aa:70:ec:03:c5:81:31:43:11:9a:
- fc:2d:ba:25:94:0b:73:7e:c1:39:01:ca:68:70:1a:
- ef:a4:ba:dc:13:d6:37:17:09:0d:ca:aa:21:94:bb:
- 3e:43:fd:8c:80:e6:58:fd:75:23:5a:ca:1f:0b:2e:
- 35:c2:cd:77:0c:73:b3:2f:9a:e4:03:68:58:c8:3f:
- f3:76:8d:05:53:d2:34:db:09:af:70:ed:67:0b:ff:
- 2f:64:35:2d:71:22:7a:f2:f2:2b:7d:6d:be:80:bd:
- 18:38:37:01:67:a4:5f:48:29:52:78:9f:b5:b8:80:
- 70:ca:10:6a:e1:27:3b:c0:61:4e:96:f8:e8:0f:42:
- b1:fa:bc:05:ef:31:91:38:ab:0f:a7:ef:2c:86:c1:
- ab:85:36:7c:10:9d:c7:0a:6b:e6:2b:11:dd:fa:45:
- e7:d2:c3:3a:c1:cd:60:27:68:26:d7:87:49:5f:e3:
- 7f:26:20:1f:99:a8:f9:00:a6:0d:d5:13:81:6e:fc:
- 27:8a:03:58:6b:0e:3a:c7:20:a1:5c:24:d1:08:a6:
- 5a:1e:e7:81:3d:21:05:2e:4b:5d:18:14:f1:4f:ab:
- 5c:e5:81:da:c1:2c:f6:12:ff:25:09:97:1e:9d:51:
- 6d:1f:63:2e:9c:ed:7d:86:45:b0:35:73:f6:9f:82:
- 65:bc:7f:46:88:e1:a1:60:a1:37:50:26:9c:d7:76:
- f3:dc:94:89:6d:d7:be:a6:17:a1:2b:71:14:37:17:
- 5f:ed:5a:39:99:fc:69:af:bb:63:55:c6:60:7b:64:
- d8:bb:b7:4a:9f:b9:aa:89:4b:30:1f:9c:ef:23:7a:
- af:7e:31:dd:fb:dd:0a:d5:04:0a:8c:57:6f:64:80:
- eb:f3:ee:6c:33:d2:72:c2:24:68:a2:4e:99:88:1c:
- f7:3b:5d:10:cc:4e:ea:a5:cb:00:40:8a:a9:63:2e:
- 18:92:eb:b1:28:05:fe:19:ea:7b:32:fb:63:56:2c:
- 0b:20:01:92:a3
+ 00:b9:f5:78:46:53:e0:3c:07:bf:97:fb:ab:be:97:
+ 71:d5:89:44:bf:db:0e:58:be:96:42:06:9e:dc:08:
+ f7:51:d6:27:7f:65:2d:c7:1e:f7:4c:5b:3f:e5:7a:
+ f8:fd:df:73:42:92:0f:37:5e:28:ae:51:14:13:be:
+ b3:55:d4:db:9a:f6:a9:88:84:02:79:fb:f9:c4:67:
+ f9:96:99:68:80:58:4a:22:c4:a1:90:c0:33:58:c8:
+ 96:d1:a4:7f:7f:9e:84:a6:f3:03:a3:01:93:cb:1d:
+ ab:f1:f5:17:28:03:34:78:6d:47:46:07:ab:f8:ea:
+ ff:02:8a:f8:20:92:a2:ce:29:6a:66:d0:39:87:2f:
+ 62:9f:43:d9:a3:0b:74:89:ab:f7:d9:39:7d:6c:de:
+ 05:4e:58:4d:35:15:d4:18:2d:ea:70:df:60:fc:50:
+ f8:0d:b5:8e:c0:c6:03:74:3b:8d:53:d6:87:a2:9a:
+ b6:0a:5a:80:a5:cc:df:30:a7:95:30:ad:50:62:e1:
+ 01:3a:8e:ee:e1:41:b4:99:ee:ce:8b:ca:55:24:3e:
+ 7c:00:79:08:f4:46:42:e0:63:93:a3:d0:5a:39:fc:
+ 7e:f4:96:21:24:9a:f7:29:0d:22:85:b6:c5:c9:9c:
+ 92:71:68:5b:03:de:fb:bc:75:f8:0f:24:ea:01:92:
+ b7:37:e0:78:a0:64:37:69:90:8a:7c:99:c7:45:f9:
+ 90:a2:50:59:e1:1c:02:ad:b2:2e:c7:3b:26:ec:76:
+ 6d:10:c9:f9:2f:dc:12:87:41:72:08:ec:0a:1c:ae:
+ 9b:6f:de:57:a4:aa:b9:ee:83:a4:14:c4:e5:54:66:
+ 32:5d:21:2a:a3:6d:2d:8d:f5:8e:08:a2:a3:0d:07:
+ 83:4b:0a:27:0b:9c:7f:73:78:f8:d9:9c:1e:d4:33:
+ 2b:a7:35:b4:77:5e:12:d6:a6:a4:d2:d0:af:30:b6:
+ d5:1f:05:9b:1e:e6:ae:c8:a5:8c:b6:b7:dc:c3:0b:
+ 1a:85:5a:d5:bd:be:65:c8:e6:a5:f0:37:38:16:d2:
+ b0:ca:ff:2e:a1:f2:7f:8e:28:c5:9c:d4:de:be:1f:
+ 23:43:51:85:f9:e5:fb:a8:61:61:96:50:34:ad:75:
+ 34:fa:46:e9:2a:66:1a:43:9c:e4:e5:79:26:b7:0b:
+ 5d:d1:1d:81:c6:52:17:d7:95:13:9e:65:64:9b:2d:
+ 0d:2b:7a:04:28:aa:02:df:81:0c:f3:83:3d:76:ad:
+ 40:e6:f8:c0:b2:f3:0a:b2:cc:e8:f2:c8:ac:21:c4:
+ 90:7d:4c:b6:50:d8:b7:0a:15:12:5f:a5:e0:c5:68:
+ 8f:ed:4d:f4:d9:b5:72:df:63:c9:d6:14:fe:d8:fc:
+ db:31:72:1e:15:d5:e8:ac:d9:a7:d2:0a:bc:a7:a6:
+ 51:5f:0d:0f:23:20:2d:34:ba:44:66:f6:81:e3:aa:
+ fe:38:11:61:ec:03:3f:64:6f:93:f5:2d:b0:be:7d:
+ 6f:49:73:c6:23:67:7b:46:da:62:67:10:e4:e6:a1:
+ e4:1b:50:0f:ff:50:51:0a:dc:ee:1b:e3:ed:20:30:
+ 3a:c1:37:17:24:96:fa:fe:2e:d0:75:b3:9b:c1:ae:
+ 15:ac:ba:fe:b4:d5:33:ff:33:86:f3:5e:24:f7:45:
+ 8d:ad:b0:47:6a:ef:9c:0e:f7:07:0e:71:a0:e7:75:
+ 4a:42:59:02:b7:11:86:d6:65:77:06:3a:f5:6f:99:
+ 3b:9b:52:cf:e6:30:59:e3:28:19:8e:c2:5f:e1:f7:
+ 28:74:ff:c2:d1:35:91:96:ed:52:14:4a:3c:91:19:
+ 50:7b:3e:04:65:f8:3e:d9:6c:29:cf:74:d8:0f:df:
+ e4:cd:94:73:81:ef:19:9e:4b:0c:3e:2e:24:fd:a9:
+ c6:73:b5:7c:ed:d1:0e:72:ac:c9:fe:5e:a6:2d:d7:
+ 7f:ca:c5:75:18:cb:3e:27:62:20:cf:10:c1:7f:d3:
+ 6f:a9:d4:78:98:3b:f6:0c:e0:5f:54:b3:0b:0a:36:
+ d7:59:34:c3:70:5c:59:25:cf:54:e0:7f:ec:a3:3b:
+ c4:a1:6f:be:1e:be:e1:36:c6:d3:26:bd:86:ae:0e:
+ 73:26:89:3c:7f:72:a1:2d:00:66:b1:e2:e0:74:72:
+ 86:12:c2:6b:e4:e7:99:70:bb:98:81:c3:44:65:c5:
+ 76:21:62:f1:af:31:aa:73:be:fb:b0:86:a6:5b:e2:
+ 51:78:e6:6a:1b:58:3f:4a:34:e6:99:88:e4:1c:b1:
+ 80:94:f2:31:a0:b0:27:81:b1:18:98:6f:53:2e:74:
+ a0:c3:2d:e7:f6:92:27:80:40:a4:f3:3a:e2:ad:84:
+ 64:82:ed:80:3f:e0:54:e8:3d:ec:75:25:21:2a:2f:
+ 4f:08:61:be:b6:e0:fb:bd:ec:7e:3b:17:d2:a4:bb:
+ b8:f8:3f:9a:2e:12:eb:b2:00:45:51:3a:99:53:6e:
+ b5:06:5e:8b:8f:0a:b5:61:2c:12:10:60:4d:2c:de:
+ 6e:e8:80:f8:99:b2:8b:36:61:33:88:08:60:4f:30:
+ ff:61:d2:cc:02:75:5d:d7:8d:06:e0:bd:e3:e0:35:
+ f7:ba:f8:a6:e4:14:79:e4:62:4d:bf:ea:81:fe:1e:
+ 01:24:69:da:89:1a:c1:11:3c:50:f1:a3:b3:27:df:
+ cc:16:3a:03:97:88:a4:92:63:a6:8e:c9:18:f5:02:
+ 16:a7:b2:a5:3d:f7:12:00:e4:e1:55:96:16:84:6e:
+ 03:70:3d:ce:4b
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -88,61 +88,61 @@ Certificate:
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- 43:3B:26:15:A5:60:62:3F:07:2A:8C:8C:DA:F8:74:BE:36:B2:33:E4
+ 74:34:B9:9A:5C:1A:27:83:BA:0D:05:F9:5B:5B:A6:F6:BB:1A:8C:E8
X509v3 Authority Key Identifier:
- keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12
+ keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93
Signature Algorithm: sha256WithRSAEncryption
- 5c:c7:4e:56:eb:21:1b:f3:5d:c4:56:fa:bf:6d:e1:0d:fa:cc:
- b0:7c:13:58:b9:d4:47:b3:de:b4:ae:f2:45:02:88:65:43:89:
- cf:ea:9c:d0:ea:45:42:35:d2:ec:bc:b4:73:03:db:85:7b:c7:
- f0:68:d7:dc:2b:70:71:63:ed:33:68:9f:29:ff:67:0a:69:3b:
- c4:65:7c:25:00:cf:7f:ee:aa:fe:44:19:70:f2:74:db:da:9f:
- 52:92:1a:03:e6:0a:49:85:2e:2a:02:c1:81:d4:6d:cf:98:d1:
- e9:6a:2f:bb:fa:a6:d5:4b:55:38:c2:aa:8c:f5:d3:f9:e6:74:
- db:00:d6:29:f9:d1:9c:7a:0e:98:c5:e5:8c:16:49:d8:cf:ee:
- a0:cb:c2:2c:31:cf:62:2c:b1:7f:6d:60:b0:ce:d5:07:45:e8:
- 44:17:7c:c4:12:fb:00:57:24:57:e8:17:78:3b:1e:0d:91:aa:
- 67:98:d0:e5:9a:86:4b:88:4a:2f:55:5d:2e:13:ec:f5:4a:7d:
- e7:13:a7:57:03:41:2f:f6:6c:08:8e:58:ef:b0:7a:79:32:e3:
- bb:4b:eb:4d:42:cd:42:96:2d:67:f6:4c:c1:f6:62:fb:c0:3e:
- 09:69:8f:36:7e:fa:c8:cd:ff:72:3e:df:92:f7:8f:44:cf:77:
- fe:6e:74:de
+ e6:e4:75:22:6c:5c:ea:f3:3c:85:1e:3c:62:a4:9b:bc:52:49:
+ 2a:dd:dd:7e:94:c9:1b:c9:7e:4f:f2:82:ce:68:a2:17:29:b7:
+ 73:0b:39:33:ca:86:c4:51:ad:d9:18:e7:c2:42:b8:c3:a9:4c:
+ 8f:54:24:79:f2:27:9e:5b:aa:e5:bc:36:eb:11:b5:91:4b:7b:
+ 79:b9:41:b0:d9:72:53:fb:ad:67:7e:7a:7e:0d:06:9e:45:7e:
+ f6:5f:5b:c4:77:1d:d1:e5:d7:7f:8e:f6:64:2a:7e:14:87:f4:
+ b4:a4:13:50:47:f7:49:b2:ad:36:c0:27:15:eb:c0:91:f0:e0:
+ 77:bc:93:f3:db:01:69:10:c0:9c:e1:5b:03:9b:1d:ac:3d:0c:
+ cc:65:24:93:d6:8d:dc:aa:d7:d5:74:7d:0b:2a:6c:ec:c1:ad:
+ 2d:83:56:aa:28:94:9e:e2:54:98:1c:28:bd:45:63:e5:6a:00:
+ 20:ab:41:83:31:05:8d:38:ea:bb:35:ad:3b:28:46:44:47:3d:
+ f6:88:2e:ac:46:73:8e:13:0d:8d:5c:44:2b:0a:e3:bb:27:e3:
+ ce:5b:f6:3c:fc:e4:86:95:0b:46:87:f7:89:ab:36:7b:3e:78:
+ 1d:be:04:aa:fa:f0:2c:fd:a7:15:ea:1e:35:bf:3c:33:3c:b7:
+ b8:4f:1b:db
-----BEGIN CERTIFICATE-----
-MIIGpDCCBYygAwIBAgIBAjANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
+MIIGpDCCBYygAwIBAgIBAzANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
-c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjMzWhcNMzcwNDIw
-MjA1MjMzWjBYMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTE1WhcNMzkwMTIy
+MTAxMTE1WjBYMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMREwDwYDVQQDDAhzZXJ2ZXI4
-azCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBALOngc+jmzxXKo7eEwim
-FWpoCM6hoO/8MpVamrXMhLujFaD8KbtxDvNAIJc1kpKJNmpfvqUkWsgO91Oo4HQF
-kDghpSVyK1ZwdKrWMCXgld09SkhLJaeoxOvl1hBPlUKRsMtoL7+WDwqbKwENA64/
-t372HsEUQgR/CSHoPofAs9fdT36VtoMzj8z0uxGOZl+0MiKLjjSTgg8C0W+Fsqd+
-NgzzDZFG+aWR3GBKDevlN+N22BO7VTMjTLOQ32q2gD32vZ2979ONepphrAI9ELXC
-U9J+7hyQpbDo23GP01PkgLC2zLDy60bD2TxIAR06XNDyF5yajvwqNuccWUFmreHT
-gtiV7q7cq3KUywuK3+9w9/nid3ZkZy0C3BrbAuleYz8+B+ll5AJ4YlXhUhhao5xW
-3c3T9/JVRWIgzv1Bk7nCIJAjpEFPMFxeoJdvpB+HapeHcPnVVrdqzPEo0iY0V2Wc
-LUFDi2y9FW/szj6fTS+mIdj3TdFjT/CeBMOCM1g0IEuBDUINRGJIG0zP4GnkyPic
-mB90Nzo/I0A6iIDCnJu6arksOmemtlyD/ZM/blMZSOM9+vWOA0CP5q/F3qr4cHc2
-K24637zX9sdPAn+hrS886QhFL1ca8VucJwc6REM+BbFKG0KkkKvOS/fBm9fdbwUR
-+eijoZlsLic9sVRv67Lo+OYSb4ppBczG9sQtsAa2IVAoUNyMsoxlztkrUbhiVnC0
-Rk3kTKGGMT3jB39z4wlu7qcpKoAjirYMIp5DHKmMRywCbRPviKfX0WDZayiAl4q3
-/2JrKFQNq2M6rFeeL5Ur9KA9oWCgVxoJI+78TZtFg/IKH7N3Dpggsxb8lwMw/Ks+
-fvw+dmTLS03JbI+qcOwDxYExQxGa/C26JZQLc37BOQHKaHAa76S63BPWNxcJDcqq
-IZS7PkP9jIDmWP11I1rKHwsuNcLNdwxzsy+a5ANoWMg/83aNBVPSNNsJr3DtZwv/
-L2Q1LXEievLyK31tvoC9GDg3AWekX0gpUniftbiAcMoQauEnO8BhTpb46A9Csfq8
-Be8xkTirD6fvLIbBq4U2fBCdxwpr5isR3fpF59LDOsHNYCdoJteHSV/jfyYgH5mo
-+QCmDdUTgW78J4oDWGsOOscgoVwk0QimWh7ngT0hBS5LXRgU8U+rXOWB2sEs9hL/
-JQmXHp1RbR9jLpztfYZFsDVz9p+CZbx/RojhoWChN1AmnNd289yUiW3XvqYXoStx
-FDcXX+1aOZn8aa+7Y1XGYHtk2Lu3Sp+5qolLMB+c7yN6r34x3fvdCtUECoxXb2SA
-6/PubDPScsIkaKJOmYgc9ztdEMxO6qXLAECKqWMuGJLrsSgF/hnqezL7Y1YsCyAB
-kqMCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBH
-ZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFEM7JhWlYGI/ByqMjNr4dL42
-sjPkMB8GA1UdIwQYMBaAFBzHK6obsbsumvQPsYZgVzjCQQUSMA0GCSqGSIb3DQEB
-CwUAA4IBAQBcx05W6yEb813EVvq/beEN+sywfBNYudRHs960rvJFAohlQ4nP6pzQ
-6kVCNdLsvLRzA9uFe8fwaNfcK3BxY+0zaJ8p/2cKaTvEZXwlAM9/7qr+RBlw8nTb
-2p9SkhoD5gpJhS4qAsGB1G3PmNHpai+7+qbVS1U4wqqM9dP55nTbANYp+dGceg6Y
-xeWMFknYz+6gy8IsMc9iLLF/bWCwztUHRehEF3zEEvsAVyRX6Bd4Ox4NkapnmNDl
-moZLiEovVV0uE+z1Sn3nE6dXA0Ev9mwIjljvsHp5MuO7S+tNQs1Cli1n9kzB9mL7
-wD4JaY82fvrIzf9yPt+S949Ez3f+bnTe
+azCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBALn1eEZT4DwHv5f7q76X
+cdWJRL/bDli+lkIGntwI91HWJ39lLcce90xbP+V6+P3fc0KSDzdeKK5RFBO+s1XU
+25r2qYiEAnn7+cRn+ZaZaIBYSiLEoZDAM1jIltGkf3+ehKbzA6MBk8sdq/H1FygD
+NHhtR0YHq/jq/wKK+CCSos4pambQOYcvYp9D2aMLdImr99k5fWzeBU5YTTUV1Bgt
+6nDfYPxQ+A21jsDGA3Q7jVPWh6KatgpagKXM3zCnlTCtUGLhATqO7uFBtJnuzovK
+VSQ+fAB5CPRGQuBjk6PQWjn8fvSWISSa9ykNIoW2xcmcknFoWwPe+7x1+A8k6gGS
+tzfgeKBkN2mQinyZx0X5kKJQWeEcAq2yLsc7Jux2bRDJ+S/cEodBcgjsChyum2/e
+V6Sque6DpBTE5VRmMl0hKqNtLY31jgiiow0Hg0sKJwucf3N4+NmcHtQzK6c1tHde
+EtampNLQrzC21R8Fmx7mrsiljLa33MMLGoVa1b2+ZcjmpfA3OBbSsMr/LqHyf44o
+xZzU3r4fI0NRhfnl+6hhYZZQNK11NPpG6SpmGkOc5OV5JrcLXdEdgcZSF9eVE55l
+ZJstDSt6BCiqAt+BDPODPXatQOb4wLLzCrLM6PLIrCHEkH1MtlDYtwoVEl+l4MVo
+j+1N9Nm1ct9jydYU/tj82zFyHhXV6KzZp9IKvKemUV8NDyMgLTS6RGb2geOq/jgR
+YewDP2Rvk/UtsL59b0lzxiNne0baYmcQ5Oah5BtQD/9QUQrc7hvj7SAwOsE3FySW
++v4u0HWzm8GuFay6/rTVM/8zhvNeJPdFja2wR2rvnA73Bw5xoOd1SkJZArcRhtZl
+dwY69W+ZO5tSz+YwWeMoGY7CX+H3KHT/wtE1kZbtUhRKPJEZUHs+BGX4PtlsKc90
+2A/f5M2Uc4HvGZ5LDD4uJP2pxnO1fO3RDnKsyf5epi3Xf8rFdRjLPidiIM8QwX/T
+b6nUeJg79gzgX1SzCwo211k0w3BcWSXPVOB/7KM7xKFvvh6+4TbG0ya9hq4OcyaJ
+PH9yoS0AZrHi4HRyhhLCa+TnmXC7mIHDRGXFdiFi8a8xqnO++7CGplviUXjmahtY
+P0o05pmI5ByxgJTyMaCwJ4GxGJhvUy50oMMt5/aSJ4BApPM64q2EZILtgD/gVOg9
+7HUlISovTwhhvrbg+73sfjsX0qS7uPg/mi4S67IARVE6mVNutQZei48KtWEsEhBg
+TSzebuiA+JmyizZhM4gIYE8w/2HSzAJ1XdeNBuC94+A197r4puQUeeRiTb/qgf4e
+ASRp2okawRE8UPGjsyffzBY6A5eIpJJjpo7JGPUCFqeypT33EgDk4VWWFoRuA3A9
+zksCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBH
+ZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFHQ0uZpcGieDug0F+Vtbpva7
+GozoMB8GA1UdIwQYMBaAFMpxmYnwcqt1ZrtlagMEcqV7laaTMA0GCSqGSIb3DQEB
+CwUAA4IBAQDm5HUibFzq8zyFHjxipJu8Ukkq3d1+lMkbyX5P8oLOaKIXKbdzCzkz
+yobEUa3ZGOfCQrjDqUyPVCR58ieeW6rlvDbrEbWRS3t5uUGw2XJT+61nfnp+DQae
+RX72X1vEdx3R5dd/jvZkKn4Uh/S0pBNQR/dJsq02wCcV68CR8OB3vJPz2wFpEMCc
+4VsDmx2sPQzMZSST1o3cqtfVdH0LKmzswa0tg1aqKJSe4lSYHCi9RWPlagAgq0GD
+MQWNOOq7Na07KEZERz32iC6sRnOOEw2NXEQrCuO7J+POW/Y8/OSGlQtGh/eJqzZ7
+PngdvgSq+vAs/acV6h41vzwzPLe4Txvb
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/server8k-key.pem b/mysql-test/std_data/server8k-key.pem
index a383b359275..2dba202dfa0 100644
--- a/mysql-test/std_data/server8k-key.pem
+++ b/mysql-test/std_data/server8k-key.pem
@@ -1,99 +1,99 @@
-----BEGIN RSA PRIVATE KEY-----
-MIISKAIBAAKCBAEAs6eBz6ObPFcqjt4TCKYVamgIzqGg7/wylVqatcyEu6MVoPwp
-u3EO80AglzWSkok2al++pSRayA73U6jgdAWQOCGlJXIrVnB0qtYwJeCV3T1KSEsl
-p6jE6+XWEE+VQpGwy2gvv5YPCpsrAQ0Drj+3fvYewRRCBH8JIeg+h8Cz191PfpW2
-gzOPzPS7EY5mX7QyIouONJOCDwLRb4Wyp342DPMNkUb5pZHcYEoN6+U343bYE7tV
-MyNMs5DfaraAPfa9nb3v0416mmGsAj0QtcJT0n7uHJClsOjbcY/TU+SAsLbMsPLr
-RsPZPEgBHTpc0PIXnJqO/Co25xxZQWat4dOC2JXurtyrcpTLC4rf73D3+eJ3dmRn
-LQLcGtsC6V5jPz4H6WXkAnhiVeFSGFqjnFbdzdP38lVFYiDO/UGTucIgkCOkQU8w
-XF6gl2+kH4dql4dw+dVWt2rM8SjSJjRXZZwtQUOLbL0Vb+zOPp9NL6Yh2PdN0WNP
-8J4Ew4IzWDQgS4ENQg1EYkgbTM/gaeTI+JyYH3Q3Oj8jQDqIgMKcm7pquSw6Z6a2
-XIP9kz9uUxlI4z369Y4DQI/mr8XeqvhwdzYrbjrfvNf2x08Cf6GtLzzpCEUvVxrx
-W5wnBzpEQz4FsUobQqSQq85L98Gb191vBRH56KOhmWwuJz2xVG/rsuj45hJvimkF
-zMb2xC2wBrYhUChQ3IyyjGXO2StRuGJWcLRGTeRMoYYxPeMHf3PjCW7upykqgCOK
-tgwinkMcqYxHLAJtE++Ip9fRYNlrKICXirf/YmsoVA2rYzqsV54vlSv0oD2hYKBX
-Ggkj7vxNm0WD8gofs3cOmCCzFvyXAzD8qz5+/D52ZMtLTclsj6pw7APFgTFDEZr8
-LbollAtzfsE5AcpocBrvpLrcE9Y3FwkNyqohlLs+Q/2MgOZY/XUjWsofCy41ws13
-DHOzL5rkA2hYyD/zdo0FU9I02wmvcO1nC/8vZDUtcSJ68vIrfW2+gL0YODcBZ6Rf
-SClSeJ+1uIBwyhBq4Sc7wGFOlvjoD0Kx+rwF7zGROKsPp+8shsGrhTZ8EJ3HCmvm
-KxHd+kXn0sM6wc1gJ2gm14dJX+N/JiAfmaj5AKYN1ROBbvwnigNYaw46xyChXCTR
-CKZaHueBPSEFLktdGBTxT6tc5YHawSz2Ev8lCZcenVFtH2MunO19hkWwNXP2n4Jl
-vH9GiOGhYKE3UCac13bz3JSJbde+phehK3EUNxdf7Vo5mfxpr7tjVcZge2TYu7dK
-n7mqiUswH5zvI3qvfjHd+90K1QQKjFdvZIDr8+5sM9JywiRook6ZiBz3O10QzE7q
-pcsAQIqpYy4YkuuxKAX+Gep7MvtjViwLIAGSowIDAQABAoIEAG18dDwatQx9As62
-wFrQ/NQwOs3S6sXWqO0knoyU639+0Duf8b7uE/Ji7nm4iG8NeEAzwXfbRAgQNuKh
-VMjgaxgKSR8dCRRQzIkgp48t46dFJvQP+A7JZ9lr5J1kIs7DAz+zawYTaW9JSVgG
-mmujIS0ayXtZ4THkSaiEZTdOVUwE7+FxVB15WvXJYAg/BFzm8HblHfEkxGppiUGx
-9ULmRAJ4TZhv7Mzeq7Ny7jEJLJpPXzgHPtE/fgshC0d5mYYpzT1I99OxsTpMtAtZ
-M8nReEwcVvjJnnDGOJZo1J2X8GXBwdVE9eXWjZmTODqbytz77S/fcaxz/amzOSIG
-dYne4SsllKS0jzfxPhz2saq26ik7vxpD7i0cRQ+I0alvgISWRTQUiHSI8UTtYJ6+
-/l7VAa/isoTZOsOmwv7M7D6U9EtjrUKwBAUHFk+0Fg2w9WELhep7/bEiQWvnOMtX
-sruWBm5zv5CxW1MuujKn2t5jHNWhQaeOIrW9V6Hew3PJsLTTHUVX2Ikc8KZLObTP
-XTtGE993cADrYYxPH8l40QCHB2t6bM2maBTRy8PlMFMsYaM7rqnftlOuXyRYLm97
-oO7F8InpD1mDND4bBKbL3UOgl1QW9dbb8KOn8pERDXD9Z3K4ewyORiyuONXxBAz2
-QiaQ4gDJWD6sEySPEHcpDjemi6mKJFtDw935JxS2brso/NHoJSVdcNxisd2irA8P
-U8jyFTrTm7cO0nKFx9vv9r5dsbkqyQnJ9V0q4/DoWvnkPElKuvTeJMw6CvTjfvc1
-xIf8m3MQJTN8pqPpIOSj8DIhQIJBEVxtcajg+vlMuefR8hTCdLzQV2QEdLGjNGph
-OhFuHrHw1b3I4nCyi9MOLzpdUDgZkaw4hPg38u71RJ6bUF6pE89Yj04/svB7SZgA
-sE8+/pZcASZl1Y0T29OM3qFJvukBWwsNij5P5SLmTXDev+DXbzUvmVLCk8nJkJ5m
-n1peGst0ApHnEzxVhU+9d5FWBdIgN7fp7V2AlFt1r0TRWUYndBn9/B6xiyfd5iyK
-LpcbRjLpQ/9b3SYQZL9t65Hc40rP35rY0luQTzVd6E/D041E0NWdpAZai4GrpMKp
-NUBXBbmwnCZEzExLi78We6aF5tG9Vh+uxyYUXlrABR98jONgYIvnWaATaw6oLgam
-B84RhWUa1f+K70wrTorUO8QNvYO2n4jpwJikn4H9pFvvzzoOB7RaA+EF4HjaVmQr
-Jm6S18c7sksYFGIJYsPrXMtgOMQVYiQ3s8LDgsWKoEQYgvgxE24AoXGlXXbALrpo
-4WvRN7qLAm3n2OQYFUK0SGoELOADQFQhbNL91i0k4wzQ56ofQCb8aTmm3q76TnbK
-4gmIUIECggIBAOm3PhMqIKb3ZEZOWYMKByb7v8seuVh6mwXmgITcZIiA2f8rTfyH
-OZanYK72FsuGZEbf1ELwNUX0JobwklA1Uq9NajaJUdfe4wDpghf282APHK1nD3m3
-FX7Rsoof/dW9+bV/IIbQDwy+1ctB20m6dejt3kWyHSXly2y2L3bk1flee8oi+VCO
-ROp4u23KJcglIYlL+cL1z76lX41v8JW3deCTL/JStmK6zuvFhY5fTlOGxsLhAY3X
-VTZ0MNUpezlBaXTixi7ilgbh7rJSpCmeno5my1hdl/5Q5U/u5F5E7ZxKxlhuVWdA
-cf9qbtolSsgJ2w8axPD3dLnQ6wsNnl4yL77TdNr8OlbwIADXHH9VzZbfEgOhP4r9
-Cwz4hIUbylJ9QGZVsEVZhvqR3M6OgqlYOmC72nLPXVYbL/Rr7cTx8t+WJ4wJRP3l
-pi6AgDZXKbMKyMIhM1IscSR2swtAFyl6g6rcAjFyG+p1IKMOQ3YOqdVVUf5UYSpo
-NBTpJ+ho3CyQJK25yT2Maex5Q91M6Rk9vmXaIs+K40t/zu8cnCIH9j3In0BrpSi7
-WUyLgzXW+7ZrW7cugC93VVgjGNbgBiDimZ5duViI+xY+3OlrsUxzSHN+YY+8H2G2
-TfzT+Mgo8lJXH9tseFBLvRKhoPbbCyCwnOJ6k2k8/iqZ2eE7vQodyW/zAoICAQDE
-yK5Mlu0k3oTVasgYRNDYKJ9uyarVLaRcN6UjzNUSta2hABzQe/LG895EucK9yVa0
-4jT7EXILYQpHnQkaYtyHtN/deYWLRObT6RMws7te2MhwzQkaNavgi449dHP38TPS
-qy3Vh6v4nMhRjkhLqNiiJoDWThtkB216t+71GxdF2l9trrcvlC6q0Z65PR4LK3B/
-3m8KmlyGN940Ovb/4kEh2EZmNwbMq+3SaXiS4R7ZvKoboyNmwvCh4t5ne+NXz3Vm
-7srej0cnOM54dTuNVdXm6pajYjELNVJGsK0vo6CAZiAOyasFkwMFMr5w/ehBaZIo
-9ewWjvgDdvQ0+JBMVZJot7e5D4tUgVTaIMpQryzAp/u3r5KC1bkcC1Zie+44CaPr
-V2FspEyYQDPJHC2tRj33lbaCWDdfdhYhv6uzlcM9ExPj+RQA0xlCuxh1pxK43H4t
-PdWvcIeIKtFRWq9gsH1/wDBaIsB5Kykq4xyvMOj3dyV+dyIO1D3GG2+ZoBt8gklk
-ieDIzCMKsXbomgm64/Ewlx9tf1fbTouSWP1+Gh0Wne3sCEtCY72ebYgjtaA0w8Xr
-HGTsEdw/rSer46uULYWXYC6VYZwlyTbPh4NSD7ATrQo6HnaKugtuya9NPfYD9S9w
-PoXPXpNKvwSq9SA/XsodHet9uU+IlKnYI41hVGaukQKCAgEAu7dAFmh5vWFqmsWH
-Q6akQ/1j+KL+v0AKj1yp0Qyreq/zZ+3CP5fk+0oIb76cZG/Wzs4sUG9aeos0/qDv
-A5kwhjipnJACul38+diTcugYZgj9QZFLbrlMfIW03xf+6tQhYlNvLpih3dzRHuYQ
-WVF4LtQO+O+sVaoSD4js6pO2AQqQZrRchwUd+S1rbS0112FrZDkvrBV+/GMbMiC8
-naOy++N8WSdx8i6Uz+3f7ZBC+vd/YTsT4ncXrBr6tdsRa9VL/GPARhwb3/9LltKl
-pAAQ3dNWc+0IjW0wIVmA9u5p4mR0lsZXtgyfA0TbMD9PpwezeJhJojk++ZgBkOkp
-UAMDMkPo0ZJQ0U8ghUxBSU0DSbB1aZDz1pCTdaGN3tOJV2Pee9NLNwhHT64kKYtx
-Cs8gZF29gQVotCY2CB0/5jVmm4qgzOsNDNiM90CiugKcLX/162Z7L/8eCOmFuP2L
-HPeYFX2MDWbXYSMeSZjFOmdgpUZYCux+9m6nljwGn7bJUMmdjCNyrQrAcPydM3v4
-pRtgd7ISz5uAID3RWWAjT3oRn2Ip9rX++44ulTpg8rdviP8FtUWWE4nHdHkMFFnu
-0i7ur7Ibki7DbQSkrp6e0watJIZXmfjBQ9wHG5CteybYKqZrofOnVubeP76t6Ffa
-wjDYcVd+WsJwaosT4sH2fc+a4V0CggIAX703N+ISHGb6f47FLTGF3jTdZJxPNgpP
-teIIwUMtwz2K7RLN8gzr0Cnj0NID0iw7uCN6HVCeiLS8uJzJSgIhQxEX/XvbIify
-mdUC1iYLmhikZGUM8ah9J/Ed0f5vUYkTaoKH+SRZ4cn9l9g+ijjqtPFAq4Myxlbq
-x9LnOm7kwsJ8vTNMwqQ4lDkKHRuEG3EV+dAxfBofu9lAjW7GrzXX9Gxxy9cnwro/
-KajQ1b0bMloc9PdJCPz87/YduIFI2XcAqoSxRNi2iHmV0ntO7vN87yzg/zqNm+Nk
-VSouCEh2lSGapTcusraUuJm4l+agcfq39p+3Lj5+ocjlBUSNh+X2JmaDx1Ctu/50
-Vu+vHtQrVMwlpneQM4Fh3ygQ7jdXbgIasyw/JQlGjqhlyYmhG3VaPrOjKQVcY2Bj
-YiYLloLdi0BV5AtR1RjfaFz4iH0xmakE5mP4K7P27KPQVOFnBAa5+EZ7/856kDkU
-fV4jnYSRQ5y/LCkv88EFEPZWNIr19Hy60mRWbbsLrW8r5/zRkRDHTpmn27EiAHvV
-Ye1T3187Gb7ae4SJgRJftc2ad60s9Z7uEvYsj8Icwwoui+1nk98V6NENuPXVb3jW
-5t8KYAlr5BbDLAWYLORZHZyYYl8r6z8FxnlUxtA/nxUSY06BUvN+J+5fnTpkXJHf
-lF2vslPK5VECggIANpTlrc5Zp9c0jPOiBQT/92LdtMR9mB76WB8fX9xn1Tm7V/cI
-MatRrFzaTvi5HqHxPWJJ5cgMYKQw8kHHk1q9U7jeexZGCICFOUjk3N2Z0aXIWrx+
-hiS1i5DzRaZNI682s436cdaS4GpZIhqjIOR4/JS15Nfu+DVqyHOevWnd0D/tGoJB
-JpiePYl2k7b8sirM3bHnRDtBiMHrHyHxzpdTLImDLHXr7C5DTeQAzzo+YMu45mNm
-utKq3SRlO2wizj0qpONgJ6cHI7pypAPalliA+hPRRJqaHmTr7LpkP3+g73hf26wK
-PoF6CLkdaN945F4Z48/3zEOP3XRIQocMA46ayA+8TsOpx9rm8L1LrF1pgmJi5Ml9
-3yV93ZZ/w4Jy0pqZ28nn3gcX6JP7qtfgioLLeyuuBphpOQXl7Ys3w1d0EEErpATU
-tRG+BS16o+FhM1iXAN8c8HrqOtyJzCpYnuoWiNc+G8BIn6ox3xmihwK4hiR6s/OM
-Mxaa6T4FF/IWIzuCezYPGgybWMXj3nRHsD7eNP170irBLwS3GdD1HWM2BpmLdJa0
-m/7QQkONhCnNFtjIalfPWMX51z/8GOKRKWH5A8PY6CxVHRg1ZfHT4TlfbdRPIG8d
-6JrWt2s4eLv9VRdM+oMifHR4qvLDgg7R8pBr2FSsVXM9U2+j+drIeAhkjHI=
+MIISKAIBAAKCBAEAufV4RlPgPAe/l/urvpdx1YlEv9sOWL6WQgae3Aj3UdYnf2Ut
+xx73TFs/5Xr4/d9zQpIPN14orlEUE76zVdTbmvapiIQCefv5xGf5lplogFhKIsSh
+kMAzWMiW0aR/f56EpvMDowGTyx2r8fUXKAM0eG1HRger+Or/Aor4IJKizilqZtA5
+hy9in0PZowt0iav32Tl9bN4FTlhNNRXUGC3qcN9g/FD4DbWOwMYDdDuNU9aHopq2
+ClqApczfMKeVMK1QYuEBOo7u4UG0me7Oi8pVJD58AHkI9EZC4GOTo9BaOfx+9JYh
+JJr3KQ0ihbbFyZyScWhbA977vHX4DyTqAZK3N+B4oGQ3aZCKfJnHRfmQolBZ4RwC
+rbIuxzsm7HZtEMn5L9wSh0FyCOwKHK6bb95XpKq57oOkFMTlVGYyXSEqo20tjfWO
+CKKjDQeDSwonC5x/c3j42Zwe1DMrpzW0d14S1qak0tCvMLbVHwWbHuauyKWMtrfc
+wwsahVrVvb5lyOal8Dc4FtKwyv8uofJ/jijFnNTevh8jQ1GF+eX7qGFhllA0rXU0
++kbpKmYaQ5zk5Xkmtwtd0R2BxlIX15UTnmVkmy0NK3oEKKoC34EM84M9dq1A5vjA
+svMKsszo8sisIcSQfUy2UNi3ChUSX6XgxWiP7U302bVy32PJ1hT+2PzbMXIeFdXo
+rNmn0gq8p6ZRXw0PIyAtNLpEZvaB46r+OBFh7AM/ZG+T9S2wvn1vSXPGI2d7Rtpi
+ZxDk5qHkG1AP/1BRCtzuG+PtIDA6wTcXJJb6/i7QdbObwa4VrLr+tNUz/zOG814k
+90WNrbBHau+cDvcHDnGg53VKQlkCtxGG1mV3Bjr1b5k7m1LP5jBZ4ygZjsJf4fco
+dP/C0TWRlu1SFEo8kRlQez4EZfg+2Wwpz3TYD9/kzZRzge8ZnksMPi4k/anGc7V8
+7dEOcqzJ/l6mLdd/ysV1GMs+J2IgzxDBf9NvqdR4mDv2DOBfVLMLCjbXWTTDcFxZ
+Jc9U4H/sozvEoW++Hr7hNsbTJr2Grg5zJok8f3KhLQBmseLgdHKGEsJr5OeZcLuY
+gcNEZcV2IWLxrzGqc777sIamW+JReOZqG1g/SjTmmYjkHLGAlPIxoLAngbEYmG9T
+LnSgwy3n9pIngECk8zrirYRkgu2AP+BU6D3sdSUhKi9PCGG+tuD7vex+OxfSpLu4
++D+aLhLrsgBFUTqZU261Bl6Ljwq1YSwSEGBNLN5u6ID4mbKLNmEziAhgTzD/YdLM
+AnVd140G4L3j4DX3uvim5BR55GJNv+qB/h4BJGnaiRrBETxQ8aOzJ9/MFjoDl4ik
+kmOmjskY9QIWp7KlPfcSAOThVZYWhG4DcD3OSwIDAQABAoIEAQCw8nPtL7jKRnE4
+VIEbDY6DK2ggy3e+WDQwRY56P4ne9FGHNqa1t7CHlriZS0eMg0hwyvzxqYY6QOpC
+045gGPiSXy34ueyFWJBVJL7pX7aBkgGRTduTGmCBlfV1LPspW5RMLCeEv2Z7uxM3
+XAkZyNrv0MQmTfyFEk9vgv8SN5X1aJFXncFv8lX8yJpaO/c7XUitCbhglG8mGn31
+Cn1UOLTBjL0DuqQen2lj48e7nUMgyJ0ty9t2xKFvox+pc31R4UkBnasGpqWF8HjC
+lOszN2eG4nIqHQG5NvZCAF6nXQXN8YZ4hDarV03iYR49cCqKapMqmKsqZs7RiMtu
+1ahZsNror474yAO2TpSIdeeZnRzUZnLv8jBWSZubdpzWGuYzOI0FznpO+6Zf+QKy
+Qi+j5kUtakscO2UxYh36DnjUB1BETAox77ukWeWe60wyZkm7EcJxBWZ94sGvF7Xt
+GPxNLVXtrIpgE7TwPLlVGId/gvBD+suHvjKx4WnuBP4n2/mMjnTNvC2CAh+6OdGM
+xmw7wG4xipkc/hIW54b9wKqTkX5DgrRtbX7ou/r4nklVlwBznrGJMaam6lXneYw4
+ViFh8ocl5VuHyEYWz5eGR40kVfhxafC9F2x9myjN9I+hHfQ0+Y6nvAwrp9ucG2rt
+WrEkBxgVLb3UP4U8Lf8L19Sccxa714PNuO9OBcGODmHNPceDuwCDOaJhKChgl3Dj
+KNM4cxtUh8WnKfsDQxzP4ShX6dGxhY6oGCnimOoBmv5PsXLdlSrLMaDh3OW6s+xh
+1okitSGUfcxsMG5JrokDT4dX8jLdMpF+qOl9BDYnDBitzdDWh07txedwIKX4roG1
+9X5RX9Q0chjrplGIcNuZOOJp8zWAoVdwrTnPNX6bdMntbQMbHXMqJWsXBNC+VWh5
+5bHvehut5dl5E/DsdHth7hTvXHwhFLmAtRyGmMjZU63Anmr/UBz6Tg9+s0XHcJQu
+7/CGH5vUXR/2tCT57Prae0x+t7pbhLxbBn1z95u2IiVjahJInlaik3QTjiFZnMaZ
+OuyAe1IBkkNuu5r3MjQ5OSQyPX9sztS24jFh5xVER59YDnCg+pv8zMEmQ6y6wY0/
+O2HwOCiwMcFktAn+qvjRnPwrwmWvcnEpViff9zhmjkLMjYSXYWPXLr541Vvy3Fd4
+izlEoFUM3jStYPKukDCGifG6j6TRlMlrSNiTr07bjDiiRUfRP8nNvS8SYqDx0ukc
+bOpTYmJLQn4PE0BB+nsH9qvC8jA3Etx0NH6Bn0haWYdOFaTGeiWAHHRCairNreFZ
+PU0rVrX6NgzUiT++HguBuDB+eoNOn9/TI+IMVHXT2Z7n/kiOh9OGGJL1Ej1ohULa
+cUcfYjwBAoICAQDo4d48xxnjhEalY0Y0z3b2uP4sUBhgyCBs3Zf2/wEIiheJDmae
+ewUU81IBT2w2dwnCGvynxTGJ4hkXPLr5DLjB1HCrG96t/Oc0lmEO4c+SCrJnaf2M
+9e8Wx+zfL0rqdIv6OFGVSw2vUE+eLcN+UXXbx5DvEpz2PP750YILPpJEMXykZUAE
+cxObKmskYWj5rbGf5SyWE8umGnn52TS37a9T5pG5og3zoMeydthSiS4/jC1u9niq
+YXOJ345uhXU3HCjKbCbeMXdYONV14um8fizY6Hw8UD3853uDjxisDh6uT9s9L9PN
+zEaSCw7DLNvtYWfb74iprZSvu4F7iQpN/lclNTnwLHV2XGmsmjbJBSzWK2Hgv0C3
+xzpjj7yt5IAM0w768PXE+9yisR/91Q571pf8afAlqsdjwE5GILw4VnRxiM2iYjwK
+9O0MCQHWhHeB6eFetKeP45QNXMM2BBAkUQbRdY4MXvg6k9pVPXzL0ZFtjzwImD8C
+zk3ucF/+hcPctVc2B9boFYQmstG4QGMRhpX2cwXckGnQalK65xcKRYld+lswds45
+0cRtzyBCHm5xt4rGeTn985XbB2WtMSbSSCKfsf3yFy4vLkLjwHlYDkBkBKvJBD30
+duT9g7fInF5V9aSNOYqflS5a+9XR9rUFIk4NPTWKUiozOCbHJlD3iPe2AQKCAgEA
+zGsobIOxluTC2P1d2tCs1SribdC7jFFT+vpzJOftwZFt0taXvifMATcKTvl1UEBz
+DYdyvcDRWbfmWjf0xhjSrhHCHKsgl7MOeOcPiog0LJhOLcBVV9Rsz+6FEMhDQtcl
+z/4FyHWTel3pBKkdXBVcqQZdxNV9Oxn2KusKPMKvoRwwF8RF4Bzvh4RnCOOLbUDY
+0kWKJ/1Hg4XbAO0Ll+efNse7LGA+KM4hRzAQLHWYbUEqzgXaGXZwNRb8qSkm5ker
+NzYee76sM9vfXsNQk2fa6R1H2womCq926DHzFf+DXNAWJ8xf4fKWSv0rtYRH9t+c
+01b9/a2/ViaKySzymlH1scgKprNSMSylF228A3XbiJkz8vRki+itxPpMNrEIlbdI
+J0M/Qk7Lu/Gz0aKkI1oPB3qs6mE0vaYl2a1kl+G5UOaOnacQjrXDlDDQY+Awi6yC
+S/nPrkgs+Y+tx5k4UQnm8VIPUhQGha7BJ4QulIFrz/+KuqeVGy06lxvFiiNghEGO
+NHLyTlUIJiybuPDLopQh+U3IVwDPIoiLMAfxaUecsjq5S3vaYP+ThMoJYZdCPd2P
+McgkVubxf/DmnBievNjlWJNt2obuFBCG9ScsRRTh0wddt324IICFTg15B3Z8x0Kw
+QkGvOp0QX360wMpAVxyrZQvaC64qf2/Akc1ajjGDfEsCggIAVhM90BsLD5PRhMmn
+pldUMib4Eyrbh9IQYgyZYXqpSB26SzceaM8xdqfklIVlis/+tFbDMcNp5vvBqFwT
+A4BXPZUmu6fGa2qBjmdSomyGCwWXITAEvjgcUcA9ZdSWDQhcwHRWeybNfRHjC6UA
+j8zOEhi2EhdAGqc62t08Aqny5++ekSi3O63I/l30UfMLGNXBREcxbpsMd21rzhQh
+LyZT2l/rVsB2BalUhjr1A7SeenB2ToAc42S3jqspeuIrC96FmSPWTePcp6gCBduD
+5t5/9wAfAy/paXOprFuUk+t4HZd4gioOUA+DufEKWMtY0mlhOOJVEdoNjdJxLlbd
+jyxFy4Pb0VCtbb0Edf5d53jZNKO+PpKR+htSEoCLDX7acWMFM20ieddZmmx7VZeN
+DeqoLGx/jXyMy+rFQ5hP2UbjLR+SWcWTSb1zbDJcEozNmx/148pD8KP+Ed5KbMmd
+qb6lFYAsq5fiicwiM8VRPghMh0EcwFR9Xa0hEtNIN8v7M7V28Yp+PTPOr3sCluZ9
+d3nWLcwfy4E5CwZxY5GMa4h+GFUzpTsUSDynLKsU0jtrOO7NBUTDUYDZz6XxR81V
++v0chwgDw5obwOaJZKK8dvZ1iEJNuDOwLo5PXwBzSlu5Zm4vjt9IxGkgRBK22i8k
+gyxFyxDnnCN4Y4wKkSsxW/ytCgECggIAP7+zTZQMT/hrY2wwVsr4+0lyb7jGpE3A
+mOZ9/iZuGQ2XaEcP73dNwZs+lb5p/Wr79l4lRFPbddVJ+xy0MwsOuMZE+NfNREHM
+45t7V0J+suGUj+QJOWi/vmCuErvBbhjWa/TWLNut8F1VC+UJiOwIh5W6rGW/tiy0
+flHqUWSNjPrTbLYC7I9Zi7OYxkbf9mRgucKCAVKVeMjHsZQ7J1ZOarEDCCXDfMo7
+yo2MnbDWpkvKY5GjoIk1GPlgNgjlXq8/D+rKuuCNp2aMVGsot6+Nr2E4RXD2yCJM
+PMFHA7c5ajpijmrIBBi5Eg2+Ec98+dpmd+oLL499ugovAeoIhmPE8XpnB/GoUjmQ
+CqxoE9QvcHwGnV/l81POzT0Zg3zWJoqP796i3bThCG2qHFhSQ8wUH8r8HePOpM4p
+w6a1VkBIoJgmJbgyC69XnOFUO7Fwsj5MLBFt2PYdQH60PSjlTTB/WwayTHB+UDZd
+ektYk2uBCc6xnuAgOedy/CjnA9tggB5JkMXAFvmhnvYOYjCF8N+tcKf3MFrKPgTD
+E2mGucRhc5uoqYeoZNOPV7wCDPM070InI+k8m/VNnw6rfEaZSl+BtovTmHC30n4M
++GsM/UYz3rHPYifMwiYSbHL7KX6kDygW+7KsSOUuc/l5uR3ZztDcCpkVmMrp6fAZ
+595YvTtnu90CggIAV5tGE9Bnh/W9NoBPTuL79cPuNeZRVo/4zSh10LWiSoh+39UB
+uVbWt8Y5XeqF6iDx/gyO5qauieF1ZZ27CPrqq/E/SU7FW2H1zKWlyvGWA6jW9mZy
+HTbiZgGoNhYougQIt7NN0U3DXqf7+Y+m1vAacKOkoc86U5dK5XtMjhxhxoqWUOSv
+TZR6VkHWhiMDNAJSmdkUojf8FwtCFDYXVoxQxVeF0jMN4S3DEjdkpIhnpetz4b9Y
+q62SIw7Moz8CABL9VMI/L2masrYaQMm0GW9o3hHkwV8t9+O9IgcbBj6np2yw9uIS
+6q9xzOHviBtbHCBieJwvKjIvbWy84MiGYdutpOVom4Wo0AvehLxgc10xpCc8tpDX
+rq9WjyLRAkHQf+mUXzquBoVJr/pQOF0tlqMLhicOELHt6Y3kGVAqLqlQSiiOTfpE
+mkRDDDbj8pTl9YneAC6asosEtukL8IJv7Pwiz7u/OSD9dZM8SzyhFMJ8hLRg6VZD
+upFxO/n4GZK/F57nivdRz3XhH5A3sx4Dh6moLAF7NwBaWL1vTcV5f+MNCos1psC0
+2mQ3YORQ+OJRMb+uUOCre6TVeii0KjEiLxVuptw7NTXsUAPKYvVMzp2yZoqSkkaD
+T9lytWVuEUmoZX4BAHsI0dpq1G5nT+9cZRWf/qY7wlUKz+CPg6SLFdaDmG8=
-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/serversan-cert.pem b/mysql-test/std_data/serversan-cert.pem
index e47779f420d..d40127365ca 100644
--- a/mysql-test/std_data/serversan-cert.pem
+++ b/mysql-test/std_data/serversan-cert.pem
@@ -5,56 +5,68 @@ Certificate:
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB
Validity
- Not Before: Apr 25 20:52:33 2017 GMT
- Not After : Apr 20 20:52:33 2037 GMT
+ Not Before: Jan 27 10:11:15 2019 GMT
+ Not After : Jan 22 10:11:15 2039 GMT
Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (1024 bit)
+ Public-Key: (2048 bit)
Modulus:
- 00:a7:74:d4:2b:80:cb:96:08:2a:b9:c2:87:18:0d:
- 69:2b:da:cf:ef:21:cb:05:d4:80:2c:f3:85:bc:78:
- b2:42:d9:9f:f1:dc:47:68:c5:af:5a:c9:01:f0:dd:
- 91:cb:3a:b9:38:b2:36:6b:a3:66:ef:cd:44:0f:8f:
- 39:57:60:ad:3b:44:33:51:c2:7f:cb:5c:8d:55:b8:
- 1e:e8:80:e0:ed:9d:8d:10:7a:42:68:73:06:63:83:
- ce:db:05:5b:e1:7b:f9:0e:87:20:38:b8:11:6a:b7:
- 59:3d:4a:ca:cb:60:e6:e1:73:d9:a2:24:4a:70:93:
- 5e:cf:d5:04:d5:ad:ac:96:a5
+ 00:be:e7:9b:da:e1:bf:fe:e6:a4:6d:c2:20:8a:1f:
+ ea:8e:1a:a6:3f:57:93:75:d8:3b:80:55:bd:f3:fe:
+ c3:1e:50:0f:e9:66:0e:bf:98:98:5f:06:95:fc:4a:
+ 9a:b2:fc:7f:b1:e0:d9:ef:df:6c:28:d0:12:98:bf:
+ 78:b6:f4:1a:94:83:a0:3e:bc:d3:b3:02:4f:4a:96:
+ d9:30:b5:7c:5a:82:dd:ff:96:72:1c:f5:ad:80:bd:
+ ec:f7:fa:9c:40:e2:37:f5:86:b7:c6:b0:bb:6a:69:
+ 77:77:e1:2a:b1:03:bb:1e:bb:e8:b3:7a:2c:bf:a6:
+ c5:6b:4d:99:fb:f3:84:ec:ac:a9:2a:f3:f5:09:4e:
+ 5b:75:18:9c:68:f7:c9:2b:59:0b:41:33:60:23:fa:
+ d4:f8:64:e2:51:59:37:29:f2:bb:68:f5:6a:47:69:
+ 58:ed:a8:bb:11:9d:6b:d1:77:75:01:da:57:5d:3e:
+ 8e:bf:f7:b1:7b:69:df:53:22:5f:7d:c5:ac:b0:80:
+ 0c:20:ea:9d:f7:c4:52:d8:31:03:07:b8:84:a9:74:
+ e3:2e:4a:68:bf:a1:84:c6:38:32:c1:11:ef:f9:4b:
+ e6:79:f4:7b:7f:52:f3:36:4b:a6:d8:a5:ad:d2:02:
+ 40:89:42:ed:ba:d6:ea:74:d0:6e:c1:bc:02:33:9f:
+ 0b:ab
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Alternative Name:
DNS:localhost
Signature Algorithm: sha256WithRSAEncryption
- 4b:78:d9:09:4c:25:cc:fb:17:8f:31:13:ac:d7:36:2d:5f:d4:
- ce:94:84:d2:a7:fa:e2:1e:ae:b6:72:1f:01:56:0f:89:80:c0:
- 01:ba:ad:d7:cb:24:c5:25:ec:f8:35:ac:52:1b:4f:af:7c:26:
- 8d:d4:d4:91:05:21:b7:ba:3f:6b:1b:8d:1d:a5:6b:7e:7d:be:
- 2f:6a:09:83:c2:c3:6c:2f:8a:31:fa:7b:36:3f:6d:e1:62:ca:
- a0:3c:43:b8:53:5a:4a:b3:4d:7a:cb:9c:6e:db:a4:ce:a1:95:
- 5e:26:d8:22:39:8c:34:0e:92:bd:87:a2:b1:7a:68:25:57:17:
- b2:d8:43:3b:98:e4:80:6b:7d:3e:ab:32:82:6d:b8:80:45:83:
- d6:55:f8:cd:31:74:17:8c:42:75:09:71:66:b9:e0:94:16:ca:
- 1d:db:1e:89:12:a1:9f:00:cb:83:99:5d:5d:28:7a:df:2a:87:
- b5:8d:f1:9c:b9:89:2a:0d:6c:af:61:00:41:cb:03:df:99:4a:
- fe:93:81:88:ff:47:4e:2a:b5:2b:bf:85:0f:9a:21:7b:20:58:
- 7a:1c:67:b5:8b:da:db:03:69:25:db:76:0e:f9:23:57:8d:8a:
- 47:dc:15:16:7c:2d:66:8f:6a:10:f3:b2:ea:2e:31:c6:d4:2c:
- 90:15:56:f4
+ 73:fa:07:e9:05:65:28:2e:72:91:29:f8:6b:a6:11:2e:e3:e2:
+ 14:6c:4d:7e:69:16:01:47:55:df:88:8d:be:82:37:bd:95:4e:
+ cc:9c:71:98:fa:3b:0d:ad:13:53:e7:04:e7:6f:38:97:ce:12:
+ c1:f1:c2:48:bc:3f:a9:61:b5:22:48:e1:8c:64:1f:58:14:e9:
+ dd:5d:9f:e3:e7:78:5f:7d:43:6a:89:21:38:9d:65:e8:71:c1:
+ 62:d9:62:c7:e6:b3:bd:cb:de:f1:7c:46:10:53:28:8c:47:02:
+ 22:91:ad:78:c0:21:10:28:a8:2c:23:a3:f2:c0:2c:c9:71:0d:
+ b4:a0:ca:37:ac:36:b3:1c:75:6a:74:85:a5:ba:c2:19:de:e4:
+ 3e:c2:3c:a4:cc:dc:8e:a7:08:36:f4:e9:81:32:ac:49:f4:34:
+ 89:84:e7:61:54:29:7b:c0:54:53:b9:73:37:58:21:32:56:01:
+ 7f:97:d3:a1:06:5b:06:14:19:6a:42:5d:45:5a:ba:8e:14:d7:
+ df:49:46:f2:83:7a:f0:d6:25:52:37:39:ae:37:ea:67:5f:7f:
+ 7b:6d:f1:42:c9:0f:44:4d:f7:39:2d:39:78:12:93:42:1b:4a:
+ 6d:f8:76:48:78:41:e9:a1:0b:78:fd:ad:29:f1:28:62:b8:9f:
+ f7:22:39:3b
-----BEGIN CERTIFICATE-----
-MIICuzCCAaOgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
+MIIDPzCCAiegAwIBAgIBBDANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl
cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs
-c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjMzWhcNMzcwNDIw
-MjA1MjMzWjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
+c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTE1WhcNMzkwMTIy
+MTAxMTE1WjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV
BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMQ8wDQYDVQQDDAZzZXJ2ZXIw
-gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKd01CuAy5YIKrnChxgNaSvaz+8h
-ywXUgCzzhbx4skLZn/HcR2jFr1rJAfDdkcs6uTiyNmujZu/NRA+POVdgrTtEM1HC
-f8tcjVW4HuiA4O2djRB6QmhzBmODztsFW+F7+Q6HIDi4EWq3WT1Kystg5uFz2aIk
-SnCTXs/VBNWtrJalAgMBAAGjGDAWMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkq
-hkiG9w0BAQsFAAOCAQEAS3jZCUwlzPsXjzETrNc2LV/UzpSE0qf64h6utnIfAVYP
-iYDAAbqt18skxSXs+DWsUhtPr3wmjdTUkQUht7o/axuNHaVrfn2+L2oJg8LDbC+K
-Mfp7Nj9t4WLKoDxDuFNaSrNNesucbtukzqGVXibYIjmMNA6SvYeisXpoJVcXsthD
-O5jkgGt9Pqsygm24gEWD1lX4zTF0F4xCdQlxZrnglBbKHdseiRKhnwDLg5ldXSh6
-3yqHtY3xnLmJKg1sr2EAQcsD35lK/pOBiP9HTiq1K7+FD5oheyBYehxntYva2wNp
-Jdt2DvkjV42KR9wVFnwtZo9qEPOy6i4xxtQskBVW9A==
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+55va4b/+5qRtwiCKH+qO
+GqY/V5N12DuAVb3z/sMeUA/pZg6/mJhfBpX8Spqy/H+x4Nnv32wo0BKYv3i29BqU
+g6A+vNOzAk9KltkwtXxagt3/lnIc9a2Avez3+pxA4jf1hrfGsLtqaXd34SqxA7se
+u+izeiy/psVrTZn784TsrKkq8/UJTlt1GJxo98krWQtBM2Aj+tT4ZOJRWTcp8rto
+9WpHaVjtqLsRnWvRd3UB2lddPo6/97F7ad9TIl99xaywgAwg6p33xFLYMQMHuISp
+dOMuSmi/oYTGODLBEe/5S+Z59Ht/UvM2S6bYpa3SAkCJQu261up00G7BvAIznwur
+AgMBAAGjGDAWMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOC
+AQEAc/oH6QVlKC5ykSn4a6YRLuPiFGxNfmkWAUdV34iNvoI3vZVOzJxxmPo7Da0T
+U+cE5284l84SwfHCSLw/qWG1IkjhjGQfWBTp3V2f4+d4X31DaokhOJ1l6HHBYtli
+x+azvcve8XxGEFMojEcCIpGteMAhECioLCOj8sAsyXENtKDKN6w2sxx1anSFpbrC
+Gd7kPsI8pMzcjqcINvTpgTKsSfQ0iYTnYVQpe8BUU7lzN1ghMlYBf5fToQZbBhQZ
+akJdRVq6jhTX30lG8oN68NYlUjc5rjfqZ19/e23xQskPRE33OS05eBKTQhtKbfh2
+SHhB6aELeP2tKfEoYrif9yI5Ow==
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/serversan-key.pem b/mysql-test/std_data/serversan-key.pem
index 393c0bc9c1a..84c34d63b0f 100644
--- a/mysql-test/std_data/serversan-key.pem
+++ b/mysql-test/std_data/serversan-key.pem
@@ -1,16 +1,28 @@
-----BEGIN PRIVATE KEY-----
-MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKd01CuAy5YIKrnC
-hxgNaSvaz+8hywXUgCzzhbx4skLZn/HcR2jFr1rJAfDdkcs6uTiyNmujZu/NRA+P
-OVdgrTtEM1HCf8tcjVW4HuiA4O2djRB6QmhzBmODztsFW+F7+Q6HIDi4EWq3WT1K
-ystg5uFz2aIkSnCTXs/VBNWtrJalAgMBAAECgYBReSgZmmpzLroK8zhjXXMEIUv1
-3w02YvOR61HwJxEkMVn+hNxBf50XoKDPHh5nMMUZbqvHpxLYLZilsVuGxcTCPVzw
-YxTooPcJY8x61oUclI2Ls5czu/OfzoJhA9ESaFn6e4xReUFmNi8ygTMuPReZZ90T
-ZvDikonKtCCk99MSaQJBANrmlPtfY57KJ18f1TqLvqy73I1vQjffSOrK3deYbvvB
-jUJ79G9Wzj8Hje2y+XkkK+OIPcND1DnoTCTuqVazn+cCQQDD1jy8zrVg/JEPhQkS
-BM7nvm4PIb0cgTPrOhsHDIF4hbaAZnA0N4ZEJ2q7YitXfOeR98x+aH/WJOrzzhmE
-VXOTAkBQ4lK6b4zH57qUk5aeg3R5LxFX0XyOWJsA5uUB/PlFXUdtAZBYc6LR92Ci
-LDeyY4M0F+t6c12/5+3615UKzGSRAkA+SGV6utcOqGTOJcZTt7nCFFtWbqmBZkoH
-1qv/2udWWFhJj8rBoKMQC+UzAS69nVjcoI2l6kA17/nVXkfZQYAHAkEAmOHCZCVQ
-9CCYTJICvoZR2euUYdnatLN8d2/ARWjzcRDTdS82P2oscATwAsvJxsphDmbOmVWP
-Hfy1t8OOCHKYAQ==
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC+55va4b/+5qRt
+wiCKH+qOGqY/V5N12DuAVb3z/sMeUA/pZg6/mJhfBpX8Spqy/H+x4Nnv32wo0BKY
+v3i29BqUg6A+vNOzAk9KltkwtXxagt3/lnIc9a2Avez3+pxA4jf1hrfGsLtqaXd3
+4SqxA7seu+izeiy/psVrTZn784TsrKkq8/UJTlt1GJxo98krWQtBM2Aj+tT4ZOJR
+WTcp8rto9WpHaVjtqLsRnWvRd3UB2lddPo6/97F7ad9TIl99xaywgAwg6p33xFLY
+MQMHuISpdOMuSmi/oYTGODLBEe/5S+Z59Ht/UvM2S6bYpa3SAkCJQu261up00G7B
+vAIznwurAgMBAAECggEATXOwMuyWNbejjHhPNVrfkcnUGyzPweb5tQaUa5K33OuE
+mR/z6d3iK+ODJHmsK+Pvdt6P7RcLTb+lW92K/0coJYsFj46SoTTVsKBk+7MWAa7I
+nLKQF5nBS9NCehVuIZDmPTHsC6uWTgT+GF/9LxYha8W3EmIGF7d0ryUrzSGuk0qA
+yVj4V2JbEbox5jjRUvRvCfbQnZYhT1Aa1/kN4fxYp00sQTkCQ1QZiC+SbN245nrv
+UHumVBy0dPL+vmYxKc+L9qwYhHKsspx6+RUTgW+7YbHs6LEd8HmXb0hIp1Xb4yUS
+ADVI7TgTGEGGRt1gQYkfcwl1YoVQeyBK8Yvfz88tgQKBgQD9PeBEXM+y7z8jcXAB
+f/JpmMmm+S8JhPyKOMDZRL5jPKgm93Xm0pAReo8xM/quKH2jAoMxmburnYTTskyo
+HBATcWDTBUiNkjCJORdWKwP6kvtYt8ZZsC9vrWkx4pPqTXQaXUNmrfZ1cuh5U/BK
+5aAzN5Drx0tKie+/+2gvevoZawKBgQDA++qDlRAiNft7fEZhjA3ovOSq9kIf1hnE
+psh4SRB21QZ443gifQKRRFIhMWRX0QkTyw2PbeVJvPjab08NmcumJWK5NCxPy3C0
+/ihQV2Ip49GVYA2qlgVzOMuxJJlG6SyKvCiBmadHY/ex4Ya1YPcfhjKsNr4ObIV8
+OCvQruQmwQKBgB+jp21jGyAD/CN1fMTzM1o2GJuf7lyGHPc3+AAtMow7e9bCfByG
+mjFU2qcPE3bG4EuJeNKtnmDmoT3BvQoT135WX/59Xn8xkJbUZzIA1dJsorKG42U5
+OfP9+nKdGFXhr2vL0yv0+CHcZWcjMZZp8gX0H0sV7zY03Zti0bV869pZAoGBALDg
+c+IkJoRkm9ljXxKbDkiJkMBNMvABCN8fyk/ND8UKnIMCYaKil07Tor7/iSuf0MUO
+b6BNJkE+bYuvR3J8ypW+YEzFT/PWz7dj10lDvhoMz5QsVHpMRDSGEtOKat3+ay/B
+IxMd5J7fNjAYN6JYfEetdRY4mluYBYSD60y6byxBAoGBALDoRoub5TUMdgr66fNp
+p7tc9ERH8/htPEq5g2SrzQex7lUIp8+wmvprx0i4a2SgDYCkj6gmjG8rP2O65tsn
+dkrKXnUOjIgjHGesbZoKgE+7Gl4c+eyoDsNVHH+ZFKN26fcO9i6wrbeGKjTTMcfu
+nEXqAq0CccdZ0lXxQTS/ttbU
-----END PRIVATE KEY-----
diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm
index 23c07958841..1c99e1ed645 100644
--- a/mysql-test/suite.pm
+++ b/mysql-test/suite.pm
@@ -62,9 +62,9 @@ sub skip_combinations {
}
$skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok();
- $skip{'main/openssl_6975.test'} = 'no or too old openssl'
+ $skip{'main/openssl_6975.test'} = 'no or wrong openssl version'
unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/
- and $1 ge "1.0.1d";
+ and $1 ge "1.0.1d" and $1 lt "1.1.1";
$skip{'main/ssl_7937.combinations'} = [ 'x509v3' ]
unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/
@@ -74,4 +74,3 @@ sub skip_combinations {
}
bless { };
-
diff --git a/mysql-test/suite/archive/disabled.def b/mysql-test/suite/archive/disabled.def
new file mode 100644
index 00000000000..ae841eaaf33
--- /dev/null
+++ b/mysql-test/suite/archive/disabled.def
@@ -0,0 +1,13 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+
+archive_gis : MDEV-17297 wait for the fix and then enable it
diff --git a/mysql-test/suite/archive/flush.result b/mysql-test/suite/archive/flush.result
new file mode 100644
index 00000000000..428f32d09f8
--- /dev/null
+++ b/mysql-test/suite/archive/flush.result
@@ -0,0 +1,18 @@
+CREATE TABLE t1(a INT) ENGINE=archive;
+INSERT INTO t1 VALUES(1);
+connect con1, localhost, root;
+LOCK TABLE t1 READ;
+connection default;
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+# Must return 1 row
+SELECT * FROM t2;
+a
+1
+SELECT * FROM t1;
+a
+1
+connection con1;
+UNLOCK TABLES;
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/archive/flush.test b/mysql-test/suite/archive/flush.test
new file mode 100644
index 00000000000..feadef08d7a
--- /dev/null
+++ b/mysql-test/suite/archive/flush.test
@@ -0,0 +1,25 @@
+--source include/have_archive.inc
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+CREATE TABLE t1(a INT) ENGINE=archive;
+INSERT INTO t1 VALUES(1);
+# Works correct if we uncomment next row
+#FLUSH TABLE t1;
+
+connect(con1, localhost, root);
+LOCK TABLE t1 READ;
+
+connection default;
+FLUSH TABLES WITH READ LOCK;
+copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t2.frm;
+copy_file $MYSQLD_DATADIR/test/t1.ARZ $MYSQLD_DATADIR/test/t2.ARZ;
+UNLOCK TABLES;
+--echo # Must return 1 row
+SELECT * FROM t2;
+SELECT * FROM t1;
+
+connection con1;
+UNLOCK TABLES;
+
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/archive/rnd_pos.result b/mysql-test/suite/archive/rnd_pos.result
new file mode 100644
index 00000000000..b6b6748d53f
--- /dev/null
+++ b/mysql-test/suite/archive/rnd_pos.result
@@ -0,0 +1,56 @@
+create table t1(c1 int not null, c2 double not null, c3 char(255) not null) engine=archive;
+insert t1 select seq, seq+0.7, concat('row with c1 = ', seq) from seq_1_to_10;
+explain partitions select c1,c3 from t1 order by c2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using filesort
+set max_length_for_sort_data = 4;
+explain partitions select c1,c3 from t1 order by c2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
+flush status;
+select c1,c3 from t1 order by c2;
+c1 c3
+1 row with c1 = 1
+2 row with c1 = 2
+3 row with c1 = 3
+4 row with c1 = 4
+5 row with c1 = 5
+6 row with c1 = 6
+7 row with c1 = 7
+8 row with c1 = 8
+9 row with c1 = 9
+10 row with c1 = 10
+set max_length_for_sort_data = default;
+show status where variable_name like '%tmp%' and value != 0;
+Variable_name Value
+Created_tmp_tables 1
+Handler_tmp_write 10
+Rows_tmp_read 20
+alter table t1 partition by hash (c1) partitions 3;
+explain partitions select c1,c3 from t1 order by c2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using filesort
+set max_length_for_sort_data = 4;
+explain partitions select c1,c3 from t1 order by c2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
+flush status;
+select c1,c3 from t1 order by c2;
+c1 c3
+1 row with c1 = 1
+2 row with c1 = 2
+3 row with c1 = 3
+4 row with c1 = 4
+5 row with c1 = 5
+6 row with c1 = 6
+7 row with c1 = 7
+8 row with c1 = 8
+9 row with c1 = 9
+10 row with c1 = 10
+set max_length_for_sort_data = default;
+show status where variable_name like '%tmp%' and value != 0;
+Variable_name Value
+Created_tmp_tables 1
+Handler_tmp_write 10
+Rows_tmp_read 20
+drop table t1;
diff --git a/mysql-test/suite/archive/rnd_pos.test b/mysql-test/suite/archive/rnd_pos.test
new file mode 100644
index 00000000000..7a1d78ea003
--- /dev/null
+++ b/mysql-test/suite/archive/rnd_pos.test
@@ -0,0 +1,27 @@
+#
+# MDEV-14500 Support engines without rnd_pos
+#
+source include/have_archive.inc;
+source include/have_sequence.inc;
+source include/have_partition.inc;
+
+create table t1(c1 int not null, c2 double not null, c3 char(255) not null) engine=archive;
+insert t1 select seq, seq+0.7, concat('row with c1 = ', seq) from seq_1_to_10;
+explain partitions select c1,c3 from t1 order by c2;
+set max_length_for_sort_data = 4;
+explain partitions select c1,c3 from t1 order by c2;
+flush status;
+select c1,c3 from t1 order by c2;
+set max_length_for_sort_data = default;
+show status where variable_name like '%tmp%' and value != 0;
+
+alter table t1 partition by hash (c1) partitions 3;
+explain partitions select c1,c3 from t1 order by c2;
+set max_length_for_sort_data = 4;
+explain partitions select c1,c3 from t1 order by c2;
+flush status;
+select c1,c3 from t1 order by c2;
+set max_length_for_sort_data = default;
+show status where variable_name like '%tmp%' and value != 0;
+
+drop table t1;
diff --git a/mysql-test/suite/binlog/include/binlog.test b/mysql-test/suite/binlog/include/binlog.test
index 40befc9d3d1..e5d4efb183b 100644
--- a/mysql-test/suite/binlog/include/binlog.test
+++ b/mysql-test/suite/binlog/include/binlog.test
@@ -269,12 +269,10 @@ create table if not exists t3 like tt1;
# the mysql database is replicated even when the current database is
# 'mysql'.
---disable_warnings
USE mysql;
-INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test');
-UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@';
-DELETE FROM user WHERE host='localhost' AND user='@#@';
---enable_warnings
+INSERT db SET host='localhost', user='@#@', db='Just a test';
+UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@';
+DELETE FROM db WHERE host='localhost' AND user='@#@';
use test;
source include/show_binlog_events.inc;
diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result
index 4068a80771c..2d79de6960a 100644
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result
@@ -843,9 +843,9 @@ create table if not exists t2 select * from t1;
create temporary table tt1 (a int);
create table if not exists t3 like tt1;
USE mysql;
-INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test');
-UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@';
-DELETE FROM user WHERE host='localhost' AND user='@#@';
+INSERT db SET host='localhost', user='@#@', db='Just a test';
+UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@';
+DELETE FROM db WHERE host='localhost' AND user='@#@';
use test;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -894,18 +894,18 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test')
-master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Annotate_rows # # INSERT db SET host='localhost', user='@#@', db='Just a test'
+master-bin.000001 # Table_map # # table_id: # (mysql.db)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
-master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Annotate_rows # # UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Table_map # # table_id: # (mysql.db)
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # DELETE FROM user WHERE host='localhost' AND user='@#@'
-master-bin.000001 # Table_map # # table_id: # (mysql.user)
+master-bin.000001 # Annotate_rows # # DELETE FROM db WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Table_map # # table_id: # (mysql.db)
master-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
drop table t1,t2,t3,tt1;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
index 872ba40e05f..ccc3db2ba7e 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
@@ -1,4 +1,3 @@
-drop table if exists t1;
create table t1 (a int, b int) engine=innodb;
begin;
insert into t1 values (1,2);
@@ -6,8 +5,6 @@ commit;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
-master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int, b int) engine=innodb
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1,2)
@@ -451,9 +448,9 @@ create table if not exists t2 select * from t1;
create temporary table tt1 (a int);
create table if not exists t3 like tt1;
USE mysql;
-INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test');
-UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@';
-DELETE FROM user WHERE host='localhost' AND user='@#@';
+INSERT db SET host='localhost', user='@#@', db='Just a test';
+UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@';
+DELETE FROM db WHERE host='localhost' AND user='@#@';
use test;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -501,15 +498,14 @@ master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Query # # use `mysql`; INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test')
+master-bin.000001 # Query # # use `mysql`; INSERT db SET host='localhost', user='@#@', db='Just a test'
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Query # # use `mysql`; UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
+master-bin.000001 # Query # # use `mysql`; DELETE FROM db WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Rotate # # master-bin.000002;pos=POS
drop table t1,t2,t3,tt1;
reset master;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog.test b/mysql-test/suite/binlog/t/binlog_stm_binlog.test
index c3d8066f807..e9c8e0ed874 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_binlog.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_binlog.test
@@ -3,10 +3,6 @@
let collation=utf8_unicode_ci;
--source include/have_collation.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
# REQUIREMENT
# replace_regex should replace output of SHOW BINLOG EVENTS
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.result b/mysql-test/suite/binlog_encryption/rpl_parallel.result
index 20f3facea27..5f78a378829 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel.result
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel.result
@@ -1518,6 +1518,7 @@ SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10000;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
INSERT INTO t3 VALUES (120, 0);
SET @commit_id= 10001;
diff --git a/mysql-test/suite/compat/oracle/r/parser.result b/mysql-test/suite/compat/oracle/r/parser.result
index c8600c29bd4..1c60c1434a3 100644
--- a/mysql-test/suite/compat/oracle/r/parser.result
+++ b/mysql-test/suite/compat/oracle/r/parser.result
@@ -499,3 +499,113 @@ test.comment()
Warnings:
Note 1585 This function 'comment' has the same name as a native function
DROP FUNCTION comment;
+#
+# MDEV-17660 sql_mode=ORACLE: Some keywords do not work as label names: history, system, versioning, without
+#
+BEGIN
+<<date_format>>
+NULL;
+END;
+/
+BEGIN
+<<decode>>
+NULL;
+END;
+/
+BEGIN
+<<history>>
+NULL;
+END;
+/
+BEGIN
+<<system>>
+NULL;
+END;
+/
+BEGIN
+<<versioning>>
+NULL;
+END;
+/
+BEGIN
+<<without>>
+NULL;
+END;
+/
+#
+# MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved
+#
+DECLARE
+ELSEIF INT;
+BEGIN
+ELSEIF:=1;
+END;
+/
+BEGIN
+<<ELSEIF>>
+NULL;
+END;
+/
+#
+# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
+#
+CREATE TABLE names (names INT);
+SELECT names FROM names AS names;
+names
+DROP TABLE names;
+CREATE TABLE password (password INT);
+SELECT password FROM password AS password;
+password
+DROP TABLE password;
+CREATE TABLE role (role INT);
+SELECT role FROM role AS role;
+role
+DROP TABLE role;
+DECLARE
+names VARCHAR(32) DEFAULT '[names]';
+password VARCHAR(32) DEFAULT '[password]';
+role VARCHAR(32) DEFAULT '[role]';
+BEGIN
+<<names>>
+SELECT names;
+<<password>>
+SELECT password;
+<<role>>
+SELECT role;
+END;
+$$
+names
+[names]
+password
+[password]
+role
+[role]
+DECLARE
+names VARCHAR(32);
+BEGIN
+SET names='[names]';
+END;
+$$
+ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
+DECLARE
+password VARCHAR(32);
+BEGIN
+SET password='[password]';
+END;
+$$
+ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
+DECLARE
+role VARCHAR(32);
+BEGIN
+SET role='[role]';
+END;
+$$
+SELECT @@GLOBAL.names;
+ERROR HY000: Unknown system variable 'names'
+SELECT @@GLOBAL.password;
+ERROR HY000: Unknown system variable 'password'
+SELECT @@GLOBAL.role;
+ERROR HY000: Unknown system variable 'role'
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/suite/compat/oracle/r/sp-code.result b/mysql-test/suite/compat/oracle/r/sp-code.result
index 1049563511c..1c6aacc8743 100644
--- a/mysql-test/suite/compat/oracle/r/sp-code.result
+++ b/mysql-test/suite/compat/oracle/r/sp-code.result
@@ -579,8 +579,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@2 0
1 set i@3 1
-2 set [upper_bound]@4 a@0
-3 jump_if_not 9(9) i@3 <= [upper_bound]@4
+2 set [target_bound]@4 a@0
+3 jump_if_not 9(9) i@3 <= [target_bound]@4
4 set total@2 total@2 + i@3
5 jump_if_not 7(7) i@3 = b@1
6 jump 9
@@ -598,7 +598,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
AS
total INT := 0;
BEGIN
-FOR i IN REVERSE a..1
+FOR i IN REVERSE 1..a
LOOP
total:= total + i;
IF i = b THEN
@@ -612,8 +612,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@2 0
1 set i@3 a@0
-2 set [upper_bound]@4 1
-3 jump_if_not 9(9) i@3 >= [upper_bound]@4
+2 set [target_bound]@4 1
+3 jump_if_not 9(9) i@3 >= [target_bound]@4
4 set total@2 total@2 + i@3
5 jump_if_not 7(7) i@3 = b@1
6 jump 9
@@ -651,12 +651,12 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@4 0
1 set ia@5 1
-2 set [upper_bound]@6 a@0
-3 jump_if_not 17(17) ia@5 <= [upper_bound]@6
+2 set [target_bound]@6 a@0
+3 jump_if_not 17(17) ia@5 <= [target_bound]@6
4 set total@4 total@4 + 1000
5 set ib@7 1
-6 set [upper_bound]@8 b@2
-7 jump_if_not 15(15) ib@7 <= [upper_bound]@8
+6 set [target_bound]@8 b@2
+7 jump_if_not 15(15) ib@7 <= [target_bound]@8
8 set total@4 total@4 + 1
9 jump_if_not 11(0) ib@7 = limitb@3
10 jump 15
@@ -698,8 +698,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set i@2 1
-2 set [upper_bound]@3 a@0
-3 jump_if_not 11(11) i@2 <= [upper_bound]@3
+2 set [target_bound]@3 a@0
+3 jump_if_not 11(11) i@2 <= [target_bound]@3
4 set total@1 total@1 + 1000
5 jump_if_not 8(8) i@2 = 5
6 set i@2 i@2 + 1
@@ -735,11 +735,11 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set i@2 1
-2 set [upper_bound]@3 a@0
-3 jump_if_not 16(16) i@2 <= [upper_bound]@3
+2 set [target_bound]@3 a@0
+3 jump_if_not 16(16) i@2 <= [target_bound]@3
4 set j@4 1
-5 set [upper_bound]@5 2
-6 jump_if_not 14(14) j@4 <= [upper_bound]@5
+5 set [target_bound]@5 2
+6 jump_if_not 14(14) j@4 <= [target_bound]@5
7 set total@1 total@1 + 1000
8 jump_if_not 11(11) i@2 = 5
9 set i@2 i@2 + 1
@@ -778,11 +778,11 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set j@2 1
-2 set [upper_bound]@3 2
-3 jump_if_not 16(16) j@2 <= [upper_bound]@3
+2 set [target_bound]@3 2
+3 jump_if_not 16(16) j@2 <= [target_bound]@3
4 set i@4 1
-5 set [upper_bound]@5 a@0
-6 jump_if_not 14(14) i@4 <= [upper_bound]@5
+5 set [target_bound]@5 a@0
+6 jump_if_not 14(14) i@4 <= [target_bound]@5
7 set total@1 total@1 + 1000
8 jump_if_not 11(11) i@4 = 5
9 set i@4 i@4 + 1
@@ -814,8 +814,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set i@2 1
-2 set [upper_bound]@3 a@0
-3 jump_if_not 10(10) i@2 <= [upper_bound]@3
+2 set [target_bound]@3 a@0
+3 jump_if_not 10(10) i@2 <= [target_bound]@3
4 jump_if_not 7(0) i@2 = 5
5 set i@2 i@2 + 1
6 jump 3
diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
index 093d52ba4e3..a60bbc38883 100644
--- a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
+++ b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
@@ -1479,3 +1479,28 @@ f1()
1
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
+#
+CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
+INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
+CREATE PROCEDURE p1()
+AS
+BEGIN
+FOR rec IN (SELECT en1 FROM t1)
+LOOP
+SELECT rec.en1;
+END LOOP;
+END;
+$$
+CALL p1();
+rec.en1
+aaa
+rec.en1
+a
+rec.en1
+b
+rec.en1
+c
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor.result b/mysql-test/suite/compat/oracle/r/sp-cursor.result
index 03211509f8b..a09459ad7cd 100644
--- a/mysql-test/suite/compat/oracle/r/sp-cursor.result
+++ b/mysql-test/suite/compat/oracle/r/sp-cursor.result
@@ -459,7 +459,7 @@ CALL p1('b1');
msg
Fetched a record a=0
Warnings:
-Warning 1366 Incorrect integer value: 'b1' for column 'p_a' at row 1
+Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 1
DROP PROCEDURE p1;
#
# One parameter in SELECT list + subselect
@@ -949,3 +949,31 @@ def c%FOUND 3 1 0 Y 32896 0 63
def c%ROWCOUNT 8 21 1 Y 32896 0 63
c%ISOPEN c%NOTFOUND c%FOUND c%ROWCOUNT
1 NULL NULL 0
+#
+# MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
+#
+CREATE TABLE t1
+(
+JOBN varchar(18) NOT NULL,
+pk int(11) NOT NULL,
+PRIMARY KEY (pk),
+KEY (JOBN)
+);
+CREATE PROCEDURE p1
+AS
+lS NUMBER(10) :=0;
+CURSOR cBPD IS SELECT * FROM t1 WHERE JOBN='x';
+BEGIN
+FOR lbpd IN cBPD LOOP
+lS:=lS+1;
+END LOOP;
+EXCEPTION
+WHEN OTHERS THEN
+BEGIN
+SELECT SQLERRM;
+END;
+END;
+$$
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/r/sp-package-mdl.result b/mysql-test/suite/compat/oracle/r/sp-package-mdl.result
index 18cc834461c..bb46341f202 100644
--- a/mysql-test/suite/compat/oracle/r/sp-package-mdl.result
+++ b/mysql-test/suite/compat/oracle/r/sp-package-mdl.result
@@ -61,8 +61,8 @@ TABLE_NAME pkg1.p1
CONN 2
INFO DROP PACKAGE pkg1
STATE Waiting for stored package body metadata lock
-LOCK_MODE MDL_INTENTION_EXCLUSIVE
-LOCK_TYPE Global read lock
+LOCK_MODE MDL_BACKUP_DDL
+LOCK_TYPE Backup lock
TABLE_NAME
CONN 2
INFO DROP PACKAGE pkg1
diff --git a/mysql-test/suite/compat/oracle/r/sp-package.result b/mysql-test/suite/compat/oracle/r/sp-package.result
index 1ea53daf43a..4f0f05b1939 100644
--- a/mysql-test/suite/compat/oracle/r/sp-package.result
+++ b/mysql-test/suite/compat/oracle/r/sp-package.result
@@ -2878,3 +2878,51 @@ msg
This is p01
DROP PACKAGE pkg1;
DROP TABLE t1;
+#
+# MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
+#
+CREATE TABLE t1 (
+CTR varchar(2) NOT NULL,
+COR varchar(3) NOT NULL,
+DATE datetime NOT NULL,
+CHAN varchar(4) NOT NULL,
+CNO varchar(20) NOT NULL,
+JOBN varchar(18) NOT NULL,
+C1 varchar(30) DEFAULT NULL,
+C2 varchar(30) DEFAULT NULL,
+TIME datetime DEFAULT NULL,
+AMT decimal(12,2) DEFAULT NULL,
+DT datetime NOT NULL,
+pk int(11) NOT NULL,
+PRIMARY KEY (pk),
+KEY Indx1 (JOBN)
+);
+CREATE PACKAGE xyz IS
+PROCEDURE xyz123(ctr IN VARCHAR2,Jn IN VARCHAR2,R OUT VARCHAR2);
+END;
+$$
+CREATE OR REPLACE PACKAGE BODY xyz IS
+PROCEDURE xyz123(
+ctr IN VARCHAR2,
+Jn IN VARCHAR2,
+R OUT VARCHAR2)
+AS
+lS NUMBER(10) :=0;
+CURSOR cBPD IS
+SELECT CTR, COR, DATE, CHAN, CNO, C1, C2, TIME, AMT
+FROM t1 WHERE JOBN=Jn;
+BEGIN
+FOR lbpd IN cBPD
+LOOP
+lS:=lS+1;
+END LOOP;
+EXCEPTION
+WHEN OTHERS THEN
+BEGIN
+SELECT SQLERRM;
+END;
+END;
+END $$
+CALL xyz.xyz123(17,18,@R);
+DROP PACKAGE xyz;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result
index 5cdfd517562..6db999b238f 100644
--- a/mysql-test/suite/compat/oracle/r/sp.result
+++ b/mysql-test/suite/compat/oracle/r/sp.result
@@ -843,7 +843,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
AS
total INT := 0;
BEGIN
-FOR i IN REVERSE a..1
+FOR i IN REVERSE 1..a
LOOP
total:= total + i;
IF i = b THEN
@@ -2494,3 +2494,61 @@ BEGIN
SELECT 'a' IN ('b',v);
END $$
ERROR HY000: Illegal parameter data types varchar and row for operation 'in'
+#
+# MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly
+#
+DECLARE
+totalprice DECIMAL(12,2):=NULL;
+loop_start INTEGER := 1;
+BEGIN
+FOR idx IN REVERSE loop_start..10 LOOP
+SELECT idx;
+END LOOP;
+END;
+$$
+idx
+10
+idx
+9
+idx
+8
+idx
+7
+idx
+6
+idx
+5
+idx
+4
+idx
+3
+idx
+2
+idx
+1
+CREATE PROCEDURE p1 AS
+loop_start INTEGER := 1;
+BEGIN
+FOR idx IN REVERSE 3..loop_start LOOP
+SELECT idx;
+END LOOP;
+END;
+$$
+CALL p1();
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1 AS
+loop_start INTEGER := 1;
+BEGIN
+FOR idx IN REVERSE loop_start..3 LOOP
+SELECT idx;
+END LOOP;
+END;
+$$
+CALL p1();
+idx
+3
+idx
+2
+idx
+1
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/r/versioning.result b/mysql-test/suite/compat/oracle/r/versioning.result
index ebedcf0f462..bbecfa1f6b1 100644
--- a/mysql-test/suite/compat/oracle/r/versioning.result
+++ b/mysql-test/suite/compat/oracle/r/versioning.result
@@ -14,3 +14,11 @@ SELECT * FROM t1 FOR SYSTEM_TIME AS OF (NOW()+INTERVAL 10 YEAR);
a
20
DROP TABLE t1;
+#
+# MDEV-17959 Assertion `opt_bootstrap || mysql_parse_status || thd->lex->select_stack_top == 0' failed in parse_sql upon DELETE HISTORY under ORACLE mode
+#
+SET SQL_MODE= ORACLE;
+CREATE TABLE t1 (a INT);
+DELETE HISTORY FROM t1;
+ERROR HY000: Table `t1` is not system-versioned
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/parser.test b/mysql-test/suite/compat/oracle/t/parser.test
index 86b6b270ccd..067fd9beb48 100644
--- a/mysql-test/suite/compat/oracle/t/parser.test
+++ b/mysql-test/suite/compat/oracle/t/parser.test
@@ -258,3 +258,157 @@ enable_prepare_warnings;
SELECT test.comment() FROM DUAL;
disable_prepare_warnings;
DROP FUNCTION comment;
+
+
+--echo #
+--echo # MDEV-17660 sql_mode=ORACLE: Some keywords do not work as label names: history, system, versioning, without
+--echo #
+
+DELIMITER /;
+BEGIN
+<<date_format>>
+ NULL;
+END;
+/
+DELIMITER ;/
+
+
+DELIMITER /;
+BEGIN
+<<decode>>
+ NULL;
+END;
+/
+DELIMITER ;/
+
+
+DELIMITER /;
+BEGIN
+<<history>>
+ NULL;
+END;
+/
+DELIMITER ;/
+
+
+DELIMITER /;
+BEGIN
+<<system>>
+ NULL;
+END;
+/
+DELIMITER ;/
+
+
+DELIMITER /;
+BEGIN
+<<versioning>>
+ NULL;
+END;
+/
+DELIMITER ;/
+
+
+DELIMITER /;
+BEGIN
+<<without>>
+ NULL;
+END;
+/
+DELIMITER ;/
+
+
+--echo #
+--echo # MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved
+--echo #
+
+DELIMITER /;
+DECLARE
+ ELSEIF INT;
+BEGIN
+ ELSEIF:=1;
+END;
+/
+DELIMITER ;/
+
+DELIMITER /;
+BEGIN
+<<ELSEIF>>
+ NULL;
+END;
+/
+DELIMITER ;/
+
+
+--echo #
+--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
+--echo #
+
+CREATE TABLE names (names INT);
+SELECT names FROM names AS names;
+DROP TABLE names;
+
+CREATE TABLE password (password INT);
+SELECT password FROM password AS password;
+DROP TABLE password;
+
+CREATE TABLE role (role INT);
+SELECT role FROM role AS role;
+DROP TABLE role;
+
+DELIMITER $$;
+DECLARE
+ names VARCHAR(32) DEFAULT '[names]';
+ password VARCHAR(32) DEFAULT '[password]';
+ role VARCHAR(32) DEFAULT '[role]';
+BEGIN
+<<names>>
+ SELECT names;
+<<password>>
+ SELECT password;
+<<role>>
+ SELECT role;
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+--error ER_SP_BAD_VAR_SHADOW
+DECLARE
+ names VARCHAR(32);
+BEGIN
+ SET names='[names]';
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+--error ER_SP_BAD_VAR_SHADOW
+DECLARE
+ password VARCHAR(32);
+BEGIN
+ SET password='[password]';
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+DECLARE
+ role VARCHAR(32);
+BEGIN
+ SET role='[role]';
+END;
+$$
+DELIMITER ;$$
+
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.names;
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.password;
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.role;
+
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/suite/compat/oracle/t/sp-code.test b/mysql-test/suite/compat/oracle/t/sp-code.test
index 9a1f64e54b4..ea66ed80d2a 100644
--- a/mysql-test/suite/compat/oracle/t/sp-code.test
+++ b/mysql-test/suite/compat/oracle/t/sp-code.test
@@ -470,7 +470,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
AS
total INT := 0;
BEGIN
- FOR i IN REVERSE a..1
+ FOR i IN REVERSE 1..a
LOOP
total:= total + i;
IF i = b THEN
diff --git a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test
index 31e28d5c8de..ba0ca9b6a60 100644
--- a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test
+++ b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test
@@ -1572,3 +1572,26 @@ DELIMITER ;$$
SELECT f1();
DROP FUNCTION f1;
DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
+--echo #
+
+CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
+INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
+
+DELIMITER $$;
+CREATE PROCEDURE p1()
+AS
+BEGIN
+ FOR rec IN (SELECT en1 FROM t1)
+ LOOP
+ SELECT rec.en1;
+ END LOOP;
+END;
+$$
+DELIMITER ;$$
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/sp-cursor.test b/mysql-test/suite/compat/oracle/t/sp-cursor.test
index 5a8b7b69f67..03b8b016ee0 100644
--- a/mysql-test/suite/compat/oracle/t/sp-cursor.test
+++ b/mysql-test/suite/compat/oracle/t/sp-cursor.test
@@ -952,3 +952,38 @@ $$
DELIMITER ;$$
--enable_ps_protocol
--disable_metadata
+
+
+--echo #
+--echo # MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
+--echo #
+
+CREATE TABLE t1
+(
+ JOBN varchar(18) NOT NULL,
+ pk int(11) NOT NULL,
+ PRIMARY KEY (pk),
+ KEY (JOBN)
+);
+
+DELIMITER $$;
+CREATE PROCEDURE p1
+AS
+ lS NUMBER(10) :=0;
+ CURSOR cBPD IS SELECT * FROM t1 WHERE JOBN='x';
+BEGIN
+ FOR lbpd IN cBPD LOOP
+ lS:=lS+1;
+ END LOOP;
+EXCEPTION
+ WHEN OTHERS THEN
+ BEGIN
+ SELECT SQLERRM;
+ END;
+END;
+$$
+DELIMITER ;$$
+
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/sp-package.test b/mysql-test/suite/compat/oracle/t/sp-package.test
index e61dd37467c..04357a7487a 100644
--- a/mysql-test/suite/compat/oracle/t/sp-package.test
+++ b/mysql-test/suite/compat/oracle/t/sp-package.test
@@ -2624,3 +2624,60 @@ DELIMITER ;$$
CALL pkg1.p00;
DROP PACKAGE pkg1;
DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
+--echo #
+
+CREATE TABLE t1 (
+ CTR varchar(2) NOT NULL,
+ COR varchar(3) NOT NULL,
+ DATE datetime NOT NULL,
+ CHAN varchar(4) NOT NULL,
+ CNO varchar(20) NOT NULL,
+ JOBN varchar(18) NOT NULL,
+ C1 varchar(30) DEFAULT NULL,
+ C2 varchar(30) DEFAULT NULL,
+ TIME datetime DEFAULT NULL,
+ AMT decimal(12,2) DEFAULT NULL,
+ DT datetime NOT NULL,
+ pk int(11) NOT NULL,
+ PRIMARY KEY (pk),
+ KEY Indx1 (JOBN)
+);
+
+DELIMITER $$;
+
+CREATE PACKAGE xyz IS
+ PROCEDURE xyz123(ctr IN VARCHAR2,Jn IN VARCHAR2,R OUT VARCHAR2);
+END;
+$$
+
+CREATE OR REPLACE PACKAGE BODY xyz IS
+ PROCEDURE xyz123(
+ ctr IN VARCHAR2,
+ Jn IN VARCHAR2,
+ R OUT VARCHAR2)
+ AS
+ lS NUMBER(10) :=0;
+ CURSOR cBPD IS
+ SELECT CTR, COR, DATE, CHAN, CNO, C1, C2, TIME, AMT
+ FROM t1 WHERE JOBN=Jn;
+ BEGIN
+ FOR lbpd IN cBPD
+ LOOP
+ lS:=lS+1;
+ END LOOP;
+ EXCEPTION
+ WHEN OTHERS THEN
+ BEGIN
+ SELECT SQLERRM;
+ END;
+ END;
+END $$
+DELIMITER ;$$
+
+CALL xyz.xyz123(17,18,@R);
+DROP PACKAGE xyz;
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test
index de2a4a5e4e7..96b4cd59fbd 100644
--- a/mysql-test/suite/compat/oracle/t/sp.test
+++ b/mysql-test/suite/compat/oracle/t/sp.test
@@ -918,7 +918,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
AS
total INT := 0;
BEGIN
- FOR i IN REVERSE a..1
+ FOR i IN REVERSE 1..a
LOOP
total:= total + i;
IF i = b THEN
@@ -2344,3 +2344,46 @@ BEGIN
END $$
DELIMITER ;$$
+--echo #
+--echo # MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly
+--echo #
+
+DELIMITER $$;
+DECLARE
+ totalprice DECIMAL(12,2):=NULL;
+ loop_start INTEGER := 1;
+BEGIN
+ FOR idx IN REVERSE loop_start..10 LOOP
+ SELECT idx;
+ END LOOP;
+END;
+$$
+DELIMITER ;$$
+
+
+DELIMITER $$;
+CREATE PROCEDURE p1 AS
+ loop_start INTEGER := 1;
+BEGIN
+ FOR idx IN REVERSE 3..loop_start LOOP
+ SELECT idx;
+ END LOOP;
+END;
+$$
+DELIMITER ;$$
+CALL p1();
+DROP PROCEDURE p1;
+
+
+DELIMITER $$;
+CREATE PROCEDURE p1 AS
+ loop_start INTEGER := 1;
+BEGIN
+ FOR idx IN REVERSE loop_start..3 LOOP
+ SELECT idx;
+ END LOOP;
+END;
+$$
+DELIMITER ;$$
+CALL p1();
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/t/versioning.test b/mysql-test/suite/compat/oracle/t/versioning.test
index d70058c56e4..abcca8c588a 100644
--- a/mysql-test/suite/compat/oracle/t/versioning.test
+++ b/mysql-test/suite/compat/oracle/t/versioning.test
@@ -11,3 +11,13 @@ INSERT INTO t1 VALUES (20);
SELECT * FROM t1 FOR SYSTEM_TIME ALL;
SELECT * FROM t1 FOR SYSTEM_TIME AS OF (NOW()+INTERVAL 10 YEAR);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17959 Assertion `opt_bootstrap || mysql_parse_status || thd->lex->select_stack_top == 0' failed in parse_sql upon DELETE HISTORY under ORACLE mode
+--echo #
+
+SET SQL_MODE= ORACLE;
+CREATE TABLE t1 (a INT);
+--error ER_VERS_NOT_VERSIONED
+DELETE HISTORY FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/csv/flush.result b/mysql-test/suite/csv/flush.result
new file mode 100644
index 00000000000..b0b9b21bd0a
--- /dev/null
+++ b/mysql-test/suite/csv/flush.result
@@ -0,0 +1,25 @@
+CREATE TABLE t1(a INT NOT NULL) ENGINE=csv;
+INSERT INTO t1 VALUES(1);
+connect con1, localhost, root;
+LOCK TABLE t1 READ;
+connection default;
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+# Must return 1 row
+SELECT * FROM t2;
+a
+1
+SELECT * FROM t1;
+a
+1
+connection con1;
+UNLOCK TABLES;
+connection default;
+INSERT INTO t2 VALUES(2);
+INSERT INTO t2 VALUES(2);
+SELECT * from t1,t2;
+a a
+1 1
+1 2
+1 2
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/csv/flush.test b/mysql-test/suite/csv/flush.test
new file mode 100644
index 00000000000..934ac26f291
--- /dev/null
+++ b/mysql-test/suite/csv/flush.test
@@ -0,0 +1,30 @@
+--source include/have_csv.inc
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+CREATE TABLE t1(a INT NOT NULL) ENGINE=csv;
+INSERT INTO t1 VALUES(1);
+# works correct if uncommented
+#FLUSH TABLE t1;
+
+connect(con1, localhost, root);
+LOCK TABLE t1 READ;
+
+connection default;
+FLUSH TABLES WITH READ LOCK;
+copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t2.frm;
+copy_file $MYSQLD_DATADIR/test/t1.CSV $MYSQLD_DATADIR/test/t2.CSV;
+copy_file $MYSQLD_DATADIR/test/t1.CSM $MYSQLD_DATADIR/test/t2.CSM;
+UNLOCK TABLES;
+--echo # Must return 1 row
+SELECT * FROM t2;
+SELECT * FROM t1;
+connection con1;
+UNLOCK TABLES;
+
+connection default;
+
+INSERT INTO t2 VALUES(2);
+INSERT INTO t2 VALUES(2);
+SELECT * from t1,t2;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/encryption/disabled.def b/mysql-test/suite/encryption/disabled.def
index d92d3495cb8..746faf49873 100644
--- a/mysql-test/suite/encryption/disabled.def
+++ b/mysql-test/suite/encryption/disabled.def
@@ -12,3 +12,4 @@
innodb_scrub : MDEV-8139 scrubbing does not work reliably
innodb_scrub_background : MDEV-8139 scrubbing does not work reliably
+innodb-redo-badkey : MDEV-13893/MDEV-12699 fix recovery of corrupted pages
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
index 179be43cc41..5812ff6dce9 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
@@ -3,6 +3,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
# Start server with keys2.txt
SET GLOBAL innodb_file_per_table = ON;
diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
index cca3b9ad686..afb79dbad8a 100644
--- a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
+++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
@@ -58,31 +58,6 @@ tpe_crc32.cfg
tpe_crc32.frm
tpe_crc32.ibd
UNLOCK TABLES;
-SET GLOBAL innodb_checksum_algorithm=strict_crc32;
-ALTER TABLE tce_crc32 DISCARD TABLESPACE;
-ALTER TABLE tc_crc32 DISCARD TABLESPACE;
-ALTER TABLE te_crc32 DISCARD TABLESPACE;
-ALTER TABLE t_crc32 DISCARD TABLESPACE;
-ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
-ALTER TABLE tp_crc32 DISCARD TABLESPACE;
-restore: tce_crc32 .ibd and .cfg files
-restore: tc_crc32 .ibd and .cfg files
-restore: te_crc32 .ibd and .cfg files
-restore: t_crc32 .ibd and .cfg files
-restore: tpe_crc32 .ibd and .cfg files
-restore: tp_crc32 .ibd and .cfg files
-ALTER TABLE tce_crc32 IMPORT TABLESPACE;
-update tce_crc32 set b=substr(b,1);
-ALTER TABLE tc_crc32 IMPORT TABLESPACE;
-update tc_crc32 set b=substr(b,1);
-ALTER TABLE te_crc32 IMPORT TABLESPACE;
-update te_crc32 set b=substr(b,1);
-ALTER TABLE t_crc32 IMPORT TABLESPACE;
-update t_crc32 set b=substr(b,1);
-ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
-update tpe_crc32 set b=substr(b,1);
-ALTER TABLE tp_crc32 IMPORT TABLESPACE;
-update tp_crc32 set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=crc32;
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
@@ -108,31 +83,6 @@ ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
update tpe_crc32 set b=substr(b,1);
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
update tp_crc32 set b=substr(b,1);
-SET GLOBAL innodb_checksum_algorithm=strict_innodb;
-ALTER TABLE tce_crc32 DISCARD TABLESPACE;
-ALTER TABLE tc_crc32 DISCARD TABLESPACE;
-ALTER TABLE te_crc32 DISCARD TABLESPACE;
-ALTER TABLE t_crc32 DISCARD TABLESPACE;
-ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
-ALTER TABLE tp_crc32 DISCARD TABLESPACE;
-restore: tce_crc32 .ibd and .cfg files
-restore: tc_crc32 .ibd and .cfg files
-restore: te_crc32 .ibd and .cfg files
-restore: t_crc32 .ibd and .cfg files
-restore: tpe_crc32 .ibd and .cfg files
-restore: tp_crc32 .ibd and .cfg files
-ALTER TABLE tce_crc32 IMPORT TABLESPACE;
-update tce_crc32 set b=substr(b,1);
-ALTER TABLE tc_crc32 IMPORT TABLESPACE;
-update tc_crc32 set b=substr(b,1);
-ALTER TABLE te_crc32 IMPORT TABLESPACE;
-update te_crc32 set b=substr(b,1);
-ALTER TABLE t_crc32 IMPORT TABLESPACE;
-update t_crc32 set b=substr(b,1);
-ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
-update tpe_crc32 set b=substr(b,1);
-ALTER TABLE tp_crc32 IMPORT TABLESPACE;
-update tp_crc32 set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=innodb;
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
@@ -158,31 +108,6 @@ ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
update tpe_crc32 set b=substr(b,1);
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
update tp_crc32 set b=substr(b,1);
-SET GLOBAL innodb_checksum_algorithm=strict_none;
-ALTER TABLE tce_crc32 DISCARD TABLESPACE;
-ALTER TABLE tc_crc32 DISCARD TABLESPACE;
-ALTER TABLE te_crc32 DISCARD TABLESPACE;
-ALTER TABLE t_crc32 DISCARD TABLESPACE;
-ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
-ALTER TABLE tp_crc32 DISCARD TABLESPACE;
-restore: tce_crc32 .ibd and .cfg files
-restore: tc_crc32 .ibd and .cfg files
-restore: te_crc32 .ibd and .cfg files
-restore: t_crc32 .ibd and .cfg files
-restore: tpe_crc32 .ibd and .cfg files
-restore: tp_crc32 .ibd and .cfg files
-ALTER TABLE tce_crc32 IMPORT TABLESPACE;
-update tce_crc32 set b=substr(b,1);
-ALTER TABLE tc_crc32 IMPORT TABLESPACE;
-update tc_crc32 set b=substr(b,1);
-ALTER TABLE te_crc32 IMPORT TABLESPACE;
-update te_crc32 set b=substr(b,1);
-ALTER TABLE t_crc32 IMPORT TABLESPACE;
-update t_crc32 set b=substr(b,1);
-ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
-update tpe_crc32 set b=substr(b,1);
-ALTER TABLE tp_crc32 IMPORT TABLESPACE;
-update tp_crc32 set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=none;
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
@@ -268,31 +193,6 @@ tpe_innodb.cfg
tpe_innodb.frm
tpe_innodb.ibd
UNLOCK TABLES;
-SET GLOBAL innodb_checksum_algorithm=strict_crc32;
-ALTER TABLE tce_innodb DISCARD TABLESPACE;
-ALTER TABLE tc_innodb DISCARD TABLESPACE;
-ALTER TABLE te_innodb DISCARD TABLESPACE;
-ALTER TABLE t_innodb DISCARD TABLESPACE;
-ALTER TABLE tpe_innodb DISCARD TABLESPACE;
-ALTER TABLE tp_innodb DISCARD TABLESPACE;
-restore: tce_innodb .ibd and .cfg files
-restore: tc_innodb .ibd and .cfg files
-restore: te_innodb .ibd and .cfg files
-restore: t_innodb .ibd and .cfg files
-restore: tpe_innodb .ibd and .cfg files
-restore: tp_innodb .ibd and .cfg files
-ALTER TABLE tce_innodb IMPORT TABLESPACE;
-update tce_innodb set b=substr(b,1);
-ALTER TABLE tc_innodb IMPORT TABLESPACE;
-update tc_innodb set b=substr(b,1);
-ALTER TABLE te_innodb IMPORT TABLESPACE;
-update te_innodb set b=substr(b,1);
-ALTER TABLE t_innodb IMPORT TABLESPACE;
-update t_innodb set b=substr(b,1);
-ALTER TABLE tpe_innodb IMPORT TABLESPACE;
-update tpe_innodb set b=substr(b,1);
-ALTER TABLE tp_innodb IMPORT TABLESPACE;
-update tp_innodb set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=crc32;
ALTER TABLE tce_innodb DISCARD TABLESPACE;
ALTER TABLE tc_innodb DISCARD TABLESPACE;
@@ -318,31 +218,6 @@ ALTER TABLE tpe_innodb IMPORT TABLESPACE;
update tpe_innodb set b=substr(b,1);
ALTER TABLE tp_innodb IMPORT TABLESPACE;
update tp_innodb set b=substr(b,1);
-SET GLOBAL innodb_checksum_algorithm=strict_innodb;
-ALTER TABLE tce_innodb DISCARD TABLESPACE;
-ALTER TABLE tc_innodb DISCARD TABLESPACE;
-ALTER TABLE te_innodb DISCARD TABLESPACE;
-ALTER TABLE t_innodb DISCARD TABLESPACE;
-ALTER TABLE tpe_innodb DISCARD TABLESPACE;
-ALTER TABLE tp_innodb DISCARD TABLESPACE;
-restore: tce_innodb .ibd and .cfg files
-restore: tc_innodb .ibd and .cfg files
-restore: te_innodb .ibd and .cfg files
-restore: t_innodb .ibd and .cfg files
-restore: tpe_innodb .ibd and .cfg files
-restore: tp_innodb .ibd and .cfg files
-ALTER TABLE tce_innodb IMPORT TABLESPACE;
-update tce_innodb set b=substr(b,1);
-ALTER TABLE tc_innodb IMPORT TABLESPACE;
-update tc_innodb set b=substr(b,1);
-ALTER TABLE te_innodb IMPORT TABLESPACE;
-update te_innodb set b=substr(b,1);
-ALTER TABLE t_innodb IMPORT TABLESPACE;
-update t_innodb set b=substr(b,1);
-ALTER TABLE tpe_innodb IMPORT TABLESPACE;
-update tpe_innodb set b=substr(b,1);
-ALTER TABLE tp_innodb IMPORT TABLESPACE;
-update tp_innodb set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=innodb;
ALTER TABLE tce_innodb DISCARD TABLESPACE;
ALTER TABLE tc_innodb DISCARD TABLESPACE;
@@ -368,31 +243,6 @@ ALTER TABLE tpe_innodb IMPORT TABLESPACE;
update tpe_innodb set b=substr(b,1);
ALTER TABLE tp_innodb IMPORT TABLESPACE;
update tp_innodb set b=substr(b,1);
-SET GLOBAL innodb_checksum_algorithm=strict_none;
-ALTER TABLE tce_innodb DISCARD TABLESPACE;
-ALTER TABLE tc_innodb DISCARD TABLESPACE;
-ALTER TABLE te_innodb DISCARD TABLESPACE;
-ALTER TABLE t_innodb DISCARD TABLESPACE;
-ALTER TABLE tpe_innodb DISCARD TABLESPACE;
-ALTER TABLE tp_innodb DISCARD TABLESPACE;
-restore: tce_innodb .ibd and .cfg files
-restore: tc_innodb .ibd and .cfg files
-restore: te_innodb .ibd and .cfg files
-restore: t_innodb .ibd and .cfg files
-restore: tpe_innodb .ibd and .cfg files
-restore: tp_innodb .ibd and .cfg files
-ALTER TABLE tce_innodb IMPORT TABLESPACE;
-update tce_innodb set b=substr(b,1);
-ALTER TABLE tc_innodb IMPORT TABLESPACE;
-update tc_innodb set b=substr(b,1);
-ALTER TABLE te_innodb IMPORT TABLESPACE;
-update te_innodb set b=substr(b,1);
-ALTER TABLE t_innodb IMPORT TABLESPACE;
-update t_innodb set b=substr(b,1);
-ALTER TABLE tpe_innodb IMPORT TABLESPACE;
-update tpe_innodb set b=substr(b,1);
-ALTER TABLE tp_innodb IMPORT TABLESPACE;
-update tp_innodb set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=none;
ALTER TABLE tce_innodb DISCARD TABLESPACE;
ALTER TABLE tc_innodb DISCARD TABLESPACE;
@@ -478,31 +328,6 @@ tpe_none.cfg
tpe_none.frm
tpe_none.ibd
UNLOCK TABLES;
-SET GLOBAL innodb_checksum_algorithm=strict_crc32;
-ALTER TABLE tce_none DISCARD TABLESPACE;
-ALTER TABLE tc_none DISCARD TABLESPACE;
-ALTER TABLE te_none DISCARD TABLESPACE;
-ALTER TABLE t_none DISCARD TABLESPACE;
-ALTER TABLE tpe_none DISCARD TABLESPACE;
-ALTER TABLE tp_none DISCARD TABLESPACE;
-restore: tce_none .ibd and .cfg files
-restore: tc_none .ibd and .cfg files
-restore: te_none .ibd and .cfg files
-restore: t_none .ibd and .cfg files
-restore: tpe_none .ibd and .cfg files
-restore: tp_none .ibd and .cfg files
-ALTER TABLE tce_none IMPORT TABLESPACE;
-update tce_none set b=substr(b,1);
-ALTER TABLE tc_none IMPORT TABLESPACE;
-update tc_none set b=substr(b,1);
-ALTER TABLE te_none IMPORT TABLESPACE;
-update te_none set b=substr(b,1);
-ALTER TABLE t_none IMPORT TABLESPACE;
-update t_none set b=substr(b,1);
-ALTER TABLE tpe_none IMPORT TABLESPACE;
-update tpe_none set b=substr(b,1);
-ALTER TABLE tp_none IMPORT TABLESPACE;
-update tp_none set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=crc32;
ALTER TABLE tce_none DISCARD TABLESPACE;
ALTER TABLE tc_none DISCARD TABLESPACE;
@@ -528,31 +353,6 @@ ALTER TABLE tpe_none IMPORT TABLESPACE;
update tpe_none set b=substr(b,1);
ALTER TABLE tp_none IMPORT TABLESPACE;
update tp_none set b=substr(b,1);
-SET GLOBAL innodb_checksum_algorithm=strict_innodb;
-ALTER TABLE tce_none DISCARD TABLESPACE;
-ALTER TABLE tc_none DISCARD TABLESPACE;
-ALTER TABLE te_none DISCARD TABLESPACE;
-ALTER TABLE t_none DISCARD TABLESPACE;
-ALTER TABLE tpe_none DISCARD TABLESPACE;
-ALTER TABLE tp_none DISCARD TABLESPACE;
-restore: tce_none .ibd and .cfg files
-restore: tc_none .ibd and .cfg files
-restore: te_none .ibd and .cfg files
-restore: t_none .ibd and .cfg files
-restore: tpe_none .ibd and .cfg files
-restore: tp_none .ibd and .cfg files
-ALTER TABLE tce_none IMPORT TABLESPACE;
-update tce_none set b=substr(b,1);
-ALTER TABLE tc_none IMPORT TABLESPACE;
-update tc_none set b=substr(b,1);
-ALTER TABLE te_none IMPORT TABLESPACE;
-update te_none set b=substr(b,1);
-ALTER TABLE t_none IMPORT TABLESPACE;
-update t_none set b=substr(b,1);
-ALTER TABLE tpe_none IMPORT TABLESPACE;
-update tpe_none set b=substr(b,1);
-ALTER TABLE tp_none IMPORT TABLESPACE;
-update tp_none set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=innodb;
ALTER TABLE tce_none DISCARD TABLESPACE;
ALTER TABLE tc_none DISCARD TABLESPACE;
@@ -578,31 +378,6 @@ ALTER TABLE tpe_none IMPORT TABLESPACE;
update tpe_none set b=substr(b,1);
ALTER TABLE tp_none IMPORT TABLESPACE;
update tp_none set b=substr(b,1);
-SET GLOBAL innodb_checksum_algorithm=strict_none;
-ALTER TABLE tce_none DISCARD TABLESPACE;
-ALTER TABLE tc_none DISCARD TABLESPACE;
-ALTER TABLE te_none DISCARD TABLESPACE;
-ALTER TABLE t_none DISCARD TABLESPACE;
-ALTER TABLE tpe_none DISCARD TABLESPACE;
-ALTER TABLE tp_none DISCARD TABLESPACE;
-restore: tce_none .ibd and .cfg files
-restore: tc_none .ibd and .cfg files
-restore: te_none .ibd and .cfg files
-restore: t_none .ibd and .cfg files
-restore: tpe_none .ibd and .cfg files
-restore: tp_none .ibd and .cfg files
-ALTER TABLE tce_none IMPORT TABLESPACE;
-update tce_none set b=substr(b,1);
-ALTER TABLE tc_none IMPORT TABLESPACE;
-update tc_none set b=substr(b,1);
-ALTER TABLE te_none IMPORT TABLESPACE;
-update te_none set b=substr(b,1);
-ALTER TABLE t_none IMPORT TABLESPACE;
-update t_none set b=substr(b,1);
-ALTER TABLE tpe_none IMPORT TABLESPACE;
-update tpe_none set b=substr(b,1);
-ALTER TABLE tp_none IMPORT TABLESPACE;
-update tp_none set b=substr(b,1);
SET GLOBAL innodb_checksum_algorithm=none;
ALTER TABLE tce_none DISCARD TABLESPACE;
ALTER TABLE tc_none DISCARD TABLESPACE;
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
index 1d5b88bc750..995360a5744 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
@@ -77,7 +77,6 @@ t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-DROP TABLE t2;
CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
SHOW WARNINGS;
@@ -85,3 +84,30 @@ Level Code Message
Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+FLUSH TABLES;
+create table t1(f1 int not null, f2 int not null)engine=innodb encrypted=yes;
+insert into t1 values(1, 2), (2, 3), (4, 5), (5, 6), (7, 8);
+insert into t1 select * from t1;
+BEGIN;
+INSERT INTO t2 VALUES (1);
+connect con1, localhost, root;
+SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL done WAIT_FOR ever';
+alter table t1 force;
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR done';
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+COMMIT;
+disconnect con1;
+select * from t1;
+f1 f2
+1 2
+2 3
+4 5
+5 6
+7 8
+1 2
+2 3
+4 5
+5 6
+7 8
+drop table t1,t2;
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result
index d8d37ba7493..94b47103dd0 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result
@@ -1,6 +1,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
create table t5 (
`intcol1` int(32) DEFAULT NULL,
diff --git a/mysql-test/suite/encryption/r/innodb-force-corrupt.result b/mysql-test/suite/encryption/r/innodb-force-corrupt.result
index 4c8ee2ef4de..13c38f1587d 100644
--- a/mysql-test/suite/encryption/r/innodb-force-corrupt.result
+++ b/mysql-test/suite/encryption/r/innodb-force-corrupt.result
@@ -1,6 +1,5 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root page|is corrupted)");
-call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
-call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version=3221342974");
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
# Create and populate tables to be corrupted
diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result
index 32ae29ca76b..6f4a45d817a 100644
--- a/mysql-test/suite/encryption/r/innodb-missing-key.result
+++ b/mysql-test/suite/encryption/r/innodb-missing-key.result
@@ -1,6 +1,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
# Start server with keys2.txt
CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19;
CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
index 5c424d8752b..a832880c494 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
@@ -13,6 +13,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
--echo # Start server with keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
index 7eaa1bd64c6..c9a4a9e1b92 100644
--- a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
+++ b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
@@ -65,17 +65,14 @@ EOF
--list_files $MYSQLD_DATADIR/test
UNLOCK TABLES;
-let $to = 6;
+let $to = 3;
while ($to)
{
dec $to;
let $tocksum = `select case $to
when 0 then 'none'
- when 1 then 'strict_none'
- when 2 then 'innodb'
- when 3 then 'strict_innodb'
- when 4 then 'crc32'
- when 5 then 'strict_crc32'
+ when 1 then 'innodb'
+ when 2 then 'crc32'
end`;
eval SET GLOBAL innodb_checksum_algorithm=$tocksum;
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index e8391d97d6c..a6a4dbaff9b 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -1,13 +1,12 @@
-- source include/have_innodb.inc
+-- source include/have_debug.inc
+-- source include/have_debug_sync.inc
-- source include/have_file_key_management_plugin.inc
#
# MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
#
-let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
-let $threads = `SELECT @@innodb_encryption_threads`;
-
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
@@ -99,14 +98,35 @@ ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
SHOW WARNINGS;
SHOW CREATE TABLE t2;
-DROP TABLE t2;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables;
-EVAL SET GLOBAL innodb_encryption_threads = $threads;
---enable_query_log
+FLUSH TABLES;
+
+create table t1(f1 int not null, f2 int not null)engine=innodb encrypted=yes;
+insert into t1 values(1, 2), (2, 3), (4, 5), (5, 6), (7, 8);
+insert into t1 select * from t1;
+BEGIN;
+INSERT INTO t2 VALUES (1);
+
+connect con1, localhost, root;
+SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL done WAIT_FOR ever';
+send alter table t1 force;
+
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR done';
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+COMMIT;
+
+--let $shutdown_timeout= 0
+--source include/restart_mysqld.inc
+disconnect con1;
+
+select * from t1;
+drop table t1,t2;
+
+# Work around missing crash recovery at the SQL layer.
+let $datadir= `select @@datadir`;
+--remove_files_wildcard $datadir/test #sql-*.frm
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
index 0994078788e..6d6f1c40d4c 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test
@@ -10,6 +10,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1");
# Suppression for builds where file_key_management plugin is linked statically
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
diff --git a/mysql-test/suite/encryption/t/innodb-force-corrupt.test b/mysql-test/suite/encryption/t/innodb-force-corrupt.test
index 2ec4960af4c..6c775dbf733 100644
--- a/mysql-test/suite/encryption/t/innodb-force-corrupt.test
+++ b/mysql-test/suite/encryption/t/innodb-force-corrupt.test
@@ -8,8 +8,7 @@
-- source include/not_embedded.inc
call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root page|is corrupted)");
-call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
-call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version=3221342974");
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
@@ -51,17 +50,17 @@ perl;
open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t1.ibd") or die "open";
binmode FILE;
seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
-print FILE pack("H*", "c00lcafedeadb017");
+print FILE pack("H*", "c001cafedeadb017");
close FILE or die "close";
open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t2.ibd") or die "open";
binmode FILE;
seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
-print FILE pack("H*", "c00lcafedeadb017");
+print FILE pack("H*", "c001cafedeadb017");
close FILE or die "close";
open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t3.ibd") or die "open";
binmode FILE;
seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
-print FILE pack("H*", "c00lcafedeadb017");
+print FILE pack("H*", "c001cafedeadb017");
close FILE or die "close";
EOF
diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test
index cf851a54def..c2a73d594b4 100644
--- a/mysql-test/suite/encryption/t/innodb-missing-key.test
+++ b/mysql-test/suite/encryption/t/innodb-missing-key.test
@@ -10,6 +10,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
--echo # Start server with keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
diff --git a/mysql-test/suite/engines/funcs/r/an_calendar.result b/mysql-test/suite/engines/funcs/r/an_calendar.result
index f057c3b618f..669b097b325 100644
--- a/mysql-test/suite/engines/funcs/r/an_calendar.result
+++ b/mysql-test/suite/engines/funcs/r/an_calendar.result
@@ -11,6 +11,7 @@ Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 TIME NULL, c2 TIME NULL);
@@ -25,6 +26,7 @@ Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 DATETIME NULL, c2 DATETIME NULL);
@@ -33,6 +35,7 @@ INSERT INTO t1 VALUES(NOW(),NOW());
INSERT INTO t1 VALUES(NOW(),NOW());
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 TIMESTAMP NULL, c2 TIMESTAMP NULL);
@@ -41,5 +44,6 @@ INSERT INTO t1 VALUES(NOW(),NOW());
INSERT INTO t1 VALUES(NOW(),NOW());
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
diff --git a/mysql-test/suite/engines/funcs/r/an_number.result b/mysql-test/suite/engines/funcs/r/an_number.result
index a77fc0e7d69..257213d0bf8 100644
--- a/mysql-test/suite/engines/funcs/r/an_number.result
+++ b/mysql-test/suite/engines/funcs/r/an_number.result
@@ -4,6 +4,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 SMALLINT NULL, c2 SMALLINT NULL);
@@ -11,6 +12,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 MEDIUMINT NULL, c2 MEDIUMINT NULL);
@@ -18,6 +20,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 INT NULL, c2 INT NULL);
@@ -25,6 +28,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 INTEGER NULL, c2 INTEGER NULL);
@@ -32,6 +36,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 BIGINT NULL, c2 BIGINT NULL);
@@ -39,6 +44,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 DECIMAL NULL, c2 DECIMAL NULL);
@@ -46,6 +52,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 DEC NULL, c2 DEC NULL);
@@ -53,6 +60,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 FIXED NULL, c2 FIXED NULL);
@@ -60,6 +68,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 NUMERIC NULL, c2 NUMERIC NULL);
@@ -67,6 +76,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 DOUBLE NULL, c2 DOUBLE NULL);
@@ -74,6 +84,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 REAL NULL, c2 REAL NULL);
@@ -81,6 +92,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 DOUBLE PRECISION NULL, c2 DOUBLE PRECISION NULL);
@@ -88,6 +100,7 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 FLOAT NULL, c2 FLOAT NULL);
@@ -95,5 +108,6 @@ INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
diff --git a/mysql-test/suite/engines/funcs/r/an_string.result b/mysql-test/suite/engines/funcs/r/an_string.result
index c7762155a7d..f3e7eaedb15 100644
--- a/mysql-test/suite/engines/funcs/r/an_string.result
+++ b/mysql-test/suite/engines/funcs/r/an_string.result
@@ -4,6 +4,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG');
INSERT INTO t1 VALUES('123','1234567890');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(100) NULL, c2 VARCHAR(100) NULL);
@@ -11,6 +12,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG');
INSERT INTO t1 VALUES('123','1234567890');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 BINARY(100) NULL, c2 BINARY(100) NULL);
@@ -18,6 +20,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG');
INSERT INTO t1 VALUES('123','1234567890');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 VARBINARY(100) NULL, c2 VARBINARY(100) NULL);
@@ -25,6 +28,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG');
INSERT INTO t1 VALUES('123','1234567890');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 BLOB(100) NULL, c2 BLOB(100) NULL);
@@ -32,6 +36,9 @@ INSERT INTO t1 VALUES('abc','ABCDEFG');
INSERT INTO t1 VALUES('123','1234567890');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'c1'
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'c2'
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT(100) NULL, c2 TEXT(100) NULL);
@@ -39,5 +46,8 @@ INSERT INTO t1 VALUES('abc','ABCDEFG');
INSERT INTO t1 VALUES('123','1234567890');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'c1'
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'c2'
test.t1 analyze status OK
DROP TABLE t1;
diff --git a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result
index 53964697506..b1c46a3a398 100644
--- a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result
@@ -7,7 +7,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -26,7 +26,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -45,7 +45,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -64,7 +64,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -83,7 +83,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
@@ -102,7 +102,7 @@ INSERT INTO t4 (c1) VALUES(0);
INSERT INTO t4 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t4 (c1) VALUES('x');
-ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1
INSERT INTO t4 (c1) VALUES('9');
SELECT COUNT(c1) AS total_rows FROM t4;
total_rows
diff --git a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result
index 62ad9a568f9..0c9ae5453e3 100644
--- a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result
+++ b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result
@@ -7,7 +7,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
@@ -27,7 +27,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
@@ -47,7 +47,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
@@ -67,7 +67,7 @@ INSERT INTO t5 (c1) VALUES(0);
INSERT INTO t5 (c1) VALUES(-1);
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5 (c1) VALUES('x');
-ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1
+ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1
INSERT INTO t5 (c1) VALUES(999999);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT COUNT(c1) AS total_rows FROM t5;
diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result b/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result
index 884408d29b3..52a8b2de642 100644
--- a/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result
+++ b/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result
@@ -33,6 +33,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p5` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 ANALYZE PARTITION p1,p2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * FROM t1 ORDER BY c1;
c1 c2
diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result
index a341de58946..860fa8a2c4c 100644
--- a/mysql-test/suite/engines/iuds/r/insert_decimal.result
+++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result
@@ -110,15 +110,15 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
Warning 1264 Out of range value for column 'c3' at row 1
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c1' at row 2
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c2' at row 2
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c3' at row 2
+Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c1` at row 2
+Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c2` at row 2
+Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c3` at row 2
Note 1265 Data truncated for column 'c1' at row 3
Note 1265 Data truncated for column 'c2' at row 3
Note 1265 Data truncated for column 'c3' at row 3
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c1' at row 4
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c2' at row 4
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c3' at row 4
+Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c1` at row 4
+Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c2` at row 4
+Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c3` at row 4
SELECT * FROM t1;
c1 c2 c3 c4
0.00000 -0.10000 0 13
diff --git a/mysql-test/suite/engines/iuds/r/insert_number.result b/mysql-test/suite/engines/iuds/r/insert_number.result
index b70c39341ad..564ce8d3401 100644
--- a/mysql-test/suite/engines/iuds/r/insert_number.result
+++ b/mysql-test/suite/engines/iuds/r/insert_number.result
@@ -12,16 +12,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106);
INSERT IGNORE INTO t1 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT IGNORE INTO t2 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1
INSERT IGNORE INTO t3 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1
INSERT IGNORE INTO t1 VALUES(-1,124,22,23,24,25,26);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
@@ -40,15 +40,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36);
INSERT IGNORE INTO t1 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1
INSERT IGNORE INTO t2 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1
INSERT IGNORE INTO t3 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7
0 0 17 18 19 20 21
@@ -1378,22 +1378,22 @@ Warnings:
Warning 1364 Field 'c2' doesn't have a default value
INSERT IGNORE INTO t4 VALUES('','',17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1
INSERT IGNORE INTO t5 VALUES('','',-17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1
INSERT IGNORE INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1
INSERT IGNORE INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1
INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13);
INSERT IGNORE INTO t5 VALUES(-1,-1,-1,8,9,10,11,12);
Warnings:
@@ -5621,16 +5621,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t1 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1
INSERT INTO t1 VALUES(-1,124,22,23,24,25,26);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
@@ -5649,15 +5649,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36);
INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7
0 0 17 18 19 20 21
@@ -6987,22 +6987,22 @@ Warnings:
Warning 1364 Field 'c2' doesn't have a default value
INSERT INTO t4 VALUES('','',17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1
INSERT INTO t5 VALUES('','',-17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1
INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1
INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1
INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13);
INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12);
Warnings:
@@ -11321,16 +11321,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t1 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1
INSERT INTO t1 VALUES(-1,124,22,23,24,25,26);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
@@ -11349,15 +11349,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36);
INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7
0 0 17 18 19 20 21
@@ -12687,22 +12687,22 @@ Warnings:
Warning 1364 Field 'c2' doesn't have a default value
INSERT INTO t4 VALUES('','',17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1
INSERT INTO t5 VALUES('','',-17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1
INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1
INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1
INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13);
INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12);
Warnings:
@@ -17126,16 +17126,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t1 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1
INSERT INTO t1 VALUES(-1,124,22,23,24,25,26);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
@@ -17154,15 +17154,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36);
INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7
0 0 17 18 19 20 21
@@ -18492,22 +18492,22 @@ Warnings:
Warning 1364 Field 'c2' doesn't have a default value
INSERT INTO t4 VALUES('','',17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1
INSERT INTO t5 VALUES('','',-17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1
INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1
INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1
INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13);
INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12);
Warnings:
@@ -23036,16 +23036,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t1 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1
INSERT INTO t1 VALUES(-1,124,22,23,24,25,26);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
@@ -23064,15 +23064,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36);
INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7
0 0 17 18 19 20 21
@@ -24402,22 +24402,22 @@ Warnings:
Warning 1364 Field 'c2' doesn't have a default value
INSERT INTO t4 VALUES('','',17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1
INSERT INTO t5 VALUES('','',-17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1
INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1
INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1
INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13);
INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12);
Warnings:
@@ -28946,16 +28946,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106);
INSERT INTO t1 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('','',17,18,19,20,21);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1
INSERT INTO t1 VALUES(-1,124,22,23,24,25,26);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
@@ -28974,15 +28974,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36);
INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1
INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1
INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7
0 0 17 18 19 20 21
@@ -30312,22 +30312,22 @@ Warnings:
Warning 1364 Field 'c2' doesn't have a default value
INSERT INTO t4 VALUES('','',17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1
INSERT INTO t5 VALUES('','',-17,18,19,20,21,22);
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1
INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1
INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1
-Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1
INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13);
INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12);
Warnings:
@@ -31586,8 +31586,33 @@ c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
+0 NULL 5 6 NULL 0 NULL
+0 -9223372036854775808 1 2 3 4 5
+0 0 17 18 19 20 21
+0 124 22 23 24 25 26
+0 124 27 28 29 30 31
+0 -9223372036854775808 31 32 33 34 35
+0 0 32 32 34 35 36
+101 0 37 38 39 40 41
+101 -102 103 104 105 106 107
+102 -109 110 111 112 113 114
+103 -109 110 111 112 113 114
+105 NULL 102 103 104 105 106
+108 -109 110 111 112 101 114
+108 -109 110 111 112 102 114
+108 -109 110 111 112 113 114
+115 -116 117 118 119 120 121
+122 -123 124 125 126 127 128
+255 -2147483648 6 7 8 9 10
+65535 -8388608 11 12 13 14 15
+16777215 -32768 16 17 18 19 20
+4294967295 -128 21 22 23 24 25
+18446744073709551615 9223372036854775807 26 27 28 29 30
+18446744073709551615 9223372036854775807 36 37 38 39 40
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+0 NULL 5 6 NULL 0 NULL
+0 -9223372036854775808 1 2 3 4 5
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
0 NULL 5 6 NULL 0 NULL
@@ -31747,8 +31772,33 @@ c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
+0 0 32 32 34 35 36
+0 -9223372036854775808 31 32 33 34 35
+0 124 27 28 29 30 31
+0 124 22 23 24 25 26
+0 0 17 18 19 20 21
+0 -9223372036854775808 1 2 3 4 5
+0 NULL 5 6 NULL 0 NULL
+101 -102 103 104 105 106 107
+101 0 37 38 39 40 41
+102 -109 110 111 112 113 114
+103 -109 110 111 112 113 114
+105 NULL 102 103 104 105 106
+108 -109 110 111 112 113 114
+108 -109 110 111 112 102 114
+108 -109 110 111 112 101 114
+115 -116 117 118 119 120 121
+122 -123 124 125 126 127 128
+255 -2147483648 6 7 8 9 10
+65535 -8388608 11 12 13 14 15
+16777215 -32768 16 17 18 19 20
+4294967295 -128 21 22 23 24 25
+18446744073709551615 9223372036854775807 36 37 38 39 40
+18446744073709551615 9223372036854775807 26 27 28 29 30
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+0 0 32 32 34 35 36
+0 -9223372036854775808 31 32 33 34 35
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
0 0 32 32 34 35 36
@@ -32014,8 +32064,33 @@ c1 c2 c3 c4 c5 c6 c7
18446744073709551615 9223372036854775807 36 37 38 39 40
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
+0 NULL 5 6 NULL 0 NULL
+0 -9223372036854775808 1 2 3 4 5
+0 0 17 18 19 20 21
+0 124 22 23 24 25 26
+0 124 27 28 29 30 31
+0 -9223372036854775808 31 32 33 34 35
+0 0 32 32 34 35 36
+101 0 37 38 39 40 41
+101 -102 103 104 105 106 107
+102 -109 110 111 112 113 114
+103 -109 110 111 112 113 114
+105 NULL 102 103 104 105 106
+108 -109 110 111 112 101 114
+108 -109 110 111 112 102 114
+108 -109 110 111 112 113 114
+115 -116 117 118 119 120 121
+122 -123 124 125 126 127 128
+255 -2147483648 6 7 8 9 10
+65535 -8388608 11 12 13 14 15
+16777215 -32768 16 17 18 19 20
+4294967295 -128 21 22 23 24 25
+18446744073709551615 9223372036854775807 26 27 28 29 30
+18446744073709551615 9223372036854775807 36 37 38 39 40
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+0 NULL 5 6 NULL 0 NULL
+0 -9223372036854775808 1 2 3 4 5
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
0 NULL 5 6 NULL 0 NULL
@@ -32175,8 +32250,33 @@ c1 c2 c3 c4 c5 c6 c7
18446744073709551615 9223372036854775807 26 27 28 29 30
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
+0 0 32 32 34 35 36
+0 -9223372036854775808 31 32 33 34 35
+0 124 27 28 29 30 31
+0 124 22 23 24 25 26
+0 0 17 18 19 20 21
+0 -9223372036854775808 1 2 3 4 5
+0 NULL 5 6 NULL 0 NULL
+101 -102 103 104 105 106 107
+101 0 37 38 39 40 41
+102 -109 110 111 112 113 114
+103 -109 110 111 112 113 114
+105 NULL 102 103 104 105 106
+108 -109 110 111 112 113 114
+108 -109 110 111 112 102 114
+108 -109 110 111 112 101 114
+115 -116 117 118 119 120 121
+122 -123 124 125 126 127 128
+255 -2147483648 6 7 8 9 10
+65535 -8388608 11 12 13 14 15
+16777215 -32768 16 17 18 19 20
+4294967295 -128 21 22 23 24 25
+18446744073709551615 9223372036854775807 36 37 38 39 40
+18446744073709551615 9223372036854775807 26 27 28 29 30
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
+0 0 32 32 34 35 36
+0 -9223372036854775808 31 32 33 34 35
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
0 0 32 32 34 35 36
diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result
index ea6e10d130b..c7a0dbcba86 100644
--- a/mysql-test/suite/engines/iuds/r/insert_year.result
+++ b/mysql-test/suite/engines/iuds/r/insert_year.result
@@ -60,12 +60,12 @@ Warning 1264 Out of range value for column 'c1' at row 6
Warning 1264 Out of range value for column 'c2' at row 6
INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */;
Warnings:
-Warning 1366 Incorrect integer value: 'abcd' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'abcd' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1
Warning 1264 Out of range value for column 'c1' at row 2
Warning 1264 Out of range value for column 'c2' at row 2
INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45');
@@ -3319,12 +3319,12 @@ Warning 1264 Out of range value for column 'c1' at row 6
Warning 1264 Out of range value for column 'c2' at row 6
INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: '' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1
INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */;
Warnings:
-Warning 1366 Incorrect integer value: 'abcd' for column 'c1' at row 1
-Warning 1366 Incorrect integer value: 'abcd' for column 'c2' at row 1
+Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1
+Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1
Warning 1264 Out of range value for column 'c1' at row 2
Warning 1264 Out of range value for column 'c2' at row 2
INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45');
diff --git a/mysql-test/suite/engines/iuds/r/update_decimal.result b/mysql-test/suite/engines/iuds/r/update_decimal.result
index 7b4a3ea9079..8bedcf8ab51 100644
--- a/mysql-test/suite/engines/iuds/r/update_decimal.result
+++ b/mysql-test/suite/engines/iuds/r/update_decimal.result
@@ -334,7 +334,7 @@ INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555'
UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3;
UPDATE IGNORE t1 SET c3='asdf' WHERE c1='11111.11111';
Warnings:
-Warning 1366 Incorrect decimal value: 'asdf' for column 'c3' at row 1
+Warning 1366 Incorrect decimal value: 'asdf' for column `test`.`t1`.`c3` at row 1
SELECT c3 FROM t1;
c3
0
@@ -1099,7 +1099,7 @@ INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555'
UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3;
UPDATE IGNORE t1 SET c3='asdf' WHERE c1='11111.11111';
Warnings:
-Warning 1366 Incorrect double value: 'asdf' for column 'c3' at row 1
+Warning 1366 Incorrect double value: 'asdf' for column `test`.`t1`.`c3` at row 1
SELECT c3 FROM t1;
c3
0
diff --git a/mysql-test/suite/engines/iuds/r/update_delete_number.result b/mysql-test/suite/engines/iuds/r/update_delete_number.result
index b091d27d1e6..1cd2a62cb56 100644
--- a/mysql-test/suite/engines/iuds/r/update_delete_number.result
+++ b/mysql-test/suite/engines/iuds/r/update_delete_number.result
@@ -3767,8 +3767,25 @@ c1 c2 c3
-12 18446744073709551615 12
SELECT * FROM t2 WHERE c2 BETWEEN 0 AND 18446744073709551615 ORDER BY c2,c1;
c1 c2 c3
+-4 4 4
+-9 9 9
+0 255 13
+-9223372036854775808 18446744073709551615 12
+-12 18446744073709551615 12
+-11 18446744073709551615 11
+-8 18446744073709551615 8
+-7 18446744073709551615 7
+-6 18446744073709551615 6
+-5 18446744073709551615 5
+-3 18446744073709551615 3
+-2 18446744073709551615 2
+-1 18446744073709551615 1
+50 18446744073709551615 10
+9223372036854775807 18446744073709551615 14
SELECT * FROM t2 WHERE c2 BETWEEN 0 AND 18446744073709551615 ORDER BY c2,c1 DESC LIMIT 2;
c1 c2 c3
+-4 4 4
+-9 9 9
SELECT * FROM t2 WHERE c2 IN(0,18446744073709551615) ORDER BY c2,c1 DESC;
c1 c2 c3
9223372036854775807 18446744073709551615 14
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index 45c04e32de8..7850e017fb2 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -3715,8 +3715,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 3
+Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3731,8 +3731,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 1
+Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -3749,8 +3749,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 24
Warnings:
-Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 3
+Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as time) AS `CAST(my_bigint AS TIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3765,8 +3765,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 24
Warnings:
-Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 1
+Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
@@ -4061,10 +4061,10 @@ NULL 1.7976931348623e308 3
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 19
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 19
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4079,10 +4079,10 @@ NULL 1.7976931348623e308 3
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -4099,10 +4099,10 @@ NULL 9223372036854775807 3
NULL -1 5
NULL 200506271758 18
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 18
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 18
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as datetime) AS `CAST(my_bigint AS DATETIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4117,10 +4117,10 @@ NULL 9223372036854775807 3
NULL -1 5
NULL 200506271758 18
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 1
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
@@ -4421,9 +4421,9 @@ NULL 1.7976931348623e308 3
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4438,9 +4438,9 @@ NULL 1.7976931348623e308 3
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -4457,9 +4457,9 @@ NULL 9223372036854775807 3
NULL -1 5
2005-06-27 20050627 12
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as date) AS `CAST(my_bigint AS DATE)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4474,9 +4474,9 @@ NULL 9223372036854775807 3
NULL -1 5
2005-06-27 20050627 12
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraint.result b/mysql-test/suite/funcs_1/r/is_check_constraint.result
new file mode 100644
index 00000000000..be44a8867e8
--- /dev/null
+++ b/mysql-test/suite/funcs_1/r/is_check_constraint.result
@@ -0,0 +1,121 @@
+#
+# MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
+#
+CREATE user boo1;
+GRANT select,create,alter,drop on foo.* to boo1;
+SHOW GRANTS for boo1;
+Grants for boo1@%
+GRANT USAGE ON *.* TO 'boo1'@'%'
+GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%'
+CREATE user boo2;
+create database foo;
+CONNECT con1,localhost, boo1,, foo;
+SET check_constraint_checks=1;
+CREATE TABLE t0
+(
+t int, check (t>32) # table constraint
+) ENGINE=myisam;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CONSTRAINT_1 t0 `t` > 32
+ALTER TABLE t0
+ADD CONSTRAINT CHK_t0_t CHECK(t<100);
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CHK_t0_t t0 `t` < 100
+def foo CONSTRAINT_1 t0 `t` > 32
+ALTER TABLE t0
+DROP CONSTRAINT CHK_t0_t;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CONSTRAINT_1 t0 `t` > 32
+ALTER TABLE t0
+ADD CONSTRAINT CHECK(t<50);
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CONSTRAINT_1 t0 `t` > 32
+def foo CONSTRAINT_2 t0 `t` < 50
+CREATE TABLE t1
+( t int CHECK(t>2), # field constraint
+tt int,
+CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
+CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
+) ENGINE=InnoDB;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CHK_tt t1 `tt` < 100
+def foo CONSTRAINT_1 t0 `t` > 32
+def foo CONSTRAINT_1 t1 `tt` > 32
+def foo CONSTRAINT_2 t0 `t` < 50
+def foo CONSTRAINT_2 t1 `tt` < 50
+def foo t t1 `t` > 2
+ALTER TABLE t1
+DROP CONSTRAINT CHK_tt;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CONSTRAINT_1 t0 `t` > 32
+def foo CONSTRAINT_1 t1 `tt` > 32
+def foo CONSTRAINT_2 t0 `t` < 50
+def foo CONSTRAINT_2 t1 `tt` < 50
+def foo t t1 `t` > 2
+CREATE TABLE t2
+(
+name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
+start_date DATE,
+end_date DATE,
+CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
+)ENGINE=Innodb;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CHK_dates t2 `start_date` is null
+def foo CONSTRAINT_1 t0 `t` > 32
+def foo CONSTRAINT_1 t1 `tt` > 32
+def foo CONSTRAINT_2 t0 `t` < 50
+def foo CONSTRAINT_2 t1 `tt` < 50
+def foo name t2 char_length(`name`) > 2
+def foo t t1 `t` > 2
+ALTER TABLE t1
+ADD CONSTRAINT CHK_new_ CHECK(t>tt);
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CHK_dates t2 `start_date` is null
+def foo CHK_new_ t1 `t` > `tt`
+def foo CONSTRAINT_1 t0 `t` > 32
+def foo CONSTRAINT_1 t1 `tt` > 32
+def foo CONSTRAINT_2 t0 `t` < 50
+def foo CONSTRAINT_2 t1 `tt` < 50
+def foo name t2 char_length(`name`) > 2
+def foo t t1 `t` > 2
+CREATE TABLE t3
+(
+a int,
+b int check (b>0), # field constraint named 'b'
+CONSTRAINT b check (b>10) # table constraint
+) ENGINE=InnoDB;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+def foo CHK_dates t2 `start_date` is null
+def foo CHK_new_ t1 `t` > `tt`
+def foo CONSTRAINT_1 t0 `t` > 32
+def foo CONSTRAINT_1 t1 `tt` > 32
+def foo CONSTRAINT_2 t0 `t` < 50
+def foo CONSTRAINT_2 t1 `tt` < 50
+def foo b t3 `b` > 0
+def foo b t3 `b` > 10
+def foo name t2 char_length(`name`) > 2
+def foo t t1 `t` > 2
+disconnect con1;
+CONNECT con2, localhost, boo2,, test;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
+disconnect con2;
+CONNECT con1, localhost, boo1,,foo;
+DROP TABLE t0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP DATABASE foo;
+disconnect con1;
+connection default;
+DROP USER boo1;
+DROP USER boo2;
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraints.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result
index 678cfb8db2f..eaf90f44544 100644
--- a/mysql-test/suite/funcs_1/r/is_check_constraints.result
+++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result
@@ -9,6 +9,11 @@ t int, check (t>32) # table constraint
) ENGINE=myisam;
SELECT * from information_schema.check_constraints order by check_clause;
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME Priv
+TABLE_NAME global_priv
+CHECK_CLAUSE json_valid(`Priv`)
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME CONSTRAINT_1
TABLE_NAME t0
@@ -17,6 +22,11 @@ ALTER TABLE t0
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
SELECT * from information_schema.check_constraints order by check_clause;
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME Priv
+TABLE_NAME global_priv
+CHECK_CLAUSE json_valid(`Priv`)
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME CHK_t0_t
TABLE_NAME t0
@@ -30,6 +40,11 @@ ALTER TABLE t0
DROP CONSTRAINT CHK_t0_t;
SELECT * from information_schema.check_constraints order by check_clause;
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME Priv
+TABLE_NAME global_priv
+CHECK_CLAUSE json_valid(`Priv`)
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME CONSTRAINT_1
TABLE_NAME t0
@@ -40,6 +55,11 @@ tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
) ENGINE=InnoDB;
SELECT * from information_schema.check_constraints order by check_clause;
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME Priv
+TABLE_NAME global_priv
+CHECK_CLAUSE json_valid(`Priv`)
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME CHK_tt
TABLE_NAME t1
@@ -58,6 +78,11 @@ ALTER TABLE t1
DROP CONSTRAINT CHK_tt;
SELECT * from information_schema.check_constraints order by check_clause;
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME Priv
+TABLE_NAME global_priv
+CHECK_CLAUSE json_valid(`Priv`)
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME t
TABLE_NAME t1
@@ -81,6 +106,11 @@ CONSTRAINT_NAME name
TABLE_NAME t2
CHECK_CLAUSE char_length(`name`) > 2
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME Priv
+TABLE_NAME global_priv
+CHECK_CLAUSE json_valid(`Priv`)
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME CHK_dates
TABLE_NAME t2
@@ -104,6 +134,11 @@ CONSTRAINT_NAME name
TABLE_NAME t2
CHECK_CLAUSE char_length(`name`) > 2
CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA mysql
+CONSTRAINT_NAME Priv
+TABLE_NAME global_priv
+CHECK_CLAUSE json_valid(`Priv`)
+CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA test
CONSTRAINT_NAME CHK_dates
TABLE_NAME t2
@@ -132,6 +167,7 @@ CONSTRAINT b check (b>10) # table constraint
select * from information_schema.check_constraints order by check_clause;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
def test name t2 char_length(`name`) > 2
+def mysql Priv global_priv json_valid(`Priv`)
def test b t3 `b` > 0
def test b t3 `b` > 10
def test CHK_dates t2 `start_date` is null
diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
index 8f2ba33b591..fbca906a9fb 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
@@ -359,9 +359,9 @@ drop TABLE if exists t7, t8;
CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = InnoDB;
CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = InnoDB;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' INTO TABLE t7;
-ERROR 22007: Incorrect date value: '' for column 'f3' at row 1
+ERROR 22007: Incorrect date value: '' for column `test`.`t7`.`f3` at row 1
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' INTO TABLE t8;
-ERROR 22007: Incorrect date value: '' for column 'f3' at row 1
+ERROR 22007: Incorrect date value: '' for column `test`.`t8`.`f3` at row 1
drop TABLE if exists t9;
CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = InnoDB;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' INTO TABLE t9;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
index 5a7fdbd63c9..31160f8a3ec 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
@@ -61,7 +61,7 @@ def mysql event modified 9 '0000-00-00 00:00:00' NO timestamp NULL NULL NULL NUL
def mysql event name 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references NEVER NULL
def mysql event on_completion 14 'DROP' NO enum 8 24 NULL NULL NULL utf8 utf8_general_ci enum('DROP','PRESERVE') select,insert,update,references NEVER NULL
def mysql event originator 17 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL
-def mysql event sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') select,insert,update,references NEVER NULL
+def mysql event sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') select,insert,update,references NEVER NULL
def mysql event starts 11 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references NEVER NULL
def mysql event status 13 'ENABLED' NO enum 18 54 NULL NULL NULL utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') select,insert,update,references NEVER NULL
def mysql event time_zone 18 'SYSTEM' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) select,insert,update,references NEVER NULL
@@ -75,6 +75,9 @@ def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL N
def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL
def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references NEVER NULL
def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references NEVER NULL
+def mysql global_priv Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references NEVER NULL
+def mysql global_priv Priv 3 '{}' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
+def mysql global_priv User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL
def mysql gtid_slave_pos domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI select,insert,update,references NEVER NULL
def mysql gtid_slave_pos seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def mysql gtid_slave_pos server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL
@@ -133,7 +136,7 @@ def mysql proc returns 10 NULL NO longblob 4294967295 4294967295 NULL NULL NULL
def mysql proc security_type 8 'DEFINER' NO enum 7 21 NULL NULL NULL utf8 utf8_general_ci enum('INVOKER','DEFINER') select,insert,update,references NEVER NULL
def mysql proc specific_name 4 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
def mysql proc sql_data_access 6 'CONTAINS_SQL' NO enum 17 51 NULL NULL NULL utf8 utf8_general_ci enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') select,insert,update,references NEVER NULL
-def mysql proc sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') select,insert,update,references NEVER NULL
+def mysql proc sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') select,insert,update,references NEVER NULL
def mysql proc type 3 NULL NO enum 12 36 NULL NULL NULL utf8 utf8_general_ci enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') PRI select,insert,update,references NEVER NULL
def mysql procs_priv Db 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references NEVER NULL
def mysql procs_priv Grantor 6 '' NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL select,insert,update,references NEVER NULL
@@ -206,53 +209,53 @@ def mysql transaction_registry commit_id 2 NULL NO bigint NULL NULL 20 0 NULL NU
def mysql transaction_registry commit_timestamp 4 '0000-00-00 00:00:00.000000' NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) MUL select,insert,update,references NEVER NULL
def mysql transaction_registry isolation_level 5 NULL NO enum 16 48 NULL NULL NULL utf8 utf8_bin enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') select,insert,update,references NEVER NULL
def mysql transaction_registry transaction_id 1 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI select,insert,update,references NEVER NULL
-def mysql user Alter_priv 17 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Alter_routine_priv 28 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user authentication_string 43 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text select,insert,update,references NEVER NULL
-def mysql user Create_priv 8 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Create_routine_priv 27 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Create_tablespace_priv 32 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Create_tmp_table_priv 20 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Create_user_priv 29 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Create_view_priv 25 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user default_role 46 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) select,insert,update,references NEVER NULL
-def mysql user Delete_history_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Event_priv 30 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Execute_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user File_priv 13 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Grant_priv 14 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references NEVER NULL
-def mysql user Index_priv 16 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Insert_priv 5 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user is_role 45 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Lock_tables_priv 21 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user max_connections 40 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references NEVER NULL
-def mysql user max_questions 38 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references NEVER NULL
+def mysql user Alter_priv 17 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Alter_routine_priv 28 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user authentication_string 43 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
+def mysql user Create_priv 8 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Create_routine_priv 27 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Create_tablespace_priv 32 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Create_tmp_table_priv 20 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Create_user_priv 29 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Create_view_priv 25 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user default_role 46 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
+def mysql user Delete_history_priv 33 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Delete_priv 7 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Drop_priv 9 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Event_priv 30 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Execute_priv 22 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user File_priv 13 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Grant_priv 14 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
+def mysql user Index_priv 16 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Insert_priv 5 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user is_role 45 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Lock_tables_priv 21 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user max_connections 40 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
+def mysql user max_questions 38 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def mysql user max_statement_time 47 0.000000 NO decimal NULL NULL 12 6 NULL NULL NULL decimal(12,6) select,insert,update,references NEVER NULL
-def mysql user max_updates 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references NEVER NULL
-def mysql user max_user_connections 41 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL
-def mysql user Password 3 '' NO char 41 41 NULL NULL NULL latin1 latin1_bin char(41) select,insert,update,references NEVER NULL
-def mysql user password_expired 44 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user plugin 42 '' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) select,insert,update,references NEVER NULL
-def mysql user Process_priv 12 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user References_priv 15 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Reload_priv 10 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Repl_client_priv 24 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Repl_slave_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Select_priv 4 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Show_db_priv 18 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Show_view_priv 26 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Shutdown_priv 11 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user ssl_cipher 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL
-def mysql user ssl_type 34 '' NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') select,insert,update,references NEVER NULL
-def mysql user Super_priv 19 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Trigger_priv 31 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL
-def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL
-def mysql user x509_issuer 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL
-def mysql user x509_subject 37 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL
+def mysql user max_updates 39 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
+def mysql user max_user_connections 41 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select,insert,update,references NEVER NULL
+def mysql user Password 3 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
+def mysql user password_expired 44 '' NO varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user plugin 42 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
+def mysql user Process_priv 12 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user References_priv 15 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Reload_priv 10 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Repl_client_priv 24 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Repl_slave_priv 23 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Select_priv 4 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Show_db_priv 18 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Show_view_priv 26 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Shutdown_priv 11 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user ssl_cipher 35 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
+def mysql user ssl_type 34 NULL YES varchar 9 9 NULL NULL NULL latin1 latin1_swedish_ci varchar(9) select,insert,update,references NEVER NULL
+def mysql user Super_priv 19 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Trigger_priv 31 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user Update_priv 6 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL
+def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) select,insert,update,references NEVER NULL
+def mysql user x509_issuer 36 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
+def mysql user x509_subject 37 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL
##########################################################################
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
##########################################################################
@@ -269,11 +272,12 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
1.0000 blob NULL NULL
1.0000 longblob NULL NULL
1.0000 varbinary NULL NULL
-1.0000 char latin1 latin1_bin
1.0000 char latin1 latin1_swedish_ci
+1.0000 varchar latin1 latin1_swedish_ci
1.0000 text utf8 utf8_bin
1.0000 mediumtext utf8 utf8_general_ci
1.0000 text utf8 utf8_general_ci
+1.0000 longtext utf8mb4 utf8mb4_bin
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
@@ -380,7 +384,7 @@ NULL mysql event starts datetime NULL NULL NULL NULL datetime
NULL mysql event ends datetime NULL NULL NULL NULL datetime
3.0000 mysql event status enum 18 54 utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED')
3.0000 mysql event on_completion enum 8 24 utf8 utf8_general_ci enum('DROP','PRESERVE')
-3.0000 mysql event sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT')
+3.0000 mysql event sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL')
3.0000 mysql event comment char 64 192 utf8 utf8_bin char(64)
NULL mysql event originator int NULL NULL NULL NULL int(10) unsigned
1.0000 mysql event time_zone char 64 64 latin1 latin1_swedish_ci char(64)
@@ -398,6 +402,9 @@ NULL mysql general_log thread_id bigint NULL NULL NULL NULL bigint(21) unsigned
NULL mysql general_log server_id int NULL NULL NULL NULL int(10) unsigned
3.0000 mysql general_log command_type varchar 64 192 utf8 utf8_general_ci varchar(64)
1.0000 mysql general_log argument mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext
+3.0000 mysql global_priv Host char 60 180 utf8 utf8_bin char(60)
+3.0000 mysql global_priv User char 80 240 utf8 utf8_bin char(80)
+1.0000 mysql global_priv Priv longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
NULL mysql gtid_slave_pos domain_id int NULL NULL NULL NULL int(10) unsigned
NULL mysql gtid_slave_pos sub_id bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql gtid_slave_pos server_id int NULL NULL NULL NULL int(10) unsigned
@@ -451,7 +458,7 @@ NULL mysql innodb_table_stats sum_of_other_index_sizes bigint NULL NULL NULL NUL
3.0000 mysql proc definer char 141 423 utf8 utf8_bin char(141)
NULL mysql proc created timestamp NULL NULL NULL NULL timestamp
NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
-3.0000 mysql proc sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT')
+3.0000 mysql proc sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL')
1.0000 mysql proc comment text 65535 65535 utf8 utf8_bin text
3.0000 mysql proc character_set_client char 32 96 utf8 utf8_bin char(32)
3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32)
@@ -531,48 +538,48 @@ NULL mysql transaction_registry commit_timestamp timestamp NULL NULL NULL NULL t
3.0000 mysql transaction_registry isolation_level enum 16 48 utf8 utf8_bin enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE')
3.0000 mysql user Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql user User char 80 240 utf8 utf8_bin char(80)
-1.0000 mysql user Password char 41 41 latin1 latin1_bin char(41)
-3.0000 mysql user Select_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Insert_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Update_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Delete_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Drop_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Reload_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Shutdown_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Process_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user File_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Grant_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user References_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Index_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Alter_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Show_db_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Super_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_tmp_table_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Lock_tables_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Repl_slave_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Repl_client_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Show_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_user_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Event_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_tablespace_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Delete_history_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user ssl_type enum 9 27 utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED')
-1.0000 mysql user ssl_cipher blob 65535 65535 NULL NULL blob
-1.0000 mysql user x509_issuer blob 65535 65535 NULL NULL blob
-1.0000 mysql user x509_subject blob 65535 65535 NULL NULL blob
-NULL mysql user max_questions int NULL NULL NULL NULL int(11) unsigned
-NULL mysql user max_updates int NULL NULL NULL NULL int(11) unsigned
-NULL mysql user max_connections int NULL NULL NULL NULL int(11) unsigned
-NULL mysql user max_user_connections int NULL NULL NULL NULL int(11)
-1.0000 mysql user plugin char 64 64 latin1 latin1_swedish_ci char(64)
-1.0000 mysql user authentication_string text 65535 65535 utf8 utf8_bin text
-3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80)
+1.0000 mysql user Password longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user Select_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Insert_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Update_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Delete_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Drop_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Reload_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Shutdown_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Process_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user File_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Grant_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user References_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Index_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Alter_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Show_db_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Super_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_tmp_table_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Lock_tables_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Execute_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Repl_slave_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Repl_client_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Show_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Alter_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_user_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Event_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Trigger_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_tablespace_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Delete_history_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user ssl_type varchar 9 9 latin1 latin1_swedish_ci varchar(9)
+1.0000 mysql user ssl_cipher longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user x509_issuer longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user x509_subject longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+NULL mysql user max_questions bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql user max_updates bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql user max_connections bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql user max_user_connections bigint NULL NULL NULL NULL bigint(21)
+1.0000 mysql user plugin longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user authentication_string longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user password_expired varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user is_role varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user default_role longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
index 440478b892d..6ad671a54c8 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
@@ -61,7 +61,7 @@ def mysql event modified 9 '0000-00-00 00:00:00' NO timestamp NULL NULL NULL NUL
def mysql event name 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI NEVER NULL
def mysql event on_completion 14 'DROP' NO enum 8 24 NULL NULL NULL utf8 utf8_general_ci enum('DROP','PRESERVE') NEVER NULL
def mysql event originator 17 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned NEVER NULL
-def mysql event sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NEVER NULL
+def mysql event sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NEVER NULL
def mysql event starts 11 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL
def mysql event status 13 'ENABLED' NO enum 18 54 NULL NULL NULL utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NEVER NULL
def mysql event time_zone 18 'SYSTEM' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) NEVER NULL
@@ -75,6 +75,9 @@ def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL N
def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned NEVER NULL
def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL
def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext NEVER NULL
+def mysql global_priv Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI NEVER NULL
+def mysql global_priv Priv 3 '{}' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
+def mysql global_priv User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI NEVER NULL
def mysql gtid_slave_pos domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI NEVER NULL
def mysql gtid_slave_pos seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL
def mysql gtid_slave_pos server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned NEVER NULL
@@ -119,7 +122,7 @@ def mysql proc returns 10 NULL NO longblob 4294967295 4294967295 NULL NULL NULL
def mysql proc security_type 8 'DEFINER' NO enum 7 21 NULL NULL NULL utf8 utf8_general_ci enum('INVOKER','DEFINER') NEVER NULL
def mysql proc specific_name 4 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL
def mysql proc sql_data_access 6 'CONTAINS_SQL' NO enum 17 51 NULL NULL NULL utf8 utf8_general_ci enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NEVER NULL
-def mysql proc sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NEVER NULL
+def mysql proc sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NEVER NULL
def mysql proc type 3 NULL NO enum 12 36 NULL NULL NULL utf8 utf8_general_ci enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') PRI NEVER NULL
def mysql procs_priv Db 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI NEVER NULL
def mysql procs_priv Grantor 6 '' NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL NEVER NULL
@@ -187,53 +190,53 @@ def mysql time_zone_transition_type Is_DST 4 0 NO tinyint NULL NULL 3 0 NULL NUL
def mysql time_zone_transition_type Offset 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL
def mysql time_zone_transition_type Time_zone_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI NEVER NULL
def mysql time_zone_transition_type Transition_type_id 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI NEVER NULL
-def mysql user Alter_priv 17 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Alter_routine_priv 28 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user authentication_string 43 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text NEVER NULL
-def mysql user Create_priv 8 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Create_routine_priv 27 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Create_tablespace_priv 32 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Create_tmp_table_priv 20 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Create_user_priv 29 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Create_view_priv 25 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user default_role 46 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) NEVER NULL
-def mysql user Delete_history_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Event_priv 30 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Execute_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user File_priv 13 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Grant_priv 14 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI NEVER NULL
-def mysql user Index_priv 16 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Insert_priv 5 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user is_role 45 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Lock_tables_priv 21 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user max_connections 40 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned NEVER NULL
-def mysql user max_questions 38 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned NEVER NULL
+def mysql user Alter_priv 17 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Alter_routine_priv 28 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user authentication_string 43 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
+def mysql user Create_priv 8 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Create_routine_priv 27 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Create_tablespace_priv 32 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Create_tmp_table_priv 20 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Create_user_priv 29 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Create_view_priv 25 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user default_role 46 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
+def mysql user Delete_history_priv 33 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Delete_priv 7 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Drop_priv 9 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Event_priv 30 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Execute_priv 22 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user File_priv 13 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Grant_priv 14 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) NEVER NULL
+def mysql user Index_priv 16 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Insert_priv 5 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user is_role 45 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Lock_tables_priv 21 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user max_connections 40 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL
+def mysql user max_questions 38 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL
def mysql user max_statement_time 47 0.000000 NO decimal NULL NULL 12 6 NULL NULL NULL decimal(12,6) NEVER NULL
-def mysql user max_updates 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned NEVER NULL
-def mysql user max_user_connections 41 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL
-def mysql user Password 3 '' NO char 41 41 NULL NULL NULL latin1 latin1_bin char(41) NEVER NULL
-def mysql user password_expired 44 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user plugin 42 '' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) NEVER NULL
-def mysql user Process_priv 12 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user References_priv 15 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Reload_priv 10 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Repl_client_priv 24 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Repl_slave_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Select_priv 4 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Show_db_priv 18 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Show_view_priv 26 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Shutdown_priv 11 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user ssl_cipher 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL
-def mysql user ssl_type 34 '' NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') NEVER NULL
-def mysql user Super_priv 19 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Trigger_priv 31 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL
-def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI NEVER NULL
-def mysql user x509_issuer 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL
-def mysql user x509_subject 37 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL
+def mysql user max_updates 39 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL
+def mysql user max_user_connections 41 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
+def mysql user Password 3 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
+def mysql user password_expired 44 '' NO varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user plugin 42 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
+def mysql user Process_priv 12 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user References_priv 15 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Reload_priv 10 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Repl_client_priv 24 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Repl_slave_priv 23 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Select_priv 4 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Show_db_priv 18 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Show_view_priv 26 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Shutdown_priv 11 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user ssl_cipher 35 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
+def mysql user ssl_type 34 NULL YES varchar 9 9 NULL NULL NULL latin1 latin1_swedish_ci varchar(9) NEVER NULL
+def mysql user Super_priv 19 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Trigger_priv 31 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user Update_priv 6 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL
+def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) NEVER NULL
+def mysql user x509_issuer 36 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
+def mysql user x509_subject 37 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
@@ -254,11 +257,12 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
1.0000 blob NULL NULL
1.0000 longblob NULL NULL
1.0000 varbinary NULL NULL
-1.0000 char latin1 latin1_bin
1.0000 char latin1 latin1_swedish_ci
+1.0000 varchar latin1 latin1_swedish_ci
1.0000 text utf8 utf8_bin
1.0000 mediumtext utf8 utf8_general_ci
1.0000 text utf8 utf8_general_ci
+1.0000 longtext utf8mb4 utf8mb4_bin
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
@@ -377,7 +381,7 @@ NULL mysql event starts datetime NULL NULL NULL NULL datetime
NULL mysql event ends datetime NULL NULL NULL NULL datetime
3.0000 mysql event status enum 18 54 utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED')
3.0000 mysql event on_completion enum 8 24 utf8 utf8_general_ci enum('DROP','PRESERVE')
-3.0000 mysql event sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT')
+3.0000 mysql event sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL')
3.0000 mysql event comment char 64 192 utf8 utf8_bin char(64)
NULL mysql event originator int NULL NULL NULL NULL int(10) unsigned
1.0000 mysql event time_zone char 64 64 latin1 latin1_swedish_ci char(64)
@@ -395,6 +399,9 @@ NULL mysql general_log thread_id bigint NULL NULL NULL NULL bigint(21) unsigned
NULL mysql general_log server_id int NULL NULL NULL NULL int(10) unsigned
3.0000 mysql general_log command_type varchar 64 192 utf8 utf8_general_ci varchar(64)
1.0000 mysql general_log argument mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext
+3.0000 mysql global_priv Host char 60 180 utf8 utf8_bin char(60)
+3.0000 mysql global_priv User char 80 240 utf8 utf8_bin char(80)
+1.0000 mysql global_priv Priv longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
NULL mysql gtid_slave_pos domain_id int NULL NULL NULL NULL int(10) unsigned
NULL mysql gtid_slave_pos sub_id bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql gtid_slave_pos server_id int NULL NULL NULL NULL int(10) unsigned
@@ -434,7 +441,7 @@ NULL mysql index_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
3.0000 mysql proc definer char 141 423 utf8 utf8_bin char(141)
NULL mysql proc created timestamp NULL NULL NULL NULL timestamp
NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
-3.0000 mysql proc sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT')
+3.0000 mysql proc sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL')
1.0000 mysql proc comment text 65535 65535 utf8 utf8_bin text
3.0000 mysql proc character_set_client char 32 96 utf8 utf8_bin char(32)
3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32)
@@ -509,50 +516,50 @@ NULL mysql time_zone_transition_type Is_DST tinyint NULL NULL NULL NULL tinyint(
3.0000 mysql time_zone_transition_type Abbreviation char 8 24 utf8 utf8_general_ci char(8)
3.0000 mysql user Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql user User char 80 240 utf8 utf8_bin char(80)
-1.0000 mysql user Password char 41 41 latin1 latin1_bin char(41)
-3.0000 mysql user Select_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Insert_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Update_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Delete_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Drop_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Reload_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Shutdown_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Process_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user File_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Grant_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user References_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Index_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Alter_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Show_db_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Super_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_tmp_table_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Lock_tables_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Repl_slave_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Repl_client_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Show_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_user_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Event_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Create_tablespace_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user Delete_history_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user ssl_type enum 9 27 utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED')
-1.0000 mysql user ssl_cipher blob 65535 65535 NULL NULL blob
-1.0000 mysql user x509_issuer blob 65535 65535 NULL NULL blob
-1.0000 mysql user x509_subject blob 65535 65535 NULL NULL blob
-NULL mysql user max_questions int NULL NULL NULL NULL int(11) unsigned
-NULL mysql user max_updates int NULL NULL NULL NULL int(11) unsigned
-NULL mysql user max_connections int NULL NULL NULL NULL int(11) unsigned
-NULL mysql user max_user_connections int NULL NULL NULL NULL int(11)
-1.0000 mysql user plugin char 64 64 latin1 latin1_swedish_ci char(64)
-1.0000 mysql user authentication_string text 65535 65535 utf8 utf8_bin text
-3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y')
-3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80)
+1.0000 mysql user Password longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user Select_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Insert_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Update_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Delete_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Drop_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Reload_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Shutdown_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Process_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user File_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Grant_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user References_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Index_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Alter_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Show_db_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Super_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_tmp_table_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Lock_tables_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Execute_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Repl_slave_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Repl_client_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Show_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Alter_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_user_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Event_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Trigger_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Create_tablespace_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user Delete_history_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user ssl_type varchar 9 9 latin1 latin1_swedish_ci varchar(9)
+1.0000 mysql user ssl_cipher longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user x509_issuer longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user x509_subject longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+NULL mysql user max_questions bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql user max_updates bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql user max_connections bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql user max_user_connections bigint NULL NULL NULL NULL bigint(21)
+1.0000 mysql user plugin longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user authentication_string longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
+1.0000 mysql user password_expired varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user is_role varchar 1 1 latin1 latin1_swedish_ci varchar(1)
+1.0000 mysql user default_role longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6)
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage.result b/mysql-test/suite/funcs_1/r/is_key_column_usage.result
index 326ea3f4acc..efb67e32cee 100644
--- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result
+++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result
@@ -90,6 +90,8 @@ def mysql PRIMARY def mysql db User
def mysql PRIMARY def mysql event db
def mysql PRIMARY def mysql event name
def mysql PRIMARY def mysql func name
+def mysql PRIMARY def mysql global_priv Host
+def mysql PRIMARY def mysql global_priv User
def mysql PRIMARY def mysql gtid_slave_pos domain_id
def mysql PRIMARY def mysql gtid_slave_pos sub_id
def mysql PRIMARY def mysql help_category help_category_id
@@ -142,8 +144,6 @@ def mysql PRIMARY def mysql time_zone_transition_type Time_zone_id
def mysql PRIMARY def mysql time_zone_transition_type Transition_type_id
def mysql commit_id def mysql transaction_registry commit_id
def mysql PRIMARY def mysql transaction_registry transaction_id
-def mysql PRIMARY def mysql user Host
-def mysql PRIMARY def mysql user User
########################################################################################
# Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.KEY_COLUMN_USAGE accessible information
########################################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result b/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result
index a547b1ddf61..cf67be8f7a0 100644
--- a/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result
@@ -90,6 +90,8 @@ def mysql PRIMARY def mysql db User
def mysql PRIMARY def mysql event db
def mysql PRIMARY def mysql event name
def mysql PRIMARY def mysql func name
+def mysql PRIMARY def mysql global_priv Host
+def mysql PRIMARY def mysql global_priv User
def mysql PRIMARY def mysql gtid_slave_pos domain_id
def mysql PRIMARY def mysql gtid_slave_pos sub_id
def mysql PRIMARY def mysql help_category help_category_id
@@ -142,8 +144,6 @@ def mysql PRIMARY def mysql time_zone_transition_type Time_zone_id
def mysql PRIMARY def mysql time_zone_transition_type Transition_type_id
def mysql commit_id def mysql transaction_registry commit_id
def mysql PRIMARY def mysql transaction_registry transaction_id
-def mysql PRIMARY def mysql user Host
-def mysql PRIMARY def mysql user User
########################################################################################
# Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.KEY_COLUMN_USAGE accessible information
########################################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_routines_embedded.result b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
index cb736417a17..ec375e9c5f6 100644
--- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
@@ -197,7 +197,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.routines;
@@ -209,7 +209,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.routines;
@@ -221,7 +221,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connection default;
disconnect testuser1;
diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result
index 2cb94b657cc..bacc106a1be 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics.result
@@ -101,6 +101,8 @@ def mysql db mysql User
def mysql event mysql PRIMARY
def mysql event mysql PRIMARY
def mysql func mysql PRIMARY
+def mysql global_priv mysql PRIMARY
+def mysql global_priv mysql PRIMARY
def mysql gtid_slave_pos mysql PRIMARY
def mysql gtid_slave_pos mysql PRIMARY
def mysql help_category mysql name
@@ -148,8 +150,6 @@ def mysql time_zone_transition mysql PRIMARY
def mysql time_zone_transition mysql PRIMARY
def mysql time_zone_transition_type mysql PRIMARY
def mysql time_zone_transition_type mysql PRIMARY
-def mysql user mysql PRIMARY
-def mysql user mysql PRIMARY
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
index 96d85a0425f..c01c456edf8 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
@@ -22,6 +22,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE
def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE
def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
+def mysql global_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
+def mysql global_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE
def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE
def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE
@@ -80,8 +82,6 @@ def mysql transaction_registry 0 mysql commit_id 1 commit_id A #CARD# NULL NULL
def mysql transaction_registry 1 mysql commit_timestamp 1 commit_timestamp A #CARD# NULL NULL BTREE
def mysql transaction_registry 1 mysql commit_timestamp 2 transaction_id A #CARD# NULL NULL BTREE
def mysql transaction_registry 0 mysql PRIMARY 1 transaction_id A #CARD# NULL NULL BTREE
-def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
-def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.statistics
WHERE table_schema = 'mysql'
diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
index 69a502e53dd..b7bd3ec2e23 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
@@ -22,6 +22,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE
def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE
def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
+def mysql global_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
+def mysql global_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE
def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE
def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE
@@ -80,8 +82,6 @@ def mysql transaction_registry 0 mysql commit_id 1 commit_id A #CARD# NULL NULL
def mysql transaction_registry 1 mysql commit_timestamp 1 commit_timestamp A #CARD# NULL NULL BTREE
def mysql transaction_registry 1 mysql commit_timestamp 2 transaction_id A #CARD# NULL NULL BTREE
def mysql transaction_registry 0 mysql PRIMARY 1 transaction_id A #CARD# NULL NULL BTREE
-def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
-def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.statistics
WHERE table_schema = 'mysql'
@@ -102,6 +102,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE
def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE
def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
+def mysql global_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
+def mysql global_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE
def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE
def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE
@@ -160,8 +162,6 @@ def mysql transaction_registry 0 mysql commit_id 1 commit_id A #CARD# NULL NULL
def mysql transaction_registry 1 mysql commit_timestamp 1 commit_timestamp A #CARD# NULL NULL BTREE
def mysql transaction_registry 1 mysql commit_timestamp 2 transaction_id A #CARD# NULL NULL BTREE
def mysql transaction_registry 0 mysql PRIMARY 1 transaction_id A #CARD# NULL NULL BTREE
-def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
-def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints.result b/mysql-test/suite/funcs_1/r/is_table_constraints.result
index cb7aa1f8fc0..bc0f9a724a1 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result
@@ -63,6 +63,8 @@ def mysql PRIMARY mysql column_stats
def mysql PRIMARY mysql db
def mysql PRIMARY mysql event
def mysql PRIMARY mysql func
+def mysql PRIMARY mysql global_priv
+def mysql Priv mysql global_priv
def mysql PRIMARY mysql gtid_slave_pos
def mysql name mysql help_category
def mysql PRIMARY mysql help_category
@@ -89,7 +91,6 @@ def mysql PRIMARY mysql time_zone_transition
def mysql PRIMARY mysql time_zone_transition_type
def mysql commit_id mysql transaction_registry
def mysql PRIMARY mysql transaction_registry
-def mysql PRIMARY mysql user
#########################################################################################
# Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.TABLE_CONSTRAINTS accessible information
#########################################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
index fc9ba660467..d5da807388b 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
@@ -12,6 +12,8 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY
def mysql PRIMARY mysql db PRIMARY KEY
def mysql PRIMARY mysql event PRIMARY KEY
def mysql PRIMARY mysql func PRIMARY KEY
+def mysql PRIMARY mysql global_priv PRIMARY KEY
+def mysql Priv mysql global_priv CHECK
def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY
def mysql name mysql help_category UNIQUE
def mysql PRIMARY mysql help_category PRIMARY KEY
@@ -38,7 +40,6 @@ def mysql PRIMARY mysql time_zone_transition PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
def mysql commit_id mysql transaction_registry UNIQUE
def mysql PRIMARY mysql transaction_registry PRIMARY KEY
-def mysql PRIMARY mysql user PRIMARY KEY
connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'mysql'
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
index 54e27e22140..0426877bc1c 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
@@ -12,6 +12,8 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY
def mysql PRIMARY mysql db PRIMARY KEY
def mysql PRIMARY mysql event PRIMARY KEY
def mysql PRIMARY mysql func PRIMARY KEY
+def mysql PRIMARY mysql global_priv PRIMARY KEY
+def mysql Priv mysql global_priv CHECK
def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY
def mysql name mysql help_category UNIQUE
def mysql PRIMARY mysql help_category PRIMARY KEY
@@ -38,7 +40,6 @@ def mysql PRIMARY mysql time_zone_transition PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
def mysql commit_id mysql transaction_registry UNIQUE
def mysql PRIMARY mysql transaction_registry PRIMARY KEY
-def mysql PRIMARY mysql user PRIMARY KEY
connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'mysql'
@@ -49,6 +50,8 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY
def mysql PRIMARY mysql db PRIMARY KEY
def mysql PRIMARY mysql event PRIMARY KEY
def mysql PRIMARY mysql func PRIMARY KEY
+def mysql PRIMARY mysql global_priv PRIMARY KEY
+def mysql Priv mysql global_priv CHECK
def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY
def mysql name mysql help_category UNIQUE
def mysql PRIMARY mysql help_category PRIMARY KEY
@@ -75,7 +78,6 @@ def mysql PRIMARY mysql time_zone_transition PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
def mysql commit_id mysql transaction_registry UNIQUE
def mysql PRIMARY mysql transaction_registry PRIMARY KEY
-def mysql PRIMARY mysql user PRIMARY KEY
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result
index 9d1539bc778..be432e2422a 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result
@@ -162,6 +162,31 @@ user_comment General log
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME global_priv
+TABLE_TYPE BASE TABLE
+ENGINE MYISAM_OR_MARIA
+VERSION 11
+ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_bin
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+MAX_INDEX_LENGTH #MIL#
+TEMPORARY N
+user_comment Users and global privileges
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME gtid_slave_pos
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
@@ -738,10 +763,10 @@ Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME user
-TABLE_TYPE BASE TABLE
-ENGINE MYISAM_OR_MARIA
-VERSION 10
-ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_TYPE VIEW
+ENGINE NULL
+VERSION NULL
+ROW_FORMAT NULL
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
@@ -752,13 +777,13 @@ AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
-TABLE_COLLATION utf8_bin
+TABLE_COLLATION NULL
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
MAX_INDEX_LENGTH #MIL#
-TEMPORARY N
-user_comment Users and global privileges
+TEMPORARY NULL
+user_comment VIEW
Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
index c28b4b45ede..01381a5e746 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
@@ -162,6 +162,31 @@ user_comment General log
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME global_priv
+TABLE_TYPE BASE TABLE
+ENGINE MYISAM_OR_MARIA
+VERSION 11
+ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_bin
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+MAX_INDEX_LENGTH #MIL#
+TEMPORARY N
+user_comment Users and global privileges
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME gtid_slave_pos
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
@@ -738,10 +763,10 @@ Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME user
-TABLE_TYPE BASE TABLE
-ENGINE MYISAM_OR_MARIA
-VERSION 10
-ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_TYPE VIEW
+ENGINE NULL
+VERSION NULL
+ROW_FORMAT NULL
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
@@ -752,13 +777,13 @@ AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
-TABLE_COLLATION utf8_bin
+TABLE_COLLATION NULL
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
MAX_INDEX_LENGTH #MIL#
-TEMPORARY N
-user_comment Users and global privileges
+TEMPORARY NULL
+user_comment VIEW
Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
@@ -926,6 +951,31 @@ user_comment General log
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME global_priv
+TABLE_TYPE BASE TABLE
+ENGINE MYISAM_OR_MARIA
+VERSION 11
+ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_bin
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+MAX_INDEX_LENGTH #MIL#
+TEMPORARY N
+user_comment Users and global privileges
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME gtid_slave_pos
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
@@ -1502,10 +1552,10 @@ Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME user
-TABLE_TYPE BASE TABLE
-ENGINE MYISAM_OR_MARIA
-VERSION 10
-ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_TYPE VIEW
+ENGINE NULL
+VERSION NULL
+ROW_FORMAT NULL
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
@@ -1516,13 +1566,13 @@ AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
-TABLE_COLLATION utf8_bin
+TABLE_COLLATION NULL
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
MAX_INDEX_LENGTH #MIL#
-TEMPORARY N
-user_comment Users and global privileges
+TEMPORARY NULL
+user_comment VIEW
Separator -----------------------------------------------------
connection default;
disconnect testuser1;
diff --git a/mysql-test/suite/funcs_1/r/is_user_privileges.result b/mysql-test/suite/funcs_1/r/is_user_privileges.result
index fa1284c355e..fe181fbf069 100644
--- a/mysql-test/suite/funcs_1/r/is_user_privileges.result
+++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result
@@ -54,7 +54,6 @@ grantee table_catalog privilege_type
# Testcases 3.2.16.2+3.2.16.3+3.2.16.4: INFORMATION_SCHEMA.USER_PRIVILEGES
# accessible information
##########################################################################
-DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict;
DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
@@ -63,7 +62,7 @@ CREATE USER 'testuser2'@'localhost';
DROP USER 'testuser3'@'localhost';
CREATE USER 'testuser3'@'localhost';
GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost';
-GRANT SELECT ON mysql.user TO 'testuser1'@'localhost';
+GRANT SELECT ON mysql.global_priv TO 'testuser1'@'localhost';
GRANT INSERT ON *.* TO 'testuser2'@'localhost';
GRANT UPDATE ON *.* TO 'testuser2'@'localhost';
SELECT * FROM information_schema.user_privileges
@@ -85,149 +84,29 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
#
# Add GRANT OPTION db_datadict.* to testuser1;
GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
@@ -250,149 +129,29 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -401,154 +160,34 @@ GRANTEE 'testuser1'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT SELECT, UPDATE ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OPTION
-GRANT SELECT ON `mysql`.`user` TO 'testuser1'@'localhost'
+GRANT SELECT ON `mysql`.`global_priv` TO 'testuser1'@'localhost'
# Now add SELECT on *.* to testuser1;
connection default;
@@ -574,149 +213,29 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv Y
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 1,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
#
# Here <SELECT YES> is shown correctly for testuser1;
@@ -739,149 +258,29 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv Y
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv Y
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 1025,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -890,154 +289,34 @@ GRANTEE 'testuser1'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE SELECT
IS_GRANTABLE YES
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv Y
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv Y
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 1025,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
SHOW GRANTS;
Grants for testuser1@localhost
GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT SELECT, UPDATE ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OPTION
-GRANT SELECT ON `mysql`.`user` TO 'testuser1'@'localhost'
+GRANT SELECT ON `mysql`.`global_priv` TO 'testuser1'@'localhost'
connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -1050,9 +329,9 @@ GRANTEE 'testuser2'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE UPDATE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 'user'
+ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 'global_priv'
SHOW GRANTS;
Grants for testuser2@localhost
GRANT INSERT, UPDATE ON *.* TO 'testuser2'@'localhost'
@@ -1064,9 +343,9 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-ERROR 42000: SELECT command denied to user 'testuser3'@'localhost' for table 'user'
+ERROR 42000: SELECT command denied to user 'testuser3'@'localhost' for table 'global_priv'
SHOW GRANTS;
Grants for testuser3@localhost
GRANT USAGE ON *.* TO 'testuser3'@'localhost'
@@ -1093,149 +372,29 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -1244,9 +403,9 @@ GRANTEE 'testuser1'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'user'
+ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'global_priv'
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -1259,19 +418,19 @@ GRANTEE 'testuser1'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'user'
+ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'global_priv'
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
CREATE TABLE db_datadict.tb_66 ( c1 TEXT );
ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table 'tb_66'
-# Add ALL on db_datadict.* (and select on mysql.user) to testuser1;
+# Add ALL on db_datadict.* (and select on mysql.global_priv) to testuser1;
connection default;
GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
-GRANT SELECT ON mysql.user TO 'testuser1'@'localhost';
+GRANT SELECT ON mysql.global_priv TO 'testuser1'@'localhost';
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -1291,149 +450,29 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -1442,154 +481,34 @@ GRANTEE 'testuser1'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OPTION
-GRANT SELECT ON `mysql`.`user` TO 'testuser1'@'localhost'
+GRANT SELECT ON `mysql`.`global_priv` TO 'testuser1'@'localhost'
CREATE TABLE db_datadict.tb_56 ( c1 TEXT );
ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table 'tb_56'
USE db_datadict;
@@ -1600,154 +519,34 @@ GRANTEE 'testuser1'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OPTION
-GRANT SELECT ON `mysql`.`user` TO 'testuser1'@'localhost'
+GRANT SELECT ON `mysql`.`global_priv` TO 'testuser1'@'localhost'
CREATE TABLE tb_57 ( c1 TEXT )
ENGINE = <other_engine_type>;
@@ -1773,149 +572,29 @@ GRANTEE 'testuser3'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-Host localhost
-User testuser1
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser2
-Password
-Select_priv N
-Insert_priv Y
-Update_priv Y
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
-Host localhost
-User testuser3
-Password
-Select_priv N
-Insert_priv N
-Update_priv N
-Delete_priv N
-Create_priv N
-Drop_priv N
-Reload_priv N
-Shutdown_priv N
-Process_priv N
-File_priv N
-Grant_priv N
-References_priv N
-Index_priv N
-Alter_priv N
-Show_db_priv N
-Super_priv N
-Create_tmp_table_priv N
-Lock_tables_priv N
-Execute_priv N
-Repl_slave_priv N
-Repl_client_priv N
-Create_view_priv N
-Show_view_priv N
-Create_routine_priv N
-Alter_routine_priv N
-Create_user_priv N
-Event_priv N
-Trigger_priv N
-Create_tablespace_priv N
-Delete_history_priv N
-ssl_type
-ssl_cipher
-x509_issuer
-x509_subject
-max_questions 0
-max_updates 0
-max_connections 0
-max_user_connections 0
-plugin mysql_native_password
-authentication_string
-password_expired N
-is_role N
-default_role
-max_statement_time 0.000000
+host localhost
+user testuser1
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser2
+json_detailed(priv) {
+ "access": 6,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
+host localhost
+user testuser3
+json_detailed(priv) {
+ "access": 0,
+ "plugin": "mysql_native_password",
+ "authentication_string": ""
+}
connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -1924,9 +603,9 @@ GRANTEE 'testuser1'@'localhost'
TABLE_CATALOG def
PRIVILEGE_TYPE USAGE
IS_GRANTABLE NO
-SELECT * FROM mysql.user
+SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
-ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'user'
+ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 'global_priv'
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
diff --git a/mysql-test/suite/funcs_1/r/is_views.result b/mysql-test/suite/funcs_1/r/is_views.result
index 62ec33c8340..e6a2715bbb3 100644
--- a/mysql-test/suite/funcs_1/r/is_views.result
+++ b/mysql-test/suite/funcs_1/r/is_views.result
@@ -70,6 +70,7 @@ ALGORITHM varchar(10) NO
SELECT table_catalog, table_schema, table_name
FROM information_schema.views WHERE table_catalog IS NOT NULL;
table_catalog table_schema table_name
+def mysql user
################################################################################
# Testcase 3.2.13.2 + 3.2.13.3: INFORMATION_SCHEMA.VIEWS accessible information
################################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_views_embedded.result b/mysql-test/suite/funcs_1/r/is_views_embedded.result
index c382370e892..cc6ade7daaf 100644
--- a/mysql-test/suite/funcs_1/r/is_views_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_views_embedded.result
@@ -70,6 +70,7 @@ ALGORITHM varchar(10) NO
SELECT table_catalog, table_schema, table_name
FROM information_schema.views WHERE table_catalog IS NOT NULL;
table_catalog table_schema table_name
+def mysql user
################################################################################
# Testcase 3.2.13.2 + 3.2.13.3: INFORMATION_SCHEMA.VIEWS accessible information
################################################################################
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index 62c9a245010..88bfa702be8 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -3716,8 +3716,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 3
+Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3732,8 +3732,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 1
+Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -3750,8 +3750,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 24
Warnings:
-Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 3
+Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as time) AS `CAST(my_bigint AS TIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3766,8 +3766,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 24
Warnings:
-Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 1
+Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
@@ -4062,10 +4062,10 @@ NULL 1.7976931348623e308 3
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 6
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 6
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4080,10 +4080,10 @@ NULL 1.7976931348623e308 3
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -4100,10 +4100,10 @@ NULL 9223372036854775807 3
NULL -1 5
NULL 200506271758 18
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 6
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 6
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as datetime) AS `CAST(my_bigint AS DATETIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4118,10 +4118,10 @@ NULL 9223372036854775807 3
NULL -1 5
NULL 200506271758 18
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 1
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
@@ -4422,9 +4422,9 @@ NULL 1.7976931348623e308 3
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4439,9 +4439,9 @@ NULL 1.7976931348623e308 3
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -4458,9 +4458,9 @@ NULL 9223372036854775807 3
NULL -1 5
2005-06-27 20050627 12
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as date) AS `CAST(my_bigint AS DATE)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4475,9 +4475,9 @@ NULL 9223372036854775807 3
NULL -1 5
2005-06-27 20050627 12
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index 62c9a245010..88bfa702be8 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -3716,8 +3716,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 3
+Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3732,8 +3732,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 1
+Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -3750,8 +3750,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 24
Warnings:
-Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 3
+Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as time) AS `CAST(my_bigint AS TIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3766,8 +3766,8 @@ NULL NULL 1
-00:00:01 -1 5
00:17:58 1758 24
Warnings:
-Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 1
+Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
@@ -4062,10 +4062,10 @@ NULL 1.7976931348623e308 3
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 6
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 6
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4080,10 +4080,10 @@ NULL 1.7976931348623e308 3
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -4100,10 +4100,10 @@ NULL 9223372036854775807 3
NULL -1 5
NULL 200506271758 18
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 6
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 6
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as datetime) AS `CAST(my_bigint AS DATETIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4118,10 +4118,10 @@ NULL 9223372036854775807 3
NULL -1 5
NULL 200506271758 18
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 1
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
@@ -4422,9 +4422,9 @@ NULL 1.7976931348623e308 3
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4439,9 +4439,9 @@ NULL 1.7976931348623e308 3
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1
DROP VIEW v1;
@@ -4458,9 +4458,9 @@ NULL 9223372036854775807 3
NULL -1 5
2005-06-27 20050627 12
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as date) AS `CAST(my_bigint AS DATE)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4475,9 +4475,9 @@ NULL 9223372036854775807 3
NULL -1 5
2005-06-27 20050627 12
Warnings:
-Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1
-Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1
+Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1
+Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 0fe7082bea1..81ed8405b7d 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -13825,7 +13825,7 @@ CALL sp1();
@xx
0
Warnings:
-Warning 1366 Incorrect integer value: 'asd' for column 'xx' at row 1
+Warning 1366 Incorrect integer value: 'asd' for column ``.``.`xx` at row 1
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -13874,7 +13874,7 @@ CALL sp1();
xx
0
Warnings:
-Warning 1366 Incorrect double value: 'asd' for column 'xx' at row 1
+Warning 1366 Incorrect double value: 'asd' for column ``.``.`xx` at row 1
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -13946,7 +13946,7 @@ CALL sp1();
xx
0
Warnings:
-Warning 1366 Incorrect integer value: 'asd' for column 'xx' at row 1
+Warning 1366 Incorrect integer value: 'asd' for column ``.``.`xx` at row 1
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraint.test b/mysql-test/suite/funcs_1/t/is_check_constraint.test
new file mode 100644
index 00000000000..30a72d02b34
--- /dev/null
+++ b/mysql-test/suite/funcs_1/t/is_check_constraint.test
@@ -0,0 +1,92 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+--echo #
+--echo # MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
+--echo #
+CREATE user boo1;
+GRANT select,create,alter,drop on foo.* to boo1;
+SHOW GRANTS for boo1;
+CREATE user boo2;
+create database foo;
+# Connect with user boo1
+CONNECT(con1,localhost, boo1,, foo);
+
+SET check_constraint_checks=1;
+CREATE TABLE t0
+(
+ t int, check (t>32) # table constraint
+) ENGINE=myisam;
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+ALTER TABLE t0
+ADD CONSTRAINT CHK_t0_t CHECK(t<100);
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+ALTER TABLE t0
+DROP CONSTRAINT CHK_t0_t;
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+ALTER TABLE t0
+ADD CONSTRAINT CHECK(t<50);
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+CREATE TABLE t1
+( t int CHECK(t>2), # field constraint
+ tt int,
+ CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
+ CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
+) ENGINE=InnoDB;
+ --sorted_result
+SELECT * from information_schema.check_constraints;
+
+ALTER TABLE t1
+DROP CONSTRAINT CHK_tt;
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+CREATE TABLE t2
+(
+name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
+start_date DATE,
+end_date DATE,
+CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
+)ENGINE=Innodb;
+ --sorted_result
+SELECT * from information_schema.check_constraints;
+
+ALTER TABLE t1
+ADD CONSTRAINT CHK_new_ CHECK(t>tt);
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+# Create table with same field and table check constraint name
+CREATE TABLE t3
+(
+a int,
+b int check (b>0), # field constraint named 'b'
+CONSTRAINT b check (b>10) # table constraint
+) ENGINE=InnoDB;
+ --sorted_result
+SELECT * from information_schema.check_constraints;
+
+DISCONNECT con1;
+CONNECT(con2, localhost, boo2,, test);
+ --sorted_result
+SELECT * from information_schema.check_constraints;
+
+DISCONNECT con2;
+CONNECT(con1, localhost, boo1,,foo);
+DROP TABLE t0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP DATABASE foo;
+
+DISCONNECT con1;
+--CONNECTION default
+DROP USER boo1;
+DROP USER boo2;
diff --git a/mysql-test/suite/funcs_1/t/is_user_privileges.test b/mysql-test/suite/funcs_1/t/is_user_privileges.test
index a61e9187d15..53d46b83f88 100644
--- a/mysql-test/suite/funcs_1/t/is_user_privileges.test
+++ b/mysql-test/suite/funcs_1/t/is_user_privileges.test
@@ -77,9 +77,6 @@ WHERE table_catalog IS NULL OR table_catalog <> 'def';
# 3.2.16.4: Ensure that the table does not show any information on any
# privileges that are not user privileges for the current user.
#
---disable_warnings
-DROP DATABASE IF EXISTS db_datadict;
---enable_warnings
CREATE DATABASE db_datadict;
--error 0,ER_CANNOT_USER
@@ -93,7 +90,7 @@ DROP USER 'testuser3'@'localhost';
CREATE USER 'testuser3'@'localhost';
GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost';
-GRANT SELECT ON mysql.user TO 'testuser1'@'localhost';
+GRANT SELECT ON mysql.global_priv TO 'testuser1'@'localhost';
GRANT INSERT ON *.* TO 'testuser2'@'localhost';
GRANT UPDATE ON *.* TO 'testuser2'@'localhost';
@@ -101,7 +98,7 @@ GRANT UPDATE ON *.* TO 'testuser2'@'localhost';
let $my_select1= SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
-let $my_select2= SELECT * FROM mysql.user
+let $my_select2= SELECT host,user,json_detailed(priv) FROM mysql.global_priv
WHERE user LIKE 'testuser%' ORDER BY host, user;
let $my_show= SHOW GRANTS;
--vertical_results
@@ -203,10 +200,10 @@ eval $my_show;
CREATE TABLE db_datadict.tb_66 ( c1 TEXT );
--echo
---echo # Add ALL on db_datadict.* (and select on mysql.user) to testuser1;
+--echo # Add ALL on db_datadict.* (and select on mysql.global_priv) to testuser1;
connection default;
GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
-GRANT SELECT ON mysql.user TO 'testuser1'@'localhost';
+GRANT SELECT ON mysql.global_priv TO 'testuser1'@'localhost';
--vertical_results
eval $my_select1;
eval $my_select2;
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index e84832458a3..76f62e7b0eb 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -9,20 +9,18 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-
+MW-360 : needs rewrite to be MariaDB gtid compatible
galera_flush : MariaDB does not have global.thread_statistics
galera_account_management : MariaDB 10.0 does not support ALTER USER
galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events
galera_migrate : MariaDB does not support START SLAVE USER
galera_as_master_gtid : Requires MySQL GTID
galera_as_master_gtid_change_master : Requires MySQL GTID
+galera_as_slave_gtid_replicate_do_db_cc : Requires MySQL GTID
galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
GAL-419 : MDEV-13549 Galera test failures
galera_var_notify_cmd : MDEV-13549 Galera test failures
galera_as_slave_replication_bundle : MDEV-13549 Galera test failures
-galera_gcache_recover : MDEV-13549 Galera test failures
-galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures
-galera_gcache_recover_manytrx : MDEV-13549 Galera test failures
galera_ssl_upgrade : MDEV-13549 Galera test failures
MW-329 : wsrep_local_replays not stable
MW-416 : MDEV-13549 Galera test failures
@@ -33,8 +31,6 @@ galera_kill_applier : race condition at the start of the test
galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status
pxc-421: Lock timeout exceeded
galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure
-galera_sst_xtrabackup-v2-options : Failed to read uuid:seqno and wsrep_gtid_domain_id from joiner script
-MW-328C : Timeouts
galera_gcs_fc_limit : Timeouts
pool_of_threads: WSREP has not yet prepared node for application use
galera_var_innodb_disallow_writes : Timeout
@@ -44,8 +40,24 @@ galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl
galera_var_node_address : MDEV-17151 Galera test failure on galera.galera_var_node_address
galera_binlog_stmt_autoinc: MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc
galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit
-partition : MDEV-13881 galera.partition failed in buildbot with wrong result
galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion
galera_wan : MDEV-17259: Test failure on galera.galera_wan
galera_pc_ignore_sb : MDEV-17357 Test failure on galera.galera_pc_ignore_sb
-galera_drop_database : test
+MW-328A : MDEV-17847 Galera test failure on MW-328[A|B|C]
+MW-328B : MDEV-17847 Galera test failure on MW-328[A|B|C]
+MW-328C : MDEV-17847 Galera test failure on MW-328[A|B|C]
+galera.galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files
+galera.galera_var_reject_queries : assertion in inline_mysql_socket_send
+query_cache : MDEV-18137: Galera test failure on query_cache
+galera.galera_autoinc_sst_mariabackup : MDEV-18177 Galera test failure on galera_autoinc_sst_mariabackup
+galera_gcache_recover_manytrx : MDEV-15740
+galera.galera_ist_mariabackup : Leaves port open
+galera.galera_sst_rsync2 : MDEV-18178 Galera test failure on galera_sst_rsync2
+galera.galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges
+galera.galera_concurrent_ctas : MDEV-18180 Galera test failure on galera.galera_concurrent_ctas
+galera.galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit
+galera.galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk
+galera.galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
+galera.galera_split_brain : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
+galera.galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit
+galera.GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index b24f3603894..ef8a17a77be 100644
--- a/mysql-test/suite/galera/galera_2nodes.cnf
+++ b/mysql-test/suite/galera/galera_2nodes.cnf
@@ -2,7 +2,7 @@
!include include/default_mysqld.cnf
[mysqld]
-wsrep-on=1
+loose-innodb
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
@@ -10,20 +10,35 @@ wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
wsrep-sync-wait=15
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.1]
+loose-innodb
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep-cluster-address=gcomm://
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 15
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
+
[mysqld.2]
+loose-innodb
+# debug=d:t:i:o,/tmp/mysqld.2.trace
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
@@ -34,8 +49,14 @@ wsrep_sync_wait = 15
wsrep_node_address=127.0.0.1
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
-wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+wsrep_sst_receive_address='127.0.0.2:@mysqld.2.#sst_port'
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 15
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[ENV]
NODE_MYPORT_1= @mysqld.1.port
@@ -43,4 +64,3 @@ NODE_MYSOCK_1= @mysqld.1.socket
NODE_MYPORT_2= @mysqld.2.port
NODE_MYSOCK_2= @mysqld.2.socket
-
diff --git a/mysql-test/suite/galera/galera_2nodes_as_master.cnf b/mysql-test/suite/galera/galera_2nodes_as_master.cnf
index 33bfc475721..4403416b033 100644
--- a/mysql-test/suite/galera/galera_2nodes_as_master.cnf
+++ b/mysql-test/suite/galera/galera_2nodes_as_master.cnf
@@ -11,6 +11,9 @@ log-bin=mysqld-bin
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.1]
#galera_port=@OPT.port
@@ -30,6 +33,9 @@ wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.2]
#galera_port=@OPT.port
@@ -49,9 +55,15 @@ wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.3]
server-id=3
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[ENV]
NODE_MYPORT_1= @mysqld.1.port
@@ -62,9 +74,3 @@ NODE_MYSOCK_2= @mysqld.2.socket
NODE_MYPORT_3= @mysqld.3.port
NODE_MYSOCK_3= @mysqld.3.socket
-
-NODE_GALERAPORT_1= @mysqld.1.#galera_port
-NODE_GALERAPORT_2= @mysqld.2.#galera_port
-
-NODE_SSTPORT_1= @mysqld.1.#sst_port
-NODE_SSTPORT_2= @mysqld.2.#sst_port
diff --git a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf
index 4d9e39d2aae..d1fa7bfbfca 100644
--- a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf
+++ b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf
@@ -9,17 +9,13 @@
binlog-format=row
[mysqld.1]
-log-bin
-server-id=1
-
-[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
-
wsrep-on=1
-log-bin
+log-bin=master-bin
+log-bin-index=master-bin
log-slave-updates
innodb-autoinc-lock-mode=2
@@ -27,38 +23,53 @@ default-storage-engine=innodb
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
wsrep-cluster-address=gcomm://
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
-wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
-wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
-server-id=2
+server-id=1
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
-[mysqld.3]
+[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
-
wsrep-on=1
-log-bin
+log-bin=master-bin
+log-bin-index=master-bin
log-slave-updates
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
-wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port'
-wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M'
-wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
-wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
+server-id=2
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
+
+[mysqld.3]
+log-bin=master-bin
+log-bin-index=master-bin
server-id=3
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
+
[ENV]
NODE_MYPORT_1= @mysqld.1.port
@@ -69,9 +80,3 @@ NODE_MYSOCK_2= @mysqld.2.socket
NODE_MYPORT_3= @mysqld.3.port
NODE_MYSOCK_3= @mysqld.3.socket
-
-NODE_GALERAPORT_2= @mysqld.2.#galera_port
-NODE_GALERAPORT_3= @mysqld.3.#galera_port
-
-NODE_SSTPORT_2= @mysqld.2.#sst_port
-NODE_SSTPORT_3= @mysqld.3.#sst_port
diff --git a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
index ac1ca34e242..c84c4b25d2a 100644
--- a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
+++ b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
@@ -8,14 +8,15 @@
[mysqld]
log-bin
binlog-format=row
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.1]
-server-id=1
-
-[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
log-slave-updates
@@ -24,19 +25,23 @@ default-storage-engine=innodb
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
wsrep-cluster-address=gcomm://
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.install_timeout = PT15S;evs.max_install_timeouts=1;gcache.size=10M'
-wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
-wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.install_timeout = PT15S;evs.max_install_timeouts=1;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
-server-id=2
+server-id=1
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
-[mysqld.3]
+[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
log-slave-updates
@@ -44,20 +49,24 @@ innodb-autoinc-lock-mode=2
default-storage-engine=innodb
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
-wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port'
-wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.install_timeout=PT15S;evs.max_install_timeouts=1;gcache.size=10M'
-wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
-wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.install_timeout=PT15S;evs.max_install_timeouts=1;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
-server-id=3
+server-id=2
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
-[mysqld.4]
+[mysqld.3]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
log-slave-updates
@@ -65,15 +74,24 @@ innodb-autoinc-lock-mode=2
default-storage-engine=innodb
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
-wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port'
-wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.install_timeout=PT15S;evs.max_install_timeouts=1;gcache.size=10M'
-wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
-wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.install_timeout=PT15S;evs.max_install_timeouts=1;gcache.size=10M'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
+server-id=3
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
+
+[mysqld.4]
server-id=4
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[ENV]
NODE_MYPORT_1= @mysqld.1.port
@@ -87,11 +105,3 @@ NODE_MYSOCK_3= @mysqld.3.socket
NODE_MYPORT_4= @mysqld.4.port
NODE_MYSOCK_4= @mysqld.4.socket
-
-NODE_GALERAPORT_2= @mysqld.2.#galera_port
-NODE_GALERAPORT_3= @mysqld.3.#galera_port
-NODE_GALERAPORT_4= @mysqld.4.#galera_port
-
-NODE_SSTPORT_2= @mysqld.2.#sst_port
-NODE_SSTPORT_3= @mysqld.3.#sst_port
-NODE_SSTPORT_4= @mysqld.4.#sst_port
diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf
index 1c195afd54b..7f59f75b2dc 100644
--- a/mysql-test/suite/galera/galera_4nodes.cnf
+++ b/mysql-test/suite/galera/galera_4nodes.cnf
@@ -5,50 +5,68 @@
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
-wsrep-on=1
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
wsrep-causal-reads=ON
wsrep-sync-wait=15
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.1]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep-cluster-address=gcomm://
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.3]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[mysqld.4]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
+# lock schedule alg appears to be VATS by default, and it is not
+# yet compatible with galera
+innodb_lock_schedule_algorithm=FCFS
[ENV]
NODE_MYPORT_1= @mysqld.1.port
@@ -62,13 +80,3 @@ NODE_MYSOCK_3= @mysqld.3.socket
NODE_MYPORT_4= @mysqld.4.port
NODE_MYSOCK_4= @mysqld.4.socket
-
-NODE_GALERAPORT_1= @mysqld.1.#galera_port
-NODE_GALERAPORT_2= @mysqld.2.#galera_port
-NODE_GALERAPORT_3= @mysqld.3.#galera_port
-NODE_GALERAPORT_4= @mysqld.4.#galera_port
-
-NODE_SSTPORT_1= @mysqld.1.#sst_port
-NODE_SSTPORT_2= @mysqld.2.#sst_port
-NODE_SSTPORT_3= @mysqld.3.#sst_port
-NODE_SSTPORT_4= @mysqld.4.#sst_port
diff --git a/mysql-test/suite/galera/include/galera_base_port.inc b/mysql-test/suite/galera/include/galera_base_port.inc
new file mode 100644
index 00000000000..caf986ee950
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_base_port.inc
@@ -0,0 +1,8 @@
+#
+# Extract base_port from galera node.
+#
+
+# Convert "... base_port = N; ..." to "N; ..."
+--let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
+# Convert "N; ..." to "N"
+--let $_NODE_GALERAPORT = `SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)`
diff --git a/mysql-test/suite/galera/include/galera_concurrent_test.inc b/mysql-test/suite/galera/include/galera_concurrent_test.inc
new file mode 100644
index 00000000000..3d1bc7674a1
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_concurrent_test.inc
@@ -0,0 +1,90 @@
+#
+# Perform a quick concurrent test on two nodes using a set of predefined statements.
+#
+# Such tests are not deterministic, so we are hoping to catch assertions, slave apply errors
+# and cases where the two nodes diverge
+#
+# Parameters:
+# - $wsrep_trx_fragment_size
+# - $count
+# - $query_node_1
+# - $query_node_1a (optional)
+# - $query_node_2
+#
+
+if (!$count) {
+ --let $count = 50;
+}
+
+if (!$node_1a_connected) {
+ --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+ --let $node_1a_connected = 1
+}
+
+--echo Running a concurrent test with the following queries:
+--echo $query_node_1
+--echo $query_node_1a
+--echo $query_node_2
+
+--connection node_1
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+
+SET SESSION wsrep_sync_wait = 0;
+--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size;
+
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size;
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size;
+
+--disable_query_log
+--let $i = `SELECT $count`
+while ($i)
+{
+ --connection node_1
+ --send_eval $query_node_1
+
+ --connection node_1a
+ if ($query_node_1a) {
+ --send_eval $query_node_1a
+ }
+
+ --connection node_2
+ --send_eval $query_node_2
+
+ --connection node_1
+ --error 0,ER_QUERY_INTERRUPTED,ER_LOCK_DEADLOCK,ER_DUP_ENTRY
+ --reap
+
+ --connection node_1a
+ if ($query_node_1a) {
+ --error 0,ER_QUERY_INTERRUPTED,ER_LOCK_DEADLOCK,ER_DUP_ENTRY
+ --reap
+ }
+
+ --connection node_2
+ --error 0,ER_QUERY_INTERRUPTED,ER_LOCK_DEADLOCK,ER_DUP_ENTRY
+ --reap
+ --dec $i
+}
+
+SET SESSION wsrep_sync_wait = 15;
+--enable_query_log
+
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
+DROP TABLE t1;
+
+--let $query_node_1 = ""
+--let $query_node_1a = ""
+--let $query_node_2 = ""
+
+--echo Concurrent test end
diff --git a/mysql-test/suite/galera/include/galera_dump_sr_table.inc b/mysql-test/suite/galera/include/galera_dump_sr_table.inc
new file mode 100644
index 00000000000..48a55006eae
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_dump_sr_table.inc
@@ -0,0 +1,28 @@
+#
+# Dump the contents of the SR table using mysqldump
+#
+
+--let $sr_min = `SELECT MIN(seqno) FROM mysql.wsrep_streaming_log`
+--let $sr_max = `SELECT MAX(seqno) FROM mysql.wsrep_streaming_log`
+
+--let $seqno = $sr_min
+while ($seqno <= $sr_max)
+{
+ --let $sr_fragment_file = $MYSQLTEST_VARDIR/tmp/sr_fragment.log
+ --exec rm -rf $sr_fragment_file
+ --disable_query_log
+ --eval SELECT frag FROM mysql.wsrep_streaming_log WHERE seqno = $seqno INTO DUMPFILE '$sr_fragment_file'
+ --enable_query_log
+
+ --let $sr_binlog_file = $MYSQLTEST_VARDIR/tmp/sr_binlog.log
+ --exec rm -rf $sr_binlog_file
+
+ --exec cp std_data/binlog-header.log $sr_binlog_file
+ --exec cat $sr_fragment_file >> $sr_binlog_file
+
+ --replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /#[0-9]+ +[0-9]+:[0-9]+:[0-9]+/<ISO TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/ /thread_id=[0-9]+/thread_id=<QUERY_THREAD_ID>/ /table id [0-9]+/table id <TABLE_ID>/ /mapped to number [0-9]+/mapped to number <TABLE_ID>/ /auto_increment_increment=[0-9]+/auto_increment_increment=<AUTO_INCREMENT_INCREMENT>/ /auto_increment_offset=[0-9]+/auto_increment_offset=<AUTO_INCREMENT_OFFSET>/ /exec_time=[0-9]+/exec_time=<EXEC_TIME>/
+ --exec $MYSQL_BINLOG --skip-gtids $sr_binlog_file --base64-output=decode-rows --start-position=120 | grep -v 'SET @' 2>&1
+
+ --inc $seqno
+}
+
diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc
index aeab7e6ea19..0f843597d9c 100644
--- a/mysql-test/suite/galera/include/galera_load_provider.inc
+++ b/mysql-test/suite/galera/include/galera_load_provider.inc
@@ -2,7 +2,75 @@
--disable_query_log
--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
+
+#
+# count occurences of successful node starts in error log
+#
+perl;
+ use strict;
+ my $test_log=$ENV{'LOG_FILE'} or die "LOG_FILE not set";
+ my $test_log_copy=$test_log . '.copy';
+ if (-e $test_log_copy) {
+ unlink $test_log_copy;
+ }
+
+EOF
+--copy_file $LOG_FILE $LOG_FILE.copy
+
+#
+# now join to the cluster
+#
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+
+--enable_query_log
+
+#
+# Cluster address change above, will launch SST/IST
+# if mysqldump ST has been configured, mysqld will close all
+# client connections, and it will be hard for us to poll for
+# cluster status during SST process, therefore wait_until_connected_again.inc
+# and wait_until_ready.inc may fail in this phase
+# To workaround this, we do first lazy polling here just to see when
+# client connections will be possible, and after that check for node readyness
+#
+--disable_result_log
+--disable_query_log
+
+--error 0,1
+perl;
+ use strict;
+ my $logfile = $ENV{'LOG_FILE'} or die ("no error log file set");
+
+ my $counter = 1000;
+ #my $found = false
+
+ while ($counter > 0) {
+
+ open(FILE, "$logfile") or die("Unable to open $logfile : $!\n");
+ my $new_sync_count = () = grep(/Synchronized with group/g,<FILE>);
+ close(FILE);
+
+ open(FILEN, "$logfile.copy") or die("Unable to open $logfile.copy : $!\n");
+ my $old_sync_count = () = grep(/Synchronized with group/g,<FILEN>);
+ close(FILEN);
+
+ if ($new_sync_count > $old_sync_count ) {
+ exit(0);
+ }
+ $counter--;
+ sleep(5);
+ }
+ exit(1);
+EOF
+if ($errno)
+{
+--echo "SST failed $errno"
+}
+
+--remove_file $LOG_FILE.copy
+
--enable_query_log
+--enable_result_log
+#--eval SET GLOBAL log_error = $log_error_;
--source include/galera_wait_ready.inc
diff --git a/mysql-test/suite/galera/include/galera_sst_restore.inc b/mysql-test/suite/galera/include/galera_sst_restore.inc
index 7c9a08090ad..83d07f086d1 100644
--- a/mysql-test/suite/galera/include/galera_sst_restore.inc
+++ b/mysql-test/suite/galera/include/galera_sst_restore.inc
@@ -20,7 +20,7 @@ CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
-
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
--disable_query_log
--eval SET GLOBAL wsrep_sst_method = '$wsrep_sst_method_orig';
--eval SET GLOBAL wsrep_sst_receive_address = '$wsrep_sst_receive_address_orig';
diff --git a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
index c8869746bd1..d6d7552f7b6 100644
--- a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
+++ b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
@@ -55,6 +55,14 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
--connection node_2
--source suite/galera/include/galera_load_provider.inc
+#
+# client connections were killed by provider load, so have to re-open here
+#
+--disconnect node_2
+--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2
+--enable_reconnect
+
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc
index edc7eb31e0e..cd841f51fbc 100644
--- a/mysql-test/suite/galera/include/galera_unload_provider.inc
+++ b/mysql-test/suite/galera/include/galera_unload_provider.inc
@@ -3,5 +3,13 @@
--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
--let $wsrep_provider_orig = `SELECT @@wsrep_provider`
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+--let $wsrep_error_log_orig = `SELECT @@log_error`
+if(!$wsrep_log_error_orig)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $wsrep_log_error_orig = $MYSQLTEST_VARDIR/log/mysqld.2.err;
+}
+--let LOG_FILE= $wsrep_log_error_orig
SET GLOBAL wsrep_provider = 'none';
diff --git a/mysql-test/suite/galera/include/have_filekeymanagement.inc b/mysql-test/suite/galera/include/have_filekeymanagement.inc
new file mode 100644
index 00000000000..f5507ca4548
--- /dev/null
+++ b/mysql-test/suite/galera/include/have_filekeymanagement.inc
@@ -0,0 +1,3 @@
+#
+# Used in galera/suite.pm to check file key management plugin
+#
diff --git a/mysql-test/suite/galera/r/GAL-382.result b/mysql-test/suite/galera/r/GAL-382.result
index fb7c229bd56..137efe4efba 100644
--- a/mysql-test/suite/galera/r/GAL-382.result
+++ b/mysql-test/suite/galera/r/GAL-382.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
create table t1 (i int, j int, k int, primary key pk(i)) engine=innodb;
insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
diff --git a/mysql-test/suite/galera/r/GAL-401.result b/mysql-test/suite/galera/r/GAL-401.result
index 3b55b7589b7..3dfc32ffb8c 100644
--- a/mysql-test/suite/galera/r/GAL-401.result
+++ b/mysql-test/suite/galera/r/GAL-401.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
connection node_2;
SET @@global.wsrep_desync = 1;
diff --git a/mysql-test/suite/galera/r/GAL-480.result b/mysql-test/suite/galera/r/GAL-480.result
index 143f48a69e3..8a4f8edcdd6 100644
--- a/mysql-test/suite/galera/r/GAL-480.result
+++ b/mysql-test/suite/galera/r/GAL-480.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 CHAR(10), f0 integer) ENGINE=InnoDB;
FLUSH TABLE t1 FOR EXPORT;
diff --git a/mysql-test/suite/galera/r/GCF-1081.result b/mysql-test/suite/galera/r/GCF-1081.result
new file mode 100644
index 00000000000..ede512ec6b1
--- /dev/null
+++ b/mysql-test/suite/galera/r/GCF-1081.result
@@ -0,0 +1,47 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 0), (3, 0);
+CREATE PROCEDURE proc_update ()
+BEGIN
+UPDATE t1 SET f2 = 1 where f1 > 0;
+END|
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+CALL proc_update ();;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+connection node_1a;
+SET GLOBAL DEBUG = 'd,sync.wsrep_before_BF_victim_unlock';
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+connection node_2;
+INSERT INTO t1 VALUES (2, 2);;
+connection node_1a;
+SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached';
+SET GLOBAL DEBUG = '';
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+1 1
+2 2
+3 1
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 1
+2 2
+3 1
+wsrep_local_replays
+1
+DROP PROCEDURE proc_update;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/GCF-939.result b/mysql-test/suite/galera/r/GCF-939.result
new file mode 100644
index 00000000000..24d4eab67e5
--- /dev/null
+++ b/mysql-test/suite/galera/r/GCF-939.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+connection node_1;
+DROP TABLE t1;
+ERROR 42S02: Unknown table 'test.t1'
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+GRA_.log
+GRA_.log
+DROP TABLE t1;
+CALL mtr.add_suppression("Ignoring error 'Unknown table 'test.t1'' on query");
+connection node_2;
+CALL mtr.add_suppression("Error 'Unknown table 'test.t1'' on query");
diff --git a/mysql-test/suite/galera/r/MDEV-15443.result b/mysql-test/suite/galera/r/MDEV-15443.result
index 618e5459878..21332b372e8 100644
--- a/mysql-test/suite/galera/r/MDEV-15443.result
+++ b/mysql-test/suite/galera/r/MDEV-15443.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/MW-252.result b/mysql-test/suite/galera/r/MW-252.result
index 795d3fff670..4d458802614 100644
--- a/mysql-test/suite/galera/r/MW-252.result
+++ b/mysql-test/suite/galera/r/MW-252.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
FLUSH TABLES WITH READ LOCK;
diff --git a/mysql-test/suite/galera/r/MW-258.result b/mysql-test/suite/galera/r/MW-258.result
index 1c2a1744c98..22963557daf 100644
--- a/mysql-test/suite/galera/r/MW-258.result
+++ b/mysql-test/suite/galera/r/MW-258.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
LOCK TABLE t1 WRITE;
diff --git a/mysql-test/suite/galera/r/MW-259.result b/mysql-test/suite/galera/r/MW-259.result
index 5256a95c52c..9a0f2ccfa23 100644
--- a/mysql-test/suite/galera/r/MW-259.result
+++ b/mysql-test/suite/galera/r/MW-259.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result
index 0f6c0be25fe..11a0a7df387 100644
--- a/mysql-test/suite/galera/r/MW-284.result
+++ b/mysql-test/suite/galera/r/MW-284.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
@@ -24,7 +26,9 @@ RESET SLAVE ALL;
CALL mtr.add_suppression('failed registering on master');
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
connection node_1;
+set global wsrep_on=OFF;
RESET MASTER;
+set global wsrep_on=ON;
CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
connection node_2;
CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
diff --git a/mysql-test/suite/galera/r/MW-285.result b/mysql-test/suite/galera/r/MW-285.result
index 8c5a21fcbee..762f22d5d25 100644
--- a/mysql-test/suite/galera/r/MW-285.result
+++ b/mysql-test/suite/galera/r/MW-285.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE parent1 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
CREATE TABLE parent2 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
CREATE TABLE child (
diff --git a/mysql-test/suite/galera/r/MW-286.result b/mysql-test/suite/galera/r/MW-286.result
index f3bef6f7516..b3accb1cd9b 100644
--- a/mysql-test/suite/galera/r/MW-286.result
+++ b/mysql-test/suite/galera/r/MW-286.result
@@ -1,15 +1,24 @@
+connection node_2;
+connection node_1;
connection node_1;
-CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
-INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
-INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
-INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;;
+INSERT INTO t1 (f1) VALUES (1), (2), (3);
connection node_2;
SET GLOBAL wsrep_desync = TRUE;
SET wsrep_on = FALSE;
-ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION debug_sync = "alter_table_inplace_after_lock_upgrade SIGNAL mdl_locked WAIT_FOR mdl_continue";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET SESSION debug_sync = "now WAIT_FOR mdl_locked";
+connection node_1;
+INSERT INTO t1(f1) VALUES (11);
+connection node_2a;
+SET debug_sync = "now SIGNAL mdl_continue";
+SET debug_sync='RESET';
+connection node_2;
+ERROR 70100: Query execution was interrupted
SET wsrep_on = TRUE;
SET GLOBAL wsrep_desync = FALSE;
connection node_1;
DROP TABLE t1;
-DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/MW-292.result b/mysql-test/suite/galera/r/MW-292.result
index 5b9214ace2a..81e5a316b63 100644
--- a/mysql-test/suite/galera/r/MW-292.result
+++ b/mysql-test/suite/galera/r/MW-292.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE rand_table (f1 FLOAT);
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
INSERT INTO t1 VALUES (1, 'a');
@@ -10,19 +12,28 @@ SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
f1 f2
2 a
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
-connection node_1;
-COMMIT;;
-connection node_1a;
-SET SESSION wsrep_sync_wait = 0;
-SET SESSION wsrep_on = 0;
-SET SESSION wsrep_on = 1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
connection node_2;
UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
connection node_1;
SELECT TIMEDIFF(SYSDATE(), NOW()) < 2;
TIMEDIFF(SYSDATE(), NOW()) < 2
diff --git a/mysql-test/suite/galera/r/MW-309.result b/mysql-test/suite/galera/r/MW-309.result
index 3dd49a041ee..0169b56e3e1 100644
--- a/mysql-test/suite/galera/r/MW-309.result
+++ b/mysql-test/suite/galera/r/MW-309.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 SELECT * FROM t1;
diff --git a/mysql-test/suite/galera/r/MW-313.result b/mysql-test/suite/galera/r/MW-313.result
index dc605ffc370..909caf77f1d 100644
--- a/mysql-test/suite/galera/r/MW-313.result
+++ b/mysql-test/suite/galera/r/MW-313.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 SELECT * FROM t1;
diff --git a/mysql-test/suite/galera/r/MW-328A.result b/mysql-test/suite/galera/r/MW-328A.result
index db0301b6bf2..f4bb018b442 100644
--- a/mysql-test/suite/galera/r/MW-328A.result
+++ b/mysql-test/suite/galera/r/MW-328A.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1);
CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
@@ -14,10 +16,6 @@ connection node_1X;
CALL proc_update();;
connection node_2;
SET SESSION wsrep_retry_autocommit = 0;
-have_successes
-1
-have_deadlocks
-1
connection node_1;
connection node_1X;
Got one of the listed errors
@@ -25,3 +23,22 @@ connection node_1;
DROP PROCEDURE proc_update;
DROP TABLE t1, t2;
CALL mtr.add_suppression("conflict state 3 after post commit");
+connection node_1;
+CREATE TABLE t1 (i int primary key, j int) engine=innodb;
+INSERT INTO t1 values (1,0);
+BEGIN;
+UPDATE t1 SET j=1 WHERE i=1;
+connection node_2;
+UPDATE t1 SET j=2 WHERE i=1;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+i j
+1 2
+connection node_2;
+SELECT * FROM t1;
+i j
+1 2
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-328B.result b/mysql-test/suite/galera/r/MW-328B.result
index e898e315ca8..d29c3a50f3d 100644
--- a/mysql-test/suite/galera/r/MW-328B.result
+++ b/mysql-test/suite/galera/r/MW-328B.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1);
CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/MW-328C.result b/mysql-test/suite/galera/r/MW-328C.result
index d8e164e7b4a..748f9420764 100644
--- a/mysql-test/suite/galera/r/MW-328C.result
+++ b/mysql-test/suite/galera/r/MW-328C.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1);
CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/MW-328D.result b/mysql-test/suite/galera/r/MW-328D.result
index 6562136ec27..43e1cefe08f 100644
--- a/mysql-test/suite/galera/r/MW-328D.result
+++ b/mysql-test/suite/galera/r/MW-328D.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (i INT) ENGINE = InnoDB;
INSERT INTO t1 (i) VALUES(1);
CREATE TABLE t2 (i INT) ENGINE = InnoDB;
diff --git a/mysql-test/suite/galera/r/MW-328E.result b/mysql-test/suite/galera/r/MW-328E.result
index 89654ec066a..729fdea1a63 100644
--- a/mysql-test/suite/galera/r/MW-328E.result
+++ b/mysql-test/suite/galera/r/MW-328E.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
create table t1 (i int primary key, j int) engine=innodb;
create table t2 (i int primary key, j int) engine=innodb;
insert into t1 values (1,0);
diff --git a/mysql-test/suite/galera/r/MW-329.result b/mysql-test/suite/galera/r/MW-329.result
index a3cb7277a9c..334ff9f80fb 100644
--- a/mysql-test/suite/galera/r/MW-329.result
+++ b/mysql-test/suite/galera/r/MW-329.result
@@ -1,10 +1,6 @@
CALL mtr.add_suppression("WSREP: .*conflict state . after post commit .*");
CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1),(65535);
-FLUSH STATUS;
-SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
-VARIABLE_VALUE = 0
-1
CREATE PROCEDURE proc_insert ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
@@ -16,10 +12,7 @@ END|
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1b;
CALL proc_insert();;
-connection node_2;
-CALL mtr.add_suppression("WSREP: Failed to report last committed .*");
-SELECT VARIABLE_VALUE > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
-VARIABLE_VALUE > 0
+wsrep_local_replays
1
connection node_1;
connection node_1b;
diff --git a/mysql-test/suite/galera/r/MW-336.result b/mysql-test/suite/galera/r/MW-336.result
index e35044d872b..5961d1f3e24 100644
--- a/mysql-test/suite/galera/r/MW-336.result
+++ b/mysql-test/suite/galera/r/MW-336.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
INSERT INTO t1 values(0);
connection node_1;
diff --git a/mysql-test/suite/galera/r/MW-357.result b/mysql-test/suite/galera/r/MW-357.result
index 35855e21233..dc391be4dd3 100644
--- a/mysql-test/suite/galera/r/MW-357.result
+++ b/mysql-test/suite/galera/r/MW-357.result
@@ -1,4 +1,6 @@
connection node_2;
+connection node_1;
+connection node_2;
SET GLOBAL wsrep_slave_threads = 0;
Warnings:
Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
diff --git a/mysql-test/suite/galera/r/MW-360.result b/mysql-test/suite/galera/r/MW-360.result
new file mode 100644
index 00000000000..f20d5be2135
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-360.result
@@ -0,0 +1,41 @@
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+DROP TABLE t1, t2;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+DROP TABLE t1, t2;
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+CREATE TEMPORARY TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (3);
+DROP TABLE t1, t2, t3;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (3);
+DROP TABLE t1, t2, t3;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+DROP TABLE t1;
+DROP TABLE t1;
+gtid_executed_equal
+1
diff --git a/mysql-test/suite/galera/r/MW-369.result b/mysql-test/suite/galera/r/MW-369.result
index 516904d1b2a..9f0a77edbbc 100644
--- a/mysql-test/suite/galera/r/MW-369.result
+++ b/mysql-test/suite/galera/r/MW-369.result
@@ -1,25 +1,36 @@
+connection node_2;
+connection node_1;
CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1)) ;
INSERT INTO p VALUES (1, 0);
INSERT INTO p VALUES (2, 0);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
DELETE FROM p WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
INSERT INTO c VALUES (1, 1);
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
SELECT * FROM p;
f1 f2
1 0
@@ -29,6 +40,7 @@ f1 p_id
1 1
DROP TABLE c;
DROP TABLE p;
+connection node_1;
CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
f2 INTEGER,
@@ -36,22 +48,30 @@ CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1)) ;
INSERT INTO p VALUES (1, 0);
INSERT INTO p VALUES (2, 0);
INSERT INTO c VALUES (1, 1, 0);
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
UPDATE c SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
SELECT * FROM p;
f1 f2
1 1
@@ -61,28 +81,37 @@ f1 p_id f2
1 1 1
DROP TABLE c;
DROP TABLE p;
+connection node_1;
CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1)) ;
INSERT INTO p VALUES (1, 0);
INSERT INTO p VALUES (2, 0);
INSERT INTO c VALUES (1, 1);
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
DELETE FROM c WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
SELECT * FROM p;
f1 f2
1 1
@@ -95,23 +124,31 @@ CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER UNIQUE KEY) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f2)) ;
INSERT INTO p VALUES (1, 0);
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
INSERT INTO c VALUES (1, 0);;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
SELECT * FROM p;
f1 f2
1 0
@@ -127,23 +164,31 @@ ON DELETE CASCADE) ;
INSERT INTO p VALUES (1, 0);
INSERT INTO p VALUES (2, 0);
INSERT INTO c VALUES (1, 1, 0);
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
DELETE FROM p WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
UPDATE c SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
SELECT * FROM p;
f1 f2
1 0
@@ -153,3 +198,87 @@ f1 p_id f2
1 1 1
DROP TABLE c;
DROP TABLE p;
+#
+# Start of 10.4 tests
+#
+connection node_1;
+CREATE TABLE pf (f1 INTEGER PRIMARY KEY) ENGINE=INNODB;
+CREATE TABLE cf (
+f1 INTEGER PRIMARY KEY,
+p_id INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES pf (f1)
+);
+INSERT INTO pf VALUES (1);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+INSERT INTO cf (f1, p_id) VALUES (10, 1);
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO cf (f1, p_id) VALUES (20, 1);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
+SELECT * FROM pf;
+f1
+1
+SELECT * FROM cf;
+f1 p_id
+10 1
+20 1
+DROP TABLE cf;
+DROP TABLE pf;
+connection node_1;
+CREATE TABLE pg (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE cg (f1 INTEGER PRIMARY KEY, p_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES pg (f1)) ;
+INSERT INTO pg VALUES (1, 0);
+INSERT INTO pg VALUES (2, 0);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE pg SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO cg VALUES (1, 1, 0);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
+SELECT * FROM pg;
+f1 f2
+1 1
+2 0
+SELECT * FROM cg;
+f1 p_id f2
+1 1 0
+DROP TABLE cg;
+DROP TABLE pg;
diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result
index a2cf02712bb..3e532b3e12d 100644
--- a/mysql-test/suite/galera/r/MW-388.result
+++ b/mysql-test/suite/galera/r/MW-388.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
CREATE PROCEDURE insert_proc ()
@@ -18,7 +20,7 @@ connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
SET SESSION wsrep_sync_wait = 0;
-SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue';
+SET SESSION DEBUG_SYNC = 'wsrep_after_certification SIGNAL wsrep_after_certification_reached WAIT_FOR wsrep_after_certification_continue';
CALL insert_proc ();;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
@@ -29,7 +31,7 @@ connection node_2;
connection node_1;
SELECT @errno = 1213;
@errno = 1213
-0
+1
SELECT * FROM t1;
f1 f2
1 node 2
diff --git a/mysql-test/suite/galera/r/MW-402.result b/mysql-test/suite/galera/r/MW-402.result
index 9be98d629fb..f692c90d611 100644
--- a/mysql-test/suite/galera/r/MW-402.result
+++ b/mysql-test/suite/galera/r/MW-402.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
@@ -20,14 +22,14 @@ connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
connection node_1;
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
@@ -60,14 +62,14 @@ connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
connection node_1;
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
@@ -102,14 +104,14 @@ connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
connection node_1;
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
@@ -135,14 +137,14 @@ connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
connection node_1;
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
@@ -159,8 +161,10 @@ DROP TABLE p;
connection node_1;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
-CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, f2 INTEGER,
-CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) ON DELETE CASCADE,
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1));
INSERT INTO p1 VALUES (1, 0);
INSERT INTO p2 VALUES (1, 0);
@@ -179,14 +183,14 @@ connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
connection node_1;
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
connection node_1;
connection node_2;
@@ -197,4 +201,52 @@ f1 f2
1 2
SELECT * FROM c;
f1 p1_id p2_id f2
+DROP TABLE c;
+DROP TABLE p1;
+DROP TABLE p2;
+connection node_1;
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ON DELETE CASCADE,
+CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
+ON DELETE CASCADE);
+INSERT INTO p1 VALUES (1, 0);
+INSERT INTO p2 VALUES (1, 0);
+INSERT INTO c VALUES (1, 1, 1, 0);
+connection node_1a;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+DELETE FROM p2 WHERE f1=1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+DELETE FROM p1 WHERE f1=1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p1;
+f1 f2
+SELECT * FROM p2;
+f1 f2
+1 0
+SELECT * FROM c;
+f1 p1_id p2_id f2
DROP TABLE c,p1,p2;
diff --git a/mysql-test/suite/galera/r/MW-416.result b/mysql-test/suite/galera/r/MW-416.result
index 05399b213a8..537e648df6b 100644
--- a/mysql-test/suite/galera/r/MW-416.result
+++ b/mysql-test/suite/galera/r/MW-416.result
@@ -109,6 +109,5 @@ mtr
mysql
performance_schema
test
-SHOW GLOBAL STATUS LIKE 'wsrep_replicated';
-Variable_name Value
-wsrep_replicated 3
+wsrep_replicated_after_diff
+1
diff --git a/mysql-test/suite/galera/r/MW-86-wait1.result b/mysql-test/suite/galera/r/MW-86-wait1.result
index 00010eaedcb..36cbfadf302 100644
--- a/mysql-test/suite/galera/r/MW-86-wait1.result
+++ b/mysql-test/suite/galera/r/MW-86-wait1.result
@@ -1,11 +1,13 @@
connection node_2;
+connection node_1;
+SET @orig_debug=@@debug;
+connection node_2;
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
+set debug_sync='RESET';
SET SESSION wsrep_sync_wait = 1;
-SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
connection node_1;
CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t_wait1 VALUES (1);
@@ -36,16 +38,11 @@ SHOW TABLES;
SHOW TRIGGERS;
SHOW GLOBAL VARIABLES LIKE 'foo_bar';
SHOW WARNINGS;
-SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET GLOBAL debug_dbug = @orig_debug;
SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb";
+SET debug_sync='RESET';
SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait1;
-SET GLOBAL debug = NULL;
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
-SET debug_sync='RESET';
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
diff --git a/mysql-test/suite/galera/r/MW-86-wait8.result b/mysql-test/suite/galera/r/MW-86-wait8.result
index 47e0ebc1342..6ac2c5f5e1f 100644
--- a/mysql-test/suite/galera/r/MW-86-wait8.result
+++ b/mysql-test/suite/galera/r/MW-86-wait8.result
@@ -1,11 +1,12 @@
connection node_2;
+connection node_1;
+SET @orig_debug=@@debug;
+connection node_2;
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
SET SESSION wsrep_sync_wait = 8;
-SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
connection node_1;
CREATE TABLE t_wait8 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t_wait8 VALUES (1);
@@ -38,16 +39,11 @@ SHOW TABLES;
SHOW TRIGGERS;
SHOW GLOBAL VARIABLES LIKE 'foo_bar';
SHOW WARNINGS;
-SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET GLOBAL debug_dbug = @orig_debug;
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET debug_sync='RESET';
SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait8;
-SET GLOBAL debug = NULL;
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
-SET debug_sync='RESET';
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
diff --git a/mysql-test/suite/galera/r/MW-86.result b/mysql-test/suite/galera/r/MW-86.result
new file mode 100644
index 00000000000..bca9be93191
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-86.result
@@ -0,0 +1,78 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET SESSION wsrep_sync_wait = 1;
+SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+connection node_1;
+CREATE DATABASE db1;
+CREATE TABLE bar (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO bar VALUES (1);
+connection node_2;
+SHOW BINARY LOGS;
+SHOW BINLOG EVENTS;
+SHOW COLUMNS FROM t1;
+SHOW CREATE DATABASE db1;
+SHOW CREATE EVENT e1;
+SHOW CREATE FUNCTION f1;
+SHOW CREATE PROCEDURE p1;
+SHOW CREATE TABLE t1;
+SHOW CREATE TRIGGER tr1;
+SHOW CREATE VIEW v1;
+SHOW DATABASES;
+SHOW ENGINE InnoDB STATUS;
+SHOW FUNCTION CODE f1;
+SHOW FUNCTION STATUS;
+SHOW GRANTS FOR 'root'@'localhost';
+SHOW INDEX FROM t1;
+SHOW OPEN TABLES;
+SHOW PROCEDURE CODE p1;
+SHOW PROCEDURE STATUS;
+SHOW PRIVILEGES;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SHOW TABLE STATUS;
+SHOW TABLES;
+SHOW TRIGGERS;
+SHOW GLOBAL VARIABLES LIKE 'foo_bar';
+SHOW WARNINGS;
+SET GLOBAL DEBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET SESSION wsrep_sync_wait = 8;
+DROP DATABASE db1;
+connection node_2;
+SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT0.1S";
+SET SESSION wsrep_sync_wait = 8;
+SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
+connection node_1;
+CREATE TABLE q (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO q VALUES (1);
+connection node_2;
+SHOW BINARY LOGS;
+SHOW BINLOG EVENTS;
+SHOW COLUMNS FROM t1;
+SHOW CREATE DATABASE db1;
+SHOW CREATE EVENT e1;
+SHOW CREATE FUNCTION f1;
+SHOW CREATE PROCEDURE p1;
+SHOW CREATE TABLE t1;
+SHOW CREATE TRIGGER tr1;
+SHOW CREATE VIEW v1;
+SHOW DATABASES;
+SHOW ENGINE InnoDB STATUS;
+SHOW FUNCTION CODE f1;
+SHOW FUNCTION STATUS;
+SHOW GRANTS FOR 'root'@'localhost';
+SHOW INDEX FROM t1;
+SHOW OPEN TABLES;
+SHOW PROCEDURE CODE p1;
+SHOW PROCEDURE STATUS;
+SHOW PRIVILEGES;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SHOW TABLE STATUS;
+SHOW TABLES;
+SHOW TRIGGERS;
+SHOW GLOBAL VARIABLES LIKE 'foo_bar';
+SHOW WARNINGS;
+SET GLOBAL DEBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
diff --git a/mysql-test/suite/galera/r/basic.result b/mysql-test/suite/galera/r/basic.result
index e85c805253f..10f180e7a94 100644
--- a/mysql-test/suite/galera/r/basic.result
+++ b/mysql-test/suite/galera/r/basic.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
USE test;
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
diff --git a/mysql-test/suite/galera/r/binlog_checksum.result b/mysql-test/suite/galera/r/binlog_checksum.result
index e86f3892ac7..4106354eb7d 100644
--- a/mysql-test/suite/galera/r/binlog_checksum.result
+++ b/mysql-test/suite/galera/r/binlog_checksum.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
# On node_1
connection node_1;
SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
diff --git a/mysql-test/suite/galera/r/create.result b/mysql-test/suite/galera/r/create.result
index a445b32e8bf..6ad94dd3d43 100644
--- a/mysql-test/suite/galera/r/create.result
+++ b/mysql-test/suite/galera/r/create.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-6924 : Server crashed on CREATE TABLE ... SELECT
#
diff --git a/mysql-test/suite/galera/r/enforce_storage_engine.result b/mysql-test/suite/galera/r/enforce_storage_engine.result
index 746aa22bf20..1a453241427 100644
--- a/mysql-test/suite/galera/r/enforce_storage_engine.result
+++ b/mysql-test/suite/galera/r/enforce_storage_engine.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-8831 : enforce_storage_engine doesn't block table creation on
# other nodes (galera cluster)
diff --git a/mysql-test/suite/galera/r/enforce_storage_engine2.result b/mysql-test/suite/galera/r/enforce_storage_engine2.result
index 128994ed221..8b174139eae 100644
--- a/mysql-test/suite/galera/r/enforce_storage_engine2.result
+++ b/mysql-test/suite/galera/r/enforce_storage_engine2.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-9312: storage engine not enforced during galera cluster
# replication
diff --git a/mysql-test/suite/galera/r/ev51914.result b/mysql-test/suite/galera/r/ev51914.result
index 3f3d67d01ef..b9d8a82bfa0 100644
--- a/mysql-test/suite/galera/r/ev51914.result
+++ b/mysql-test/suite/galera/r/ev51914.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SAVEPOINT in a stored function should be forbidden
CREATE FUNCTION f1 () RETURNS INT BEGIN
diff --git a/mysql-test/suite/galera/r/fk.result b/mysql-test/suite/galera/r/fk.result
index ab8e1c8f680..17fc99a904e 100644
--- a/mysql-test/suite/galera/r/fk.result
+++ b/mysql-test/suite/galera/r/fk.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
USE test;
# On node_1
diff --git a/mysql-test/suite/galera/r/galera#414.result b/mysql-test/suite/galera/r/galera#414.result
index 34dcb6242d3..2c1dccfd131 100644
--- a/mysql-test/suite/galera/r/galera#414.result
+++ b/mysql-test/suite/galera/r/galera#414.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera#500.result b/mysql-test/suite/galera/r/galera#500.result
index 6a07d0359a4..a5ab0b19718 100644
--- a/mysql-test/suite/galera/r/galera#500.result
+++ b/mysql-test/suite/galera/r/galera#500.result
@@ -1,10 +1,18 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options="gmcast.isolate=2";
+connection node_1;
SET SESSION wsrep_sync_wait = 0;
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status non-Primary
SET SESSION wsrep_sync_wait = default;
SET GLOBAL wsrep_provider_options="pc.bootstrap=1";
+connection node_2;
SET SESSION wsrep_on=0;
+connection node_2;
CALL mtr.add_suppression("WSREP: exception from gcomm, backend must be restarted: Gcomm backend termination was requested by setting gmcast.isolate=2.");
diff --git a/mysql-test/suite/galera/r/galera#505.result b/mysql-test/suite/galera/r/galera#505.result
index 8d3e3ec072a..bc7eb3b9ed4 100644
--- a/mysql-test/suite/galera/r/galera#505.result
+++ b/mysql-test/suite/galera/r/galera#505.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET SESSION wsrep_sync_wait=0;
SET SESSION wsrep_sync_wait=DEFAULT;
diff --git a/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result
new file mode 100644
index 00000000000..5ae577a6323
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result
@@ -0,0 +1,382 @@
+connection node_2;
+connection node_1;
+CREATE TABLE user(id int primary key, j int) ENGINE=InnoDB;
+CREATE TABLE user_session(id int primary key, fk1 int, fk2 int) ENGINE=InnoDB;
+alter table user_session add foreign key (fk1) references user(id);
+INSERT INTO user values (1,0), (2,0), (3,0), (4,0);
+INSERT INTO user_session values (1,1,1);
+connect node_1_u, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_i, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_2_i, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+"Phase 1: plain SQL statements"
+connection node_1;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+"Phase 2: prepared statements"
+connection node_1_u;
+prepare upd from 'update user set j = j + 1 WHERE id > 0';
+connection node_1_i;
+prepare ins1 from 'insert into user_session(id,fk1,fk2) values (2, 2, 2)';
+connection node_2_i;
+prepare ins2 from 'insert into user_session(id,fk1,fk2) values (2, 2, 3)';
+connection node_1;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1;
+drop table user_session,user;
diff --git a/mysql-test/suite/galera/r/galera_admin.result b/mysql-test/suite/galera/r/galera_admin.result
index ed753247236..01e2aac16b2 100644
--- a/mysql-test/suite/galera/r/galera_admin.result
+++ b/mysql-test/suite/galera/r/galera_admin.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
DROP TABLE IF EXISTS t1, t2;
DROP TABLE IF EXISTS x1, x2;
connection node_1;
@@ -16,7 +18,9 @@ connection node_2;
connection node_1;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
connection node_2;
# OPTIMIZE test
diff --git a/mysql-test/suite/galera/r/galera_alter_engine_innodb.result b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result
index ff6ab792c0e..dfa30441f85 100644
--- a/mysql-test/suite/galera/r/galera_alter_engine_innodb.result
+++ b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
ALTER TABLE t1 ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result
index 389383858ac..b3a9bdd30df 100644
--- a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result
+++ b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SET GLOBAL wsrep_replicate_myisam = TRUE;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/galera/r/galera_alter_table_force.result b/mysql-test/suite/galera/r/galera_alter_table_force.result
index d0a2f81b631..271796422cd 100644
--- a/mysql-test/suite/galera/r/galera_alter_table_force.result
+++ b/mysql-test/suite/galera/r/galera_alter_table_force.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
ALTER TABLE t1 FORCE;
diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result
index a6607906661..11fda5d8aab 100644
--- a/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result
+++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result
index 9711100d155..a5aeb6eb366 100644
--- a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result
+++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET SESSION lock_wait_timeout = 60;
diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result
index 2a7262359fa..4aca328be56 100644
--- a/mysql-test/suite/galera/r/galera_as_master.result
+++ b/mysql-test/suite/galera/r/galera_as_master.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
START SLAVE;
connection node_1;
@@ -54,4 +56,6 @@ STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
connection node_1;
+set global wsrep_on=OFF;
RESET MASTER;
+set global wsrep_on=ON;
diff --git a/mysql-test/suite/galera/r/galera_as_master_gtid.result b/mysql-test/suite/galera/r/galera_as_master_gtid.result
index 8dfe462d495..4f5c38b607a 100644
--- a/mysql-test/suite/galera/r/galera_as_master_gtid.result
+++ b/mysql-test/suite/galera/r/galera_as_master_gtid.result
@@ -5,55 +5,19 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
uuids_do_not_match
1
-SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 120;
-Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-bin.000002 120 Previous_gtids 1 151
-mysqld-bin.000002 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid>:1'
-mysqld-bin.000002 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
-mysqld-bin.000002 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= '<effective_uuid>:2'
-mysqld-bin.000002 375 Query 1 452 BEGIN
-mysqld-bin.000002 452 Table_map 1 497 table_id: # (test.t1)
-mysqld-bin.000002 497 Write_rows 1 537 table_id: # flags: STMT_END_F
-mysqld-bin.000002 537 Xid 1 568 COMMIT /* xid=# */
INSERT INTO t1 VALUES(2);
uuids_do_not_match
1
uuids_match
1
-SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 120;
-Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-bin.000003 120 Previous_gtids 2 151
-mysqld-bin.000003 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid>:1'
-mysqld-bin.000003 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
-mysqld-bin.000003 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= '<effective_uuid>:2'
-mysqld-bin.000003 375 Query 1 443 BEGIN
-mysqld-bin.000003 443 Table_map 1 488 table_id: # (test.t1)
-mysqld-bin.000003 488 Write_rows 1 528 table_id: # flags: STMT_END_F
-mysqld-bin.000003 528 Xid 1 559 COMMIT /* xid=# */
-mysqld-bin.000003 559 Gtid 2 607 SET @@SESSION.GTID_NEXT= '<effective_uuid>:3'
-mysqld-bin.000003 607 Query 2 684 BEGIN
-mysqld-bin.000003 684 Table_map 2 729 table_id: # (test.t1)
-mysqld-bin.000003 729 Write_rows 2 769 table_id: # flags: STMT_END_F
-mysqld-bin.000003 769 Xid 2 800 COMMIT /* xid=# */
uuids_do_not_match
1
uuids_match
1
-SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
-Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-bin.000001 120 Previous_gtids 3 151
-mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid>:1'
-mysqld-bin.000001 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
-mysqld-bin.000001 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= '<effective_uuid>:2'
-mysqld-bin.000001 375 Query 1 443 BEGIN
-mysqld-bin.000001 443 Table_map 1 488 table_id: # (test.t1)
-mysqld-bin.000001 488 Write_rows 1 528 table_id: # flags: STMT_END_F
-mysqld-bin.000001 528 Xid 1 559 COMMIT /* xid=# */
-mysqld-bin.000001 559 Gtid 2 607 SET @@SESSION.GTID_NEXT= '<effective_uuid>:3'
-mysqld-bin.000001 607 Query 2 675 BEGIN
-mysqld-bin.000001 675 Table_map 2 720 table_id: # (test.t1)
-mysqld-bin.000001 720 Write_rows 2 760 table_id: # flags: STMT_END_F
-mysqld-bin.000001 760 Xid 2 791 COMMIT /* xid=# */
DROP TABLE t1;
+gtid_executed_equal
+1
+gtid_executed_equal
+1
STOP SLAVE;
RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_master_large.result b/mysql-test/suite/galera/r/galera_as_master_large.result
index dad74211af9..826d2f32057 100644
--- a/mysql-test/suite/galera/r/galera_as_master_large.result
+++ b/mysql-test/suite/galera/r/galera_as_master_large.result
@@ -2,6 +2,8 @@
# MDEV-9044 : Getting binlog corruption on my Galera cluster (10.1.8)
# making it impossible to async slave.
#
+connection node_2;
+connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
START SLAVE;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_as_slave.result b/mysql-test/suite/galera/r/galera_as_slave.result
index 9ccb5106234..391ceecd509 100644
--- a/mysql-test/suite/galera/r/galera_as_slave.result
+++ b/mysql-test/suite/galera/r/galera_as_slave.result
@@ -1,12 +1,14 @@
-connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2;
-START SLAVE;
connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
connection node_2;
INSERT INTO t1 VALUES (2);
-connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
@@ -15,10 +17,10 @@ connection node_2;
SELECT COUNT(*) = 3 FROM t1;
COUNT(*) = 3
1
-connection node_1;
+connection node_3;
DROP TABLE t1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
-connection node_1;
+connection node_3;
RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result
index 60f3216aa9c..6ac51f44950 100644
--- a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result
+++ b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result
@@ -1,7 +1,9 @@
-connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2;
-START SLAVE;
connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
SET SESSION binlog_format='STATEMENT';
CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT,
@@ -60,7 +62,7 @@ binlog_format ROW
show variables like 'auto_increment_increment';
Variable_name Value
auto_increment_increment 2
-connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
select * from t1;
i c
1 dummy_text
@@ -79,10 +81,10 @@ binlog_format ROW
show variables like 'auto_increment_increment';
Variable_name Value
auto_increment_increment 2
-connection node_1;
+connection node_3;
DROP TABLE t1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
-connection node_1;
+connection node_3;
RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid.result b/mysql-test/suite/galera/r/galera_as_slave_gtid.result
index 0ef9d208bf4..180b72bf729 100644
--- a/mysql-test/suite/galera/r/galera_as_slave_gtid.result
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid.result
@@ -1,7 +1,9 @@
-connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2;
-START SLAVE;
connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
SELECT LENGTH(@@global.gtid_binlog_state) > 1;
@@ -10,15 +12,15 @@ LENGTH(@@global.gtid_binlog_state) > 1
connection node_2;
gtid_binlog_state_equal
1
-connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
gtid_binlog_state_equal
1
-connection node_1;
-DROP TABLE t1;
connection node_3;
+DROP TABLE t1;
+connection node_1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db.result
new file mode 100644
index 00000000000..9589d319991
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db.result
@@ -0,0 +1,159 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+connection node_3;
+RESET MASTER;
+connection node_2;
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+START SLAVE;
+connection node_3;
+CREATE SCHEMA test1;
+CREATE SCHEMA test2;
+USE test1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
+USE test2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
+INSERT INTO test1.t1 (f1) VALUES (1);
+INSERT INTO test2.t1 (f1) VALUES (1);
+INSERT INTO test1.t1 (f1) VALUES (2);
+INSERT INTO test2.t1 (f1) VALUES (2);
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+UPDATE test2.t1 SET test2.t1.f2 = 'cde';
+UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz';
+DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO test2.t1 (f1) VALUES (999);
+INSERT INTO test2.t1 (f1) VALUES (9999);
+COMMIT;
+START TRANSACTION;
+INSERT INTO test1.t1 (f1) VALUES (111);
+INSERT INTO test1.t1 (f1) VALUES (222);
+COMMIT;
+START TRANSACTION;
+INSERT INTO test1.t1 (f1) VALUES (333);
+INSERT INTO test2.t1 (f1) VALUES (99999);
+COMMIT;
+connection node_2;
+SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 256 Gtid_list 2 285 []
+master-bin.000001 285 Binlog_checkpoint 2 329 master-bin.000001
+master-bin.000001 329 Gtid 3 371 GTID 0-3-1
+master-bin.000001 371 Query 3 458 CREATE SCHEMA test1
+master-bin.000001 458 Gtid 3 500 GTID 0-3-3
+master-bin.000001 500 Query 3 647 use `test1`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB
+master-bin.000001 647 Gtid 3 689 BEGIN GTID 0-3-5
+master-bin.000001 689 Annotate_rows 3 748 INSERT INTO test1.t1 (f1) VALUES (1)
+master-bin.000001 748 Table_map 3 797 table_id: ### (test1.t1)
+master-bin.000001 797 Write_rows_v1 3 839 table_id: ### flags: STMT_END_F
+master-bin.000001 839 Xid 3 870 COMMIT /* xid=### */
+master-bin.000001 870 Gtid 3 912 BEGIN GTID 0-3-7
+master-bin.000001 912 Annotate_rows 3 971 INSERT INTO test1.t1 (f1) VALUES (2)
+master-bin.000001 971 Table_map 3 1020 table_id: ### (test1.t1)
+master-bin.000001 1020 Write_rows_v1 3 1062 table_id: ### flags: STMT_END_F
+master-bin.000001 1062 Xid 3 1093 COMMIT /* xid=### */
+master-bin.000001 1093 Gtid 3 1135 BEGIN GTID 0-3-9
+master-bin.000001 1135 Annotate_rows 3 1194 INSERT INTO test1.t1 (f1) VALUES (3)
+master-bin.000001 1194 Table_map 3 1243 table_id: ### (test1.t1)
+master-bin.000001 1243 Write_rows_v1 3 1285 table_id: ### flags: STMT_END_F
+master-bin.000001 1285 Xid 3 1316 COMMIT /* xid=### */
+master-bin.000001 1316 Gtid 3 1358 BEGIN GTID 0-3-12
+master-bin.000001 1358 Annotate_rows 3 1451 UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz'
+master-bin.000001 1451 Table_map 3 1500 table_id: ### (test1.t1)
+master-bin.000001 1500 Update_rows_v1 3 1588 table_id: ### flags: STMT_END_F
+master-bin.000001 1588 Xid 3 1619 COMMIT /* xid=### */
+master-bin.000001 1619 Gtid 3 1661 BEGIN GTID 0-3-13
+master-bin.000001 1661 Annotate_rows 3 1795 DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3
+master-bin.000001 1795 Table_map 3 1844 table_id: ### (test1.t1)
+master-bin.000001 1844 Delete_rows_v1 3 1886 table_id: ### flags: STMT_END_F
+master-bin.000001 1886 Xid 3 1917 COMMIT /* xid=### */
+master-bin.000001 1917 Gtid 3 1959 BEGIN GTID 0-3-15
+master-bin.000001 1959 Annotate_rows 3 2020 INSERT INTO test1.t1 (f1) VALUES (111)
+master-bin.000001 2020 Table_map 3 2069 table_id: ### (test1.t1)
+master-bin.000001 2069 Write_rows_v1 3 2111 table_id: ### flags: STMT_END_F
+master-bin.000001 2111 Annotate_rows 3 2172 INSERT INTO test1.t1 (f1) VALUES (222)
+master-bin.000001 2172 Table_map 3 2221 table_id: ### (test1.t1)
+master-bin.000001 2221 Write_rows_v1 3 2263 table_id: ### flags: STMT_END_F
+master-bin.000001 2263 Xid 3 2294 COMMIT /* xid=### */
+master-bin.000001 2294 Gtid 3 2336 BEGIN GTID <effective_uuid>
+master-bin.000001 2336 Annotate_rows 3 2397 INSERT INTO test1.t1 (f1) VALUES (333)
+master-bin.000001 2397 Table_map 3 2446 table_id: ### (test1.t1)
+master-bin.000001 2446 Write_rows_v1 3 2488 table_id: ### flags: STMT_END_F
+master-bin.000001 2488 Xid 3 2519 COMMIT /* xid=### */
+connection node_1;
+gtid_executed_equal
+0
+SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 256 Gtid_list 1 285 []
+master-bin.000001 285 Binlog_checkpoint 1 329 master-bin.000001
+master-bin.000001 329 Gtid 3 371 GTID 0-3-1
+master-bin.000001 371 Query 3 458 CREATE SCHEMA test1
+master-bin.000001 458 Gtid 3 500 GTID 0-3-2
+master-bin.000001 500 Query 3 647 use `test1`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB
+master-bin.000001 647 Gtid 3 689 BEGIN GTID 0-3-3
+master-bin.000001 689 Annotate_rows 3 748 INSERT INTO test1.t1 (f1) VALUES (1)
+master-bin.000001 748 Table_map 3 797 table_id: ### (test1.t1)
+master-bin.000001 797 Write_rows_v1 3 839 table_id: ### flags: STMT_END_F
+master-bin.000001 839 Xid 3 870 COMMIT /* xid=### */
+master-bin.000001 870 Gtid 3 912 BEGIN GTID 0-3-4
+master-bin.000001 912 Annotate_rows 3 971 INSERT INTO test1.t1 (f1) VALUES (2)
+master-bin.000001 971 Table_map 3 1020 table_id: ### (test1.t1)
+master-bin.000001 1020 Write_rows_v1 3 1062 table_id: ### flags: STMT_END_F
+master-bin.000001 1062 Xid 3 1093 COMMIT /* xid=### */
+master-bin.000001 1093 Gtid 3 1135 BEGIN GTID 0-3-5
+master-bin.000001 1135 Annotate_rows 3 1194 INSERT INTO test1.t1 (f1) VALUES (3)
+master-bin.000001 1194 Table_map 3 1243 table_id: ### (test1.t1)
+master-bin.000001 1243 Write_rows_v1 3 1285 table_id: ### flags: STMT_END_F
+master-bin.000001 1285 Xid 3 1316 COMMIT /* xid=### */
+master-bin.000001 1316 Gtid 3 1358 BEGIN GTID 0-3-6
+master-bin.000001 1358 Annotate_rows 3 1451 UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz'
+master-bin.000001 1451 Table_map 3 1500 table_id: ### (test1.t1)
+master-bin.000001 1500 Update_rows_v1 3 1588 table_id: ### flags: STMT_END_F
+master-bin.000001 1588 Xid 3 1619 COMMIT /* xid=### */
+master-bin.000001 1619 Gtid 3 1661 BEGIN GTID 0-3-7
+master-bin.000001 1661 Annotate_rows 3 1795 DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3
+master-bin.000001 1795 Table_map 3 1844 table_id: ### (test1.t1)
+master-bin.000001 1844 Delete_rows_v1 3 1886 table_id: ### flags: STMT_END_F
+master-bin.000001 1886 Xid 3 1917 COMMIT /* xid=### */
+master-bin.000001 1917 Gtid 3 1959 BEGIN GTID 0-3-8
+master-bin.000001 1959 Annotate_rows 3 2020 INSERT INTO test1.t1 (f1) VALUES (111)
+master-bin.000001 2020 Table_map 3 2069 table_id: ### (test1.t1)
+master-bin.000001 2069 Write_rows_v1 3 2111 table_id: ### flags: STMT_END_F
+master-bin.000001 2111 Annotate_rows 3 2172 INSERT INTO test1.t1 (f1) VALUES (222)
+master-bin.000001 2172 Table_map 3 2221 table_id: ### (test1.t1)
+master-bin.000001 2221 Write_rows_v1 3 2263 table_id: ### flags: STMT_END_F
+master-bin.000001 2263 Xid 3 2294 COMMIT /* xid=### */
+master-bin.000001 2294 Gtid 3 2336 BEGIN GTID 0-3-9
+master-bin.000001 2336 Annotate_rows 3 2397 INSERT INTO test1.t1 (f1) VALUES (333)
+master-bin.000001 2397 Table_map 3 2446 table_id: ### (test1.t1)
+master-bin.000001 2446 Write_rows_v1 3 2488 table_id: ### flags: STMT_END_F
+master-bin.000001 2488 Xid 3 2519 COMMIT /* xid=### */
+include/diff_servers.inc [servers=1 2]
+connection node_1;
+SELECT COUNT(*) = 2 FROM test1.t1 WHERE f1 IN (1,2);
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 3 FROM test1.t1 WHERE f1 IN (111,222,333);
+COUNT(*) = 3
+1
+SELECT COUNT(*) = 2 FROM test1.t1 WHERE f2 = 'klm';
+COUNT(*) = 2
+1
+USE test2;
+ERROR 42000: Unknown database 'test2'
+connection node_3;
+DROP SCHEMA test1;
+DROP SCHEMA test2;
+connection node_1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db_cc.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db_cc.result
new file mode 100644
index 00000000000..fc10cc01a45
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_replicate_do_db_cc.result
@@ -0,0 +1,315 @@
+RESET MASTER;
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+START SLAVE USER='root';
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+CREATE SCHEMA test1;
+CREATE SCHEMA test2;
+USE test1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+USE test2;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO test1.t1 (f1) VALUES (1);
+INSERT INTO test2.t1 (f1) VALUES (1);
+INSERT INTO test1.t1 (f1) VALUES (2);
+INSERT INTO test2.t1 (f1) VALUES (2);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+SET SESSION wsrep_on=OFF;
+include/wait_for_slave_sql_error.inc [errno=1047]
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO test1.t1 (f1) VALUES (5);
+INSERT INTO test2.t1 (f1) VALUES (5);
+SET SESSION wsrep_on=ON;
+INSERT INTO test1.t1 (f1) VALUES (6);
+INSERT INTO test2.t1 (f1) VALUES (6);
+START SLAVE;
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 120 Previous_gtids 2 151
+mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:1'
+mysqld-bin.000001 199 Query 1 294 CREATE SCHEMA test1
+mysqld-bin.000001 294 Gtid 1 342 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:2'
+mysqld-bin.000001 342 Query 1 415 BEGIN
+mysqld-bin.000001 415 Query 1 489 COMMIT
+mysqld-bin.000001 489 Gtid 1 537 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:3'
+mysqld-bin.000001 537 Query 1 655 use `test1`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
+mysqld-bin.000001 655 Gtid 1 703 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:4'
+mysqld-bin.000001 703 Query 1 776 BEGIN
+mysqld-bin.000001 776 Query 1 850 COMMIT
+mysqld-bin.000001 850 Gtid 1 898 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:5'
+mysqld-bin.000001 898 Query 1 961 BEGIN
+mysqld-bin.000001 961 Table_map 1 1007 table_id: ### (test1.t1)
+mysqld-bin.000001 1007 Write_rows 1 1047 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 1047 Xid 1 1078 COMMIT /* xid=### */
+mysqld-bin.000001 1078 Gtid 1 1126 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:6'
+mysqld-bin.000001 1126 Query 1 1189 BEGIN
+mysqld-bin.000001 1189 Query 1 1253 COMMIT
+mysqld-bin.000001 1253 Gtid 1 1301 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:7'
+mysqld-bin.000001 1301 Query 1 1364 BEGIN
+mysqld-bin.000001 1364 Table_map 1 1410 table_id: ### (test1.t1)
+mysqld-bin.000001 1410 Write_rows 1 1450 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 1450 Xid 1 1481 COMMIT /* xid=### */
+mysqld-bin.000001 1481 Gtid 1 1529 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:8'
+mysqld-bin.000001 1529 Query 1 1592 BEGIN
+mysqld-bin.000001 1592 Query 1 1656 COMMIT
+mysqld-bin.000001 1656 Gtid 2 1704 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:12'
+mysqld-bin.000001 1704 Query 2 1772 BEGIN
+mysqld-bin.000001 1772 Ignorable 2 1795 # Unrecognized ignorable event
+mysqld-bin.000001 1795 Query 2 1864 COMMIT
+mysqld-bin.000001 1864 Gtid 2 1912 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:13'
+mysqld-bin.000001 1912 Query 2 1980 BEGIN
+mysqld-bin.000001 1980 Ignorable 2 2003 # Unrecognized ignorable event
+mysqld-bin.000001 2003 Query 2 2072 COMMIT
+mysqld-bin.000001 2072 Gtid 1 2120 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:9'
+mysqld-bin.000001 2120 Query 1 2183 BEGIN
+mysqld-bin.000001 2183 Table_map 1 2229 table_id: ### (test1.t1)
+mysqld-bin.000001 2229 Write_rows 1 2269 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 2269 Xid 1 2300 COMMIT /* xid=### */
+mysqld-bin.000001 2300 Gtid 1 2348 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:10'
+mysqld-bin.000001 2348 Query 1 2411 BEGIN
+mysqld-bin.000001 2411 Query 1 2475 COMMIT
+mysqld-bin.000001 2475 Gtid 1 2523 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:11'
+mysqld-bin.000001 2523 Query 1 2586 BEGIN
+mysqld-bin.000001 2586 Table_map 1 2632 table_id: ### (test1.t1)
+mysqld-bin.000001 2632 Write_rows 1 2672 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 2672 Xid 1 2703 COMMIT /* xid=### */
+mysqld-bin.000001 2703 Gtid 1 2751 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:12'
+mysqld-bin.000001 2751 Query 1 2814 BEGIN
+mysqld-bin.000001 2814 Query 1 2878 COMMIT
+mysqld-bin.000001 2878 Gtid 1 2926 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:13'
+mysqld-bin.000001 2926 Query 1 2989 BEGIN
+mysqld-bin.000001 2989 Table_map 1 3035 table_id: ### (test1.t1)
+mysqld-bin.000001 3035 Write_rows 1 3075 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 3075 Xid 1 3106 COMMIT /* xid=### */
+mysqld-bin.000001 3106 Gtid 1 3154 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:14'
+mysqld-bin.000001 3154 Query 1 3217 BEGIN
+mysqld-bin.000001 3217 Query 1 3281 COMMIT
+mysqld-bin.000001 3281 Gtid 1 3329 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:15'
+mysqld-bin.000001 3329 Query 1 3392 BEGIN
+mysqld-bin.000001 3392 Table_map 1 3438 table_id: ### (test1.t1)
+mysqld-bin.000001 3438 Write_rows 1 3478 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 3478 Xid 1 3509 COMMIT /* xid=### */
+mysqld-bin.000001 3509 Gtid 1 3557 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:16'
+mysqld-bin.000001 3557 Query 1 3620 BEGIN
+mysqld-bin.000001 3620 Query 1 3684 COMMIT
+mysqld-bin.000001 3684 Gtid 1 3732 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:17'
+mysqld-bin.000001 3732 Query 1 3795 BEGIN
+mysqld-bin.000001 3795 Table_map 1 3841 table_id: ### (test1.t1)
+mysqld-bin.000001 3841 Write_rows 1 3881 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 3881 Xid 1 3912 COMMIT /* xid=### */
+mysqld-bin.000001 3912 Gtid 1 3960 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:18'
+mysqld-bin.000001 3960 Query 1 4023 BEGIN
+mysqld-bin.000001 4023 Query 1 4087 COMMIT
+mysqld-bin.000001 4087 Gtid 1 4135 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:19'
+mysqld-bin.000001 4135 Query 1 4198 BEGIN
+mysqld-bin.000001 4198 Table_map 1 4244 table_id: ### (test1.t1)
+mysqld-bin.000001 4244 Write_rows 1 4284 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 4284 Xid 1 4315 COMMIT /* xid=### */
+mysqld-bin.000001 4315 Gtid 1 4363 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:20'
+mysqld-bin.000001 4363 Query 1 4426 BEGIN
+mysqld-bin.000001 4426 Query 1 4490 COMMIT
+mysqld-bin.000001 4490 Gtid 1 4538 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:21'
+mysqld-bin.000001 4538 Query 1 4601 BEGIN
+mysqld-bin.000001 4601 Table_map 1 4647 table_id: ### (test1.t1)
+mysqld-bin.000001 4647 Write_rows 1 4687 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 4687 Xid 1 4718 COMMIT /* xid=### */
+mysqld-bin.000001 4718 Gtid 1 4766 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:22'
+mysqld-bin.000001 4766 Query 1 4829 BEGIN
+mysqld-bin.000001 4829 Query 1 4893 COMMIT
+mysqld-bin.000001 4893 Gtid 1 4941 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:23'
+mysqld-bin.000001 4941 Query 1 5004 BEGIN
+mysqld-bin.000001 5004 Table_map 1 5050 table_id: ### (test1.t1)
+mysqld-bin.000001 5050 Write_rows 1 5090 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 5090 Xid 1 5121 COMMIT /* xid=### */
+mysqld-bin.000001 5121 Gtid 1 5169 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:24'
+mysqld-bin.000001 5169 Query 1 5232 BEGIN
+mysqld-bin.000001 5232 Query 1 5296 COMMIT
+mysqld-bin.000001 5296 Gtid 1 5344 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:25'
+mysqld-bin.000001 5344 Query 1 5407 BEGIN
+mysqld-bin.000001 5407 Table_map 1 5453 table_id: ### (test1.t1)
+mysqld-bin.000001 5453 Write_rows 1 5493 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 5493 Xid 1 5524 COMMIT /* xid=### */
+mysqld-bin.000001 5524 Gtid 1 5572 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:26'
+mysqld-bin.000001 5572 Query 1 5635 BEGIN
+mysqld-bin.000001 5635 Query 1 5699 COMMIT
+mysqld-bin.000001 5699 Gtid 1 5747 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:27'
+mysqld-bin.000001 5747 Query 1 5810 BEGIN
+mysqld-bin.000001 5810 Table_map 1 5856 table_id: ### (test1.t1)
+mysqld-bin.000001 5856 Write_rows 1 5896 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 5896 Xid 1 5927 COMMIT /* xid=### */
+mysqld-bin.000001 5927 Gtid 1 5975 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:28'
+mysqld-bin.000001 5975 Query 1 6038 BEGIN
+mysqld-bin.000001 6038 Query 1 6102 COMMIT
+mysqld-bin.000001 6102 Gtid 1 6150 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:29'
+mysqld-bin.000001 6150 Query 1 6213 BEGIN
+mysqld-bin.000001 6213 Table_map 1 6259 table_id: ### (test1.t1)
+mysqld-bin.000001 6259 Write_rows 1 6299 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 6299 Xid 1 6330 COMMIT /* xid=### */
+mysqld-bin.000001 6330 Gtid 1 6378 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:30'
+mysqld-bin.000001 6378 Query 1 6441 BEGIN
+mysqld-bin.000001 6441 Query 1 6505 COMMIT
+USE test2;
+ERROR 42000: Unknown database 'test2'
+gtid_executed_equal
+1
+USE test2;
+ERROR 42000: Unknown database 'test2'
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 120 Previous_gtids 4 151
+mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:1'
+mysqld-bin.000001 199 Query 1 294 CREATE SCHEMA test1
+mysqld-bin.000001 294 Gtid 1 342 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:2'
+mysqld-bin.000001 342 Query 1 415 BEGIN
+mysqld-bin.000001 415 Query 1 489 COMMIT
+mysqld-bin.000001 489 Gtid 1 537 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:3'
+mysqld-bin.000001 537 Query 1 655 use `test1`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
+mysqld-bin.000001 655 Gtid 1 703 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:4'
+mysqld-bin.000001 703 Query 1 776 BEGIN
+mysqld-bin.000001 776 Query 1 850 COMMIT
+mysqld-bin.000001 850 Gtid 1 898 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:5'
+mysqld-bin.000001 898 Query 1 961 BEGIN
+mysqld-bin.000001 961 Table_map 1 1007 table_id: ### (test1.t1)
+mysqld-bin.000001 1007 Write_rows 1 1047 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 1047 Xid 1 1078 COMMIT /* xid=### */
+mysqld-bin.000001 1078 Gtid 1 1126 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:6'
+mysqld-bin.000001 1126 Query 1 1189 BEGIN
+mysqld-bin.000001 1189 Query 1 1253 COMMIT
+mysqld-bin.000001 1253 Gtid 1 1301 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:7'
+mysqld-bin.000001 1301 Query 1 1364 BEGIN
+mysqld-bin.000001 1364 Table_map 1 1410 table_id: ### (test1.t1)
+mysqld-bin.000001 1410 Write_rows 1 1450 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 1450 Xid 1 1481 COMMIT /* xid=### */
+mysqld-bin.000001 1481 Gtid 1 1529 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:8'
+mysqld-bin.000001 1529 Query 1 1592 BEGIN
+mysqld-bin.000001 1592 Query 1 1656 COMMIT
+mysqld-bin.000001 1656 Gtid 4 1704 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:12'
+mysqld-bin.000001 1704 Query 4 1772 BEGIN
+mysqld-bin.000001 1772 Ignorable 4 1795 # Unrecognized ignorable event
+mysqld-bin.000001 1795 Query 4 1864 COMMIT
+mysqld-bin.000001 1864 Gtid 4 1912 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:13'
+mysqld-bin.000001 1912 Query 4 1980 BEGIN
+mysqld-bin.000001 1980 Ignorable 4 2003 # Unrecognized ignorable event
+mysqld-bin.000001 2003 Query 4 2072 COMMIT
+mysqld-bin.000001 2072 Gtid 1 2120 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:9'
+mysqld-bin.000001 2120 Query 1 2183 BEGIN
+mysqld-bin.000001 2183 Table_map 1 2229 table_id: ### (test1.t1)
+mysqld-bin.000001 2229 Write_rows 1 2269 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 2269 Xid 1 2300 COMMIT /* xid=### */
+mysqld-bin.000001 2300 Gtid 1 2348 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:10'
+mysqld-bin.000001 2348 Query 1 2411 BEGIN
+mysqld-bin.000001 2411 Query 1 2475 COMMIT
+mysqld-bin.000001 2475 Gtid 1 2523 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:11'
+mysqld-bin.000001 2523 Query 1 2586 BEGIN
+mysqld-bin.000001 2586 Table_map 1 2632 table_id: ### (test1.t1)
+mysqld-bin.000001 2632 Write_rows 1 2672 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 2672 Xid 1 2703 COMMIT /* xid=### */
+mysqld-bin.000001 2703 Gtid 1 2751 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:12'
+mysqld-bin.000001 2751 Query 1 2814 BEGIN
+mysqld-bin.000001 2814 Query 1 2878 COMMIT
+mysqld-bin.000001 2878 Gtid 1 2926 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:13'
+mysqld-bin.000001 2926 Query 1 2989 BEGIN
+mysqld-bin.000001 2989 Table_map 1 3035 table_id: ### (test1.t1)
+mysqld-bin.000001 3035 Write_rows 1 3075 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 3075 Xid 1 3106 COMMIT /* xid=### */
+mysqld-bin.000001 3106 Gtid 1 3154 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:14'
+mysqld-bin.000001 3154 Query 1 3217 BEGIN
+mysqld-bin.000001 3217 Query 1 3281 COMMIT
+mysqld-bin.000001 3281 Gtid 1 3329 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:15'
+mysqld-bin.000001 3329 Query 1 3392 BEGIN
+mysqld-bin.000001 3392 Table_map 1 3438 table_id: ### (test1.t1)
+mysqld-bin.000001 3438 Write_rows 1 3478 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 3478 Xid 1 3509 COMMIT /* xid=### */
+mysqld-bin.000001 3509 Gtid 1 3557 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:16'
+mysqld-bin.000001 3557 Query 1 3620 BEGIN
+mysqld-bin.000001 3620 Query 1 3684 COMMIT
+mysqld-bin.000001 3684 Gtid 1 3732 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:17'
+mysqld-bin.000001 3732 Query 1 3795 BEGIN
+mysqld-bin.000001 3795 Table_map 1 3841 table_id: ### (test1.t1)
+mysqld-bin.000001 3841 Write_rows 1 3881 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 3881 Xid 1 3912 COMMIT /* xid=### */
+mysqld-bin.000001 3912 Gtid 1 3960 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:18'
+mysqld-bin.000001 3960 Query 1 4023 BEGIN
+mysqld-bin.000001 4023 Query 1 4087 COMMIT
+mysqld-bin.000001 4087 Gtid 1 4135 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:19'
+mysqld-bin.000001 4135 Query 1 4198 BEGIN
+mysqld-bin.000001 4198 Table_map 1 4244 table_id: ### (test1.t1)
+mysqld-bin.000001 4244 Write_rows 1 4284 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 4284 Xid 1 4315 COMMIT /* xid=### */
+mysqld-bin.000001 4315 Gtid 1 4363 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:20'
+mysqld-bin.000001 4363 Query 1 4426 BEGIN
+mysqld-bin.000001 4426 Query 1 4490 COMMIT
+mysqld-bin.000001 4490 Gtid 1 4538 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:21'
+mysqld-bin.000001 4538 Query 1 4601 BEGIN
+mysqld-bin.000001 4601 Table_map 1 4647 table_id: ### (test1.t1)
+mysqld-bin.000001 4647 Write_rows 1 4687 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 4687 Xid 1 4718 COMMIT /* xid=### */
+mysqld-bin.000001 4718 Gtid 1 4766 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:22'
+mysqld-bin.000001 4766 Query 1 4829 BEGIN
+mysqld-bin.000001 4829 Query 1 4893 COMMIT
+mysqld-bin.000001 4893 Gtid 1 4941 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:23'
+mysqld-bin.000001 4941 Query 1 5004 BEGIN
+mysqld-bin.000001 5004 Table_map 1 5050 table_id: ### (test1.t1)
+mysqld-bin.000001 5050 Write_rows 1 5090 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 5090 Xid 1 5121 COMMIT /* xid=### */
+mysqld-bin.000001 5121 Gtid 1 5169 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:24'
+mysqld-bin.000001 5169 Query 1 5232 BEGIN
+mysqld-bin.000001 5232 Query 1 5296 COMMIT
+mysqld-bin.000001 5296 Gtid 1 5344 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:25'
+mysqld-bin.000001 5344 Query 1 5407 BEGIN
+mysqld-bin.000001 5407 Table_map 1 5453 table_id: ### (test1.t1)
+mysqld-bin.000001 5453 Write_rows 1 5493 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 5493 Xid 1 5524 COMMIT /* xid=### */
+mysqld-bin.000001 5524 Gtid 1 5572 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:26'
+mysqld-bin.000001 5572 Query 1 5635 BEGIN
+mysqld-bin.000001 5635 Query 1 5699 COMMIT
+mysqld-bin.000001 5699 Gtid 1 5747 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:27'
+mysqld-bin.000001 5747 Query 1 5810 BEGIN
+mysqld-bin.000001 5810 Table_map 1 5856 table_id: ### (test1.t1)
+mysqld-bin.000001 5856 Write_rows 1 5896 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 5896 Xid 1 5927 COMMIT /* xid=### */
+mysqld-bin.000001 5927 Gtid 1 5975 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:28'
+mysqld-bin.000001 5975 Query 1 6038 BEGIN
+mysqld-bin.000001 6038 Query 1 6102 COMMIT
+mysqld-bin.000001 6102 Gtid 1 6150 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:29'
+mysqld-bin.000001 6150 Query 1 6213 BEGIN
+mysqld-bin.000001 6213 Table_map 1 6259 table_id: ### (test1.t1)
+mysqld-bin.000001 6259 Write_rows 1 6299 table_id: ### flags: STMT_END_F
+mysqld-bin.000001 6299 Xid 1 6330 COMMIT /* xid=### */
+mysqld-bin.000001 6330 Gtid 1 6378 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:30'
+mysqld-bin.000001 6378 Query 1 6441 BEGIN
+mysqld-bin.000001 6441 Query 1 6505 COMMIT
+DROP SCHEMA test1;
+DROP SCHEMA test2;
+STOP SLAVE;
+RESET SLAVE ALL;
+CALL mtr.add_suppression("GTID replication failed");
+CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed");
+CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
+CALL mtr.add_suppression("TO isolation failed for");
+CALL mtr.add_suppression("Slave SQL: Error 'Deadlock found when trying to get lock; try restarting transaction' on query");
+CALL mtr.add_suppression("Slave SQL: Error 'WSREP has not yet prepared node for application use' on query");
+CALL mtr.add_suppression("Slave: WSREP has not yet prepared node for application use Error_code: 1047");
diff --git a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result
index 365ea31f292..fefc988d9d4 100644
--- a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result
+++ b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result
@@ -1,13 +1,28 @@
+connection node_2;
+connection node_1;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_2;
START SLAVE;
SET SESSION wsrep_sync_wait = 0;
+connection node_4;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connection node_1;
+connection node_4;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+connection node_2;
+connection node_1;
expected_error
1
+connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_1;
+connection node_2;
START SLAVE;
+connection node_4;
DROP TABLE t1;
+connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query");
@@ -15,4 +30,5 @@ CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047");
CALL mtr.add_suppression("Transport endpoint is not connected");
CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213");
CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
+connection node_4;
RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result
index d0fac1e3d14..7c98b3e85ed 100644
--- a/mysql-test/suite/galera/r/galera_autoinc_sst_xtrabackup.result
+++ b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result
@@ -1,3 +1,7 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
CREATE PROCEDURE p1 ()
diff --git a/mysql-test/suite/galera/r/galera_bf_abort.result b/mysql-test/suite/galera/r/galera_bf_abort.result
index c2e89965fce..cb4a27c82fd 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(6)) ENGINE=InnoDB;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2;
@@ -9,7 +11,7 @@ INSERT INTO t1 VALUES (1,'node_1');
connection node_2a;
connection node_2;
INSERT INTO t1 VALUES (2, 'node_2');
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result
index 7b98c807efb..1150a9fff63 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
SET AUTOCOMMIT=OFF;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_for_update.result b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
index ec8bddb087a..7dd3053b7bb 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 10);
connection node_1;
@@ -10,7 +12,7 @@ UPDATE t1 SET f1 = 2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_bf_aborts_diff
1
connection node_1;
@@ -23,7 +25,7 @@ UPDATE t1 SET f2 = 20;
connection node_1a;
connection node_1;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_bf_aborts_diff
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result
index ae1ca6d2157..43ca6089d78 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
SET AUTOCOMMIT=OFF;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
index 8c6c7b7d7a4..0ef2a1a72c6 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2a;
SELECT GET_LOCK("foo", 1000);
@@ -10,7 +12,7 @@ SELECT GET_LOCK("foo", 1000);;
connection node_1;
INSERT INTO t1 VALUES (1);
connection node_2;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result b/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result
new file mode 100644
index 00000000000..2a2ddd519f4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result
@@ -0,0 +1,685 @@
+SET SESSION wsrep_sync_wait = 0;
+galera_sr_bf_abort_at_commit = 0
+after_replicate_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+galera_sr_bf_abort_at_commit = 1
+after_replicate_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+galera_sr_bf_abort_at_commit = 1
+after_replicate_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: fragment replication failed: 1");
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result
index 81b5816ddbe..e7882e43b6a 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
SET AUTOCOMMIT=OFF;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result
new file mode 100644
index 00000000000..fa2a5c373f2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+connection node_2;
+SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
+INSERT INTO t1 VALUES (1);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_sleep.result b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result
index 9cd6abad5a1..00d6600d264 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_sleep.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
SET AUTOCOMMIT=OFF;
@@ -6,7 +8,7 @@ SELECT SLEEP(1000);;
connection node_1;
INSERT INTO t1 VALUES (1);
connection node_2;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_background_statistics.result b/mysql-test/suite/galera/r/galera_bf_background_statistics.result
index c2c3fce2b14..a8c8842b8e1 100644
--- a/mysql-test/suite/galera/r/galera_bf_background_statistics.result
+++ b/mysql-test/suite/galera/r/galera_bf_background_statistics.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SELECT @@innodb_stats_persistent;
@@innodb_stats_persistent
1
@@ -27,7 +29,7 @@ SELECT SLEEP(1000);;
connection node_1;
ALTER TABLE t1 CHANGE f2 f2 INTEGER NOT NULL DEFAULT 1;
connection node_2;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_lock_wait.result b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
index 7ec524da888..f893848a72d 100644
--- a/mysql-test/suite/galera/r/galera_bf_lock_wait.result
+++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
ALTER TABLE t1 add primary key(a);
CREATE PROCEDURE p1()
diff --git a/mysql-test/suite/galera/r/galera_binlog_cache_size.result b/mysql-test/suite/galera/r/galera_binlog_cache_size.result
index 6aac74ab5f0..c5a09074537 100644
--- a/mysql-test/suite/galera/r/galera_binlog_cache_size.result
+++ b/mysql-test/suite/galera/r/galera_binlog_cache_size.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 VARCHAR(767)) ENGINE=InnoDB;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result
index 7303aa61122..3ef7cf5c41e 100644
--- a/mysql-test/suite/galera/r/galera_binlog_checksum.result
+++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result
index 46582ff5c4b..b513c491bb0 100644
--- a/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result
+++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 VARCHAR(1000));
diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result
index 7b88af5d5af..6c2279bece0 100644
--- a/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result
+++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 VARCHAR(1000));
INSERT INTO t1 VALUES (REPEAT('x', 1000));
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_binlog_row_image.result b/mysql-test/suite/galera/r/galera_binlog_row_image.result
index d54db61105e..20e6bd9fab8 100644
--- a/mysql-test/suite/galera/r/galera_binlog_row_image.result
+++ b/mysql-test/suite/galera/r/galera_binlog_row_image.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET SESSION binlog_row_image=minimal;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_commit_empty.result b/mysql-test/suite/galera/r/galera_commit_empty.result
new file mode 100644
index 00000000000..75b94c54b1e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_commit_empty.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+START TRANSACTION;
+COMMIT;
+START TRANSACTION;
+COMMIT;
+START TRANSACTION READ ONLY;
+COMMIT;
+START TRANSACTION;
+COMMIT;
+START TRANSACTION;
+START TRANSACTION;
+COMMIT;
+wsrep_last_committed_diff
+1
diff --git a/mysql-test/suite/galera/r/galera_concurrent_ctas.result b/mysql-test/suite/galera/r/galera_concurrent_ctas.result
index 8a3ac1ae0d3..39c55277c52 100644
--- a/mysql-test/suite/galera/r/galera_concurrent_ctas.result
+++ b/mysql-test/suite/galera/r/galera_concurrent_ctas.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
disconnect node_2;
disconnect node_1;
# End of test
diff --git a/mysql-test/suite/galera/r/galera_create_function.result b/mysql-test/suite/galera/r/galera_create_function.result
index 9118c2864f3..85fa85d81f1 100644
--- a/mysql-test/suite/galera/r/galera_create_function.result
+++ b/mysql-test/suite/galera/r/galera_create_function.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE USER 'user1';
CREATE
diff --git a/mysql-test/suite/galera/r/galera_create_procedure.result b/mysql-test/suite/galera/r/galera_create_procedure.result
index 98dc4a856dc..24a0bd66b39 100644
--- a/mysql-test/suite/galera/r/galera_create_procedure.result
+++ b/mysql-test/suite/galera/r/galera_create_procedure.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE USER 'user1';
CREATE TABLE t1 (f1 INTEGER);
diff --git a/mysql-test/suite/galera/r/galera_create_table_as_select.result b/mysql-test/suite/galera/r/galera_create_table_as_select.result
new file mode 100644
index 00000000000..6f65ee99f0a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_table_as_select.result
@@ -0,0 +1,103 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION default_storage_engine=InnoDB;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 AS SELECT * FROM t2;
+ERROR 42S01: Table 't1' already exists
+DROP TABLE t1,t2;
+CREATE TABLE t1 AS SELECT * FROM t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TABLE t1 AS SELECT 1 FROM DUAL;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 AS SELECT * FROM t2;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1,t2;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT * FROM t2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1,t2;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT MAX(f1) AS f1 FROM t2;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT f1 = 5 FROM t1;
+f1 = 5
+1
+connection node_1;
+DROP TABLE t1,t2;
+connection node_1;
+CREATE PROCEDURE sp1 ()
+BEGIN
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT * FROM t2;
+END|
+CALL sp1();
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1, t2;
+DROP PROCEDURE sp1;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT * FROM t2';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+LOCK TABLE t2 WRITE;
+connection node_1;
+CREATE TABLE t1 AS SELECT * FROM t2;;
+connection node_2;
+SELECT COUNT(*) = 5 FROM t2;
+COUNT(*) = 5
+1
+CREATE TABLE t1 AS SELECT * FROM t2;
+connection node_1a;
+UNLOCK TABLES;
+connection node_1;
+Got one of the listed errors
+DROP TABLE t1, t2;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TEMPORARY TABLE t1 AS SELECT * FROM t2;
+connection node_2;
+SELECT * FROM t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t1'' on query");
+connection node_1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/r/galera_create_table_like.result b/mysql-test/suite/galera/r/galera_create_table_like.result
index 131ac311bca..82543331ad5 100644
--- a/mysql-test/suite/galera/r/galera_create_table_like.result
+++ b/mysql-test/suite/galera/r/galera_create_table_like.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE SCHEMA schema1;
CREATE SCHEMA schema2;
USE schema1;
diff --git a/mysql-test/suite/galera/r/galera_create_trigger.result b/mysql-test/suite/galera/r/galera_create_trigger.result
index d07a007543e..56b35150d87 100644
--- a/mysql-test/suite/galera/r/galera_create_trigger.result
+++ b/mysql-test/suite/galera/r/galera_create_trigger.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE definer_root (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
CREATE TABLE definer_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_ddl_multiline.result b/mysql-test/suite/galera/r/galera_ddl_multiline.result
index 339a91125eb..9e70731a62b 100644
--- a/mysql-test/suite/galera/r/galera_ddl_multiline.result
+++ b/mysql-test/suite/galera/r/galera_ddl_multiline.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
index 8083784bb01..20ea590e2e5 100644
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -1,6 +1,8 @@
-SELECT COUNT(*) = 43 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
-COUNT(*) = 43
-0
+connection node_2;
+connection node_1;
+SELECT COUNT(*) `expect 48` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+expect 48
+48
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
@@ -31,6 +33,7 @@ WSREP_DRUPAL_282555_WORKAROUND OFF
WSREP_FORCED_BINLOG_FORMAT NONE
WSREP_GTID_DOMAIN_ID 0
WSREP_GTID_MODE OFF
+WSREP_IGNORE_APPLY_ERRORS 7
WSREP_LOAD_DATA_SPLITTING ON
WSREP_LOG_CONFLICTS OFF
WSREP_MAX_WS_ROWS 0
@@ -47,9 +50,11 @@ WSREP_RETRY_AUTOCOMMIT 1
WSREP_SLAVE_FK_CHECKS ON
WSREP_SLAVE_THREADS 1
WSREP_SLAVE_UK_CHECKS OFF
+WSREP_SR_STORE table
WSREP_SST_AUTH
WSREP_SST_DONOR
WSREP_SST_DONOR_REJECTS_QUERIES OFF
WSREP_SST_METHOD rsync
WSREP_SYNC_WAIT 15
-<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT30S; evs.info_log_mask = 0; evs.install_timeout = PT15S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.recover = no; gcache.size = 10M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; <REPL_PROTO_MAX>;socket.checksum = 2; socket.recv_buf_size = 212992;
+WSREP_TRX_FRAGMENT_SIZE 0
+WSREP_TRX_FRAGMENT_UNIT bytes
diff --git a/mysql-test/suite/galera/r/galera_delete_limit.result b/mysql-test/suite/galera/r/galera_delete_limit.result
index f6fb2e56346..9898bfcf169 100644
--- a/mysql-test/suite/galera/r/galera_delete_limit.result
+++ b/mysql-test/suite/galera/r/galera_delete_limit.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
diff --git a/mysql-test/suite/galera/r/galera_desync_overlapped.result b/mysql-test/suite/galera/r/galera_desync_overlapped.result
index f9920e7f7ad..e3f40d444ee 100644
--- a/mysql-test/suite/galera/r/galera_desync_overlapped.result
+++ b/mysql-test/suite/galera/r/galera_desync_overlapped.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
diff --git a/mysql-test/suite/galera/r/galera_drop_database.result b/mysql-test/suite/galera/r/galera_drop_database.result
index 79789da5a11..ac76683cb25 100644
--- a/mysql-test/suite/galera/r/galera_drop_database.result
+++ b/mysql-test/suite/galera/r/galera_drop_database.result
@@ -1,3 +1,7 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
CREATE DATABASE fts;
USE fts;
CREATE TABLE fts_t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
@@ -9,6 +13,10 @@ INSERT INTO fts_t2 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
DROP TABLE ten;
UPDATE fts_t1 SET f2 = 'abcd';
UPDATE fts_t2 SET f2 = 'efjh';
+connection node_2;
+connection node_1;
+connection node_2;
+connection node_1;
USE fts;
DROP TABLE fts_t1;
DROP TABLE fts_t2;
diff --git a/mysql-test/suite/galera/r/galera_drop_multi.result b/mysql-test/suite/galera/r/galera_drop_multi.result
index 7793ef93b90..1ff8afe3219 100644
--- a/mysql-test/suite/galera/r/galera_drop_multi.result
+++ b/mysql-test/suite/galera/r/galera_drop_multi.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_encrypt_tmp_files.result b/mysql-test/suite/galera/r/galera_encrypt_tmp_files.result
index 38480d186ba..fdfca3316b1 100644
--- a/mysql-test/suite/galera/r/galera_encrypt_tmp_files.result
+++ b/mysql-test/suite/galera/r/galera_encrypt_tmp_files.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
diff --git a/mysql-test/suite/galera/r/galera_enum.result b/mysql-test/suite/galera/r/galera_enum.result
index a2a6317e2a0..40fc6931f6a 100644
--- a/mysql-test/suite/galera/r/galera_enum.result
+++ b/mysql-test/suite/galera/r/galera_enum.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 ENUM('', 'one', 'two'), KEY (f1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('');
@@ -38,7 +40,7 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1;
SELECT COUNT(*) FROM t1 WHERE f1 = 'three';
COUNT(*)
diff --git a/mysql-test/suite/galera/r/galera_events.result b/mysql-test/suite/galera/r/galera_events.result
index f01627aba70..791b0be729d 100644
--- a/mysql-test/suite/galera/r/galera_events.result
+++ b/mysql-test/suite/galera/r/galera_events.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1;
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
index 73375ae55c5..291d641db88 100644
--- a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_update.result b/mysql-test/suite/galera/r/galera_fk_cascade_update.result
index 5fe8b532473..5294826a8f9 100644
--- a/mysql-test/suite/galera/r/galera_fk_cascade_update.result
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_update.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_fk_conflict.result b/mysql-test/suite/galera/r/galera_fk_conflict.result
index a08aa30a82e..f9f151abce4 100644
--- a/mysql-test/suite/galera/r/galera_fk_conflict.result
+++ b/mysql-test/suite/galera/r/galera_fk_conflict.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE parent (
id INT PRIMARY KEY,
KEY (id)
@@ -22,6 +24,6 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE child;
DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_fk_mismatch.result b/mysql-test/suite/galera/r/galera_fk_mismatch.result
index bdc60c9e099..a030b1214c5 100644
--- a/mysql-test/suite/galera/r/galera_fk_mismatch.result
+++ b/mysql-test/suite/galera/r/galera_fk_mismatch.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE parent (
id1 INT,
id2 INT,
diff --git a/mysql-test/suite/galera/r/galera_fk_multicolumn.result b/mysql-test/suite/galera/r/galera_fk_multicolumn.result
index f5b6aa23692..b626d963af8 100644
--- a/mysql-test/suite/galera/r/galera_fk_multicolumn.result
+++ b/mysql-test/suite/galera/r/galera_fk_multicolumn.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t0 (
f1 INT PRIMARY KEY,
f2 INT UNIQUE
diff --git a/mysql-test/suite/galera/r/galera_fk_multitable.result b/mysql-test/suite/galera/r/galera_fk_multitable.result
index 04ff7adc3e9..83e1491ab34 100644
--- a/mysql-test/suite/galera/r/galera_fk_multitable.result
+++ b/mysql-test/suite/galera/r/galera_fk_multitable.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t0 (
f0 INT PRIMARY KEY
);
diff --git a/mysql-test/suite/galera/r/galera_fk_no_pk.result b/mysql-test/suite/galera/r/galera_fk_no_pk.result
index e7b5f0b2b64..622e63dbb8f 100644
--- a/mysql-test/suite/galera/r/galera_fk_no_pk.result
+++ b/mysql-test/suite/galera/r/galera_fk_no_pk.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE parent (
id INT,
KEY (id)
diff --git a/mysql-test/suite/galera/r/galera_fk_selfreferential.result b/mysql-test/suite/galera/r/galera_fk_selfreferential.result
index 3b4dbf2a8e9..9a64521e7b8 100644
--- a/mysql-test/suite/galera/r/galera_fk_selfreferential.result
+++ b/mysql-test/suite/galera/r/galera_fk_selfreferential.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (
f1 INT NOT NULL PRIMARY KEY,
f2 INT,
diff --git a/mysql-test/suite/galera/r/galera_fk_setnull.result b/mysql-test/suite/galera/r/galera_fk_setnull.result
index d4f20fe60a3..afb3fc3b9b8 100644
--- a/mysql-test/suite/galera/r/galera_fk_setnull.result
+++ b/mysql-test/suite/galera/r/galera_fk_setnull.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE parent (
id INT NOT NULL,
PRIMARY KEY (id)
diff --git a/mysql-test/suite/galera/r/galera_flush_local.result b/mysql-test/suite/galera/r/galera_flush_local.result
index a8e798a693d..146833fc3c8 100644
--- a/mysql-test/suite/galera/r/galera_flush_local.result
+++ b/mysql-test/suite/galera/r/galera_flush_local.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
DROP TABLE IF EXISTS t1, t2, x1, x2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
@@ -45,7 +47,9 @@ UNLOCK TABLES;
FLUSH LOCAL TABLES t1;
ANALYZE LOCAL TABLE t1, t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
OPTIMIZE LOCAL TABLE t1, t2;
Table Op Msg_type Msg_text
@@ -120,7 +124,9 @@ UNLOCK TABLES;
FLUSH TABLES t1;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
OPTIMIZE TABLE t1, t2;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format.result b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
index b94e6530886..a94ac0c112d 100644
--- a/mysql-test/suite/galera/r/galera_forced_binlog_format.result
+++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
@@ -1,5 +1,10 @@
+connection node_2;
connection node_1;
+connection node_1;
+SEt GLOBAL wsrep_on=OFF;
RESET MASTER;
+SEt GLOBAL wsrep_on=ON;
+FLUSH BINARY LOGS;
SET SESSION binlog_format = 'STATEMENT';
Warnings:
Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
@@ -13,18 +18,7 @@ SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 <Pos> Gtid_list 1 <End_log_pos> []
mysqld-bin.000001 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001
-mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1
-mysqld-bin.000001 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
-mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2
-mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1)
-mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
-mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
-mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
-mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-3
-mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (2)
-mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
-mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
-mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Rotate 1 <End_log_pos> mysqld-bin.000002;pos=4
DROP TABLE t1;
#
# MDEV-9401: wsrep_forced_binlog_format with binlog causes crash
@@ -43,6 +37,4 @@ GRANT ALL PRIVILEGES ON `testdb_9401`.`t1` TO 'dummy'@'localhost'
REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
DROP USER dummy@localhost;
DROP DATABASE testdb_9401;
-disconnect node_2;
-disconnect node_1;
# End of tests
diff --git a/mysql-test/suite/galera/r/galera_ftwrl.result b/mysql-test/suite/galera/r/galera_ftwrl.result
index 0565781c051..eae8028a7f4 100644
--- a/mysql-test/suite/galera/r/galera_ftwrl.result
+++ b/mysql-test/suite/galera/r/galera_ftwrl.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S";
diff --git a/mysql-test/suite/galera/r/galera_ftwrl_drain.result b/mysql-test/suite/galera/r/galera_ftwrl_drain.result
index 751811b88fd..2342643e745 100644
--- a/mysql-test/suite/galera/r/galera_ftwrl_drain.result
+++ b/mysql-test/suite/galera/r/galera_ftwrl_drain.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
@@ -22,7 +24,7 @@ connection node_2;
SET SESSION lock_wait_timeout = 1;
SET SESSION innodb_lock_wait_timeout=1;
SET SESSION wait_timeout=1;
-INSERT INTO t2 VALUES (2);
+INSERT INTO t1 VALUES (2);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection node_2a;
UNLOCK TABLES;
diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result
index 18e3bff40fc..a22296278fa 100644
--- a/mysql-test/suite/galera/r/galera_fulltext.result
+++ b/mysql-test/suite/galera/r/galera_fulltext.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover.result b/mysql-test/suite/galera/r/galera_gcache_recover.result
index 127bcba39d8..819c595ece3 100644
--- a/mysql-test/suite/galera/r/galera_gcache_recover.result
+++ b/mysql-test/suite/galera/r/galera_gcache_recover.result
@@ -1,18 +1,27 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET SESSION wsrep_sync_wait = 0;
+connection node_2;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
+connection node_1;
INSERT INTO t1 VALUES (2);
Killing server ...
+connection node_1;
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
INSERT INTO t1 VALUES (3);
+connection node_2;
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
+connection node_1;
include/diff_servers.inc [servers=1 2]
+connection node_1;
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
include/assert_grep.inc [async IST sender starting to serve]
+connection node_2;
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence]
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
index 30ee5772411..a0d128f5fa3 100644
--- a/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
@@ -1,19 +1,28 @@
+connection node_2;
+connection node_1;
SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
+connection node_2;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
+connection node_1;
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
Killing server ...
+connection node_1;
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
+connection node_2;
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
+connection node_1;
include/diff_servers.inc [servers=1 2]
+connection node_1;
DROP TABLE t1;
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
-include/assert_grep.inc [IST first seqno 2 not found from cache, falling back to SST]
+include/assert_grep.inc [IST first seqno [24] not found from cache, falling back to SST]
+connection node_2;
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
index 464a8b7ea97..83eaa0fb7aa 100644
--- a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
+++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_gcs_fragment.result b/mysql-test/suite/galera/r/galera_gcs_fragment.result
index 0c9c1819f60..bdd749047ee 100644
--- a/mysql-test/suite/galera/r/galera_gcs_fragment.result
+++ b/mysql-test/suite/galera/r/galera_gcs_fragment.result
@@ -1,24 +1,37 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 TEXT);
+connection node_2;
SET GLOBAL wsrep_cluster_address='';
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'dbug=d,gcs_core_after_frag_send';
+connection node_1;
SET SESSION wsrep_retry_autocommit=0;
INSERT INTO t1 VALUES (1, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_2;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+connection node_1a;
SET GLOBAL wsrep_provider_options = 'signal=gcs_core_after_frag_send';
-ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+ERROR HY000: Got error 6 "No such device or address" during COMMIT
INSERT INTO t1 VALUES (3, "cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
SELECT * FROM t1;
f1 f2
2 bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3 cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+connection node_2;
SELECT * FROM t1;
f1 f2
2 bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3 cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+connection node_1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result
index ce74f3db433..b97be5733ff 100644
--- a/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result
+++ b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result
index 777eda42046..33853188965 100644
--- a/mysql-test/suite/galera/r/galera_gra_log.result
+++ b/mysql-test/suite/galera/r/galera_gra_log.result
@@ -1,4 +1,6 @@
connection node_2;
+connection node_1;
+connection node_2;
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_gtid.result b/mysql-test/suite/galera/r/galera_gtid.result
index acc5eae9876..f27e2590898 100644
--- a/mysql-test/suite/galera/r/galera_gtid.result
+++ b/mysql-test/suite/galera/r/galera_gtid.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result
index f8ca6322d22..7a3048231af 100644
--- a/mysql-test/suite/galera/r/galera_gtid_slave.result
+++ b/mysql-test/suite/galera/r/galera_gtid_slave.result
@@ -1,7 +1,9 @@
-connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2;
-START SLAVE;
connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
@@ -11,27 +13,31 @@ insert into t2 values(22);
commit;
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-4
+2-3-4
connection node_2;
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-4,2-2-2
-connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+0-2-2,2-3-4
+connection node_1;
INSERT INTO t1 VALUES(4);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-4,2-2-2,2-3-3
-connection node_1;
+1-1-1,2-3-4,2-2-6
+connection node_3;
DROP TABLE t1,t2;
connection node_2;
-connection node_3;
+connection node_1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
+SET GLOBAL wsrep_on=OFF;
reset master;
-connection node_3;
-reset master;
+SET GLOBAL wsrep_on=ON;
connection node_1;
+SET GLOBAL wsrep_on=OFF;
+reset master;
+SET GLOBAL wsrep_on=ON;
+connection node_3;
reset master;
diff --git a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result
index cdf330643c2..7c5519af495 100644
--- a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result
+++ b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result
@@ -1,38 +1,40 @@
-connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
#Connection 2
connection node_2;
START SLAVE;
-#Connection 1
-connection node_1;
+#Connection 3
+connection node_3;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB;
INSERT INTO t2 VALUES(1,11);
INSERT INTO t2 VALUES(2,22);
INSERT INTO t2 VALUES(3,33);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-4
+2-3-4
include/save_master_gtid.inc
#Connection 2
connection node_2;
include/sync_with_master_gtid.inc
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-4
+2-3-4
INSERT INTO t2 VALUES(4,44);
INSERT INTO t2 VALUES(5,55);
INSERT INTO t2 VALUES(6,66);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-4,2-2-3
-#Connection 3
-connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+0-2-3,2-3-4
+#Connection 1
+connection node_1;
INSERT INTO t2 VALUES(7,77);
INSERT INTO t2 VALUES(8,88);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-4,2-2-3,2-3-5
-#Connection 1
-connection node_1;
+1-1-2,2-3-4,2-2-7
+#Connection 3
+connection node_3;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -48,76 +50,78 @@ START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
-#Connection 3
-connection node_3;
+#Connection 1
+connection node_1;
+connection node_1;
connection node_2;
-connection node_3;
-Shutting down server ...
#Connection 2
connection node_2;
+Shutting down server ...
+#Connection 1
+connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
COMMIT;
-#Connection 3
-connection node_3;
+#Connection 2
+connection node_2;
Starting server ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
-INSERT INTO t1 VALUES ('node3_committed_after');
-INSERT INTO t1 VALUES ('node3_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
COMMIT;
-#Connection 2
-connection node_2;
+#Connection 1
+connection node_1;
Select * from t1 order by f1;
f1
node1_committed_before
node1_committed_before
node1_committed_during
node1_committed_during
+node2_committed_after
+node2_committed_after
node2_committed_before
node2_committed_before
-node3_committed_after
-node3_committed_after
-#Connection 3
-connection node_3;
+#Connection 2
+connection node_2;
Select * from t1 order by f1;
f1
node1_committed_before
node1_committed_before
node1_committed_during
node1_committed_during
+node2_committed_after
+node2_committed_after
node2_committed_before
node2_committed_before
-node3_committed_after
-node3_committed_after
+#Connection 1
+connection node_1;
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-3,2-3-6,2-2-9
#Connection 2
connection node_2;
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-6,2-2-7,2-3-8
+0-1-7,0-2-8,2-3-6
#Connection 3
connection node_3;
-SELECT @@global.gtid_binlog_state;
-@@global.gtid_binlog_state
-1-1-6,2-2-7,2-3-8
-#Connection 1
-connection node_1;
SET AUTOCOMMIT=ON;
#Connection 2
connection node_2;
SET AUTOCOMMIT=ON;
-#Connection 3
-connection node_3;
+#Connection 1
+connection node_1;
SET AUTOCOMMIT=ON;
#Connection 2
connection node_2;
STOP slave;
INSERT INTO t1 VALUES ('node2_slave_stoped');
-#Connection 1
-connection node_1;
-INSERT INTO t1 VALUES ('node1_normal_entry');
+#Connection 3
+connection node_3;
+INSERT INTO t1 VALUES ('node3_normal_entry');
include/save_master_gtid.inc
#Connection 2
connection node_2;
@@ -130,30 +134,35 @@ count(*)
12
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-7,2-3-8,2-2-11
-#Connection 3
-connection node_3;
+0-1-7,0-2-11,2-3-7
+#Connection 1
+connection node_1;
SELECT count(*) from t1;
count(*)
12
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
-1-1-7,2-3-8,2-2-11
-#Connection 1
-connection node_1;
+1-1-3,2-3-7,2-2-12
+#Connection 3
+connection node_3;
DROP TABLE t2,t1;
#Connection 2
connection node_2;
-#Connection 3
-connection node_3;
+#Connection 1
+connection node_1;
#Connection 2
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
+set global wsrep_on=OFF;
reset master;
-#Connection 3
-connection node_3;
-reset master;
+set global wsrep_on=ON;
+set global gtid_slave_pos="";
#Connection 1
connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+#Connection 3
+connection node_3;
reset master;
diff --git a/mysql-test/suite/galera/r/galera_insert_ignore.result b/mysql-test/suite/galera/r/galera_insert_ignore.result
index 7057affaa0e..417524240e7 100644
--- a/mysql-test/suite/galera/r/galera_insert_ignore.result
+++ b/mysql-test/suite/galera/r/galera_insert_ignore.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SET GLOBAL wsrep_sync_wait = 15;
connection node_2;
SET GLOBAL wsrep_sync_wait = 15;
diff --git a/mysql-test/suite/galera/r/galera_insert_multi.result b/mysql-test/suite/galera/r/galera_insert_multi.result
index 913dd42403a..d7a4f01873e 100644
--- a/mysql-test/suite/galera/r/galera_insert_multi.result
+++ b/mysql-test/suite/galera/r/galera_insert_multi.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
@@ -51,7 +53,7 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ROLLBACK;
INSERT INTO t1 VALUES (1), (2);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
diff --git a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,release.rdiff b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,release.rdiff
new file mode 100644
index 00000000000..bbd75f5230a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,release.rdiff
@@ -0,0 +1,114 @@
+--- galera_ist_innodb_flush_logs.result
++++ galera_ist_innodb_flush_logs,release.result
+@@ -94,111 +94,3 @@
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
+-Performing State Transfer on a server that has been killed and restarted
+-while a DDL was in progress on it
+-connection node_1;
+-CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+-SET AUTOCOMMIT=OFF;
+-START TRANSACTION;
+-INSERT INTO t1 VALUES ('node1_committed_before');
+-INSERT INTO t1 VALUES ('node1_committed_before');
+-INSERT INTO t1 VALUES ('node1_committed_before');
+-INSERT INTO t1 VALUES ('node1_committed_before');
+-INSERT INTO t1 VALUES ('node1_committed_before');
+-connection node_2;
+-START TRANSACTION;
+-INSERT INTO t1 VALUES ('node2_committed_before');
+-INSERT INTO t1 VALUES ('node2_committed_before');
+-INSERT INTO t1 VALUES ('node2_committed_before');
+-INSERT INTO t1 VALUES ('node2_committed_before');
+-INSERT INTO t1 VALUES ('node2_committed_before');
+-COMMIT;
+-SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+-connection node_1;
+-ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+-connection node_2;
+-SET wsrep_sync_wait = 0;
+-Killing server ...
+-connection node_1;
+-SET AUTOCOMMIT=OFF;
+-START TRANSACTION;
+-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+-COMMIT;
+-START TRANSACTION;
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+-SET AUTOCOMMIT=OFF;
+-START TRANSACTION;
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-connection node_2;
+-Performing --wsrep-recover ...
+-connection node_2;
+-Starting server ...
+-Using --wsrep-start-position when starting mysqld ...
+-SET AUTOCOMMIT=OFF;
+-START TRANSACTION;
+-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+-COMMIT;
+-connection node_1;
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+-COMMIT;
+-SET AUTOCOMMIT=OFF;
+-START TRANSACTION;
+-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+-COMMIT;
+-connection node_1a_galera_st_kill_slave_ddl;
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+-ROLLBACK;
+-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+-COUNT(*) = 2
+-1
+-SELECT COUNT(*) = 35 FROM t1;
+-COUNT(*) = 35
+-1
+-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+-COUNT(*) = 0
+-1
+-COMMIT;
+-SET AUTOCOMMIT=ON;
+-connection node_1;
+-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+-COUNT(*) = 2
+-1
+-SELECT COUNT(*) = 35 FROM t1;
+-COUNT(*) = 35
+-1
+-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+-COUNT(*) = 0
+-1
+-DROP TABLE t1;
+-COMMIT;
+-SET AUTOCOMMIT=ON;
+-SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result
index e3bf407ddaa..cad00aaee48 100644
--- a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result
+++ b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result
@@ -1,4 +1,7 @@
+connection node_2;
+connection node_1;
Performing State Transfer on a server that has been killed and restarted
+connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -8,6 +11,7 @@ INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
+connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
@@ -17,6 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Killing server ...
+connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
@@ -31,6 +36,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -38,6 +44,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
Performing --wsrep-recover ...
Starting server ...
Using --wsrep-start-position when starting mysqld ...
@@ -49,6 +56,7 @@ INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
COMMIT;
+connection node_1;
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
@@ -63,6 +71,7 @@ INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
COMMIT;
+connection node_1a_galera_st_kill_slave;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -77,6 +86,7 @@ COUNT(*) = 0
1
COMMIT;
SET AUTOCOMMIT=ON;
+connection node_1;
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
@@ -86,3 +96,111 @@ COUNT(*) = 0
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff
index fa1b67e7ef3..fe54c515395 100644
--- a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff
@@ -1,11 +1,12 @@
---- r/galera_ist_innodb_flush_logs.result 2018-09-05 10:34:36.192439933 +0300
-+++ r/galera_ist_innodb_flush_logs.reject 2018-09-17 10:20:06.039150838 +0300
-@@ -86,3 +86,100 @@
+--- galera_ist_mariabackup.result 2018-12-11 13:33:56.728535840 +0100
++++ galera_ist_mariabackup.reject 2018-12-11 13:37:40.572535840 +0100
+@@ -290,3 +290,111 @@
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
++connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
@@ -14,6 +15,7 @@
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
++connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
@@ -22,9 +24,12 @@
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
++connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
@@ -39,6 +44,7 @@
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
@@ -46,7 +52,9 @@
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+Performing --wsrep-recover ...
++connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
@@ -57,6 +65,7 @@
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
++connection node_1;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
@@ -71,6 +80,7 @@
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
@@ -88,6 +98,7 @@
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
++connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
diff --git a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_ist_mariabackup.result
index 099d944d491..13f7d898a59 100644
--- a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup.result
@@ -1,4 +1,9 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
Performing State Transfer on a server that has been temporarily disconnected
+connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -8,6 +13,7 @@ INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
+connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
@@ -18,6 +24,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Unloading wsrep provider ...
SET GLOBAL wsrep_provider = 'none';
+connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
@@ -32,6 +39,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -39,7 +47,11 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_after');
@@ -48,6 +60,7 @@ INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
COMMIT;
+connection node_1;
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
@@ -62,6 +75,7 @@ INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
COMMIT;
+connection node_1a_galera_st_disconnect_slave;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -76,6 +90,7 @@ COUNT(*) = 0
1
COMMIT;
SET AUTOCOMMIT=ON;
+connection node_1;
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
@@ -86,6 +101,7 @@ DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -95,6 +111,7 @@ INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
+connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
@@ -104,6 +121,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Shutting down server ...
+connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
@@ -118,6 +136,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -125,6 +144,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
Starting server ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -134,6 +154,7 @@ INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
COMMIT;
+connection node_1;
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
@@ -148,6 +169,7 @@ INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
COMMIT;
+connection node_1a_galera_st_shutdown_slave;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -162,6 +184,7 @@ COUNT(*) = 0
1
COMMIT;
SET AUTOCOMMIT=ON;
+connection node_1;
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
@@ -172,6 +195,7 @@ DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
Performing State Transfer on a server that has been killed and restarted
+connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -181,6 +205,7 @@ INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
+connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
@@ -190,6 +215,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Killing server ...
+connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
@@ -204,6 +230,7 @@ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -211,6 +238,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
Performing --wsrep-recover ...
Starting server ...
Using --wsrep-start-position when starting mysqld ...
@@ -222,6 +250,7 @@ INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
COMMIT;
+connection node_1;
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
@@ -236,6 +265,7 @@ INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
COMMIT;
+connection node_1a_galera_st_kill_slave;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
@@ -250,6 +280,7 @@ COUNT(*) = 0
1
COMMIT;
SET AUTOCOMMIT=ON;
+connection node_1;
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
diff --git a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff
index 95310b3ffeb..792f98b4427 100644
--- a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff
@@ -1,11 +1,12 @@
---- r/galera_ist_xtrabackup-v2.result 2018-09-05 10:34:36.192439933 +0300
-+++ r/galera_ist_xtrabackup-v2.reject 2018-09-17 11:13:33.395264800 +0300
-@@ -259,3 +259,100 @@
+--- r/galera_ist_mariabackup_innodb_flush_logs.result 2018-11-21 21:34:20.157054441 +0200
++++ r/galera_ist_mariabackup_innodb_flush_logs.reject 2018-11-22 09:16:16.824604445 +0200
+@@ -94,3 +94,111 @@
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
++connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
@@ -14,6 +15,7 @@
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
++connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
@@ -22,9 +24,12 @@
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
++connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
@@ -39,6 +44,7 @@
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
@@ -46,7 +52,9 @@
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+Performing --wsrep-recover ...
++connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
@@ -57,6 +65,7 @@
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
++connection node_1;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
@@ -71,6 +80,7 @@
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
@@ -88,6 +98,7 @@
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
++connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result
new file mode 100644
index 00000000000..99b9c8d6c1b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result
@@ -0,0 +1,98 @@
+connection node_2;
+connection node_1;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_1;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff
index 74e6abd713f..141b1ebd25f 100644
--- a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff
@@ -1,11 +1,12 @@
---- r/galera_ist_mysqldump.result 2018-09-11 12:38:42.027479411 +0300
-+++ r/galera_ist_mysqldump.reject 2018-09-17 10:28:44.483441364 +0300
-@@ -180,6 +180,103 @@
+--- r/galera_ist_mysqldump.result 2018-11-22 14:25:28.551554055 +0200
++++ r/galera_ist_mysqldump.reject 2018-11-22 15:46:33.119441931 +0200
+@@ -200,6 +200,114 @@
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
++connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
@@ -14,6 +15,7 @@
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
++connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
@@ -22,9 +24,12 @@
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
++connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
@@ -39,6 +44,7 @@
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
@@ -46,7 +52,9 @@
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+Performing --wsrep-recover ...
++connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
@@ -57,6 +65,7 @@
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
++connection node_1;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
@@ -71,6 +80,7 @@
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
@@ -88,6 +98,7 @@
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
++connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
@@ -101,6 +112,6 @@
+COMMIT;
+SET AUTOCOMMIT=ON;
+SET GLOBAL debug_dbug = $debug_orig;
+ connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
- CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
index 296ecc2adc7..222eb7704e8 100644
--- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
Setting SST method to mysqldump ...
call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
@@ -210,3 +212,4 @@ CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
diff --git a/mysql-test/suite/galera/r/galera_ist_progress.result b/mysql-test/suite/galera/r/galera_ist_progress.result
index ed36a217624..9fc7febbea5 100644
--- a/mysql-test/suite/galera/r/galera_ist_progress.result
+++ b/mysql-test/suite/galera/r/galera_ist_progress.result
@@ -1,10 +1,6 @@
-connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
-connection node_1;
-connection node_2;
SET SESSION wsrep_on = OFF;
SET SESSION wsrep_on = ON;
-connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
@@ -16,13 +12,8 @@ INSERT INTO t1 VALUES (7);
INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9);
INSERT INTO t1 VALUES (10);
-connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
-connection node_1;
-connection node_2;
-connection node_1;
include/assert_grep.inc [Receiving IST: 11 writesets, seqnos]
include/assert_grep.inc [Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete]
include/assert_grep.inc [Receiving IST\.\.\.100\.0% \(11/11 events\) complete]
-connection node_1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ist_recv_bind.result b/mysql-test/suite/galera/r/galera_ist_recv_bind.result
index ffc751d8672..be72aa60ab0 100644
--- a/mysql-test/suite/galera/r/galera_ist_recv_bind.result
+++ b/mysql-test/suite/galera/r/galera_ist_recv_bind.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%';
@@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'
diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
index c81cecfae1c..80d2c90642b 100644
--- a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
+++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
@@ -13,7 +15,6 @@ Loading wsrep_provider ...
SET SESSION wsrep_on=OFF;
SET SESSION wsrep_on=ON;
connection node_1;
-connection node_1;
UPDATE t1 SET f2 = 'd' WHERE f1 > 3;
connection node_2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result
index 8a7c02ab1b6..13f7d898a59 100644
--- a/mysql-test/suite/galera/r/galera_ist_rsync.result
+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
Performing State Transfer on a server that has been temporarily disconnected
@@ -47,6 +49,9 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
connection node_2;
Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_after');
diff --git a/mysql-test/suite/galera/r/galera_kill_ddl.result b/mysql-test/suite/galera/r/galera_kill_ddl.result
index b11353fcbcc..9d66140465c 100644
--- a/mysql-test/suite/galera/r/galera_kill_ddl.result
+++ b/mysql-test/suite/galera/r/galera_kill_ddl.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result
index f4de101fef8..a04729d2c87 100644
--- a/mysql-test/suite/galera/r/galera_kill_largechanges.result
+++ b/mysql-test/suite/galera/r/galera_kill_largechanges.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
diff --git a/mysql-test/suite/galera/r/galera_kill_smallchanges.result b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
index 2ee291004b0..206591bbebe 100644
--- a/mysql-test/suite/galera/r/galera_kill_smallchanges.result
+++ b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
diff --git a/mysql-test/suite/galera/r/galera_lock_table.result b/mysql-test/suite/galera/r/galera_lock_table.result
index ce529deb22c..c3df1749ada 100644
--- a/mysql-test/suite/galera/r/galera_lock_table.result
+++ b/mysql-test/suite/galera/r/galera_lock_table.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result
index a6f0ef12be1..12e5e59a426 100644
--- a/mysql-test/suite/galera/r/galera_log_bin.result
+++ b/mysql-test/suite/galera/r/galera_log_bin.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (id INT) ENGINE=InnoDB;
@@ -66,4 +68,6 @@ mysqld-bin.000003 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
DROP TABLE t1;
DROP TABLE t2;
connection node_1;
+SET GLOBAL wsrep_on=OFF;
RESET MASTER;
+SET GLOBAL wsrep_on=ON;
diff --git a/mysql-test/suite/galera/r/galera_log_output_csv.result b/mysql-test/suite/galera/r/galera_log_output_csv.result
index 5cb61b36332..efe8c73c986 100644
--- a/mysql-test/suite/galera/r/galera_log_output_csv.result
+++ b/mysql-test/suite/galera/r/galera_log_output_csv.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) > 0 FROM mysql.general_log;
diff --git a/mysql-test/suite/galera/r/galera_many_columns.result b/mysql-test/suite/galera/r/galera_many_columns.result
index db8a8f5ec9d..64e97f11fa7 100644
--- a/mysql-test/suite/galera/r/galera_many_columns.result
+++ b/mysql-test/suite/galera/r/galera_many_columns.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
INSERT INTO t1 (f1) VALUES (DEFAULT);
connection node_2;
SELECT f1 = 'ABC', f1017 = 'ABC' FROM t1;
@@ -19,7 +21,7 @@ UPDATE t1 SET f2 = 'CDE' WHERE f1 = 'XYZ' AND f1017 = 'XYZ';
COMMIT;
connection node_1;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ROLLBACK;
connection node_2;
ROLLBACK;
diff --git a/mysql-test/suite/galera/r/galera_many_indexes.result b/mysql-test/suite/galera/r/galera_many_indexes.result
index 5691eef4c00..963d3552252 100644
--- a/mysql-test/suite/galera/r/galera_many_indexes.result
+++ b/mysql-test/suite/galera/r/galera_many_indexes.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 VARCHAR(767) PRIMARY KEY) ENGINE=InnoDB;
CREATE UNIQUE INDEX i63 ON t1(f1);
CREATE UNIQUE INDEX i62 ON t1(f1);
@@ -91,6 +93,7 @@ COUNT(*) = 1
INSERT INTO t1 VALUES (REPEAT('b', 767));
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
connection node_1;
SELECT COUNT(*) = 2 FROM t1;
@@ -98,6 +101,7 @@ COUNT(*) = 2
1
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DELETE FROM t1 WHERE f1 = REPEAT('b', 767);
connection node_1;
@@ -129,5 +133,5 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result
index b06925fea60..26771dc3c24 100644
--- a/mysql-test/suite/galera/r/galera_many_rows.result
+++ b/mysql-test/suite/galera/r/galera_many_rows.result
@@ -1,3 +1,7 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
connection node_1;
SET SESSION innodb_lock_wait_timeout=600;
SET SESSION lock_wait_timeout=600;
@@ -35,6 +39,6 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_many_tables_nopk.result b/mysql-test/suite/galera/r/galera_many_tables_nopk.result
index 573ce758a13..2a226defcc7 100644
--- a/mysql-test/suite/galera/r/galera_many_tables_nopk.result
+++ b/mysql-test/suite/galera/r/galera_many_tables_nopk.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -18,6 +20,6 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP SCHEMA test;
CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/r/galera_many_tables_pk.result b/mysql-test/suite/galera/r/galera_many_tables_pk.result
index 67624d5edb0..2700df8ebe4 100644
--- a/mysql-test/suite/galera/r/galera_many_tables_pk.result
+++ b/mysql-test/suite/galera/r/galera_many_tables_pk.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
@@ -23,7 +25,7 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
include/diff_servers.inc [servers=1 2]
DROP SCHEMA test;
CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/r/galera_mdev_10812.result b/mysql-test/suite/galera/r/galera_mdev_10812.result
index de0a08a3794..16eacc6beab 100644
--- a/mysql-test/suite/galera/r/galera_mdev_10812.result
+++ b/mysql-test/suite/galera/r/galera_mdev_10812.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-10812: On COM_STMT_CLOSE/COM_QUIT, when wsrep_conflict_state
# is ABORTED, it causes wrong response to be sent to the client
diff --git a/mysql-test/suite/galera/r/galera_mdev_13787.result b/mysql-test/suite/galera/r/galera_mdev_13787.result
index b1caec0283c..4d0770918c0 100644
--- a/mysql-test/suite/galera/r/galera_mdev_13787.result
+++ b/mysql-test/suite/galera/r/galera_mdev_13787.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
create table t(a int);
insert into t select 1;
diff --git a/mysql-test/suite/galera/r/galera_mdev_15611.result b/mysql-test/suite/galera/r/galera_mdev_15611.result
index 9ea1684494a..5461f8f03fb 100644
--- a/mysql-test/suite/galera/r/galera_mdev_15611.result
+++ b/mysql-test/suite/galera/r/galera_mdev_15611.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (
id int primary key
diff --git a/mysql-test/suite/galera/r/galera_mdl_race.result b/mysql-test/suite/galera/r/galera_mdl_race.result
index 048b2c46a67..e05c1493322 100644
--- a/mysql-test/suite/galera/r/galera_mdl_race.result
+++ b/mysql-test/suite/galera/r/galera_mdl_race.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
INSERT INTO t1 VALUES (1, 'a');
@@ -28,7 +30,7 @@ SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_after_BF_victim_lock";
UNLOCK TABLES;
connection node_1;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
COUNT(*) = 1
1
diff --git a/mysql-test/suite/galera/r/galera_multi_database.result b/mysql-test/suite/galera/r/galera_multi_database.result
index f6242de663b..a9d58d5d0e2 100644
--- a/mysql-test/suite/galera/r/galera_multi_database.result
+++ b/mysql-test/suite/galera/r/galera_multi_database.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE DATABASE d1;
CREATE TABLE d1.t1(f1 INTEGER) ENGINE=InnoDB;
CREATE DATABASE d2;
diff --git a/mysql-test/suite/galera/r/galera_myisam_autocommit.result b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
index e9578a261e6..6213e8f6380 100644
--- a/mysql-test/suite/galera/r/galera_myisam_autocommit.result
+++ b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2), (3);
diff --git a/mysql-test/suite/galera/r/galera_myisam_transactions.result b/mysql-test/suite/galera/r/galera_myisam_transactions.result
index 25796c309d1..091c5ffb6f6 100644
--- a/mysql-test/suite/galera/r/galera_myisam_transactions.result
+++ b/mysql-test/suite/galera/r/galera_myisam_transactions.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
CREATE TABLE t3 (f1 INTEGER) ENGINE=MyISAM;
diff --git a/mysql-test/suite/galera/r/galera_nopk_bit.result b/mysql-test/suite/galera/r/galera_nopk_bit.result
index 21da039df09..97ded793c08 100644
--- a/mysql-test/suite/galera/r/galera_nopk_bit.result
+++ b/mysql-test/suite/galera/r/galera_nopk_bit.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 BIT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(0),(b'1');
connection node_2;
@@ -28,6 +30,6 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_nopk_blob.result b/mysql-test/suite/galera/r/galera_nopk_blob.result
index 53e04f72d1e..6a3cee516c9 100644
--- a/mysql-test/suite/galera/r/galera_nopk_blob.result
+++ b/mysql-test/suite/galera/r/galera_nopk_blob.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),('abc');
connection node_2;
@@ -28,6 +30,6 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_nopk_large_varchar.result b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result
index a83cf7f2d91..6d29306996b 100644
--- a/mysql-test/suite/galera/r/galera_nopk_large_varchar.result
+++ b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 VARCHAR(8000)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(CONCAT(REPEAT('x', 7999), 'a'));
connection node_2;
@@ -31,6 +33,6 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_nopk_unicode.result b/mysql-test/suite/galera/r/galera_nopk_unicode.result
index b2a8bb63df9..587ba9285da 100644
--- a/mysql-test/suite/galera/r/galera_nopk_unicode.result
+++ b/mysql-test/suite/galera/r/galera_nopk_unicode.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (
f1 VARCHAR(255),
KEY (f1)
@@ -19,7 +21,7 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT f1 = 'текÑÑ‚2' FROM t1;
f1 = 'текÑÑ‚2'
1
diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
index ab56a8a2aa6..48625b3ba4a 100644
--- a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
+++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
@@ -8,10 +10,10 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
connection node_2a;
SET SESSION wsrep_sync_wait=0;
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committing%';
COUNT(*) = 1
1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%';
COUNT(*) = 1
1
SELECT COUNT(*) = 0 FROM t1;
@@ -30,7 +32,7 @@ COUNT(*) = 1
SELECT COUNT(*) = 1 FROM t2;
COUNT(*) = 1
1
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%';
COUNT(*) = 2
1
SET GLOBAL wsrep_slave_threads = 1;;
diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
index 827b2aa9dac..d2e09d7084f 100644
--- a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
@@ -1,5 +1,7 @@
+connection node_2;
+connection node_1;
connection node_1;
-CREATE TABLE ten (f1 INTEGER);
+CREATE TABLE ten (f1 INTEGER) engine=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
connection node_2;
@@ -11,18 +13,26 @@ INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
connection node_2;
INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30000
+SELECT COUNT(DISTINCT f1) FROM t1;
+COUNT(DISTINCT f1)
+30000
connection node_1a;
-connection node_2;
SELECT COUNT(*) FROM t1;
COUNT(*)
30000
SELECT COUNT(DISTINCT f1) FROM t1;
COUNT(DISTINCT f1)
30000
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
-USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
+connection node_2;
+SELECT COUNT(*) FROM t1;
COUNT(*)
-3
+30000
+SELECT COUNT(DISTINCT f1) FROM t1;
+COUNT(DISTINCT f1)
+30000
connection default;
DROP TABLE t1;
DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
index c8c07221cb1..09a415d47eb 100644
--- a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
@@ -12,7 +14,7 @@ COUNT(*) = 20000
SELECT COUNT(DISTINCT f1) = 20000 FROM t1;
COUNT(DISTINCT f1) = 20000
1
-SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'wsrep applier committed%';
COUNT(*) = 4
1
connection default;
diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result
index 3f657a0479e..d95abefdc24 100644
--- a/mysql-test/suite/galera/r/galera_parallel_simple.result
+++ b/mysql-test/suite/galera/r/galera_parallel_simple.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT) ENGINE=InnoDB;
CREATE TABLE t2 (id INT) ENGINE=InnoDB;
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_pc_recovery.result b/mysql-test/suite/galera/r/galera_pc_recovery.result
new file mode 100644
index 00000000000..17a43d17211
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pc_recovery.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+CALL mtr.add_suppression("points to own listening address, blacklisting");
+CALL mtr.add_suppression("non weight changing install in S_PRIM");
+CALL mtr.add_suppression("No re-merged primary component found");
+connection node_2;
+CALL mtr.add_suppression("points to own listening address, blacklisting");
+CALL mtr.add_suppression("non weight changing install in S_PRIM");
+CALL mtr.add_suppression("No re-merged primary component found");
diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_signed.result b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result
index 807ab62c548..0b538778204 100644
--- a/mysql-test/suite/galera/r/galera_pk_bigint_signed.result
+++ b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 BIGINT SIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(-9223372036854775808, 'min'),
@@ -27,6 +29,6 @@ COMMIT;
SET AUTOCOMMIT=ON;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET AUTOCOMMIT=ON;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
index c94b7e2314a..9442f79cd14 100644
--- a/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
+++ b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 BIGINT UNSIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(18446744073709551615, 'max')
@@ -24,6 +26,6 @@ COMMIT;
SET AUTOCOMMIT=ON;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET AUTOCOMMIT=ON;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_prepared_statement.result b/mysql-test/suite/galera/r/galera_prepared_statement.result
index d32d412ff46..b84f25e9929 100644
--- a/mysql-test/suite/galera/r/galera_prepared_statement.result
+++ b/mysql-test/suite/galera/r/galera_prepared_statement.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 CHAR(5)) ENGINE=InnoDB;
CREATE TABLE t2 (f1 CHAR(5)) ENGINE=InnoDB;
CREATE TABLE t3 (f1 CHAR(5)) ENGINE=InnoDB;
@@ -28,7 +30,7 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER;
ALTER TABLE t1 DROP COLUMN f1;
connection node_1;
EXECUTE st1;
-ERROR 22007: Incorrect integer value: 'abc' for column 'f2' at row 1
+ERROR 22007: Incorrect integer value: 'abc' for column `test`.`t1`.`f2` at row 1
connection node_1;
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_query_cache.result b/mysql-test/suite/galera/r/galera_query_cache.result
index e64c9438646..8f5bc4b6f37 100644
--- a/mysql-test/suite/galera/r/galera_query_cache.result
+++ b/mysql-test/suite/galera/r/galera_query_cache.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result
index 8c9cece9097..4ee910f9169 100644
--- a/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result
+++ b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result
index 4c2523f8691..fe8b45fa596 100644
--- a/mysql-test/suite/galera/r/galera_read_only.result
+++ b/mysql-test/suite/galera/r/galera_read_only.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
SET GLOBAL read_only=TRUE;
diff --git a/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result
index 2470f59c497..3d421216f93 100644
--- a/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result
+++ b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET GLOBAL wsrep_provider_options = 'repl.key_format=FLAT16';
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result
index da24a741351..0528df7b9f6 100644
--- a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result
+++ b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result
@@ -1,8 +1,10 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB;
SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
INSERT INTO t1 VALUES (REPEAT('a', 512));
-ERROR HY000: Got error 90 "Message too long" during COMMIT
+ERROR HY000: Got error 5 "Input/output error" during COMMIT
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
diff --git a/mysql-test/suite/galera/r/galera_restart_nochanges.result b/mysql-test/suite/galera/r/galera_restart_nochanges.result
index b35ae50e2fb..09f8d9a586b 100644
--- a/mysql-test/suite/galera/r/galera_restart_nochanges.result
+++ b/mysql-test/suite/galera/r/galera_restart_nochanges.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
index ba6f30fcf30..6e672c2d444 100644
--- a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
+++ b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("unknown option '--galera-unknown-option'");
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_roles.result b/mysql-test/suite/galera/r/galera_roles.result
index bef89acfc92..b1124b597c5 100644
--- a/mysql-test/suite/galera/r/galera_roles.result
+++ b/mysql-test/suite/galera/r/galera_roles.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# Testing CREATE/GRANT role
#
diff --git a/mysql-test/suite/galera/r/galera_rsu_add_pk.result b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
index 4c79da154e2..9b068ba30d1 100644
--- a/mysql-test/suite/galera/r/galera_rsu_add_pk.result
+++ b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
diff --git a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
index f64649ef4e2..7d731955691 100644
--- a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
+++ b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
diff --git a/mysql-test/suite/galera/r/galera_rsu_error.result b/mysql-test/suite/galera/r/galera_rsu_error.result
index 5c16e34b492..f78e8fa544c 100644
--- a/mysql-test/suite/galera/r/galera_rsu_error.result
+++ b/mysql-test/suite/galera/r/galera_rsu_error.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
INSERT INTO t1 VALUES (1), (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_rsu_simple.result b/mysql-test/suite/galera/r/galera_rsu_simple.result
index d0ddcfb4d64..d75ef094065 100644
--- a/mysql-test/suite/galera/r/galera_rsu_simple.result
+++ b/mysql-test/suite/galera/r/galera_rsu_simple.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
connection node_2;
SET SESSION wsrep_OSU_method = "RSU";
diff --git a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result
index a103e810588..310611a0e49 100644
--- a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result
+++ b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
SET GLOBAL wsrep_desync=1;
diff --git a/mysql-test/suite/galera/r/galera_sbr.result b/mysql-test/suite/galera/r/galera_sbr.result
index 0bdaeef5b8a..c5fdecece0e 100644
--- a/mysql-test/suite/galera/r/galera_sbr.result
+++ b/mysql-test/suite/galera/r/galera_sbr.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET SESSION binlog_format = 'STATEMENT';
Warnings:
diff --git a/mysql-test/suite/galera/r/galera_sbr_binlog.result b/mysql-test/suite/galera/r/galera_sbr_binlog.result
index 0bdaeef5b8a..c5fdecece0e 100644
--- a/mysql-test/suite/galera/r/galera_sbr_binlog.result
+++ b/mysql-test/suite/galera/r/galera_sbr_binlog.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET SESSION binlog_format = 'STATEMENT';
Warnings:
diff --git a/mysql-test/suite/galera/r/galera_schema_dirty_reads.result b/mysql-test/suite/galera/r/galera_schema_dirty_reads.result
index edf20da92c6..fbac9ff4eb7 100644
--- a/mysql-test/suite/galera/r/galera_schema_dirty_reads.result
+++ b/mysql-test/suite/galera/r/galera_schema_dirty_reads.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
USE information_schema;
SELECT * FROM SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep_dirty_reads";
VARIABLE_NAME VARIABLE_VALUE
diff --git a/mysql-test/suite/galera/r/galera_serializable.result b/mysql-test/suite/galera/r/galera_serializable.result
index be3f93a081f..e3785663271 100644
--- a/mysql-test/suite/galera/r/galera_serializable.result
+++ b/mysql-test/suite/galera/r/galera_serializable.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
@@ -9,7 +11,7 @@ connection node_2;
INSERT INTO t1 VALUES (1,1);
connection node_1;
SELECT * FROM t1;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ROLLBACK;
DELETE FROM t1;
connection node_1;
@@ -22,7 +24,7 @@ connection node_2;
UPDATE t1 SET f2 = 2;
connection node_1;
UPDATE t1 SET f2 = 3;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ROLLBACK;
DELETE FROM t1;
connection node_1;
@@ -33,5 +35,5 @@ connection node_2;
INSERT INTO t1 VALUES (1,2);
connection node_1;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_server.result b/mysql-test/suite/galera/r/galera_server.result
index cc08b826e82..5130dee3459 100644
--- a/mysql-test/suite/galera/r/galera_server.result
+++ b/mysql-test/suite/galera/r/galera_server.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
# On node_1
CREATE SERVER s1
diff --git a/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result
index 14407c917a1..e9f81192386 100644
--- a/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result
+++ b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION sql_log_bin = 0;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/galera/r/galera_ssl.result b/mysql-test/suite/galera/r/galera_ssl.result
index 022d06319b8..ec3b717e3f3 100644
--- a/mysql-test/suite/galera/r/galera_ssl.result
+++ b/mysql-test/suite/galera/r/galera_ssl.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
diff --git a/mysql-test/suite/galera/r/galera_ssl_compression.result b/mysql-test/suite/galera/r/galera_ssl_compression.result
index 333d646376c..0acc4b97eea 100644
--- a/mysql-test/suite/galera/r/galera_ssl_compression.result
+++ b/mysql-test/suite/galera/r/galera_ssl_compression.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff
index 8b091eb370a..819bcba7cac 100644
--- a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff
@@ -1,5 +1,5 @@
---- galera_sst_mariabackup.result
-+++ galera_sst_mariabackup,debug.reject
+--- r/galera_sst_mariabackup.result 2018-11-21 16:50:35.766982279 +0200
++++ r/galera_sst_mariabackup.reject 2018-11-22 09:20:10.344408266 +0200
@@ -286,5 +286,113 @@
DROP TABLE t1;
COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup.result b/mysql-test/suite/galera/r/galera_sst_mariabackup.result
index fdb5883b590..4fdc283b286 100644
--- a/mysql-test/suite/galera/r/galera_sst_mariabackup.result
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
Performing State Transfer on a server that has been shut down cleanly and restarted
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff
index 8b091eb370a..f06da63561a 100644
--- a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff
@@ -1,5 +1,5 @@
---- galera_sst_mariabackup.result
-+++ galera_sst_mariabackup,debug.reject
+--- r/galera_sst_mariabackup_data_dir.result 2018-12-12 13:59:56.525554689 +0100
++++ r/galera_sst_mariabackup_data_dir.reject 2018-12-12 14:33:50.868181956 +0100
@@ -286,5 +286,113 @@
DROP TABLE t1;
COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir.result
index fdb5883b590..4fdc283b286 100644
--- a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
Performing State Transfer on a server that has been shut down cleanly and restarted
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result
new file mode 100644
index 00000000000..409da775d9a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result
@@ -0,0 +1,5 @@
+connection node_2;
+connection node_1;
+SELECT 1;
+1
+1
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result
new file mode 100644
index 00000000000..568c06de94c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result
@@ -0,0 +1,999 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1;
+CREATE TABLE t3 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=NO;
+CREATE TABLE t4 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES;
+CREATE TABLE t5 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+CREATE TABLE t6 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO;
+CREATE TABLE t7 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES;
+CREATE TABLE t8 (f1 CHAR(255)) ENGINE=InnoDB ENCRYPTED=NO;
+CREATE TABLE t9 (f1 CHAR(255)) ENGINE=InnoDB ENCRYPTED=YES;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+connection node_1;
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+ROLLBACK;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t4;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t8;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t9;
+COUNT(*)
+30
+SELECT * FROM t1;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t2;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t3;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t4;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t5;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t6;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t7;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t8;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t9;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t4;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t8;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t9;
+COUNT(*)
+30
+SELECT * FROM t1;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t2;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t3;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t4;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t5;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t6;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t7;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t8;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t9;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+COMMIT;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9;
+COMMIT;
+SET AUTOCOMMIT=ON;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff
index 3eadee615ed..2978411c8f7 100644
--- a/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff
@@ -1,6 +1,22 @@
---- galera_sst_mysqldump.result
-+++ galera_sst_mysqldump,debug.reject
-@@ -388,6 +388,114 @@
+--- galera_sst_mysqldump.result 2018-11-29 23:54:03.663607613 +0100
++++ galera_sst_mysqldump,debug.reject 2018-11-29 23:55:42.377562815 +0100
+@@ -1,3 +1,5 @@
++connection node_2;
++connection node_1;
+ Setting SST method to mysqldump ...
+ call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+ call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+@@ -56,6 +58,9 @@
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ connection node_2;
+ Loading wsrep provider ...
++disconnect node_2;
++connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
+@@ -390,6 +395,114 @@
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff
new file mode 100644
index 00000000000..3e8fee1b098
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff
@@ -0,0 +1,18 @@
+--- suite/galera/r/galera_sst_mysqldump.result 2018-12-20 14:22:41.730134062 +0100
++++ suite/galera/r/galera_sst_mysqldump.reject 2019-01-16 22:18:44.139781857 +0100
+@@ -1,3 +1,5 @@
++connection node_2;
++connection node_1;
+ Setting SST method to mysqldump ...
+ call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+ call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+@@ -56,6 +58,9 @@
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ connection node_2;
+ Loading wsrep provider ...
++disconnect node_2;
++connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
index 5c530c32ce6..4ed679ba477 100644
--- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
@@ -400,3 +400,4 @@ CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff
new file mode 100644
index 00000000000..4a7db96dc22
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff
@@ -0,0 +1,106 @@
+--- r/galera_sst_mysqldump_with_key.result 2018-11-19 09:56:30.081976558 +0200
++++ r/galera_sst_mysqldump_with_key.reject 2018-11-19 10:47:41.609299365 +0200
+@@ -183,6 +183,103 @@
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++SET wsrep_sync_wait = 0;
++Killing server ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++Performing --wsrep-recover ...
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++ROLLBACK;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++SET AUTOCOMMIT=ON;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET AUTOCOMMIT=ON;
++SET GLOBAL debug_dbug = $debug_orig;
+ CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
index 02dde169911..3de446fec32 100644
--- a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
@@ -204,114 +204,17 @@ COUNT(*) = 0
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
-Performing State Transfer on a server that has been killed and restarted
-while a DDL was in progress on it
connection node_1;
-CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
connection node_2;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-COMMIT;
-SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
connection node_1;
-ALTER TABLE t1 ADD COLUMN f2 INTEGER;
connection node_2;
-SET wsrep_sync_wait = 0;
-Killing server ...
connection node_1;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
connection node_2;
-Performing --wsrep-recover ...
connection node_2;
-Starting server ...
-Using --wsrep-start-position when starting mysqld ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-COMMIT;
connection node_1;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-COMMIT;
connection node_1a_galera_st_kill_slave_ddl;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-ROLLBACK;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-COMMIT;
-SET AUTOCOMMIT=ON;
connection node_1;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-DROP TABLE t1;
-COMMIT;
-SET AUTOCOMMIT=ON;
-SET GLOBAL debug_dbug = $debug_orig;
connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync.result b/mysql-test/suite/galera/r/galera_sst_rsync.result
index ff85a7d6c0f..d41d0d34e75 100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync.result
+++ b/mysql-test/suite/galera/r/galera_sst_rsync.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
Performing State Transfer on a server that has been shut down cleanly and restarted
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
index 525156d88da..8ffe51c0cc3 100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
@@ -1,6 +1,12 @@
---- suite/galera/r/galera_sst_rsync2.result 2018-09-12 13:09:35.352229478 +0200
-+++ suite/galera/r/galera_sst_rsync2,debug.reject 2018-09-12 17:00:51.601974979 +0200
-@@ -286,3 +286,111 @@
+--- galera_sst_rsync2.result 2018-11-29 17:57:53.288606346 +0100
++++ galera_sst_rsync2,debug.reject 2018-11-29 18:00:01.172512000 +0100
+@@ -1,3 +1,5 @@
++connection node_2;
++connection node_1;
+ connection node_1;
+ connection node_2;
+ Performing State Transfer on a server that has been shut down cleanly and restarted
+@@ -286,3 +288,111 @@
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
index ff85a7d6c0f..d41d0d34e75 100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
Performing State Transfer on a server that has been shut down cleanly and restarted
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2-options.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2-options.result
deleted file mode 100644
index 990e0a29506..00000000000
--- a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2-options.result
+++ /dev/null
@@ -1,3 +0,0 @@
-SELECT 1;
-1
-1
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_data_dir.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_data_dir.result
deleted file mode 100644
index cec0f21ee22..00000000000
--- a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_data_dir.result
+++ /dev/null
@@ -1,262 +0,0 @@
-Performing State Transfer on a server that has been shut down cleanly and restarted
-CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-COMMIT;
-Shutting down server ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-Starting server ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-COMMIT;
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-COMMIT;
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-ROLLBACK;
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-COMMIT;
-SET AUTOCOMMIT=ON;
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-DROP TABLE t1;
-COMMIT;
-SET AUTOCOMMIT=ON;
-Performing State Transfer on a server that starts from a clean var directory
-This is accomplished by shutting down node #2 and removing its var directory before restarting it
-CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-COMMIT;
-Shutting down server ...
-Cleaning var directory ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-Starting server ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-COMMIT;
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-COMMIT;
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-ROLLBACK;
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-COMMIT;
-SET AUTOCOMMIT=ON;
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-DROP TABLE t1;
-COMMIT;
-SET AUTOCOMMIT=ON;
-Performing State Transfer on a server that has been killed and restarted
-CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-COMMIT;
-Killing server ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-INSERT INTO t1 VALUES ('node1_committed_during');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-Performing --wsrep-recover ...
-Starting server ...
-Using --wsrep-start-position when starting mysqld ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-INSERT INTO t1 VALUES ('node2_committed_after');
-COMMIT;
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 VALUES ('node1_to_be_committed_after');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-INSERT INTO t1 VALUES ('node1_committed_after');
-COMMIT;
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-ROLLBACK;
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-COMMIT;
-SET AUTOCOMMIT=ON;
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-DROP TABLE t1;
-COMMIT;
-SET AUTOCOMMIT=ON;
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_encrypt_with_key.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_encrypt_with_key.result
deleted file mode 100644
index 990e0a29506..00000000000
--- a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2_encrypt_with_key.result
+++ /dev/null
@@ -1,3 +0,0 @@
-SELECT 1;
-1
-1
diff --git a/mysql-test/suite/galera/r/galera_status_cluster.result b/mysql-test/suite/galera/r/galera_status_cluster.result
index ad92a51b775..9db0b88adc9 100644
--- a/mysql-test/suite/galera/r/galera_status_cluster.result
+++ b/mysql-test/suite/galera/r/galera_status_cluster.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
diff --git a/mysql-test/suite/galera/r/galera_status_local_index.result b/mysql-test/suite/galera/r/galera_status_local_index.result
index 8c36b60cc5f..c67498fff9f 100644
--- a/mysql-test/suite/galera/r/galera_status_local_index.result
+++ b/mysql-test/suite/galera/r/galera_status_local_index.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE wsrep_local_indexes (wsrep_local_index INTEGER);
INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index'));
diff --git a/mysql-test/suite/galera/r/galera_status_local_state.result b/mysql-test/suite/galera/r/galera_status_local_state.result
index 65713f1975c..3fe988ee6ac 100644
--- a/mysql-test/suite/galera/r/galera_status_local_state.result
+++ b/mysql-test/suite/galera/r/galera_status_local_state.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
VARIABLE_VALUE = 4
1
diff --git a/mysql-test/suite/galera/r/galera_suspend_slave.result b/mysql-test/suite/galera/r/galera_suspend_slave.result
index 07433399081..ce49b491778 100644
--- a/mysql-test/suite/galera/r/galera_suspend_slave.result
+++ b/mysql-test/suite/galera/r/galera_suspend_slave.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_sync_wait_show.result b/mysql-test/suite/galera/r/galera_sync_wait_show.result
index def771ff88d..793da3246ff 100644
--- a/mysql-test/suite/galera/r/galera_sync_wait_show.result
+++ b/mysql-test/suite/galera/r/galera_sync_wait_show.result
@@ -1,4 +1,6 @@
connection node_2;
+connection node_1;
+connection node_2;
SET SESSION wsrep_sync_wait = 8;
connection node_1;
CREATE DATABASE db1;
diff --git a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
index 8a86dfd11e2..a23b0523140 100644
--- a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
+++ b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_error.result b/mysql-test/suite/galera/r/galera_toi_ddl_error.result
index dafad153867..386dc28bed3 100644
--- a/mysql-test/suite/galera/r/galera_toi_ddl_error.result
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_error.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
@@ -19,3 +21,6 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP TABLE ten;
+CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query.");
+connection node_2;
+CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query.");
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
index 0dbc89978d4..0ecc4a4619f 100644
--- a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE parent (
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result
index a5db90aa965..a7966e36133 100644
--- a/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE parent (
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_locking.result b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result
index 68743c024a0..bbe181ce6f5 100644
--- a/mysql-test/suite/galera/r/galera_toi_ddl_locking.result
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result
@@ -1,32 +1,46 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
connection node_1;
-SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+SET DEBUG_SYNC= 'RESET';
+SET DEBUG_SYNC = 'alter_table_before_open_tables SIGNAL before_open_tables WAIT_FOR continue';
ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
connection node_1a;
-SET SESSION wsrep_sync_wait = 0;
+SET DEBUG_SYNC= 'now WAIT_FOR before_open_tables';
+SET wsrep_retry_autocommit=0;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) = 0 FROM t2;
COUNT(*) = 0
1
-INSERT INTO t1 VALUES (1);
-Got one of the listed errors
+INSERT INTO t1 VALUES (1);;
+connection node_1c;
+SET SESSION wsrep_sync_wait = 0;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
INSERT INTO t2 VALUES (1);
COMMIT;;
connection node_1b;
SET SESSION wsrep_sync_wait = 0;
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit';
-COUNT(*) = 1
-1
SELECT COUNT(*) = 0 FROM t2;
COUNT(*) = 0
1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit';
+COUNT(*) = 1
+1
SET DEBUG_SYNC= 'now SIGNAL continue';
connection node_1a;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1c;
connection node_1;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
@@ -34,6 +48,7 @@ COUNT(*) = 0
SELECT COUNT(*) = 1 FROM t2;
COUNT(*) = 1
1
+SET debug_sync='RESET';
connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
@@ -41,9 +56,5 @@ COUNT(*) = 0
SELECT COUNT(*) = 1 FROM t2;
COUNT(*) = 1
1
-connection node_1;
-SET DEBUG_SYNC= 'RESET';
-connection node_1b;
-SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result
index 3844fa97d82..5412cd3faee 100644
--- a/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
connection node_2;
ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result
index 722bb9d9e12..db702b1a59e 100644
--- a/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_toi_drop_database.result b/mysql-test/suite/galera/r/galera_toi_drop_database.result
index 6d88c8ea230..48056c70126 100644
--- a/mysql-test/suite/galera/r/galera_toi_drop_database.result
+++ b/mysql-test/suite/galera/r/galera_toi_drop_database.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE DATABASE database1;
USE database1;
@@ -14,9 +16,9 @@ INSERT INTO t2 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, te
connection node_2;
DROP DATABASE database1;;
connection node_1;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1a;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
connection node_1;
SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
diff --git a/mysql-test/suite/galera/r/galera_toi_ftwrl.result b/mysql-test/suite/galera/r/galera_toi_ftwrl.result
index 0f13e95b689..fdc8b294c1c 100644
--- a/mysql-test/suite/galera/r/galera_toi_ftwrl.result
+++ b/mysql-test/suite/galera/r/galera_toi_ftwrl.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
FLUSH TABLES WITH READ LOCK;
diff --git a/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
index f5cc14ed0f1..ee8c826fd18 100644
--- a/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
+++ b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
@@ -8,7 +10,7 @@ connection node_2a;
ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1;
INSERT INTO t1 VALUES (2, 2);
SELECT COUNT(*) = 2 FROM t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_lock_shared.result b/mysql-test/suite/galera/r/galera_toi_lock_shared.result
index 950c4d83c70..fe1c88075d5 100644
--- a/mysql-test/suite/galera/r/galera_toi_lock_shared.result
+++ b/mysql-test/suite/galera/r/galera_toi_lock_shared.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_toi_truncate.result b/mysql-test/suite/galera/r/galera_toi_truncate.result
index 73285d723c1..081a82e6e7d 100644
--- a/mysql-test/suite/galera/r/galera_toi_truncate.result
+++ b/mysql-test/suite/galera/r/galera_toi_truncate.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
@@ -11,7 +13,7 @@ connection node_1;
TRUNCATE TABLE t1;;
connection node_1;
connection node_2;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
diff --git a/mysql-test/suite/galera/r/galera_transaction_read_only.result b/mysql-test/suite/galera/r/galera_transaction_read_only.result
index b388f195fb1..55923f58b65 100644
--- a/mysql-test/suite/galera/r/galera_transaction_read_only.result
+++ b/mysql-test/suite/galera/r/galera_transaction_read_only.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_transaction_replay.result b/mysql-test/suite/galera/r/galera_transaction_replay.result
index 7fd837433d2..272086c4eba 100644
--- a/mysql-test/suite/galera/r/galera_transaction_replay.result
+++ b/mysql-test/suite/galera/r/galera_transaction_replay.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
INSERT INTO t1 VALUES (1, 'a');
INSERT INTO t1 VALUES (2, 'a');
@@ -9,19 +11,73 @@ SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
f1 f2
2 a
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
connection node_1;
-COMMIT;;
+COMMIT;
connection node_1a;
-SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+wsrep_local_replays
+1
connection node_2;
-UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
connection node_1;
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
COUNT(*) = 1
@@ -46,22 +102,34 @@ SELECT * FROM t1;
i j
1 0
3 0
+SET AUTOCOMMIT=ON;
PREPARE stmt1 FROM "UPDATE t1 SET j = 1 where i > 0";
connection node_1a;
-SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
-connection node_1;
-EXECUTE stmt1;;
-connection node_1a;
-SET SESSION wsrep_sync_wait = 0;
-SET SESSION wsrep_on = 0;
-SET SESSION wsrep_on = 1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
connection node_2;
INSERT INTO t1 VALUES(2,2);
connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+EXECUTE stmt1;
connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
connection node_1;
+SET SESSION wsrep_sync_wait=7;
SELECT * FROM t1;
i j
1 1
@@ -74,5 +142,7 @@ i j
2 2
3 1
connection node_1;
+wsrep_local_replays
+1
DEALLOCATE PREPARE stmt1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_truncate.result b/mysql-test/suite/galera/r/galera_truncate.result
index 4f3d72dbca7..c649d9bbaf9 100644
--- a/mysql-test/suite/galera/r/galera_truncate.result
+++ b/mysql-test/suite/galera/r/galera_truncate.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_truncate_temporary.result b/mysql-test/suite/galera/r/galera_truncate_temporary.result
index 183ebd9d24a..81373bda739 100644
--- a/mysql-test/suite/galera/r/galera_truncate_temporary.result
+++ b/mysql-test/suite/galera/r/galera_truncate_temporary.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TEMPORARY TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
INSERT INTO t1 VALUES (1);
TRUNCATE TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_unicode_identifiers.result b/mysql-test/suite/galera/r/galera_unicode_identifiers.result
index 77848bc751f..5db1be8c910 100644
--- a/mysql-test/suite/galera/r/galera_unicode_identifiers.result
+++ b/mysql-test/suite/galera/r/galera_unicode_identifiers.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SET GLOBAL wsrep_sync_wait = 15;
connection node_2;
SET GLOBAL wsrep_sync_wait = 15;
diff --git a/mysql-test/suite/galera/r/galera_unicode_pk.result b/mysql-test/suite/galera/r/galera_unicode_pk.result
index 0e8965a76e3..bb36fd4f369 100644
--- a/mysql-test/suite/galera/r/galera_unicode_pk.result
+++ b/mysql-test/suite/galera/r/galera_unicode_pk.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (
f1 VARCHAR(255) PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -18,7 +20,7 @@ connection node_1;
COMMIT;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT f1 = 'текÑÑ‚2' FROM t1;
f1 = 'текÑÑ‚2'
1
@@ -35,6 +37,6 @@ connection node_2;
COMMIT;
connection node_1;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_update_limit.result b/mysql-test/suite/galera/r/galera_update_limit.result
index 20a94e6f504..30c89a38dff 100644
--- a/mysql-test/suite/galera/r/galera_update_limit.result
+++ b/mysql-test/suite/galera/r/galera_update_limit.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
diff --git a/mysql-test/suite/galera/r/galera_v1_row_events.result b/mysql-test/suite/galera/r/galera_v1_row_events.result
index b0ea2293119..80fe2fb6d8d 100644
--- a/mysql-test/suite/galera/r/galera_v1_row_events.result
+++ b/mysql-test/suite/galera/r/galera_v1_row_events.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_var_OSU_method.result b/mysql-test/suite/galera/r/galera_var_OSU_method.result
index 18e8bd2271a..2b0a713e86b 100644
--- a/mysql-test/suite/galera/r/galera_var_OSU_method.result
+++ b/mysql-test/suite/galera/r/galera_var_OSU_method.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
connection node_1;
SET SESSION wsrep_OSU_method = "RSU";
diff --git a/mysql-test/suite/galera/r/galera_var_OSU_method2.result b/mysql-test/suite/galera/r/galera_var_OSU_method2.result
index 0e3751645a8..ca4f617d903 100644
--- a/mysql-test/suite/galera/r/galera_var_OSU_method2.result
+++ b/mysql-test/suite/galera/r/galera_var_OSU_method2.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
connection node_1;
SET SESSION wsrep_OSU_method = "TOI";
diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
index ba117b4c2d5..86c30fa4b23 100644
--- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
+++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET GLOBAL wsrep_auto_increment_control = OFF;
SET GLOBAL auto_increment_increment = 1;
@@ -59,7 +61,7 @@ connection node_1a;
COMMIT;
connection node_2a;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1a;
SELECT * FROM t1;
f1 node
diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
index b71cf4c831d..48c649b66a8 100644
--- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
+++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
diff --git a/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
index ca3844bf6bf..f5472aa931f 100644
--- a/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
+++ b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SET GLOBAL wsrep_certify_nonPK = OFF;
connection node_2;
SET GLOBAL wsrep_certify_nonPK = OFF;
diff --git a/mysql-test/suite/galera/r/galera_var_cluster_address.result b/mysql-test/suite/galera/r/galera_var_cluster_address.result
index 378d8ca84f5..8c1070e43ce 100644
--- a/mysql-test/suite/galera/r/galera_var_cluster_address.result
+++ b/mysql-test/suite/galera/r/galera_var_cluster_address.result
@@ -1,7 +1,11 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_2;
SET GLOBAL wsrep_cluster_address = 'foo://';
+SHOW STATUS;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET SESSION wsrep_sync_wait=0;
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
COUNT(*) > 0
@@ -11,7 +15,7 @@ Variable_name Value
wsrep_ready OFF
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
-wsrep_cluster_status non-Primary
+wsrep_cluster_status Disconnected
SHOW STATUS LIKE 'wsrep_local_state';
Variable_name Value
wsrep_local_state 0
@@ -39,7 +43,7 @@ CALL mtr.add_suppression("Failed to initialize backend using 'foo");
CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo");
CALL mtr.add_suppression("gcs connect failed: Socket type not supported");
CALL mtr.add_suppression("wsrep::connect\\(\\) failed: 7");
-CALL mtr.add_suppression("gcs_caused\\(\\) returned -103 \\(Software caused connection abort\\)");
+CALL mtr.add_suppression("gcs_caused\\(\\) returned -[0-9]+ \\(Software caused connection abort\\)");
CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed to reach primary view: 110");
CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
CALL mtr.add_suppression("gcs connect failed: Connection timed out");
diff --git a/mysql-test/suite/galera/r/galera_var_desync_on.result b/mysql-test/suite/galera/r/galera_var_desync_on.result
index 26798e51926..6a2e501eee2 100644
--- a/mysql-test/suite/galera/r/galera_var_desync_on.result
+++ b/mysql-test/suite/galera/r/galera_var_desync_on.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_var_dirty_reads.result b/mysql-test/suite/galera/r/galera_var_dirty_reads.result
index 049aa5be3cc..33536d95186 100644
--- a/mysql-test/suite/galera/r/galera_var_dirty_reads.result
+++ b/mysql-test/suite/galera/r/galera_var_dirty_reads.result
@@ -1,6 +1,6 @@
-connection node_1;
connection node_2;
connection node_1;
+connection node_1;
connection node_2;
connection node_2;
CREATE TABLE t1(i INT) ENGINE=INNODB;
@@ -16,7 +16,7 @@ Variable_name Value
wsrep_ready OFF
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
-wsrep_cluster_status non-Primary
+wsrep_cluster_status Disconnected
SELECT * FROM t1;
ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1 FROM t1;
@@ -52,4 +52,3 @@ i
DROP TABLE t1;
disconnect node_2;
disconnect node_1;
-# End of test
diff --git a/mysql-test/suite/galera/r/galera_var_fkchecks.result b/mysql-test/suite/galera/r/galera_var_fkchecks.result
index 8b1b913a584..42f8085ee1a 100644
--- a/mysql-test/suite/galera/r/galera_var_fkchecks.result
+++ b/mysql-test/suite/galera/r/galera_var_fkchecks.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE parent (
id INT PRIMARY KEY,
KEY (id)
diff --git a/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result b/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result
index 1a8733e2e1a..d2faf5ff463 100644
--- a/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result
+++ b/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
# On node_1
connection node_1;
list of GTID variables :
diff --git a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result
new file mode 100644
index 00000000000..48c845a4c2b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result
@@ -0,0 +1,186 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 1;
+connection node_1;
+SET GLOBAL wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = ON;
+DROP TABLE t1;
+SET GLOBAL wsrep_on = OFF;
+CREATE SCHEMA s1;
+SET GLOBAL wsrep_on = ON;
+DROP SCHEMA s1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+CREATE INDEX idx1 ON t1 (f1);
+SET GLOBAL wsrep_on = ON;
+DROP INDEX idx1 ON t1;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+CREATE INDEX idx1 ON t1 (f1);
+SET GLOBAL wsrep_on = ON;
+ALTER TABLE t1 DROP INDEX idx1;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET GLOBAL wsrep_on = ON;
+ALTER TABLE t1 DROP COLUMN f2;
+DROP TABLE t1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+DELETE FROM t1 WHERE f1 = 1;
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (2);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+START TRANSACTION;
+INSERT INTO t1 VALUES (3);
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+connection node_1;
+DELETE FROM t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 3;
+DELETE FROM t1 WHERE f1 = 4;
+DELETE FROM t1 WHERE f1 = 5;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM t2 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+connection node_1;
+DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1,t2;
+connection node_1;
+CREATE TABLE parent (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+INSERT INTO parent VALUES (1),(2),(3);
+CREATE TABLE child (id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE) ENGINE=INNODB;
+INSERT INTO child VALUES (1,1),(2,2),(3,3);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM child WHERE parent_id = 2;
+SET SESSION wsrep_on = ON;
+connection node_1;
+DELETE FROM parent;
+SELECT COUNT(*) = 0 FROM parent;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM child;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 0 FROM parent;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM child;
+COUNT(*) = 0
+1
+DROP TABLE child, parent;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 4;
+connection node_2;
+SET GLOBAL wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = ON;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
+DROP TABLE t1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+CALL mtr.add_suppression("Can't find record in 't.*'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t1'' on query. Default database: 'test'. Query: 'DROP TABLE t1', Error_code: 1051");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't drop database 's1'; database doesn't exist' on query. Default database: 'test'. Query: 'DROP SCHEMA s1', Error_code: 1008");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query. Default database: 'test'. Query: 'DROP INDEX idx1 ON t1', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query.");
diff --git a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
index 4db4e539c50..f5ec473fea4 100644
--- a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
+++ b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1a;
SET SESSION wsrep_sync_wait = 0;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_var_load_data_splitting.result b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result
index 3e451abbed1..7c5fd44356e 100644
--- a/mysql-test/suite/galera/r/galera_var_load_data_splitting.result
+++ b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
SET GLOBAL wsrep_load_data_splitting = TRUE;
diff --git a/mysql-test/suite/galera/r/galera_var_log_bin.result b/mysql-test/suite/galera/r/galera_var_log_bin.result
index b0ea2293119..80fe2fb6d8d 100644
--- a/mysql-test/suite/galera/r/galera_var_log_bin.result
+++ b/mysql-test/suite/galera/r/galera_var_log_bin.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_rows.result b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result
index 6bf67a3fb60..16e868f0485 100644
--- a/mysql-test/suite/galera/r/galera_var_max_ws_rows.result
+++ b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_size.result b/mysql-test/suite/galera/r/galera_var_max_ws_size.result
index 53bac04fa86..89c9698eed4 100644
--- a/mysql-test/suite/galera/r/galera_var_max_ws_size.result
+++ b/mysql-test/suite/galera/r/galera_var_max_ws_size.result
@@ -1,8 +1,10 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB;
SET GLOBAL wsrep_max_ws_size = 1024;
INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024));
-ERROR HY000: Got error 90 "Message too long" during COMMIT
+ERROR HY000: Got error 5 "Input/output error" during COMMIT
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
diff --git a/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result b/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result
index 202633a020e..d7a38d24722 100644
--- a/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result
+++ b/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
SET GLOBAL wsrep_mysql_replication_bundle = 2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_var_node_address.result b/mysql-test/suite/galera/r/galera_var_node_address.result
index 7696d1e3f4f..cf45861c8ad 100644
--- a/mysql-test/suite/galera/r/galera_var_node_address.result
+++ b/mysql-test/suite/galera/r/galera_var_node_address.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
call mtr.add_suppression("WSREP: Stray state UUID msg: .* current group state WAIT_STATE_UUID .*");
call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .* is not in state transfer (.*). Message ignored.");
call mtr.add_suppression("WSREP: Sending JOIN failed: -[0-9]+ (Transport endpoint is not connected). Will retry in new primary component.");
diff --git a/mysql-test/suite/galera/r/galera_var_reject_queries.result b/mysql-test/suite/galera/r/galera_var_reject_queries.result
index 98380238fcb..b95e5773830 100644
--- a/mysql-test/suite/galera/r/galera_var_reject_queries.result
+++ b/mysql-test/suite/galera/r/galera_var_reject_queries.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER);
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
@@ -7,7 +9,6 @@ SET GLOBAL wsrep_reject_queries = ALL;
SELECT * FROM t1;
ERROR 08S01: WSREP has not yet prepared node for application use
SET GLOBAL wsrep_reject_queries = ALL_KILL;
-ERROR HY000: Lost connection to MySQL server during query
connection node_1a;
SELECT * FROM t1;
Got one of the listed errors
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result
index 382466b1387..8968f89d11b 100644
--- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result
+++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SET GLOBAL wsrep_replicate_myisam = FALSE;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
index 87f8862df7e..716af033e7a 100644
--- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
+++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_1;
SET GLOBAL wsrep_replicate_myisam = TRUE;
diff --git a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
index c0bf6035184..b8943464cb7 100644
--- a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
+++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
@@ -1,15 +1,17 @@
+connection node_2;
+connection node_1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 0;
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue';
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
INSERT INTO t1 (f1) VALUES (2);
connection node_1a;
-SET DEBUG_SYNC = 'now WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
connection node_1;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
@@ -18,10 +20,10 @@ DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1;
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue';
-INSERT INTO t1 (f1) VALUES (2);
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
+INSERT INTO t1 (f1) VALUES (3);
connection node_1a;
-SET DEBUG_SYNC = 'now WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
connection node_1;
@@ -34,10 +36,10 @@ connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue EXECUTE 2';
-INSERT INTO t1 VALUES (2);;
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 2';
+INSERT INTO t1 VALUES (4);;
connection node_1a;
-SET DEBUG_SYNC = 'now WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
connection node_1a;
@@ -45,7 +47,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
-SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
connection node_1a;
@@ -53,7 +55,7 @@ SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
connection node_1;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;
@@ -61,8 +63,8 @@ connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 64;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue EXECUTE 64';
-INSERT INTO t1 VALUES (2);
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
+INSERT INTO t1 VALUES (5);
connection node_1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result
index c28cc091ae9..168b45154b8 100644
--- a/mysql-test/suite/galera/r/galera_var_slave_threads.result
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@ -1,3 +1,7 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
@@ -13,6 +17,9 @@ SELECT @@wsrep_slave_threads = 1;
@@wsrep_slave_threads = 1
1
SET GLOBAL wsrep_slave_threads = 1;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND COMMAND != 'Daemon';
+COUNT(*)
+3
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
COUNT(*)
1
@@ -20,8 +27,11 @@ SET GLOBAL wsrep_slave_threads = 64;
connection node_1;
INSERT INTO t1 VALUES (1);
connection node_2;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*)
1
SET GLOBAL wsrep_slave_threads = 1;
connection node_1;
@@ -32,26 +42,42 @@ COUNT(*)
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
COUNT(*)
1
+SET GLOBAL wsrep_slave_threads = 5;
SET GLOBAL wsrep_slave_threads = 1;
-DROP TABLE t1;
-DROP TABLE t2;
-#
-# lp:1372840 - Changing wsrep_slave_threads causes future connections to hang
-#
+connection node_2;
+Shutting down server ...
+connection node_1;
+show status like 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 1
+SET GLOBAL wsrep_slave_threads = 6;
+SET GLOBAL wsrep_slave_threads = 1;
+SET GLOBAL wsrep_cluster_address='';
+SET GLOBAL wsrep_cluster_address='gcomm://';
+SET GLOBAL wsrep_slave_threads = 10;
+connection node_2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND COMMAND != 'Daemon';
+COUNT(*)
+3
connection node_1;
-CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB;
+SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
-SET GLOBAL wsrep_slave_threads = 4;
SET GLOBAL wsrep_slave_threads = 1;
connection node_1;
-INSERT INTO t1 VALUES (DEFAULT);
-INSERT INTO t1 VALUES (DEFAULT);
-INSERT INTO t1 VALUES (DEFAULT);
-DROP TABLE t1;
connection node_2;
-SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
-NAME
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
-COUNT(*) = 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+192
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+192
+DROP TABLE t1;
+DROP TABLE t2;
# End of tests
diff --git a/mysql-test/suite/galera/r/galera_var_sst_auth.result b/mysql-test/suite/galera/r/galera_var_sst_auth.result
index 1db83197870..6a5683e2633 100644
--- a/mysql-test/suite/galera/r/galera_var_sst_auth.result
+++ b/mysql-test/suite/galera/r/galera_var_sst_auth.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
#
diff --git a/mysql-test/suite/galera/r/galera_var_sync_wait.result b/mysql-test/suite/galera/r/galera_var_sync_wait.result
index 3dfe902767c..80fbd3f3e05 100644
--- a/mysql-test/suite/galera/r/galera_var_sync_wait.result
+++ b/mysql-test/suite/galera/r/galera_var_sync_wait.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-10161: wsrep_sync_wait not enabled when set to 1 in config file
#
diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result
index 36340f505ff..5323bc9bf60 100644
--- a/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result
+++ b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET SESSION wsrep_on = FALSE;
diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result
index 41b915fa5bf..bc4113ffb1c 100644
--- a/mysql-test/suite/galera/r/galera_wan.result
+++ b/mysql-test/suite/galera/r/galera_wan.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CALL mtr.add_suppression("WSREP: Stray state UUID msg:.*");
CALL mtr.add_suppression("WSREP: Sending JOIN failed:.*");
CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
diff --git a/mysql-test/suite/galera/r/galera_wan_restart_ist.result b/mysql-test/suite/galera/r/galera_wan_restart_ist.result
index 8a2a7d0818e..7b87d534d92 100644
--- a/mysql-test/suite/galera/r/galera_wan_restart_ist.result
+++ b/mysql-test/suite/galera/r/galera_wan_restart_ist.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result
index 71786cdd023..1296744a9c1 100644
--- a/mysql-test/suite/galera/r/galera_wan_restart_sst.result
+++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
diff --git a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
index 99c680c7b12..e01825fd944 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
diff --git a/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
index fa49d8c57c2..59883f1ca7e 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (
f1 VARCHAR(255) PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -20,6 +22,6 @@ connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
connection node_2;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
include/assert_grep.inc [cluster conflict due to high priority abort for threads]
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
index ca388496794..8edf1a02e9d 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result
index f19dc40205b..0f7cd134156 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\.segment'");
call mtr.add_suppression("WSREP\: Set options returned 7");
SET GLOBAL wsrep_provider_options="gmcasts.segment=1";
diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result b/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result
index d56d9340474..7a645407004 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_zero_length_column.result b/mysql-test/suite/galera/r/galera_zero_length_column.result
index 572d94d6756..fa29264704f 100644
--- a/mysql-test/suite/galera/r/galera_zero_length_column.result
+++ b/mysql-test/suite/galera/r/galera_zero_length_column.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY , f2 VARCHAR(0)) ENGINE=InnoDB;
CREATE TABLE t2 (f1 VARCHAR(0)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera/r/grant.result b/mysql-test/suite/galera/r/grant.result
index a2ca72ee8ec..56f56d3b023 100644
--- a/mysql-test/suite/galera/r/grant.result
+++ b/mysql-test/suite/galera/r/grant.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV#6266: Changing password fails on galera cluster
#
@@ -13,7 +15,7 @@ SET PASSWORD FOR 'user_6266'@'localhost' = PASSWORD('newpass');
# On node_2
connection node_2;
SELECT user FROM mysql.user WHERE user='user_6266';
-user
+User
user_6266
DROP USER 'user_6266'@'localhost';
disconnect node_2;
diff --git a/mysql-test/suite/galera/r/lp1276424.result b/mysql-test/suite/galera/r/lp1276424.result
index 363758e0d66..be27ee5374f 100644
--- a/mysql-test/suite/galera/r/lp1276424.result
+++ b/mysql-test/suite/galera/r/lp1276424.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INT DEFAULT NULL, UNIQUE KEY i1 (f1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
diff --git a/mysql-test/suite/galera/r/lp1347768.result b/mysql-test/suite/galera/r/lp1347768.result
index 7beb167d538..49c8894c081 100644
--- a/mysql-test/suite/galera/r/lp1347768.result
+++ b/mysql-test/suite/galera/r/lp1347768.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE `r8kmb_redirect_links` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`old_url` varchar(255) DEFAULT NULL,
diff --git a/mysql-test/suite/galera/r/lp1376747-2.result b/mysql-test/suite/galera/r/lp1376747-2.result
index b85e130f4f4..5e5b5be6c86 100644
--- a/mysql-test/suite/galera/r/lp1376747-2.result
+++ b/mysql-test/suite/galera/r/lp1376747-2.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/lp1376747-3.result b/mysql-test/suite/galera/r/lp1376747-3.result
index a2c55b5f1f6..62893b85bcf 100644
--- a/mysql-test/suite/galera/r/lp1376747-3.result
+++ b/mysql-test/suite/galera/r/lp1376747-3.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/lp1376747-4.result b/mysql-test/suite/galera/r/lp1376747-4.result
index f1d32aa8f69..d6884cc3746 100644
--- a/mysql-test/suite/galera/r/lp1376747-4.result
+++ b/mysql-test/suite/galera/r/lp1376747-4.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/galera/r/lp1376747.result b/mysql-test/suite/galera/r/lp1376747.result
index 16d4fa3fc52..1b9dd545409 100644
--- a/mysql-test/suite/galera/r/lp1376747.result
+++ b/mysql-test/suite/galera/r/lp1376747.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera/r/lp1438990.result b/mysql-test/suite/galera/r/lp1438990.result
index d48d2435faa..a324121d7da 100644
--- a/mysql-test/suite/galera/r/lp1438990.result
+++ b/mysql-test/suite/galera/r/lp1438990.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
diff --git a/mysql-test/suite/galera/r/lp959512.result b/mysql-test/suite/galera/r/lp959512.result
index 55adfa360b0..589030002db 100644
--- a/mysql-test/suite/galera/r/lp959512.result
+++ b/mysql-test/suite/galera/r/lp959512.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
DROP TABLE IF EXISTS variable;
Warnings:
Note 1051 Unknown table 'test.variable'
diff --git a/mysql-test/suite/galera/r/mdev_10518.result b/mysql-test/suite/galera/r/mdev_10518.result
index 4ccd5fd1d23..252aa244f77 100644
--- a/mysql-test/suite/galera/r/mdev_10518.result
+++ b/mysql-test/suite/galera/r/mdev_10518.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
# On node_1
connection node_1;
list of GTID variables :
diff --git a/mysql-test/suite/galera/r/mdev_9290.result b/mysql-test/suite/galera/r/mdev_9290.result
index 276ab9e8ecb..d8fc35b02f4 100644
--- a/mysql-test/suite/galera/r/mdev_9290.result
+++ b/mysql-test/suite/galera/r/mdev_9290.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-9290 : InnoDB: Assertion failure in file trx0sys.cc line 353
# InnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#110.result b/mysql-test/suite/galera/r/mysql-wsrep#110.result
index 6d4031d71cd..344185f4f4e 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#110.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#110.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#198.result b/mysql-test/suite/galera/r/mysql-wsrep#198.result
index 33f36d407db..5b569ffae27 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#198.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#198.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#201.result b/mysql-test/suite/galera/r/mysql-wsrep#201.result
index fe5725cab27..e55c38ea7cc 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#201.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#201.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#216.result b/mysql-test/suite/galera/r/mysql-wsrep#216.result
new file mode 100644
index 00000000000..b07589d0c04
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#216.result
@@ -0,0 +1,11 @@
+SET GLOBAL wsrep_debug = ON;
+CREATE USER u1 IDENTIFIED BY 'plaintext_password';
+CREATE USER u1 IDENTIFIED BY 'plaintext_password';
+ERROR HY000: Operation CREATE USER failed for 'u1'@'%'
+0
+0
+2
+1
+DROP USER u1;
+CALL mtr.add_suppression('Operation CREATE USER failed');
+ \ No newline at end of file
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#237.result b/mysql-test/suite/galera/r/mysql-wsrep#237.result
index 19503dd5781..bc348613d25 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#237.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#237.result
@@ -1,6 +1,8 @@
+connection node_2;
+connection node_1;
CREATE TABLE t (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
connection node_1;
-SET DEBUG_SYNC = 'wsrep_before_replication WAIT_FOR continue';
+SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
INSERT INTO t values (1);;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#247.result b/mysql-test/suite/galera/r/mysql-wsrep#247.result
index e59c6d1a299..704f0ba923c 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#247.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#247.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
SET GLOBAL wsrep_desync=1;
SET wsrep_OSU_method=RSU;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#31.result b/mysql-test/suite/galera/r/mysql-wsrep#31.result
index 1092f4ddb0c..d1d2861ec3a 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#31.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#31.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result
index 6a5251204b9..5589faad8b1 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#33.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
Setting SST method to mysqldump ...
@@ -56,6 +58,9 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
connection node_2;
Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_after');
@@ -114,5 +119,6 @@ CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
connection node_2;
Restarting server ...
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#332.result b/mysql-test/suite/galera/r/mysql-wsrep#332.result
index 8667f5e9c41..565979a93ae 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#332.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#332.result
@@ -1,26 +1,38 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER) ENGINE=INNODB;
INSERT INTO p VALUES (1, 0);
INSERT INTO p VALUES (2, 0);
INSERT INTO c VALUES (1, 1);
INSERT INTO c VALUES (2, 2);
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p SET f1 = f1 + 100;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
ALTER TABLE c ADD FOREIGN KEY (p_id) REFERENCES p(f1);
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
SELECT * FROM p;
f1 f2
1 0
@@ -31,6 +43,7 @@ f1 p_id
2 2
DROP TABLE c;
DROP TABLE p;
+connection node_1;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB;
@@ -38,23 +51,31 @@ INSERT INTO p1 VALUES (1, 0), (2, 0);
INSERT INTO p2 VALUES (1, 0), (2, 0);
INSERT INTO c VALUES (1, 1, 1);
INSERT INTO c VALUES (2, 2, 2);
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p1 SET f1 = f1 + 100;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1);
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
SELECT * FROM p1;
f1 f2
1 0
@@ -70,6 +91,7 @@ f1 p_id1 p_id2
DROP TABLE c;
DROP TABLE p1;
DROP TABLE p2;
+connection node_1;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB;
@@ -77,23 +99,31 @@ INSERT INTO p1 VALUES (1, 0), (2, 0);
INSERT INTO p2 VALUES (1, 0), (2, 0);
INSERT INTO c VALUES (1, 1, 1);
INSERT INTO c VALUES (2, 2, 2);
+connection node_1;
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE p2 SET f1 = f1 + 100;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1);
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
-SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
COMMIT;
+connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
-SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
SELECT * FROM p1;
f1 f2
1 0
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#90.result b/mysql-test/suite/galera/r/mysql-wsrep#90.result
index 0b8f55e6219..b0fa06ffaf8 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#90.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#90.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
connection node_1;
SET GLOBAL wsrep_OSU_method = "RSU";
diff --git a/mysql-test/suite/galera/r/partition.result b/mysql-test/suite/galera/r/partition.result
index 3835de514aa..e34028ab04f 100644
--- a/mysql-test/suite/galera/r/partition.result
+++ b/mysql-test/suite/galera/r/partition.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV#4953 Galera: DELETE from a partitioned table is not replicated
#
@@ -119,11 +121,11 @@ SET GLOBAL wsrep_load_data_splitting = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
connection node_2;
-SELECT COUNT(*) = 20002 FROM t1;
-COUNT(*) = 20002
-1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20002
wsrep_last_committed_diff
-1
+AS_EXPECTED_3_or_5
DROP TABLE t1;
# Case 2: wsrep_load_data_splitting = ON & LOAD DATA with 101 entries.
connection node_1;
@@ -131,9 +133,9 @@ SET GLOBAL wsrep_load_data_splitting = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
connection node_2;
-SELECT COUNT(*) = 101 FROM t1;
-COUNT(*) = 101
-1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+101
wsrep_last_committed_diff
1
DROP TABLE t1;
@@ -144,11 +146,11 @@ SET GLOBAL wsrep_load_data_splitting = OFF;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
connection node_2;
-SELECT COUNT(*) = 20002 FROM t1;
-COUNT(*) = 20002
-1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20002
wsrep_last_committed_diff
-1
+AS_EXPECTED_1_or_2
DROP TABLE t1;
connection node_1;
SET GLOBAL wsrep_load_data_splitting = 1;;
diff --git a/mysql-test/suite/galera/r/pxc-421.result b/mysql-test/suite/galera/r/pxc-421.result
index a317b3e40e1..058af15c098 100644
--- a/mysql-test/suite/galera/r/pxc-421.result
+++ b/mysql-test/suite/galera/r/pxc-421.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/query_cache.result b/mysql-test/suite/galera/r/query_cache.result
index 8592a68141c..5dabd38a982 100644
--- a/mysql-test/suite/galera/r/query_cache.result
+++ b/mysql-test/suite/galera/r/query_cache.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
# Execute FLUSH/RESET commands.
# On node-1
diff --git a/mysql-test/suite/galera/r/rename.result b/mysql-test/suite/galera/r/rename.result
index a7ec431657b..3ad715fa38c 100644
--- a/mysql-test/suite/galera/r/rename.result
+++ b/mysql-test/suite/galera/r/rename.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-8598 : Failed MySQL DDL commands and Galera replication
#
diff --git a/mysql-test/suite/galera/r/rpl_row_annotate.result b/mysql-test/suite/galera/r/rpl_row_annotate.result
index 23de06f015b..61fa2bc286c 100644
--- a/mysql-test/suite/galera/r/rpl_row_annotate.result
+++ b/mysql-test/suite/galera/r/rpl_row_annotate.result
@@ -1,9 +1,15 @@
+connection node_2;
+connection node_1;
# On node_2
connection node_2;
+SET GLOBAL wsrep_on=OFF;
RESET MASTER;
+SET GLOBAL wsrep_on=ON;
# On node_1
connection node_1;
+SET GLOBAL wsrep_on=OFF;
RESET MASTER;
+SET GLOBAL wsrep_on=ON;
CREATE TABLE t1(i INT)ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
DELETE FROM t1 WHERE i = 1;
@@ -68,6 +74,4 @@ mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
mysqld-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
DROP TABLE t1;
-disconnect node_2;
-disconnect node_1;
# End of test
diff --git a/mysql-test/suite/galera/r/sql_log_bin.result b/mysql-test/suite/galera/r/sql_log_bin.result
index c175a0a0e7a..6efd70ca8b8 100644
--- a/mysql-test/suite/galera/r/sql_log_bin.result
+++ b/mysql-test/suite/galera/r/sql_log_bin.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
# On node_1
connection node_1;
diff --git a/mysql-test/suite/galera/r/unique_key.result b/mysql-test/suite/galera/r/unique_key.result
index 9f1fc858389..bb7e22014d9 100644
--- a/mysql-test/suite/galera/r/unique_key.result
+++ b/mysql-test/suite/galera/r/unique_key.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV#5552 Deadlock when inserting NULL column value in column with
# UNIQUE index
diff --git a/mysql-test/suite/galera/r/versioning_trx_id.result b/mysql-test/suite/galera/r/versioning_trx_id.result
index f15916e51a5..232cca202c0 100644
--- a/mysql-test/suite/galera/r/versioning_trx_id.result
+++ b/mysql-test/suite/galera/r/versioning_trx_id.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_1;
create table t1 (a int, s bigint unsigned as row start, e bigint unsigned as row end, period for system_time(s,e)) engine=InnoDB with system versioning;
diff --git a/mysql-test/suite/galera/r/view.result b/mysql-test/suite/galera/r/view.result
index f8da811f9cc..45d5b422f3f 100644
--- a/mysql-test/suite/galera/r/view.result
+++ b/mysql-test/suite/galera/r/view.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
#
# MDEV-7222: Cluster Node Crash at CREATE DEFINER statement
#
diff --git a/mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result b/mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result
new file mode 100644
index 00000000000..4139ecd6472
--- /dev/null
+++ b/mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+SELECT variable_value FROM information_schema.session_variables
+WHERE variable_name = 'wsrep_trx_fragment_size';
+variable_value
+0
+SET SESSION wsrep_trx_fragment_size = 0;
+SET SESSION wsrep_trx_fragment_size = 123;
+SELECT variable_value FROM information_schema.global_variables
+WHERE variable_name = 'wsrep_trx_fragment_size';
+variable_value
+0
+SET GLOBAL wsrep_trx_fragment_size = 0;
+SET GLOBAL wsrep_trx_fragment_size = 123;
+SET GLOBAL wsrep_trx_fragment_size = default;
diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm
index 233aa020a94..a9fd1568f9c 100644
--- a/mysql-test/suite/galera/suite.pm
+++ b/mysql-test/suite/galera/suite.pm
@@ -9,9 +9,9 @@ return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib64/galera-3/libgalera_smm.so",
+ "/usr/lib64/galera-4/libgalera_smm.so",
"/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-3/libgalera_smm.so",
+ "/usr/lib/galera-4/libgalera_smm.so",
"/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
@@ -81,6 +81,8 @@ push @::global_suppressions,
qr|WSREP: .*core_handle_uuid_msg.*|,
qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on),
qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|,
+ qr|Query apply failed:*|,
+ qr(WSREP: Ignoring error*),
qr(WSREP: Failed to remove page file .*),
qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*),
);
@@ -98,10 +100,8 @@ if (which(socat)) {
sub skip_combinations {
my %skip = ();
- $skip{'include/have_xtrabackup.inc'} = 'Need innobackupex'
- unless which(innobackupex);
- $skip{'include/have_xtrabackup.inc'} = 'Need socat or nc'
- unless $ENV{MTR_GALERA_TFMT};
+ $skip{'include/have_filekeymanagement.inc'} = 'needs file_key_management plugin'
+ unless $ENV{FILE_KEY_MANAGEMENT_SO};
$skip{'include/have_mariabackup.inc'} = 'Need mariabackup'
unless which(mariabackup);
$skip{'include/have_mariabackup.inc'} = 'Need ss'
diff --git a/mysql-test/suite/galera/t/GAL-419.test b/mysql-test/suite/galera/t/GAL-419.test
index e50b948bf35..07abcbcc47b 100644
--- a/mysql-test/suite/galera/t/GAL-419.test
+++ b/mysql-test/suite/galera/t/GAL-419.test
@@ -5,11 +5,11 @@
--source include/galera_cluster.inc
--source include/big_test.inc
---connection node_2
+--connection node_1
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
---connection node_1
+--connection node_2
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
diff --git a/mysql-test/suite/galera/t/GCF-1081.test b/mysql-test/suite/galera/t/GCF-1081.test
new file mode 100644
index 00000000000..8296c55f1b6
--- /dev/null
+++ b/mysql-test/suite/galera/t/GCF-1081.test
@@ -0,0 +1,72 @@
+#
+# GCF-1081 - Assertion `!thd->sp_runtime_ctx`
+#
+# Test replaying of stored procedures
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+--connection node_1
+
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 0), (3, 0);
+
+DELIMITER |;
+CREATE PROCEDURE proc_update ()
+BEGIN
+ UPDATE t1 SET f2 = 1 where f1 > 0;
+END|
+DELIMITER ;|
+
+# Block the SP
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+--send CALL proc_update ();
+
+# Wait until SP is blocked
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+--source include/galera_wait_sync_point.inc
+
+# Issue a conflicting insert on node #2
+--connection node_1a
+SET GLOBAL DEBUG = 'd,sync.wsrep_before_BF_victim_unlock';
+
+--connection node_2
+--send INSERT INTO t1 VALUES (2, 2);
+
+# Wait until it BF aborts the SP
+--connection node_1a
+SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached';
+SET GLOBAL DEBUG = '';
+
+# Unblock the SP
+--connection node_1a
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+
+--connection node_2
+--reap
+SELECT * FROM t1;
+
+# SP succeeds
+--connection node_1
+--reap
+SELECT * FROM t1;
+
+# wsrep_local_replays has increased by 1
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old AS wsrep_local_replays;
+--enable_query_log
+
+DROP PROCEDURE proc_update;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/GCF-939.test b/mysql-test/suite/galera/t/GCF-939.test
new file mode 100644
index 00000000000..637d656996e
--- /dev/null
+++ b/mysql-test/suite/galera/t/GCF-939.test
@@ -0,0 +1,31 @@
+#
+# GCF-939 Avoid creation of GRA log files when applier is successfull
+#
+
+--source include/galera_cluster.inc
+
+--exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log
+
+--connection node_1
+--error ER_BAD_TABLE_ERROR
+DROP TABLE t1;
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+# Expect only one GRA_*.log file
+# TODO replace_regex is somehow broken, it will filter out
+# result totally if replacement string is already in result
+# fixed this temporarily by calling list_files twice
+# to get GRA_.log two times, this works for some reason
+#
+--replace_regex /GRA_.+\.log/GRA_.log/
+--list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log
+--replace_regex /GRA_.+\.log/GRA_.log/
+--list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log
+
+DROP TABLE t1;
+CALL mtr.add_suppression("Ignoring error 'Unknown table 'test.t1'' on query");
+--connection node_2
+CALL mtr.add_suppression("Error 'Unknown table 'test.t1'' on query");
+
diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test
index 5e17baa1bdb..b52db4c68b0 100644
--- a/mysql-test/suite/galera/t/MW-284.test
+++ b/mysql-test/suite/galera/t/MW-284.test
@@ -63,7 +63,9 @@ CALL mtr.add_suppression('failed registering on master');
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
--connection node_1
+set global wsrep_on=OFF;
RESET MASTER;
+set global wsrep_on=ON;
CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
--connection node_2
diff --git a/mysql-test/suite/galera/t/MW-286.test b/mysql-test/suite/galera/t/MW-286.test
index 426b4493bb7..9c849861001 100644
--- a/mysql-test/suite/galera/t/MW-286.test
+++ b/mysql-test/suite/galera/t/MW-286.test
@@ -4,31 +4,55 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source include/big_test.inc
-
+--source include/have_debug_sync.inc
+
--connection node_1
-CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
-INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
-
# Insert some values before the ALTER
-INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
-
-# Insert more values while the ALTER is running
---send INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+INSERT INTO t1 (f1) VALUES (1), (2), (3);
+#
+# run ALTER with no wsrep replication
+#
--connection node_2
SET GLOBAL wsrep_desync = TRUE;
SET wsrep_on = FALSE;
---error 0,ER_QUERY_INTERRUPTED
-ALTER TABLE t1 ADD PRIMARY KEY (f1);
+#
+# stop ALTER processing after it has acquired exclusive MDL lock
+#
+SET SESSION debug_sync = "alter_table_inplace_after_lock_upgrade SIGNAL mdl_locked WAIT_FOR mdl_continue";
+
+--send ALTER TABLE t1 ADD PRIMARY KEY (f1);
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+SET SESSION debug_sync = "now WAIT_FOR mdl_locked";
+
+#
+# replicate conflicting insert from node_1
+#
+--connection node_1
+INSERT INTO t1(f1) VALUES (11);
+
+#
+# let parked ALTER processing to continue after the conflict
+#
+--connection node_2a
+SET debug_sync = "now SIGNAL mdl_continue";
+SET debug_sync='RESET';
+
+#
+# ALTER should have been aborted with query interupted error code
+#
+--connection node_2
+--error ER_QUERY_INTERRUPTED
+--reap
SET wsrep_on = TRUE;
SET GLOBAL wsrep_desync = FALSE;
--connection node_1
-reap;
+
DROP TABLE t1;
-DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/MW-292.test b/mysql-test/suite/galera/t/MW-292.test
index ecb1273759e..9580d53d85c 100644
--- a/mysql-test/suite/galera/t/MW-292.test
+++ b/mysql-test/suite/galera/t/MW-292.test
@@ -9,7 +9,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
@@ -25,37 +25,51 @@ START TRANSACTION;
UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
-# Block the commit
+# Block the applier on node #1 and issue a conflicting update on node #2
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
---let $galera_sync_point = commit_monitor_enter_sync
+SET SESSION wsrep_sync_wait=0;
+--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_set_sync_point.inc
---connection node_1
---send COMMIT;
+--connection node_2
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
-# Wait until commit is blocked
--connection node_1a
-SET SESSION wsrep_sync_wait = 0;
--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
-# Issue a conflicting update on node #2
---connection node_2
-UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+# Block the commit, send the COMMIT and wait until it gets blocked
-# Wait for both transactions to be blocked
---connection node_1a
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Update_rows_log_event::find_row%';
---source include/wait_condition.inc
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'init' AND INFO = 'COMMIT';
---source include/wait_condition.inc
+--connection node_1
+--send COMMIT
-# Unblock the commit
--connection node_1a
+
+--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
+
+# Let the conflicting UPDATE proceed and wait until it hits abort_trx_end.
+# The victim transaction still sits in commit_monitor_master_sync_point.
+
+--let $galera_sync_point = abort_trx_end
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+
+# Let the transactions proceed
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_signal_sync_point.inc
-# Commit succeeds via replay
+# Commit succeeds
--connection node_1
--reap
diff --git a/mysql-test/suite/galera/t/MW-328A.test b/mysql-test/suite/galera/t/MW-328A.test
index 09aad1bcf60..097d4ac4ff6 100644
--- a/mysql-test/suite/galera/t/MW-328A.test
+++ b/mysql-test/suite/galera/t/MW-328A.test
@@ -3,8 +3,13 @@
#
#
-# Attempt to insert into t2 and check if insert actually inserted rows if
-# a success was reported.
+# test phase 1 is not deterministic
+#
+# Here we attempt to insert into t2 and check if insert actually
+# inserted rows if a success was reported.
+#
+# However, deadlocks may or may not happen in this test execution
+# it all depends on timing.
#
--source include/big_test.inc
@@ -25,7 +30,7 @@ while ($count)
{
TRUNCATE TABLE t2;
- --error 0,1213
+ --error 0,ER_LOCK_DEADLOCK
INSERT IGNORE INTO t2 SELECT f2 FROM t1;
if ($mysql_errno != 1213) {
--inc $successes
@@ -44,14 +49,31 @@ while ($count)
--enable_query_log
+
+--source suite/galera/t/MW-328-footer.inc
+
#
-# Check that the test produced both deadlocks and successes
+# Test phase 2 is deterministic
+# Here we generate a sure conflict in node 1 and verify that
+# insert failed in both nodes
#
+--connection node_1
+CREATE TABLE t1 (i int primary key, j int) engine=innodb;
+INSERT INTO t1 values (1,0);
---disable_query_log
---eval SELECT $successes > 0 AS have_successes
---eval SELECT $deadlocks > 0 AS have_deadlocks
---enable_query_log
+BEGIN;
+UPDATE t1 SET j=1 WHERE i=1;
+--connection node_2
+UPDATE t1 SET j=2 WHERE i=1;
---source suite/galera/t/MW-328-footer.inc
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+SELECT * FROM t1;
+--connection node_2
+SELECT * FROM t1;
+--connection node_1
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-329.test b/mysql-test/suite/galera/t/MW-329.test
index 5baa4d14966..78755fc3b42 100644
--- a/mysql-test/suite/galera/t/MW-329.test
+++ b/mysql-test/suite/galera/t/MW-329.test
@@ -11,11 +11,6 @@ CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
# We start with a populated table
INSERT INTO t1 (f1) VALUES (1),(65535);
-# Clear the wsrep_local_replays counter
-
-FLUSH STATUS;
-SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
-
#
# Run concurrent INSERTs
#
@@ -42,8 +37,9 @@ DELIMITER ;|
#
--connection node_2
-CALL mtr.add_suppression("WSREP: Failed to report last committed .*");
---let $count = 200
+--let $count = 10
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
while ($count)
{
--let $signature = `SELECT LEFT(MD5(RAND()), 10)`
@@ -57,14 +53,28 @@ while ($count)
--die ROW_COUNT() = 0
}
}
- --dec $count
+
+ #
+ # Ensure at least one replay happens
+ #
+
+ --let $wsrep_replays = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+ --disable_query_log
+ if (`SELECT $wsrep_replays - $wsrep_local_replays_old > 0`) {
+ --dec $count
+ }
+ --enable_query_log
}
#
# Confirm that some transaction replays occurred
#
-SELECT VARIABLE_VALUE > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old > 0 AS wsrep_local_replays;
+--enable_query_log
+
#
# Terminate the stored procedure
diff --git a/mysql-test/suite/galera/t/MW-336.test b/mysql-test/suite/galera/t/MW-336.test
index 4bdbfb2ecff..67715c24992 100644
--- a/mysql-test/suite/galera/t/MW-336.test
+++ b/mysql-test/suite/galera/t/MW-336.test
@@ -11,9 +11,8 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1;
-
--let $wait_timeout=600
---let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
+--let $wait_condition = SELECT COUNT(*) = 12 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
@@ -31,11 +30,11 @@ while ($count)
--connection node_1
SET GLOBAL wsrep_slave_threads = 10;
---let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
+--let $wait_condition = SELECT COUNT(*) = 12 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 20;
---let $wait_condition = SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
+--let $wait_condition = SELECT COUNT(*) = 22 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1;
@@ -62,7 +61,7 @@ while ($count)
}
--connection node_1
---let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
+--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1;
diff --git a/mysql-test/suite/galera/t/MW-360-master.opt b/mysql-test/suite/galera/t/MW-360-master.opt
new file mode 100644
index 00000000000..e51c49c3808
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-360-master.opt
@@ -0,0 +1,2 @@
+--gtid-domain-id=1 --log-bin --log-slave-updates
+
diff --git a/mysql-test/suite/galera/t/MW-360.test b/mysql-test/suite/galera/t/MW-360.test
new file mode 100644
index 00000000000..b776631cfff
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-360.test
@@ -0,0 +1,100 @@
+#
+# MW-360 DROP TABLE containing temporary tables results in binlog divergence
+#
+
+--source include/galera_cluster.inc
+--source include/have_binlog_format_row.inc
+
+--connection node_1
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+
+--connection node_2
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+
+--connection node_1
+
+#
+# Straightforward temporary table
+#
+
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+
+--let $local_uuid = `SELECT LEFT(@@global.gtid_executed, 36)`
+
+#
+# A mix of normal and temporary tables
+#
+
+# Temp table first, normal table second
+
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+
+DROP TABLE t1, t2;
+
+# Normal table first, temporary table second
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+
+DROP TABLE t1, t2;
+
+# Temporary table first, normal table second, temp table third
+
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+
+CREATE TEMPORARY TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (3);
+
+DROP TABLE t1, t2, t3;
+
+# Normal table first, temporary table second, normal table third
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2);
+
+CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (3);
+
+DROP TABLE t1, t2, t3;
+
+#
+# A temporary table masking a normal one
+#
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+
+DROP TABLE t1;
+DROP TABLE t1;
+
+--connection node_2
+--let $gtid_executed_node2 = `SELECT @@global.gtid_executed;`
+
+--connection node_1
+--disable_query_log
+# Node 1 has extra GTID set generated by the temporary table drop
+--eval SELECT GTID_SUBSET('$gtid_executed_node2', @@global.gtid_executed) AS gtid_executed_equal;
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/MW-369.inc b/mysql-test/suite/galera/t/MW-369.inc
index 5fd9ef150ae..71df979d6ba 100644
--- a/mysql-test/suite/galera/t/MW-369.inc
+++ b/mysql-test/suite/galera/t/MW-369.inc
@@ -24,7 +24,6 @@
--connection node_1
SET AUTOCOMMIT=ON;
START TRANSACTION;
-
--eval $mw_369_parent_query
#
@@ -51,7 +50,7 @@ SET SESSION wsrep_sync_wait = 0;
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
---let $galera_sync_point = local_monitor_enter_sync
+--let $galera_sync_point = local_monitor_master_enter_sync
--source include/galera_set_sync_point.inc
--connection node_1
@@ -61,7 +60,7 @@ SET SESSION wsrep_sync_wait = 0;
# Wait until both sync points have been reached
#
--connection node_1a
---let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_enter_sync
+--let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_master_enter_sync
--source include/galera_wait_sync_point.inc
#
@@ -70,6 +69,6 @@ SET SESSION wsrep_sync_wait = 0;
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_signal_sync_point.inc
---let $galera_sync_point = local_monitor_enter_sync
+--let $galera_sync_point = local_monitor_master_enter_sync
--source include/galera_signal_sync_point.inc
--source include/galera_clear_sync_point.inc
diff --git a/mysql-test/suite/galera/t/MW-369.test b/mysql-test/suite/galera/t/MW-369.test
index 720d6daf518..c8f8c974019 100644
--- a/mysql-test/suite/galera/t/MW-369.test
+++ b/mysql-test/suite/galera/t/MW-369.test
@@ -24,7 +24,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
@@ -244,3 +244,101 @@ SELECT * FROM c;
DROP TABLE c;
DROP TABLE p;
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+#
+# Test F Outline:
+# ===============
+#
+# Test two concurrent INSERTs on the child table.
+#
+# The pf table will originally have row (1)
+# The cf table will originally be empty
+#
+# A new row (10, 1) pointing to parent row (1) is inserted from
+# connection node_2. A transaction which tries to INSERT another child
+# row (20, 1), pointing to the same parent, is run from connection node_1.
+#
+# Expected Outcome:
+# =================
+# Both INSERTs should succeed since they don't modify the common parent
+# key.
+#
+# At the end of the test:
+# parent table should have row (1)
+# child table should have rows (10, 1), (20, 1)
+
+--connection node_1
+
+CREATE TABLE pf (f1 INTEGER PRIMARY KEY) ENGINE=INNODB;
+CREATE TABLE cf (
+ f1 INTEGER PRIMARY KEY,
+ p_id INTEGER,
+ CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES pf (f1)
+);
+
+INSERT INTO pf VALUES (1);
+
+# This is run on node1:
+--let $mw_369_parent_query = INSERT INTO cf (f1, p_id) VALUES (10, 1)
+# This is run on node2:
+--let $mw_369_child_query = INSERT INTO cf (f1, p_id) VALUES (20, 1)
+--source MW-369.inc
+
+--connection node_1
+--reap
+
+--connection node_2
+SELECT * FROM pf;
+SELECT * FROM cf;
+
+DROP TABLE cf;
+DROP TABLE pf;
+
+#
+# Test G Outline:
+# ===============
+#
+# This test is similar to test B where a existing
+# child table row is updated concurrently from another node
+# with a transaction which updates the parent table, except
+# that here the child table row is inserted, not updated.
+#
+# The pg table will originally have rows (1, 0), (2, 0).
+# The cg table will originally be empty
+#
+# Expected outcome:
+# ================
+#
+# Both UPDATE and INSERT should succeed since they are done to separate tables
+# and UPDATE to parent row does not touch the foreign key referenced by the
+# child row INSERT. The parent table shall contain rows (1, 1), (2, 0).
+# The child table shall contain row (1, 1, 0) which points to parent table
+# row (1, 0).
+#
+
+--connection node_1
+CREATE TABLE pg (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE cg (f1 INTEGER PRIMARY KEY, p_id INTEGER,
+ f2 INTEGER,
+ CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES pg (f1)) ;
+
+INSERT INTO pg VALUES (1, 0);
+INSERT INTO pg VALUES (2, 0);
+
+--let mw_369_parent_query = UPDATE pg SET f2 = 1 WHERE f1 = 1
+--let $mw_369_child_query = INSERT INTO cg VALUES (1, 1, 0)
+--source MW-369.inc
+
+# Commit succeeds
+--connection node_1
+--reap
+
+--connection node_2
+SELECT * FROM pg;
+SELECT * FROM cg;
+
+DROP TABLE cg;
+DROP TABLE pg;
+
diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test
index de1ac52bf3e..9cf176434ba 100644
--- a/mysql-test/suite/galera/t/MW-388.test
+++ b/mysql-test/suite/galera/t/MW-388.test
@@ -2,7 +2,6 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
-
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
@@ -41,11 +40,11 @@ SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_1
SET SESSION wsrep_sync_wait = 0;
-SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue';
+SET SESSION DEBUG_SYNC = 'wsrep_after_certification SIGNAL wsrep_after_certification_reached WAIT_FOR wsrep_after_certification_continue';
--send CALL insert_proc ();
--connection node_1a
-SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
+SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_certification_reached";
SET GLOBAL DEBUG_DBUG = "";
diff --git a/mysql-test/suite/galera/t/MW-402.test b/mysql-test/suite/galera/t/MW-402.test
index 36b691c6295..4b83e25dc50 100644
--- a/mysql-test/suite/galera/t/MW-402.test
+++ b/mysql-test/suite/galera/t/MW-402.test
@@ -1,6 +1,6 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
#
# we must open connection node_1a here, MW-369.inc will use it later
@@ -135,7 +135,6 @@ SELECT * FROM c;
DROP TABLE c;
DROP TABLE p;
-
#
# CASCADE DELETE tests with two parent tables
# Here we cause cascaded operation on child table through
@@ -151,10 +150,11 @@ DROP TABLE p;
CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
-CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, f2 INTEGER,
- CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) ON DELETE CASCADE,
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+ f2 INTEGER,
+ CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ ON DELETE CASCADE,
CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1));
-
INSERT INTO p1 VALUES (1, 0);
INSERT INTO p2 VALUES (1, 0);
@@ -171,7 +171,51 @@ INSERT INTO c VALUES (1, 1, 1, 0);
--connection node_1
--reap
-# same as previous, but statements in different order
+--connection node_2
+SELECT * FROM p1;
+SELECT * FROM p2;
+SELECT * FROM c;
+
+DROP TABLE c;
+DROP TABLE p1;
+DROP TABLE p2;
+
+#
+# CASCADE DELETE tests with two parent tables
+# Here we cause cascaded operation on child table through
+# one parent table and issue other delete operation through the
+# other parent table. The cascade progresses to same child table row where
+# we should see the conflict to happen
+#
+# As a result, the update on p2 should fail
+#
+--connection node_1
+
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+ f2 INTEGER,
+ CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ ON DELETE CASCADE,
+ CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
+ ON DELETE CASCADE);
+
+INSERT INTO p1 VALUES (1, 0);
+INSERT INTO p2 VALUES (1, 0);
+
+INSERT INTO c VALUES (1, 1, 1, 0);
+
+--let $mw_369_parent_query = DELETE FROM p2 WHERE f1=1
+--let $mw_369_child_query = DELETE FROM p1 WHERE f1=1
+
+--connection node_1a
+--source MW-369.inc
+
+# Commit succeeds
+--connection node_1
+--error ER_LOCK_DEADLOCK
+--reap
+
--connection node_2
SELECT * FROM p1;
SELECT * FROM p2;
diff --git a/mysql-test/suite/galera/t/MW-416.test b/mysql-test/suite/galera/t/MW-416.test
index df4fa35abc7..48eada95cb8 100644
--- a/mysql-test/suite/galera/t/MW-416.test
+++ b/mysql-test/suite/galera/t/MW-416.test
@@ -2,11 +2,10 @@
--source include/have_innodb.inc
--source include/wait_until_ready.inc
-
CREATE USER 'userMW416'@'localhost';
GRANT SELECT, INSERT, UPDATE ON test.* TO 'userMW416'@'localhost';
-SHOW GLOBAL STATUS LIKE 'wsrep_replicated';
+--let $wsrep_replicated_before = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_replicated'`
--connect userMW416, localhost, userMW416,, test, $NODE_MYPORT_1
--connection userMW416
@@ -131,4 +130,7 @@ UNINSTALL PLUGIN plg;
--connection node_1
DROP USER 'userMW416'@'localhost';
SHOW DATABASES;
-SHOW GLOBAL STATUS LIKE 'wsrep_replicated';
+--let $wsrep_replicated_after = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_replicated'`
+--disable_query_log
+--eval SELECT $wsrep_replicated_after - $wsrep_replicated_before AS wsrep_replicated_after_diff
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/MW-86-wait1.test b/mysql-test/suite/galera/t/MW-86-wait1.test
index 6c0982ad8b3..aee5a0b2486 100644
--- a/mysql-test/suite/galera/t/MW-86-wait1.test
+++ b/mysql-test/suite/galera/t/MW-86-wait1.test
@@ -6,13 +6,15 @@
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
--source include/have_debug_sync.inc
+SET @orig_debug=@@debug;
--connection node_2
# Make sure no signals have been leftover from previous tests to surprise us.
SELECT @@debug_sync;
+set debug_sync='RESET';
SET SESSION wsrep_sync_wait = 1;
-SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
--connection node_1
CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB;
@@ -90,17 +92,16 @@ SHOW WARNINGS;
--enable_result_log
# Unblock the background INSERT and remove the sync point.
-SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
-SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb";
+#SET GLOBAL debug_dbug = "-d,sync.wsrep_apply_cb";
+SET GLOBAL debug_dbug = @orig_debug;
+SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb";
+SET debug_sync='RESET';
SET SESSION wsrep_sync_wait = default;
# This will wait for the background INSERT to complete before we quit
# from the test.
DROP TABLE t_wait1;
-SET GLOBAL debug = NULL;
-SET debug_sync='RESET';
-
# Make sure no pending signals are leftover to surprise subsequent tests.
SELECT @@debug_sync;
diff --git a/mysql-test/suite/galera/t/MW-86-wait8.test b/mysql-test/suite/galera/t/MW-86-wait8.test
index 65e612c5c8e..c40cd8b77c7 100644
--- a/mysql-test/suite/galera/t/MW-86-wait8.test
+++ b/mysql-test/suite/galera/t/MW-86-wait8.test
@@ -4,13 +4,14 @@
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
--source include/have_debug_sync.inc
+SET @orig_debug=@@debug;
--connection node_2
# Make sure no signals have been leftover from previous tests to surprise us.
SELECT @@debug_sync;
SET SESSION wsrep_sync_wait = 8;
-SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
--connection node_1
CREATE TABLE t_wait8 (f1 INTEGER) ENGINE=InnoDB;
@@ -112,8 +113,11 @@ SHOW WARNINGS;
--enable_query_log
# Unblock the background INSERT and remove the sync point.
-SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
+#SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
+SET GLOBAL debug_dbug = @orig_debug;
+
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET debug_sync='RESET';
SET SESSION wsrep_sync_wait = default;
@@ -121,8 +125,5 @@ SET SESSION wsrep_sync_wait = default;
# from the test.
DROP TABLE t_wait8;
-SET GLOBAL debug = NULL;
-SET debug_sync='RESET';
-
# Make sure no pending signals are leftover to surprise subsequent tests.
SELECT @@debug_sync;
diff --git a/mysql-test/suite/galera/t/galera#500.test b/mysql-test/suite/galera/t/galera#500.test
index 3c8490b6907..60f303b7103 100644
--- a/mysql-test/suite/galera/t/galera#500.test
+++ b/mysql-test/suite/galera/t/galera#500.test
@@ -8,6 +8,10 @@
--source include/galera_cluster.inc
--source include/galera_have_debug_sync.inc
+--let $node_1=node_1
+--let $node_2=node_2
+--source suite/galera/include/auto_increment_offset_save.inc
+
# Force node_2 gcomm background thread to terminate via exception.
--connection node_2
--let $wsrep_cluster_address = `SELECT @@wsrep_cluster_address`
@@ -36,3 +40,5 @@ SET SESSION wsrep_on=0;
--connection node_2
CALL mtr.add_suppression("WSREP: exception from gcomm, backend must be restarted: Gcomm backend termination was requested by setting gmcast.isolate=2.");
+
+--source suite/galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test
new file mode 100644
index 00000000000..02322fc02ec
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test
@@ -0,0 +1,161 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/galera_cluster.inc
+#
+# This test will reproduce regressions of bugs
+# https://github.com/codership/mysql-wsrep/issues/335
+# https://github.com/codership/mysql-wsrep/issues/336
+#
+# The test will issue duplicate inserts into a table, which has foreign key
+# constraint for a parent table.
+# The inserts happen in separate nodes, and the
+# The test outline is as follows:
+# 1. in node 1, an update is done for the FK parent row, in a transaction,
+# which is left open. The purpose of this is just to establish a X lock on
+# the parent row.
+# 2. in node 1, an insert for the child table is sent. The insert will have to wait
+# for the parent row X lock, because it needs S lock on the same row.
+# However, we have set an DBUG sync point just before the insert will call for
+# innodb suspend
+# 3. in node 2, a similar insert is issued. This will replicate to node 1 and try to
+# abort the conflicting update and blocked insert
+# 4. the inserts dbug sync point is relased, and insert should continue and abort
+# gracefully
+# 5. update is continued to commit, and it should also observe the deadlock
+#
+# This test is run in 3 phases:
+#
+# 1. with plain SQL statement
+# 2. as SQL prepared statements
+# 3. as SQl stored procedures
+#
+# The test phase 3 is for reproducing the issue in bug #336 specifically
+#
+
+#
+# create the test tables and foreign key constraint between them
+#
+CREATE TABLE user(id int primary key, j int) ENGINE=InnoDB;
+CREATE TABLE user_session(id int primary key, fk1 int, fk2 int) ENGINE=InnoDB;
+alter table user_session add foreign key (fk1) references user(id);
+
+# populate a few initial rows
+INSERT INTO user values (1,0), (2,0), (3,0), (4,0);
+INSERT INTO user_session values (1,1,1);
+
+#
+# prepare test connections, for:
+# update of parent row in node1
+# insert of child row in node1
+# insert of child row in node2
+
+--connect node_1_u, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1_i, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_2_i, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+
+#
+# test phase 1: plain SQL statements
+#
+--echo "Phase 1: plain SQL statements"
+
+
+--connection node_1
+let $counter=10;
+let $sleep_period=1;
+
+while($counter > 0)
+{
+ --connection node_1_u
+ begin;
+ update user set j = j + 1 WHERE id > 0;
+
+ --connection node_1_i
+ set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+ send insert into user_session(id,fk1,fk2) values (2, 2, 2);
+
+ --connection node_1
+ set debug_sync='now WAIT_FOR ins_waiting';
+
+ --connection node_2_i
+ insert into user_session(id,fk1,fk2) values (2, 2, 3);
+
+ --connection node_1
+ set debug_sync='now SIGNAL cont_ins';
+
+ --connection node_1_i
+ --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY
+ reap;
+
+ --connection node_1_u
+ --error 0,ER_LOCK_DEADLOCK
+ commit;
+
+ --connection node_1
+ --error 0,ER_LOCK_DEADLOCK
+ truncate user_session;
+ set debug_sync = reset;
+
+ dec $counter;
+}
+
+#
+# test phase 2: prepared statements
+#
+--echo "Phase 2: prepared statements"
+
+--connection node_1_u
+prepare upd from 'update user set j = j + 1 WHERE id > 0';
+
+--connection node_1_i
+prepare ins1 from 'insert into user_session(id,fk1,fk2) values (2, 2, 2)';
+
+--connection node_2_i
+prepare ins2 from 'insert into user_session(id,fk1,fk2) values (2, 2, 3)';
+
+--connection node_1
+let $counter=10;
+let $sleep_period=1;
+
+while($counter > 0)
+{
+ --connection node_1_u
+ begin;
+ execute upd;
+ #update user set j = j + 1 WHERE id > 0;
+
+ --connection node_1_i
+ set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins';
+ send execute ins1;
+
+ --connection node_1
+ set debug_sync='now WAIT_FOR ins_waiting';
+
+ --connection node_2_i
+ execute ins2;
+
+ --connection node_1
+ set debug_sync='now SIGNAL cont_ins';
+
+ --connection node_1_i
+ --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY
+ reap;
+
+ --connection node_1_u
+ --error 0,ER_LOCK_DEADLOCK
+ commit;
+
+ --connection node_1
+
+ --error 0,ER_LOCK_DEADLOCK
+ truncate user_session;
+ set debug_sync = reset;
+
+ dec $counter;
+}
+
+
+--connection node_1
+
+drop table user_session,user;
diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt
index d8ecaacaa4c..6f688b39fd5 100644
--- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt
+++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt
@@ -1 +1 @@
---lock_wait_timeout=5 --innodb_lock_wait_timeout=5 --wait_timeout=5
+--lock_wait_timeout=5 --innodb_lock_wait_timeout=5 --wait_timeout=60
diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test
index 49f3c993256..1c439ffff63 100644
--- a/mysql-test/suite/galera/t/galera_as_master.test
+++ b/mysql-test/suite/galera/t/galera_as_master.test
@@ -64,4 +64,6 @@ RESET SLAVE ALL;
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
--connection node_1
+set global wsrep_on=OFF;
RESET MASTER;
+set global wsrep_on=ON;
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid.cnf
index 19517556331..75caba5420a 100644
--- a/mysql-test/suite/galera/t/galera_as_master_gtid.cnf
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid.cnf
@@ -1,8 +1,6 @@
!include ../galera_2nodes_as_master.cnf
[mysqld]
-gtid-mode=ON
log-bin=mysqld-bin
log-slave-updates
-enforce-gtid-consistency
binlog-format=ROW
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid.test b/mysql-test/suite/galera/t/galera_as_master_gtid.test
index 9db104b7cab..9be065e448b 100644
--- a/mysql-test/suite/galera/t/galera_as_master_gtid.test
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid.test
@@ -27,10 +27,6 @@ INSERT INTO t1 VALUES(1);
--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
--enable_query_log
---replace_result $effective_uuid <effective_uuid>
---replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
-SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 120;
-
--connection node_2
INSERT INTO t1 VALUES(2);
@@ -39,10 +35,6 @@ INSERT INTO t1 VALUES(2);
--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match;
--enable_query_log
---replace_result $effective_uuid <effective_uuid>
---replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
-SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 120;
-
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
@@ -55,10 +47,6 @@ SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 120;
--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match;
--enable_query_log
---replace_result $effective_uuid <effective_uuid>
---replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
-SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
-
--connection node_1
DROP TABLE t1;
@@ -66,5 +54,17 @@ DROP TABLE t1;
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
+--connection node_1
+--let $gtid_executed_node1 = `SELECT @@global.gtid_executed;`
+
+--connection node_2
+--disable_query_log
+--eval SELECT '$gtid_executed_node1' = @@global.gtid_executed AS gtid_executed_equal
+--enable_query_log
+--connection node_3
+--disable_query_log
+--eval SELECT '$gtid_executed_node1' = @@global.gtid_executed AS gtid_executed_equal
+--enable_query_log
+
STOP SLAVE;
RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf
index 19517556331..75caba5420a 100644
--- a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf
@@ -1,8 +1,6 @@
!include ../galera_2nodes_as_master.cnf
[mysqld]
-gtid-mode=ON
log-bin=mysqld-bin
log-slave-updates
-enforce-gtid-consistency
binlog-format=ROW
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test
index 23606d7ac4c..61c7eed6543 100644
--- a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test
+++ b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test
@@ -24,6 +24,8 @@ INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
STOP SLAVE;
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_2, MASTER_AUTO_POSITION=1;
diff --git a/mysql-test/suite/galera/t/galera_as_slave.test b/mysql-test/suite/galera/t/galera_as_slave.test
index 849b75eadd1..da92437b118 100644
--- a/mysql-test/suite/galera/t/galera_as_slave.test
+++ b/mysql-test/suite/galera/t/galera_as_slave.test
@@ -5,18 +5,19 @@
#
--source include/have_innodb.inc
-
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
---connection node_1
+--connection node_3
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
@@ -29,14 +30,14 @@ INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES (2);
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_1
SELECT COUNT(*) = 2 FROM t1;
INSERT INTO t1 VALUES (3);
--connection node_2
SELECT COUNT(*) = 3 FROM t1;
---connection node_1
+--connection node_3
DROP TABLE t1;
--connection node_2
@@ -46,5 +47,5 @@ DROP TABLE t1;
STOP SLAVE;
RESET SLAVE ALL;
---connection node_1
+--connection node_3
RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_autoinc.test b/mysql-test/suite/galera/t/galera_as_slave_autoinc.test
index 59483d0591c..e0c8bf29682 100644
--- a/mysql-test/suite/galera/t/galera_as_slave_autoinc.test
+++ b/mysql-test/suite/galera/t/galera_as_slave_autoinc.test
@@ -5,18 +5,19 @@
#
--source include/have_innodb.inc
-
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
---connection node_1
+--connection node_3
##
## Verify the correct operation of the auto-increment when
@@ -62,14 +63,13 @@ select * from t1;
show variables like 'binlog_format';
show variables like 'auto_increment_increment';
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
-
+--connection node_1
select * from t1;
show variables like 'binlog_format';
show variables like 'auto_increment_increment';
---connection node_1
+--connection node_3
DROP TABLE t1;
--connection node_2
@@ -79,5 +79,5 @@ DROP TABLE t1;
STOP SLAVE;
RESET SLAVE ALL;
---connection node_1
+--connection node_3
RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid.test b/mysql-test/suite/galera/t/galera_as_slave_gtid.test
index c2331a2ae05..3b0f191ad83 100644
--- a/mysql-test/suite/galera/t/galera_as_slave_gtid.test
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid.test
@@ -8,18 +8,19 @@
#
--source include/have_innodb.inc
-
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
---connection node_1
+--connection node_3
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
@@ -34,17 +35,21 @@ SELECT LENGTH(@@global.gtid_binlog_state) > 1;
--source include/wait_condition.inc
--disable_query_log
+
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
+
--enable_query_log
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_1
SELECT COUNT(*) = 1 FROM t1;
--disable_query_log
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
--enable_query_log
---connection node_1
+--connection node_3
DROP TABLE t1;
#
@@ -55,7 +60,7 @@ DROP TABLE t1;
--sleep 1
---connection node_3
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.cnf b/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.cnf
new file mode 100644
index 00000000000..e0852c50c44
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.cnf
@@ -0,0 +1,17 @@
+!include ../galera_2nodes_as_slave.cnf
+
+[mysqld]
+#gtid-mode=ON
+log-bin=master-bin
+log-bin-index=master-bin
+log-slave-updates
+#enforce-gtid-consistency
+binlog-format=ROW
+
+[mysqld.2]
+replicate-do-db=test1
+replicate-wild-do-table=test1.%
+
+[mysqld.3]
+replicate-do-db=test1
+replicate-wild-do-table=test1.%
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.test b/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.test
new file mode 100644
index 00000000000..81b6d446ba6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db.test
@@ -0,0 +1,150 @@
+#
+# Test Galera as a slave to a MySQL master using GTIDs
+#
+
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source include/have_log_bin.inc
+
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+--connection node_1
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+
+--connection node_3
+RESET MASTER;
+
+--connection node_2
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_3, MASTER_USER='root';
+--enable_query_log
+START SLAVE;
+
+--connection node_3
+CREATE SCHEMA test1;
+CREATE SCHEMA test2;
+USE test1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
+USE test2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
+
+#
+# First , some autocommit stuff
+#
+
+# Simple inserts
+
+INSERT INTO test1.t1 (f1) VALUES (1);
+INSERT INTO test2.t1 (f1) VALUES (1);
+
+INSERT INTO test1.t1 (f1) VALUES (2);
+INSERT INTO test2.t1 (f1) VALUES (2);
+
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+
+# Update that only covers test2.t1
+
+UPDATE test2.t1 SET test2.t1.f2 = 'cde';
+
+# Multi-table UPDATE
+
+UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz';
+
+# Multi-table DELETE
+
+DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3;
+
+#
+# Multi-statement transactions
+#
+
+# Transaction which is not replicated at all
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO test2.t1 (f1) VALUES (999);
+INSERT INTO test2.t1 (f1) VALUES (9999);
+COMMIT;
+
+# Transaction that is completely replicated
+START TRANSACTION;
+INSERT INTO test1.t1 (f1) VALUES (111);
+INSERT INTO test1.t1 (f1) VALUES (222);
+COMMIT;
+
+# Transaction that is partially replicated
+
+START TRANSACTION;
+INSERT INTO test1.t1 (f1) VALUES (333);
+INSERT INTO test2.t1 (f1) VALUES (99999);
+COMMIT;
+
+#
+# Make sure binary logs and gtid_executed strings are equal
+#
+
+--sleep 2
+--connection node_2
+--let $effective_uuid = `SELECT LEFT(@@global.gtid_current_pos, 36)`
+--let $gtid_executed_node2 = `SELECT @@global.gtid_current_pos;`
+
+--replace_result $effective_uuid <effective_uuid>
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
+
+--connection node_1
+
+--disable_query_log
+--eval SELECT '$gtid_executed_node2' = @@global.gtid_current_pos AS gtid_executed_equal;
+--enable_query_log
+
+--replace_result $effective_uuid <effective_uuid>
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
+
+#
+# Final consistency checks
+#
+
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
+--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+SELECT COUNT(*) = 2 FROM test1.t1 WHERE f1 IN (1,2);
+SELECT COUNT(*) = 3 FROM test1.t1 WHERE f1 IN (111,222,333);
+SELECT COUNT(*) = 2 FROM test1.t1 WHERE f2 = 'klm';
+
+--error 1049
+USE test2;
+
+#
+# Cleanup
+#
+
+--connection node_3
+DROP SCHEMA test1;
+DROP SCHEMA test2;
+
+--sleep 1
+
+--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db_cc.test b/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db_cc.test
new file mode 100644
index 00000000000..1604016f3c3
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_replicate_do_db_cc.test
@@ -0,0 +1,176 @@
+#
+# Test the case where a Galera slave to async replication goes non-prim while
+# a stream of replication events including filtered events is arriving
+#
+
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+--source include/big_test.inc
+
+# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/galera_cluster.inc
+
+--connection node_1
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+
+--connection node_2
+SET global wsrep_on=OFF;
+RESET MASTER;
+SET global wsrep_on=ON;
+
+--connection node_2
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE USER='root';
+
+--connection node_1
+CREATE SCHEMA test1;
+CREATE SCHEMA test2;
+USE test1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+USE test2;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+INSERT INTO test1.t1 (f1) VALUES (1);
+INSERT INTO test2.t1 (f1) VALUES (1);
+
+INSERT INTO test1.t1 (f1) VALUES (2);
+INSERT INTO test2.t1 (f1) VALUES (2);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM test1.t1;
+--source include/wait_condition.inc
+
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_1
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+INSERT INTO test1.t1 (f1) VALUES (3);
+INSERT INTO test2.t1 (f1) VALUES (3);
+
+--connection node_2
+SET SESSION wsrep_on=OFF;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+--let $slave_sql_errno = 1047
+--source include/wait_for_slave_sql_error.inc
+
+--connection node_1
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+INSERT INTO test1.t1 (f1) VALUES (4);
+INSERT INTO test2.t1 (f1) VALUES (4);
+
+--connection node_2
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_1
+INSERT INTO test1.t1 (f1) VALUES (5);
+INSERT INTO test2.t1 (f1) VALUES (5);
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+SET SESSION wsrep_on=ON;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_ready';
+--source include/wait_condition.inc
+
+--connection node_1
+INSERT INTO test1.t1 (f1) VALUES (6);
+INSERT INTO test2.t1 (f1) VALUES (6);
+
+--connection node_2
+START SLAVE;
+
+#
+# Consistency checks
+#
+
+--sleep 2
+--connection node_2
+--let $wait_condition = SELECT COUNT(DISTINCT f1) = 6 FROM test1.t1;
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(DISTINCT f1) = 6 FROM test1.t1;
+--source include/wait_condition.inc
+
+--connection node_2
+--let $gtid_executed_node2 = `SELECT @@global.gtid_executed;`
+
+--let $effective_uuid_1 = `SELECT SUBSTRING_INDEX(@@global.gtid_executed, ':', 1)`
+--let $effective_uuid_2 = `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(@@global.gtid_executed, '\n', -1), ':', 1)`
+
+--replace_result $effective_uuid_1 <effective_uuid_1> $effective_uuid_2 <effective_uuid_2>
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
+
+--error 1049
+USE test2;
+
+--connection node_3
+
+--disable_query_log
+--eval SELECT '$gtid_executed_node2' = @@global.gtid_executed AS gtid_executed_equal;
+--enable_query_log
+
+--error 1049
+USE test2;
+
+--replace_result $effective_uuid_1 <effective_uuid_1> $effective_uuid_2 <effective_uuid_2>
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
+
+#
+# Cleanup
+#
+
+--connection node_1
+DROP SCHEMA test1;
+DROP SCHEMA test2;
+
+--sleep 1
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--connection node_2
+STOP SLAVE;
+RESET SLAVE ALL;
+CALL mtr.add_suppression("GTID replication failed");
+CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed");
+CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
+CALL mtr.add_suppression("TO isolation failed for");
+CALL mtr.add_suppression("Slave SQL: Error 'Deadlock found when trying to get lock; try restarting transaction' on query");
+CALL mtr.add_suppression("Slave SQL: Error 'WSREP has not yet prepared node for application use' on query");
+CALL mtr.add_suppression("Slave: WSREP has not yet prepared node for application use Error_code: 1047");
diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test
index 46a93458271..31c0b9ca162 100644
--- a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test
+++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test
@@ -7,22 +7,23 @@
--source include/have_innodb.inc
--source include/big_test.inc
+--source include/galera_cluster.inc
# Step #1. Establish replication
#
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
-#
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
---source include/galera_cluster.inc
+# As node 4 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_4 connection here
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1, MASTER_USER='root';
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_4, MASTER_USER='root';
--enable_query_log
START SLAVE;
SET SESSION wsrep_sync_wait = 0;
---connection node_1
+--connection node_4
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
--connection node_2
@@ -34,22 +35,21 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
---connection node_3
+--connection node_1
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
# Step #3. Force async replication to fail by creating a replication event while the slave is non-prim
---connection node_1
+--connection node_4
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
--connection node_2
--sleep 5
--let $value = query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1)
---connection node_3
+--connection node_1
--disable_query_log
--eval SELECT "$value" IN ("Error 'Unknown command' on query. Default database: 'test'. Query: 'BEGIN'", "Node has dropped from cluster") AS expected_error
--enable_query_log
@@ -58,7 +58,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
--connection node_2
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
---connection node_3
+--connection node_1
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
@@ -74,7 +74,7 @@ START SLAVE;
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc
---connection node_1
+--connection node_4
DROP TABLE t1;
--sleep 2
@@ -92,5 +92,5 @@ CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be
CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
---connection node_1
+--connection node_4
RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_preordered.test b/mysql-test/suite/galera/t/galera_as_slave_preordered.test
index 6f221f83b3a..5b3c78b2cb1 100644
--- a/mysql-test/suite/galera/t/galera_as_slave_preordered.test
+++ b/mysql-test/suite/galera/t/galera_as_slave_preordered.test
@@ -6,14 +6,15 @@
--source include/have_innodb.inc
--source include/have_log_bin.inc
-
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE USER='root';
@@ -21,7 +22,7 @@ START SLAVE USER='root';
# Issue many large-ish transaction on the async master
#
---connection node_1
+--connection node_3
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
@@ -63,8 +64,7 @@ while ($count)
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
---connection node_3
+--connection node_1
SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
@@ -72,7 +72,7 @@ SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
# Cleanup
#
---connection node_1
+--connection node_3
DROP TABLE t1;
DROP TABLE ten;
@@ -80,5 +80,8 @@ DROP TABLE ten;
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ten';
+--source include/wait_condition.inc
+
STOP SLAVE;
RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test b/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test
index 460e040c010..fa5f3f9c7c6 100644
--- a/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test
+++ b/mysql-test/suite/galera/t/galera_as_slave_replication_bundle.test
@@ -5,18 +5,19 @@
#
--source include/have_innodb.inc
-
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
---connection node_1
+--connection node_3
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
@@ -36,7 +37,7 @@ INSERT INTO t1 VALUES(5);
SELECT COUNT(*) = 4 FROM t1;
# Bundle is now complete, the last INSERT and the DROP are delivered
---connection node_1
+--connection node_3
DROP TABLE t1;
--connection node_2
diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf
index b4bf5f02171..cddb8e0e174 100644
--- a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf
+++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf
@@ -1,12 +1,11 @@
!include ../galera_2nodes.cnf
[mysqld]
-wsrep_sst_method=xtrabackup-v2
+wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
[mysqld.1]
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;pc.ignore_sb=true'
[mysqld.2]
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
-
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;pc.ignore_sb=true'
diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test
index cd7621bfa6e..ed3674ad0e0 100644
--- a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test
+++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test
@@ -6,7 +6,11 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source include/have_xtrabackup.inc
+--source include/have_mariabackup.inc
+
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
--connection node_1
--let $connection_id = `SELECT CONNECTION_ID()`
@@ -41,6 +45,8 @@ DELIMITER ;|
--connection node_2a
--source include/kill_galera.inc
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
--sleep 10
--source include/start_mysqld.inc
--sleep 25
@@ -55,7 +61,6 @@ INSERT INTO t1 VALUES (DEFAULT);
--disable_query_log
--eval KILL CONNECTION $connection_id
--enable_query_log
-
INSERT INTO t1 VALUES (DEFAULT);
--connection node_1
@@ -94,3 +99,7 @@ DROP TABLE t1;
CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)");
CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
+
+--let $node_1=node_1a
+--let $node_2=node_2a
+--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_group_commit.cnf b/mysql-test/suite/galera/t/galera_bf_abort_group_commit.cnf
new file mode 100644
index 00000000000..612418c17c0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_group_commit.cnf
@@ -0,0 +1,15 @@
+!include ../galera_2nodes.cnf
+
+# We set repl.commit_order=1 in order to disable provider commit
+# ordering.
+
+[mysqld.1]
+log-bin
+log-slave-updates
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;repl.commit_order=1'
+
+[mysqld.2]
+
+log-bin
+log-slave-updates
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;repl.commit_order=1' \ No newline at end of file
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_group_commit.test b/mysql-test/suite/galera/t/galera_bf_abort_group_commit.test
new file mode 100644
index 00000000000..a828701cd0e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_group_commit.test
@@ -0,0 +1,77 @@
+#
+# This test uses galera_sr_bf_abort.inc to probe various BF abort points
+# for SR transactions with wsrep provider commit ordering disabled.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/galera_have_debug_sync.inc
+
+# Control connection for manipulating sync points on node 1
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait = 0;
+
+# SR bf abort on fragment
+--let $wsrep_trx_fragment_size = 1
+--echo galera_sr_bf_abort_at_commit = 0
+--let $galera_sr_bf_abort_at_commit = 0
+
+--echo after_replicate_sync
+--let $galera_sr_bf_abort_sync_point = after_replicate_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo local_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo apply_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo commit_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+# SR bf abort on commit fragment
+--let $wsrep_trx_fragment_size = 1
+--echo galera_sr_bf_abort_at_commit = 1
+--let $galera_sr_bf_abort_at_commit = 1
+
+--echo after_replicate_sync
+--let $galera_sr_bf_abort_sync_point = after_replicate_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo local_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo apply_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo commit_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
+--source suite/galera/t/galera_sr_bf_abort.inc
+
+# Normal bf abort on commit
+--let $wsrep_trx_fragment_size = 0
+--echo galera_sr_bf_abort_at_commit = 1
+--let $galera_sr_bf_abort_at_commit = 1
+
+--echo after_replicate_sync
+--let $galera_sr_bf_abort_sync_point = after_replicate_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo local_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo apply_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+--echo commit_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
+--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
+
+CALL mtr.add_suppression("WSREP: fragment replication failed: 1");
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test b/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test
new file mode 100644
index 00000000000..c7af8375b3f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_abort_shutdown.test
@@ -0,0 +1,33 @@
+#
+# This test verifies that the server can be shut down even if
+# some of the wsrep transactions are in QUERY_COMMITTING state.
+# In this case the shutdown sequence may do a BF abort for the
+# connection.
+#
+
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+
+--connection node_2
+SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
+--send INSERT INTO t1 VALUES (1)
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/restart_mysqld.inc
+
+# Restore original auto_increment_offset values.
+--let $node_2=node_2a
+--source include/auto_increment_offset_restore.inc
+
+--connection node_1
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_commit_empty.test b/mysql-test/suite/galera/t/galera_commit_empty.test
new file mode 100644
index 00000000000..4e1a1e4eb2c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_commit_empty.test
@@ -0,0 +1,35 @@
+# Test empty transactions.
+#
+# Check that the empty transaction gets terminated by starting and new
+# transaction after it. If the empty transaction is not terminated
+# appropriately, the following START TRANSACTION will fail.
+#
+# Also check that empty transactions don't generate any write sets.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+START TRANSACTION;
+COMMIT;
+
+START TRANSACTION;
+COMMIT;
+
+START TRANSACTION READ ONLY;
+COMMIT;
+
+START TRANSACTION;
+COMMIT;
+
+START TRANSACTION;
+START TRANSACTION;
+COMMIT;
+
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/galera_create_table_as_select.test b/mysql-test/suite/galera/t/galera_create_table_as_select.test
new file mode 100644
index 00000000000..a6c1f657280
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_create_table_as_select.test
@@ -0,0 +1,145 @@
+#
+# CREATE TABLE AS SELECT tests
+#
+
+--source include/galera_cluster.inc
+
+--connection node_1
+SET SESSION default_storage_engine=InnoDB;
+
+# Left table already exists
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE t1 AS SELECT * FROM t2;
+DROP TABLE t1,t2;
+
+# Right table does not exist
+--error ER_NO_SUCH_TABLE
+CREATE TABLE t1 AS SELECT * FROM t2;
+
+# No right table at all
+CREATE TABLE t1 AS SELECT 1 FROM DUAL;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+
+# Empty right table
+--connection node_1
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 AS SELECT * FROM t2;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+DROP TABLE t1,t2;
+
+# Right table is MyISAM
+
+CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT * FROM t2;
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1
+DROP TABLE t1,t2;
+
+# Right side is a subquery
+
+--connection node_1
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT MAX(f1) AS f1 FROM t2;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT f1 = 5 FROM t1;
+
+--connection node_1
+DROP TABLE t1,t2;
+
+# Inside a stored procedure
+
+--connection node_1
+DELIMITER |;
+CREATE PROCEDURE sp1 ()
+BEGIN
+ CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+ INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+ CREATE TABLE t1 AS SELECT * FROM t2;
+END|
+DELIMITER ;|
+CALL sp1();
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1
+DROP TABLE t1, t2;
+DROP PROCEDURE sp1;
+
+# Inside a prepared statement
+
+--connection node_1
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+
+PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT * FROM t2';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+
+#
+# Multi-master conflict
+#
+
+--connection node_1
+
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+LOCK TABLE t2 WRITE;
+
+--connection node_1
+--send CREATE TABLE t1 AS SELECT * FROM t2;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t2;
+CREATE TABLE t1 AS SELECT * FROM t2;
+
+--connection node_1a
+UNLOCK TABLES;
+
+--connection node_1
+--error ER_TABLE_EXISTS_ERROR,ER_LOCK_DEADLOCK
+--reap
+
+DROP TABLE t1, t2;
+
+#
+# Temporary table
+#
+
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+
+CREATE TEMPORARY TABLE t1 AS SELECT * FROM t2;
+
+--connection node_2
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t1;
+
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t1'' on query");
+
+--connection node_1
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test
index 0ad97916302..3f8be268135 100644
--- a/mysql-test/suite/galera/t/galera_defaults.test
+++ b/mysql-test/suite/galera/t/galera_defaults.test
@@ -19,7 +19,7 @@ source ../wsrep/include/check_galera_version.inc;
# Global Variables
-SELECT COUNT(*) = 43 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+SELECT COUNT(*) `expect 48` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -36,26 +36,3 @@ AND VARIABLE_NAME NOT IN (
'WSREP_PATCH_VERSION'
)
ORDER BY VARIABLE_NAME;
-
-# wsrep_provider_options
-#
-# We replace the ones that vary from run to run with placeholders
-
---let _WSREP_PROVIDER_OPTIONS = `SELECT @@wsrep_provider_options`
---perl
- use strict;
- my $wsrep_provider_options = $ENV{'_WSREP_PROVIDER_OPTIONS'};
- $wsrep_provider_options =~ s/base_dir = .*?;/<BASE_DIR>;/sgio;
- $wsrep_provider_options =~ s/base_host = .*?;/<BASE_HOST>;/sgio;
- $wsrep_provider_options =~ s/base_port = .*?;/<BASE_PORT>;/sgio;
- $wsrep_provider_options =~ s/gcache\.dir = .*?;/<GCACHE_DIR>;/sgio;
- $wsrep_provider_options =~ s/gcache\.name = .*?;/<GCACHE_NAME>;/sgio;
- $wsrep_provider_options =~ s/gmcast\.listen_addr = .*?;/<GMCAST_LISTEN_ADDR>;/sgio;
- $wsrep_provider_options =~ s/gcs\.recv_q_hard_limit = .*?;/<GCS_RECV_Q_HARD_LIMIT>;/sgio;
- $wsrep_provider_options =~ s/ist\.recv_addr = .*?;/<IST_RECV_ADDR>;/sgio;
- $wsrep_provider_options =~ s/evs\.evict = .*?;/<EVS_EVICT>;/sgio;
- $wsrep_provider_options =~ s/signal = .*?;\s*//sgio;
- $wsrep_provider_options =~ s/dbug = .*?;\s*//sgio;
- $wsrep_provider_options =~ s/repl.proto_max = .*?;\s*/<REPL_PROTO_MAX>;/sgio;
- print $wsrep_provider_options."\n";
-EOF
diff --git a/mysql-test/suite/galera/t/galera_drop_database.test b/mysql-test/suite/galera/t/galera_drop_database.test
index 47fe8315198..12d9efea2f9 100644
--- a/mysql-test/suite/galera/t/galera_drop_database.test
+++ b/mysql-test/suite/galera/t/galera_drop_database.test
@@ -9,6 +9,7 @@
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
+# Create test database with two sets of the FTS indexes:
CREATE DATABASE fts;
USE fts;
CREATE TABLE fts_t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
@@ -23,34 +24,19 @@ DROP TABLE ten;
UPDATE fts_t1 SET f2 = 'abcd';
UPDATE fts_t2 SET f2 = 'efjh';
+# Restart the second node:
--connection node_2
-let $wsrep_cluster_address = `SELECT @@global.wsrep_node_incoming_address`;
--source include/restart_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
---let $galera_connection_name = node_2a
---let $galera_server_number = 2
---source include/galera_connect.inc
---connection node_2a
+--connection node_2
--source include/wait_until_ready.inc
+# Drop the tables and database after nodes restarted:
--connection node_1
---let $restart_parameters = --wsrep-cluster-address=gcomm://$wsrep_cluster_address
---source include/restart_mysqld.inc
-
---connection node_2a
---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
---source include/wait_condition.inc
-
---let $galera_connection_name = node_1a
---let $galera_server_number = 1
---source include/galera_connect.inc
---connection node_1a
---source include/wait_until_ready.inc
-
USE fts;
DROP TABLE fts_t1;
DROP TABLE fts_t2;
@@ -58,8 +44,4 @@ SHOW TABLES;
DROP DATABASE fts;
# Restore original auto_increment_offset values.
---let $node_1=node_1a
---let $node_2=node_2a
--source include/auto_increment_offset_restore.inc
-
---source include/galera_end.inc
diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test
index 364f41529a4..e9d7fa1c3a3 100644
--- a/mysql-test/suite/galera/t/galera_forced_binlog_format.test
+++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test
@@ -7,7 +7,10 @@
--source include/galera_cluster.inc
--connection node_1
+SEt GLOBAL wsrep_on=OFF;
RESET MASTER;
+SEt GLOBAL wsrep_on=ON;
+FLUSH BINARY LOGS;
SET SESSION binlog_format = 'STATEMENT';
@@ -40,6 +43,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
DROP USER dummy@localhost;
DROP DATABASE testdb_9401;
---source include/galera_end.inc
+#--source include/galera_end.inc
--echo # End of tests
diff --git a/mysql-test/suite/galera/t/galera_ftwrl_drain.test b/mysql-test/suite/galera/t/galera_ftwrl_drain.test
index 690e890cdea..ee64e147f65 100644
--- a/mysql-test/suite/galera/t/galera_ftwrl_drain.test
+++ b/mysql-test/suite/galera/t/galera_ftwrl_drain.test
@@ -12,7 +12,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--connection node_1
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
@@ -55,7 +55,7 @@ SET SESSION innodb_lock_wait_timeout=1;
SET SESSION wait_timeout=1;
--error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t2 VALUES (2);
+INSERT INTO t1 VALUES (2);
--connection node_2a
UNLOCK TABLES;
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
index b7fd9cf3aed..d728a094f10 100644
--- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
@@ -13,6 +13,14 @@ SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--connection node_1
+
+#
+# Wait until the configuration change is over in order to avoid
+# replication error due to configuration change.
+#
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
@@ -48,8 +56,8 @@ DROP TABLE t1;
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
# Confirm that IST did not take place
---let $assert_text = IST first seqno 2 not found from cache, falling back to SST
---let $assert_select = IST first seqno 2 not found from cache, falling back to SST
+--let $assert_text = IST first seqno [24] not found from cache, falling back to SST
+--let $assert_select = IST first seqno [24] not found from cache, falling back to SST
--let $assert_count = 1
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_only_after = starting as process
diff --git a/mysql-test/suite/galera/t/galera_gcs_fragment.test b/mysql-test/suite/galera/t/galera_gcs_fragment.test
index 80d3a5cb659..d2593fec8c8 100644
--- a/mysql-test/suite/galera/t/galera_gcs_fragment.test
+++ b/mysql-test/suite/galera/t/galera_gcs_fragment.test
@@ -1,7 +1,7 @@
# Test fragmentation over configuration changes
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
@@ -54,7 +54,7 @@ INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Deadlock error should be returned since write set send was
# interrupted by gcs
--connection node_1
---error ER_LOCK_DEADLOCK
+--error ER_ERROR_DURING_COMMIT
--reap
# Do additional insert to verify that node_1 remain operational
diff --git a/mysql-test/suite/galera/t/galera_gtid-master.opt b/mysql-test/suite/galera/t/galera_gtid-master.opt
index 8a755e98b00..30317469ae7 100644
--- a/mysql-test/suite/galera/t/galera_gtid-master.opt
+++ b/mysql-test/suite/galera/t/galera_gtid-master.opt
@@ -1 +1 @@
---log-bin --log-slave-updates
+--log-bin --log-slave-updates --loose-new-servers-for-galera_gtid-test
diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.test b/mysql-test/suite/galera/t/galera_gtid_slave.test
index 19bfd8e17db..df55ea03cb0 100644
--- a/mysql-test/suite/galera/t/galera_gtid_slave.test
+++ b/mysql-test/suite/galera/t/galera_gtid_slave.test
@@ -8,18 +8,19 @@
#
--source include/have_innodb.inc
-
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
---connection node_1
+--connection node_3
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
@@ -49,31 +50,43 @@ INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
SELECT @@global.gtid_binlog_state;
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
--source include/wait_condition.inc
INSERT INTO t1 VALUES(4);
SELECT @@global.gtid_binlog_state;
---connection node_1
+--connection node_3
DROP TABLE t1,t2;
+#
+# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
+# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
+# warning is also reported by MTR, which is also weird.
+#
+
+--sleep 1
+
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
---connection node_3
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
+SET GLOBAL wsrep_on=OFF;
reset master;
+SET GLOBAL wsrep_on=ON;
---connection node_3
+--connection node_1
+SET GLOBAL wsrep_on=OFF;
reset master;
+SET GLOBAL wsrep_on=ON;
---connection node_1
+--connection node_3
reset master;
diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test
index 3fe94ad16b7..d03445d537a 100644
--- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test
+++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test
@@ -8,21 +8,21 @@
--source include/big_test.inc
--source include/have_innodb.inc
-# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
+# we open the node_3 connection here
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--echo #Connection 2
--connection node_2
--disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1,master_use_gtid=slave_pos;
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3,master_use_gtid=slave_pos;
--enable_query_log
START SLAVE;
--sleep 1
-
---echo #Connection 1
---connection node_1
+--echo #Connection 3
+--connection node_3
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB;
INSERT INTO t2 VALUES(1,11);
INSERT INTO t2 VALUES(2,22);
@@ -30,7 +30,6 @@ INSERT INTO t2 VALUES(3,33);
SELECT @@global.gtid_binlog_state;
--source include/save_master_gtid.inc
-
--echo #Connection 2
--connection node_2
--source include/sync_with_master_gtid.inc
@@ -40,9 +39,8 @@ INSERT INTO t2 VALUES(4,44);
INSERT INTO t2 VALUES(5,55);
INSERT INTO t2 VALUES(6,66);
SELECT @@global.gtid_binlog_state;
-
---echo #Connection 3
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--echo #Connection 1
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM t2;
@@ -53,8 +51,8 @@ INSERT INTO t2 VALUES(8,88);
SELECT @@global.gtid_binlog_state;
#Perform SST
---echo #Connection 1
---connection node_1
+--echo #Connection 3
+--connection node_3
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -62,7 +60,6 @@ INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
--source include/save_master_gtid.inc
-
--echo #Connection 2
--connection node_2
--source include/sync_with_master_gtid.inc
@@ -71,22 +68,21 @@ START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
-
---echo #Connection 3
---connection node_3
+--echo #Connection 1
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
---let $node_1= node_2
---let $node_2= node_3
+--let $node_1= node_1
+--let $node_2= node_2
--source include/auto_increment_offset_save.inc
---echo Shutting down server ...
---source include/shutdown_mysqld.inc
-
-
--echo #Connection 2
--connection node_2
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+--echo #Connection 1
+--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SET AUTOCOMMIT=OFF;
@@ -94,51 +90,46 @@ START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
COMMIT;
-
---echo #Connection 3
---connection node_3
+--echo #Connection 2
+--connection node_2
--echo Starting server ...
--source include/start_mysqld.inc
+
--source include/wait_until_ready.inc
--source include/auto_increment_offset_restore.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
-INSERT INTO t1 VALUES ('node3_committed_after');
-INSERT INTO t1 VALUES ('node3_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
COMMIT;
-
---echo #Connection 2
---connection node_2
+--echo #Connection 1
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
--source include/wait_condition.inc
Select * from t1 order by f1;
-
---echo #Connection 3
---connection node_3
+--echo #Connection 2
+--connection node_2
Select * from t1 order by f1;
#SST Done
--sleep 1
+--echo #Connection 1
+--connection node_1
+SELECT @@global.gtid_binlog_state;
--echo #Connection 2
--connection node_2
SELECT @@global.gtid_binlog_state;
-
--echo #Connection 3
--connection node_3
-SELECT @@global.gtid_binlog_state;
-
---echo #Connection 1
---connection node_1
SET AUTOCOMMIT=ON;
#drop table t1;
#CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
-
--echo #Connection 2
--connection node_2
SET AUTOCOMMIT=ON;
---echo #Connection 3
---connection node_3
+--echo #Connection 1
+--connection node_1
SET AUTOCOMMIT=ON;
#
@@ -148,10 +139,9 @@ SET AUTOCOMMIT=ON;
STOP slave;
--sleep 1
INSERT INTO t1 VALUES ('node2_slave_stoped');
-
---echo #Connection 1
---connection node_1
-INSERT INTO t1 VALUES ('node1_normal_entry');
+--echo #Connection 3
+--connection node_3
+INSERT INTO t1 VALUES ('node3_normal_entry');
--source include/save_master_gtid.inc
#start slave
@@ -163,16 +153,14 @@ start slave;
INSERT INTO t1 VALUES ('node2_slave_started');
SELECT count(*) from t1;
SELECT @@global.gtid_binlog_state;
-
---echo #Connection 3
---connection node_3
+--echo #Connection 1
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 12 FROM t1;
--source include/wait_condition.inc
SELECT count(*) from t1;
SELECT @@global.gtid_binlog_state;
-
---echo #Connection 1
---connection node_1
+--echo #Connection 3
+--connection node_3
DROP TABLE t2,t1;
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
@@ -181,27 +169,31 @@ DROP TABLE t2,t1;
#
--sleep 3
-
--echo #Connection 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
-
---echo #Connection 3
---connection node_3
+--echo #Connection 1
+--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
-
--echo #Connection 2
--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
+set global wsrep_on=OFF;
reset master;
+set global wsrep_on=ON;
---echo #Connection 3
---connection node_3
-reset master;
+--disable_warnings
+set global gtid_slave_pos="";
+--enable_warnings
--echo #Connection 1
--connection node_1
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+--echo #Connection 3
+--connection node_3
reset master;
diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf
index 41a1aab382b..7979b23e085 100644
--- a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf
+++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld]
-wsrep_sst_method=xtrabackup-v2
+wsrep_sst_method=mariabackup
wsrep_sst_auth=root:
innodb_flush_log_at_trx_commit=0
@@ -11,4 +11,3 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
-
diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test
index 07838702deb..fd362a26840 100644
--- a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test
+++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test
@@ -7,6 +7,7 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--source include/have_mariabackup.inc
--source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf
index a762b939f69..75dff78149d 100644
--- a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld]
-wsrep_sst_method=xtrabackup-v2
+wsrep_sst_method=mariabackup
wsrep_sst_auth=root:
[mysqld.1]
diff --git a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_ist_mariabackup.test
index 34961765008..6ef4f65ccd4 100644
--- a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup.test
@@ -1,7 +1,7 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source include/have_xtrabackup.inc
+--source include/have_mariabackup.inc
--let $node_1=node_1
--let $node_2=node_2
@@ -12,4 +12,5 @@
--source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc
+
--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf
new file mode 100644
index 00000000000..1542376b2b8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf
@@ -0,0 +1,14 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=mariabackup
+wsrep_sst_auth=root:
+
+innodb_flush_log_at_trx_commit=0
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test
new file mode 100644
index 00000000000..fd362a26840
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test
@@ -0,0 +1,13 @@
+#
+# This test performs server kill and IST while innodb_flush_logs_on_trx_commit = 0
+# This confirms that IST can properly catch up even in the face of relaxed single-node durability
+#
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_mariabackup.inc
+
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_ist_progress.test b/mysql-test/suite/galera/t/galera_ist_progress.test
index 3ba63415c28..dd93161eab8 100644
--- a/mysql-test/suite/galera/t/galera_ist_progress.test
+++ b/mysql-test/suite/galera/t/galera_ist_progress.test
@@ -58,8 +58,8 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
--let $assert_only_after = Need state transfer
---let $assert_text = Receiving IST: 11 writesets, seqnos
---let $assert_select = Receiving IST: 11 writesets, seqnos
+--let $assert_text = Receiving IST: 1[13] writesets
+--let $assert_select = Receiving IST: 1[13] writesets
--source include/assert_grep.inc
--let $assert_text = Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete
diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
index 633318629a6..42f210170bc 100644
--- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
+++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
@@ -7,7 +7,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
# This could cause out of storage if run /dev/shm
--source include/big_test.inc
@@ -43,8 +43,6 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
# ... and restart provider to force IST
--echo Loading wsrep_provider ...
--disable_query_log
-# base_port setting is lost for some reason when unloading provider, so we need to restore it
---eval SET GLOBAL wsrep_provider_options= 'base_port=$NODE_GALERAPORT_2';
--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
# Make sure IST will block ...
--let $galera_sync_point = recv_IST_after_apply_trx
diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test
index d04b72bce0a..b66e0bcbbd0 100644
--- a/mysql-test/suite/galera/t/galera_kill_applier.test
+++ b/mysql-test/suite/galera/t/galera_kill_applier.test
@@ -6,7 +6,6 @@
--source include/have_innodb.inc
--connection node_1
---sleep 2
--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE IS NULL LIMIT 1`
--disable_query_log
diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test
index 2f0faa761c5..57df53e29b1 100644
--- a/mysql-test/suite/galera/t/galera_log_bin.test
+++ b/mysql-test/suite/galera/t/galera_log_bin.test
@@ -36,4 +36,6 @@ DROP TABLE t1;
DROP TABLE t2;
--connection node_1
+SET GLOBAL wsrep_on=OFF;
RESET MASTER;
+SET GLOBAL wsrep_on=ON;
diff --git a/mysql-test/suite/galera/t/galera_many_rows.cnf b/mysql-test/suite/galera/t/galera_many_rows.cnf
new file mode 100644
index 00000000000..24c4cc1c60d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_many_rows.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+innodb-status-output=ON
+innodb-status-output-locks=ON
+
+[mysqld.2]
+innodb-status-output=ON
+innodb-status-output-locks=ON
+
diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test
index 58ba85e1b9e..67e2eb6edbf 100644
--- a/mysql-test/suite/galera/t/galera_many_rows.test
+++ b/mysql-test/suite/galera/t/galera_many_rows.test
@@ -3,6 +3,11 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
--connection node_1
SET SESSION innodb_lock_wait_timeout=600;
SET SESSION lock_wait_timeout=600;
@@ -52,3 +57,5 @@ COMMIT;
DROP TABLE t1;
DROP TABLE ten;
+
+--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_migrate.cnf b/mysql-test/suite/galera/t/galera_migrate.cnf
index ed48f208e52..2e1e9f161a9 100644
--- a/mysql-test/suite/galera/t/galera_migrate.cnf
+++ b/mysql-test/suite/galera/t/galera_migrate.cnf
@@ -29,11 +29,13 @@ wsrep_sync_wait = 15
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+log-slave-updates
[mysqld.4]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+log-slave-updates
[ENV]
NODE_MYPORT_1= @mysqld.1.port
diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
index 08ed3fac67e..5a33c16c86e 100644
--- a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
+++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
@@ -32,8 +32,8 @@ INSERT INTO t2 VALUES (1);
--connection node_2a
--sleep 1
SET SESSION wsrep_sync_wait=0;
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%';
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committing%';
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%';
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM t2;
@@ -44,7 +44,7 @@ UNLOCK TABLES;
--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig;
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) = 1 FROM t2;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%';
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
index 644b4687cb3..203d18b85a6 100644
--- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
@@ -12,13 +12,16 @@
--source include/galera_connect.inc
--connection node_1
-CREATE TABLE ten (f1 INTEGER);
+CREATE TABLE ten (f1 INTEGER) engine=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+
--connection node_2
--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
SET GLOBAL wsrep_slave_threads = 4;
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+--source include/wait_condition.inc
--connection node_1
--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
@@ -31,16 +34,18 @@ SET GLOBAL wsrep_slave_threads = 4;
--connection node_1
--reap
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(DISTINCT f1) FROM t1;
--connection node_1a
--reap
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(DISTINCT f1) FROM t1;
--connection node_2
--reap
SELECT COUNT(*) FROM t1;
SELECT COUNT(DISTINCT f1) FROM t1;
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
- USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
--disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test
index 8680d62a36d..d2156cb3577 100644
--- a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test
@@ -42,7 +42,7 @@ while ($count)
SELECT COUNT(*) = 20000 FROM t1;
SELECT COUNT(DISTINCT f1) = 20000 FROM t1;
-SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'wsrep applier committed%';
--disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test
index 2cd840123cf..51bb1355ba4 100644
--- a/mysql-test/suite/galera/t/galera_parallel_simple.test
+++ b/mysql-test/suite/galera/t/galera_parallel_simple.test
@@ -47,7 +47,7 @@ SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%';
--source include/wait_condition.inc
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'applied write set%';
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committing%';
--source include/wait_condition.inc
UNLOCK TABLES;
diff --git a/mysql-test/suite/galera/t/galera_pc_recovery.test b/mysql-test/suite/galera/t/galera_pc_recovery.test
new file mode 100644
index 00000000000..1621414aff5
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_pc_recovery.test
@@ -0,0 +1,102 @@
+#
+# Test the pc.recovery=1 option. Killing all nodes simultaneously and
+# restarting them should succeed and the cluster should re-form.
+#
+
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+# Save galera ports
+--connection node_1
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
+
+--connection node_2
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+# Instruct MTR to not restart the nodes automatically when they are killed
+
+--let $NODE_1_PIDFILE = `SELECT @@pid_file`
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+--let $NODE_2_PIDFILE = `SELECT @@pid_file`
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--exec kill -9 `cat $NODE_1_PIDFILE` `cat $NODE_2_PIDFILE`
+
+# Perform --wsrep-recover and preserve the positions into variables by placing them in $MYSQL_TMP_DIR/galera_wsrep_start_position.inc and then --source'ing it
+
+--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-recover --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.1.log > $MYSQL_TMP_DIR/galera_wsrep_recover.1.log 2>&1
+--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-recover --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.2.log > $MYSQL_TMP_DIR/galera_wsrep_recover.2.log 2>&1
+
+--perl
+ use strict;
+ my $wsrep_start_position1 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
+ chomp($wsrep_start_position1);
+
+ my $wsrep_start_position2 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
+ chomp($wsrep_start_position2);
+
+ die if $wsrep_start_position1 eq '' || $wsrep_start_position2 eq '';
+
+ open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;
+ print FILE "--let \$galera_wsrep_start_position1 = $wsrep_start_position1\n";
+ print FILE "--let \$galera_wsrep_start_position2 = $wsrep_start_position2\n";
+ close FILE;
+EOF
+
+--source $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
+
+if ($galera_wsrep_start_position1 == '') {
+ --die "Could not obtain wsrep_start_position."
+}
+
+if ($galera_wsrep_start_position2 == '') {
+ --die "Could not obtain wsrep_start_position."
+}
+
+--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
+
+# Instruct MTR to perform the actual restart using --wsrep-start-position . Proper --wsrep_cluster_address is used as my.cnf only contains 'gcomm://' for node #1
+
+--exec echo "restart: --wsrep-start-position=$galera_wsrep_start_position1 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--exec echo "restart: --wsrep-start-position=$galera_wsrep_start_position2 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+
+--sleep 5
+--connection node_1
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# Confirm that the cluster has re-formed and data is present
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_2
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
+
+--connection node_1
+CALL mtr.add_suppression("points to own listening address, blacklisting");
+CALL mtr.add_suppression("non weight changing install in S_PRIM");
+CALL mtr.add_suppression("No re-merged primary component found");
+
+--connection node_2
+CALL mtr.add_suppression("points to own listening address, blacklisting");
+CALL mtr.add_suppression("non weight changing install in S_PRIM");
+CALL mtr.add_suppression("No re-merged primary component found");
diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test
index a85a2ad9b8d..91a2cc326a2 100644
--- a/mysql-test/suite/galera/t/galera_split_brain.test
+++ b/mysql-test/suite/galera/t/galera_split_brain.test
@@ -1,6 +1,8 @@
#
-# Confirm that with two nodes, killing one causes the other to stop accepting connections
-# The pc.ignore_sb=true wsrep_provider option is tested in the galera_kill_* tests.
+# Confirm that with two nodes, killing one causes the other to stop accepting
+# connections.
+# The pc.ignore_sb=true wsrep_provider option is tested in the galera_kill_*
+# tests.
#
--source include/galera_cluster.inc
diff --git a/mysql-test/suite/galera/t/galera_ssl.cnf b/mysql-test/suite/galera/t/galera_ssl.cnf
index 1c22580cc15..de57c9ffbf0 100644
--- a/mysql-test/suite/galera/t/galera_ssl.cnf
+++ b/mysql-test/suite/galera/t/galera_ssl.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld.1]
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
[mysqld.2]
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.cnf b/mysql-test/suite/galera/t/galera_ssl_compression.cnf
index d6fd2c4d510..4dffe99bd5a 100644
--- a/mysql-test/suite/galera/t/galera_ssl_compression.cnf
+++ b/mysql-test/suite/galera/t/galera_ssl_compression.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld.1]
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.ssl_compression=YES'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES'
[mysqld.2]
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.ssl_compression=YES'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES'
diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf
index 2954ae0f4cb..3fd1c650c05 100644
--- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf
+++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld.1]
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
[mysqld.2]
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test
index a424942da30..2ce932b5398 100644
--- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test
+++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test
@@ -14,7 +14,7 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N
--connection node_1
--source include/shutdown_mysqld.inc
---let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem
+--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/cakey.pem
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
@@ -46,4 +46,8 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+# 5. Make sure node_2 is ready as well
+--connection node_2
+--source include/galera_wait_ready.inc
+
# Upgrade complete. Both nodes now use the new key and certificate
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_data_dir.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf
index 89f23d24d87..aeb2301925e 100644
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_data_dir.cnf
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld]
-wsrep_sst_method=xtrabackup-v2
+wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
wsrep_debug=ON
@@ -9,8 +9,9 @@ wsrep_debug=ON
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
[mysqld.2]
-innodb_data_home_dir=@ENV.MYSQL_TMP_DIR/rsync_test_2
+innodb_data_home_dir=@ENV.MYSQL_TMP_DIR/data_dir_test
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
[sst]
transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=xbstream
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_data_dir.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.test
index 135bc2a39f7..aad68460c34 100644
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_data_dir.test
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.test
@@ -1,7 +1,7 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source include/have_xtrabackup.inc
+--source include/have_mariabackup.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
@@ -20,4 +20,4 @@
--source include/galera_end.inc
# cleanup temporary database files:
---remove_files_wildcard $MYSQL_TMP_DIR/rsync_test_2 *
+--remove_files_wildcard $MYSQL_TMP_DIR/data_dir_test *
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf
new file mode 100644
index 00000000000..646d7322b41
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=mariabackup
+wsrep_sst_auth="root:"
+wsrep_debug=ON
+
+[SST]
+tkey=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem
+tcert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
+encrypt=3
+transferfmt=@ENV.MTR_GALERA_TFMT
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.test
index 2f685ca7184..4449ea43c43 100644
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.test
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_encrypt_with_key.test
@@ -1,12 +1,12 @@
#
-# This test checks that key and cert encryption options can be passed to xtrabackup via the my.cnf file
-# Initial SST happens via xtrabackup, so there is not much to do in the body of the test
+# This test checks that key and cert encryption options can be passed to mariabackup via the my.cnf file
+# Initial SST happens via mariabackup, so there is not much to do in the body of the test
#
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source include/have_xtrabackup.inc
+--source include/have_mariabackup.inc
SELECT 1;
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
index 0025b259ec5..336296e9bfe 100644
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld]
-wsrep_sst_method=xtrabackup-v2
+wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
wsrep_debug=ON
@@ -13,3 +13,4 @@ wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore
[sst]
transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=xbstream
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test
new file mode 100644
index 00000000000..9d4f50f66ee
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test
@@ -0,0 +1,229 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_filekeymanagement.inc
+--source include/innodb_encrypt_tables.inc
+--source include/innodb_page_size_small.inc
+--source include/have_mariabackup.inc
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
+--echo Performing State Transfer on a server that starts from a clean var directory
+--echo This is accomplished by shutting down node #2 and removing its var directory before restarting it
+
+--connection node_1
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1;
+CREATE TABLE t3 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=NO;
+CREATE TABLE t4 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES;
+CREATE TABLE t5 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+CREATE TABLE t6 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO;
+CREATE TABLE t7 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES;
+CREATE TABLE t8 (f1 CHAR(255)) ENGINE=InnoDB ENCRYPTED=NO;
+CREATE TABLE t9 (f1 CHAR(255)) ENGINE=InnoDB ENCRYPTED=YES;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+let $tables = 9;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node1_committed_before');
+ dec $rows;
+ }
+ dec $tables;
+}
+COMMIT;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t7;
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+let $tables = 9;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node2_committed_before');
+ dec $rows;
+ }
+ dec $tables;
+}
+COMMIT;
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--echo Cleaning var directory ...
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+let $tables = 9;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node1_committed_during');
+ dec $rows;
+ }
+ dec $tables;
+}
+COMMIT;
+
+START TRANSACTION;
+let $tables = 9;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node1_to_be_committed_after');
+ dec $rows;
+ }
+ dec $tables;
+}
+
+--connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+let $tables = 9;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node1_to_be_rollbacked_after');
+ dec $rows;
+ }
+ dec $tables;
+}
+
+--connection node_2
+--echo Starting server ...
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node2_committed_after');
+ dec $rows;
+ }
+ dec $tables;
+}
+COMMIT;
+
+--connection node_1
+let $tables = 9;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node1_to_be_committed_after');
+ dec $rows;
+ }
+ dec $tables;
+}
+COMMIT;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+let $tables = 9;
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node1_committed_after');
+ dec $rows;
+ }
+ dec $tables;
+}
+COMMIT;
+
+--connection node_1a_galera_st_clean_slave
+while ($tables)
+{
+ let $rows = 5;
+ while($rows)
+ {
+ eval insert into t$tables values ('node1_to_be_rollbacked_after');
+ dec $rows;
+ }
+ dec $tables;
+}
+ROLLBACK;
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t3;
+SELECT COUNT(*) FROM t4;
+SELECT COUNT(*) FROM t5;
+SELECT COUNT(*) FROM t6;
+SELECT COUNT(*) FROM t7;
+SELECT COUNT(*) FROM t8;
+SELECT COUNT(*) FROM t9;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t4;
+SELECT * FROM t5;
+SELECT * FROM t6;
+SELECT * FROM t7;
+SELECT * FROM t8;
+SELECT * FROM t9;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+--connection node_1
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t3;
+SELECT COUNT(*) FROM t4;
+SELECT COUNT(*) FROM t5;
+SELECT COUNT(*) FROM t6;
+SELECT COUNT(*) FROM t7;
+SELECT COUNT(*) FROM t8;
+SELECT COUNT(*) FROM t9;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t4;
+SELECT * FROM t5;
+SELECT * FROM t6;
+SELECT * FROM t7;
+SELECT * FROM t8;
+SELECT * FROM t9;
+COMMIT;
+
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+# Restore original auto_increment_offset values.
+--source include/auto_increment_offset_restore.inc
+--source include/galera_end.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf
index 574ae28b54a..0d05038f2fb 100644
--- a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf
+++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf
@@ -5,7 +5,7 @@
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
-
+wsrep_sync_wait=0
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
-
+wsrep_sync_wait=0
diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.test b/mysql-test/suite/galera/t/galera_sst_mysqldump.test
index 835fac94a68..cce4d374a6d 100644
--- a/mysql-test/suite/galera/t/galera_sst_mysqldump.test
+++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.test
@@ -1,6 +1,5 @@
--source include/big_test.inc
--source include/galera_cluster.inc
-
--source suite/galera/include/galera_sst_set_mysqldump.inc
--let $node_1=node_1
@@ -14,7 +13,6 @@
--source suite/galera/include/galera_st_shutdown_slave.inc
--source suite/galera/include/galera_st_clean_slave.inc
-
--source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf
index 44e5573b3e6..b7bca487fc5 100644
--- a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf
+++ b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf
@@ -5,9 +5,13 @@
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+wsrep_causal_reads=0
+wsrep_sync_wait=0
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
+wsrep_causal_reads=0
+wsrep_sync_wait=0
[mysqld]
wsrep_debug=ON
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.cnf b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.cnf
deleted file mode 100644
index 3abf2549aae..00000000000
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.cnf
+++ /dev/null
@@ -1,25 +0,0 @@
-!include ../galera_2nodes.cnf
-
-[mysqld]
-wsrep_sst_method=xtrabackup-v2
-wsrep_sst_auth="root:"
-wsrep_debug=ON
-
-[xtrabackup]
-backup-locks
-close-files
-#compact - disabled in xtrabackup 2.4, https://bugs.launchpad.net/percona-xtrabackup/+bug/1192834/comments/29
-# compression requires qpress from the Percona repositories
-# compress
-# compress-threads=2
-encryption=AES256
-encrypt-key=4FA92C5873672E20FB163A0BCB2BB4A4
-galera-info
-history=backup
-parallel=2
-
-[SST]
-encrypt=1
-encrypt-algo=AES256
-encrypt-key=4FA92C5873672E20FB163A0BCB2BB4A4
-transferfmt=@ENV.MTR_GALERA_TFMT
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.test
deleted file mode 100644
index db2b706b6b8..00000000000
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2-options.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# This test checks that various options can be passed to xtrabackup via the my.cnf file
-# Initial SST happens via xtrabackup, so there is not much to do in the body of the test
-#
-
---source include/galera_cluster.inc
---source include/have_innodb.inc
---source include/have_xtrabackup.inc
-
-SELECT 1;
-
---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
---source include/wait_condition.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test
deleted file mode 100644
index c270e4d0b19..00000000000
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test
+++ /dev/null
@@ -1,20 +0,0 @@
---source include/big_test.inc
---source include/galera_cluster.inc
---source include/have_innodb.inc
---source include/have_xtrabackup.inc
-
-# Save original auto_increment_offset values.
---let $node_1=node_1
---let $node_2=node_2
---source include/auto_increment_offset_save.inc
-
---source suite/galera/include/galera_st_shutdown_slave.inc
---source suite/galera/include/galera_st_clean_slave.inc
-
---source suite/galera/include/galera_st_kill_slave.inc
---source suite/galera/include/galera_st_kill_slave_ddl.inc
-
-# Restore original auto_increment_offset values.
---source include/auto_increment_offset_restore.inc
-
---source include/galera_end.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.cnf
deleted file mode 100644
index 63d05104a37..00000000000
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2_encrypt_with_key.cnf
+++ /dev/null
@@ -1,12 +0,0 @@
-!include ../galera_2nodes.cnf
-
-[mysqld]
-wsrep_sst_method=xtrabackup-v2
-wsrep_sst_auth="root:"
-wsrep_debug=ON
-
-[SST]
-tkey=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem
-tcert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem
-encrypt=3
-transferfmt=@ENV.MTR_GALERA_TFMT
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_error.test b/mysql-test/suite/galera/t/galera_toi_ddl_error.test
index c586d97bdb5..6ee2a6e9b16 100644
--- a/mysql-test/suite/galera/t/galera_toi_ddl_error.test
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_error.test
@@ -27,3 +27,8 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP TABLE ten;
+
+CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query.");
+
+--connection node_2
+CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query."); \ No newline at end of file
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_locking.test b/mysql-test/suite/galera/t/galera_toi_ddl_locking.test
index 12c83a1f87a..22a45316306 100644
--- a/mysql-test/suite/galera/t/galera_toi_ddl_locking.test
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_locking.test
@@ -11,20 +11,31 @@
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
---connection node_1
-SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
---send ALTER TABLE t1 ADD COLUMN f2 INTEGER;
-
--let $galera_connection_name = node_1a
--let $galera_server_number = 1
--source include/galera_connect.inc
+SET SESSION wsrep_sync_wait = 0;
--let $galera_connection_name = node_1b
--let $galera_server_number = 1
--source include/galera_connect.inc
+# node_1c tests write to unrelated table trough a transaction
+--let $galera_connection_name = node_1c
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--connection node_1
+SET DEBUG_SYNC= 'RESET';
+SET DEBUG_SYNC = 'alter_table_before_open_tables SIGNAL before_open_tables WAIT_FOR continue';
+--send ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
--connection node_1a
-SET SESSION wsrep_sync_wait = 0;
+SET DEBUG_SYNC= 'now WAIT_FOR before_open_tables';
+
+# if we would retry the insert, it would fail for wrong column count
+# on second try
+SET wsrep_retry_autocommit=0;
# Allowed
SELECT COUNT(*) = 0 FROM t1;
@@ -32,45 +43,56 @@ SELECT COUNT(*) = 0 FROM t1;
# Allowed
SELECT COUNT(*) = 0 FROM t2;
-# Not allowed
---error ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
-INSERT INTO t1 VALUES (1);
+# Not allowed, this will hang because of ALTER
+--send INSERT INTO t1 VALUES (1);
+
+--connection node_1c
+SET SESSION wsrep_sync_wait = 0;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
# Allowed
+SELECT COUNT(*) = 0 FROM t1;
+
+# Allowed
+SELECT COUNT(*) = 0 FROM t2;
+
+# Allowed (until commit)
INSERT INTO t2 VALUES (1);
# Hangs
--send COMMIT;
---sleep 1
--connection node_1b
SET SESSION wsrep_sync_wait = 0;
# The Commit issued above is still not done
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit';
+--sleep 1
SELECT COUNT(*) = 0 FROM t2;
+
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit';
+
SET DEBUG_SYNC= 'now SIGNAL continue';
--connection node_1a
+--error ER_LOCK_DEADLOCK
+--reap
+
+--connection node_1c
+# this will succeeed, becaus the query will be replayed
--reap
--connection node_1
--reap
+
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 1 FROM t2;
+SET debug_sync='RESET';
--connection node_2
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 1 FROM t2;
---connection node_1
-SET DEBUG_SYNC= 'RESET';
-
---connection node_1b
-SET DEBUG_SYNC= 'RESET';
-
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/galera_transaction_replay.test b/mysql-test/suite/galera/t/galera_transaction_replay.test
index 29870829ba3..655714f26c9 100644
--- a/mysql-test/suite/galera/t/galera_transaction_replay.test
+++ b/mysql-test/suite/galera/t/galera_transaction_replay.test
@@ -1,12 +1,25 @@
#
-# This test tests the operation of transaction replay. If a potentially conflicting remote transaction arrives at
-# just the right time during the commit of a local transaction, the local transaction will be aborted and replayed.
+# This test tests the operation of transaction replay. If a potentially
+# conflicting remote transaction arrives at just the right time during
+# the commit of a local transaction, the local transaction will be aborted
+# and replayed.
+#
+# Because the write set with higher sequence number cannot BF abort
+# the victim with lower sequence number, the conflicting remote transaction
+# must be executed first and must be allowed to proceed up to the apply
+# monitor before sending the COMMIT for the transaction to be replayed.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+######################################################################
+#
+# Scenario #1, the victim will have higher seqno and will be replayed
+#
+######################################################################
--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
@@ -21,34 +34,123 @@ START TRANSACTION;
UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
-# Block the commit
+# Block the applier on node #1 and issue a conflicting update on node #2
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
---let $galera_sync_point = commit_monitor_enter_sync
+SET SESSION wsrep_sync_wait=0;
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_2
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# Block the commit, send the COMMIT and wait until it gets blocked
+
+--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_set_sync_point.inc
--connection node_1
---send COMMIT;
+--send COMMIT
-# Wait until commit is blocked
--connection node_1a
-SET SESSION wsrep_sync_wait = 0;
+
+--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# Let the conflicting UPDATE proceed and wait until it hits abort_trx_end.
+# The victim transaction still sits in commit_monitor_master_sync_point.
+
+--let $galera_sync_point = abort_trx_end
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync
--source include/galera_wait_sync_point.inc
-# Issue a conflicting update on node #2
+# Let the transactions proceed
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_signal_sync_point.inc
+
+# Commit succeeds
+--connection node_1
+--reap
+
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+# wsrep_local_replays has increased by 1
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
--connection node_2
-UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+DROP TABLE t1;
+
+#########################################################################
+#
+# Scenario #2, the victim will have lower seqno and will not be replayed
+#
+#########################################################################
+
+--connection node_1
+
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+
+--connection node_1
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+
+# Block the commit, send the COMMIT and wait until it gets blocked
+
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+--send COMMIT
-# Wait for both transactions to be blocked
--connection node_1a
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Update_rows_log_event::find_row%';
---source include/wait_condition.inc
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'init' AND INFO = 'COMMIT';
---source include/wait_condition.inc
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+
+# Set sync point at the end of BF abort, issue a conflicting update
+# and wait for the conflicting update to hit the sync point.
+--let $galera_sync_point = abort_trx_end
+--source include/galera_set_sync_point.inc
+
+--connection node_2
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
-# Unblock the commit
--connection node_1a
+--let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# Let the transactions proceed
--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_signal_sync_point.inc
# Commit succeeds
@@ -58,10 +160,10 @@ UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
-# wsrep_local_replays has increased by 1
+# wsrep_local_replays should have not increased
--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
--disable_query_log
---eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 0 AS wsrep_local_replays;
--enable_query_log
--connection node_2
@@ -70,55 +172,84 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
DROP TABLE t1;
-#echo "# test for PS replaying"
+########################################
#
# test replaying of prepared statements
#
+########################################
+
--connection node_1
+
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
CREATE TABLE t1 (i int primary key, j int) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 0), (3, 0);
SELECT * FROM t1;
-
+SET AUTOCOMMIT=ON;
PREPARE stmt1 FROM "UPDATE t1 SET j = 1 where i > 0";
-# block the commit of PS
+
+# Block the applier on node #1 and issue a conflicting update on node #2
--connection node_1a
---let $galera_sync_point = commit_monitor_enter_sync
+SET SESSION wsrep_sync_wait=0;
+--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_set_sync_point.inc
---connection node_1
---send EXECUTE stmt1;
+--connection node_2
+INSERT INTO t1 VALUES(2,2);
-# Wait until commit is blocked
--connection node_1a
-SET SESSION wsrep_sync_wait = 0;
--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
-# Issue a conflicting update on node_2
---connection node_2
-#UPDATE t1 SET j=2;
-INSERT INTO t1 VALUES(2,2);
+# Block the commit, send the EXECUTE stmt1 and wait until it gets blocked
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
-# Wait until applying begins in node_1
---connection node_1a
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Write_rows_log_event::write_row%';
---source include/wait_condition.inc
+--connection node_1
+SET SESSION wsrep_sync_wait=0;
+--send EXECUTE stmt1
-# Unblock the PS commit
--connection node_1a
+
+--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
+
+# Let the conflicting INSERT proceed and wait until it hits abort_trx_end.
+# The victim transaction still sits in commit_monitor_master_sync_point.
+
+--let $galera_sync_point = abort_trx_end
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+
+# Let the transactions proceed
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_signal_sync_point.inc
# Commit succeeds
--connection node_1
--reap
+SET SESSION wsrep_sync_wait=7;
SELECT * FROM t1;
--connection node_2
SELECT * FROM t1;
--connection node_1
+# wsrep_local_replays has increased by 1
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
DEALLOCATE PREPARE stmt1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_cluster_address.test b/mysql-test/suite/galera/t/galera_var_cluster_address.test
index 6d99d35cdac..85ae73ffda4 100644
--- a/mysql-test/suite/galera/t/galera_var_cluster_address.test
+++ b/mysql-test/suite/galera/t/galera_var_cluster_address.test
@@ -19,8 +19,8 @@
SET GLOBAL wsrep_cluster_address = 'foo://';
# With wsrep_sync_wait, this returns an error
-#--error ER_LOCK_WAIT_TIMEOUT
-#SHOW STATUS;
+--error ER_LOCK_WAIT_TIMEOUT
+SHOW STATUS;
SET SESSION wsrep_sync_wait=0;
@@ -29,7 +29,7 @@ SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
# Must return 'OFF'
SHOW STATUS LIKE 'wsrep_ready';
-# Must return 'Non-primary'
+# Must return 'Disconnected'
SHOW STATUS LIKE 'wsrep_cluster_status';
# Must return 0 = 'Initialized'
@@ -49,10 +49,9 @@ SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA
--connection node_2
--disable_query_log
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node2';
+--source include/galera_wait_ready.inc
--enable_query_log
---source include/wait_until_connected_again.inc
-
--connection node_1
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
@@ -63,7 +62,7 @@ CALL mtr.add_suppression("Failed to initialize backend using 'foo");
CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo");
CALL mtr.add_suppression("gcs connect failed: Socket type not supported");
CALL mtr.add_suppression("wsrep::connect\\(\\) failed: 7");
-CALL mtr.add_suppression("gcs_caused\\(\\) returned -103 \\(Software caused connection abort\\)");
+CALL mtr.add_suppression("gcs_caused\\(\\) returned -[0-9]+ \\(Software caused connection abort\\)");
CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed to reach primary view: 110");
CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
CALL mtr.add_suppression("gcs connect failed: Connection timed out");
diff --git a/mysql-test/suite/galera/t/galera_var_dirty_reads.test b/mysql-test/suite/galera/t/galera_var_dirty_reads.test
index 1f01c4aac07..859642a6fdf 100644
--- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test
+++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test
@@ -11,11 +11,6 @@
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
-# Save original auto_increment_offset values.
---let $node_1=node_1
---let $node_2=node_2
---source include/auto_increment_offset_save.inc
-
--connection node_2
--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
@@ -32,7 +27,7 @@ SET SESSION wsrep_sync_wait=0;
# Must return 'OFF'
SHOW STATUS LIKE 'wsrep_ready';
-# Must return 'Non-primary'
+# Must return 'Disconnected'
SHOW STATUS LIKE 'wsrep_cluster_status';
--error ER_UNKNOWN_COM_ERROR
@@ -53,6 +48,7 @@ SET @@session.wsrep_dirty_reads=OFF;
--error ER_UNKNOWN_COM_ERROR
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
+
SELECT 1;
USE information_schema;
@@ -65,6 +61,7 @@ SELECT COUNT(*) >= 10 FROM performance_schema.events_statements_history;
--eval SET @@global.wsrep_cluster_address = '$wsrep_cluster_address_saved'
--enable_query_log
--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
--connection node_1
USE test;
@@ -72,8 +69,7 @@ SELECT * FROM t1;
# Cleanup
DROP TABLE t1;
+# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc
---echo # End of test
-
diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test
new file mode 100644
index 00000000000..ddf561c8784
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test
@@ -0,0 +1,235 @@
+#
+# Test option wsrep_ignore_apply_errors
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+
+#
+# Ignore reconciling DDL errors on node_2
+#
+
+--connection node_2
+SET GLOBAL wsrep_ignore_apply_errors = 1;
+
+# Drop table that does not exist
+--connection node_1
+SET GLOBAL wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = ON;
+DROP TABLE t1;
+
+# Drop schema that does not exist
+SET GLOBAL wsrep_on = OFF;
+CREATE SCHEMA s1;
+SET GLOBAL wsrep_on = ON;
+DROP SCHEMA s1;
+
+# Drop index that does not exist using DROP INDEX
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+CREATE INDEX idx1 ON t1 (f1);
+SET GLOBAL wsrep_on = ON;
+DROP INDEX idx1 ON t1;
+DROP TABLE t1;
+
+# Drop index that does not exist using ALTER TABLE
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+CREATE INDEX idx1 ON t1 (f1);
+SET GLOBAL wsrep_on = ON;
+ALTER TABLE t1 DROP INDEX idx1;
+DROP TABLE t1;
+
+# Drop column that does not exist
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET GLOBAL wsrep_on = ON;
+ALTER TABLE t1 DROP COLUMN f2;
+DROP TABLE t1;
+
+
+#
+# Ignore reconciling DML errors on node_2
+#
+
+--connection node_2
+SET GLOBAL wsrep_ignore_apply_errors = 2;
+
+# Delete row that does not exist
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+DELETE FROM t1 WHERE f1 = 1;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+DROP TABLE t1;
+
+# Delete row that does not exist in a multi statement transaction
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (2);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+START TRANSACTION;
+INSERT INTO t1 VALUES (3);
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+COMMIT;
+
+--connection node_1
+SELECT COUNT(*) = 1 FROM t1;
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
+
+#
+# Multi-row delete where only one row does not exist
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+SET SESSION wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+--connection node_1
+DELETE FROM t1;
+
+SELECT COUNT(*) = 0 FROM t1;
+--connection node_2
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT COUNT(*) = 0 FROM t1;
+DROP TABLE t1;
+
+#
+# Multi-statement delete where only one row does not exist
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+SET SESSION wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+--connection node_1
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 3;
+DELETE FROM t1 WHERE f1 = 4;
+DELETE FROM t1 WHERE f1 = 5;
+COMMIT;
+SET AUTOCOMMIT=ON;
+
+SELECT COUNT(*) = 0 FROM t1;
+--connection node_2
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT COUNT(*) = 0 FROM t1;
+DROP TABLE t1;
+
+#
+# Multi-table delete
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t2;
+--source include/wait_condition.inc
+
+SET SESSION wsrep_on = OFF;
+DELETE FROM t2 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+
+--connection node_1
+DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT COUNT(*) = 0 FROM t1;
+DROP TABLE t1,t2;
+
+#
+# Foreign keys
+#
+
+--connection node_1
+CREATE TABLE parent (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+INSERT INTO parent VALUES (1),(2),(3);
+CREATE TABLE child (id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE) ENGINE=INNODB;
+INSERT INTO child VALUES (1,1),(2,2),(3,3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 3 FROM child;
+--source include/wait_condition.inc
+
+SET SESSION wsrep_on = OFF;
+DELETE FROM child WHERE parent_id = 2;
+SET SESSION wsrep_on = ON;
+
+--connection node_1
+DELETE FROM parent;
+SELECT COUNT(*) = 0 FROM parent;
+SELECT COUNT(*) = 0 FROM child;
+
+--connection node_2
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT COUNT(*) = 0 FROM parent;
+SELECT COUNT(*) = 0 FROM child;
+DROP TABLE child, parent;
+
+#
+# Ignore all DDL errors on node_2
+#
+
+--connection node_2
+SET GLOBAL wsrep_ignore_apply_errors = 4;
+
+# Create a table that already exists
+--connection node_2
+SET GLOBAL wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = ON;
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
+DROP TABLE t1;
+
+
+--connection node_2
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+
+CALL mtr.add_suppression("Can't find record in 't.*'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t1'' on query. Default database: 'test'. Query: 'DROP TABLE t1', Error_code: 1051");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't drop database 's1'; database doesn't exist' on query. Default database: 'test'. Query: 'DROP SCHEMA s1', Error_code: 1008");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query. Default database: 'test'. Query: 'DROP INDEX idx1 ON t1', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query.");
diff --git a/mysql-test/suite/galera/t/galera_var_log_bin.cnf b/mysql-test/suite/galera/t/galera_var_log_bin.cnf
index f7f17e3720a..30ccee2024e 100644
--- a/mysql-test/suite/galera/t/galera_var_log_bin.cnf
+++ b/mysql-test/suite/galera/t/galera_var_log_bin.cnf
@@ -3,3 +3,8 @@
[mysqld]
log-bin
+[mysqld.1]
+log-slave-updates
+
+[mysqld.2]
+log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test
index 6859855c35f..8b80c04e3be 100644
--- a/mysql-test/suite/galera/t/galera_var_reject_queries.test
+++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test
@@ -18,8 +18,11 @@ SET GLOBAL wsrep_reject_queries = ALL;
--error ER_UNKNOWN_COM_ERROR
SELECT * FROM t1;
-# Lost connection
---error 2013
+#
+# Original behavior was lost connection,
+# but since 10.1, we allow controlling connection to remain alive
+#
+--error 0,2013
SET GLOBAL wsrep_reject_queries = ALL_KILL;
--connection node_1a
diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
index 142f02546b4..df541b774a4 100644
--- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
+++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
@@ -16,11 +16,11 @@
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 0;
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue';
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
--send INSERT INTO t1 (f1) VALUES (2)
--connection node_1a
-SET DEBUG_SYNC = 'now WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2
TRUNCATE TABLE t1;
@@ -42,11 +42,11 @@ DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1;
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue';
---send INSERT INTO t1 (f1) VALUES (2)
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
+--send INSERT INTO t1 (f1) VALUES (3)
--connection node_1a
-SET DEBUG_SYNC = 'now WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2
TRUNCATE TABLE t1;
@@ -68,12 +68,12 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue EXECUTE 2';
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 2';
---send INSERT INTO t1 VALUES (2);
+--send INSERT INTO t1 VALUES (4);
--connection node_1a
-SET DEBUG_SYNC = 'now WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2
TRUNCATE TABLE t1;
@@ -81,7 +81,7 @@ TRUNCATE TABLE t1;
--connection node_1a
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) = 0 FROM t1;
-SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_rep';
+SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert';
--connection node_2
TRUNCATE TABLE t1;
@@ -107,9 +107,9 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 64;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
-SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue EXECUTE 64';
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
---send INSERT INTO t1 VALUES (2)
+--send INSERT INTO t1 VALUES (5)
--disable_query_log
--disable_result_log
@@ -117,7 +117,7 @@ SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL before_rep WAIT_FOR continue E
while ($count)
{
--connection node_1a
- SET DEBUG_SYNC = 'now WAIT_FOR before_rep';
+ SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2
TRUNCATE TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.cnf b/mysql-test/suite/galera/t/galera_var_slave_threads.cnf
new file mode 100644
index 00000000000..889c81b4a0a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+auto_increment_offset=1
+
+[mysqld.2]
+auto_increment_offset=2
diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test
index 80edcb2aff9..12d8006db4b 100644
--- a/mysql-test/suite/galera/t/galera_var_slave_threads.test
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test
@@ -8,6 +8,11 @@
--source include/have_innodb.inc
--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
--connection node_1
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
@@ -21,6 +26,7 @@ SELECT @@wsrep_slave_threads = 1;
SET GLOBAL wsrep_slave_threads = 1;
# There is a separate wsrep_aborter thread at all times
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND COMMAND != 'Daemon';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
#
@@ -33,13 +39,15 @@ SET GLOBAL wsrep_slave_threads = 64;
INSERT INTO t1 VALUES (1);
--connection node_2
---let $wait_timeout=600
---let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
---source include/wait_condition.inc
+SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) = 1 FROM t1;
+#
+# note, in wsrep API #26, we have 2 rollbacker threads, counted as system user's
+#
---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--source include/wait_condition.inc
#
@@ -65,49 +73,122 @@ while ($count)
--connection node_2
SELECT COUNT(*) FROM t2;
---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
---source include/wait_condition.inc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+--source include/wait_condition.inc
---eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig
+--let $wsrep_cluster_address_node2 = `SELECT @@wsrep_cluster_address`
+--let $wsrep_provider_node2 = `SELECT @@wsrep_provider`
-DROP TABLE t1;
-DROP TABLE t2;
+SET GLOBAL wsrep_slave_threads = 5;
---echo #
---echo # lp:1372840 - Changing wsrep_slave_threads causes future connections to hang
---echo #
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+--source include/wait_condition.inc
---connection node_1
-CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB;
+SET GLOBAL wsrep_slave_threads = 1;
+#
+# test phase for bug https://github.com/codership/mysql-wsrep/issues/319
+#
+
+# shutdown node 2
--connection node_2
-SET GLOBAL wsrep_slave_threads = 4;
---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+# wait until node_1 is ready as one node cluster
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--source include/wait_condition.inc
+show status like 'wsrep_cluster_size';
+# step up slave threads to 6, and make sure all appliers and rollbacker thread are running
+SET GLOBAL wsrep_slave_threads = 6;
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+--source include/wait_condition.inc
+
+# change to invalid cluster address
SET GLOBAL wsrep_slave_threads = 1;
+SET GLOBAL wsrep_cluster_address='';
---connection node_1
-INSERT INTO t1 VALUES (DEFAULT);
-INSERT INTO t1 VALUES (DEFAULT);
-INSERT INTO t1 VALUES (DEFAULT);
-DROP TABLE t1;
+# join back to single node cluster
+SET GLOBAL wsrep_cluster_address='gcomm://';
+--source include/wait_until_connected_again.inc
---connection node_2
+# we should have 1 applier thread now
+--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND COMMAND != 'Daemon'
+--source include/wait_condition.inc
-# Wait until above DDL is replicated
---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+# test if we can increase applier count now (fails in bug #319)
+SET GLOBAL wsrep_slave_threads = 10;
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--source include/wait_condition.inc
-SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+# restart node 2
+--connection node_2
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND COMMAND != 'Daemon';
+#
#
-# make sure that we are left with exactly one applier thread before we leaving the test
+# cleanup to original state
#
---let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
+--connection node_1
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig
+
+--connection node_2
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig
+
+
+--disable_result_log
+--disable_query_log
+# Generate 64 replication events, to help node 1 to purge excessive applier threads
+--let $count = 64
+while ($count)
+{
+ INSERT INTO t2 VALUES (DEFAULT);
+ --dec $count
+}
+--enable_query_log
+--enable_result_log
+
+--connection node_1
+--disable_result_log
+--disable_query_log
+# Generate 64 replication events, to help node 2 to purge excessive applier threads
+--let $count = 64
+while ($count)
+{
+ INSERT INTO t2 VALUES (DEFAULT);
+ --dec $count
+}
+--enable_query_log
+--enable_result_log
+
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+--source include/wait_condition.inc
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+
+--connection node_1
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+# Restore original auto_increment_offset values.
+--source include/auto_increment_offset_restore.inc
--echo # End of tests
diff --git a/mysql-test/suite/galera/t/galera_vote_drop_temporary-master.opt b/mysql-test/suite/galera/t/galera_vote_drop_temporary-master.opt
new file mode 100644
index 00000000000..beae84b3862
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_vote_drop_temporary-master.opt
@@ -0,0 +1 @@
+--log-bin
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
index 6ba8ce786c8..28025363019 100644
--- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
+++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
@@ -5,7 +5,6 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#198-master.opt b/mysql-test/suite/galera/t/mysql-wsrep#198-master.opt
new file mode 100644
index 00000000000..beae84b3862
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql-wsrep#198-master.opt
@@ -0,0 +1 @@
+--log-bin
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#237.test b/mysql-test/suite/galera/t/mysql-wsrep#237.test
index cba8dfeb275..174266bdbc5 100644
--- a/mysql-test/suite/galera/t/mysql-wsrep#237.test
+++ b/mysql-test/suite/galera/t/mysql-wsrep#237.test
@@ -7,13 +7,13 @@
CREATE TABLE t (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
--connection node_1
-SET DEBUG_SYNC = 'wsrep_before_replication WAIT_FOR continue';
+SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
--send INSERT INTO t values (1);
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
SET SESSION wsrep_sync_wait = 0;
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: wsrep_before_replication'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: wsrep_before_certification'
--source include/wait_condition.inc
--connection node_2
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#332.test b/mysql-test/suite/galera/t/mysql-wsrep#332.test
index 2da01ba900e..674a5c3de52 100644
--- a/mysql-test/suite/galera/t/mysql-wsrep#332.test
+++ b/mysql-test/suite/galera/t/mysql-wsrep#332.test
@@ -1,7 +1,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
# Open connection node_1a here, MW-369.inc will use it later
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
diff --git a/mysql-test/suite/galera/t/partition.test b/mysql-test/suite/galera/t/partition.test
index bb5a02411c3..13e09a4e3e6 100644
--- a/mysql-test/suite/galera/t/partition.test
+++ b/mysql-test/suite/galera/t/partition.test
@@ -129,11 +129,17 @@ CREATE TABLE t1 (pk INT PRIMARY KEY)
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_2
-SELECT COUNT(*) = 20002 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 20002 FROM t1;
+--source include/wait_condition.inc
-# LOAD-ing 20002 rows causes 3 commits to be registered
+SELECT COUNT(*) FROM t1;
+
+# LOAD-ing 20002 rows causes
+# 3 commits to be registered when the Galera library does not support streaming replication and
+# 5 commits to be registered when the Galera library supports streaming replication
--disable_query_log
---eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 3 AS wsrep_last_committed_diff;
+--replace_result 3 AS_EXPECTED_3_or_5 5 AS_EXPECTED_3_or_5
+--eval SELECT $wsrep_last_committed_after - $wsrep_last_committed_before AS wsrep_last_committed_diff;
--enable_query_log
DROP TABLE t1;
@@ -157,11 +163,14 @@ CREATE TABLE t1 (pk INT PRIMARY KEY)
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_2
-SELECT COUNT(*) = 101 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 101 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) FROM t1;
# LOAD-ing 101 rows causes 1 commit to be registered
--disable_query_log
---eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--eval SELECT $wsrep_last_committed_after - $wsrep_last_committed_before AS wsrep_last_committed_diff;
--enable_query_log
DROP TABLE t1;
@@ -186,11 +195,16 @@ CREATE TABLE t1 (pk INT PRIMARY KEY)
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_2
-SELECT COUNT(*) = 20002 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 20002 FROM t1;
+--source include/wait_condition.inc
+SELECT COUNT(*) FROM t1;
-# LOAD-ing 20002 rows causes 1 commit to be registered
+# LOAD-ing 20002 rows causes
+# 1 commit to be registered when the Galera library does not support streaming replication and
+# 2 commits to be registered when the Galera library supports streaming replication
--disable_query_log
---eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
+--replace_result 1 AS_EXPECTED_1_or_2 2 AS_EXPECTED_1_or_2
+--eval SELECT $wsrep_last_committed_after - $wsrep_last_committed_before AS wsrep_last_committed_diff;
--enable_query_log
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/rpl_row_annotate.test b/mysql-test/suite/galera/t/rpl_row_annotate.test
index b1cfdb36639..0ec30829982 100644
--- a/mysql-test/suite/galera/t/rpl_row_annotate.test
+++ b/mysql-test/suite/galera/t/rpl_row_annotate.test
@@ -3,11 +3,15 @@
--echo # On node_2
--connection node_2
+SET GLOBAL wsrep_on=OFF;
RESET MASTER;
+SET GLOBAL wsrep_on=ON;
--echo # On node_1
--connection node_1
+SET GLOBAL wsrep_on=OFF;
RESET MASTER;
+SET GLOBAL wsrep_on=ON;
CREATE TABLE t1(i INT)ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
DELETE FROM t1 WHERE i = 1;
@@ -38,5 +42,4 @@ let $start_pos= `select @binlog_start_pos`;
# Cleanup
DROP TABLE t1;
---source include/galera_end.inc
--echo # End of test
diff --git a/mysql-test/suite/galera/t/wsrep_trx_fragment_size_sr.test b/mysql-test/suite/galera/t/wsrep_trx_fragment_size_sr.test
new file mode 100644
index 00000000000..a970cc09afc
--- /dev/null
+++ b/mysql-test/suite/galera/t/wsrep_trx_fragment_size_sr.test
@@ -0,0 +1,22 @@
+-- source include/galera_cluster.inc
+
+-- let $sr = `SELECT variable_value LIKE '%:STREAMING:%' FROM information_schema.session_status WHERE variable_name = 'wsrep_provider_capabilities'`
+
+if (!$sr)
+{
+ -- skip The test requires a wsrep provider that supports streaming replication.
+}
+
+SELECT variable_value FROM information_schema.session_variables
+WHERE variable_name = 'wsrep_trx_fragment_size';
+
+SET SESSION wsrep_trx_fragment_size = 0;
+SET SESSION wsrep_trx_fragment_size = 123;
+
+SELECT variable_value FROM information_schema.global_variables
+WHERE variable_name = 'wsrep_trx_fragment_size';
+
+SET GLOBAL wsrep_trx_fragment_size = 0;
+SET GLOBAL wsrep_trx_fragment_size = 123;
+
+SET GLOBAL wsrep_trx_fragment_size = default;
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def
index a9b9b00b40c..1683485981b 100644
--- a/mysql-test/suite/galera_3nodes/disabled.def
+++ b/mysql-test/suite/galera_3nodes/disabled.def
@@ -1,3 +1,2 @@
galera_slave_options_do :MDEV-8798
galera_slave_options_ignore : MDEV-8798
-
diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
index 3f39b82f7b7..2707fb69f4d 100644
--- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
@@ -10,7 +10,6 @@ default-storage-engine=innodb
wsrep_gtid_mode=1
gtid_ignore_duplicates
-wsrep-on=1
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
@@ -21,8 +20,9 @@ wsrep_node_address=127.0.0.1
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep-cluster-address='gcomm://'
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
@@ -32,8 +32,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
@@ -43,8 +44,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
@@ -56,9 +58,9 @@ wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
-
+wsrep-on=1
wsrep-cluster-address='gcomm://'
-wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
@@ -69,8 +71,9 @@ wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port'
-wsrep_provider_options='base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port
@@ -81,8 +84,9 @@ wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port'
-wsrep_provider_options='base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port
@@ -106,17 +110,3 @@ NODE_MYSOCK_5= @mysqld.5.socket
NODE_MYPORT_6= @mysqld.6.port
NODE_MYSOCK_6= @mysqld.6.socket
-
-NODE_GALERAPORT_1= @mysqld.1.#galera_port
-NODE_GALERAPORT_2= @mysqld.2.#galera_port
-NODE_GALERAPORT_3= @mysqld.3.#galera_port
-NODE_GALERAPORT_4= @mysqld.4.#galera_port
-NODE_GALERAPORT_5= @mysqld.5.#galera_port
-NODE_GALERAPORT_6= @mysqld.6.#galera_port
-
-NODE_SSTPORT_1= @mysqld.1.#sst_port
-NODE_SSTPORT_2= @mysqld.2.#sst_port
-NODE_SSTPORT_3= @mysqld.3.#sst_port
-NODE_SSTPORT_4= @mysqld.4.#sst_port
-NODE_SSTPORT_5= @mysqld.5.#sst_port
-NODE_SSTPORT_6= @mysqld.6.#sst_port
diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index 91aa53ad7b1..ab7493e313b 100644
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@ -6,7 +6,6 @@ binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
-wsrep-on=1
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
@@ -17,8 +16,10 @@ wsrep-sync-wait=15
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+#wsrep-new-cluster
+wsrep-on=1
wsrep-cluster-address='gcomm://'
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
@@ -28,8 +29,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
@@ -39,8 +41,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
@@ -55,12 +58,3 @@ NODE_MYSOCK_2= @mysqld.2.socket
NODE_MYPORT_3= @mysqld.3.port
NODE_MYSOCK_3= @mysqld.3.socket
-
-NODE_GALERAPORT_1= @mysqld.1.#galera_port
-NODE_GALERAPORT_2= @mysqld.2.#galera_port
-NODE_GALERAPORT_3= @mysqld.3.#galera_port
-
-NODE_SSTPORT_1= @mysqld.1.#sst_port
-NODE_SSTPORT_2= @mysqld.2.#sst_port
-NODE_SSTPORT_3= @mysqld.3.#sst_port
-
diff --git a/mysql-test/suite/galera/include/galera_resume.inc b/mysql-test/suite/galera_3nodes/include/galera_resume.inc
index 232cb46479e..af8f2b956fd 100644
--- a/mysql-test/suite/galera/include/galera_resume.inc
+++ b/mysql-test/suite/galera_3nodes/include/galera_resume.inc
@@ -3,7 +3,7 @@
my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
- system("kill -18 $mysqld_pid");
+ system("kill -SIGCONT $mysqld_pid");
exit(0);
EOF
diff --git a/mysql-test/suite/galera_3nodes/include/galera_suspend.inc b/mysql-test/suite/galera_3nodes/include/galera_suspend.inc
index 3495ad2342b..d4037d8958c 100644
--- a/mysql-test/suite/galera_3nodes/include/galera_suspend.inc
+++ b/mysql-test/suite/galera_3nodes/include/galera_suspend.inc
@@ -9,6 +9,6 @@
my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
- system("kill -19 $mysqld_pid");
+ system("kill -SIGSTOP $mysqld_pid");
exit(0);
EOF
diff --git a/mysql-test/suite/galera_3nodes/include/have_ipv6.inc b/mysql-test/suite/galera_3nodes/include/have_ipv6.inc
deleted file mode 100644
index 560cad03350..00000000000
--- a/mysql-test/suite/galera_3nodes/include/have_ipv6.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-# Check if ipv6 is available.
-#
---disable_query_log
---disable_result_log
-connect (checkcon123456789,::1,root,,test);
-if($mysql_errno)
-{
- skip No IPv6 support;
-}
-connection default;
-disconnect checkcon123456789;
---enable_result_log
---enable_query_log
-# end check
-
diff --git a/mysql-test/suite/galera/include/have_xtrabackup.inc b/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc
index 0dd693f2c63..0dd693f2c63 100644
--- a/mysql-test/suite/galera/include/have_xtrabackup.inc
+++ b/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc
diff --git a/mysql-test/suite/galera_3nodes/r/GAL-501.result b/mysql-test/suite/galera_3nodes/r/GAL-501.result
index a2bf5f4d98c..063e88ec21a 100644
--- a/mysql-test/suite/galera_3nodes/r/GAL-501.result
+++ b/mysql-test/suite/galera_3nodes/r/GAL-501.result
@@ -1,12 +1,18 @@
+connection node_2;
+connection node_1;
+connection node_3;
SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';
VARIABLE_VALUE LIKE '%[::1]%'
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
+connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
+connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result
index b1bbb1406a1..6393a30da6f 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_3;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result
index e1528c6f74f..d43b42bec45 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
@@ -11,6 +13,7 @@ connection node_3;
INSERT INTO t2 VALUES (1);
connection node_1;
COMMIT;
-ERROR 40001: Deadlock: wsrep aborted transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_3;
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
index 7e0d282ec7f..3543feff78c 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
@@ -1,12 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
+connection node_2;
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
+connection node_3;
Suspending node ...
+connection node_1;
SET SESSION wsrep_sync_wait = 0;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
+connection node_2;
SET SESSION wsrep_sync_wait = 0;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
@@ -16,5 +23,6 @@ SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
DROP TABLE t1;
+connection node_3;
Resuming node ...
CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd.result b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
index 180aade029c..88bb3ca2ff9 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_garbd.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
@@ -1,17 +1,31 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
Killing node #3 to free ports for garbd ...
+connection node_1;
Starting garbd ...
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
+connection node_2;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
Killing garbd ...
+connection node_1;
INSERT INTO t1 VALUES (2);
+connection node_2;
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
DROP TABLE t1;
Restarting node #3 to satisfy MTR's end-of-test checks
+connection node_3;
+connection node_1;
CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)");
+connection node_2;
CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)");
+connection node_3;
CALL mtr.add_suppression("WSREP: Protocol violation\. JOIN message sender 1\.0 \(.*\) is not in state transfer \(SYNCED\)");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result b/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result
deleted file mode 100644
index 85000db8e77..00000000000
--- a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE t1 (f1 INTEGER);
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-SELECT COUNT(*) = 10 FROM t1;
-COUNT(*) = 10
-1
-Killing server ...
-INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
-SELECT COUNT(*) = 20 FROM t1;
-COUNT(*) = 20
-1
-DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result
index 53e35939a79..8ec1ff090ff 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result
@@ -1,18 +1,24 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';
VARIABLE_VALUE LIKE '%[::1]%'
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
+connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
+connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
DROP TABLE t1;
+connection node_1;
include/assert_grep.inc [Streaming the backup to joiner at \[::1\]]
include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:]
include/assert_grep.inc [IST receiver addr using tcp://\[::1\]]
-include/assert_grep.inc [Prepared IST receiver, listening at: tcp://\[::1\]]
+include/assert_grep.inc [Prepared IST receiver for 3-6, listening at: tcp://\[::1\]]
diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result
index f519654952b..bfc210db2ba 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result
@@ -1,11 +1,23 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
+CREATE USER 'sst';
GRANT ALL PRIVILEGES ON *.* TO 'sst';
SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
SET GLOBAL wsrep_sst_method = 'mysqldump';
-Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
-Loading wsrep provider ...
+connection node_2;
+Starting server ...
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
@@ -13,14 +25,16 @@ DROP TABLE t1;
SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';
VARIABLE_VALUE LIKE '%[::1]%'
1
+connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
+connection node_2;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
-CALL mtr.add_suppression("InnoDB: New log files created");
-CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
+connection node_2;
CALL mtr.add_suppression("Unsupported protocol downgrade: incremental data collection disabled. Expect abort");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result
index a2bf5f4d98c..3f810d3eb97 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result
@@ -1,12 +1,17 @@
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';
VARIABLE_VALUE LIKE '%[::1]%'
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
+connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
+connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
diff --git a/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result
index 3d4dbcc00b0..7780c3f73b8 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
connection node_1;
connection node_2;
connection node_3;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result
index 4f9951c382f..8211fb8501e 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result
@@ -1,3 +1,5 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_3;
@@ -12,7 +14,7 @@ connection node_3;
SELECT f1 = 111 FROM t1;
f1 = 111
1
-SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%';
COUNT(*) IN (1, 2)
1
SET GLOBAL wsrep_slave_threads = 1;;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result
index 69995acb982..ee49330e892 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result
@@ -1,8 +1,15 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER);
+connection node_1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait = 0;
+connection node_2;
SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1';
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
@@ -11,15 +18,21 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status Primary
INSERT INTO t1 VALUES (1);
+connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_3;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
+connection node_2;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
+connection node_3;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
index 9f845ffe776..3ae983f9550 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result
@@ -1,9 +1,15 @@
+connection node_2;
+connection node_1;
+connection node_1;
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
+1
SET GLOBAL wsrep_provider_options = 'pc.weight=3';
SELECT VARIABLE_VALUE = 5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 5
+1
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connection node_2;
SET SESSION wsrep_sync_wait=0;
SET SESSION wsrep_on=OFF;
SET SESSION wsrep_on=ON;
@@ -12,6 +18,7 @@ Variable_name Value
wsrep_cluster_size 2
SHOW STATUS LIKE 'wsrep_cluster_weight';
Variable_name Value
+wsrep_cluster_weight 0
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status non-Primary
@@ -27,6 +34,7 @@ wsrep_local_state 0
SHOW STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment Initialized
+connection node_3;
SET SESSION wsrep_sync_wait=0;
SET SESSION wsrep_on=OFF;
SET SESSION wsrep_on=ON;
@@ -35,6 +43,7 @@ Variable_name Value
wsrep_cluster_size 2
SHOW STATUS LIKE 'wsrep_cluster_weight';
Variable_name Value
+wsrep_cluster_weight 0
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status non-Primary
@@ -50,8 +59,10 @@ wsrep_local_state 0
SHOW STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment Initialized
+connection node_1;
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
+1
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
@@ -70,12 +81,18 @@ VARIABLE_VALUE = 'Synced'
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 1
+1
+connection node_1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_2;
+connection node_3;
+connection node_1;
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
+1
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
@@ -91,11 +108,13 @@ VARIABLE_VALUE = 4
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
+connection node_2;
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
+1
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
@@ -111,11 +130,13 @@ VARIABLE_VALUE = 4
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
+connection node_3;
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 3
1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
VARIABLE_VALUE = 3
+1
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
@@ -131,12 +152,15 @@ VARIABLE_VALUE = 4
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
+connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1');
+connection node_2;
CALL mtr.add_suppression('overriding reported weight for');
CALL mtr.add_suppression('SYNC message from member');
CALL mtr.add_suppression('user message in state LEAVING');
CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)');
+connection node_3;
CALL mtr.add_suppression('WSREP: user message in state LEAVING');
CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)');
CALL mtr.add_suppression('overriding reported weight for');
diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result
index 21f747d280b..b87c8743406 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result
@@ -1,23 +1,46 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+connection node_2;
+connection node_1;
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+connection node_3;
+connection node_1;
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 1']
+connection node_2;
+connection node_1;
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+connection node_2;
+connection node_1;
SET SESSION wsrep_on = OFF;
Killing server ...
safe_to_bootstrap: 1
safe_to_bootstrap: 0
safe_to_bootstrap: 0
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_2;
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
+CALL mtr.add_suppression("Aborting");
+connection node_3;
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
+CALL mtr.add_suppression("Aborting");
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
index 88780a2c87f..8e6d27823f6 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
@@ -1,6 +1,11 @@
+connection node_2;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
+connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+connection node_1;
+connection node_2;
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_dirty_reads = 1;
SELECT f1 FROM t1;
@@ -45,4 +50,6 @@ SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST;
COUNT(*) > 0
1
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+connection node_1;
+connection node_2;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result
new file mode 100644
index 00000000000..23ced3ba734
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result
@@ -0,0 +1,82 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+SHOW CREATE TABLE mysql.wsrep_cluster;
+Table Create Table
+wsrep_cluster CREATE TABLE `wsrep_cluster` (
+ `cluster_uuid` char(36) NOT NULL,
+ `view_id` bigint(20) NOT NULL,
+ `view_seqno` bigint(20) NOT NULL,
+ `protocol_version` int(11) NOT NULL,
+ `capabilities` int(11) NOT NULL,
+ PRIMARY KEY (`cluster_uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE mysql.wsrep_cluster_members;
+Table Create Table
+wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` (
+ `node_uuid` char(36) NOT NULL,
+ `cluster_uuid` char(36) NOT NULL,
+ `node_name` char(32) NOT NULL,
+ `node_incoming_address` varchar(256) NOT NULL,
+ PRIMARY KEY (`node_uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster;
+COUNT(*) = 1
+1
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid')
+1
+SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members;
+COUNT(*) = 3
+1
+SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members;
+COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
+1
+SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid');
+COUNT(*) = 1
+1
+SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members;
+node_incoming_address LIKE '127.0.0.1:%'
+1
+1
+1
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members;
+cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid')
+1
+1
+1
+SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid');
+COUNT(*) = 1
+1
+connection node_2;
+connection node_1;
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid')
+1
+SELECT COUNT(*) = 2 FROM mysql.wsrep_cluster_members;
+COUNT(*) = 2
+1
+connection node_2;
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid')
+1
+SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members;
+COUNT(*) = 3
+1
+connection node_1;
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid')
+1
+SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members;
+COUNT(*) = 3
+1
+connection node_1;
+CALL mtr.add_suppression("SYNC message from member");
+connection node_2;
+CALL mtr.add_suppression("SYNC message from member");
+connection node_3;
+CALL mtr.add_suppression("SYNC message from member");
diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm
index 3a1237ecf75..9882793cb20 100644
--- a/mysql-test/suite/galera_3nodes/suite.pm
+++ b/mysql-test/suite/galera_3nodes/suite.pm
@@ -9,9 +9,9 @@ return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib64/galera-3/libgalera_smm.so",
+ "/usr/lib64/galera-4/libgalera_smm.so",
"/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-3/libgalera_smm.so",
+ "/usr/lib/galera-4/libgalera_smm.so",
"/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
@@ -21,14 +21,21 @@ $ENV{WSREP_PROVIDER} = $provider;
my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
return "No SST scripts" unless $spath;
+my ($cpath) = grep { -f "$_/mysql"; } "$::bindir/scripts", $::path_client_bindir;
+return "No scritps" unless $cpath;
+
my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir;
return "No my_print_defaults" unless $epath;
+my ($bpath) = grep { -f "$_/mariabackup"; } "$::bindir/extra/mariabackup", $::path_client_bindir;
+
+sub which($) { return `sh -c "command -v $_[0]"` }
+
push @::global_suppressions,
(
qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1),
- qr(WSREP: Could not open saved state file for reading: ),
- qr(WSREP: Could not open state file for reading: ),
+ qr(WSREP: Could not open saved state file for reading: .*),
+ qr(WSREP: Could not open state file for reading: .*),
qr(WSREP: Gap in state sequence. Need state transfer.),
qr(WSREP: Failed to prepare for incremental state transfer:),
qr(WSREP:.*down context.*),
@@ -42,16 +49,43 @@ push @::global_suppressions,
qr|WSREP: discarding established \(time wait\) .*|,
qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.),
qr(WSREP: evs::proto.*),
- qr|WSREP: Ignoring possible split-brain (allowed by configuration) from view:.*|,
+ qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|,
qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable),
+ qr(WSREP: .* sending install message failed: Transport endpoint is not connected),
+ qr(WSREP: .* sending install message failed: Resource temporarily unavailable),
qr(WSREP: Could not find peer:),
- qr(WSREP: Protocol violation. JOIN message sender .*),
- qr(WSREP: JOIN message from member [0-9]* in non-primary configuration. Ignored.),
+ qr|WSREP: gcs_caused\(\) returned .*|,
+ qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|,
+ qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|,
+ qr(WSREP: Action message in non-primary configuration from member [0-9]*),
+ qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on),
+ qr(WSREP: JOIN message from member .* in non-primary configuration. Ignored.),
);
$ENV{PATH}="$epath:$ENV{PATH}";
$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath;
+$ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
+$ENV{PATH}="$bpath:$ENV{PATH}" unless $bpath eq $spath;
+
+if (which(socat)) {
+ $ENV{MTR_GALERA_TFMT}='socat';
+} elsif (which(nc)) {
+ $ENV{MTR_GALERA_TFMT}='nc';
+}
+
+sub skip_combinations {
+ my %skip = ();
+ $skip{'include/have_filekeymanagement.inc'} = 'needs file_key_management plugin'
+ unless $ENV{FILE_KEY_MANAGEMENT_SO};
+ $skip{'include/have_mariabackup.inc'} = 'Need mariabackup'
+ unless which(mariabackup);
+ $skip{'include/have_mariabackup.inc'} = 'Need ss'
+ unless which(ss);
+ $skip{'include/have_mariabackup.inc'} = 'Need socat or nc'
+ unless $ENV{MTR_GALERA_TFMT};
+ %skip;
+}
bless { };
diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.opt b/mysql-test/suite/galera_3nodes/t/GAL-501.opt
new file mode 100644
index 00000000000..c2bb4d156af
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/GAL-501.opt
@@ -0,0 +1 @@
+--bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.test b/mysql-test/suite/galera_3nodes/t/GAL-501.test
index 60ed5989227..c4b17cdb21e 100644
--- a/mysql-test/suite/galera_3nodes/t/GAL-501.test
+++ b/mysql-test/suite/galera_3nodes/t/GAL-501.test
@@ -5,7 +5,13 @@
# ist.recv_addr=[::1]
--source include/galera_cluster.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+--connection node_3
+--source include/galera_wait_ready.inc
# Confirm that initial handshake happened over ipv6
diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test
index a2ad0765028..5366d2a4a6e 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test
@@ -29,5 +29,7 @@ INSERT INTO t2 VALUES (1);
--error ER_LOCK_DEADLOCK
COMMIT;
+--connection node_3
+--source include/galera_wait_ready.inc
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
index 03236a3cb93..a4767928681 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
@@ -60,9 +60,9 @@ DROP TABLE t1;
--source include/galera_resume.inc
--source include/wait_until_connected_again.inc
-CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)");
-
--disable_query_log
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node3';
--enable_query_log
---source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+
+CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)");
diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
index a68ba8ce15b..81d927894c7 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
@@ -7,10 +7,21 @@
--source include/have_innodb.inc
--source include/big_test.inc
+# Save galera ports
+--connection node_1
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
+
+--connection node_2
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT
+
+--connection node_3
--echo Killing node #3 to free ports for garbd ...
---let $galera_connection_name = node_3
---let $galera_server_number = 3
---source include/galera_connect.inc
--source include/shutdown_mysqld.inc
--connection node_1
@@ -32,7 +43,10 @@ INSERT INTO t1 VALUES (1);
SELECT COUNT(*) = 1 FROM t1;
--echo Killing garbd ...
---exec pkill --oldest --full garbd.*$NODE_GALERAPORT_3
+# FreeBSD's /bin/pkill only supports short versions of the options:
+# -o Select only the oldest (least recently started)
+# -f Match against full argument lists
+--exec pkill -o -f garbd.*$NODE_GALERAPORT_3
--sleep 5
diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf
new file mode 100644
index 00000000000..35ecb8b5937
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf
@@ -0,0 +1,4 @@
+!include ../galera_3nodes.cnf
+
+[mysqld]
+wsrep-causal-reads=OFF
diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test
deleted file mode 100644
index cc3f42c7290..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# This test uses innobackupex to take a backup on node #2 and then restores that node from backup
-#
-
---source include/galera_cluster.inc
---source include/have_innodb.inc
-
---connection node_1
-CREATE TABLE t1 (f1 INTEGER);
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
---connection node_2
-SELECT COUNT(*) = 10 FROM t1;
-
---exec rm -rf $MYSQL_TMP_DIR/innobackupex_backup
---exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log
---exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log
-
---source ../galera/include/kill_galera.inc
---sleep 1
-
---connection node_1
-INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
-
---exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/*
---exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --copy-back $MYSQL_TMP_DIR/innobackupex_backup --port=$NODE_MYPORT_2 --host=127.0.0.1 > $MYSQL_TMP_DIR/innobackupex-restore.log
-
-#
-# Convert the xtrabackup_galera_info into a grastate.dat file
-#
-
---perl
- use strict;
- my $xtrabackup_galera_info_file = $ENV{'MYSQL_TMP_DIR'}.'/innobackupex_backup/xtrabackup_galera_info';
- open(XTRABACKUP_GALERA_INFO, $xtrabackup_galera_info_file) or die "Can not open $xtrabackup_galera_info_file: $!";
- my $xtrabackup_galera_info = <XTRABACKUP_GALERA_INFO>;
- my ($uuid, $seqno) = split(':', $xtrabackup_galera_info);
-
- my $grastate_dat_file = $ENV{'MYSQLTEST_VARDIR'}.'/mysqld.2/data/grastate.dat';
- die "grastate.dat already exists" if -e $grastate_dat_file;
-
- open(GRASTATE_DAT, ">$grastate_dat_file") or die "Can not write to $grastate_dat_file: $!";
- print GRASTATE_DAT "version: 2.1\n";
- print GRASTATE_DAT "uuid: $uuid\n";
- print GRASTATE_DAT "seqno: $seqno\n";
- print GRASTATE_DAT "cert_index:\n";
- exit(0);
-EOF
-
---source include/start_mysqld.inc
---sleep 5
-
---source include/wait_until_connected_again.inc
-SELECT COUNT(*) = 20 FROM t1;
-
-DROP TABLE t1;
-
---sleep 10
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf
index 8a80be0d2a9..969f364a1ec 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf
@@ -1,26 +1,34 @@
!include ../galera_3nodes.cnf
[mysqld]
-wsrep_sst_method=xtrabackup-v2
+wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
+wsrep_node_address=::1
[mysqld.1]
wsrep-cluster-address=gcomm://
wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.1.port'
+wsrep_node_name=node_1
[mysqld.2]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.2.port'
+wsrep_node_name=node_2
+wsrep_sst_donor=node_1
[mysqld.3]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.3.port'
+wsrep_node_name=node_3
+wsrep_sst_donor=node_1
[SST]
+transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=xbstream
sockopt=",pf=ip6"
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt
new file mode 100644
index 00000000000..c2bb4d156af
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt
@@ -0,0 +1 @@
+--bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
index 84eee017700..2abb67421c8 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
@@ -1,5 +1,6 @@
--source include/galera_cluster.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
+--source include/have_mariabackup.inc
# Confirm that initial handshake happened over ipv6
@@ -37,26 +38,31 @@ DROP TABLE t1;
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_only_after = CURRENT_TEST
+# The SSTs happen when nodes are started first time
--let $assert_count = 2
--let $assert_text = Streaming the backup to joiner at \[::1\]
--let $assert_select = Streaming the backup to joiner at \[::1\]
--source include/assert_grep.inc
---let $assert_count = 1
+# There will be 3 ISTs donated from node_1 in Galera 4.
+# Two first happen at the initial startup to populate the certification
+# index. The third one is from the IST which happens during the actual test.
+--let $assert_count = 3
--let $assert_text = async IST sender starting to serve tcp://\[::1\]:
--let $assert_select = async IST sender starting to serve tcp://\[::1\]:
--source include/assert_grep.inc
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
+# There are two ISTs on joiner, the first at the initial startup, the second
+# during the actual test.
+--let $assert_count = 2
--let $assert_text = IST receiver addr using tcp://\[::1\]
--let $assert_select = IST receiver addr using tcp://\[::1\]
--source include/assert_grep.inc
---let $assert_text = Prepared IST receiver, listening at: tcp://\[::1\]
---let $assert_select = Prepared IST receiver, listening at: tcp://\[::1\]
+# The receiver expects seqnos 3-6 only once.
+--let $assert_count = 1
+--let $assert_text = Prepared IST receiver for 3-6, listening at: tcp://\[::1\]
+--let $assert_select = Prepared IST receiver for 3-6, listening at: tcp://\[::1\]
--source include/assert_grep.inc
-
-
-
-
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf
index 3728e1ce005..80dd0c41cc3 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf
@@ -2,21 +2,25 @@
[mysqld]
wsrep_sst_method=rsync
+wsrep_node_address=::1
[mysqld.1]
wsrep-cluster-address=gcomm://
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port'
+wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.1.port'
[mysqld.2]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port'
+wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.2.port'
[mysqld.3]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port'
+wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.3.port'
+
+[SST]
+sockopt=",pf=ip6"
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt
new file mode 100644
index 00000000000..c2bb4d156af
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt
@@ -0,0 +1 @@
+--bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
index 5b06e617eef..4733b686e93 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
@@ -1,7 +1,21 @@
--source include/galera_cluster.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
+
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
--connection node_1
+CREATE USER 'sst';
GRANT ALL PRIVILEGES ON *.* TO 'sst';
--let $wsrep_sst_auth_orig = `SELECT @@wsrep_sst_auth`
@@ -17,25 +31,37 @@ SET GLOBAL wsrep_sst_auth = 'sst:';
--enable_query_log
SET GLOBAL wsrep_sst_method = 'mysqldump';
-
#
# Force mysqldump SST
#
---connection node_2
---source suite/galera/include/galera_unload_provider.inc
---remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+#--connection node_2
+#--source suite/galera/include/galera_unload_provider.inc
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
+--echo Cleaning var directory ...
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql
+--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data
+
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
-
--connection node_2
---source suite/galera/include/galera_load_provider.inc
+--echo Starting server ...
+--let $start_mysqld_params = --wsrep_sst_auth=sst: --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=[::1].1:$NODE_MYPORT_2
+--source include/start_mysqld.inc
+
+#--source suite/galera/include/galera_load_provider.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
@@ -51,6 +77,14 @@ DROP TABLE t1;
SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';
+# restart node so we don't fail on WSREP_START_POSITION internal check
+--source include/restart_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+--source ../galera/include/auto_increment_offset_restore.inc
--source suite/galera/include/galera_sst_restore.inc
--connection node_2
CALL mtr.add_suppression("Unsupported protocol downgrade: incremental data collection disabled. Expect abort");
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf
index 3728e1ce005..80dd0c41cc3 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf
@@ -2,21 +2,25 @@
[mysqld]
wsrep_sst_method=rsync
+wsrep_node_address=::1
[mysqld.1]
wsrep-cluster-address=gcomm://
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port'
+wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.1.port'
[mysqld.2]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port'
+wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.2.port'
[mysqld.3]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port'
+wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port'
wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.3.port'
+
+[SST]
+sockopt=",pf=ip6"
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt
new file mode 100644
index 00000000000..c2bb4d156af
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt
@@ -0,0 +1 @@
+--bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test
index 7ee209d8e72..1937eb43e13 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test
@@ -1,5 +1,5 @@
--source include/galera_cluster.inc
---source include/have_ipv6.inc
+--source include/check_ipv6.inc
# Confirm that initial handshake happened over ipv6
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
index a67b30e3fa1..9e43c90bfc1 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
@@ -11,7 +11,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
---source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--let $galera_connection_name = node_3
--let $galera_server_number = 3
diff --git a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test
index 7d80d8036a1..659df2b3c93 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test
@@ -31,7 +31,7 @@ SET GLOBAL wsrep_slave_threads = 2;
--connection node_3
SELECT f1 = 111 FROM t1;
-SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf
index 57026ce6928..1a61471d581 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf
@@ -1,5 +1,7 @@
-# We need a dedicated .cnf file, even if empty, in order to force this test to run
-# alone on a freshly started cluster. Otherwise there are adverse interactions with
-# following tests such as galera_3nodes.galera_var_dirty_reads2
+# We need a dedicated .cnf file, even if empty, in order to force this test
+# to run alone on a freshly started cluster. Otherwise there are adverse
+# interactions with following tests such as
+# galera_3nodes.galera_var_dirty_reads2
+!include ../galera_3nodes.cnf
!include ../galera_3nodes.cnf
diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
index 0a94e7cd85d..729f14a731f 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
@@ -1,11 +1,11 @@
#
-# Test the pc.weight wsrep provider option. We set Node #1 to have a high weight and then
-# suspend it. This will cause Nodes #2 and #3 to transition to non-primary component.
+# Test the pc.weight wsrep provider option. We set Node #1 to have a high
+# weight and then suspend it. This will cause Nodes #2 and #3 to transition
+# to non-primary component.
#
--source include/big_test.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
--connection node_1
SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
@@ -55,6 +55,9 @@ SHOW STATUS LIKE 'wsrep_local_state_comment';
--connection node_1
# For Node #1, we expect a primary component of size 1
+# (NOTE: this is a bit racy as nodes 2 and 3 will try to reconnect ASAP.
+# to avoid the raice they should be suspended first as well, but that's
+# not currently possible)
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test
index 88d0cfba4f4..722242b22c8 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test
@@ -3,6 +3,22 @@
#
--source include/galera_cluster.inc
+
+#
+# Create connection node_3 and save auto increment variables.
+#
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+--let $node_1 = node_1
+--let $node_2 = node_2
+--let $node_3 = node_3
+
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
+
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
#
@@ -48,7 +64,6 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
# Shut down one more node
#
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
--source include/shutdown_mysqld.inc
@@ -155,9 +170,18 @@ SET SESSION wsrep_on = OFF;
--connection node_2
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
+CALL mtr.add_suppression("Aborting");
--connection node_3
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
+CALL mtr.add_suppression("Aborting");
SHOW CREATE TABLE t1;
DROP TABLE t1;
+
+#
+# Restore auto increment variables.
+#
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test b/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test
index 3e8b1557e7b..8e73dee70ae 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_slave_options_ignore.test
@@ -25,6 +25,7 @@ SELECT COUNT(*) = 1 FROM db2.t2B;
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
+--source include/galera_wait_ready.inc
SELECT COUNT(*) = 0 FROM db1.t1;
SELECT COUNT(*) = 1 FROM db2.t2A;
SELECT COUNT(*) = 1 FROM db2.t2B;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
index 129ba2e1f38..2ceda1ed352 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
@@ -106,7 +106,8 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--source include/wait_condition.inc
--connection node_2
---let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test
new file mode 100644
index 00000000000..5c2cae75bd0
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test
@@ -0,0 +1,83 @@
+#
+# This test performs basic checks on the contents of the wsrep_schema
+#
+# wsrep_members_history checks are temporarily disabled until it
+# can be made configurable.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_1
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+# Make the test fail if table structure has changed
+
+SHOW CREATE TABLE mysql.wsrep_cluster;
+SHOW CREATE TABLE mysql.wsrep_cluster_members;
+#disabled SHOW CREATE TABLE mysql.wsrep_member_history;
+
+# Checks for the wsrep_cluster table
+
+SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster;
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+
+# Checks for the wsrep_cluster_members table
+
+SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members;
+SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members;
+SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid');
+
+SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members;
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members;
+
+# Checks for the wsrep_cluster_member_history table
+
+#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history;
+#disabled SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_member_history;
+SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid');
+
+#disabled SELECT last_view_id = (SELECT view_id FROM mysql.wsrep_cluster) FROM mysql.wsrep_cluster_member_history;
+#disabled SELECT last_view_seqno = (SELECT view_seqno FROM mysql.wsrep_cluster) FROM mysql.wsrep_cluster_member_history;
+#disabled SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_member_history;
+#disabled SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_member_history;
+
+--connection node_2
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+SELECT COUNT(*) = 2 FROM mysql.wsrep_cluster_members;
+#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history;
+#disabled SELECT COUNT(*) = 2 FROM mysql.wsrep_cluster_member_history WHERE last_view_id = (SELECT MAX(last_view_id) FROM mysql.wsrep_cluster_member_history);
+
+--connection node_2
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members;
+#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history WHERE last_view_id = (SELECT MAX(last_view_id) FROM mysql.wsrep_cluster_member_history);
+
+--connection node_1
+SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
+SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_members;
+#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history WHERE last_view_id = (SELECT MAX(last_view_id) FROM mysql.wsrep_cluster_member_history);
+
+--source ../galera/include/auto_increment_offset_restore.inc
+
+--connection node_1
+CALL mtr.add_suppression("SYNC message from member");
+
+--connection node_2
+CALL mtr.add_suppression("SYNC message from member");
+
+--connection node_3
+CALL mtr.add_suppression("SYNC message from member");
diff --git a/mysql-test/suite/galera_3nodes_sr/disabled.def b/mysql-test/suite/galera_3nodes_sr/disabled.def
new file mode 100644
index 00000000000..0944abd0ad5
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/disabled.def
@@ -0,0 +1,7 @@
+GCF-336 :
+GCF-582 :
+GCF-609 :
+GCF-810A :
+GCF-810B :
+GCF-810C :
+galera_sr_kill_slave_after_apply_rollback2 : \ No newline at end of file
diff --git a/mysql-test/suite/galera_3nodes_sr/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes_sr/galera_3nodes.cnf
new file mode 100644
index 00000000000..62c8214b8f2
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/galera_3nodes.cnf
@@ -0,0 +1 @@
+!include ../galera_3nodes/galera_3nodes.cnf
diff --git a/mysql-test/suite/galera_3nodes_sr/my.cnf b/mysql-test/suite/galera_3nodes_sr/my.cnf
new file mode 100644
index 00000000000..bb25b95ceea
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/my.cnf
@@ -0,0 +1 @@
+!include galera_3nodes.cnf
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result
new file mode 100644
index 00000000000..bb6c11edf36
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result
@@ -0,0 +1,26 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM t1;
+COUNT(*) > 0
+1
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+SET SESSION wsrep_sync_wait=0;
+INSERT INTO t1 VALUES (2);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+ERROR 08S01: WSREP has not yet prepared node for application use
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+DROP TABLE t1;
+CALL mtr.add_suppression("replication aborted");
+CALL mtr.add_suppression("WSREP: fragment replication failed: 3");
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result
new file mode 100644
index 00000000000..9e2a4823973
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result
@@ -0,0 +1,23 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COUNT(*)
+5
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COUNT(*)
+5
+COMMIT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result
new file mode 100644
index 00000000000..775f7ee0412
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result
@@ -0,0 +1,38 @@
+connection node_2;
+connection node_1;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (20);
+INSERT INTO t1 VALUES (21);
+INSERT INTO t1 VALUES (22);
+INSERT INTO t1 VALUES (23);
+INSERT INTO t1 VALUES (24);
+connection node_1;
+connection node_2a;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+SET WSREP_ON=ON;
+connection node_1;
+connection node_2a;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+connection node_1;
+connection node_1;
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+0
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1
+COMMIT;
+connection node_1;
+SELECT * FROM t1;
+f1
+DROP TABLE t1;
+connection node_2;
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-609.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-609.result
new file mode 100644
index 00000000000..8fe13c7e2bf
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-609.result
@@ -0,0 +1,20 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+INSERT INTO t1 VALUES (31),(32),(33);
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+0
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+0
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result
new file mode 100644
index 00000000000..9a83ff3c041
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result
@@ -0,0 +1,256 @@
+SET GLOBAL debug="d,crash_last_fragment_commit_before_fragment_removal";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+crash_last_fragment_commit_before_fragment_removal
+COMMIT;
+Got one of the listed errors
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug = '';
+SET GLOBAL debug="d,crash_last_fragment_commit_after_fragment_removal";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+crash_last_fragment_commit_after_fragment_removal
+COMMIT;
+Got one of the listed errors
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug = '';
+SET GLOBAL debug="d,crash_replicate_fragment_success";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+crash_replicate_fragment_success
+COMMIT;
+Got one of the listed errors
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug = '';
+SET GLOBAL debug="d,crash_replicate_fragment_after_certify";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+crash_replicate_fragment_after_certify
+COMMIT;
+Got one of the listed errors
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug = '';
+SET GLOBAL debug="d,crash_replicate_fragment_before_certify";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+crash_replicate_fragment_before_certify
+COMMIT;
+Got one of the listed errors
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug = '';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result
new file mode 100644
index 00000000000..bbec3531a49
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result
@@ -0,0 +1,100 @@
+SET GLOBAL debug="d,crash_apply_cb_before_append_frag";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+COMMIT;
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug = '';
+SET GLOBAL debug="d,crash_apply_cb_after_append_frag";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+COMMIT;
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug = '';
+CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member");
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result
new file mode 100644
index 00000000000..1a6dcbfd392
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result
@@ -0,0 +1,177 @@
+SET GLOBAL debug="d,crash_commit_cb_last_fragment_commit_success";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+SET SESSION wsrep_trx_fragment_size=1;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary');
+SELECT 1 FROM t1;
+Got one of the listed errors
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug="d,crash_commit_cb_before_last_fragment_commit";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+SET SESSION wsrep_trx_fragment_size=1;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary');
+SELECT 1 FROM t1;
+Got one of the listed errors
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug="d,crash_apply_cb_after_fragment_removal";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+SET SESSION wsrep_trx_fragment_size=1;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary');
+SELECT 1 FROM t1;
+Got one of the listed errors
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET GLOBAL debug="d,crash_apply_cb_before_fragment_removal";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary');
+SET SESSION wsrep_trx_fragment_size=1;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary');
+SELECT 1 FROM t1;
+Got one of the listed errors
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-817.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-817.result
new file mode 100644
index 00000000000..4eb0ebca4f4
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-817.result
@@ -0,0 +1,54 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+SET SESSION wsrep_on = OFF;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+connection node_3;
+connection node_1a;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_3;
+connection node_1a;
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1a;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result
new file mode 100644
index 00000000000..d670b8c24a0
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_2;
+SET GLOBAL debug="d,crash_last_fragment_commit_after_fragment_removal";
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+COMMIT;
+ERROR HY000: Lost connection to MySQL server during query
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result
new file mode 100644
index 00000000000..bb4eb829abc
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result
@@ -0,0 +1,80 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM t1;
+COUNT(*) > 0
+1
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+connection node_2;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_3;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+connection node_2;
+connection node_3;
+connection node_1a;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_3;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+CALL mtr.add_suppression("failed to send SR rollback for");
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_join_slave.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_join_slave.result
new file mode 100644
index 00000000000..0260ebec86a
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_join_slave.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+COMMIT;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+connection node_2;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+connection node_3;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_master.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_master.result
new file mode 100644
index 00000000000..1a179565666
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_master.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_3;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_2;
+Killing server ...
+connection node_3;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply.result
new file mode 100644
index 00000000000..595bd30d675
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply.result
@@ -0,0 +1,53 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (15);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 15
+1
+connection node_1;
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 15 FROM t1;
+COUNT(*) = 15
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+connection node_3;
+CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member");
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback.result
new file mode 100644
index 00000000000..239eb748385
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback.result
@@ -0,0 +1,58 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (15);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 15
+1
+connection node_1;
+ROLLBACK;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result
new file mode 100644
index 00000000000..21e301ed353
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result
@@ -0,0 +1,31 @@
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+Killing server ...
+INSERT INTO t1 VALUES (6);
+ROLLBACK;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result
new file mode 100644
index 00000000000..4a135cd9274
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result
@@ -0,0 +1,44 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+LOCK TABLE t2 WRITE;
+connection node_1;
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+Killing server ...
+connection node_1;
+COMMIT;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split.result
new file mode 100644
index 00000000000..1a50bace279
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split.result
@@ -0,0 +1,117 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (10);
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (200);
+INSERT INTO t1 VALUES (201);
+INSERT INTO t1 VALUES (202);
+INSERT INTO t1 VALUES (203);
+INSERT INTO t1 VALUES (204);
+connection node_3;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (300);
+INSERT INTO t1 VALUES (301);
+INSERT INTO t1 VALUES (302);
+INSERT INTO t1 VALUES (303);
+INSERT INTO t1 VALUES (304);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1a;
+connection node_2a;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+connection node_3a;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+connection node_1a;
+INSERT INTO t1 VALUES (20);
+INSERT INTO t1 VALUES (21);
+INSERT INTO t1 VALUES (22);
+INSERT INTO t1 VALUES (23);
+INSERT INTO t1 VALUES (24);
+connection node_2a;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+connection node_3a;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+connection node_1a;
+connection node_2a;
+connection node_3a;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+wsrep_gcomm_uuid_match
+1
+connection node_3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+COUNT(DISTINCT node_uuid) = 1
+1
+wsrep_gcomm_uuid_match
+1
+connection node_1;
+INSERT INTO t1 VALUES (30);
+INSERT INTO t1 VALUES (31);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (33);
+INSERT INTO t1 VALUES (34);
+COMMIT;
+SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
+COUNT(*) = 15 MIN(f1) = 10 MAX(f1) = 34
+1 1 1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+connection node_2;
+COMMIT;
+SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
+COUNT(*) = 15 MIN(f1) = 10 MAX(f1) = 34
+1 1 1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+connection node_3;
+COMMIT;
+SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
+COUNT(*) = 15 MIN(f1) = 10 MAX(f1) = 34
+1 1 1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+DROP TABLE t1;
+connection node_1;
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
+connection node_2;
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
+connection node_3;
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test
new file mode 100644
index 00000000000..b8d46db74f1
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test
@@ -0,0 +1,47 @@
+--source include/galera_cluster.inc
+
+--connection node_2
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM t1;
+
+--connection node_2a
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+SET SESSION wsrep_sync_wait=0;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (2);
+--error ER_UNKNOWN_COM_ERROR
+COMMIT;
+
+--connection node_2a
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+DROP TABLE t1;
+
+CALL mtr.add_suppression("replication aborted");
+CALL mtr.add_suppression("WSREP: fragment replication failed: 3");
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+--source include/galera_wait_ready.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test
new file mode 100644
index 00000000000..bf19ea84c87
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test
@@ -0,0 +1,39 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COMMIT;
+SELECT COUNT(*) FROM t1;
+
+--connection node_2
+SELECT COUNT(*) FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test
new file mode 100644
index 00000000000..6d49247ab5e
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test
@@ -0,0 +1,80 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the case where the cluster splits 3 ways.
+# The master transitions to a non-prim view and back to prim. Its ongoing
+# should fail to commit.
+#
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+--connection node_2
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (20);
+INSERT INTO t1 VALUES (21);
+INSERT INTO t1 VALUES (22);
+INSERT INTO t1 VALUES (23);
+INSERT INTO t1 VALUES (24);
+
+--connection node_1
+--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+#
+# Isolate node_2 into a separate non-primary component
+#
+
+--connection node_2a
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+--disable_query_log
+SET WSREP_ON=OFF;
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SET WSREP_ON=ON;
+--enable_query_log
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+#
+# Confirm that node_1 has no transactions in SR table
+#
+
+--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+#
+# Restore cluster
+#
+
+--connection node_2a
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+--source include/galera_wait_ready.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_1
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+SELECT * FROM t1;
+COMMIT;
+
+--connection node_1
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--connection node_2
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-609.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-609.test
new file mode 100644
index 00000000000..fd346cf365b
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-609.test
@@ -0,0 +1,30 @@
+#
+# GCF-609 SR: Assertion wsrep_apply_cb on slave after master causes a duplicate key error
+#
+
+--source include/galera_cluster.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+--connection node_2
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+INSERT INTO t1 VALUES (31),(32),(33);
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COMMIT;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test
new file mode 100644
index 00000000000..38d95556e48
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test
@@ -0,0 +1,137 @@
+#
+# Exercise the crash points which crash the server at various points important to SR
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+
+--connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+#
+# crash_last_fragment_commit_before_fragment_removal
+#
+
+--connection node_2
+--enable_reconnect
+SET GLOBAL debug="d,crash_last_fragment_commit_before_fragment_removal";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc
+
+--echo crash_last_fragment_commit_before_fragment_removal
+
+--connection node_2
+--error 2006,2013
+COMMIT;
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_2
+--source include/start_mysqld.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc
+
+#
+# crash_last_fragment_commit_after_fragment_removal
+#
+
+--connection node_2
+SET GLOBAL debug="d,crash_last_fragment_commit_after_fragment_removal";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc
+
+--echo crash_last_fragment_commit_after_fragment_removal
+
+--connection node_2
+--error 2006,2013
+COMMIT;
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_2
+--source include/start_mysqld.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc
+
+#
+# crash_last_fragment_commit_success
+#
+# Case crash_last_fragment_commit_success is commented out,
+# the changes will be visible on slave due to succesful commit,
+# so the galera_sr_crash_post_check will fail.
+#
+
+# --connection node_2
+# SET GLOBAL debug="d,crash_last_fragment_commit_success";
+# --source suite/galera_3nodes/include/galera_expect_node_crash.inc
+# --source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc
+
+# --echo crash_last_fragment_commit_success
+
+# --connection node_2
+# --error 2006,2013
+# COMMIT;
+
+# --source include/start_mysqld.inc
+# --source suite/galera_3nodes/include/galera_sr_crash_post_check.inc
+
+#
+# crash_replicate_fragment_success
+#
+
+--connection node_2
+SET GLOBAL debug="d,crash_replicate_fragment_success";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc
+
+--echo crash_replicate_fragment_success
+
+--connection node_2
+--error 2006,2013
+COMMIT;
+
+--source include/start_mysqld.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc
+
+#
+# crash_replicate_fragment_after_certify
+#
+
+--connection node_2
+SET GLOBAL debug="d,crash_replicate_fragment_after_certify";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc
+
+--echo crash_replicate_fragment_after_certify
+
+--connection node_2
+--error 2006,2013
+COMMIT;
+
+--source include/start_mysqld.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc
+
+#
+# crash_replicate_fragment_before_certify
+#
+
+--connection node_2
+SET GLOBAL debug="d,crash_replicate_fragment_before_certify";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc
+
+--echo crash_replicate_fragment_before_certify
+
+--connection node_2
+--error 2006,2013
+COMMIT;
+
+--source include/start_mysqld.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc
+
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test
new file mode 100644
index 00000000000..24a518af9f7
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test
@@ -0,0 +1,49 @@
+#
+# Exercise the crash points which crash the server at various points important to SR
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+
+--connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+#
+# crash_apply_cb_before_append_frag
+#
+
+--connection node_3
+SET GLOBAL debug="d,crash_apply_cb_before_append_frag";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes2.inc
+
+--connection node_3
+--error 0,2006,2013
+COMMIT;
+
+--source include/start_mysqld.inc
+--sleep 5
+--source suite/galera_3nodes/include/galera_sr_crash_post_check2.inc
+
+#
+# crash_apply_cb_after_append_frag
+#
+
+--connection node_3
+SET GLOBAL debug="d,crash_apply_cb_after_append_frag";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes2.inc
+
+--connection node_3
+--error 0,2006,2013
+COMMIT;
+
+--source include/start_mysqld.inc
+--sleep 5
+--source suite/galera_3nodes/include/galera_sr_crash_post_check2.inc
+
+--connection node_1
+CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member");
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test
new file mode 100644
index 00000000000..79948e5a46d
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test
@@ -0,0 +1,70 @@
+#
+# Exercise the crash points which crash the server at various points important to SR
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+
+--connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--enable_reconnect
+--connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+#
+# crash_commit_cb_last_fragment_commit_success
+#
+
+--connection node_3
+SET GLOBAL debug="d,crash_commit_cb_last_fragment_commit_success";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc
+
+--source include/start_mysqld.inc
+--sleep 5
+--source include/galera_wait_ready.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc
+
+#
+# crash_commit_cb_before_last_fragment_commit
+#
+
+--connection node_3
+SET GLOBAL debug="d,crash_commit_cb_before_last_fragment_commit";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc
+
+--source include/start_mysqld.inc
+--sleep 5
+--source include/galera_wait_ready.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc
+
+#
+# crash_apply_cb_after_fragment_removal
+#
+
+--connection node_3
+SET GLOBAL debug="d,crash_apply_cb_after_fragment_removal";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc
+
+--source include/start_mysqld.inc
+--sleep 5
+--source include/galera_wait_ready.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc
+
+#
+# crash_apply_cb_before_fragment_removal
+#
+
+--connection node_3
+SET GLOBAL debug="d,crash_apply_cb_before_fragment_removal";
+--source suite/galera_3nodes/include/galera_expect_node_crash.inc
+--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc
+
+--source include/start_mysqld.inc
+--sleep 5
+--source include/galera_wait_ready.inc
+--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test
new file mode 100644
index 00000000000..a32da959429
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test
@@ -0,0 +1,109 @@
+#
+# GCF-817 SR: master removes SR trx in non-primary view
+#
+
+--source include/galera_cluster.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+--connection node_1a
+# Force node #1 to go non-primary
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+
+SET SESSION wsrep_on = OFF;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+# SR table on master should still contain entries after going non-Prim
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# SR table on slave should eventually clean up entries when master goes non-Prim
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Restore node #1 to primary
+
+--connection node_1a
+#
+# The following sleep is a workaround for issue GCF-861.
+# Normally it's sufficient to make sure that the CC happened
+# by checking that wsrep_cluster_size has shrinked, as above.
+# However that is not always enough, so we sleep a few seconds.
+# See GCF-861 on how to reproduce.
+#
+
+--connection node_1a
+--sleep 6
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--source include/galera_wait_ready.inc
+
+# SR table on master should contain no entries after going back to Prim state
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+--connection node_2
+# And none on slave
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+# SR table is now empty everywhere
+--connection node_1a
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+DROP TABLE t1;
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test
new file mode 100644
index 00000000000..c5a6346d6a1
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test
@@ -0,0 +1,43 @@
+#
+# GCF-832 SR: mysql.wsrep_streaming_log table remains populated on all nodes after crash
+# followed by immediate recovery
+#
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_2
+SET GLOBAL debug="d,crash_last_fragment_commit_after_fragment_removal";
+
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--exec echo "wait" > $_expect_file_name
+
+CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB;
+
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
+--error 2013
+COMMIT;
+
+--source include/start_mysqld.inc
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--enable_reconnect
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test
new file mode 100644
index 00000000000..30fd0192f26
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test
@@ -0,0 +1,127 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the effect of gmcast.isolate on master during an SR transaction
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM t1;
+
+#
+# Trigger gmcast.isolate=1 .
+# The transaction is aborted and we expect the SR tables to be cleaned up
+#
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
+
+#
+# Expect that the transaction is cleaned up entirely across the cluster and in all mysql.wsrep_streaming_log tables
+#
+
+--connection node_2
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_3
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM t1;
+
+#
+# Restore cluster
+#
+
+--connection node_1a
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_1a
+--source include/galera_wait_ready.inc
+
+#
+# Confirm that the previous transaction is gone on Node #1 as well
+#
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+#
+# Confirm that the transaction can be retried
+#
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+COMMIT;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+SELECT COUNT(*) = 5 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+SELECT COUNT(*) = 5 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+CALL mtr.add_suppression("failed to send SR rollback for");
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test
new file mode 100644
index 00000000000..95aa1a37a78
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test
@@ -0,0 +1,59 @@
+#
+# This test kills the slave before a Streaming Replication transaction has started
+# and restarts it when the transaction is already in progress. IST should
+# bring the slave up to date so that it can receive the complete transaction.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_1
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--connection node_2
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--source include/start_mysqld.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+COMMIT;
+SELECT COUNT(*) = 10 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 10 FROM t1;
+
+--connection node_3
+SELECT COUNT(*) = 10 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test
new file mode 100644
index 00000000000..c7e7528679b
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test
@@ -0,0 +1,58 @@
+#
+# This test kills the master while a Streaming Replication transaction is in progress
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_2
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_3
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+--source include/kill_galera.inc
+
+--connection node_3
+# We expect that uncommitted values are no longer present
+
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# and we can insert them again
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+--source include/start_mysqld.inc
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply.test
new file mode 100644
index 00000000000..270af538085
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply.test
@@ -0,0 +1,81 @@
+#
+# This test kills the slave while a Streaming Replication transaction is in progress
+# and after a fragment has already been applied on the slave. It is expected that
+# after the slave restarts, the cluster will continue to be consistent
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+
+--connection node_2
+--source include/start_mysqld.inc
+
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (15);
+
+--connection node_2
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) = 15 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+COMMIT;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 15 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
+
+--connection node_3
+CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member");
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test
new file mode 100644
index 00000000000..c0df6b2777a
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test
@@ -0,0 +1,80 @@
+#
+# This test kills the slave while a Streaming Replication transaction is in progress
+# and after a fragment has already been applied on the slave. It is expected that
+# after the slave restarts, the cluster will continue to be consistent even if ROLLBACK
+# is issued on the SR transaction after restart.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+
+--connection node_2
+--source include/start_mysqld.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (15);
+
+--connection node_2
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) = 15 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+ROLLBACK;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test
new file mode 100644
index 00000000000..83964769ef5
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test
@@ -0,0 +1,56 @@
+#
+# This test kills the slave while a Streaming Replication transaction is in progress
+# and after a fragment has already been applied on the slave. It is expected that
+# after the slave restarts, the cluster will continue to be consistent
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+--sleep 1
+
+--connection node_1
+INSERT INTO t1 VALUES (6);
+ROLLBACK;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--source include/start_mysqld.inc
+--sleep 1
+
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+
+--connection node_2
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test
new file mode 100644
index 00000000000..92566fa6323
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test
@@ -0,0 +1,73 @@
+#
+# This test kills the slave while a Streaming Replication transaction is in progress
+# but before a fragment has already been applied on the slave. It is expected that
+# after the slave restarts, the cluster will continue to be consistent.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+
+# Block node #2's applier before table t1's inserts have come into play
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+CREATE TABLE t2 (f1 INTEGER);
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+LOCK TABLE t2 WRITE;
+
+--connection node_1
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--source include/kill_galera.inc
+--source include/start_mysqld.inc
+
+# Expect that the SR table will get some entries after the restart
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+--connection node_1
+COMMIT;
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+DROP TABLE t1;
+DROP TABLE t2;
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf
new file mode 100644
index 00000000000..910d945949a
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf
@@ -0,0 +1,5 @@
+!include ../galera_3nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=3'
+
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test
new file mode 100644
index 00000000000..62122fe4292
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test
@@ -0,0 +1,177 @@
+#
+# Test the case where the cluster splits 3 ways . The master remains in the
+# primary component and is able to commit its transaction.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+#
+# Begin a separate SR transaction on every node and confirm that each node
+# has SR table entries for every transaction
+#
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (10);
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (200);
+INSERT INTO t1 VALUES (201);
+INSERT INTO t1 VALUES (202);
+INSERT INTO t1 VALUES (203);
+INSERT INTO t1 VALUES (204);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 2 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (300);
+INSERT INTO t1 VALUES (301);
+INSERT INTO t1 VALUES (302);
+INSERT INTO t1 VALUES (303);
+INSERT INTO t1 VALUES (304);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+--connection node_1a
+--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 3 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+#
+# Isolate nodes #2 and #3 into separate non-primary components
+#
+
+--connection node_2a
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_3a
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (20);
+INSERT INTO t1 VALUES (21);
+INSERT INTO t1 VALUES (22);
+INSERT INTO t1 VALUES (23);
+INSERT INTO t1 VALUES (24);
+
+#
+# Restore cluster
+#
+
+--connection node_2a
+--source include/wsrep_wait_disconnect.inc
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+--source include/galera_wait_ready.inc
+
+--connection node_3a
+--source include/wsrep_wait_disconnect.inc
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+--source include/galera_wait_ready.inc
+
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+--let $node_1_gcomm_uuid = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'`
+
+--connection node_2a
+--source include/wait_condition.inc
+
+--connection node_3a
+--source include/wait_condition.inc
+
+
+#
+# Confirm that the rejoined nodes only have node #1's transaction in their SR tables
+#
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+--disable_query_log
+--eval SELECT DISTINCT node_uuid = '$node_1_gcomm_uuid' AS wsrep_gcomm_uuid_match FROM mysql.wsrep_streaming_log;
+--enable_query_log
+
+--connection node_3
+--error ER_LOCK_DEADLOCK
+COMMIT;
+SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
+--disable_query_log
+--eval SELECT DISTINCT node_uuid = '$node_1_gcomm_uuid' AS wsrep_gcomm_uuid_match FROM mysql.wsrep_streaming_log;
+--enable_query_log
+
+#
+# Finalize transaction on node #1
+#
+
+--connection node_1
+INSERT INTO t1 VALUES (30);
+INSERT INTO t1 VALUES (31);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (33);
+INSERT INTO t1 VALUES (34);
+COMMIT;
+
+#
+# Confirm that transaction is replicated correctly and SR tables are empty at the end of the test
+#
+
+SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SET AUTOCOMMIT=ON;
+
+--connection node_2
+COMMIT;
+SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SET AUTOCOMMIT=ON;
+
+--connection node_3
+COMMIT;
+SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SET AUTOCOMMIT=ON;
+
+DROP TABLE t1;
+
+--connection node_1
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
+--connection node_2
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
+--connection node_3
+CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
+
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def
new file mode 100644
index 00000000000..94f328bf31b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/disabled.def
@@ -0,0 +1,3 @@
+mysql-wsrep-features#29 : binlog_format=STATEMENT not supported with SR
+GCF-574 : CTAS is not supported together with SR
+galera_sr_sbr : binlog_format=STATEMENT not supported with SR
diff --git a/mysql-test/suite/galera_sr/galera_2nodes.cnf b/mysql-test/suite/galera_sr/galera_2nodes.cnf
new file mode 100644
index 00000000000..0412b5654dd
--- /dev/null
+++ b/mysql-test/suite/galera_sr/galera_2nodes.cnf
@@ -0,0 +1 @@
+!include ../galera/galera_2nodes.cnf
diff --git a/mysql-test/suite/galera_sr/my.cnf b/mysql-test/suite/galera_sr/my.cnf
new file mode 100644
index 00000000000..ca163a540d9
--- /dev/null
+++ b/mysql-test/suite/galera_sr/my.cnf
@@ -0,0 +1 @@
+!include galera_2nodes.cnf
diff --git a/mysql-test/suite/galera_sr/r/GCF-1008.result b/mysql-test/suite/galera_sr/r/GCF-1008.result
new file mode 100644
index 00000000000..541ac3cddfb
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-1008.result
@@ -0,0 +1,70 @@
+connection node_2;
+connection node_1;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'x');
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_local_commit_monitor_enter';
+connection node_2;
+COMMIT;
+connection node_2b;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+REPLACE INTO t1 VALUES (1,'y');
+connection node_2b;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'signal=before_local_commit_monitor_enter';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'x');
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_certify_apply_monitor_enter';
+connection node_2;
+COMMIT;
+connection node_2b;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+REPLACE INTO t1 VALUES (1,'y');
+connection node_2b;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'signal=before_certify_apply_monitor_enter';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-1018.result b/mysql-test/suite/galera_sr/r/GCF-1018.result
new file mode 100644
index 00000000000..ec5bdca214c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-1018.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+INSERT INTO t1 (f2) VALUES ('a');
+INSERT INTO t1 (f2) VALUES ('b');
+INSERT INTO t1 (f2) VALUES ('c');
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_certify_apply_monitor_enter';
+connection node_2;
+SET SESSION wsrep_trx_fragment_size = 64;
+DELETE FROM t1 ORDER BY f1 DESC LIMIT 2;;
+connection node_2a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+connection node_1;
+INSERT INTO t1 (f2) VALUES ('d'),('e');
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'signal=after_certify_apply_monitor_enter';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_2;
+Got one of the listed errors
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-1018B.result b/mysql-test/suite/galera_sr/r/GCF-1018B.result
new file mode 100644
index 00000000000..4752c072cc1
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-1018B.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 64;
+SET SESSION innodb_lock_wait_timeout = 1000;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 64;
+SET SESSION innodb_lock_wait_timeout = 1000;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-1043A.result b/mysql-test/suite/galera_sr/r/GCF-1043A.result
new file mode 100644
index 00000000000..cc90461291d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-1043A.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+Running a concurrent test with the following queries:
+DELETE FROM t1
+REPLACE INTO t1 VALUES (1,'y'),(2,'x')
+REPLACE INTO t1 VALUES (1,'y'),(2,'y'),(3,'y')
+connection node_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+include/diff_servers.inc [servers=1 2]
+DROP TABLE t1;
+Concurrent test end
diff --git a/mysql-test/suite/galera_sr/r/GCF-1043B.result b/mysql-test/suite/galera_sr/r/GCF-1043B.result
new file mode 100644
index 00000000000..a10295c00b9
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-1043B.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+Running a concurrent test with the following queries:
+DELETE FROM t1
+INSERT INTO t1 VALUES (1,'y'),(2,'x')
+UPDATE t1 SET f2 = 'y' WHERE f1 = 1 OR f1 = 2;
+connection node_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+include/diff_servers.inc [servers=1 2]
+DROP TABLE t1;
+Concurrent test end
diff --git a/mysql-test/suite/galera_sr/r/GCF-1051.result b/mysql-test/suite/galera_sr/r/GCF-1051.result
new file mode 100644
index 00000000000..82fa389bb1d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-1051.result
@@ -0,0 +1,46 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size=1;
+connection node_1;
+START TRANSACTION;
+SAVEPOINT A;
+INSERT INTO t1 VALUES (1);
+ROLLBACK TO SAVEPOINT A;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+SAVEPOINT A;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT A;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-1060.result b/mysql-test/suite/galera_sr/r/GCF-1060.result
new file mode 100644
index 00000000000..58af97d064b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-1060.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+Running a concurrent test with the following queries:
+TRUNCATE TABLE t1
+INSERT INTO t1 VALUE (1,'x'),(2,'x'),(3,'x')
+INSERT INTO t1 VALUE (4, 'z');
+connection node_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;;;
+include/diff_servers.inc [servers=1 2]
+DROP TABLE t1;
+Concurrent test end
diff --git a/mysql-test/suite/galera_sr/r/GCF-437.result b/mysql-test/suite/galera_sr/r/GCF-437.result
new file mode 100644
index 00000000000..1aa0c9c0768
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-437.result
@@ -0,0 +1,12 @@
+CREATE TABLE ten (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 2 * 1024 * 1024;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+ERROR HY000: Writing one row to the row-based binary log failed
+CALL mtr.add_suppression("InnoDB: The total blob data length*");
+CALL mtr.add_suppression("WSREP: Error writing into mysql.wsrep_streaming_log: 139");
+CALL mtr.add_suppression("WSREP: Failed to write to frag table: 1");
+CALL mtr.add_suppression("WSREP: Failed to append frag to persistent storage");
+DROP TABLE t1;
+DROP table ten;
diff --git a/mysql-test/suite/galera_sr/r/GCF-561.result b/mysql-test/suite/galera_sr/r/GCF-561.result
new file mode 100644
index 00000000000..58663caf134
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-561.result
@@ -0,0 +1,50 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+ALTER TABLE t1 DROP COLUMN f2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+INSERT INTO t1 VALUES (6, 6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (6, 6);
+ERROR 21S01: Column count doesn't match value count at row 1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-571.result b/mysql-test/suite/galera_sr/r/GCF-571.result
new file mode 100644
index 00000000000..4b4f749d910
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-571.result
@@ -0,0 +1,67 @@
+connection node_2;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('%abcdef%');
+INSERT INTO t1 VALUES ('%abcdef%');
+INSERT INTO t1 VALUES ('%abcdef%');
+INSERT INTO t1 VALUES ('%abcdef%');
+SAVEPOINT A;
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%';
+COUNT(*) > 0
+1
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%';
+COUNT(*) = 1
+0
+connection node_1;
+ROLLBACK TO SAVEPOINT A;
+connection node_1a;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%';
+COUNT(*) > 0
+1
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%';
+COUNT(*) = 1
+0
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%';
+COUNT(*) = 1
+0
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%';
+COUNT(*) > 0
+1
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%';
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%';
+COUNT(*) = 1
+0
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%';
+COUNT(*) = 1
+0
+connection node_1;
+ROLLBACK;
+connection node_1a;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-572.result b/mysql-test/suite/galera_sr/r/GCF-572.result
new file mode 100644
index 00000000000..cb4d48b3600
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-572.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'node1');
+connection node_1a;
+INSERT INTO t1 VALUES (5, 'node2');
+connection node_1;
+INSERT INTO t1 VALUES (5, 'node1');
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+5 node2
+SET SESSION wsrep_trx_fragment_size = 10000;
+START TRANSACTION;
+INSERT INTO t1 VALUE (10, 'node1');
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+connection node_1a;
+INSERT INTO t1 VALUES(15, 'node2');
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+5 node2
+10 node1
+INSERT INTO t1 VALUES(15, 'node1');
+ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
+COMMIT;
+SELECT * FROM t1;
+f1 f2
+5 node2
+10 node1
+15 node2
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-574.result b/mysql-test/suite/galera_sr/r/GCF-574.result
new file mode 100644
index 00000000000..bbf817c8c6c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-574.result
@@ -0,0 +1,11 @@
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+wsrep_last_committed_delta
+1
+SELECT COUNT(*) = 10000 FROM t1;
+COUNT(*) = 10000
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/r/GCF-580.result b/mysql-test/suite/galera_sr/r/GCF-580.result
new file mode 100644
index 00000000000..3ee69c6c4b3
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-580.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+last_committed_matches_fragment_count
+1
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-585.result b/mysql-test/suite/galera_sr/r/GCF-585.result
new file mode 100644
index 00000000000..ab5fed59081
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-585.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+create table t1 (f1 integer primary key) engine=innodb;
+set autocommit=off;
+set session wsrep_trx_fragment_size=1;
+start transaction;
+insert into t1 values (1);
+insert into t1 values (2),(1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+alter table t1 drop primary key;
+drop table t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+update t1 set f1 = 100 where f1 = 10;
+connection node_2;
+INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+SET SESSION wsrep_trx_fragment_size=1;
+SET SESSION innodb_lock_wait_timeout=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+delete from t1 where f1 > 10;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+delete from t1 where f1 > 10 and f1 < 100;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-597.result b/mysql-test/suite/galera_sr/r/GCF-597.result
new file mode 100644
index 00000000000..7afca229251
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-597.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+SET wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+ROLLBACK;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-620.result b/mysql-test/suite/galera_sr/r/GCF-620.result
new file mode 100644
index 00000000000..33789f82add
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-620.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 200;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+SAVEPOINT A;
+INSERT INTO t1 VALUES (1);
+ROLLBACK TO SAVEPOINT A;
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-623.result b/mysql-test/suite/galera_sr/r/GCF-623.result
new file mode 100644
index 00000000000..f3500b7ac2b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-623.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-627.result b/mysql-test/suite/galera_sr/r/GCF-627.result
new file mode 100644
index 00000000000..891cf4af5a9
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-627.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER);
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+connection node_2;
+DROP TABLE t1;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+INSERT INTO t1 VALUES (2);
+ERROR 42S02: Table 'test.t1' doesn't exist
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/r/GCF-845.result b/mysql-test/suite/galera_sr/r/GCF-845.result
new file mode 100644
index 00000000000..df842049332
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-845.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+CREATE TABLE IF NOT EXISTS t1 (f1 INTEGER) ENGINE = InnoDB;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (161);
+COMMIT;
+DELETE FROM t1 WHERE f1 > 13;
+disconnect node_1a;
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+include/assert_grep.inc [No BF-BF log line found]
diff --git a/mysql-test/suite/galera_sr/r/GCF-851.result b/mysql-test/suite/galera_sr/r/GCF-851.result
new file mode 100644
index 00000000000..52aa4c78745
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-851.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION WSREP_TRX_FRAGMENT_SIZE=1;
+SET SESSION AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (10);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_1;
+START TRANSACTION;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) > 0 FROM t1;
+COUNT(*) > 0
+1
+connection node_1;
+SELECT COUNT(*) > 0 FROM t1;
+COUNT(*) > 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-867.result b/mysql-test/suite/galera_sr/r/GCF-867.result
new file mode 100644
index 00000000000..9521a86d621
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-867.result
@@ -0,0 +1,4 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-889.result b/mysql-test/suite/galera_sr/r/GCF-889.result
new file mode 100644
index 00000000000..617377de15a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-889.result
@@ -0,0 +1,25 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_trx_fragment_size = 1;
+DELETE FROM t1 WHERE f1 = 1;
+SET SESSION wsrep_trx_fragment_size = 0;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1;
+COUNT(*) = 1
+1
+CALL mtr.add_suppression("Could not execute Delete_rows event on table");
+CALL mtr.add_suppression("Can't find record in 't1'");
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/GCF-900.result b/mysql-test/suite/galera_sr/r/GCF-900.result
new file mode 100644
index 00000000000..caa2d2c4138
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/GCF-900.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 128;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 0);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2, 0);
+connection node_2;
+ALTER TABLE t1 DROP COLUMN f2;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1a;
+INSERT INTO t1 VALUES (3, 0);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera-features#56.result b/mysql-test/suite/galera_sr/r/galera-features#56.result
new file mode 100644
index 00000000000..1d04b6f9cee
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera-features#56.result
@@ -0,0 +1,32 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+connection node_2;
+SET GLOBAL wsrep_slave_threads = 4;
+SET SESSION wsrep_trx_fragment_size = 1;
+connection node_1;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_1a;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_2;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_1;
+connection node_1a;
+connection node_2;
+SELECT COUNT(*) = 30000 FROM t1;
+COUNT(*) = 30000
+1
+SELECT COUNT(DISTINCT f1) = 30000 FROM t1;
+COUNT(DISTINCT f1) = 30000
+1
+SELECT COUNT(*) = 6 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+COUNT(*) = 6
+0
+connection default;
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_bf_abort.result b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort.result
new file mode 100644
index 00000000000..bf92a48b242
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort.result
@@ -0,0 +1,555 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait = 0;
+galera_sr_bf_abort_at_commit = 0
+after_replicate_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+INSERT INTO t1 VALUES (3);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+INSERT INTO t1 VALUES (3);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+connection node_1;
+INSERT INTO t1 VALUES (3);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+INSERT INTO t1 VALUES (3);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+galera_sr_bf_abort_at_commit = 1
+after_replicate_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+connection node_1;
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+connection node_1;
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+ROLLBACK;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+connection node_1;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: fragment replication failed: 1");
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_blob.result b/mysql-test/suite/galera_sr/r/galera_sr_blob.result
new file mode 100644
index 00000000000..db25f54a611
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_blob.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 TEXT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (REPEAT('x', 65535));
+connection node_2;
+wsrep_last_committed_delta
+1
+connection node_1;
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT LENGTH(f1) = 65535 FROM t1;
+LENGTH(f1) = 65535
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result
new file mode 100644
index 00000000000..79bc29200f9
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result
@@ -0,0 +1,65 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_1;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_cluster_address = '';
+SET SESSION wsrep_sync_wait = DEFAULT;
+connection node_2;
+INSERT INTO t1 VALUES (6);
+ERROR HY000: Lost connection to MySQL server during query
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2a;
+connection node_1;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2b;
+SELECT * FROM mysql.wsrep_streaming_log;
+node_uuid trx_id seqno flags frag
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+connection node_2b;
+CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for");
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result
new file mode 100644
index 00000000000..671745c8686
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result
@@ -0,0 +1,59 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+SET GLOBAL wsrep_cluster_address = '';
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait = default;
+connection node_1;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_1;
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (16);
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+CALL mtr.add_suppression("points to own listening address, blacklisting");
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_concurrent.result b/mysql-test/suite/galera_sr/r/galera_sr_concurrent.result
new file mode 100644
index 00000000000..75acba366c2
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_concurrent.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (2);
+INSERT INTO t2 VALUES (3);
+INSERT INTO t2 VALUES (4);
+INSERT INTO t2 VALUES (5);
+connection node_1;
+COMMIT;
+connection node_1a;
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SELECT COUNT(*) = 5 FROM t2;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict.result
new file mode 100644
index 00000000000..a45bffeaa81
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+INSERT INTO t1 VALUES(1);;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_1;
+COMMIT;
+connection node_2;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit.result
new file mode 100644
index 00000000000..5de1ac2422c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+COMMIT;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit2.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit2.result
new file mode 100644
index 00000000000..2ee3d4c714c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit2.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+INSERT INTO t1 VALUES (5);;
+connection node_1;
+COMMIT;
+connection node_2;
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict_with_rollback_master.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict_with_rollback_master.result
new file mode 100644
index 00000000000..92bf007e21b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict_with_rollback_master.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+ROLLBACK;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result
new file mode 100644
index 00000000000..cf9c7771bed
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result
@@ -0,0 +1,48 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_1;
+INSERT INTO t1 VALUES (6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+ROLLBACK;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (1);
+INSERT INTO t1 (f1) VALUES (2);
+INSERT INTO t1 (f1) VALUES (3);
+INSERT INTO t1 (f1) VALUES (4);
+INSERT INTO t1 (f1) VALUES (5);
+INSERT INTO t1 (f1) VALUES (6);
+COMMIT;
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_schema.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_schema.result
new file mode 100644
index 00000000000..fcd6cfa4a6e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_schema.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+DROP SCHEMA test;
+SELECT COUNT(*) = 0 FROM test.t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+connection node_1;
+INSERT INTO test.t1 VALUES (6, 6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+INSERT INTO test.t1 VALUES (6, 6);
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_slave.result
new file mode 100644
index 00000000000..58663caf134
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_slave.result
@@ -0,0 +1,50 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+ALTER TABLE t1 DROP COLUMN f2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+INSERT INTO t1 VALUES (6, 6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (6, 6);
+ERROR 21S01: Column count doesn't match value count at row 1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_unrelated.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_unrelated.result
new file mode 100644
index 00000000000..0f23ade58c1
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_unrelated.result
@@ -0,0 +1,42 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+ALTER TABLE t2 DROP COLUMN f2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+connection node_1;
+INSERT INTO t1 VALUES (6, 6);
+connection node_2;
+connection node_1;
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result b/mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result
new file mode 100644
index 00000000000..b23b934da33
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result
@@ -0,0 +1,46 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB;
+CREATE UNIQUE INDEX i1 ON t1 (f1(512));
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1024;
+INSERT INTO t1 VALUES (REPEAT('a', 512));
+INSERT INTO t1 VALUES (REPEAT('b', 512));
+INSERT INTO t1 VALUES (REPEAT('c', 512));
+INSERT INTO t1 VALUES (REPEAT('d', 512));
+INSERT INTO t1 VALUES (REPEAT('e', 512));
+INSERT INTO t1 VALUES (REPEAT('f', 512));
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (REPEAT('c', 512));
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+INSERT INTO t1 VALUES (REPEAT('d', 512));
+INSERT INTO t1 VALUES (REPEAT('e', 512));
+INSERT INTO t1 VALUES (REPEAT('f', 512));
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (REPEAT('a', 512));
+INSERT INTO t1 VALUES (REPEAT('b', 512));
+INSERT INTO t1 VALUES (REPEAT('c', 512));
+COMMIT;
+connection node_1;
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+connection node_2;
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_fk_conflict.result b/mysql-test/suite/galera_sr/r/galera_sr_fk_conflict.result
new file mode 100644
index 00000000000..1d12533cc1d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_fk_conflict.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+CREATE TABLE grandparent (
+id INT NOT NULL PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TABLE parent (
+id INT NOT NULL PRIMARY KEY,
+grandparent_id INT,
+FOREIGN KEY (grandparent_id)
+REFERENCES grandparent(id)
+ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT NOT NULL PRIMARY KEY,
+grandparent_id INT,
+FOREIGN KEY (grandparent_id)
+REFERENCES parent(grandparent_id)
+ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO grandparent VALUES (1),(2),(3),(4);
+INSERT INTO parent VALUES (1,1), (2,2);
+INSERT INTO child VALUES (1,1), (2,2);
+connection node_1;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+UPDATE grandparent SET id = 5 WHERE id = 1;
+connection node_2;
+SET SESSION innodb_lock_wait_timeout = 1;
+UPDATE grandparent SET id = 10 WHERE id = 5;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+DELETE FROM child;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection node_1;
+COMMIT;
+include/diff_servers.inc [servers=1 2]
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE grandparent;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_gtid.result b/mysql-test/suite/galera_sr/r/galera_sr_gtid.result
new file mode 100644
index 00000000000..be631d1d916
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_gtid.result
@@ -0,0 +1,57 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+SET SESSION wsrep_trx_fragment_size=1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SET SESSION wsrep_trx_fragment_size=1;
+UPDATE t1 SET f1 = 2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size=0;
+connection node_2;
+SET SESSION wsrep_trx_fragment_size=0;
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000002 <Pos> Gtid_list 1 <End_log_pos> []
+mysqld-bin.000002 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001
+mysqld-bin.000002 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000002
+mysqld-bin.000002 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1
+mysqld-bin.000002 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INT PRIMARY KEY)
+mysqld-bin.000002 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2
+mysqld-bin.000002 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1)
+mysqld-bin.000002 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000002 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000002 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000002 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3
+mysqld-bin.000002 <Pos> Annotate_rows 2 <End_log_pos> UPDATE t1 SET f1 = 2
+mysqld-bin.000002 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000002 <Pos> Update_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000002 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */
+connection node_2;
+SELECT 1 FROM DUAL;
+1
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000003 <Pos> Gtid_list 2 <End_log_pos> []
+mysqld-bin.000003 <Pos> Binlog_checkpoint 2 <End_log_pos> mysqld-bin.000003
+mysqld-bin.000003 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1
+mysqld-bin.000003 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INT PRIMARY KEY)
+mysqld-bin.000003 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2
+mysqld-bin.000003 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1)
+mysqld-bin.000003 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000003 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000003 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000003 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3
+mysqld-bin.000003 <Pos> Annotate_rows 2 <End_log_pos> UPDATE t1 SET f1 = 2
+mysqld-bin.000003 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000003 <Pos> Update_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000003 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_insert_select.result b/mysql-test/suite/galera_sr/r/galera_sr_insert_select.result
new file mode 100644
index 00000000000..0302290123d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_insert_select.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) SELECT REPEAT('a', 255) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+COMMIT;
+connection node_2;
+connection node_1;
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_nobootstrap.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_nobootstrap.result
new file mode 100644
index 00000000000..a78926a9794
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_nobootstrap.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+Killing server ...
+connection node_1;
+Killing server ...
+connection node_1;
+connection node_2;
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result
new file mode 100644
index 00000000000..7525cd6d4b7
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+Killing server ...
+connection node_1;
+Killing server ...
+connection node_1;
+connection node_2;
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_pcrecovery.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_pcrecovery.result
new file mode 100644
index 00000000000..7525cd6d4b7
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_pcrecovery.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+Killing server ...
+connection node_1;
+Killing server ...
+connection node_1;
+connection node_2;
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_connection.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_connection.result
new file mode 100644
index 00000000000..96a85bc038b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_connection.result
@@ -0,0 +1,32 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+COMMIT;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1a;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_query.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_query.result
new file mode 100644
index 00000000000..59942e717e7
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_query.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
+connection node_2;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+Killing query ...
+connection node_1;
+ERROR 70100: Query execution was interrupted
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+INSERT INTO t1 SELECT 1 FROM ten AS t1, ten AS t2, ten AS t3;
+SELECT COUNT(*) = 1000 FROM t1;
+COUNT(*) = 1000
+1
+connection node_1a;
+SELECT COUNT(*) = 1000 FROM t1;
+COUNT(*) = 1000
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_slave.result
new file mode 100644
index 00000000000..b4e84b1b72a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_slave.result
@@ -0,0 +1,53 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+LOCK TABLE t2 WRITE;
+connection node_1;
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (15);
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 15 FROM t1;
+COUNT(*) = 15
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_large_fragment.result b/mysql-test/suite/galera_sr/r/galera_sr_large_fragment.result
new file mode 100644
index 00000000000..bf111f5cee4
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_large_fragment.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1024 * 1024 * 10;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 50000 FROM t1;
+COUNT(*) > 50000
+1
+connection node_1;
+ROLLBACK;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M';
+SET SESSION wsrep_sync_wait = 7;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+COUNT(*) = 0
+1
+COUNT(*) = 0
+1
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_load_data.result b/mysql-test/suite/galera_sr/r/galera_sr_load_data.result
new file mode 100644
index 00000000000..a474a7e3ae8
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_load_data.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 512;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+connection node_1;
+connection node_2;
+SELECT COUNT(*) = 20000 FROM t1;
+COUNT(*) = 20000
+1
+wsrep_last_committed_diff
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_load_data_splitting.result b/mysql-test/suite/galera_sr/r/galera_sr_load_data_splitting.result
new file mode 100644
index 00000000000..b25a8877005
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_load_data_splitting.result
@@ -0,0 +1,9 @@
+SET SESSION wsrep_trx_fragment_size = 512;
+SET GLOBAL wsrep_load_data_splitting = TRUE;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SELECT COUNT(*) = 95000 FROM t1;
+COUNT(*) = 95000
+1
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_log_bin.result b/mysql-test/suite/galera_sr/r/galera_sr_log_bin.result
new file mode 100644
index 00000000000..cb8e84383bc
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_log_bin.result
@@ -0,0 +1,124 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t4 (f1 INTEGER) ENGINE=InnoDB;
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t3 VALUES (1);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t4 VALUES (1);
+connection node_1;
+INSERT INTO t1 VALUES (2);
+COMMIT;
+connection node_1a;
+INSERT INTO t2 VALUES (2);
+COMMIT;
+connection node_2;
+INSERT INTO t3 VALUES (2);
+COMMIT;
+connection node_2a;
+INSERT INTO t4 VALUES (2);
+COMMIT;
+connection node_1;
+SELECT COUNT(*) = 2 FROM t4;
+COUNT(*) = 2
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 <Pos> Gtid_list 1 <End_log_pos> []
+mysqld-bin.000001 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-1
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-4
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */
+connection node_2;
+SELECT COUNT(*) = 2 FROM t4;
+COUNT(*) = 2
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 <Pos> Gtid_list 2 <End_log_pos> []
+mysqld-bin.000001 <Pos> Binlog_checkpoint 2 <End_log_pos> mysqld-bin.000001
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-1
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-4
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (1)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (2)
+mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4)
+mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */
+DROP TABLE t1,t2,t3,t4;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_many_fragments.result b/mysql-test/suite/galera_sr/r/galera_sr_many_fragments.result
new file mode 100644
index 00000000000..8c89d100260
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_many_fragments.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 10000 FROM t1;
+COUNT(*) = 10000
+1
+connection node_1;
+ROLLBACK;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M';
+SET SESSION wsrep_sync_wait = 7;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+COUNT(*) = 0
+1
+COUNT(*) = 0
+1
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result
new file mode 100644
index 00000000000..97818f072e1
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 TEXT) ENGINE=MyISAM;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+INSERT INTO t1 VALUES (REPEAT('x', 65535));
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT LENGTH(f1) = 65535 FROM t1;
+LENGTH(f1) = 65535
+1
+DROP TABLE t1;
+connection node_1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_mysqldump_sst.result b/mysql-test/suite/galera_sr/r/galera_sr_mysqldump_sst.result
new file mode 100644
index 00000000000..f1b60c7f76a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_mysqldump_sst.result
@@ -0,0 +1,58 @@
+connection node_2;
+connection node_1;
+Setting SST method to mysqldump ...
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+connection node_1;
+CREATE USER 'sst';
+GRANT ALL PRIVILEGES ON *.* TO 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1000;
+START TRANSACTION;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 255) FROM ten AS a1, ten AS a2, ten AS a3;
+UPDATE t1 SET f2 = REPEAT('y', 255);
+connection node_2;
+connection node_2;
+Shutting down server ...
+connection node_1;
+connection node_2;
+Starting server ...
+connection node_1;
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+UPDATE t1 SET f2 = REPEAT('z', 255);
+COMMIT;
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 1000 FROM t1;
+COUNT(*) = 1000
+1
+SELECT COUNT(*) = 1000 FROM t1 WHERE f2 = REPEAT('z', 255);
+COUNT(*) = 1000
+1
+DROP TABLE t1;
+DROP TABLE ten;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size=0;
+connection node_1;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_parallel_apply.result b/mysql-test/suite/galera_sr/r/galera_sr_parallel_apply.result
new file mode 100644
index 00000000000..e2194e08cb8
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_parallel_apply.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET GLOBAL wsrep_slave_threads = 5;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (1);;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (2);;
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+COMMIT;
+connection node_1a;
+ROLLBACK;
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1;
+connection node_2;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback.result
new file mode 100644
index 00000000000..4b275c6e0b6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback.result
@@ -0,0 +1,42 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+connection node_2;
+connection node_1;
+ROLLBACK;
+connection node_2;
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+connection node_2;
+connection node_1;
+COMMIT;
+connection node_2;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback_retry.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback_retry.result
new file mode 100644
index 00000000000..054f7cf2eae
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback_retry.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+ROLLBACK;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+COMMIT;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback_savepoint.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback_savepoint.result
new file mode 100644
index 00000000000..f2efa20f0d3
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback_savepoint.result
@@ -0,0 +1,42 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+SAVEPOINT s1;
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+connection node_2;
+connection node_1;
+ROLLBACK TO SAVEPOINT s1;
+INSERT INTO t1 VALUES (21, 'c');
+INSERT INTO t1 VALUES (22, 'c');
+INSERT INTO t1 VALUES (23, 'c');
+INSERT INTO t1 VALUES (24, 'c');
+INSERT INTO t1 VALUES (25, 'c');
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 5
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 0
+0
+SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 5
+1
+connection node_1;
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback_statement.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback_statement.result
new file mode 100644
index 00000000000..21e6ef4b057
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback_statement.result
@@ -0,0 +1,22 @@
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB;
+INSERT INTO t1 (f2) SELECT REPEAT('a', 255) FROM ten AS a1, ten AS a2, ten AS a3;
+ALTER TABLE t1 CHANGE f1 f1 INTEGER;
+ALTER TABLE t1 DROP PRIMARY KEY;
+INSERT INTO t1 VALUES (1, 'abc');
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t2 SELECT * FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO t2 VALUES (1, 'abc');
+INSERT INTO t2 VALUES (2, 'abc');
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_sbr.result b/mysql-test/suite/galera_sr/r/galera_sr_sbr.result
new file mode 100644
index 00000000000..c83db3d5ea6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_sbr.result
@@ -0,0 +1,16 @@
+CREATE TABLE t1 (id INT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET SESSION BINLOG_FORMAT='STATEMENT';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+COMMIT;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_master.result b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_master.result
new file mode 100644
index 00000000000..eb493f66ed6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_master.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1),(2),(3);
+connection node_1;
+connection node_2;
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1),(2),(3);
+connection node_1;
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+DROP TABLE t1;
+connection node_2;
+CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for ");
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result
new file mode 100644
index 00000000000..568452b10b0
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result
@@ -0,0 +1,43 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11),(12),(13);
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21),(22),(23);
+connection node_2;
+connection node_1;
+connection node_1a;
+INSERT INTO t1 VALUES (14),(15),(16);
+COMMIT;
+connection node_2;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) > 0
+1
+SELECT COUNT(*) = 6 FROM t1 WHERE f1 IN (11,12,13,14,15,16);
+COUNT(*) = 6
+1
+connection node_1b;
+INSERT INTO t1 VALUES (24),(25),(26);
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 12 FROM t1;
+COUNT(*) = 12
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_small_gcache.result b/mysql-test/suite/galera_sr/r/galera_sr_small_gcache.result
new file mode 100644
index 00000000000..875f2df5214
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_small_gcache.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_2;
+SELECT COUNT(*) = 10000 FROM t1;
+COUNT(*) = 10000
+1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_table_contents.result b/mysql-test/suite/galera_sr/r/galera_sr_table_contents.result
new file mode 100644
index 00000000000..29bb71704e2
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_table_contents.result
@@ -0,0 +1,198 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+Start of Simple Insert
+INSERT INTO t1 VALUES (4);
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 73 Query thread_id=<QUERY_THREAD_ID> exec_time=<EXEC_TIME> error_code=0
+SET TIMESTAMP=<TIMESTAMP>/*!*/;
+/*!\C latin1 *//*!*/;
+BEGIN
+/*!*/;
+# at 193
+<ISO TIMESTAMP> server id 1 end_log_pos 114 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 234
+<ISO TIMESTAMP> server id 1 end_log_pos 150 Write_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+End of Simple Insert
+
+ROLLBACK;
+Start of Multi-row Update
+UPDATE t1 SET f1 = f1 + 10;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 73 Query thread_id=<QUERY_THREAD_ID> exec_time=<EXEC_TIME> error_code=0
+SET TIMESTAMP=<TIMESTAMP>/*!*/;
+/*!\C latin1 *//*!*/;
+BEGIN
+/*!*/;
+# at 193
+<ISO TIMESTAMP> server id 1 end_log_pos 114 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 234
+<ISO TIMESTAMP> server id 1 end_log_pos 156 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 197 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 239 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 280 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 322 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+End of Multi-row Update
+
+ROLLBACK;
+Start of Multi-table Update
+UPDATE t1, t2 SET t1.f1 = t1.f1 + 100, t2.f1 = t2.f1 + 100;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 82 Query thread_id=<QUERY_THREAD_ID> exec_time=<EXEC_TIME> error_code=0
+SET TIMESTAMP=<TIMESTAMP>/*!*/;
+/*!\C latin1 *//*!*/;
+BEGIN
+/*!*/;
+# at 202
+<ISO TIMESTAMP> server id 1 end_log_pos 123 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 243
+<ISO TIMESTAMP> server id 1 end_log_pos 164 Table_map: `test`.`t2` mapped to number <TABLE_ID>
+# at 284
+<ISO TIMESTAMP> server id 1 end_log_pos 206 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 247 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 288 Table_map: `test`.`t2` mapped to number <TABLE_ID>
+# at 202
+<ISO TIMESTAMP> server id 1 end_log_pos 330 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 371 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 412 Table_map: `test`.`t2` mapped to number <TABLE_ID>
+# at 202
+<ISO TIMESTAMP> server id 1 end_log_pos 454 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 495 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 536 Table_map: `test`.`t2` mapped to number <TABLE_ID>
+# at 202
+<ISO TIMESTAMP> server id 1 end_log_pos 578 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 619 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 660 Table_map: `test`.`t2` mapped to number <TABLE_ID>
+# at 202
+<ISO TIMESTAMP> server id 1 end_log_pos 702 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 743 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 784 Table_map: `test`.`t2` mapped to number <TABLE_ID>
+# at 202
+<ISO TIMESTAMP> server id 1 end_log_pos 826 Update_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+End of Multi-table Update
+
+ROLLBACK;
+Start of Savepoint
+INSERT INTO t1 VALUES (1000);
+SAVEPOINT X;
+INSERT INTO t1 VALUES (2000);
+ROLLBACK TO SAVEPOINT X;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 73 Query thread_id=<QUERY_THREAD_ID> exec_time=<EXEC_TIME> error_code=0
+SET TIMESTAMP=<TIMESTAMP>/*!*/;
+/*!\C latin1 *//*!*/;
+BEGIN
+/*!*/;
+# at 193
+<ISO TIMESTAMP> server id 1 end_log_pos 114 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 234
+<ISO TIMESTAMP> server id 1 end_log_pos 150 Write_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 231 Query thread_id=<QUERY_THREAD_ID> exec_time=<EXEC_TIME> error_code=0
+SET TIMESTAMP=<TIMESTAMP>/*!*/;
+/*!\C latin1 *//*!*/;
+SAVEPOINT `X`
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 272 Table_map: `test`.`t1` mapped to number <TABLE_ID>
+# at 161
+<ISO TIMESTAMP> server id 1 end_log_pos 308 Write_rows: table id <TABLE_ID> flags: STMT_END_F
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+DELIMITER /*!*/;
+# at 120
+<ISO TIMESTAMP> server id 1 end_log_pos 391 Query thread_id=<QUERY_THREAD_ID> exec_time=<EXEC_TIME> error_code=0
+SET TIMESTAMP=<TIMESTAMP>/*!*/;
+/*!\C latin1 *//*!*/;
+ROLLBACK TO `X`
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+End of Savepoint
+
+ROLLBACK;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_transaction_replay.result b/mysql-test/suite/galera_sr/r/galera_sr_transaction_replay.result
new file mode 100644
index 00000000000..5806ab5558d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_transaction_replay.result
@@ -0,0 +1,121 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+wsrep_local_replays
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'x' WHERE f1 = 1;
+SET SESSION wsrep_trx_fragment_size = 0;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+wsrep_local_replays
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DELETE FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_unit_statements.result b/mysql-test/suite/galera_sr/r/galera_sr_unit_statements.result
new file mode 100644
index 00000000000..4e3bd52483e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_unit_statements.result
@@ -0,0 +1,54 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 3;
+SET SESSION wsrep_trx_fragment_unit = 'statements';
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COUNT(*)
+0
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COUNT(*)
+1
+connection node_1;
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COUNT(*)
+2
+connection node_1;
+COMMIT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COUNT(*)
+0
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+COUNT(*)
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_v1_row_events.result b/mysql-test/suite/galera_sr/r/galera_sr_v1_row_events.result
new file mode 100644
index 00000000000..ab090e5c2a7
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_v1_row_events.result
@@ -0,0 +1,20 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ws_size.result b/mysql-test/suite/galera_sr/r/galera_sr_ws_size.result
new file mode 100644
index 00000000000..b7bdd94dd68
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_ws_size.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+SET SESSION wsrep_trx_fragment_size = 512;
+SET GLOBAL wsrep_provider_options='repl.max_ws_size=4096';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+COMMIT;
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SELECT COUNT(*) = 100 FROM t1;
+COUNT(*) = 100
+1
+DROP TABLE t1;
+DROP TABLE ten;
+connection node_1;
+call mtr.add_suppression('WSREP: transaction size limit.*');
+call mtr.add_suppression('WSREP: rbr write fail.*');
+call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*');
+call mtr.add_suppression('WSREP: transaction size exceeded.*');
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ws_size2.result b/mysql-test/suite/galera_sr/r/galera_sr_ws_size2.result
new file mode 100644
index 00000000000..6bd8b6b8212
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_ws_size2.result
@@ -0,0 +1,34 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+SET SESSION wsrep_trx_fragment_size = 256;
+SET GLOBAL wsrep_provider_options='repl.max_ws_size=128';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1, ten AS a2;
+Got one of the listed errors
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE ten;
+call mtr.add_suppression('WSREP: SR rollback replication failure.*');
+call mtr.add_suppression('WSREP: transaction size limit.*');
+call mtr.add_suppression('WSREP: SR rbr write fail.*');
+call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*');
+call mtr.add_suppression('WSREP: transaction size exceeded.*');
+call mtr.add_suppression('WSREP: fragment replication failed:');
+call mtr.add_suppression('WSREP: post commit failed for SR rollback');
+call mtr.add_suppression('WSREP: pre_commit for SR rollback returned 2, thd:*');
+call mtr.add_suppression('WSREP: wsrep_rollback failed to send SR ROLLBACK for *');
diff --git a/mysql-test/suite/galera_sr/r/galera_var_ignore_apply_errors_sr.result b/mysql-test/suite/galera_sr/r/galera_var_ignore_apply_errors_sr.result
new file mode 100644
index 00000000000..852208437e5
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_var_ignore_apply_errors_sr.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (2);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (3);
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SET SESSION wsrep_trx_fragment_size = 0;
+DROP TABLE t1;
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");
+CALL mtr.add_suppression("Can't find record in 't1'");
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep#215.result b/mysql-test/suite/galera_sr/r/mysql-wsrep#215.result
new file mode 100644
index 00000000000..623bef4c3c4
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep#215.result
@@ -0,0 +1,137 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 2;
+SET SESSION wsrep_trx_fragment_unit = 'statements';
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_1a;
+SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
+SET SESSION wsrep_sync_wait = 0;
+connection node_2;
+INSERT INTO t1 VALUES (1);
+connection node_1a;
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);;
+connection node_1a;
+connection node_1a;
+SET GLOBAL DEBUG_DBUG = '';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1a;
+SET DEBUG_SYNC = 'RESET';
+connection node_1;
+TRUNCATE TABLE t1;
+SET SESSION wsrep_trx_fragment_size = 10;
+SET SESSION wsrep_trx_fragment_unit = 'bytes';
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_1a;
+SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
+SET SESSION wsrep_sync_wait = 0;
+connection node_2;
+INSERT INTO t1 VALUES (1);
+connection node_1a;
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);
+connection node_1a;
+SET GLOBAL DEBUG_DBUG = '';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SELECT * FROM t1;
+f1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1a;
+SET DEBUG_SYNC = 'RESET';
+connection node_1;
+TRUNCATE TABLE t1;
+SET SESSION wsrep_trx_fragment_size = 200;
+SET SESSION wsrep_trx_fragment_unit = 'bytes';
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_1a;
+SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
+SET SESSION wsrep_sync_wait = 0;
+connection node_2;
+INSERT INTO t1 VALUES (1);
+connection node_1a;
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+connection node_1a;
+SET GLOBAL DEBUG_DBUG = '';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_1a;
+DROP TABLE t1;
+SET DEBUG_SYNC = 'RESET';
+connection node_2;
+CALL mtr.add_suppression("WSREP: Could not find applier context for");
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#136.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#136.result
new file mode 100644
index 00000000000..25bc2e11a3e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#136.result
@@ -0,0 +1,65 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+connection node_2;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+COMMIT;
+SET SESSION wsrep_trx_fragment_size = 0;
+INSERT INTO t1 VALUES (3),(4);
+COMMIT;
+connection node_1;
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 <Pos> Gtid_list 1 <End_log_pos> []
+mysqld-bin.000001 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1
+mysqld-bin.000001 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1),(2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1),(2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-3
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (3),(4)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+connection node_2;
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 <Pos> Gtid_list 2 <End_log_pos> []
+mysqld-bin.000001 <Pos> Binlog_checkpoint 2 <End_log_pos> mysqld-bin.000001
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1
+mysqld-bin.000001 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1),(2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1),(2)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-3
+mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (3),(4)
+mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
+mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F
+mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#138.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#138.result
new file mode 100644
index 00000000000..fc9afd6e1e0
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#138.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+connection node_2;
+SELECT flags FROM mysql.wsrep_streaming_log;
+flags
+1
+0
+connection node_1;
+ROLLBACK;
+INSERT INTO t1 VALUES (3),(4);
+connection node_2;
+SELECT flags FROM mysql.wsrep_streaming_log;
+flags
+1
+0
+connection node_1;
+ROLLBACK;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#14.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#14.result
new file mode 100644
index 00000000000..b09c7d4047a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#14.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+COMMIT;
+DROP TABLE t1;
+connection node_2;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result
new file mode 100644
index 00000000000..a85c0f302d0
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result
@@ -0,0 +1,42 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (6),(7),(8),(9),(10),(1);
+connection node_2;
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL DEBUG = 'd,sync.wsrep_apply_cb';
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);;
+connection node_1;
+INSERT INTO t1 SELECT * FROM t2;;
+connection node_1a;
+INSERT INTO t1 VALUES (6), (7), (8), (9), (10);
+COMMIT;
+connection node_1;
+Got one of the listed errors
+connection node_2;
+SET GLOBAL wsrep_slave_threads = 1;
+SET GLOBAL DEBUG = '';
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#15.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#15.result
new file mode 100644
index 00000000000..610019e2b48
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#15.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (id INT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result
new file mode 100644
index 00000000000..fe0761d186d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result
@@ -0,0 +1,752 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+START TRANSACTION;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (3, 'c');
+SELECT * FROM t1;
+f1 f2
+1 x
+2 x
+4 x
+5 x
+UPDATE t1 SET f2 = 'a' WHERE f1 = 2;
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 x
+4 a
+5 a
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#22.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#22.result
new file mode 100644
index 00000000000..0053619187c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#22.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+connection node_1;
+SAVEPOINT s1;
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+connection node_2;
+connection node_1;
+ROLLBACK TO SAVEPOINT s1;
+INSERT INTO t1 VALUES (21, 'c');
+COMMIT;
+connection node_1;
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+1
+connection node_2;
+SELECT COUNT(*) = 6 FROM t1;
+COUNT(*) = 6
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#27.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#27.result
new file mode 100644
index 00000000000..4cbcd49dd24
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#27.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#29.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#29.result
new file mode 100644
index 00000000000..29b17ea07d6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#29.result
@@ -0,0 +1,14 @@
+SET SESSION wsrep_trx_fragment_size = 1;
+SET SESSION binlog_format = STATEMENT;
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=innodb;
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=innodb;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#32.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#32.result
new file mode 100644
index 00000000000..ca749a45e9a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#32.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SET AUTOCOMMIT=OFF;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+START TRANSACTION;
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (5);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ROLLBACK;
+connection node_1;
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#35.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#35.result
new file mode 100644
index 00000000000..41657d7340a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#35.result
@@ -0,0 +1,41 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL debug = '+d,sync.wsrep_apply_cb';
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+connection node_2a;
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);;
+connection node_1;
+COMMIT;
+connection node_2a;
+SET GLOBAL debug = '';
+Warnings:
+Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2;
+Got one of the listed errors
+ROLLBACK;
+DROP TABLE t1;
+connection node_2a;
+SET DEBUG_SYNC = "RESET";
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#8.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#8.result
new file mode 100644
index 00000000000..56905c03e10
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#8.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
+connection node_2;
+SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%';
+COUNT(*) = 13
+1
+connection node_1;
+INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_2;
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz');
+COUNT(f2) = 10000
+1
+UPDATE t1 SET f2 = 'abcdefjhk';
+connection node_1;
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk');
+COUNT(f2) = 10000
+1
+connection node_2;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB;
+connection node_2;
+INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+connection node_1;
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz');
+COUNT(f1) = 1000
+1
+UPDATE t1 SET f1 = 'abcdefjhk';
+connection node_2;
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
+COUNT(f1) = 1000
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#9.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#9.result
new file mode 100644
index 00000000000..990ea47f8bc
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#9.result
@@ -0,0 +1,20 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+connection node_2;
+Killing server ...
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+connection node_2a;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1';
+COUNT(*) = 2
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#93.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#93.result
new file mode 100644
index 00000000000..17f71213767
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#93.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+SET SESSION WSREP_TRX_FRAGMENT_SIZE=1;
+START TRANSACTION;
+SAVEPOINT a;
+INSERT INTO t1 VALUES (1);
+ROLLBACK TO SAVEPOINT a;
+INSERT INTO t1 values (2);
+COMMIT;
+SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#96.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#96.result
new file mode 100644
index 00000000000..dbe91aad9fd
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#96.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t2 (f2 VARCHAR(32));
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2),(1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+INSERT INTO t2 VALUES ('abc');
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+connection node_1;
+ROLLBACK;
+connection node_2;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/t/GCF-1008.inc b/mysql-test/suite/galera_sr/t/GCF-1008.inc
new file mode 100644
index 00000000000..69245b3a91f
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1008.inc
@@ -0,0 +1,36 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB;
+
+--connection node_2
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'x');
+
+--connection node_2a
+--source include/galera_set_sync_point.inc
+
+--connection node_2
+--send COMMIT
+
+--connection node_2b
+--sleep 1
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 1;
+SELECT COUNT(*) = 1 FROM t1;
+REPLACE INTO t1 VALUES (1,'y');
+
+--connection node_2b
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2a
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--connection node_2
+--reap
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-1008.test b/mysql-test/suite/galera_sr/t/GCF-1008.test
new file mode 100644
index 00000000000..c6926840bd1
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1008.test
@@ -0,0 +1,18 @@
+#
+# GCF-1008 SR trx fails to apply because previous trx is not committed yet on applier
+#
+
+--source include/have_debug_sync.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/galera_have_debug_sync.inc
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+--let $galera_sync_point = before_local_commit_monitor_enter
+--source GCF-1008.inc
+
+--let $galera_sync_point = before_certify_apply_monitor_enter
+--source GCF-1008.inc
+
diff --git a/mysql-test/suite/galera_sr/t/GCF-1018.test b/mysql-test/suite/galera_sr/t/GCF-1018.test
new file mode 100644
index 00000000000..1ff8f81e824
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1018.test
@@ -0,0 +1,38 @@
+#
+# SR: Node hang with one thread waiting in InnoDB
+#
+--source include/have_debug_sync.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/galera_have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+INSERT INTO t1 (f2) VALUES ('a');
+INSERT INTO t1 (f2) VALUES ('b');
+INSERT INTO t1 (f2) VALUES ('c');
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+SET SESSION wsrep_sync_wait = 0;
+--let $galera_sync_point = after_certify_apply_monitor_enter
+--source include/galera_set_sync_point.inc
+
+--connection node_2
+SET SESSION wsrep_trx_fragment_size = 64;
+--send DELETE FROM t1 ORDER BY f1 DESC LIMIT 2;
+
+--connection node_2a
+--source include/galera_wait_sync_point.inc
+
+--connection node_1
+INSERT INTO t1 (f2) VALUES ('d'),('e');
+
+--connection node_2a
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--connection node_2
+--error ER_LOCK_DEADLOCK, ER_QUERY_INTERRUPTED
+--reap
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-1018B.test b/mysql-test/suite/galera_sr/t/GCF-1018B.test
new file mode 100644
index 00000000000..f11309080c0
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1018B.test
@@ -0,0 +1,40 @@
+#
+# SR: Node hang with one thread waiting in InnoDB
+#
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 64;
+SET SESSION innodb_lock_wait_timeout = 1000;
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_size = 64;
+SET SESSION innodb_lock_wait_timeout = 1000;
+
+--let $count = 500
+--disable_query_log
+while ($count)
+{
+ --connection node_1
+ --send INSERT INTO t1 (f2) VALUES ('abc'),('abc');
+
+ --connection node_2
+ --send DELETE FROM t1 ORDER BY f1 DESC LIMIT 2;
+
+ --connection node_1
+ --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY,ER_LOCK_WAIT_TIMEOUT,ER_QUERY_INTERRUPTED
+ --reap
+
+ --connection node_2
+ --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY,ER_LOCK_WAIT_TIMEOUT,ER_QUERY_INTERRUPTED
+ --reap
+
+ --dec $count
+}
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-1043A.test b/mysql-test/suite/galera_sr/t/GCF-1043A.test
new file mode 100644
index 00000000000..c76623742d7
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1043A.test
@@ -0,0 +1,13 @@
+#
+# Assertion `retval == WSREP_OK || retval == WSREP_TRX_FAIL || retval == WSREP_BF_ABORT || retval == WSREP_CONN_FAIL' failed with SR
+#
+
+--source include/galera_cluster.inc
+
+--let $count = 1000;
+--let $wsrep_trx_fragment_size = 1;
+--let $query_node_1 = DELETE FROM t1
+--let $query_node_1a = REPLACE INTO t1 VALUES (1,'y'),(2,'x')
+--let $query_node_2 = REPLACE INTO t1 VALUES (1,'y'),(2,'y'),(3,'y')
+
+--source suite/galera/include/galera_concurrent_test.inc
diff --git a/mysql-test/suite/galera_sr/t/GCF-1043B.test b/mysql-test/suite/galera_sr/t/GCF-1043B.test
new file mode 100644
index 00000000000..e3b6b7439ca
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1043B.test
@@ -0,0 +1,13 @@
+#
+# Assertion `retval == WSREP_OK || retval == WSREP_TRX_FAIL || retval == WSREP_BF_ABORT || retval == WSREP_CONN_FAIL' failed with SR
+#
+
+--source include/galera_cluster.inc
+
+--let $count = 1000;
+--let $wsrep_trx_fragment_size = 1;
+--let $query_node_1 = DELETE FROM t1
+--let $query_node_1a = INSERT INTO t1 VALUES (1,'y'),(2,'x')
+--let $query_node_2 = UPDATE t1 SET f2 = 'y' WHERE f1 = 1 OR f1 = 2;
+
+--source suite/galera/include/galera_concurrent_test.inc
diff --git a/mysql-test/suite/galera_sr/t/GCF-1051.test b/mysql-test/suite/galera_sr/t/GCF-1051.test
new file mode 100644
index 00000000000..1db4ed15c41
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1051.test
@@ -0,0 +1,51 @@
+#
+# Test the case where SR is rolled back to savepoint that points to the
+# very beginning of the transaction. This results in regular rollback
+# rather than rollback to savepoint.
+#
+
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size=1;
+
+#
+# Test 1: regular transaction
+#
+--connection node_1
+START TRANSACTION;
+SAVEPOINT A;
+INSERT INTO t1 VALUES (1);
+ROLLBACK TO SAVEPOINT A;
+COMMIT;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+#
+# Test 2: AUTOCOMMIT OFF
+#
+--connection node_1
+SET AUTOCOMMIT=OFF;
+SAVEPOINT A;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT A;
+COMMIT;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-1060.test b/mysql-test/suite/galera_sr/t/GCF-1060.test
new file mode 100644
index 00000000000..714a5ef9f90
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-1060.test
@@ -0,0 +1,9 @@
+--source include/galera_cluster.inc
+
+--let $count = 100;
+--let $wsrep_trx_fragment_size = 1;
+--let $query_node_1 = TRUNCATE TABLE t1
+--let $query_node_1a = INSERT INTO t1 VALUE (1,'x'),(2,'x'),(3,'x')
+--let $query_node_2 = INSERT INTO t1 VALUE (4, 'z');
+
+--source suite/galera/include/galera_concurrent_test.inc
diff --git a/mysql-test/suite/galera_sr/t/GCF-437.test b/mysql-test/suite/galera_sr/t/GCF-437.test
new file mode 100644
index 00000000000..f71be65708e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-437.test
@@ -0,0 +1,21 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 2 * 1024 * 1024;
+
+--error ER_BINLOG_ROW_LOGGING_FAILED
+INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+CALL mtr.add_suppression("InnoDB: The total blob data length*");
+CALL mtr.add_suppression("WSREP: Error writing into mysql.wsrep_streaming_log: 139");
+CALL mtr.add_suppression("WSREP: Failed to write to frag table: 1");
+CALL mtr.add_suppression("WSREP: Failed to append frag to persistent storage");
+
+DROP TABLE t1;
+DROP table ten;
diff --git a/mysql-test/suite/galera_sr/t/GCF-561.test b/mysql-test/suite/galera_sr/t/GCF-561.test
new file mode 100644
index 00000000000..4a652284e59
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-561.test
@@ -0,0 +1,65 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the effect of DDL on a concurrent SR transaction
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+ALTER TABLE t1 DROP COLUMN f2;
+
+# SR applied before the DDL is no longer visible
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+# Transaction can not continue due to DDL, implicit ROLLBACK
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (6, 6);
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# DDL is now in effect
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 VALUES (6, 6);
+
+# But it should be possible to reissue the transaction
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-571.test b/mysql-test/suite/galera_sr/t/GCF-571.test
new file mode 100644
index 00000000000..aca0b9f7907
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-571.test
@@ -0,0 +1,54 @@
+#
+# GCF-571 ROLLBACK TO SAVEPOINT causes all SR records to be deleted
+#
+
+--source include/galera_cluster.inc
+
+SET AUTOCOMMIT=OFF;
+CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('%abcdef%');
+INSERT INTO t1 VALUES ('%abcdef%');
+INSERT INTO t1 VALUES ('%abcdef%');
+INSERT INTO t1 VALUES ('%abcdef%');
+SAVEPOINT A;
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+INSERT INTO t1 VALUES ('xyzxyz');
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%';
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%';
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%';
+
+--connection node_1
+ROLLBACK TO SAVEPOINT A;
+
+--connection node_1a
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%';
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%';
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%';
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%';
+
+--connection node_2
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%';
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%';
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%';
+SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%';
+
+--connection node_1
+ROLLBACK;
+
+--connection node_1a
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-572.test b/mysql-test/suite/galera_sr/t/GCF-572.test
new file mode 100644
index 00000000000..abefb9b08f6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-572.test
@@ -0,0 +1,54 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+#
+# Test 1: statement rollback is not safe
+# (some fragments were already replicated)
+#
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'node1');
+
+--connection node_1a
+INSERT INTO t1 VALUES (5, 'node2');
+
+--connection node_1
+# If we try to INSERT a duplicate key, ER_LOCK_DEADLOCK is the only possible
+# outcome at this point. Notice that ER_DUP_ENTRY is NOT an option here
+# because we were forced to rollback the whole transaction (not just the
+# statement)
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (5, 'node1');
+
+SELECT * FROM t1;
+
+#
+# Test 2: statement rollback is safe
+# (no fragments have been replicated)
+#
+
+SET SESSION wsrep_trx_fragment_size = 10000;
+
+START TRANSACTION;
+INSERT INTO t1 VALUE (10, 'node1');
+SELECT * FROM mysql.wsrep_streaming_log;
+
+--connection node_1a
+INSERT INTO t1 VALUES(15, 'node2');
+
+--connection node_1
+SELECT * FROM t1;
+# This time, only the statement is rolled back and we expect ER_DUP_ENTRY.
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES(15, 'node1');
+
+COMMIT;
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-574.test b/mysql-test/suite/galera_sr/t/GCF-574.test
new file mode 100644
index 00000000000..c9d7c405d14
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-574.test
@@ -0,0 +1,27 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test CREATE TABLE ... SELECT with Streaming Replication
+#
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT ($wsrep_last_committed_after - $wsrep_last_committed_before) > 1 AS wsrep_last_committed_delta;
+--enable_query_log
+
+--connection node_2
+SELECT COUNT(*) = 10000 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/t/GCF-580.test b/mysql-test/suite/galera_sr/t/GCF-580.test
new file mode 100644
index 00000000000..39a237fda57
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-580.test
@@ -0,0 +1,27 @@
+#
+# GCF-580 wsrep_last_committed_counter increases twice for every SR fragment
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+
+--let $fragments_count = `SELECT COUNT(*) FROM mysql.wsrep_streaming_log`
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+--disable_query_log
+--eval SELECT ($wsrep_last_committed_after - $wsrep_last_committed_before) = $fragments_count AS last_committed_matches_fragment_count
+--enable_query_log
+
+COMMIT;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-585.test b/mysql-test/suite/galera_sr/t/GCF-585.test
new file mode 100644
index 00000000000..ceb7da60df6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-585.test
@@ -0,0 +1,44 @@
+#
+# GCF-585 SR: Assertion `total_length + wsrep_get_fragment_base(thd) == saved_pos' failed in wsrep_write_cache_once after SQL error
+#
+
+--source include/galera_cluster.inc
+
+# Test case #1
+
+create table t1 (f1 integer primary key) engine=innodb;
+set autocommit=off;
+set session wsrep_trx_fragment_size=1;
+start transaction;
+insert into t1 values (1);
+# If we try to INSERT a duplicate key, ER_LOCK_DEADLOCK is the only possible
+# outcome at this point. Notice that ER_DUP_ENTRY is NOT an option here
+# because we were forced to rollback the whole transaction (not just the
+# statement)
+--error ER_LOCK_DEADLOCK
+insert into t1 values (2),(1);
+alter table t1 drop primary key;
+drop table t1;
+
+# Test case #2
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+update t1 set f1 = 100 where f1 = 10;
+
+--connection node_2
+INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+SET SESSION wsrep_trx_fragment_size=1;
+SET SESSION innodb_lock_wait_timeout=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+--error ER_LOCK_DEADLOCK
+delete from t1 where f1 > 10;
+--error ER_LOCK_DEADLOCK
+delete from t1 where f1 > 10 and f1 < 100;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-597.test b/mysql-test/suite/galera_sr/t/GCF-597.test
new file mode 100644
index 00000000000..d3d80ffc4f8
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-597.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+
+SET wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+ROLLBACK;
+
+DROP TABLE t1; \ No newline at end of file
diff --git a/mysql-test/suite/galera_sr/t/GCF-620.test b/mysql-test/suite/galera_sr/t/GCF-620.test
new file mode 100644
index 00000000000..abfba47ee5a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-620.test
@@ -0,0 +1,22 @@
+#
+# GCF-620 SR: ROLLBACK TO SAVEPOINT causes slave crash if wsrep_trx_fragment_size does not fall on boundary
+#
+
+--source include/galera_cluster.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 200;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+SAVEPOINT A;
+INSERT INTO t1 VALUES (1);
+ROLLBACK TO SAVEPOINT A;
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-623.test b/mysql-test/suite/galera_sr/t/GCF-623.test
new file mode 100644
index 00000000000..6784989bde9
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-623.test
@@ -0,0 +1,31 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1; \ No newline at end of file
diff --git a/mysql-test/suite/galera_sr/t/GCF-627.test b/mysql-test/suite/galera_sr/t/GCF-627.test
new file mode 100644
index 00000000000..86637ad8e7f
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-627.test
@@ -0,0 +1,30 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER);
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+
+--connection node_2
+DROP TABLE t1;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--error ER_NO_SUCH_TABLE
+INSERT INTO t1 VALUES (2);
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/t/GCF-845.test b/mysql-test/suite/galera_sr/t/GCF-845.test
new file mode 100644
index 00000000000..316317c6a10
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-845.test
@@ -0,0 +1,30 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE IF NOT EXISTS t1 (f1 INTEGER) ENGINE = InnoDB;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET SESSION AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (161);
+COMMIT;
+DELETE FROM t1 WHERE f1 > 13;
+--disconnect node_1a
+--sleep 2
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
+
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
+--let $assert_count = 0
+--let $assert_select = BF-BF X
+--let $assert_text = No BF-BF log line found
+--let $assert_only_after = CURRENT_TEST
+--source include/assert_grep.inc
+
diff --git a/mysql-test/suite/galera_sr/t/GCF-851.test b/mysql-test/suite/galera_sr/t/GCF-851.test
new file mode 100644
index 00000000000..28d5302a422
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-851.test
@@ -0,0 +1,24 @@
+--source include/galera_cluster.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET SESSION WSREP_TRX_FRAGMENT_SIZE=1;
+SET SESSION AUTOCOMMIT=OFF;
+
+INSERT INTO t1 VALUES (10);
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--connection node_2
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+START TRANSACTION;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) > 0 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) > 0 FROM t1;
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera_sr/t/GCF-867.test b/mysql-test/suite/galera_sr/t/GCF-867.test
new file mode 100644
index 00000000000..54476a860b7
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-867.test
@@ -0,0 +1,42 @@
+#
+# Test many ongoing SR transactions
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+--disable_query_log
+
+--let $connections = 62
+
+--let $count = $connections
+while ($count)
+{
+--connect $count, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET SESSION wsrep_sync_wait = 0;
+--dec $count
+}
+
+
+--let $count = $connections
+while ($count)
+{
+--connection $count
+START TRANSACTION;
+--send_eval INSERT INTO t1 VALUES ($count)
+--dec $count
+}
+
+--let $count = $connections
+while ($count)
+{
+--connection $count
+--reap
+COMMIT;
+--dec $count
+}
+
+--enable_query_log
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/GCF-889.test b/mysql-test/suite/galera_sr/t/GCF-889.test
new file mode 100644
index 00000000000..e785b282019
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-889.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+
+--connection node_2
+SET GLOBAL wsrep_ignore_apply_errors = 2;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET SESSION wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_on = ON;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+DELETE FROM t1 WHERE f1 = 1;
+SET SESSION wsrep_trx_fragment_size = 0;
+
+INSERT INTO t1 VALUES (1);
+
+SELECT COUNT(*) = 1;
+
+--connection node_2
+SELECT COUNT(*) = 1;
+CALL mtr.add_suppression("Could not execute Delete_rows event on table");
+CALL mtr.add_suppression("Can't find record in 't1'");
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+
+--connection node_1
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera_sr/t/GCF-900.test b/mysql-test/suite/galera_sr/t/GCF-900.test
new file mode 100644
index 00000000000..3f1b53630b6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/GCF-900.test
@@ -0,0 +1,28 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size = 128;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 0);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2, 0);
+
+--connection node_2
+ALTER TABLE t1 DROP COLUMN f2;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+--connection node_1a
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (3, 0);
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera-features#56.test b/mysql-test/suite/galera_sr/t/galera-features#56.test
new file mode 100644
index 00000000000..0497952e355
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera-features#56.test
@@ -0,0 +1,55 @@
+##
+## This test tests parallel application of multiple auto-increment insert transactions
+##
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Create a second connection to node1 so that we can run transactions concurrently
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+SET SESSION wsrep_trx_fragment_size = 1;
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+
+
+--connection node_2
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+SET GLOBAL wsrep_slave_threads = 4;
+SET SESSION wsrep_trx_fragment_size = 1;
+
+--connection node_1
+--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_1a
+--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_1
+--reap
+
+--connection node_1a
+--reap
+
+--connection node_2
+--reap
+
+SELECT COUNT(*) = 30000 FROM t1;
+SELECT COUNT(DISTINCT f1) = 30000 FROM t1;
+SELECT COUNT(*) = 6 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+
+--disable_query_log
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
+--enable_query_log
+
+--connection default
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.inc b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.inc
new file mode 100644
index 00000000000..cd9884cee81
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.inc
@@ -0,0 +1,145 @@
+#
+# Test SR BF abort for all sync points in master side code path
+#
+# The procedure in all test cases is the following:
+# 1) Start SR transaction on node 1, do INSERT + SELECT .. FOR UPDATE
+# 2) Set up sync point on node 1 to block slave thread processing
+# in apply monitor
+# 3) Do write on node 2 which will conflict with SELECT .. FOR UPDATE
+# 4) Set up desired sync point on master side and commit
+# 5) Wait until commit reaches master side sync point, clear sync points
+# and release all sync point waiters
+# 6) COMMIT on node 1 should return deadlock error
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size
+SET AUTOCOMMIT=OFF;
+
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+
+# Set up sync point
+--connection node_1a
+--let galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_set_sync_point.inc
+
+# Conflicting insert
+--connection node_2
+
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = $galera_sr_bf_abort_sync_point
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+if ($galera_sr_bf_abort_at_commit)
+{
+ --send COMMIT
+}
+if (!$galera_sr_bf_abort_at_commit)
+{
+ --send INSERT INTO t1 VALUES (3)
+}
+
+--connection node_1a
+
+--let $cmp = `SELECT STRCMP('apply_monitor_slave_enter_sync', '$galera_sr_bf_abort_sync_point') = -1`
+
+if ($cmp)
+{
+ --let $galera_sync_point = apply_monitor_slave_enter_sync $galera_sr_bf_abort_sync_point
+}
+if (!$cmp)
+{
+ --let $galera_sync_point = $galera_sr_bf_abort_sync_point apply_monitor_slave_enter_sync
+}
+--source include/galera_wait_sync_point.inc
+
+# Let conflicting insert proceed, make sure it hits abort_trx_end and
+# let both threads continue.
+
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = abort_trx_end $galera_sr_bf_abort_sync_point
+
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = $galera_sr_bf_abort_sync_point
+--source include/galera_signal_sync_point.inc
+
+# Deadlock should now be retured by node_1
+--connection node_1
+if (!$galera_sr_bf_abort_at_commit)
+{
+ --error ER_LOCK_DEADLOCK
+ --reap
+}
+if ($galera_sr_bf_abort_at_commit)
+{
+ --reap
+}
+
+ROLLBACK;
+
+# Release slave insert
+--connection node_1a
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+
+# Verify that nodes are consistent
+
+# End result:
+# If the statement which was BF aborted was commit,
+# node_1 must replay the transaction so that the table
+# will have rows 1, 2. If it in turn was INSERT,
+# node_1 must abort the transaction so that only
+# INSERT ... VALUES (2) survives.
+
+--connection node_1
+SELECT * FROM t1;
+if ($galera_sr_bf_abort_at_commit)
+{
+ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+}
+if (!$galera_sr_bf_abort_at_commit)
+{
+ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+}
+--connection node_2
+SELECT * FROM t1;
+if ($galera_sr_bf_abort_at_commit)
+{
+ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+}
+if (!$galera_sr_bf_abort_at_commit)
+{
+ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+}
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Delete entery to verify that node is unblocked
+--connection node_1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.test b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.test
new file mode 100644
index 00000000000..a2db6a8bad2
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.test
@@ -0,0 +1,50 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+--let $wsrep_trx_fragment_size = 1
+
+# Control connection for manipulating sync points on node 1
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait = 0;
+
+--echo galera_sr_bf_abort_at_commit = 0
+--let $galera_sr_bf_abort_at_commit = 0
+
+--echo after_replicate_sync
+--let $galera_sr_bf_abort_sync_point = after_replicate_sync
+--source galera_sr_bf_abort.inc
+
+--echo local_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
+--source galera_sr_bf_abort.inc
+
+--echo apply_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
+--source galera_sr_bf_abort.inc
+
+--echo commit_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
+--source galera_sr_bf_abort.inc
+
+--echo galera_sr_bf_abort_at_commit = 1
+--let $galera_sr_bf_abort_at_commit = 1
+
+--echo after_replicate_sync
+--let $galera_sr_bf_abort_sync_point = after_replicate_sync
+--source galera_sr_bf_abort.inc
+
+--echo local_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
+--source galera_sr_bf_abort.inc
+
+--echo apply_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
+--source galera_sr_bf_abort.inc
+
+--echo commit_monitor_master_enter_sync
+--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
+--source galera_sr_bf_abort.inc
+
+CALL mtr.add_suppression("WSREP: fragment replication failed: 1");
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_blob.test b/mysql-test/suite/galera_sr/t/galera_sr_blob.test
new file mode 100644
index 00000000000..ed314d09f5a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_blob.test
@@ -0,0 +1,38 @@
+#
+# Test that a single-blob will be replicated using SR if it is sufficiently
+# large.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 TEXT) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+INSERT INTO t1 VALUES (REPEAT('x', 65535));
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+# Confirm that exactly one fragment was replicated
+
+--disable_query_log
+--eval SELECT ($wsrep_last_committed_after - $wsrep_last_committed_before) = 1 AS wsrep_last_committed_delta;
+--enable_query_log
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT LENGTH(f1) = 65535 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test
new file mode 100644
index 00000000000..8ae8c204f60
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test
@@ -0,0 +1,98 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the effect of Cluster Configuration Change on a concurrently-running SR transaction
+# We use SET GLOBAL wsrep_cluster_address = '' to cause the master (node_2) to temporarily
+# leave the cluster.
+#
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_2
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+#
+# Trigger CC . The transaction is aborted and we expect the SR tables to be cleaned up
+#
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+SET SESSION wsrep_sync_wait=0;
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+SET GLOBAL wsrep_cluster_address = '';
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SET SESSION wsrep_sync_wait = DEFAULT;
+
+--connection node_2
+--error 2013 # CR_SERVER_LOST
+INSERT INTO t1 VALUES (6);
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Restore cluster
+
+--connection node_2a
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address='$wsrep_cluster_address_orig'
+--enable_query_log
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+
+--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2b
+--source include/galera_wait_ready.inc
+SELECT * FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Repeat transaction to confirm no locks are left from previous transaction
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+COMMIT;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+SELECT COUNT(*) = 5 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
+
+--connection node_2b
+CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for");
+
+--disconnect node_2
+--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test
new file mode 100644
index 00000000000..8c790ac7cd2
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test
@@ -0,0 +1,97 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the effect of Cluster Configuration Change on a concurrently-running SR transaction
+# We use SET GLOBAL wsrep_cluster_address = '' to cause the slave (node_2) to temporarily
+# leave the cluster.
+#
+
+# Start with a clean slate
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+#
+# Trigger CC . The transaction should be able to continue
+#
+
+--connection node_2
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+SET GLOBAL wsrep_cluster_address = '';
+
+# Wait until the node_2 disconnects from the cluster
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
+--source include/wait_condition.inc
+SET SESSION wsrep_sync_wait = default;
+
+--connection node_1
+
+# Wait until the node_1 sees the cluster configuration change
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Continue generating events in the transaction
+
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+# Restore cluster
+
+--connection node_2
+--disable_query_log
+--eval SET GLOBAL wsrep_cluster_address='$wsrep_cluster_address_orig';
+--enable_query_log
+--source include/galera_wait_ready.inc
+
+# Confirm that the SR table still contains entries from ongoing transaction
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+# Continue and finalize transaction
+--connection node_1
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (16);
+COMMIT;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Confirm that transaction was replicated properly
+# and SR table is cleaned up afterwards.
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 15 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
+
+CALL mtr.add_suppression("points to own listening address, blacklisting");
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_concurrent.test b/mysql-test/suite/galera_sr/t/galera_sr_concurrent.test
new file mode 100644
index 00000000000..9ec7143d25c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_concurrent.test
@@ -0,0 +1,45 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test two concurrent SR-replicated transactions
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (2);
+INSERT INTO t2 VALUES (3);
+INSERT INTO t2 VALUES (4);
+INSERT INTO t2 VALUES (5);
+
+--connection node_1
+COMMIT;
+
+--connection node_1a
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+SELECT COUNT(*) = 5 FROM t2;
+
+--connection node_1
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict.test
new file mode 100644
index 00000000000..dd133c2d12e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict.test
@@ -0,0 +1,45 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# A conflict between a streaming replication fragment and a local transaction
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+# Wait until a streaming replication fragment has arrived
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+# Attempt a conflicting INSERT. This will block
+--send INSERT INTO t1 VALUES(1);
+
+# Observe the block from a separate connection
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'wsrep applier committed%';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'update';
+--source include/wait_condition.inc
+
+# Commit the remote transaction, causing the local transaction to return an error
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_DUP_ENTRY
+--reap
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit.test
new file mode 100644
index 00000000000..6675321641f
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit.test
@@ -0,0 +1,45 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the following sequence of events:
+#
+# 1. Node #2 begins a transaction
+# 2. Node #1 begins conflicting transaction that is SR replicated
+# 3. Node #2 attempts to commit, gets a deadlock error, even before #1 has committed
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+--connection node_1
+COMMIT;
+
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit2.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit2.test
new file mode 100644
index 00000000000..0ea52290bb6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit2.test
@@ -0,0 +1,46 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the following sequence of events:
+#
+# 1. Node #1 begins a transaction that is SR replicated
+# 2. Node #2 begins a conflicting transaction, hangs
+# 3. Node #1 comits
+# 4. Node #2 gets a dup key error
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--send INSERT INTO t1 VALUES (5);
+
+--sleep 1
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--error ER_DUP_ENTRY
+--reap
+
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict_with_rollback_master.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict_with_rollback_master.test
new file mode 100644
index 00000000000..cb96fae0122
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict_with_rollback_master.test
@@ -0,0 +1,44 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the following sequence of events:
+#
+# 1. Node #2 begins a transaction
+# 2. Node #1 begins conflicting transaction that is SR replicated
+# 3. Node #1 rolls back
+# 4. Node #2 can not commit because it was BF-aborted even though the SR transaction was rolled back
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+ROLLBACK;
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test
new file mode 100644
index 00000000000..7da7f55ba15
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test
@@ -0,0 +1,63 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the following sequence of events on the master:
+#
+# 1. Connection #1 begins a SR transaction
+# 2. Connection #2 issues DDL
+# 3. Connection #1 attempts to continue the transaction, gets deadlock
+# 4. Connection #1 retries the transaction and succeeds
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+# SR replication is triggered and rows have been delivered to the slave
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (6);
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Check that the transaction thus aborted could be reissued
+
+ROLLBACK;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (1);
+INSERT INTO t1 (f1) VALUES (2);
+INSERT INTO t1 (f1) VALUES (3);
+INSERT INTO t1 (f1) VALUES (4);
+INSERT INTO t1 (f1) VALUES (5);
+INSERT INTO t1 (f1) VALUES (6);
+COMMIT;
+
+SELECT COUNT(*) = 6 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 6 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_schema.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_schema.test
new file mode 100644
index 00000000000..a3045773387
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_schema.test
@@ -0,0 +1,43 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the effect of DROP SCHEMA DDL on a concurrent SR transaction
+# Most other DDL tests work on a table level, so this test exercises a
+# different granularity.
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+DROP SCHEMA test;
+
+--error ER_NO_SUCH_TABLE
+SELECT COUNT(*) = 0 FROM test.t1;
+
+--connection node_1
+
+# Transaction can not continue due to DDL
+--error ER_LOCK_DEADLOCK
+INSERT INTO test.t1 VALUES (6, 6);
+
+# DDL is now in effect
+--error ER_NO_SUCH_TABLE
+INSERT INTO test.t1 VALUES (6, 6);
+
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_slave.test
new file mode 100644
index 00000000000..4a652284e59
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_slave.test
@@ -0,0 +1,65 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the effect of DDL on a concurrent SR transaction
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+ALTER TABLE t1 DROP COLUMN f2;
+
+# SR applied before the DDL is no longer visible
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+# Transaction can not continue due to DDL, implicit ROLLBACK
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (6, 6);
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# DDL is now in effect
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 VALUES (6, 6);
+
+# But it should be possible to reissue the transaction
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_unrelated.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_unrelated.test
new file mode 100644
index 00000000000..77b6e64641d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_unrelated.test
@@ -0,0 +1,53 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the effect of unrelated DDL on a concurrent SR transaction
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 VALUES (5, 5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+ALTER TABLE t2 DROP COLUMN f2;
+
+# SR applied before the DDL is still visible
+SELECT COUNT(*) = 5 FROM t1;
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+
+# Transaction can continue, even after the DDL
+--error 0
+INSERT INTO t1 VALUES (6, 6);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+COMMIT;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 6 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test b/mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test
new file mode 100644
index 00000000000..a7aca042829
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test
@@ -0,0 +1,59 @@
+#
+# Test the case where a duplicate key error happens in the middle of an SR transaction
+#
+
+--source include/galera_cluster.inc
+
+CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB;
+CREATE UNIQUE INDEX i1 ON t1 (f1(512));
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1024;
+
+INSERT INTO t1 VALUES (REPEAT('a', 512));
+INSERT INTO t1 VALUES (REPEAT('b', 512));
+INSERT INTO t1 VALUES (REPEAT('c', 512));
+INSERT INTO t1 VALUES (REPEAT('d', 512));
+INSERT INTO t1 VALUES (REPEAT('e', 512));
+INSERT INTO t1 VALUES (REPEAT('f', 512));
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+# Deadlock error instead of dupkey since the transaction is SR and
+# statement rollback is not safe.
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (REPEAT('c', 512));
+
+# Confirm that the wsrep_streaming_log table is now empty, as it was a full transaction rollback
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Confirm that the transaction can be restarted on either node
+
+--connection node_1
+INSERT INTO t1 VALUES (REPEAT('d', 512));
+INSERT INTO t1 VALUES (REPEAT('e', 512));
+INSERT INTO t1 VALUES (REPEAT('f', 512));
+COMMIT;
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (REPEAT('a', 512));
+INSERT INTO t1 VALUES (REPEAT('b', 512));
+INSERT INTO t1 VALUES (REPEAT('c', 512));
+COMMIT;
+
+--connection node_1
+SELECT COUNT(*) = 6 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 6 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_fk_conflict.test b/mysql-test/suite/galera_sr/t/galera_sr_fk_conflict.test
new file mode 100644
index 00000000000..b83deaee244
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_fk_conflict.test
@@ -0,0 +1,62 @@
+#
+# Test Foreign Key with SR
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE grandparent (
+ id INT NOT NULL PRIMARY KEY
+) ENGINE=InnoDB;
+
+CREATE TABLE parent (
+ id INT NOT NULL PRIMARY KEY,
+ grandparent_id INT,
+ FOREIGN KEY (grandparent_id)
+ REFERENCES grandparent(id)
+ ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+CREATE TABLE child (
+ id INT NOT NULL PRIMARY KEY,
+ grandparent_id INT,
+ FOREIGN KEY (grandparent_id)
+ REFERENCES parent(grandparent_id)
+ ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO grandparent VALUES (1),(2),(3),(4);
+INSERT INTO parent VALUES (1,1), (2,2);
+INSERT INTO child VALUES (1,1), (2,2);
+
+# Start and SR transaction
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+
+UPDATE grandparent SET id = 5 WHERE id = 1;
+
+# No conflicting transactions are allowed to proceed on slave
+
+--connection node_2
+SET SESSION innodb_lock_wait_timeout = 1;
+
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE grandparent SET id = 10 WHERE id = 5;
+
+--error ER_LOCK_WAIT_TIMEOUT
+DELETE FROM child;
+
+# SR transaction succesffull
+
+--connection node_1
+COMMIT;
+
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE grandparent;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt
new file mode 100644
index 00000000000..6623c33c484
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt
@@ -0,0 +1 @@
+ --log-bin --log-slave-updates --loose-galera-sr-gtid-unique
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_gtid.test b/mysql-test/suite/galera_sr/t/galera_sr_gtid.test
new file mode 100644
index 00000000000..56464ba6f63
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_gtid.test
@@ -0,0 +1,46 @@
+#
+# Test basic Galera operation
+#
+
+--source include/have_log_bin.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+
+SET SESSION wsrep_trx_fragment_size=1;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+SET SESSION wsrep_trx_fragment_size=1;
+UPDATE t1 SET f1 = 2;
+
+#--let $gtid_executed_node2 = `SELECT @@global.gtid_executed;`
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size=0;
+
+--connection node_2
+SET SESSION wsrep_trx_fragment_size=0;
+
+--connection node_1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+
+--disable_query_log
+#--eval SELECT '$gtid_executed_node2' = @@global.gtid_executed AS gtid_executed_equal;
+--enable_query_log
+
+--replace_regex /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/<GTID>/ /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+--replace_column 2 <Pos> 5 <End_log_pos>
+SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 256;
+
+--connection node_2
+# Perform causal wait
+SELECT 1 FROM DUAL;
+--replace_regex /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/<GTID>/ /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+--replace_column 2 <Pos> 5 <End_log_pos>
+SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 256;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_insert_select.test b/mysql-test/suite/galera_sr/t/galera_sr_insert_select.test
new file mode 100644
index 00000000000..01481db5a8b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_insert_select.test
@@ -0,0 +1,33 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test large INSERT ... SELECT with SR
+#
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+# Insert 10K rows.
+INSERT INTO t1 (f2) SELECT REPEAT('a', 255) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 99 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1;
+
+--connection node_1
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_nobootstrap.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_nobootstrap.test
new file mode 100644
index 00000000000..8fba27f9a73
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_nobootstrap.test
@@ -0,0 +1,52 @@
+#
+# Kill entire cluster during SR while pc.bootstrap is in effect
+# after restart, confirm that the mysql.wsrep_streaming_log table is empty
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+--connection node_1
+--source include/kill_galera.inc
+
+--sleep 1
+
+# Bootstrap the cluster from scratch
+
+--connection node_1
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+
+--connection node_2
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf
new file mode 100644
index 00000000000..6422d7541ba
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf
@@ -0,0 +1,4 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.recovery=false'
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test
new file mode 100644
index 00000000000..042e3d3ef57
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test
@@ -0,0 +1,53 @@
+#
+# Kill entire cluster during SR while pc.recovery is NOT in effect
+# after restart, confirm that the mysql.wsrep_streaming_log table is empty
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+--connection node_1
+--source include/kill_galera.inc
+
+--sleep 1
+
+--connection node_1
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--let $start_mysqld_params = "--wsrep-new-cluster"
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+
+--connection node_2
+--let $start_mysqld_params = ""
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_pcrecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_pcrecovery.test
new file mode 100644
index 00000000000..0ba7cedbd8f
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_pcrecovery.test
@@ -0,0 +1,54 @@
+#
+# Kill entire cluster during SR while pc.recovery is in effect
+# after restart, confirm that the mysql.wsrep_streaming_log table is empty
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+--connection node_1
+--source include/kill_galera.inc
+
+--sleep 1
+
+# Bootstrap the cluster from scratch
+
+--connection node_1
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+
+--connection node_2
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_connection.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_connection.test
new file mode 100644
index 00000000000..03d09f33fab
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_connection.test
@@ -0,0 +1,59 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test KILL CONNECTION on a transaction that has already replicated some data via SR
+#
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+# Confirm that the transaction is SR-replicated
+--connection node_2
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+# Kill the transaction by killing the entire connection
+
+--connection node_1
+--let $connection_id = `SELECT CONNECTION_ID()`
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--disable_query_log
+--eval KILL CONNECTION $connection_id
+--enable_query_log
+
+# Confirm that the disconnection caused the updates made so far to be removed
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
+
+# Confirm that the transaction can be reissued in its entirety on the slave without a conflict
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+COMMIT;
+
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1a
+SELECT COUNT(*) = 5 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_query.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_query.test
new file mode 100644
index 00000000000..4c9f2b4d7bc
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_query.test
@@ -0,0 +1,48 @@
+--source include/galera_cluster.inc
+
+#
+# Test KILL QUERY on a statement that has already replicated some data via SR
+#
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+--let $connection_id = `SELECT CONNECTION_ID()`
+--send INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
+
+# Wait for some SR to arrive on the slave.
+--connection node_2
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT TABLE_ROWS > 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--connection node_1
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--echo Killing query ...
+--disable_query_log
+--eval KILL QUERY $connection_id
+--enable_query_log
+
+--connection node_1
+--error ER_QUERY_INTERRUPTED
+--reap
+
+# Confirm that the kill caused the updates made so far to be removed
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Confirm that the transaction can be reissued in its entirety on the slave without a conflict
+
+INSERT INTO t1 SELECT 1 FROM ten AS t1, ten AS t2, ten AS t3;
+SELECT COUNT(*) = 1000 FROM t1;
+
+--connection node_1a
+SELECT COUNT(*) = 1000 FROM t1;
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf
new file mode 100644
index 00000000000..290d8fe196e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf
@@ -0,0 +1,4 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=2'
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.test
new file mode 100644
index 00000000000..a76a03e49b9
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.test
@@ -0,0 +1,80 @@
+#
+# This test kills the slave while a Streaming Replication transaction is in
+# progress but before a fragment has already been applied on the slave. It
+# is expected that after the slave restarts, the cluster will continue to
+# be consistent.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+# Block node #2's applier before table t1's inserts have come into play
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+CREATE TABLE t2 (f1 INTEGER);
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+LOCK TABLE t2 WRITE;
+
+--connection node_1
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_1
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--sleep 2
+
+--connection node_2
+--source include/kill_galera.inc
+--sleep 1
+
+--connection node_1
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+
+--connection node_2
+--source include/start_mysqld.inc
+--sleep 1
+
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (15);
+COMMIT;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+--sleep 5
+SELECT COUNT(*) = 15 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_large_fragment-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment-master.opt
new file mode 100644
index 00000000000..132c6aed246
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment-master.opt
@@ -0,0 +1 @@
+--innodb_log_file_size=1G --binlog-row-event-max-size=100M
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test
new file mode 100644
index 00000000000..63278555723
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test
@@ -0,0 +1,58 @@
+#
+# Test the replication and subsequent cleanup of a few, very large fragments
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1024 * 1024 * 10;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+
+--connection node_2
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) > 50000 FROM t1;
+
+--connection node_1
+ROLLBACK;
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--let $wsrep_provider_options_node_2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'`
+SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M';
+SET SESSION wsrep_sync_wait = 7;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_2';
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+--let $wsrep_provider_options_node_1 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'`
+SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M';
+SET SESSION wsrep_sync_wait = 7;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_1';
+
+DROP TABLE ten;
+DROP TABLE t1;
+
+CALL mtr.add_suppression('InnoDB: Resizing redo log from');
+CALL mtr.add_suppression('InnoDB: Starting to delete and rewrite log files');
+CALL mtr.add_suppression('InnoDB: New log files created, LSN=');
+
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_load_data.test b/mysql-test/suite/galera_sr/t/galera_sr_load_data.test
new file mode 100644
index 00000000000..b430ace5d69
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_load_data.test
@@ -0,0 +1,39 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test Streaming Replication + LOAD DATA
+#
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 512;
+
+# Create a file for LOAD DATA with 20K entries
+--perl
+open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/galera_sr_load_data.csv") or die;
+foreach my $i (1..20000) {
+ print FILE "$i\n";
+}
+EOF
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+# Record wsrep_last_committed as it was before LOAD DATA
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+--disable_query_log
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/galera_sr_load_data.csv' INTO TABLE t1;
+--enable_query_log
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+SELECT COUNT(*) = 20000 FROM t1;
+# LOAD-ing 20K rows causes 3 commits to be registered
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after - $wsrep_last_committed_before = 3 AS wsrep_last_committed_diff;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_load_data_splitting.test b/mysql-test/suite/galera_sr/t/galera_sr_load_data_splitting.test
new file mode 100644
index 00000000000..40e63e7c67f
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_load_data_splitting.test
@@ -0,0 +1,50 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+#
+# Test Streaming Replication and LOAD DATA splitting operating at the same time
+#
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+--let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting`
+
+SET SESSION wsrep_trx_fragment_size = 512;
+SET GLOBAL wsrep_load_data_splitting = TRUE;
+
+
+# Create a file for LOAD DATA with 95K entries
+--perl
+open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/galera_sr_load_data.csv") or die;
+foreach my $i (1..95000) {
+ print FILE "$i\n";
+}
+EOF
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+# Record wsrep_last_committed as it was before LOAD DATA
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+--disable_query_log
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/galera_sr_load_data.csv' INTO TABLE t1;
+--enable_query_log
+
+--connection node_2
+--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+SELECT COUNT(*) = 95000 FROM t1;
+
+# LOAD-ing 95K rows causes 10 'commits' to be registered
+--disable_query_log
+--eval SELECT $wsrep_last_committed_after - $wsrep_last_committed_before = 10 AS wsrep_last_committed_diff;
+--enable_query_log
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_load_data_splitting = $wsrep_load_data_splitting_orig;
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_log_bin-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_log_bin-master.opt
new file mode 100644
index 00000000000..03fcb5d040d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_log_bin-master.opt
@@ -0,0 +1 @@
+--log-slave-updates --log-bin
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_log_bin.test b/mysql-test/suite/galera_sr/t/galera_sr_log_bin.test
new file mode 100644
index 00000000000..7dfa7850c15
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_log_bin.test
@@ -0,0 +1,70 @@
+#
+# Interleave SR and non-SR transactions and confirm that the binlog is in correct order
+#
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t4 (f1 INTEGER) ENGINE=InnoDB;
+
+--source include/galera_cluster.inc
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t3 VALUES (1);
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t4 VALUES (1);
+
+--connection node_1
+INSERT INTO t1 VALUES (2);
+COMMIT;
+
+--connection node_1a
+INSERT INTO t2 VALUES (2);
+COMMIT;
+
+--connection node_2
+INSERT INTO t3 VALUES (2);
+COMMIT;
+--connection node_2a
+INSERT INTO t4 VALUES (2);
+COMMIT;
+
+--connection node_1
+SELECT COUNT(*) = 2 FROM t4;
+
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+--replace_column 2 <Pos> 5 <End_log_pos>
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t4;
+
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+--replace_column 2 <Pos> 5 <End_log_pos>
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+
+DROP TABLE t1,t2,t3,t4;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test b/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test
new file mode 100644
index 00000000000..9b8dae9d8e3
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test
@@ -0,0 +1,53 @@
+#
+# Test the replication and subsequent cleanup of a large number of small transaction fragments
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 10000 FROM t1;
+
+--connection node_1
+ROLLBACK;
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--let $wsrep_provider_options_node_2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'`
+SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M';
+SET SESSION wsrep_sync_wait = 7;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_2';
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+--let $wsrep_provider_options_node_1 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'`
+SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M';
+SET SESSION wsrep_sync_wait = 7;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_1';
+
+DROP TABLE ten;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test
new file mode 100644
index 00000000000..b037f817610
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test
@@ -0,0 +1,29 @@
+#
+# Test that the basic MyISAM replication works even with SR enabled
+# We basically check that the data arrived on the slave and that there
+# were no assertions.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 TEXT) ENGINE=MyISAM;
+
+--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam`
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+
+INSERT INTO t1 VALUES (REPEAT('x', 65535));
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT LENGTH(f1) = 65535 FROM t1;
+
+DROP TABLE t1;
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig;
+--enable_query_log
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf
new file mode 100644
index 00000000000..574ae28b54a
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf
@@ -0,0 +1,11 @@
+!include ../galera_2nodes.cnf
+
+# We do not set mysqldump-related SST options here because doing so on startup
+# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test
new file mode 100644
index 00000000000..25ded94e100
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test
@@ -0,0 +1,79 @@
+#
+# Test mysqldump SST on slave if SR transaction is in progress
+#
+
+--source include/big_test.inc
+--source include/galera_cluster.inc
+
+--source suite/galera/include/galera_sst_set_mysqldump.inc
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size = 1000;
+START TRANSACTION;
+# Insert 1000 rows
+INSERT INTO t1 (f2) SELECT REPEAT('x', 255) FROM ten AS a1, ten AS a2, ten AS a3;
+
+# Update 1000 rows
+UPDATE t1 SET f2 = REPEAT('y', 255);
+
+# Wait for SR replication to kick in
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+# Restart node #2
+
+--connection node_2
+--let $MYSQLD2_DATADIR = `SELECT @@datadir`
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+# Force SST
+--remove_file $MYSQLD2_DATADIR/grastate.dat
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_2
+--echo Starting server ...
+--let $start_mysqld_params = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2
+--source include/start_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Check that node #2 is caught up with the SR transaction that is still in progress
+--connection node_2
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+# Finalize transaction
+--connection node_1
+UPDATE t1 SET f2 = REPEAT('z', 255);
+COMMIT;
+
+# Confirm proper replication of entire transaction to node #2
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 1000 FROM t1;
+SELECT COUNT(*) = 1000 FROM t1 WHERE f2 = REPEAT('z', 255);
+
+DROP TABLE t1;
+DROP TABLE ten;
+
+--connection node_1
+# galera_sst_restore.inc uses DROP USER internally which is incompatible
+# with SR, need to disable SR before that.
+SET SESSION wsrep_trx_fragment_size=0;
+--source suite/galera/include/galera_sst_restore.inc
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_parallel_apply.test b/mysql-test/suite/galera_sr/t/galera_sr_parallel_apply.test
new file mode 100644
index 00000000000..83a7acbe3e0
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_parallel_apply.test
@@ -0,0 +1,59 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test SR with parallel apply
+#
+
+--connection node_2
+--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
+SET GLOBAL wsrep_slave_threads = 5;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (1);
+--send INSERT INTO t1 (f2) VALUES (1);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (2);
+--send INSERT INTO t1 (f2) VALUES (2);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1 WHERE f2 = 1;
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1 WHERE f2 = 2;
+--source include/wait_condition.inc
+
+--connection node_1
+--reap
+COMMIT;
+
+--connection node_1a
+--reap
+ROLLBACK;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+
+--connection node_2
+--disable_query_log
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
+--enable_query_log
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback.test
new file mode 100644
index 00000000000..33a318f8ae3
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback.test
@@ -0,0 +1,76 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test that ROLLBACK works correctly with streaming replication
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) >= 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+ROLLBACK;
+
+#
+# After ROLLBACK, the table on node #2 should be empty
+#
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
+
+#
+# It should be possible to re-insert the values we just rolled back
+#
+
+--connection node_1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) >= 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) >= 10 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test
new file mode 100644
index 00000000000..c6c443a0828
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test
@@ -0,0 +1,55 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test that a SR transaction that was just ROLLBACKed on one node can be
+# run against another node without any conflicts
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+ROLLBACK;
+
+#
+# After ROLLBACK, the table on node #2 should be empty
+#
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
+
+#
+# It should be possible to reissue the same transaction against node #2
+#
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+COMMIT;
+
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 5 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback_savepoint.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback_savepoint.test
new file mode 100644
index 00000000000..93ff7a948c4
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback_savepoint.test
@@ -0,0 +1,51 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test that ROLLBACK TO SAVEPOINT works correctly with streaming replication
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SAVEPOINT s1;
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 5 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+ROLLBACK TO SAVEPOINT s1;
+
+INSERT INTO t1 VALUES (21, 'c');
+INSERT INTO t1 VALUES (22, 'c');
+INSERT INTO t1 VALUES (23, 'c');
+INSERT INTO t1 VALUES (24, 'c');
+INSERT INTO t1 VALUES (25, 'c');
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'a';
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'c';
+
+--connection node_1
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test
new file mode 100644
index 00000000000..74350faf5a2
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test
@@ -0,0 +1,61 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the case where a statement is rolled back due to an error while Streaming Replication
+# is in effect. We construct an INSERT ... SELECT statement that will fail with a duplicate
+# key error towards the end of the statement, after a portion has already been replicated via SR.
+#
+
+--disable_query_log
+--let $auto_increment_offset_orig = `SELECT @@auto_increment_offset`
+SET GLOBAL auto_increment_offset=1;
+--enable_query_log
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB;
+
+INSERT INTO t1 (f2) SELECT REPEAT('a', 255) FROM ten AS a1, ten AS a2, ten AS a3;
+ALTER TABLE t1 CHANGE f1 f1 INTEGER;
+ALTER TABLE t1 DROP PRIMARY KEY;
+
+# This poison value is used to cause the INSERT ... SELECT below to fail
+INSERT INTO t1 VALUES (1, 'abc');
+
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+SET SESSION wsrep_trx_fragment_size = 1;
+
+--error ER_DUP_ENTRY
+INSERT INTO t2 SELECT * FROM t1;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t2;
+--source include/wait_condition.inc
+
+# Cluster continues to operate after the implicit ROLLBACK;
+--connection node_1
+INSERT INTO t2 VALUES (1, 'abc');
+
+--connection node_2
+INSERT INTO t2 VALUES (2, 'abc');
+
+--connection node_1
+SELECT COUNT(*) = 2 FROM t2;
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM t2;
+
+--connection node_1
+
+--disable_query_log
+--eval SET GLOBAL auto_increment_offset=$auto_increment_offset_orig;
+--enable_query_log
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_sbr.test b/mysql-test/suite/galera_sr/t/galera_sr_sbr.test
new file mode 100644
index 00000000000..a24a520af60
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_sbr.test
@@ -0,0 +1,31 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test that SR does not assert in the presence of statement-based replication events
+#
+
+--connection node_1
+CREATE TABLE t1 (id INT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET SESSION BINLOG_FORMAT='STATEMENT';
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+COMMIT;
+
+--connection node_2
+SELECT COUNT(*) = 5 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_master.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_master.test
new file mode 100644
index 00000000000..3f7407fe536
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_master.test
@@ -0,0 +1,53 @@
+#
+# Shut down master (node #2) while an SR transaction is in progress
+#
+
+--source include/galera_cluster.inc
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_2
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB;
+
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1),(2),(3);
+
+--connection node_1
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+--connection node_2
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+# Confirm that SR table on slave is empty
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2
+--source include/start_mysqld.inc
+
+# SR table on master should be empty too
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+# Confirm that the INSERT can be re-issued
+INSERT INTO t1 VALUES (1),(2),(3);
+
+--connection node_1
+SELECT COUNT(*) = 3 FROM t1;
+
+DROP TABLE t1;
+
+--connection node_2
+CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for ");
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test
new file mode 100644
index 00000000000..fa2df242ccc
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test
@@ -0,0 +1,63 @@
+#
+# Shut down slave (node #2) while an SR transaction is in progress
+#
+
+--source include/galera_cluster.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB;
+
+# We start two transactions on the master so that we can commit one while the slave
+# is down and commit the other after the slave has rejoined
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11),(12),(13);
+
+--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1b
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21),(22),(23);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+--source include/wait_condition.inc
+
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+# Commit one transaction while the slave is down
+--connection node_1a
+INSERT INTO t1 VALUES (14),(15),(16);
+COMMIT;
+
+# Restart slave
+--connection node_2
+--source include/start_mysqld.inc
+
+# Confirm SR table on slave has entries
+SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 6 FROM t1 WHERE f1 IN (11,12,13,14,15,16);
+
+# Commit the second transaction on master after the slave has rejoined
+--connection node_1b
+INSERT INTO t1 VALUES (24),(25),(26);
+COMMIT;
+
+# Confirm that SR table on slave is empty
+--connection node_2
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) = 12 FROM t1;
+
+# SR table on master should be empty too
+--connection node_1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf
new file mode 100644
index 00000000000..c8e17436e71
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf
@@ -0,0 +1,6 @@
+!include ../galera_2nodes.cnf
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=16K'
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=16K'
+
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.test b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.test
new file mode 100644
index 00000000000..403b44286d9
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.test
@@ -0,0 +1,21 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# A simple test with a very low value for gcache.size - 16K
+#
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+SELECT COUNT(*) = 10000 FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_table_contents.test b/mysql-test/suite/galera_sr/t/galera_sr_table_contents.test
new file mode 100644
index 00000000000..92d29fe4ca2
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_table_contents.test
@@ -0,0 +1,49 @@
+#
+# This test dumps the contents of the SR table under various circumstances
+#
+
+--source include/galera_cluster.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--echo
+--echo Start of Simple Insert
+INSERT INTO t1 VALUES (4);
+--source suite/galera/include/galera_dump_sr_table.inc
+--echo End of Simple Insert
+--echo
+ROLLBACK;
+
+--echo Start of Multi-row Update
+UPDATE t1 SET f1 = f1 + 10;
+--source suite/galera/include/galera_dump_sr_table.inc
+--echo End of Multi-row Update
+--echo
+ROLLBACK;
+
+--echo Start of Multi-table Update
+UPDATE t1, t2 SET t1.f1 = t1.f1 + 100, t2.f1 = t2.f1 + 100;
+--source suite/galera/include/galera_dump_sr_table.inc
+--echo End of Multi-table Update
+--echo
+ROLLBACK;
+
+--echo Start of Savepoint
+INSERT INTO t1 VALUES (1000);
+SAVEPOINT X;
+INSERT INTO t1 VALUES (2000);
+ROLLBACK TO SAVEPOINT X;
+--source suite/galera/include/galera_dump_sr_table.inc
+--echo End of Savepoint
+--echo
+ROLLBACK;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_transaction_replay.test b/mysql-test/suite/galera_sr/t/galera_sr_transaction_replay.test
new file mode 100644
index 00000000000..f44d67e5c8c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_transaction_replay.test
@@ -0,0 +1,260 @@
+#
+# This test tests the operation of SR transaction replay. If a
+# potentially conflicting remote transaction arrives at
+# just the right time during the commit of a local transaction,
+# the local transaction will be aborted and replayed.
+#
+# This test is divided in two sections:
+# 1) Test the scenario where the last fragment does not have write set
+# payload, just commit flag is replicated
+# 2) Test the scenario where the last fragment has write set payload
+# and commit flag
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+# Control connection for manipulating galera sync points
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_1
+
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+
+#########################################################################
+#
+# 1) Replay without commit fragment write set payload
+#
+#########################################################################
+
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+
+--connection node_1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+
+#
+# Block the commit from node_2
+#
+--connection node_1a
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_set_sync_point.inc
+
+#
+# Issue conflicting UPDATE from node_2 and wait until it hits the
+# apply monitor (but does not apply yet)
+#
+--connection node_2
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+
+--connection node_1a
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_wait_sync_point.inc
+
+#
+# Set a new sync point to block in local monitor on node_1 commit
+#
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = local_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
+
+#
+# Send the commit on node_1
+#
+--connection node_1
+--send COMMIT
+
+#
+# Wait until commit reaches sync point
+#
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+--let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+
+#
+# Release conflicting slave transaction and wait until it has BF
+# aborted pending COMMIT
+#
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_set_sync_point.inc
+
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+
+--let $galera_sync_point = abort_trx_end local_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+
+#
+# Release both threads, local thread will now replay
+#
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+
+--let $galera_sync_point = local_monitor_master_enter_sync
+--source include/galera_signal_sync_point.inc
+
+#
+# Commit must succeed
+#
+--connection node_1
+--reap
+
+
+#
+# Check the outcome and that wsrep schema SR table is empty
+#
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+#
+# wsrep_local_replays has increased by 1
+#
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DELETE FROM t1;
+
+#########################################################################
+#
+# 2) Replay with commit fragment write set payload
+#
+#########################################################################
+
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+
+--connection node_1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+
+#
+# Do first update SR on
+#
+UPDATE t1 SET f2 = 'x' WHERE f1 = 1;
+
+#
+# Disable SR for following statements
+#
+SET SESSION wsrep_trx_fragment_size = 0;
+
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+
+#
+# Block the commit from node_2
+#
+--connection node_1a
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_set_sync_point.inc
+
+#
+# Issue conflicting UPDATE from node_2 and wait until it hits the
+# apply monitor (but does not apply yet)
+#
+--connection node_2
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+
+--connection node_1a
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_wait_sync_point.inc
+
+#
+# Set a new sync point to block in local monitor on node_1 commit
+#
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = local_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
+
+#
+# Send the commit on node_1
+#
+--connection node_1
+--send COMMIT
+
+#
+# Wait until commit reaches sync point
+#
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+--let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+
+#
+# Release conflicting slave transaction and wait until it has BF
+# aborted pending COMMIT
+#
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_set_sync_point.inc
+
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+
+--let $galera_sync_point = abort_trx_end local_monitor_master_enter_sync
+--source include/galera_wait_sync_point.inc
+
+#
+# Release both threads, local thread will now replay
+#
+--source include/galera_clear_sync_point.inc
+--let $galera_sync_point = abort_trx_end
+--source include/galera_signal_sync_point.inc
+
+--let $galera_sync_point = local_monitor_master_enter_sync
+--source include/galera_signal_sync_point.inc
+
+#
+# Commit must succeed
+#
+--connection node_1
+--reap
+
+
+#
+# Check the outcome and that wsrep schema SR table is empty
+#
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+#
+# wsrep_local_replays has increased by 1
+#
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 2 AS wsrep_local_replays;
+--enable_query_log
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+DELETE FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_unit_statements.test b/mysql-test/suite/galera_sr/t/galera_sr_unit_statements.test
new file mode 100644
index 00000000000..0cf05765838
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_unit_statements.test
@@ -0,0 +1,54 @@
+#
+# Test wsrep_fragment_unit = statements
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 3;
+SET SESSION wsrep_trx_fragment_unit = 'statements';
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+
+# Expect noting is replicated yet, so far we have 2 statements
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+INSERT INTO t1 VALUES (2);
+
+# Expect 2 rows in t1 and 1 fragment in SR table
+--connection node_2
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+
+ --connection node_1
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+# Expect 5 rows in t1 and 2 fragments in SR table
+--connection node_2
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+COMMIT;
+
+# Expect 5 rows in t1 and empty SR table
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events-master.opt
new file mode 100644
index 00000000000..0b5f8bf7104
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events-master.opt
@@ -0,0 +1 @@
+--log-bin-use-v1-row-events=1 --wsrep-trx-fragment-size=1
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events.test b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events.test
new file mode 100644
index 00000000000..d3d4d2d0c14
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events.test
@@ -0,0 +1,27 @@
+#
+# Test that Galera SR continues to run even with --log-bin-use-v1-row-events=1
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+COMMIT;
+
+SET AUTOCOMMIT=ON;
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ws_size.test b/mysql-test/suite/galera_sr/t/galera_sr_ws_size.test
new file mode 100644
index 00000000000..98f6e796ef6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_ws_size.test
@@ -0,0 +1,70 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test that SR transaction is cumulatively allowed to grow beyond repl.max_ws_size
+# if individual fragements are below that size
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+
+SET SESSION wsrep_trx_fragment_size = 512;
+SET GLOBAL wsrep_provider_options='repl.max_ws_size=4096';
+
+#
+# Create a transaction larger than repl.max_ws_size
+#
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1;
+
+#
+# We expect that the transaction can proceed successfully
+#
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 10 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+# Commit succeeds
+COMMIT;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SELECT COUNT(*) = 100 FROM t1;
+
+#
+# Cleanup
+#
+
+DROP TABLE t1;
+DROP TABLE ten;
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+call mtr.add_suppression('WSREP: transaction size limit.*');
+call mtr.add_suppression('WSREP: rbr write fail.*');
+call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*');
+call mtr.add_suppression('WSREP: transaction size exceeded.*');
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ws_size2.test b/mysql-test/suite/galera_sr/t/galera_sr_ws_size2.test
new file mode 100644
index 00000000000..2b9bc4819b8
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_ws_size2.test
@@ -0,0 +1,62 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test that if wsrep_trx_fragment_size > repl.max_ws_size, no SR takes place and
+# the transaction is properly aborted.
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+
+SET SESSION wsrep_trx_fragment_size = 256;
+SET GLOBAL wsrep_provider_options='repl.max_ws_size=128';
+
+#
+# Create a transaction larger than repl.max_ws_size
+#
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+--error ER_ERROR_DURING_COMMIT,ER_ERROR_ON_WRITE,ER_BINLOG_ROW_LOGGING_FAILED
+INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1, ten AS a2;
+
+#
+# We expect that the transaction can not complete successfully
+#
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--sleep 2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SELECT COUNT(*) = 0 FROM t1;
+
+#
+# Cleanup
+#
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_trx_fragment_size = $wsrep_trx_fragment_size_orig;
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
+DROP TABLE ten;
+
+call mtr.add_suppression('WSREP: SR rollback replication failure.*');
+call mtr.add_suppression('WSREP: transaction size limit.*');
+call mtr.add_suppression('WSREP: SR rbr write fail.*');
+call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*');
+call mtr.add_suppression('WSREP: transaction size exceeded.*');
+call mtr.add_suppression('WSREP: fragment replication failed:');
+call mtr.add_suppression('WSREP: post commit failed for SR rollback');
+call mtr.add_suppression('WSREP: pre_commit for SR rollback returned 2, thd:*');
+call mtr.add_suppression('WSREP: wsrep_rollback failed to send SR ROLLBACK for *');
diff --git a/mysql-test/suite/galera_sr/t/galera_var_ignore_apply_errors_sr.test b/mysql-test/suite/galera_sr/t/galera_var_ignore_apply_errors_sr.test
new file mode 100644
index 00000000000..ea40f58db73
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_var_ignore_apply_errors_sr.test
@@ -0,0 +1,38 @@
+#
+# Test option wsrep_ignore_apply_errors
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Delete row that does not exist using SR transaction
+#
+
+--connection node_2
+SET GLOBAL wsrep_ignore_apply_errors = 2;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (2);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (3);
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+COMMIT;
+
+--connection node_1
+SELECT COUNT(*) = 1 FROM t1;
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+SET SESSION wsrep_trx_fragment_size = 0;
+DROP TABLE t1;
+
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");
+CALL mtr.add_suppression("Can't find record in 't1'"); \ No newline at end of file
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep#215.test b/mysql-test/suite/galera_sr/t/mysql-wsrep#215.test
new file mode 100644
index 00000000000..81b4a718f68
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep#215.test
@@ -0,0 +1,175 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# Test the following sequence of events:
+#
+# 1. Node #1 begins a transaction
+# 2. Node #2 performs a conflicting insert
+# 3. Node #1 attempts to SR-replicate a conflicting transaction
+#
+
+# to sync node_1 appliers
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 2;
+SET SESSION wsrep_trx_fragment_unit = 'statements';
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_1a
+SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_2
+INSERT INTO t1 VALUES (1);
+
+--connection node_1a
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+--send INSERT INTO t1 VALUES (1);
+
+--connection node_1a
+# Wait for the above INSERT to fail certification
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
+--source include/wait_condition.inc
+
+SET GLOBAL DEBUG_DBUG = '';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+--reap
+
+COMMIT;
+
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1a
+SET DEBUG_SYNC = 'RESET';
+
+#
+# Similar test with BYTES unit
+#
+--connection node_1
+TRUNCATE TABLE t1;
+
+SET SESSION wsrep_trx_fragment_size = 10;
+SET SESSION wsrep_trx_fragment_unit = 'bytes';
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_1a
+SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_2
+INSERT INTO t1 VALUES (1);
+
+--connection node_1a
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+--send INSERT INTO t1 VALUES (1)
+
+# Wait for the above INSERT to fail certification
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
+--source include/wait_condition.inc
+
+SET GLOBAL DEBUG_DBUG = '';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+--reap
+ROLLBACK;
+
+SELECT * FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT * FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1a
+SET DEBUG_SYNC = 'RESET';
+
+#
+# One more test with BYTES unit, but now fragment size is adjusted so
+# that second insert should trigger fragment replication.
+# Currently 200 bytes is good choice here, but this may change with
+# future MySQL versions.
+# => If this test fails after some MySQL merge, check if frgament size
+# needs to be tuned to spot at second insert statement.
+#
+--connection node_1
+TRUNCATE TABLE t1;
+
+SET SESSION wsrep_trx_fragment_size = 200;
+SET SESSION wsrep_trx_fragment_unit = 'bytes';
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+--connection node_1a
+SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_2
+INSERT INTO t1 VALUES (1);
+
+--connection node_1a
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+--send INSERT INTO t1 VALUES (2)
+
+# Wait for the above INSERT to fail certification
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
+--source include/wait_condition.inc
+
+SET GLOBAL DEBUG_DBUG = '';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+--reap
+COMMIT;
+
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+
+--connection node_1a
+DROP TABLE t1;
+SET DEBUG_SYNC = 'RESET';
+
+--connection node_2
+CALL mtr.add_suppression("WSREP: Could not find applier context for");
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136-master.opt b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136-master.opt
new file mode 100644
index 00000000000..03fcb5d040d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136-master.opt
@@ -0,0 +1 @@
+--log-slave-updates --log-bin
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136.test
new file mode 100644
index 00000000000..06e56d3c9cd
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136.test
@@ -0,0 +1,41 @@
+# SR transactions are not binlogged #136
+
+--source include/galera_cluster.inc
+
+--connection node_1
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+
+--connection node_2
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+COMMIT;
+
+SET SESSION wsrep_trx_fragment_size = 0;
+INSERT INTO t1 VALUES (3),(4);
+COMMIT;
+
+--connection node_1
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+--replace_column 2 <Pos> 5 <End_log_pos>
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+
+--connection node_2
+# Wait for all updates to arrive before dumping binlog
+SELECT COUNT(*) = 4 FROM t1;
+
+--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
+--replace_column 2 <Pos> 5 <End_log_pos>
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#138.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#138.test
new file mode 100644
index 00000000000..3694dc9ad43
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#138.test
@@ -0,0 +1,25 @@
+# SR: two identical transactions have different value for the WSREP_FLAG_PA_UNSAFE flag
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+
+--connection node_2
+SELECT flags FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+ROLLBACK;
+INSERT INTO t1 VALUES (3),(4);
+
+--connection node_2
+SELECT flags FROM mysql.wsrep_streaming_log;
+
+--connection node_1
+ROLLBACK;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test
new file mode 100644
index 00000000000..deeb890fa0b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test
@@ -0,0 +1,21 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+
+COMMIT;
+
+DROP TABLE t1;
+
+--connection node_2
+--source include/galera_wait_ready.inc
+
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test
new file mode 100644
index 00000000000..5210b9ce99e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test
@@ -0,0 +1,60 @@
+# statement rollback for SR transaction causes slave crash for inconsistency
+
+# We test the following:
+# 1. Create a transaction that is blocked by an SR transaction
+# 2. Force the SR transaction to have a statement rollback
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (6),(7),(8),(9),(10),(1);
+
+--connection node_2
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL DEBUG = 'd,sync.wsrep_apply_cb';
+
+# Begin SR transaction
+--connection node_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+
+# Begin non-SR transaction that will block waiting for the SR transaction
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+--send INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+
+# Cause the SR transaction to fail with a duplicate key error
+--connection node_1
+--send INSERT INTO t1 SELECT * FROM t2;
+
+# Continue and commit the non-SR transaction.
+--connection node_1a
+--reap
+INSERT INTO t1 VALUES (6), (7), (8), (9), (10);
+COMMIT;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK,ER_DUP_ENTRY
+--reap
+
+--connection node_2
+SET GLOBAL wsrep_slave_threads = 1;
+SET GLOBAL DEBUG = '';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
+
+SELECT COUNT(*) = 10 FROM t1;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#15.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#15.test
new file mode 100644
index 00000000000..4aaff058b30
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#15.test
@@ -0,0 +1,17 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (id INT) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+
+COMMIT;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc
new file mode 100644
index 00000000000..29755ab6c2e
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc
@@ -0,0 +1,104 @@
+# --source include/galera_cluster.inc
+# --source include/have_debug_sync.inc
+
+#
+# This test attempts to catch a race condition between autocommit
+# transaction and transaction which is rolling back due to
+# deadlock.
+#
+# Test outline:
+# * Trx 1a makes updates
+# * SR trx 1b writes a row 3, then makes updates
+# * AC trx 1c will attempt to write row 3 and will wait for lock
+# held by 1b
+# * Sync point is set for 1b to delay SR rollback
+# * SR trx 1b makes an update which makes it conflict with trx 1a
+# * Slave shows BF - BF conflict and fails in applying write event
+
+--connection node_1
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x');
+
+# --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+# --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
+# --connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+--connection node_1a
+START TRANSACTION;
+
+UPDATE t1 SET f2 = 'a' WHERE f1 = 1;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 4;
+UPDATE t1 SET f2 = 'a' WHERE f1 = 5;
+
+
+--connection node_1b
+START TRANSACTION;
+SET SESSION wsrep_trx_fragment_size = 1;
+INSERT INTO t1 VALUES (3, 'b');
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+
+--connection node_2
+SELECT * FROM t1;
+
+# Will block, waiting for 1b
+--connection node_1c
+SET AUTOCOMMIT=ON;
+--send INSERT INTO t1 VALUES (3, 'c')
+
+--connection node_2
+SELECT * FROM t1;
+
+# Will block, waiting for 1b
+--connection node_1a
+--send UPDATE t1 SET f2 = 'a' WHERE f1 = 2
+
+# Will deadlock
+--connection node_1b
+SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
+--send UPDATE t1 SET f2 = 'b' WHERE f1 = 1
+
+# Wait until 1b hits rollback
+--connection node_1
+SET DEBUG_SYNC = 'now WAIT_FOR wait';
+
+# UPDATE 12.06.2016: as of recent wsrep API changes, rollbacking thread no
+# longer queues ROLLBACKs and blocks on ROLLBACK replication before performing
+# the actual rollback. As a result this test is moot as both node_1a and node_1c
+# connections are hanging now until sync point is released. Thus sync point
+# release had to be moved above to release the connections. However it is not
+# impossible that further changes in the code may reintroduce the race, so
+# leaving the test as close to original as possible.
+#
+# --connection node_1a
+# --reap
+# COMMIT;
+#
+# --connection node_1c
+# --reap
+#
+# UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+
+--connection node_1
+SET DEBUG_SYNC = 'now SIGNAL continue';
+
+--connection node_1c
+--reap
+
+UPDATE t1 SET f2 = 'x' WHERE f1 = 3;
+
+--connection node_1a
+--reap
+COMMIT;
+
+--connection node_1b
+--error ER_LOCK_DEADLOCK
+--reap
+
+--connection node_1
+SELECT * FROM t1;
+--connection node_2
+SELECT * FROM t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.test
new file mode 100644
index 00000000000..85d501288b0
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.test
@@ -0,0 +1,41 @@
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+
+#
+# This test attempts to catch a race condition between autocommit
+# transaction and transaction which is rolling back due to
+# deadlock.
+#
+# Since it is trying to catch a race condition which may not reliably
+# occur, several runs are necessary for certainty. Hence the body of
+# the test was placed into the .inc file and sourced several times below
+#
+# Test outline:
+# * Trx 1a makes updates
+# * SR trx 1b writes a row 3, then makes updates
+# * AC trx 1c will attempt to write row 3 and will wait for lock
+# held by 1b
+# * Sync point is set for 1b to delay SR rollback
+# * SR trx 1b makes an update which makes it conflict with trx 1a
+# * Slave shows BF - BF conflict and fails in applying write event
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
+--source mysql-wsrep-features#165.inc
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test
new file mode 100644
index 00000000000..544109dadee
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test
@@ -0,0 +1,47 @@
+# Assertion `total_length + thd->wsrep_fragment_base == saved_pos' failed in wsrep_write_cache_inc() with ROLLBACK TO SAVEPOINT and SR
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+INSERT INTO t1 VALUES (4, 'a');
+INSERT INTO t1 VALUES (5, 'a');
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SAVEPOINT s1;
+INSERT INTO t1 VALUES (11, 'b');
+INSERT INTO t1 VALUES (12, 'b');
+INSERT INTO t1 VALUES (13, 'b');
+INSERT INTO t1 VALUES (14, 'b');
+INSERT INTO t1 VALUES (15, 'b');
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 10 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+ROLLBACK TO SAVEPOINT s1;
+
+INSERT INTO t1 VALUES (21, 'c');
+
+COMMIT;
+
+--connection node_1
+SELECT COUNT(*) = 6 FROM t1;
+
+
+--connection node_2
+SELECT COUNT(*) = 6 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#27.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#27.test
new file mode 100644
index 00000000000..f9c09391f8f
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#27.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+--sleep 2
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#29.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#29.test
new file mode 100644
index 00000000000..2349fe9979f
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#29.test
@@ -0,0 +1,23 @@
+#
+# mysql-wsrep-features#29 Unwarranted deadlock error with SR and a single-node cluster
+#
+
+SET SESSION wsrep_trx_fragment_size = 1;
+SET SESSION binlog_format = STATEMENT;
+
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=innodb;
+
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=innodb;
+
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32-master.opt b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32-master.opt
new file mode 100644
index 00000000000..a6ef074a120
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32-master.opt
@@ -0,0 +1 @@
+--innodb-lock-wait-timeout=1
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32.test
new file mode 100644
index 00000000000..72c7a7b5e82
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32.test
@@ -0,0 +1,44 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# mysql-wsrep-features#32 Assertion `meta->gtid.seqno == wsrep_thd_trx_seqno(thd)' failed in wsrep_commit_cb with SR
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+SET AUTOCOMMIT=OFF;
+
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (6);
+
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES (5);
+ROLLBACK;
+
+--connection node_1
+COMMIT;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#35.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#35.test
new file mode 100644
index 00000000000..c5cf1dea0ae
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#35.test
@@ -0,0 +1,48 @@
+--source include/have_debug_sync.inc
+--source include/galera_cluster.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+# Block node #2's applier so that it is able to issue a conflicting INSERT before
+# node #1 INSERTs have been applied on it.
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+SELECT COUNT(*) = 0 FROM t1;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL debug = '+d,sync.wsrep_apply_cb';
+
+--connection node_1
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--connection node_2a
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+--send INSERT INTO t1 VALUES (1);
+
+--connection node_1
+COMMIT;
+
+--connection node_2a
+SET GLOBAL debug = '';
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+--connection node_2
+--error ER_DUP_ENTRY,ER_LOCK_DEADLOCK
+--reap
+ROLLBACK;
+
+DROP TABLE t1;
+
+--connection node_2a
+SET DEBUG_SYNC = "RESET";
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#8.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#8.test
new file mode 100644
index 00000000000..55210386044
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#8.test
@@ -0,0 +1,63 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# InnoDB FULLTEXT indexes
+#
+
+SET SESSION wsrep_trx_fragment_size = 1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+#
+# Fulltext index creation causes the creation of multiple system tables
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
+
+--connection node_2
+SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%';
+
+#
+# Fulltext insertion causes a flurry of updates on those system tables
+#
+
+--connection node_1
+# Insert 10K rows
+INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz');
+
+UPDATE t1 SET f2 = 'abcdefjhk';
+
+--connection node_1
+SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk');
+
+--connection node_2
+
+DROP TABLE t1;
+
+#
+# Same on a table with no PK
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB;
+
+--connection node_2
+# We insert only 1K rows here, because updates without a PK are very slow
+INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+
+--connection node_1
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz');
+
+UPDATE t1 SET f1 = 'abcdefjhk';
+
+--connection node_2
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#9.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#9.test
new file mode 100644
index 00000000000..cbecf40fadf
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#9.test
@@ -0,0 +1,44 @@
+#
+# mysql-wsrep-features#9 Hang in galera::ReplicatorSMM::cert with Streaming Replication
+# when running the galera_kill_ddl.test test
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+--connection node_1
+
+# Enable the master to continue running during the split-brain situation that
+# occurs when the slave is killed
+--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+
+SET SESSION wsrep_trx_fragment_size = 1;
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+--connection node_2
+--source include/kill_galera.inc
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+--source include/start_mysqld.inc
+--source include/galera_wait_ready.inc
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+--connection node_2a
+
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1';
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--connection node_1
+--disable_query_log
+--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
+--enable_query_log
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#93.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#93.test
new file mode 100644
index 00000000000..442a7113537
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#93.test
@@ -0,0 +1,29 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# This test sets a SAVEPOINT at the very beginning
+# of the transaction. When ROLLBACK TO SAVEPOINT is
+# issued, mysql performs a full rollback on SEs that
+# where not part of the transaction.
+# Test that SR transactions are rolled back, and
+# cleaned up properly in this case.
+#
+
+CREATE TABLE t1 (f1 INTEGER);
+SET SESSION WSREP_TRX_FRAGMENT_SIZE=1;
+
+START TRANSACTION;
+
+SAVEPOINT a;
+INSERT INTO t1 VALUES (1);
+ROLLBACK TO SAVEPOINT a;
+
+INSERT INTO t1 values (2);
+COMMIT;
+
+SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log;
+--connection node_2
+SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test
new file mode 100644
index 00000000000..c773b310183
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test
@@ -0,0 +1,45 @@
+# mysql-wsrep-features#96 - "Sanity check failed" with SR and statement rolled back due to error
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+
+--connection node_1
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t2 (f2 VARCHAR(32));
+
+SET SESSION wsrep_trx_fragment_size=1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+
+# This statement causes full transaction rollback
+# rather than just statement rollback, as it is run under SR
+
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (2),(1);
+INSERT INTO t2 VALUES ('abc');
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 1 FROM t2;
+
+--connection node_1
+ROLLBACK;
+
+--connection node_2
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+
+SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) = 0 FROM t2;
+
+--connection node_1
+DROP TABLE t1;
+DROP TABLE t2;
+
+
+
+
diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result
index 9aff30aabc9..3d19f718287 100644
--- a/mysql-test/suite/gcol/r/gcol_bugfixes.result
+++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result
@@ -231,6 +231,7 @@ Note 1265 Data truncated for column 'col_time_key' at row 5
Note 1265 Data truncated for column 'col_time_key' at row 6
ANALYZE TABLE c;
Table Op Msg_type Msg_text
+test.c analyze status Engine-independent statistics collected
test.c analyze status OK
explain SELECT COUNT(DISTINCT col_varchar_key) AS x
FROM c
@@ -327,6 +328,7 @@ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS (b + 1) VIRTUAL;
ALTER TABLE t1 ADD INDEX( c );
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Make sure the index is correct. That's kinda important.
EXPLAIN
diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
index 577b3255620..2ea0a256df7 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
@@ -348,6 +348,7 @@ CREATE TABLE t1 (f1 int, gc int AS (f1 + 1) STORED, UNIQUE(gc));
INSERT INTO t1(f1) VALUES (1),(2),(0),(9),(3),(4),(8),(7),(5),(6);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Should use index
SELECT * FROM t1 WHERE f1 + 1 > 7;
@@ -455,6 +456,7 @@ INSERT INTO t1(f1) VALUES
(070707),(080808);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * FROM t1 WHERE f1 + 1 > 070707;
f1 gc_int gc_date
@@ -489,6 +491,7 @@ KEY col_int_gc_key(col_int_gc_key)
INSERT INTO t1 ( col_int_key) VALUES (7);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2
FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk))
@@ -696,8 +699,6 @@ Warning 1264 Out of range value for column 'b' at row 1
SELECT * FROM t WHERE c = '0';
a b c
1 127 0
-Warnings:
-Warning 1264 Out of range value for column 'b' at row 1
DROP TABLE t;
#
# Bug#21688115 VIRTUAL COLUMN COMPUTATION SAVE_IN_FIELD()
@@ -729,6 +730,7 @@ INDEX(gc_case));
INSERT INTO t (a, b) VALUES (0, 0), (0, 1), (1, 0), (1, 1);
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
EXPLAIN SELECT a, b FROM t WHERE (a AND b) = 1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -811,7 +813,9 @@ CREATE TABLE t2 (b INTEGER);
INSERT INTO t2 VALUES (1);
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
# Used to choose the index on a1 and get wrong results.
EXPLAIN SELECT * FROM t1 WHERE (a2 AND a2) = 0;
diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result
index dcbba1f70c1..8ef6736388a 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result
@@ -348,6 +348,7 @@ CREATE TABLE t1 (f1 int, gc int AS (f1 + 1) STORED, UNIQUE(gc));
INSERT INTO t1(f1) VALUES (1),(2),(0),(9),(3),(4),(8),(7),(5),(6);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Should use index
SELECT * FROM t1 WHERE f1 + 1 > 7;
@@ -455,6 +456,7 @@ INSERT INTO t1(f1) VALUES
(070707),(080808);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * FROM t1 WHERE f1 + 1 > 070707;
f1 gc_int gc_date
@@ -489,6 +491,7 @@ KEY col_int_gc_key(col_int_gc_key)
INSERT INTO t1 ( col_int_key) VALUES (7);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2
FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk))
@@ -727,6 +730,7 @@ INDEX(gc_case));
INSERT INTO t (a, b) VALUES (0, 0), (0, 1), (1, 0), (1, 1);
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
EXPLAIN SELECT a, b FROM t WHERE (a AND b) = 1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -809,7 +813,9 @@ CREATE TABLE t2 (b INTEGER);
INSERT INTO t2 VALUES (1);
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
# Used to choose the index on a1 and get wrong results.
EXPLAIN SELECT * FROM t1 WHERE (a2 AND a2) = 0;
diff --git a/mysql-test/suite/gcol/r/gcol_select_innodb.result b/mysql-test/suite/gcol/r/gcol_select_innodb.result
index bc9bddad690..983e1fb2533 100644
--- a/mysql-test/suite/gcol/r/gcol_select_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_select_innodb.result
@@ -20,8 +20,11 @@ c int generated always as (-a) stored unique);
insert into t3 (a) values (2),(1),(3);
analyze table t1,t2,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
# select_type=SIMPLE, type=system
select * from t2;
@@ -676,9 +679,13 @@ INSERT INTO t4
VALUES (1, 'j'), (2, 'c'), (0, 'a');
ANALYZE TABLE t1, t2, t3, t4;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
+test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
diff --git a/mysql-test/suite/gcol/r/gcol_select_myisam.result b/mysql-test/suite/gcol/r/gcol_select_myisam.result
index d0fe7fbd0d4..e823458483d 100644
--- a/mysql-test/suite/gcol/r/gcol_select_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_select_myisam.result
@@ -20,8 +20,11 @@ c int generated always as (-a) stored unique);
insert into t3 (a) values (2),(1),(3);
analyze table t1,t2,t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
# select_type=SIMPLE, type=system
select * from t2;
@@ -853,7 +856,9 @@ Warnings:
Note 1265 Data truncated for column 'col_time_key' at row 1
ANALYZE TABLE a, c;
Table Op Msg_type Msg_text
+test.a analyze status Engine-independent statistics collected
test.a analyze status OK
+test.c analyze status Engine-independent statistics collected
test.c analyze status OK
EXPLAIN
SELECT
@@ -931,7 +936,9 @@ col_varchar_nokey
(5, 'b'),(8,'m'),(7, 'j'),(2, 'v');
ANALYZE TABLE c, cc;
Table Op Msg_type Msg_text
+test.c analyze status Engine-independent statistics collected
test.c analyze status OK
+test.cc analyze status Engine-independent statistics collected
test.cc analyze status OK
EXPLAIN SELECT
alias2 . col_varchar_key AS field1
@@ -1298,9 +1305,13 @@ INSERT INTO t4
VALUES (1, 'j'), (2, 'c'), (0, 'a');
ANALYZE TABLE t1, t2, t3, t4;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
+test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
diff --git a/mysql-test/suite/gcol/r/gcol_view_innodb.result b/mysql-test/suite/gcol/r/gcol_view_innodb.result
index ec82c792493..b23dbfc4bff 100644
--- a/mysql-test/suite/gcol/r/gcol_view_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_view_innodb.result
@@ -5,6 +5,7 @@ c int generated always as (-a) stored);
insert into t1 (a) values (1), (1), (2), (2), (3);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
create view v1 (d,e) as select abs(b), abs(c) from t1;
select d,e from v1;
diff --git a/mysql-test/suite/gcol/r/gcol_view_myisam.result b/mysql-test/suite/gcol/r/gcol_view_myisam.result
index 13cb74ebcb5..264bd904c30 100644
--- a/mysql-test/suite/gcol/r/gcol_view_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_view_myisam.result
@@ -5,6 +5,7 @@ c int generated always as (-a) stored);
insert into t1 (a) values (1), (1), (2), (2), (3);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
create view v1 (d,e) as select abs(b), abs(c) from t1;
select d,e from v1;
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result
index 25faeaf4e84..1d4766eab19 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result
@@ -7,9 +7,18 @@ CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb;
CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL,
fld3 INT AS (fld2) VIRTUAL, KEY(fld1),
FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb;
+CREATE TABLE u1(a INT, KEY(a)) ENGINE=InnoDB;
+CREATE TABLE u2(b INT, vb INT GENERATED ALWAYS AS(b) VIRTUAL, KEY(vb),
+FOREIGN KEY(b) REFERENCES u1(a)ON DELETE CASCADE)ENGINE=InnoDB;
+INSERT INTO u1 SET a=1;
+INSERT INTO u2 SET b=1;
INSERT INTO t1(fld1) VALUES(1);
INSERT INTO t2(fld1, fld2) VALUES(1, 2);
UPDATE t1 SET fld1= 2;
+DELETE FROM u1;
+SELECT * FROM u2;
+b vb
+DROP TABLE u2,u1;
SELECT fld3, fld1 FROM t2;
fld3 fld1
2 2
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result
index 8d4762e1b90..6913ec698b4 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_index.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result
@@ -135,7 +135,7 @@ key (d)
insert into t(a) values ((select d from s for update));
insert into s(c) values ('');
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'c' at row 1
+Warning 1366 Incorrect integer value: '' for column `test`.`s`.`c` at row 1
SET sql_mode = default;
drop table if exists t,s;
#
@@ -239,3 +239,23 @@ KEY (a(1))
INSERT INTO t1(b) VALUES(REPEAT('b',1000));
DELETE FROM t1;
DROP TABLE t1;
+#
+# Bug #22990029 GCOLS: INCORRECT BEHAVIOR
+# AFTER DATA INSERTED WITH IGNORE KEYWORD
+#
+CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb))
+ENGINE=InnoDB;
+INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132);
+Warnings:
+Warning 1265 Data truncated for column 'vb' at row 1
+BEGIN;
+DELETE FROM t1;
+INSERT INTO t1 (a,b) VALUES(1,20190123);
+ERROR 22007: Incorrect date value: '20190132' for column `test`.`t1`.`vb` at row 1
+SELECT * FROM t1;
+a b vb
+ROLLBACK;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test
index 61d330036ea..45d1c1295a5 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test
@@ -11,10 +11,19 @@ CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb;
CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL,
fld3 INT AS (fld2) VIRTUAL, KEY(fld1),
FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb;
+CREATE TABLE u1(a INT, KEY(a)) ENGINE=InnoDB;
+CREATE TABLE u2(b INT, vb INT GENERATED ALWAYS AS(b) VIRTUAL, KEY(vb),
+ FOREIGN KEY(b) REFERENCES u1(a)ON DELETE CASCADE)ENGINE=InnoDB;
+
+INSERT INTO u1 SET a=1;
+INSERT INTO u2 SET b=1;
INSERT INTO t1(fld1) VALUES(1);
INSERT INTO t2(fld1, fld2) VALUES(1, 2);
--source include/restart_mysqld.inc
UPDATE t1 SET fld1= 2;
+DELETE FROM u1;
+SELECT * FROM u2;
+DROP TABLE u2,u1;
SELECT fld3, fld1 FROM t2;
alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM=INPLACE;
UPDATE t1 SET fld1=3;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test
index 8f4e09fdf31..a89ae813b05 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_index.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test
@@ -263,3 +263,22 @@ CREATE TABLE t1(
INSERT INTO t1(b) VALUES(REPEAT('b',1000));
DELETE FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # Bug #22990029 GCOLS: INCORRECT BEHAVIOR
+--echo # AFTER DATA INSERTED WITH IGNORE KEYWORD
+--echo #
+
+CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb))
+ENGINE=InnoDB;
+INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132);
+BEGIN;
+DELETE FROM t1;
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 (a,b) VALUES(1,20190123);
+SELECT * FROM t1;
+ROLLBACK;
+# MDEV-18366 FIXME: fix the crash and enable this
+# SELECT * FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result
index 90b2eab902c..1896e30f7d5 100644
--- a/mysql-test/suite/handler/aria.result
+++ b/mysql-test/suite/handler/aria.result
@@ -808,6 +808,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
handler t1 read next;
ERROR 42S02: Unknown table 't1' in HANDLER
@@ -927,6 +928,7 @@ handler t1 open;
lock tables t1 write;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
unlock tables;
handler t1 read next;
@@ -1483,7 +1485,7 @@ handler t2 open;
flush tables with read lock;
handler t1 read next;
a b
-1 1
+2 1
select a from t3;
a
1
diff --git a/mysql-test/suite/handler/heap.result b/mysql-test/suite/handler/heap.result
index 7b81748700e..32d06b79604 100644
--- a/mysql-test/suite/handler/heap.result
+++ b/mysql-test/suite/handler/heap.result
@@ -808,7 +808,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
analyze table t1;
Table Op Msg_type Msg_text
-test.t1 analyze note The storage engine for the table doesn't support analyze
+test.t1 analyze status Operation failed
handler t1 read next;
ERROR 42S02: Unknown table 't1' in HANDLER
#
@@ -927,6 +927,7 @@ handler t1 open;
lock tables t1 write;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze note The storage engine for the table doesn't support analyze
unlock tables;
handler t1 read next;
@@ -1483,7 +1484,7 @@ handler t2 open;
flush tables with read lock;
handler t1 read next;
a b
-1 1
+2 1
select a from t3;
a
1
diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result
index 05cf36fee9e..a1b2b318911 100644
--- a/mysql-test/suite/handler/innodb.result
+++ b/mysql-test/suite/handler/innodb.result
@@ -810,6 +810,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
handler t1 read next;
ERROR 42S02: Unknown table 't1' in HANDLER
@@ -930,6 +931,7 @@ handler t1 open;
lock tables t1 write;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
unlock tables;
handler t1 read next;
@@ -1487,7 +1489,7 @@ handler t2 open;
flush tables with read lock;
handler t1 read next;
a b
-1 1
+2 1
select a from t3;
a
1
diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result
index c4a169be185..8c39b15b6c9 100644
--- a/mysql-test/suite/handler/interface.result
+++ b/mysql-test/suite/handler/interface.result
@@ -175,6 +175,7 @@ c1
connect flush,localhost,root,,;
connection flush;
flush tables;
+flush table t1;
connect waiter,localhost,root,,;
connection waiter;
connection default;
@@ -258,10 +259,11 @@ a b
flush tables;
handler t1 read a next;
a b
-0 a
+2 c
+flush tables t1;
handler t1 read a next;
a b
-1 b
+0 a
flush tables with read lock;
handler t1 read a next;
a b
diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test
index 15853dfdbf5..0ecdbf9c5cf 100644
--- a/mysql-test/suite/handler/interface.test
+++ b/mysql-test/suite/handler/interface.test
@@ -179,12 +179,13 @@ handler t1 open;
handler t1 read first;
connect (flush,localhost,root,,);
connection flush;
-send flush tables;
+flush tables;
+send flush table t1;
connect (waiter,localhost,root,,);
connection waiter;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush";
+ where state = "Waiting for table metadata lock";
--source include/wait_condition.inc
connection default;
handler t2 open;
@@ -282,6 +283,7 @@ handler t1 read a first;
handler t1 read a next;
flush tables;
handler t1 read a next;
+flush tables t1;
handler t1 read a next;
flush tables with read lock;
handler t1 read a next;
diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result
index 8681bb905a0..2c5f8c3bfde 100644
--- a/mysql-test/suite/handler/myisam.result
+++ b/mysql-test/suite/handler/myisam.result
@@ -808,6 +808,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
handler t1 read next;
ERROR 42S02: Unknown table 't1' in HANDLER
@@ -927,6 +928,7 @@ handler t1 open;
lock tables t1 write;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
unlock tables;
handler t1 read next;
@@ -1483,7 +1485,7 @@ handler t2 open;
flush tables with read lock;
handler t1 read next;
a b
-1 1
+2 1
select a from t3;
a
1
diff --git a/mysql-test/suite/innodb/include/alter_instant.inc b/mysql-test/suite/innodb/include/alter_instant.inc
deleted file mode 100644
index cf0c082416b..00000000000
--- a/mysql-test/suite/innodb/include/alter_instant.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-CREATE TABLE t1(f1 INT NOT NULL,
- f2 INT NOT NULL,
- f3 INT AS (f2 * f2) VIRTUAL)engine=innodb;
-
-INSERT INTO t1(f1, f2) VALUES(1, 1);
-
---echo #
---echo # ALGORITHM=$algorithm_type
---echo #
-
---enable_info
---echo # Add column at the end of the table
---error $error_code
---eval ALTER TABLE t1 ADD COLUMN f4 char(100) default "BIG WALL", ALGORITHM=$algorithm_type
-
---echo # Change virtual column expression
---error $error_code
---eval ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL, ALGORITHM=$algorithm_type
-
---echo # Add virtual column
---error $error_code
---eval ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL, ALGORITHM=$algorithm_type
-
---echo # Rename Column
---error $error_code
---eval ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL, ALGORITHM=$algorithm_type
-
---echo # Rename table
---error $error_code
---eval ALTER TABLE t1 RENAME t2, algorithm=$algorithm_type
-
-DROP TABLE t2;
---disable_info
diff --git a/mysql-test/suite/innodb/include/crc32.pl b/mysql-test/suite/innodb/include/crc32.pl
new file mode 100644
index 00000000000..c2bce09dd36
--- /dev/null
+++ b/mysql-test/suite/innodb/include/crc32.pl
@@ -0,0 +1,33 @@
+# The following is Public Domain / Creative Commons CC0 from
+# http://billauer.co.il/blog/2011/05/perl-crc32-crc-xs-module/
+
+sub mycrc32 {
+ my ($input, $init_value, $polynomial) = @_;
+
+ $init_value = 0 unless (defined $init_value);
+ $polynomial = 0xedb88320 unless (defined $polynomial);
+
+ my @lookup_table;
+
+ for (my $i=0; $i<256; $i++) {
+ my $x = $i;
+ for (my $j=0; $j<8; $j++) {
+ if ($x & 1) {
+ $x = ($x >> 1) ^ $polynomial;
+ } else {
+ $x = $x >> 1;
+ }
+ }
+ push @lookup_table, $x;
+ }
+
+ my $crc = $init_value ^ 0xffffffff;
+
+ foreach my $x (unpack ('C*', $input)) {
+ $crc = (($crc >> 8) & 0xffffff) ^ $lookup_table[ ($crc ^ $x) & 0xff ];
+ }
+
+ $crc = $crc ^ 0xffffffff;
+
+ return $crc;
+}
diff --git a/mysql-test/suite/innodb/r/alter_candidate_key.result b/mysql-test/suite/innodb/r/alter_candidate_key.result
new file mode 100644
index 00000000000..23989e0da5f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_candidate_key.result
@@ -0,0 +1,114 @@
+CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL,
+UNIQUE KEY uidx2(f1,f2),
+UNIQUE KEY uidx1(f2)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1, 1);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ UNIQUE KEY `uidx2` (`f1`,`f2`),
+ UNIQUE KEY `uidx1` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
+ SIGNAL conc_dml WAIT_FOR go_ahead';
+ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE;
+connect con1,localhost,root,,;
+SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
+DELETE FROM t1;
+SET DEBUG_SYNC = 'now SIGNAL go_ahead';
+connection default;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f11` int(11) DEFAULT NULL,
+ `f2` int(11) NOT NULL,
+ UNIQUE KEY `uidx1` (`f2`),
+ UNIQUE KEY `uidx2` (`f11`,`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT, f2 INT,
+PRIMARY KEY(f1, f2),
+UNIQUE INDEX uidx2 (f1, f2),
+UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ UNIQUE KEY `uidx2` (`f1`,`f2`),
+ UNIQUE KEY `uidx1` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
+ SIGNAL conc_dml WAIT_FOR go_ahead';
+ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE;
+connection con1;
+SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
+INSERT INTO t1 VALUES(1, 1), (1, 1);
+ERROR 23000: Duplicate entry '1-1' for key 'uidx2'
+SET DEBUG_SYNC = 'now SIGNAL go_ahead';
+connection default;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f11` int(11) DEFAULT NULL,
+ `f2` int(11) NOT NULL,
+ UNIQUE KEY `uidx1` (`f2`),
+ UNIQUE KEY `uidx2` (`f11`,`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+SET SQL_MODE= strict_trans_tables;
+CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB;
+SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
+ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL;
+connection con1;
+SET DEBUG_SYNC='now WAIT_FOR dml';
+BEGIN;
+INSERT INTO t1 SET a=NULL;
+ROLLBACK;
+set DEBUG_SYNC='now SIGNAL dml_done';
+connection default;
+ERROR 22004: Invalid use of NULL value
+DROP TABLE t1;
+disconnect con1;
+SET DEBUG_SYNC="RESET";
+SET SQL_MODE=DEFAULT;
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2),
+UNIQUE KEY(f2))ENGINE=InnoDB;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ UNIQUE KEY `f2` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB;
+Warnings:
+Note 1831 Duplicate index `f2_2`. This is deprecated and will be disallowed in a future release
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ UNIQUE KEY `f2` (`f2`),
+ UNIQUE KEY `f2_2` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ UNIQUE KEY `f2_2` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
index 68e25664031..440a1d0d6b3 100644
--- a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
+++ b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
@@ -1,3 +1,4 @@
+select count_star into @init_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
connect ddl, localhost, root,,;
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
@@ -8,10 +9,10 @@ SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR go';
-SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
-WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
-object_name
-tmp/Innodb Merge Temp File
+select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
+SELECT @final_count - @init_count;
+@final_count - @init_count
+11
SET DEBUG_SYNC = 'now SIGNAL gone';
connection ddl;
disconnect ddl;
diff --git a/mysql-test/suite/innodb/r/analyze_table.result b/mysql-test/suite/innodb/r/analyze_table.result
index a5c25289ad1..57095b725eb 100644
--- a/mysql-test/suite/innodb/r/analyze_table.result
+++ b/mysql-test/suite/innodb/r/analyze_table.result
@@ -19,6 +19,7 @@ COUNT(*)
SET GLOBAL innodb_stats_persistent_sample_pages=2000;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/data_types.result b/mysql-test/suite/innodb/r/data_types.result
index 446d37527e5..1394431b09d 100644
--- a/mysql-test/suite/innodb/r/data_types.result
+++ b/mysql-test/suite/innodb/r/data_types.result
@@ -75,10 +75,15 @@ t1_VARCHAR_10_BINARY VARCHAR(10) BINARY,
t1_VARCHAR_500 VARCHAR(500),
t1_VARCHAR_500_BINARY VARCHAR(500) BINARY,
t1_YEAR_2 YEAR(2),
-t1_YEAR_4 YEAR(4)
+t1_YEAR_4 YEAR(4),
+t1_CHAR_0 CHAR(0),
+t1_MYSQL_0 CHAR(0) CHARACTER SET utf8,
+t1_VARCHAR_0 VARCHAR(0),
+t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8
) ENGINE=InnoDB;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+INSERT INTO t1 () VALUES ();
SELECT
name,
CASE mtype
@@ -109,6 +114,7 @@ t1_BINARY_100 DATA_FIXBINARY
t1_BIT_2 DATA_FIXBINARY UNSIGNED
t1_BIT_20 DATA_FIXBINARY UNSIGNED
t1_BLOB DATA_BLOB
+t1_CHAR_0 DATA_CHAR
t1_CHAR_100 DATA_CHAR
t1_CHAR_100_BINARY DATA_MYSQL
t1_DATE DATA_INT
@@ -131,6 +137,7 @@ t1_MEDIUMBLOB DATA_BLOB
t1_MEDIUMINT DATA_INT
t1_MEDIUMINT_UNSIGNED DATA_INT UNSIGNED
t1_MEDIUMTEXT DATA_BLOB
+t1_MYSQL_0 DATA_MYSQL
t1_SET DATA_INT UNSIGNED
t1_SET_9 DATA_INT UNSIGNED
t1_SET_BINARY DATA_INT UNSIGNED
@@ -146,10 +153,24 @@ t1_TINYINT DATA_INT
t1_TINYINT_UNSIGNED DATA_INT UNSIGNED
t1_TINYTEXT DATA_BLOB
t1_VARBINARY_100 DATA_BINARY
+t1_VARCHAR_0 DATA_VARCHAR
t1_VARCHAR_10 DATA_VARCHAR
t1_VARCHAR_10_BINARY DATA_VARMYSQL
t1_VARCHAR_500 DATA_VARCHAR
t1_VARCHAR_500_BINARY DATA_VARMYSQL
+t1_VARMYSQL_0 DATA_VARMYSQL
t1_YEAR_2 DATA_INT UNSIGNED
t1_YEAR_4 DATA_INT UNSIGNED
DROP TABLE t1;
+#
+# MDEV-17815 Assertion failed in btr_node_ptr_max_size for CHAR(0)
+#
+CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+#
+# MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0)
+#
+CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff
index 5258b7193fa..fbf1d914f5b 100644
--- a/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff
+++ b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff
@@ -9,3 +9,14 @@
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SHOW TABLE STATUS LIKE 't1';
+@@ -31,8 +31,9 @@
+ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1;
+ SHOW TABLE STATUS LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+-t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 0 N
+ DROP TABLE IF EXISTS t1;
++Warnings:
++Note 1051 Unknown table 'test.t1'
+ SET @save_format = @@GLOBAL.innodb_default_row_format;
+ SET GLOBAL innodb_default_row_format = redundant;
+ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/r/default_row_format_create.result b/mysql-test/suite/innodb/r/default_row_format_create.result
index 83d04b47bd0..262e8bc7f19 100644
--- a/mysql-test/suite/innodb/r/default_row_format_create.result
+++ b/mysql-test/suite/innodb/r/default_row_format_create.result
@@ -19,8 +19,26 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=REDUNDANT 0 N
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
-ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+ROW_FORMAT=COMPRESSED;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
-t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED key_block_size=1 0 N
+t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED 0 N
+TRUNCATE TABLE t1;
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED 0 N
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1;
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 0 N
+DROP TABLE IF EXISTS t1;
+SET @save_format = @@GLOBAL.innodb_default_row_format;
+SET GLOBAL innodb_default_row_format = redundant;
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
+SET GLOBAL innodb_default_row_format = @save_format;
+TRUNCATE TABLE t1;
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innochecksum.result b/mysql-test/suite/innodb/r/innochecksum.result
deleted file mode 100644
index 2d8a2652309..00000000000
--- a/mysql-test/suite/innodb/r/innochecksum.result
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
-INSERT INTO t1 (b) VALUES ('corrupt me');
-INSERT INTO t1 (b) VALUES ('corrupt me');
-# Run innochecksum on t1
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result
index 73037247272..51ba58aa1ef 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result
@@ -75,3 +75,26 @@ connection default;
ERROR 23000: Duplicate entry '1' for key 'a'
SET DEBUG_SYNC='RESET';
DROP TABLE t1;
+#
+# MDEV-17470 Orphan temporary files after interrupted ALTER
+# cause InnoDB: Operating system error number 17 and eventual
+# fatal error 71
+#
+CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8);
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+LOCK TABLE t1 READ;
+connect con1,localhost,root,,test;
+ALTER TABLE t1 FORCE, ALGORITHM=COPY;
+connection default;
+kill query @id;
+connection con1;
+ERROR 70100: Query execution was interrupted
+disconnect con1;
+connection default;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result
index 0d5afab6bae..ad3b2cb04af 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-table.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-table.result
@@ -218,6 +218,7 @@ t CREATE TABLE `t` (
PARTITION `p99991231` VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB)
analyze table t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
select count(*) from t where d ='2017-09-15';
count(*)
diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result
index 7b0a43297e0..bf06e9a992b 100644
--- a/mysql-test/suite/innodb/r/innodb-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-alter.result
@@ -439,17 +439,17 @@ tt CREATE TABLE `tt` (
FULLTEXT KEY `ct` (`ct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
CREATE TABLE tu (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
FULLTEXT INDEX(t)
) ENGINE=InnoDB;
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
DROP TABLE tu;
CREATE TABLE tv (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
@@ -457,9 +457,9 @@ UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
FULLTEXT INDEX(t)
) ENGINE=InnoDB;
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
DROP TABLE tv;
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY;
ERROR 42000: Incorrect column name 'dB_row_Id'
@@ -500,8 +500,6 @@ ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY
ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY
-ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID;
@@ -881,6 +879,27 @@ NAME
a
b
DROP TABLE t1;
+# and an MDEV-18041 regression related to indexes prefixes
+create table `test` (
+`test_old` varchar(255) NOT NULL,
+`other` varchar(255) NOT NULL,
+PRIMARY KEY (`test_old`,`other`),
+UNIQUE KEY uk (`test_old`(100), `other`)
+) ENGINE=InnoDB;
+select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
+name pos
+test_old 0
+other 1
+test_old 0
+other 1
+alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
+select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
+name pos
+test_new 0
+other 1
+test_new 0
+other 1
+drop table `test`;
#
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
# DICT_MEM_TABLE_COL_RENAME_LOW
diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result
index c646645ba7a..07b2c0dfaac 100644
--- a/mysql-test/suite/innodb/r/innodb-index-online.result
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result
@@ -123,6 +123,8 @@ ERROR 23000: Duplicate entry '4' for key 'c2'
ALTER TABLE t1 STATS_PERSISTENT=1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'c3'
test.t1 analyze status OK
UPDATE mysql.innodb_index_stats SET stat_value = 5
WHERE database_name = 'test' AND table_name= 't1' AND index_name = 'PRIMARY'
@@ -141,6 +143,7 @@ ALTER TABLE t1_c2_stats ENGINE=INNODB;
DROP INDEX c2 ON t1;
ANALYZE TABLE t1_c2_stats;
Table Op Msg_type Msg_text
+test.t1_c2_stats analyze status Engine-independent statistics collected
test.t1_c2_stats analyze status OK
SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1', 't1_c2_stats');
database_name table_name index_name last_update stat_name stat_value sample_size stat_description
@@ -184,9 +187,11 @@ INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1;
INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1;
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 80 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'c3'
test.t1 analyze status OK
connection con1;
UPDATE t1_c2_stats SET index_name = 'c2d';
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index df27769b810..09e4da28564 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -77,6 +77,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain select * from t1 force index(c) order by c;
id select_type table type possible_keys key key_len ref rows Extra
@@ -119,6 +120,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain select * from t1 force index(c) order by c;
id select_type table type possible_keys key key_len ref rows Extra
@@ -810,6 +812,7 @@ a b
2 2
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -846,6 +849,7 @@ a
2
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1184,6 +1188,33 @@ t2c CREATE TABLE `t2c` (
KEY `t2a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1,t2,t2c,t2i;
+CREATE TABLE t1 (c VARCHAR(1024),
+c1 CHAR(255) NOT NULL,c2 CHAR(255) NOT NULL,c3 CHAR(255) NOT NULL,
+c4 CHAR(255) NOT NULL,c5 CHAR(255) NOT NULL,c6 CHAR(255) NOT NULL,
+c7 CHAR(255) NOT NULL,c8 CHAR(255) NOT NULL,c9 CHAR(255) NOT NULL,
+ca CHAR(255) NOT NULL,cb CHAR(255) NOT NULL,cc CHAR(255) NOT NULL,
+cd CHAR(255) NOT NULL,ce CHAR(255) NOT NULL,cf CHAR(255) NOT NULL,
+d0 CHAR(255) NOT NULL,d1 CHAR(255) NOT NULL,d2 CHAR(255) NOT NULL,
+d3 CHAR(255) NOT NULL,d4 CHAR(255) NOT NULL,d5 CHAR(255) NOT NULL,
+d6 CHAR(255) NOT NULL,d7 CHAR(255) NOT NULL,d8 CHAR(255) NOT NULL,
+d9 CHAR(255) NOT NULL,da CHAR(255) NOT NULL,db CHAR(255) NOT NULL,
+dc CHAR(255) NOT NULL,dd CHAR(255) NOT NULL,de CHAR(255) NOT NULL,
+UNIQUE KEY(c))
+ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(repeat('a',999),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''),
+(CONCAT(repeat('a',999),'b'),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=inplace;
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=copy;
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
#
# Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
#
@@ -1540,6 +1571,7 @@ create table t1(f1 int not null, f2 int not null,
primary key (f1), unique key(f1, f2))engine=innodb;
insert into t1 values(1,3), (2,2);
alter table t1 drop primary key, lock=none;
+alter table t1 drop index f1, lock=none;
ERROR 0A000: LOCK=NONE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try LOCK=SHARED
drop table t1;
#
@@ -1865,3 +1897,19 @@ f1
SELECT * FROM t2;
f1
DROP TABLE t1, t2;
+#
+# MDEV-18186 assertion failure on missing InnoDB index
+#
+CREATE TABLE t (a INT, INDEX i1 (a)) ENGINE=INNODB;
+DROP TABLE t;
+CREATE TABLE t (a INT) ENGINE=INNODB;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i1` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+Warnings:
+Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
+Warning 1082 InnoDB: Table test/t contains 0 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
index 34cc62f0a55..0f467c649db 100644
--- a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
+++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
@@ -42,7 +42,7 @@ drop table t1;
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
-ERROR 22007: Incorrect LINESTRING value: 'POINT' for column 'b' at row 1
+ERROR 22007: Incorrect LINESTRING value: 'POINT' for column ``.``.`b` at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
a int(11) YES NULL
diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result
index 5b5c4d6b9e1..363ca07e1bc 100644
--- a/mysql-test/suite/innodb/r/innodb-table-online.result
+++ b/mysql-test/suite/innodb/r/innodb-table-online.result
@@ -99,17 +99,6 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `c2` (`c2`),
UNIQUE KEY `c2_2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPY
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c1` int(11) NOT NULL,
- `c2` int(11) NOT NULL,
- `c3` char(255) NOT NULL,
- UNIQUE KEY `c2` (`c2`),
- UNIQUE KEY `c2_2` (`c2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1);
# session default
connection default;
@@ -212,6 +201,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL ROWS Using where
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET @merge_encrypt_0=
(SELECT variable_value FROM information_schema.global_status
diff --git a/mysql-test/suite/innodb/r/innodb-update-insert.result b/mysql-test/suite/innodb/r/innodb-update-insert.result
index 6265adb6e21..b50c35578d9 100644
--- a/mysql-test/suite/innodb/r/innodb-update-insert.result
+++ b/mysql-test/suite/innodb/r/innodb-update-insert.result
@@ -28,7 +28,7 @@ charset=utf8 engine=innodb;
set statement sql_mode = '' for
replace into t1 set f1=0xa3;
Warnings:
-Warning 1366 Incorrect string value: '\xA3' for column 'f1' at row 1
+Warning 1366 Incorrect string value: '\xA3' for column `test`.`t1`.`f1` at row 1
select f1 from t1;
f1
?
@@ -37,7 +37,7 @@ update t1 set f3=repeat(0xb1,8103);
update t1 set f1=0x4a;
update ignore t1 set f1=0x82;
Warnings:
-Warning 1366 Incorrect string value: '\x82' for column 'f1' at row 1
+Warning 1366 Incorrect string value: '\x82' for column `test`.`t1`.`f1` at row 1
select f1 from t1;
f1
?
diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
index 6fbb7dcc58f..bf21e352681 100644
--- a/mysql-test/suite/innodb/r/innodb-virtual-columns.result
+++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
@@ -330,3 +330,16 @@ term uw_id plan wdraw_rsn admit_term
1035 2 CSM ACAD 1009
drop table grad_degree;
drop table gso_grad_supr;
+CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES (1,'foo');
+SELECT * FROM t1;
+a b c
+1 foo 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES (1,'foo');
+ALTER TABLE t1 ADD FULLTEXT KEY(b);
+SELECT * FROM t1;
+a b c
+1 foo 1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
index ec3856c20b8..ed7477fa033 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
@@ -479,12 +479,6 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
-SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Index for table 't1' is corrupt; try to repair it
-SET SESSION debug_dbug=@saved_debug_dbug;
-unlink: t1.ibd
-unlink: t1.cfg
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index cb82d292d7e..100845a081b 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -217,6 +217,7 @@ create index skr on t1 (a);
insert into t1 values (3,""), (4,"testing");
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -3236,7 +3237,7 @@ select f1 from t1;
f1
show status like "handler_read_key";
Variable_name Value
-Handler_read_key 0
+Handler_read_key 3
drop table t1;
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/r/innodb_28867993.result b/mysql-test/suite/innodb/r/innodb_28867993.result
new file mode 100644
index 00000000000..acc6734eaee
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_28867993.result
@@ -0,0 +1,9 @@
+create table t1 (a int) engine=innodb;
+insert t1 values (1),(2);
+create database ib_logfile2;
+select * from t1;
+a
+1
+2
+drop table t1;
+drop database ib_logfile2;
diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result
index d1e21c92d95..f8f0b3fbccb 100644
--- a/mysql-test/suite/innodb/r/innodb_bug14676111.result
+++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result
@@ -16,6 +16,7 @@ insert into t1 values (2);
connection default;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
@@ -26,6 +27,7 @@ disconnect con4;
connection default;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
@@ -36,6 +38,7 @@ disconnect con5;
connection default;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
@@ -47,6 +50,7 @@ disconnect con2;
connection default;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
@@ -56,6 +60,7 @@ insert into t1 values (2);
rollback;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
@@ -65,6 +70,7 @@ insert into t1 values (2);
rollback;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
CLUST_INDEX_SIZE
diff --git a/mysql-test/suite/innodb/r/innodb_bug30423.result b/mysql-test/suite/innodb/r/innodb_bug30423.result
index c7f823a06ae..786041370ef 100644
--- a/mysql-test/suite/innodb/r/innodb_bug30423.result
+++ b/mysql-test/suite/innodb/r/innodb_bug30423.result
@@ -19,12 +19,15 @@ select @@innodb_stats_method;
nulls_equal
analyze table bug30243_1;
Table Op Msg_type Msg_text
+test.bug30243_1 analyze status Engine-independent statistics collected
test.bug30243_1 analyze status OK
analyze table bug30243_2;
Table Op Msg_type Msg_text
+test.bug30243_2 analyze status Engine-independent statistics collected
test.bug30243_2 analyze status OK
analyze table bug30243_3;
Table Op Msg_type Msg_text
+test.bug30243_3 analyze status Engine-independent statistics collected
test.bug30243_3 analyze status OK
set global innodb_stats_method = "NULL";
ERROR 42000: Variable 'innodb_stats_method' can't be set to the value of 'NULL'
@@ -34,12 +37,15 @@ select @@innodb_stats_method;
nulls_ignored
analyze table bug30243_1;
Table Op Msg_type Msg_text
+test.bug30243_1 analyze status Engine-independent statistics collected
test.bug30243_1 analyze status OK
analyze table bug30243_2;
Table Op Msg_type Msg_text
+test.bug30243_2 analyze status Engine-independent statistics collected
test.bug30243_2 analyze status OK
analyze table bug30243_3;
Table Op Msg_type Msg_text
+test.bug30243_3 analyze status Engine-independent statistics collected
test.bug30243_3 analyze status OK
explain SELECT COUNT(*), 0
FROM bug30243_1 orgs
@@ -60,12 +66,15 @@ select @@innodb_stats_method;
nulls_unequal
analyze table bug30243_1;
Table Op Msg_type Msg_text
+test.bug30243_1 analyze status Engine-independent statistics collected
test.bug30243_1 analyze status OK
analyze table bug30243_2;
Table Op Msg_type Msg_text
+test.bug30243_2 analyze status Engine-independent statistics collected
test.bug30243_2 analyze status OK
analyze table bug30243_3;
Table Op Msg_type Msg_text
+test.bug30243_3 analyze status Engine-independent statistics collected
test.bug30243_3 analyze status OK
explain SELECT COUNT(*), 0
FROM bug30243_1 orgs
@@ -83,10 +92,12 @@ COUNT(*)
set global innodb_stats_method = "nulls_unequal";
analyze table table_bug30423;
Table Op Msg_type Msg_text
+test.table_bug30423 analyze status Engine-independent statistics collected
test.table_bug30423 analyze status OK
set global innodb_stats_method = "nulls_ignored";
analyze table table_bug30423;
Table Op Msg_type Msg_text
+test.table_bug30423 analyze status Engine-independent statistics collected
test.table_bug30423 analyze status OK
set global innodb_stats_method = nulls_equal;
drop table bug30243_2;
diff --git a/mysql-test/suite/innodb/r/innodb_bug53046.result b/mysql-test/suite/innodb/r/innodb_bug53046.result
index 69be6c4e0a7..0321d5ace19 100644
--- a/mysql-test/suite/innodb/r/innodb_bug53046.result
+++ b/mysql-test/suite/innodb/r/innodb_bug53046.result
@@ -16,6 +16,7 @@ FROM bug53046_1;
INSERT INTO bug53046_2 VALUES (1), (2);
ANALYZE TABLE bug53046_1;
Table Op Msg_type Msg_text
+test.bug53046_1 analyze status Engine-independent statistics collected
test.bug53046_1 analyze status OK
SHOW TABLE STATUS LIKE 'bug53046_1';
UPDATE bug53046_1 SET c1 = c1 - 1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug57252.result b/mysql-test/suite/innodb/r/innodb_bug57252.result
index efa50c742e0..2e371cb74ee 100644
--- a/mysql-test/suite/innodb/r/innodb_bug57252.result
+++ b/mysql-test/suite/innodb/r/innodb_bug57252.result
@@ -1,6 +1,7 @@
cardinality
10
Table Op Msg_type Msg_text
+test.bug57252 analyze status Engine-independent statistics collected
test.bug57252 analyze status OK
cardinality
10
diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
index 117b7e4418e..c20c981653c 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
@@ -325,6 +325,8 @@ LENGTH(col)
FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
+test.t analyze Warning Engine-independent statistics are not collected for column 'col'
test.t analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
@@ -345,6 +347,8 @@ LENGTH(col)
FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
+test.t analyze Warning Engine-independent statistics are not collected for column 'col'
test.t analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
@@ -365,6 +369,8 @@ LENGTH(col)
FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
+test.t analyze Warning Engine-independent statistics are not collected for column 'col'
test.t analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
index de957023ff8..a74e7826729 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
@@ -528,6 +528,8 @@ LENGTH(col)
FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
+test.t analyze Warning Engine-independent statistics are not collected for column 'col'
test.t analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
@@ -548,6 +550,8 @@ LENGTH(col)
FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
+test.t analyze Warning Engine-independent statistics are not collected for column 'col'
test.t analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
@@ -568,6 +572,8 @@ LENGTH(col)
FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
+test.t analyze Warning Engine-independent statistics are not collected for column 'col'
test.t analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index b4e0f090e5d..f1573d46a6f 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -191,8 +191,8 @@ min(7)
7
explain select min(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2i ALL NULL NULL NULL NULL 1
-1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
+1 SIMPLE t1i ALL NULL NULL NULL NULL 0
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
select min(7) from t2i join t1i;
min(7)
NULL
@@ -207,8 +207,8 @@ max(7)
7
explain select max(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2i ALL NULL NULL NULL NULL 1
-1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
+1 SIMPLE t1i ALL NULL NULL NULL NULL 0
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
select max(7) from t2i join t1i;
max(7)
NULL
@@ -239,7 +239,7 @@ select 1, max(1) from t1i where 1=99;
explain select count(*), min(7), max(7) from t1m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found
-1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 0
select count(*), min(7), max(7) from t1m, t1i;
count(*) min(7) max(7)
0 NULL NULL
@@ -253,7 +253,7 @@ count(*) min(7) max(7)
explain select count(*), min(7), max(7) from t2m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2m system NULL NULL NULL NULL 1
-1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 0
select count(*), min(7), max(7) from t2m, t1i;
count(*) min(7) max(7)
0 NULL NULL
@@ -303,6 +303,7 @@ create index idx12672_1 on t4 (a1,a2,b,c);
create index idx12672_2 on t4 (a1,a2,b);
analyze table t4;
Table Op Msg_type Msg_text
+test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
select distinct a1 from t4 where pk_col not in (1,2,3,4);
a1
@@ -2699,6 +2700,7 @@ INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1;
INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
c1 c2 c3
@@ -2851,6 +2853,7 @@ INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3),
(11,11,11,11,11,11);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT COUNT(*) FROM t1;
id 1
diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
index 2e9f0f0ee21..a90cd22f57a 100644
--- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
+++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
@@ -182,7 +182,6 @@ trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N
trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions committed with inserts and updates
trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back
trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back to savepoint
-trx_rollback_active transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of resurrected active transactions rolled back
trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of active transactions
trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Length of the TRX_RSEG_HISTORY list
trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots used
diff --git a/mysql-test/suite/innodb/r/innodb_stats.result b/mysql-test/suite/innodb/r/innodb_stats.result
index d2c3bd0127e..eadce75318b 100644
--- a/mysql-test/suite/innodb/r/innodb_stats.result
+++ b/mysql-test/suite/innodb/r/innodb_stats.result
@@ -4,6 +4,7 @@ dummy INSERT, the table should be empty
dummy INSERT, the table should be empty
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -56,6 +57,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -108,6 +110,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (1);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -160,6 +163,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -212,6 +216,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1), (1), (1), (1), (1), (1), (1), (1);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -264,6 +269,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (2);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -316,6 +322,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -368,6 +375,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -420,6 +428,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2), (3), (3);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
@@ -472,6 +481,7 @@ TRUNCATE TABLE test_innodb_stats;
INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3), (4), (5), (1), (2), (3), (4), (5);
ANALYZE TABLE test_innodb_stats;
Table Op Msg_type Msg_text
+test.test_innodb_stats analyze status Engine-independent statistics collected
test.test_innodb_stats analyze status OK
SELECT
stat_name,
diff --git a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
index b8f312ccd63..fc0a590934a 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
@@ -1,4 +1,5 @@
Table Op Msg_type Msg_text
+test.innodb_stats_drop_locked analyze status Engine-independent statistics collected
test.innodb_stats_drop_locked analyze status OK
SET autocommit=0;
SELECT table_name FROM mysql.innodb_table_stats
diff --git a/mysql-test/suite/innodb/r/innodb_stats_fetch.result b/mysql-test/suite/innodb/r/innodb_stats_fetch.result
index b348e41f1d9..67437c46cd3 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_fetch.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_fetch.result
@@ -5,6 +5,10 @@ ANALYZE TABLE test_ps_fetch;
Table test.test_ps_fetch
Op analyze
Msg_type status
+Msg_text Engine-independent statistics collected
+Table test.test_ps_fetch
+Op analyze
+Msg_type status
Msg_text OK
SELECT n_rows, clustered_index_size, sum_of_other_index_sizes
FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch';
diff --git a/mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result b/mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result
index 0f0e941b838..c232a841376 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_fetch_corrupted.result
@@ -7,6 +7,10 @@ ANALYZE TABLE test_ps_fetch_corrupted;
Table test.test_ps_fetch_corrupted
Op analyze
Msg_type status
+Msg_text Engine-independent statistics collected
+Table test.test_ps_fetch_corrupted
+Op analyze
+Msg_type status
Msg_text OK
SELECT n_rows, clustered_index_size, sum_of_other_index_sizes
FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_corrupted';
diff --git a/mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result b/mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result
index 6093fbae86b..91bb2bf3ecd 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_fetch_nonexistent.result
@@ -6,6 +6,10 @@ ANALYZE TABLE test_ps_fetch_nonexistent;
Table test.test_ps_fetch_nonexistent
Op analyze
Msg_type status
+Msg_text Engine-independent statistics collected
+Table test.test_ps_fetch_nonexistent
+Op analyze
+Msg_type status
Msg_text OK
SELECT COUNT(*)
FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_nonexistent';
diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent.result b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
index f4de4b6b82e..44cb3a81372 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_persistent.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
@@ -19,6 +19,7 @@ COUNT(*)
16
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
connect con1, localhost, root,,;
START TRANSACTION;
@@ -100,7 +101,7 @@ COUNT(*)
# ha_innobase::records_in_range() would count the delete-marked records.
EXPLAIN SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL val 4 NULL 1 Using index
+1 SIMPLE t1 index NULL val 4 NULL 16 Using index
ROLLBACK;
EXPLAIN SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result b/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result
index 9f93f05fd56..ee1ad318d65 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result
@@ -17,6 +17,7 @@ SET GLOBAL innodb_limit_optimistic_insert_debug = @save_debug;
connect con1, localhost, root,,;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
disconnect con1;
connection default;
diff --git a/mysql-test/suite/innodb/r/innodb_zip_innochecksum.result b/mysql-test/suite/innodb/r/innodb_zip_innochecksum.result
deleted file mode 100644
index 31d9450df80..00000000000
--- a/mysql-test/suite/innodb/r/innodb_zip_innochecksum.result
+++ /dev/null
@@ -1,91 +0,0 @@
-# Set the environmental variables
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
-CREATE INDEX idx1 ON tab1(c2(10));
-INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-insert into t1 values(1,"i");
-insert into t1 values(2,"am");
-insert into t1 values(3,"compressed table");
-# Shutdown the Server
-# Server Default checksum = innodb
-[1b]: check the innochecksum without --strict-check
-[2]: check the innochecksum with full form --strict-check=crc32
-[3]: check the innochecksum with short form -C crc32
-[4]: check the innochecksum with --no-check ignores algorithm check, warning is expected
-FOUND 1 /Error: --no-check must be associated with --write option./ in my_restart.err
-[5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected
-FOUND 1 /Error: --no-check must be associated with --write option./ in my_restart.err
-[6]: check the innochecksum with full form strict-check & no-check , an error is expected
-FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
-[7]: check the innochecksum with short form strict-check & no-check , an error is expected
-FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
-[8]: check the innochecksum with short & full form combination
-# strict-check & no-check, an error is expected
-FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
-[9]: check the innochecksum with full form --strict-check=innodb
-[10]: check the innochecksum with full form --strict-check=none
-# when server Default checksum=crc32
-[11]: check the innochecksum with short form -C innodb
-# when server Default checksum=crc32
-[12]: check the innochecksum with short form -C none
-# when server Default checksum=crc32
-[13]: check strict-check with invalid values
-FOUND 1 /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'crc\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'no\' to \'strict-check\'/ in my_restart.err
-[14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
-# Also check the long form of write option.
-[14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
-# Also check the long form of write option.
-# start the server with innodb_checksum_algorithm=InnoDB
-INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-# Stop the server
-[15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
-# Also check the short form of write option.
-# Start the server with checksum algorithm=none
-INSERT INTO tab1 VALUES(3, 'Innochecksum None');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-3 Innochecksum None
-DROP TABLE t1;
-# Stop the server
-[16]: rewrite into new checksum=crc32 with innochecksum
-# Restart the DB server with innodb_checksum_algorithm=crc32
-SELECT * FROM tab1;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-3 Innochecksum None
-DELETE FROM tab1 where c1=3;
-SELECT c1,c2 FROM tab1 order by c1,c2;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-# Stop server
-[17]: rewrite into new checksum=InnoDB
-# Restart the DB server with innodb_checksum_algorithm=InnoDB
-DELETE FROM tab1 where c1=2;
-SELECT * FROM tab1;
-c1 c2
-1 Innochecksum InnoDB1
-# Stop server
-[18]:check Innochecksum with invalid write options
-FOUND 1 /Error while setting value \'strict_crc32\' to \'write\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_innodb\' to \'write\'/ in my_restart.err
-FOUND 1 /Error while setting value \'crc23\' to \'write\'/ in my_restart.err
-DROP TABLE tab1;
diff --git a/mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result b/mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result
deleted file mode 100644
index 582bb42f0cb..00000000000
--- a/mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result
+++ /dev/null
@@ -1,160 +0,0 @@
-SET GLOBAL innodb_compression_level=0;
-SELECT @@innodb_compression_level;
-@@innodb_compression_level
-0
-CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-# stop the server
-
-Variables (--variable-name=value)
-and boolean options {FALSE|TRUE} Value (after reading options)
---------------------------------- ----------------------------------------
-verbose TRUE
-debug FALSE
-count FALSE
-start-page 0
-end-page 0
-page 0
-strict-check crc32
-no-check FALSE
-allow-mismatches 0
-write crc32
-page-type-summary FALSE
-page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
-per-page-details FALSE
-log (No default value)
-leaf FALSE
-merge 0
-[1]:# check the both short and long options for "help"
-[2]:# Run the innochecksum when file isn't provided.
-# It will print the innochecksum usage similar to --help option.
-innochecksum Ver #.#.#
-Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
-
-InnoDB offline file checksum utility.
-Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-l] [-m <merge pages>] <filename or [-]>
- -?, --help Displays this help and exits.
- -I, --info Synonym for --help.
- -V, --version Displays version information and exits.
- -v, --verbose Verbose (prints progress every 5 seconds).
- -c, --count Print the count of pages in the file and exits.
- -s, --start-page=# Start on this page number (0 based).
- -e, --end-page=# End at this page number (0 based).
- -p, --page=# Check only this page (0 based).
- -C, --strict-check=name
- Specify the strict checksum algorithm by the user.. One
- of: crc32, crc32, innodb, innodb, none, none
- -n, --no-check Ignore the checksum verification.
- -a, --allow-mismatches=#
- Maximum checksum mismatch allowed.
- -w, --write=name Rewrite the checksum algorithm by the user.. One of:
- crc32, crc32, innodb, innodb, none, none
- -S, --page-type-summary
- Display a count of each page type in a tablespace.
- -D, --page-type-dump=name
- Dump the page type info for each page in a tablespace.
- -i, --per-page-details
- Print out per-page detail information.
- -l, --log=name log output.
- -f, --leaf Examine leaf index pages
- -m, --merge=# leaf page count if merge given number of consecutive
- pages
-
-Variables (--variable-name=value)
-and boolean options {FALSE|TRUE} Value (after reading options)
---------------------------------- ----------------------------------------
-verbose FALSE
-count FALSE
-start-page 0
-end-page 0
-page 0
-strict-check crc32
-no-check FALSE
-allow-mismatches 0
-write crc32
-page-type-summary FALSE
-page-type-dump (No default value)
-per-page-details FALSE
-log (No default value)
-leaf FALSE
-merge 0
-[3]:# check the both short and long options for "count" and exit
-Number of pages:#
-Number of pages:#
-[4]:# Print the version of innochecksum and exit
-innochecksum Ver #.#.## Restart the DB server
-DROP TABLE t1;
-[5]:# Check the innochecksum for compressed table t1 with different key_block_size
-# Test for KEY_BLOCK_SIZE=1
-===> Testing size=1
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-# Test for KEY_BLOCK_SIZE=2
-===> Testing size=2
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-# Test for for KEY_BLOCK_SIZE=4
-===> Testing size=4
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-set innodb_strict_mode=off;
-# Test for for KEY_BLOCK_SIZE=8
-===> Testing size=8
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-set innodb_strict_mode=off;
-# Test for KEY_BLOCK_SIZE=16
-===> Testing size=16
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-# Test[5] completed
diff --git a/mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result b/mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result
deleted file mode 100644
index aaab68b3df9..00000000000
--- a/mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result
+++ /dev/null
@@ -1,227 +0,0 @@
-# Set the environmental variables
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to.*");
-[1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server.
-CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY,
-linestring_key GEOMETRY NOT NULL,
-linestring_nokey GEOMETRY NOT NULL)
-ENGINE=InnoDB ;
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (1, ST_GeomFromText('POINT(10 10) '), ST_GeomFromText('POINT(10 10) '));
-CREATE INDEX linestring_index ON tab1(linestring_nokey(5));
-ALTER TABLE tab1 ADD KEY (linestring_key(5));
-# create a compressed table
-CREATE TABLE tab2(col_1 CHAR (255) ,
-col_2 VARCHAR (255), col_3 longtext,
-col_4 longtext,col_5 longtext,
-col_6 longtext , col_7 int )
-engine = innodb row_format=compressed key_block_size=4;
-CREATE INDEX idx1 ON tab2(col_3(10));
-CREATE INDEX idx2 ON tab2(col_4(10));
-CREATE INDEX idx3 ON tab2(col_5(10));
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,5);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,4);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,3);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,2);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,1);
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[1(a)]: Rewrite into new checksum=InnoDB for all *.ibd file and ibdata1
-: start the server with innodb_checksum_algorithm=strict_innodb
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (2, ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'), ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'));
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,6);
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[1(b)]: Rewrite into new checksum=crc32 for all *.ibd file and ibdata1
-# start the server with innodb_checksum_algorithm=strict_crc32
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (3, ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'),
-ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'));
-SET @col_1 = repeat('g', 5);
-SET @col_2 = repeat('h', 20);
-SET @col_3 = repeat('i', 100);
-SET @col_4 = repeat('j', 100);
-SET @col_5 = repeat('k', 100);
-SET @col_6 = repeat('l', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,7);
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[1(c)]: Rewrite into new checksum=none for all *.ibd file and ibdata1
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (4, ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '), ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '));
-SET @col_1 = repeat('m', 5);
-SET @col_2 = repeat('n', 20);
-SET @col_3 = repeat('o', 100);
-SET @col_4 = repeat('p', 100);
-SET @col_5 = repeat('q', 100);
-SET @col_6 = repeat('r', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,8);
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[2]: Check the page type summary with shortform for tab1.ibd
-
-File::tab#.ibd
-================PAGE TYPE SUMMARY==============
-#PAGE_COUNT PAGE_TYPE
-===============================================
- # Index page
- # Undo log page
- # Inode page
- # Insert buffer free list page
- # Freshly allocated page
- # Insert buffer bitmap
- # System page
- # Transaction system page
- # File Space Header
- # Extent descriptor page
- # BLOB page
- # Compressed BLOB page
- # Page compressed page
- # Page compressed encrypted page
- # Other type of page
-
-===============================================
-Additional information:
-Undo page type: # insert, # update, # other
-Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
-index_id #pages #leaf_pages #recs_per_page #bytes_per_page
-# # # # #
-# # # # #
-# # # # #
-
-index_id page_data_bytes_histgram(empty,...,oversized)
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-[3]: Check the page type summary with longform for tab1.ibd
-
-File::tab#.ibd
-================PAGE TYPE SUMMARY==============
-#PAGE_COUNT PAGE_TYPE
-===============================================
- # Index page
- # Undo log page
- # Inode page
- # Insert buffer free list page
- # Freshly allocated page
- # Insert buffer bitmap
- # System page
- # Transaction system page
- # File Space Header
- # Extent descriptor page
- # BLOB page
- # Compressed BLOB page
- # Page compressed page
- # Page compressed encrypted page
- # Other type of page
-
-===============================================
-Additional information:
-Undo page type: # insert, # update, # other
-Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
-index_id #pages #leaf_pages #recs_per_page #bytes_per_page
-# # # # #
-# # # # #
-# # # # #
-
-index_id page_data_bytes_histgram(empty,...,oversized)
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-[4]: Page type dump for with longform for tab1.ibd
-# Print the contents stored in dump.txt
-
-
-Filename::tab#.ibd
-==============================================================================
- PAGE_NO | PAGE_TYPE | EXTRA INFO
-==============================================================================
-#::# | File Space Header | -
-#::# | Insert Buffer Bitmap | -
-#::# | Inode page | -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Freshly allocated page | -
-# Variables used by page type dump for ibdata1
-
-Variables (--variable-name=value)
-and boolean options {FALSE|TRUE} Value (after reading options)
---------------------------------- ----------------------------------------
-verbose TRUE
-count FALSE
-start-page 0
-end-page 0
-page 0
-strict-check crc32
-no-check FALSE
-allow-mismatches 0
-write crc32
-page-type-summary FALSE
-page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
-per-page-details FALSE
-log (No default value)
-leaf FALSE
-merge 0
-[5]: Page type dump for with shortform for tab1.ibd
-
-
-Filename::tab#.ibd
-==============================================================================
- PAGE_NO | PAGE_TYPE | EXTRA INFO
-==============================================================================
-#::# | File Space Header | -
-#::# | Insert Buffer Bitmap | -
-#::# | Inode page | -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Freshly allocated page | -
-[6]: check the valid lower bound values for option
-# allow-mismatches,page,start-page,end-page
-[9]: check the both short and long options "page" and "start-page" when
-# seek value is larger than file size.
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-[34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page.
-# innochecksum will fail with error code: 1
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-DROP TABLE tab1,tab2;
diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result
index 5f89b31c142..f864221def5 100644
--- a/mysql-test/suite/innodb/r/instant_alter.result
+++ b/mysql-test/suite/innodb/r/instant_alter.result
@@ -236,6 +236,7 @@ UPDATE t2 SET c1 = repeat(id, 4000);
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -246,6 +247,7 @@ ROLLBACK;
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -257,6 +259,7 @@ UPDATE t2 SET d1 = repeat(id, 200);
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -267,6 +270,7 @@ ROLLBACK;
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -386,6 +390,7 @@ COMMIT;
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -409,6 +414,7 @@ test.big 385477733
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -422,6 +428,7 @@ test.big 1705165209
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -523,6 +530,210 @@ SELECT * FROM t1;
i t
1 NULL
DROP TABLE t1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT, b INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 SET a=NULL;
+ALTER TABLE t1 DROP COLUMN b;
+ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 42;
+INSERT INTO t1 SET a=NULL;
+UPDATE t1 SET a=a+2;
+SELECT * FROM t1;
+a c
+3 42
+4 42
+DROP TABLE t1;
+CREATE TABLE t1 (i INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 SET i=1;
+ALTER TABLE t1 ADD COLUMN b BIT FIRST;
+ALTER TABLE t1 ADD COLUMN v INT AS (i) VIRTUAL;
+SELECT * FROM t1;
+b i v
+NULL 1 1
+DROP TABLE t1;
+CREATE TABLE t1 (ts TIMESTAMP) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 ADD COLUMN f VARCHAR(8), ADD COLUMN dt DATETIME;
+ALTER TABLE t1 ADD COLUMN b BIT, DROP COLUMN f, ADD COLUMN t TIME FIRST;
+ALTER TABLE t1 ADD COLUMN ts2 TIMESTAMP;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES (4,4,4);
+ALTER TABLE t1 DROP f1, DROP f2, ADD f4 INT, ADD f5 INT;
+DELETE FROM t1;
+ALTER TABLE t1 DROP COLUMN f4;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 DROP f2, ADD COLUMN f4 INT;
+ALTER TABLE t1 DROP f4;
+ALTER TABLE t1 DROP f1;
+DROP TABLE t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 () VALUES (),();
+SELECT * FROM t1;
+f
+NULL
+NULL
+ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id);
+SELECT * FROM t1;
+id f
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 SET f=NULL;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 SET f=NULL;
+SELECT * FROM t1;
+f
+NULL
+NULL
+DROP TABLE t1;
+CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1(pk INT PRIMARY KEY, f INT, k INT AUTO_INCREMENT, KEY(k))
+ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 (pk) VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+f1 INT,
+f2 CHAR(255),
+f3 BIGINT,
+f4 INT,
+f5 CHAR(255),
+f6 CHAR(255),
+f7 CHAR(255) NOT NULL,
+f8 INT,
+f9 CHAR(10)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES
+(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
+(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
+(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
+(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
+(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
+(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
+(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
+(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
+(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
+(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
+(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
+(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
+(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
+(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
+(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
+DELETE FROM t1 WHERE pk=1;
+InnoDB 0 transactions not purged
+INSERT INTO t1 VALUES
+(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
+ALTER TABLE t1 DROP COLUMN f1;
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+f1 INT, f2 CHAR(32) NOT NULL,
+f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL,
+f7 CHAR(32), f8 CHAR(32)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES
+(1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''),
+(3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''),
+(5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''),
+(7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''),
+(9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''),
+(11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''),
+(13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''),
+(15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''),
+(17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''),
+(19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''),
+(21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''),
+(23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''),
+(25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''),
+(51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''),
+(53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''),
+(55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''),
+(57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''),
+(59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''),
+(61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''),
+(63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''),
+(101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''),
+(103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''),
+(105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''),
+(107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''),
+(109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''),
+(151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''),
+(153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''),
+(155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''),
+(157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''),
+(159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''),
+(201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''),
+(203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''),
+(205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''),
+(207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''),
+(252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''),
+(254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''),
+(256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''),
+(258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''),
+(301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''),
+(303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''),
+(305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''),
+(307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''),
+(351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''),
+(353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''),
+(355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''),
+(357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''),
+(359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''),
+(361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''),
+(363,75,'',66,76,52,'','','');
+ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar ';
+UPDATE t1 SET f1 = 0;
+ALTER TABLE t1 DROP COLUMN x;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNIQUE, b INT UNIQUE, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 CHANGE COLUMN a a INT;
+DELETE FROM t1 WHERE a = NULL OR a IS NULL;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT,
+e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ADD COLUMN b INT;
+ALTER TABLE t1 MODIFY COLUMN a INT NULL;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, b BLOB NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES (1,10,REPEAT('foobar',2000));
+ALTER TABLE t1 DROP COLUMN b;
+INSERT INTO t1 VALUES (2,20);
+ALTER TABLE t1 ADD COLUMN vpk INT AS (pk);
+ALTER TABLE t1 DROP COLUMN i;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD f DATE AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD COLUMN f INT AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
@@ -705,6 +916,7 @@ UPDATE t2 SET c1 = repeat(id, 4000);
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -715,6 +927,7 @@ ROLLBACK;
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -726,6 +939,7 @@ UPDATE t2 SET d1 = repeat(id, 200);
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -736,6 +950,7 @@ ROLLBACK;
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -855,6 +1070,7 @@ COMMIT;
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -878,6 +1094,7 @@ test.big 385477733
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -891,6 +1108,7 @@ test.big 1705165209
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -992,6 +1210,210 @@ SELECT * FROM t1;
i t
1 NULL
DROP TABLE t1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT, b INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 SET a=NULL;
+ALTER TABLE t1 DROP COLUMN b;
+ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 42;
+INSERT INTO t1 SET a=NULL;
+UPDATE t1 SET a=a+2;
+SELECT * FROM t1;
+a c
+3 42
+4 42
+DROP TABLE t1;
+CREATE TABLE t1 (i INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 SET i=1;
+ALTER TABLE t1 ADD COLUMN b BIT FIRST;
+ALTER TABLE t1 ADD COLUMN v INT AS (i) VIRTUAL;
+SELECT * FROM t1;
+b i v
+NULL 1 1
+DROP TABLE t1;
+CREATE TABLE t1 (ts TIMESTAMP) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD COLUMN f VARCHAR(8), ADD COLUMN dt DATETIME;
+ALTER TABLE t1 ADD COLUMN b BIT, DROP COLUMN f, ADD COLUMN t TIME FIRST;
+ALTER TABLE t1 ADD COLUMN ts2 TIMESTAMP;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (4,4,4);
+ALTER TABLE t1 DROP f1, DROP f2, ADD f4 INT, ADD f5 INT;
+DELETE FROM t1;
+ALTER TABLE t1 DROP COLUMN f4;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 DROP f2, ADD COLUMN f4 INT;
+ALTER TABLE t1 DROP f4;
+ALTER TABLE t1 DROP f1;
+DROP TABLE t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 () VALUES (),();
+SELECT * FROM t1;
+f
+NULL
+NULL
+ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id);
+SELECT * FROM t1;
+id f
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 SET f=NULL;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 SET f=NULL;
+SELECT * FROM t1;
+f
+NULL
+NULL
+DROP TABLE t1;
+CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1(pk INT PRIMARY KEY, f INT, k INT AUTO_INCREMENT, KEY(k))
+ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 (pk) VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+f1 INT,
+f2 CHAR(255),
+f3 BIGINT,
+f4 INT,
+f5 CHAR(255),
+f6 CHAR(255),
+f7 CHAR(255) NOT NULL,
+f8 INT,
+f9 CHAR(10)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
+(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
+(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
+(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
+(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
+(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
+(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
+(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
+(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
+(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
+(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
+(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
+(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
+(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
+(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
+DELETE FROM t1 WHERE pk=1;
+InnoDB 0 transactions not purged
+INSERT INTO t1 VALUES
+(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
+ALTER TABLE t1 DROP COLUMN f1;
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+f1 INT, f2 CHAR(32) NOT NULL,
+f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL,
+f7 CHAR(32), f8 CHAR(32)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''),
+(3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''),
+(5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''),
+(7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''),
+(9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''),
+(11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''),
+(13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''),
+(15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''),
+(17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''),
+(19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''),
+(21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''),
+(23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''),
+(25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''),
+(51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''),
+(53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''),
+(55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''),
+(57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''),
+(59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''),
+(61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''),
+(63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''),
+(101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''),
+(103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''),
+(105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''),
+(107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''),
+(109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''),
+(151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''),
+(153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''),
+(155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''),
+(157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''),
+(159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''),
+(201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''),
+(203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''),
+(205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''),
+(207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''),
+(252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''),
+(254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''),
+(256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''),
+(258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''),
+(301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''),
+(303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''),
+(305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''),
+(307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''),
+(351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''),
+(353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''),
+(355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''),
+(357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''),
+(359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''),
+(361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''),
+(363,75,'',66,76,52,'','','');
+ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar ';
+UPDATE t1 SET f1 = 0;
+ALTER TABLE t1 DROP COLUMN x;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNIQUE, b INT UNIQUE, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 CHANGE COLUMN a a INT;
+DELETE FROM t1 WHERE a = NULL OR a IS NULL;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT,
+e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ADD COLUMN b INT;
+ALTER TABLE t1 MODIFY COLUMN a INT NULL;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, b BLOB NOT NULL) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (1,10,REPEAT('foobar',2000));
+ALTER TABLE t1 DROP COLUMN b;
+INSERT INTO t1 VALUES (2,20);
+ALTER TABLE t1 ADD COLUMN vpk INT AS (pk);
+ALTER TABLE t1 DROP COLUMN i;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD f DATE AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD COLUMN f INT AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
@@ -1174,6 +1596,7 @@ UPDATE t2 SET c1 = repeat(id, 4000);
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -1184,6 +1607,7 @@ ROLLBACK;
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -1195,6 +1619,7 @@ UPDATE t2 SET d1 = repeat(id, 200);
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -1205,6 +1630,7 @@ ROLLBACK;
connection analyze;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t2';
@@ -1324,6 +1750,7 @@ COMMIT;
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -1347,6 +1774,7 @@ test.big 385477733
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -1360,6 +1788,7 @@ test.big 1705165209
connection analyze;
ANALYZE TABLE big;
Table Op Msg_type Msg_text
+test.big analyze status Engine-independent statistics collected
test.big analyze status OK
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
@@ -1461,10 +1890,214 @@ SELECT * FROM t1;
i t
1 NULL
DROP TABLE t1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT, b INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 SET a=NULL;
+ALTER TABLE t1 DROP COLUMN b;
+ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 42;
+INSERT INTO t1 SET a=NULL;
+UPDATE t1 SET a=a+2;
+SELECT * FROM t1;
+a c
+3 42
+4 42
+DROP TABLE t1;
+CREATE TABLE t1 (i INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 SET i=1;
+ALTER TABLE t1 ADD COLUMN b BIT FIRST;
+ALTER TABLE t1 ADD COLUMN v INT AS (i) VIRTUAL;
+SELECT * FROM t1;
+b i v
+NULL 1 1
+DROP TABLE t1;
+CREATE TABLE t1 (ts TIMESTAMP) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 ADD COLUMN f VARCHAR(8), ADD COLUMN dt DATETIME;
+ALTER TABLE t1 ADD COLUMN b BIT, DROP COLUMN f, ADD COLUMN t TIME FIRST;
+ALTER TABLE t1 ADD COLUMN ts2 TIMESTAMP;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (4,4,4);
+ALTER TABLE t1 DROP f1, DROP f2, ADD f4 INT, ADD f5 INT;
+DELETE FROM t1;
+ALTER TABLE t1 DROP COLUMN f4;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 DROP f2, ADD COLUMN f4 INT;
+ALTER TABLE t1 DROP f4;
+ALTER TABLE t1 DROP f1;
+DROP TABLE t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 () VALUES (),();
+SELECT * FROM t1;
+f
+NULL
+NULL
+ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id);
+SELECT * FROM t1;
+id f
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 SET f=NULL;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 SET f=NULL;
+SELECT * FROM t1;
+f
+NULL
+NULL
+DROP TABLE t1;
+CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1(pk INT PRIMARY KEY, f INT, k INT AUTO_INCREMENT, KEY(k))
+ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 (pk) VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+f1 INT,
+f2 CHAR(255),
+f3 BIGINT,
+f4 INT,
+f5 CHAR(255),
+f6 CHAR(255),
+f7 CHAR(255) NOT NULL,
+f8 INT,
+f9 CHAR(10)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
+(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
+(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
+(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
+(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
+(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
+(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
+(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
+(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
+(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
+(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
+(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
+(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
+(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
+(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
+DELETE FROM t1 WHERE pk=1;
+InnoDB 0 transactions not purged
+INSERT INTO t1 VALUES
+(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
+ALTER TABLE t1 DROP COLUMN f1;
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+f1 INT, f2 CHAR(32) NOT NULL,
+f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL,
+f7 CHAR(32), f8 CHAR(32)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''),
+(3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''),
+(5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''),
+(7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''),
+(9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''),
+(11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''),
+(13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''),
+(15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''),
+(17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''),
+(19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''),
+(21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''),
+(23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''),
+(25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''),
+(51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''),
+(53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''),
+(55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''),
+(57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''),
+(59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''),
+(61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''),
+(63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''),
+(101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''),
+(103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''),
+(105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''),
+(107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''),
+(109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''),
+(151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''),
+(153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''),
+(155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''),
+(157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''),
+(159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''),
+(201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''),
+(203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''),
+(205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''),
+(207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''),
+(252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''),
+(254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''),
+(256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''),
+(258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''),
+(301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''),
+(303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''),
+(305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''),
+(307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''),
+(351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''),
+(353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''),
+(355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''),
+(357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''),
+(359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''),
+(361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''),
+(363,75,'',66,76,52,'','','');
+ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar ';
+UPDATE t1 SET f1 = 0;
+ALTER TABLE t1 DROP COLUMN x;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT UNIQUE, b INT UNIQUE, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 CHANGE COLUMN a a INT;
+DELETE FROM t1 WHERE a = NULL OR a IS NULL;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT,
+e INT, f INT, g INT, h INT, j INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ADD COLUMN b INT;
+ALTER TABLE t1 MODIFY COLUMN a INT NULL;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, b BLOB NOT NULL) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (1,10,REPEAT('foobar',2000));
+ALTER TABLE t1 DROP COLUMN b;
+INSERT INTO t1 VALUES (2,20);
+ALTER TABLE t1 ADD COLUMN vpk INT AS (pk);
+ALTER TABLE t1 DROP COLUMN i;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD f DATE AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD COLUMN f INT AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
disconnect analyze;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-78
+170
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result
new file mode 100644
index 00000000000..91298859e42
--- /dev/null
+++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result
@@ -0,0 +1,130 @@
+#
+# MDEV-17821 Assertion `!page_rec_is_supremum(rec)' failed
+# in btr_pcur_store_position
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY, c INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2);
+ALTER TABLE t1 ADD COLUMN f VARCHAR(255);
+ALTER TABLE t1 DROP COLUMN f;
+DELETE FROM t1;
+HANDLER t1 OPEN;
+HANDLER t1 READ `PRIMARY` <= (3);
+pk c
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk INT AUTO_INCREMENT,
+f1 CHAR(32),
+f2 CHAR(32),
+f3 CHAR(32),
+f4 INT,
+f5 CHAR(32),
+f6 INT,
+f7 INT,
+f8 INT,
+PRIMARY KEY (pk),
+UNIQUE (f6)
+) ENGINE=InnoDB;
+INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES
+('reality', 'llt', 'within', -1996816384, 'j', 160, 7, -1822687232),
+('h', 'j', 'j', 251, 'civilian', NULL, 211, NULL),
+('ltq', 'b', 'mud', 111, 'v', 90, 0, NULL),
+('toxic', 'breakfast', 'series', 2, 'x', NULL, 118, 2),
+('h', 'n', 'vision', 84, 'n', NULL, 197, 103),
+('h', 'tq', 'q', 6, 'bet', -1927151616, -446038016, 3),
+('pocket', 'qjt', 'jtl', 0, 'blink', NULL, 12, 0),
+('k', 'uv', 'exist', 37, 'g', 149, -1610219520, NULL),
+('parent', 'motion', 'u', 70, 'promote', NULL, 178, NULL),
+('get', 'convict', 'liquid', -780337152, 'd', NULL, 4, NULL),
+('vp', 'px', 'xi', -631111680, 'support', NULL, 8, NULL),
+('ck', 'z', 'minority', 8, 'k', NULL, 864878592, NULL),
+('kxx', 'g', 'container', 1, 'cholesterol', NULL, 4, 1404436480),
+('xxv', 'rail', 'j', 219, 'serious', NULL, -816119808, 62),
+('x', 'v', 'vr', 146, 'm', 16, 170, -1765867520),
+('age', 'm', 'q', -1251278848, 'rte', 6, 224, NULL),
+('discrimination', 't', 'q', 31, 'exl', 0, 2, 244),
+('water', 'x', 'ldb', 98, 'r', 235, 4, 63),
+('d', 'db', 'p', 248, 'so-called', 102, -255524864, 198),
+('last', 'bz', 'us', 0, 'experienced', 137, 240, 134),
+('q', 'z', 'attract', 67, 'code', 67, 75, 1758920704),
+('yellow', 'c', 'u', 6, 'v', 1731985408, 528154624, 2),
+('cognitive', 'he', 'protective', 590020608, 'sentence', NULL, 4, 102),
+('eih', 'l', 'ih', 1266024448, 'traditionally', NULL, 190, NULL),
+('pine', 'i', 'y', 6, 'glimpse', 214, 7, -1486880768),
+('jo', 'everyone', 'ol', 0, 'lj', NULL, 1, 0),
+('blood', 'f', 'scientist', 54, 'j', 1341128704, 168, NULL),
+('z', 'brief', 'ambassador', 115, 'ygp', 82, 129, NULL),
+('gp', 'severe', 'consist', 7, 'p', -1829961728, 602669056, 154),
+('admit', 'poetry', 'x', 116, 'enemy', 174, -2128543744, -407764992),
+('s', 'norm', 'decide', 2055667712, 'rtz', NULL, 99, -1233715200),
+('tzg', 'f', 'beg', 2016280576, 'w', NULL, -643825664, 137),
+('zgg', 'x', 'f', 148, 'y', -987496448, -708116480, 8),
+('attorney', 'perfectly', 's', 49, 'z', -1865285632, 56, -1518534656),
+('concentrate', 's', 'k', -1028849664, 'tir', 83, -1592459264, 1820065792),
+('t', 'sacrifice', 'ir', -2143879168, 'recipe', 156, 217, NULL),
+('wdf', 'd', 'f', 137, 'empty', NULL, 188, NULL),
+('o', 'customer', 'qd', -2135293952, 'z', 1527840768, 227, -1174929408),
+('d', 'qow', 'o', 1472266240, 'whe', NULL, 7, 197),
+('deny', 'reputation', 'dutch', 59, 'v', 124, 2, 191),
+('m', 'liver', 'fv', 0, 'policy', 781582336, 198574080, 177),
+('vk', 'kx', 'immigrant', -1452736512, 'x', 163, 76, 6) ,
+('j', 'ru', 'r', 67, 'joke', NULL, 3, NULL),
+('o', 'u', 'a', -569442304, 'uz', NULL, 933298176, NULL),
+('g', 'zb', 'c', -1694760960, 'fish', 18, -390463488, 1),
+('bb', 'o', 'b', 6, 'z', 9, 12, NULL),
+('compelling', 'xe', 'debut', 89, 'e', -734724096, 119, 175),
+('md', 'r', 'object', 1046478848, 'frequently', 915537920, 0, 1506410496),
+('dwn', 'wnz', 'x', 1767571456, 'nz', 241, -882180096, 9),
+('zvf', 'vfo', 'g', -844824576, 'w', NULL, 1, 9),
+('w', 'pose', 'r', 1029308416, 'a', -48627712, 1756168192, NULL),
+('o', 'jwp', 'patient', 172, 'i', 297140224, 45809664, 3),
+('w', 'p', 'american', 450297856, 'z', 20, 4, 186),
+('ridiculous', 'helpful', 'vy', -2022899712, 'conspiracy', NULL, 162, -264634368),
+('t', 'g', 'spite', 289931264, 'y', 4, 13, NULL),
+('performer', 'i', 'tomato', -1519386624, 'mz', 8, 87, 106),
+('m', 'z', 'hang', 3, 'crowded', -537919488, 1, 2),
+('fu', 'uot', 'j', 1, 'o', 179, 220, -2084569088),
+('ts', 'n', 'su', 1, 'o', 198, 9, 68),
+('ball', 'halfway', 'uf', 40, 'l', 145948672, 9, 149),
+('hunting', 'n', 'teenager', 0, 'neat', 209, 2044461056, 68),
+('independent', 'along', 'fpn', 5, 'pn', 3, 1353252864, 217),
+('p', 'presumably', 'n', -1977548800, 'balanced', 1909260288, 197, NULL),
+('pink', 'h', 'tear', 8, 'n', 254, 8, 1006305280),
+('tyy', 'n', 'yyr', 1107820544, 'yr', NULL, 0, 219),
+('u', 'retirement', 'thread', -2083192832, 'rx', -678232064, 209, 1048969216),
+('xk', 'kb', 'z', 9, 'ba', 218, 7, 8),
+('a', 'plenty', 'forget', 36, 'c', 215, 2027094016, NULL),
+('i', 'compromise', 'n', -1090256896, 'o', 10, 66, 1872887808),
+('x', 'disappointment', 'cognitive', 753860608, 'ua', 77, 123, 10),
+('e', 'added', 'aub', 2, 'u', NULL, 9, 92),
+('bc', 'h', 'n', 146, 'master', NULL, 1003945984, NULL),
+('execution', 'f', 'cgp', 574423040, 'gp', 2, -518782976, -1189085184),
+('pv', 'bad', 'v', 132, 'r', 195, 6, 5),
+('modify', 'participation', 'vol', 237, 'j', -842924032, 88, -747765760),
+('substantially', 'i', 'congressional', 2, 'edit', NULL, 1003159552, NULL),
+('tell', 'forty', 'v', -910098432, 'd', 43, 3, NULL),
+('crawl', 'ad', 'respect', -1851195392, 'p', 72, -1709047808, 1343225856),
+('w', 'reception', 'fiber', 56, 's', NULL, 2, -993787904),
+('successful', 'instruct', 'dug', 2, 'u', 7, -411500544, NULL),
+('appointment', 'pregnant', 'weird', 2, 'r', NULL, -897384448, 76),
+('g', 'j', 'thin', 663617536, 'oan', 1, 7, NULL),
+('secretary', 'a', 'o', 103, 'nj', 1977745408, -1291124736, -1314521088),
+('g', 'jq', 'q', 1875116032, 'blame', NULL, 1, 4),
+('oj', 'j', 'breast', 150, 'c', NULL, 3, NULL),
+('rd', 'm', 'comprehensive', 1723334656, 't', NULL, 155, -312344576) ,
+('a', 'd', 'criminal', -1155137536, 'airplane', 242, -662896640, 1),
+('fast', 'i', 'k', -386662400, 'zxe', NULL, 7, 119),
+('xe', 'mouse', 'c', -205717504, 'ew', NULL, -729612288, 86),
+('hang', 'j', 'o', 3, 'hungry', NULL, 200, 49),
+('expense', 'z', 'sum', 2, 'gob', -472055808, -538181632, NULL),
+('nest', 'o', 'k', 116, 'weak', NULL, 223, NULL);
+INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3);
+ERROR 23000: Duplicate entry '7' for key 'f6'
+ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT '';
+SELECT * INTO OUTFILE 'load.data' FROM t1;
+UPDATE IGNORE t1 SET pk = 0;
+LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1;
+HANDLER t1 OPEN AS h;
+HANDLER h READ `PRIMARY` PREV WHERE 0;
+pk f1 f2 f3 f4 f5 f6 f7 f8 filler
+HANDLER h CLOSE;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/instant_alter_crash.result b/mysql-test/suite/innodb/r/instant_alter_crash.result
index 807a4091822..db16ecc5a89 100644
--- a/mysql-test/suite/innodb/r/instant_alter_crash.result
+++ b/mysql-test/suite/innodb/r/instant_alter_crash.result
@@ -5,7 +5,7 @@ FLUSH TABLES;
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES(1,2);
+INSERT INTO t1 VALUES(0,2);
BEGIN;
INSERT INTO t2 VALUES(2,1);
ALTER TABLE t2 ADD COLUMN (c3 TEXT NOT NULL DEFAULT 'De finibus bonorum');
@@ -15,16 +15,17 @@ ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT NULL DEFAULT ' et malorum');
connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-COMMIT;
+INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium');
# Kill the server
disconnect ddl;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SELECT * FROM t1;
id c2
-1 2
+0 2
SELECT * FROM t2;
id c2 c3
2 1 De finibus bonorum
+3 4 accusantium doloremque laudantium
BEGIN;
DELETE FROM t1;
ROLLBACK;
@@ -37,16 +38,18 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere';
connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-DELETE FROM t1;
+UPDATE t1 SET c2=c2+1;
# Kill the server
disconnect ddl;
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SELECT * FROM t1;
id c2
+0 3
SELECT * FROM t2;
id c2 c3
2 1 De finibus bonorum
+3 4 accusantium doloremque laudantium
16 1551 Omnium enim rerum
128 1571 principia parva sunt
BEGIN;
@@ -67,11 +70,13 @@ DELETE FROM t1;
disconnect ddl;
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+FOUND 3 /\[Note\] InnoDB: Rolled back recovered transaction / in mysqld.1.err
SELECT * FROM t1;
id c2
SELECT * FROM t2;
id c2
2 1
+3 4
64 42
16 1551
128 1571
@@ -87,7 +92,7 @@ N_RECS=0; LEVEL=0
header=0x010000030074 (id=0x696e66696d756d00)
header=0x010008030000 (id=0x73757072656d756d00)
t2 clustered index root page(type 18):
-N_RECS=6; LEVEL=0
+N_RECS=7; LEVEL=0
header=0x01000003008f (id=0x0000000000000000)
header=0x3000100c00d4 (id=0x80000000,
DB_TRX_ID=0x000000000000,
@@ -99,26 +104,31 @@ header=0x0000180900f4 (id=0x80000002,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x80000001)
-header=0x0000200b0124 (id=0x80000010,
+header=0x0000200b0135 (id=0x80000003,
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+ c2=0x80000004,
+ c3=0x6163637573616e7469756d20646f6c6f72656d717565206c617564616e7469756d)
+header=0x0000280b0165 (id=0x80000010,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x8000060f,
c3=0x4f6d6e69756d20656e696d20726572756d)
-header=0x000028090144 (id=0x80000040,
+header=0x000030090185 (id=0x80000040,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x8000002a)
-header=0x0000300b0179 (id=0x80000080,
+header=0x0000380b01ba (id=0x80000080,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x80000623,
c3=0x207072696e63697069612070617276612073756e74)
-header=0x0000380b0074 (id=0x8000015b,
+header=0x0000400b0074 (id=0x8000015b,
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
c2=0x8000814d,
c3=0x206574206d616c6f72756d)
-header=0x070008030000 (id=0x000000000000000100)
+header=0x080008030000 (id=0x000000000000000100)
UNLOCK TABLES;
DELETE FROM t2;
InnoDB 0 transactions not purged
diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result
index c017a466516..4989c801738 100644
--- a/mysql-test/suite/innodb/r/instant_alter_debug.result
+++ b/mysql-test/suite/innodb/r/instant_alter_debug.result
@@ -1,5 +1,8 @@
SET @save_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+SET @old_instant=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_instant_alter_column');
CREATE TABLE t1 (
pk INT AUTO_INCREMENT PRIMARY KEY,
c1 INT,
@@ -260,4 +263,41 @@ a b c d
1 2 NULL 1
2 3 4 1
DROP TABLE t1;
+#
+# MDEV-17899 Assertion failures on rollback of instant ADD/DROP
+# MDEV-18098 Crash after rollback of instant DROP COLUMN
+#
+SET @save_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,ib_commit_inplace_fail_1';
+CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2);
+ALTER TABLE t1 DROP COLUMN b;
+ERROR HY000: Internal error: Injected error!
+ALTER TABLE t1 DROP COLUMN b;
+ERROR HY000: Internal error: Injected error!
+ALTER TABLE t1 ADD COLUMN c INT;
+ERROR HY000: Internal error: Injected error!
+SELECT * FROM t1;
+a b
+1 2
+DROP TABLE t1;
+CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN c INT;
+ERROR HY000: Internal error: Injected error!
+BEGIN;
+INSERT INTO t1 VALUES(1, 1);
+ROLLBACK;
+ALTER TABLE t1 DROP COLUMN b;
+ERROR HY000: Internal error: Injected error!
+INSERT INTO t1 values (1,1);
+SELECT * FROM t1;
+a b
+1 1
+DROP TABLE t1;
+SET debug_dbug = @save_dbug;
+SELECT variable_value-@old_instant instants
+FROM information_schema.global_status
+WHERE variable_name = 'innodb_instant_alter_column';
+instants
+21
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
diff --git a/mysql-test/suite/innodb/r/instant_alter_null.result b/mysql-test/suite/innodb/r/instant_alter_null.result
new file mode 100644
index 00000000000..f49d60fc301
--- /dev/null
+++ b/mysql-test/suite/innodb/r/instant_alter_null.result
@@ -0,0 +1,56 @@
+create table t (a int NOT NULL) engine=innodb row_format= compressed;
+alter table t modify a int NULL, algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
+drop table t;
+create table t (a int NOT NULL) engine=innodb row_format= dynamic;
+alter table t modify a int NULL, algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
+drop table t;
+create table t (a int NOT NULL) engine=innodb row_format= compact;
+alter table t modify a int NULL, algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
+drop table t;
+create table t (
+id int primary key,
+a int NOT NULL default 0,
+b int NOT NULL default 0,
+c int NOT NULL default 0,
+index idx (a,b,c)
+) engine=innodb row_format=redundant;
+insert into t (id, a) values (0, NULL);
+ERROR 23000: Column 'a' cannot be null
+insert into t (id, b) values (0, NULL);
+ERROR 23000: Column 'b' cannot be null
+insert into t (id, c) values (0, NULL);
+ERROR 23000: Column 'c' cannot be null
+insert into t values (1,1,1,1);
+set @id = (select table_id from information_schema.innodb_sys_tables
+where name = 'test/t');
+select * from information_schema.innodb_sys_columns where table_id=@id;
+TABLE_ID NAME POS MTYPE PRTYPE LEN
+TABLE_ID id 0 6 1283 4
+TABLE_ID a 1 6 1283 4
+TABLE_ID b 2 6 1283 4
+TABLE_ID c 3 6 1283 4
+alter table t modify a int NULL, algorithm=instant;
+insert into t values (2, NULL, 2, 2);
+alter table t modify b int NULL, algorithm=nocopy;
+insert into t values (3, NULL, NULL, 3);
+alter table t modify c int NULL, algorithm=inplace;
+insert into t values (4, NULL, NULL, NULL);
+select * from information_schema.innodb_sys_columns where table_id=@id;
+TABLE_ID NAME POS MTYPE PRTYPE LEN
+TABLE_ID id 0 6 1283 4
+TABLE_ID a 1 6 1027 4
+TABLE_ID b 2 6 1027 4
+TABLE_ID c 3 6 1027 4
+select * from t;
+id a b c
+4 NULL NULL NULL
+3 NULL NULL 3
+2 NULL 2 2
+1 1 1 1
+check table t;
+Table Op Msg_type Msg_text
+test.t check status OK
+drop table t;
diff --git a/mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff b/mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff
new file mode 100644
index 00000000000..53d2be18f9c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/instant_alter_purge,release.rdiff
@@ -0,0 +1,18 @@
+--- instant_alter_purge.result
++++ instant_alter_purge,release.result
+@@ -32,15 +32,11 @@
+ START TRANSACTION WITH CONSISTENT SNAPSHOT;
+ connection default;
+ DELETE FROM t1;
+-SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL go WAIT_FOR do';
+ ALTER TABLE t1 ADD COLUMN f3 INT;
+ connection purge_control;
+-SET DEBUG_SYNC='now WAIT_FOR go';
+ COMMIT;
+ InnoDB 0 transactions not purged
+-SET DEBUG_SYNC='now SIGNAL do';
+ disconnect purge_control;
+ connection default;
+-SET DEBUG_SYNC=RESET;
+ DROP TABLE t1;
+ SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
diff --git a/mysql-test/suite/innodb/r/instant_alter_purge.result b/mysql-test/suite/innodb/r/instant_alter_purge.result
new file mode 100644
index 00000000000..a3643610f04
--- /dev/null
+++ b/mysql-test/suite/innodb/r/instant_alter_purge.result
@@ -0,0 +1,46 @@
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+#
+# MDEV-17793 Crash in purge after instant DROP and emptying the table
+#
+connect prevent_purge,localhost,root;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 () VALUES ();
+ALTER TABLE t1 DROP f2, ADD COLUMN f2 INT;
+ALTER TABLE t1 DROP f1;
+DELETE FROM t1;
+connection prevent_purge;
+COMMIT;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+ALTER TABLE t1 ADD COLUMN extra TINYINT UNSIGNED NOT NULL DEFAULT 42;
+InnoDB 1 transactions not purged
+ALTER TABLE t1 DROP extra;
+disconnect prevent_purge;
+InnoDB 0 transactions not purged
+DROP TABLE t1;
+#
+# MDEV-17813 Crash in instant ALTER TABLE due to purge
+# concurrently emptying table
+#
+CREATE TABLE t1 (f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 SET f2=1;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+connect purge_control,localhost,root;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+DELETE FROM t1;
+SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL go WAIT_FOR do';
+ALTER TABLE t1 ADD COLUMN f3 INT;
+connection purge_control;
+SET DEBUG_SYNC='now WAIT_FOR go';
+COMMIT;
+InnoDB 0 transactions not purged
+SET DEBUG_SYNC='now SIGNAL do';
+disconnect purge_control;
+connection default;
+SET DEBUG_SYNC=RESET;
+DROP TABLE t1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
diff --git a/mysql-test/suite/innodb/r/instant_drop.result b/mysql-test/suite/innodb/r/instant_drop.result
index 3f029c3f7d0..0650229dc13 100644
--- a/mysql-test/suite/innodb/r/instant_drop.result
+++ b/mysql-test/suite/innodb/r/instant_drop.result
@@ -130,11 +130,12 @@ update t1 set f3 = 19;
select * from t1;
f1 f3
1 19
-alter table t1 drop column f1, add column f5 int default 10, algorithm=instant;
+alter table t1 drop column f1, add column f5 tinyint default 10 first,
+algorithm=instant;
insert into t1 values(4, 10);
select * from t1;
-f3 f5
-19 10
+f5 f3
+10 19
4 10
create table t2(f1 int, f2 int not null) engine=innodb;
insert into t2(f1, f2) values(1, 2);
@@ -153,9 +154,12 @@ alter table t2 add column f6 char(100) default repeat('a', 99), algorithm=instan
create table t3(f1 int, f2 int not null)engine=innodb;
insert into t3 values(1, 2);
alter table t3 drop column f2, add column f3 int default 1, add column f4 int default 4, algorithm=instant;
+create table t4(a varchar(1), b int, c int, primary key(a,b))engine=innodb;
+insert into t4 values('4',5,6);
+alter table t4 drop column c;
select * from t1;
-f3 f5
-19 10
+f5 f3
+10 19
4 10
alter table t1 add column f6 int default 9,drop column f5, algorithm = instant;
insert into t1 values(4, 9);
@@ -163,7 +167,7 @@ alter table t1 force, algorithm=inplace;
select * from t1;
f3 f6
19 9
-4 9
+10 9
4 9
select * from t2;
f1 f4 f5 f6
@@ -184,7 +188,16 @@ select * from t3;
f1 f3 f4
1 1 4
alter table t3 add column f5 char(100) default repeat('a', 99), algorithm=instant;
+select * from t4;
+a b
+4 5
+alter table t4 add column d varchar(5) default 'fubar';
+insert into t4 values('',0,'snafu');
select * from t3;
f1 f3 f4 f5
1 1 4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-drop table t1,t2,t3;
+select * from t4;
+a b d
+ 0 snafu
+4 5 fubar
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/suite/innodb/r/instant_varchar_enlarge.result b/mysql-test/suite/innodb/r/instant_varchar_enlarge.result
new file mode 100644
index 00000000000..14f16bd4fe2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/instant_varchar_enlarge.result
@@ -0,0 +1,9 @@
+create table t (a varchar(100)) engine=innodb;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+name pos mtype prtype len
+a 0 1 524303 100
+alter table t modify a varchar(110), algorithm=inplace;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+name pos mtype prtype len
+a 0 1 524303 110
+drop table t;
diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result
index 4168a94928f..4a72a37a7ea 100644
--- a/mysql-test/suite/innodb/r/monitor.result
+++ b/mysql-test/suite/innodb/r/monitor.result
@@ -147,7 +147,6 @@ trx_nl_ro_commits disabled
trx_commits_insert_update disabled
trx_rollbacks disabled
trx_rollbacks_savepoint disabled
-trx_rollback_active disabled
trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
diff --git a/mysql-test/suite/innodb/r/purge_secondary.result b/mysql-test/suite/innodb/r/purge_secondary.result
index 8f20f5baacb..1b5f2896887 100644
--- a/mysql-test/suite/innodb/r/purge_secondary.result
+++ b/mysql-test/suite/innodb/r/purge_secondary.result
@@ -134,6 +134,7 @@ test.t1 check status OK
InnoDB 0 transactions not purged
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT OTHER_INDEX_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE NAME='test/t1';
diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result
index c82cd6ceccb..8c4280738e1 100644
--- a/mysql-test/suite/innodb/r/table_flags.result
+++ b/mysql-test/suite/innodb/r/table_flags.result
@@ -192,3 +192,8 @@ ib_logfile0
ib_logfile1
ibdata1
sys_tables.bin
+call mtr.add_suppression("ERROR HY000: Can't create table `test`.`t1`");
+CREATE TABLE t1(f1 INT, f2 VARCHAR(1), KEY k1(f2),
+FULLTEXT KEY(f2),
+FOREIGN KEY (f2) REFERENCES t1(f3))ENGINE=InnoDB;
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
diff --git a/mysql-test/suite/innodb/r/truncate.result b/mysql-test/suite/innodb/r/truncate.result
index 3ade1e7f8de..0e5ffeea34f 100644
--- a/mysql-test/suite/innodb/r/truncate.result
+++ b/mysql-test/suite/innodb/r/truncate.result
@@ -6,3 +6,36 @@ connection default;
TRUNCATE TABLE t;
disconnect dml;
DROP TABLE t;
+#
+# MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED
+#
+CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+TRUNCATE TABLE t1;
+SHOW TABLE STATUS;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+t1 InnoDB # Compressed # # # # # # 1 # # NULL latin1_swedish_ci NULL key_block_size=4 0 N
+DROP TABLE t1;
+#
+# MDEV-17859 Operating system errors in file operations
+# after failed CREATE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+call mtr.add_suppression("InnoDB: (Operating system )?[Ee]rror number");
+call mtr.add_suppression("InnoDB: Cannot create file '.*t1\\.ibd");
+FLUSH TABLES;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ERROR HY000: Tablespace for table '`test`.`t1`' exists. Please DISCARD the tablespace before IMPORT
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+#
+# MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO
+#
+CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+TRUNCATE t1;
+SELECT * FROM t1;
+a
+DROP TEMPORARY TABLE t1;
diff --git a/mysql-test/suite/innodb/r/undo_truncate_recover.result b/mysql-test/suite/innodb/r/undo_truncate_recover.result
index 2619f384847..018ac65537a 100644
--- a/mysql-test/suite/innodb/r/undo_truncate_recover.result
+++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result
@@ -9,7 +9,6 @@ update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc';
commit;
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
FOUND 1 /ib_undo_trunc/ in mysqld.1.err
drop table t1;
diff --git a/mysql-test/suite/innodb/t/alter_candidate_key.test b/mysql-test/suite/innodb/t/alter_candidate_key.test
new file mode 100644
index 00000000000..7429cd89a1a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_candidate_key.test
@@ -0,0 +1,72 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL,
+ UNIQUE KEY uidx2(f1,f2),
+ UNIQUE KEY uidx1(f2)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1, 1);
+SHOW CREATE TABLE t1;
+SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
+ SIGNAL conc_dml WAIT_FOR go_ahead';
+--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE
+connect (con1,localhost,root,,);
+SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
+DELETE FROM t1;
+SET DEBUG_SYNC = 'now SIGNAL go_ahead';
+connection default;
+reap;
+SHOW CREATE TABLE t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT, f2 INT,
+ PRIMARY KEY(f1, f2),
+ UNIQUE INDEX uidx2 (f1, f2),
+ UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
+ SIGNAL conc_dml WAIT_FOR go_ahead';
+--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE
+connection con1;
+SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES(1, 1), (1, 1);
+SET DEBUG_SYNC = 'now SIGNAL go_ahead';
+connection default;
+reap;
+SHOW CREATE TABLE t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+
+SET SQL_MODE= strict_trans_tables;
+CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB;
+SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
+--send ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL
+connection con1;
+SET DEBUG_SYNC='now WAIT_FOR dml';
+BEGIN;
+INSERT INTO t1 SET a=NULL;
+ROLLBACK;
+set DEBUG_SYNC='now SIGNAL dml_done';
+connection default;
+--error ER_INVALID_USE_OF_NULL
+reap;
+DROP TABLE t1;
+disconnect con1;
+SET DEBUG_SYNC="RESET";
+SET SQL_MODE=DEFAULT;
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2),
+ UNIQUE KEY(f2))ENGINE=InnoDB;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+ UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
index b832596647f..e0451e121a6 100644
--- a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
+++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
@@ -4,6 +4,7 @@
--source include/have_debug_sync.inc
--source include/not_embedded.inc
+select count_star into @init_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
connect (ddl, localhost, root,,);
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
@@ -24,9 +25,10 @@ send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR go';
---replace_regex /.*[\\\/]tmp/tmp/
-SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
-WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
+
+select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
+
+SELECT @final_count - @init_count;
#--exec lsof -p `pidof mysqld`
SET DEBUG_SYNC = 'now SIGNAL gone';
diff --git a/mysql-test/suite/innodb/t/data_types.test b/mysql-test/suite/innodb/t/data_types.test
index 0978146361c..cfdd5201af2 100644
--- a/mysql-test/suite/innodb/t/data_types.test
+++ b/mysql-test/suite/innodb/t/data_types.test
@@ -88,9 +88,15 @@ CREATE TABLE t1
t1_VARCHAR_500 VARCHAR(500),
t1_VARCHAR_500_BINARY VARCHAR(500) BINARY,
t1_YEAR_2 YEAR(2),
- t1_YEAR_4 YEAR(4)
+ t1_YEAR_4 YEAR(4),
+ t1_CHAR_0 CHAR(0),
+ t1_MYSQL_0 CHAR(0) CHARACTER SET utf8,
+ t1_VARCHAR_0 VARCHAR(0),
+ t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8
) ENGINE=InnoDB;
+INSERT INTO t1 () VALUES ();
+
SELECT
name,
CASE mtype
@@ -116,3 +122,17 @@ WHERE name LIKE "t1\_%"
ORDER BY name;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17815 Assertion failed in btr_node_ptr_max_size for CHAR(0)
+--echo #
+CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0)
+--echo #
+CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/default_row_format_create.test b/mysql-test/suite/innodb/t/default_row_format_create.test
index e0981abf7eb..03a7ebd3752 100644
--- a/mysql-test/suite/innodb/t/default_row_format_create.test
+++ b/mysql-test/suite/innodb/t/default_row_format_create.test
@@ -22,7 +22,25 @@ SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
-ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+ROW_FORMAT=COMPRESSED;
+--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
+SHOW TABLE STATUS LIKE 't1';
+TRUNCATE TABLE t1;
+--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
+SHOW TABLE STATUS LIKE 't1';
+DROP TABLE t1;
+
+--error 0,ER_CANT_CREATE_TABLE
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1;
+--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
+SHOW TABLE STATUS LIKE 't1';
+DROP TABLE IF EXISTS t1;
+
+SET @save_format = @@GLOBAL.innodb_default_row_format;
+SET GLOBAL innodb_default_row_format = redundant;
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
+SET GLOBAL innodb_default_row_format = @save_format;
+TRUNCATE TABLE t1;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innochecksum.test b/mysql-test/suite/innodb/t/innochecksum.test
deleted file mode 100644
index 79896ed1e3f..00000000000
--- a/mysql-test/suite/innodb/t/innochecksum.test
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Test innochecksum
-#
-
---source include/have_innodb.inc
-# Embedded server test does not support restarting
---source include/not_embedded.inc
-
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
-INSERT INTO t1 (b) VALUES ('corrupt me');
---disable_query_log
---let $i = 1000
-while ($i)
-{
- INSERT INTO t1 (b) VALUES (REPEAT('abcdefghijklmnopqrstuvwxyz', 100));
- dec $i;
-}
---enable_query_log
-INSERT INTO t1 (b) VALUES ('corrupt me');
-
-let $MYSQLD_DATADIR=`select @@datadir`;
-
---source include/shutdown_mysqld.inc
-
---echo # Run innochecksum on t1
---disable_result_log
---exec $INNOCHECKSUM $MYSQLD_DATADIR/test/t1.ibd
---enable_result_log
-
---source include/start_mysqld.inc
-
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test
index 5c8025265e5..00300bfdccc 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test
@@ -98,5 +98,37 @@ SET DEBUG_SYNC='RESET';
DROP TABLE t1;
+--echo #
+--echo # MDEV-17470 Orphan temporary files after interrupted ALTER
+--echo # cause InnoDB: Operating system error number 17 and eventual
+--echo # fatal error 71
+--echo #
+CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8);
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+INSERT INTO t1 SELECT NULL, i FROM t1;
+
+LOCK TABLE t1 READ;
+
+--connect (con1,localhost,root,,test)
+let $ID= `SELECT @id := CONNECTION_ID()`;
+send ALTER TABLE t1 FORCE, ALGORITHM=COPY;
+
+--connection default
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+let $ignore= `SELECT @id := $ID`;
+kill query @id;
+--connection con1
+--error ER_QUERY_INTERRUPTED
+reap;
+--disconnect con1
+--connection default
+UNLOCK TABLES;
+DROP TABLE t1;
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test
index a7f1eb56dce..961d8653e90 100644
--- a/mysql-test/suite/innodb/t/innodb-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-alter.test
@@ -272,13 +272,8 @@ ALTER TABLE t1o ADD FULLTEXT INDEX(cu),
ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
# Replace the hidden FTS_DOC_ID column with a user-visible one.
-# This used to work if there is at most one fulltext index.
-# Currently, we disallow native ALTER TABLE if the table
-# contains any FULLTEXT indexes.
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
ALGORITHM=INPLACE;
-ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
# Replace the user-visible FTS_DOC_ID column with a hidden one.
# We do not support this in-place.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
@@ -545,6 +540,19 @@ SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
WHERE T.NAME='test/t1';
DROP TABLE t1;
+--echo # and an MDEV-18041 regression related to indexes prefixes
+create table `test` (
+ `test_old` varchar(255) NOT NULL,
+ `other` varchar(255) NOT NULL,
+ PRIMARY KEY (`test_old`,`other`),
+ UNIQUE KEY uk (`test_old`(100), `other`)
+) ENGINE=InnoDB;
+
+select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
+alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
+select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
+drop table `test`;
+
--echo #
--echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index 97014d84ca7..bfbe62699fd 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb/t/innodb-index.test
@@ -549,6 +549,31 @@ show create table t2c;
--disable_info
DROP TABLE t1,t2,t2c,t2i;
+
+CREATE TABLE t1 (c VARCHAR(1024),
+c1 CHAR(255) NOT NULL,c2 CHAR(255) NOT NULL,c3 CHAR(255) NOT NULL,
+c4 CHAR(255) NOT NULL,c5 CHAR(255) NOT NULL,c6 CHAR(255) NOT NULL,
+c7 CHAR(255) NOT NULL,c8 CHAR(255) NOT NULL,c9 CHAR(255) NOT NULL,
+ca CHAR(255) NOT NULL,cb CHAR(255) NOT NULL,cc CHAR(255) NOT NULL,
+cd CHAR(255) NOT NULL,ce CHAR(255) NOT NULL,cf CHAR(255) NOT NULL,
+d0 CHAR(255) NOT NULL,d1 CHAR(255) NOT NULL,d2 CHAR(255) NOT NULL,
+d3 CHAR(255) NOT NULL,d4 CHAR(255) NOT NULL,d5 CHAR(255) NOT NULL,
+d6 CHAR(255) NOT NULL,d7 CHAR(255) NOT NULL,d8 CHAR(255) NOT NULL,
+d9 CHAR(255) NOT NULL,da CHAR(255) NOT NULL,db CHAR(255) NOT NULL,
+dc CHAR(255) NOT NULL,dd CHAR(255) NOT NULL,de CHAR(255) NOT NULL,
+UNIQUE KEY(c))
+ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(repeat('a',999),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''),
+(CONCAT(repeat('a',999),'b'),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
+--error ER_INDEX_COLUMN_TOO_LONG
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=inplace;
+--error ER_INDEX_COLUMN_TOO_LONG
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=copy;
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+
--echo #
--echo # Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
--echo #
@@ -880,8 +905,9 @@ drop table t1;
create table t1(f1 int not null, f2 int not null,
primary key (f1), unique key(f1, f2))engine=innodb;
insert into t1 values(1,3), (2,2);
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t1 drop primary key, lock=none;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+alter table t1 drop index f1, lock=none;
drop table t1;
--echo #
@@ -1115,12 +1141,39 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
--move_file $MYSQLD_DATADIR/test/t0.ibd $MYSQLD_DATADIR/test/t1.ibd
--source include/start_mysqld.inc
+if ($have_debug) {
+# Initiate shutdown in order to issue a redo log checkpoint and to discard
+# the redo log record that was emitted due to '+d,fil_names_write_bogus'.
+--source include/restart_mysqld.inc
+}
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-18186 assertion failure on missing InnoDB index
+--echo #
+
+--disable_query_log
+call mtr.add_suppression("Cannot find index i1 in InnoDB index dictionary");
+call mtr.add_suppression("InnoDB indexes are inconsistent with what defined");
+call mtr.add_suppression("Table test/t contains 0 indexes");
+call mtr.add_suppression("InnoDB could not find key no");
+--enable_query_log
+
+# Test an attempt to rename a nonexistent index inside InnoDB
+-- let $MYSQL_DATA_DIR = `SELECT @@datadir`
+CREATE TABLE t (a INT, INDEX i1 (a)) ENGINE=INNODB;
+-- copy_file $MYSQL_DATA_DIR/test/t.frm $MYSQL_DATA_DIR/test/t.fr_
+DROP TABLE t;
+CREATE TABLE t (a INT) ENGINE=INNODB;
+-- remove_file $MYSQL_DATA_DIR/test/t.frm
+-- move_file $MYSQL_DATA_DIR/test/t.fr_ $MYSQL_DATA_DIR/test/t.frm
+SHOW CREATE TABLE t;
+DROP TABLE t;
+
--disable_query_log
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*t[12].ibd.");
diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test
index edf83247142..2b3879bc707 100644
--- a/mysql-test/suite/innodb/t/innodb-table-online.test
+++ b/mysql-test/suite/innodb/t/innodb-table-online.test
@@ -102,10 +102,6 @@ ALTER TABLE t1 ADD UNIQUE INDEX(c2),
LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
SHOW CREATE TABLE t1;
-# We do not support plain DROP_PK_INDEX without ADD_PK_INDEX.
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE;
-SHOW CREATE TABLE t1;
# Now the previous DEBUG_SYNC should kick in.
--send
ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1);
diff --git a/mysql-test/suite/innodb/t/innodb-virtual-columns.test b/mysql-test/suite/innodb/t/innodb-virtual-columns.test
index 0e0d6dbb2f5..faf542645fb 100644
--- a/mysql-test/suite/innodb/t/innodb-virtual-columns.test
+++ b/mysql-test/suite/innodb/t/innodb-virtual-columns.test
@@ -306,3 +306,14 @@ select * from gso_grad_supr;
drop table grad_degree;
drop table gso_grad_supr;
+
+CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES (1,'foo');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES (1,'foo');
+ALTER TABLE t1 ADD FULLTEXT KEY(b);
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
index ca37521b9cf..15f8544088d 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
@@ -1017,20 +1017,6 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
-# Test failure after importing the cluster index
-SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
-
---error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-
-SET SESSION debug_dbug=@saved_debug_dbug;
-
-# Left over from the failed IMPORT
-perl;
-do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
-EOF
-
DROP TABLE test_wl5522.t1;
--disable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_28867993.test b/mysql-test/suite/innodb/t/innodb_28867993.test
new file mode 100644
index 00000000000..61e9578df7b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_28867993.test
@@ -0,0 +1,12 @@
+#
+# Bug#28867993: POSSIBLE ISSUE WITH MYSQL SERVER RESTART
+#
+
+source include/have_innodb.inc;
+create table t1 (a int) engine=innodb;
+insert t1 values (1),(2);
+create database ib_logfile2;
+source include/restart_mysqld.inc;
+select * from t1;
+drop table t1;
+drop database ib_logfile2;
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt b/mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt
deleted file mode 100644
index 1dcd1367b3a..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---skip-innodb-doublewrite
---innodb-file-per-table
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.test b/mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
deleted file mode 100644
index 63a4b418677..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
+++ /dev/null
@@ -1,239 +0,0 @@
-#************************************************************
-# WL6045:Improve Innochecksum
-#************************************************************
---source include/innodb_page_size_small.inc
---source include/no_valgrind_without_big.inc
-# Embedded server does not support crashing.
---source include/not_embedded.inc
-
-# Avoid CrashReporter popup on Mac.
---source include/not_crashrep.inc
-
---echo # Set the environmental variables
-let MYSQLD_BASEDIR= `SELECT @@basedir`;
-let MYSQLD_DATADIR= `SELECT @@datadir`;
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-
-CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
-CREATE INDEX idx1 ON tab1(c2(10));
-INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-insert into t1 values(1,"i");
-insert into t1 values(2,"am");
-insert into t1 values(3,"compressed table");
-
---echo # Shutdown the Server
---source include/shutdown_mysqld.inc
---echo # Server Default checksum = innodb
-
-#
-# Not repeatable with --parallel= >1
-#
-#--echo [1a]: check the innochecksum when file doesn't exists
-#--error 1
-#--exec $INNOCHECKSUM $MYSQLD_DATADIR/test/aa.ibd 2> $SEARCH_FILE
-#let SEARCH_PATTERN= Error: $MYSQLD_DATADIR/test/aa.ibd cannot be found;
-#--source include/search_pattern_in_file.inc
-
---echo [1b]: check the innochecksum without --strict-check
---exec $INNOCHECKSUM $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [2]: check the innochecksum with full form --strict-check=crc32
---exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [3]: check the innochecksum with short form -C crc32
---exec $INNOCHECKSUM -C crc32 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [4]: check the innochecksum with --no-check ignores algorithm check, warning is expected
---error 1
---exec $INNOCHECKSUM --no-check $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --no-check must be associated with --write option.;
---source include/search_pattern_in_file.inc
-
---echo [5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected
---error 1
---exec $INNOCHECKSUM -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --no-check must be associated with --write option.;
---source include/search_pattern_in_file.inc
-
---echo [6]: check the innochecksum with full form strict-check & no-check , an error is expected
---error 1
---exec $INNOCHECKSUM --strict-check=innodb --no-check $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
---source include/search_pattern_in_file.inc
-
---echo [7]: check the innochecksum with short form strict-check & no-check , an error is expected
---error 1
---exec $INNOCHECKSUM -C innodb -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
---source include/search_pattern_in_file.inc
-
---echo [8]: check the innochecksum with short & full form combination
---echo # strict-check & no-check, an error is expected
---error 1
---exec $INNOCHECKSUM --strict-check=innodb -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
---source include/search_pattern_in_file.inc
-
---echo [9]: check the innochecksum with full form --strict-check=innodb
-# Server Default checksum = crc32
---exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-
---echo [10]: check the innochecksum with full form --strict-check=none
---echo # when server Default checksum=crc32
---exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-
---echo [11]: check the innochecksum with short form -C innodb
---echo # when server Default checksum=crc32
---exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-
---echo [12]: check the innochecksum with short form -C none
---echo # when server Default checksum=crc32
---exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-
---echo [13]: check strict-check with invalid values
---error 1
---exec $INNOCHECKSUM --strict-check=strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_innodb\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_innodb\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2>$SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=crc $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'crc\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=no $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'no\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---echo [14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
---echo # Also check the long form of write option.
---exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/t1.ibd
-# Rewrite done, verify with --strict-check=crc32
---exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/t1.ibd
-
---echo [14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
---echo # Also check the long form of write option.
---exec $INNOCHECKSUM --no-check --write=innodb $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=crc32 --write=innodb $MYSQLD_DATADIR/test/t1.ibd
-# Rewrite done, verify with --strict-check=innodb
---exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd
-
---echo # start the server with innodb_checksum_algorithm=InnoDB
---let $restart_parameters= --innodb_checksum_algorithm=innodb
---source include/start_mysqld.inc
-
-INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-
---echo # Stop the server
---source include/shutdown_mysqld.inc
-
---echo [15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
---echo # Also check the short form of write option.
---exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/t1.ibd
-# Rewrite done, verify with --strict-check=none
---exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/t1.ibd
-
---echo # Start the server with checksum algorithm=none
---let $restart_parameters= --innodb_checksum_algorithm=none
---source include/start_mysqld.inc
-
-INSERT INTO tab1 VALUES(3, 'Innochecksum None');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-DROP TABLE t1;
-
---echo # Stop the server
---source include/shutdown_mysqld.inc
-
---echo [16]: rewrite into new checksum=crc32 with innochecksum
---exec $INNOCHECKSUM --no-check --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo # Restart the DB server with innodb_checksum_algorithm=crc32
---let $restart_parameters= --innodb_checksum_algorithm=crc32
---source include/start_mysqld.inc
-
-SELECT * FROM tab1;
-DELETE FROM tab1 where c1=3;
-SELECT c1,c2 FROM tab1 order by c1,c2;
-
---echo # Stop server
---source include/shutdown_mysqld.inc
-
---echo [17]: rewrite into new checksum=InnoDB
---exec $INNOCHECKSUM --no-check --write=InnoDB $MYSQLD_DATADIR/test/tab1.ibd
-
---echo # Restart the DB server with innodb_checksum_algorithm=InnoDB
---let $restart_parameters= --innodb_checksum_algorithm=innodb
---source include/start_mysqld.inc
-
-DELETE FROM tab1 where c1=2;
-SELECT * FROM tab1;
-
---echo # Stop server
---source include/shutdown_mysqld.inc
-
---echo [18]:check Innochecksum with invalid write options
---error 1
---exec $INNOCHECKSUM --no-check --write=strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN=Error while setting value \'strict_crc32\' to \'write\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --no-check --write=strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN=Error while setting value \'strict_innodb\' to \'write\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --no-check --write=crc23 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN=Error while setting value \'crc23\' to \'write\';
---source include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
-
-# Cleanup
---let $restart_parameters=
---source include/start_mysqld.inc
-
-DROP TABLE tab1;
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt b/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt
deleted file mode 100644
index 5bbafd986e5..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---skip-innodb-doublewrite
---innodb-file-per-table
---innodb-change-buffering=none
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test b/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test
deleted file mode 100644
index 330bb81ba75..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test
+++ /dev/null
@@ -1,118 +0,0 @@
-#************************************************************
-# WL6045:Improve Innochecksum
-#************************************************************
---source include/innodb_page_size_small.inc
---source include/have_debug.inc
---source include/no_valgrind_without_big.inc
-# Avoid CrashReporter popup on Mac.
---source include/not_crashrep.inc
-
---source include/not_embedded.inc
--- source include/big_test.inc
-
---disable_query_log
-# This warning occurs due to small buffer pool size(i.e. 8MB). It doesn't occur
-# with --mysqld=--innodb_buffer_pool_size=10MB
-call mtr.add_suppression("\\[Warning\\] InnoDB: Difficult to find free blocks in the buffer pool.*");
---enable_query_log
-let MYSQLD_BASEDIR= `SELECT @@basedir`;
-let MYSQLD_DATADIR= `SELECT @@datadir`;
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
-
-SET GLOBAL innodb_compression_level=0;
-SELECT @@innodb_compression_level;
-
-CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
-let $i=10;
-while ($i > 0) {
- INSERT INTO t1 SELECT * from t1;
- dec $i;
-}
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
-# Page_type_dump for t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/t1.ibd
---file_exists $MYSQLTEST_VARDIR/tmp/dump.txt
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
---echo [1]:# check the both short and long options for "help"
---exec $INNOCHECKSUM --help $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_long.txt
---exec $INNOCHECKSUM -I $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_short.txt
---diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/help_output_short.txt
-
---echo [2]:# Run the innochecksum when file isn't provided.
---echo # It will print the innochecksum usage similar to --help option.
---error 1
---exec $INNOCHECKSUM > $MYSQLTEST_VARDIR/tmp/usage.txt
---diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/usage.txt
---remove_file $MYSQLTEST_VARDIR/tmp/usage.txt
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-my $file= 'help_output_long.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
-while(<IN_FILE>) {
- unless ($_=~ /^debug.*$/ || $_=~ /\-#, \-\-debug.*$/ || $_=~ /http:.*html/) {
- $_=~ s/^\S*innochecksum.+Ver.+[0-9]*\.[0-9]*\.[0-9]*.+$/innochecksum Ver #.#.#/g;
- $_=~ s/(Copyright\s\(c\))\s([0-9]*),\s([0-9]*)(.*)/$1 YEAR, YEAR $4/g;
- $_=~ s/Usage:.*\[-c/Usage: innochecksum [-c/g;
- print OUT_FILE $_;
- }
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
-EOF
-
---cat_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt
---remove_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt
---remove_file $MYSQLTEST_VARDIR/tmp/help_output_short.txt
-
---echo [3]:# check the both short and long options for "count" and exit
---replace_regex /[0-9]+/#/
---exec $INNOCHECKSUM --count $MYSQLD_DATADIR/test/t1.ibd
---replace_regex /[0-9]+/#/
---exec $INNOCHECKSUM -c $MYSQLD_DATADIR/test/t1.ibd
-
---echo [4]:# Print the version of innochecksum and exit
---replace_regex /.*innochecksum.*Ver.*[0-9]*.[0-9]*.[0-9]*.*/innochecksum Ver #.#.#/
---exec $INNOCHECKSUM -V $MYSQLD_DATADIR/test/t1.ibd
-
---echo # Restart the DB server
---source include/start_mysqld.inc
-
-DROP TABLE t1;
-
---echo [5]:# Check the innochecksum for compressed table t1 with different key_block_size
---echo # Test for KEY_BLOCK_SIZE=1
---let $size=1
---source ../include/innodb-wl6045.inc
-
---echo # Test for KEY_BLOCK_SIZE=2
---let $size=2
---source ../include/innodb-wl6045.inc
-
---echo # Test for for KEY_BLOCK_SIZE=4
---let $size=4
---source ../include/innodb-wl6045.inc
-
-set innodb_strict_mode=off;
---echo # Test for for KEY_BLOCK_SIZE=8
---let $size=8
---source ../include/innodb-wl6045.inc
-
-set innodb_strict_mode=off;
---echo # Test for KEY_BLOCK_SIZE=16
---let $size=16
---source ../include/innodb-wl6045.inc
---echo # Test[5] completed
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt b/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt
deleted file mode 100644
index 302a9872a26..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb-file-per-table
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test b/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test
deleted file mode 100644
index dab10dcc997..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test
+++ /dev/null
@@ -1,406 +0,0 @@
-#************************************************************
-# WL6045:Improve Innochecksum
-#************************************************************
---source include/innodb_page_size_small.inc
-
---source include/no_valgrind_without_big.inc
-
-# Embedded server does not support crashing.
---source include/not_embedded.inc
-
-# Avoid CrashReporter popup on Mac.
---source include/not_crashrep.inc
-
---echo # Set the environmental variables
-let MYSQLD_BASEDIR= `SELECT @@basedir`;
-let MYSQLD_DATADIR= `SELECT @@datadir`;
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
-
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to.*");
-
---echo [1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server.
-
-CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY,
-linestring_key GEOMETRY NOT NULL,
-linestring_nokey GEOMETRY NOT NULL)
-ENGINE=InnoDB ;
-
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (1, ST_GeomFromText('POINT(10 10) '), ST_GeomFromText('POINT(10 10) '));
-
-CREATE INDEX linestring_index ON tab1(linestring_nokey(5));
-ALTER TABLE tab1 ADD KEY (linestring_key(5));
-
---echo # create a compressed table
-CREATE TABLE tab2(col_1 CHAR (255) ,
-col_2 VARCHAR (255), col_3 longtext,
-col_4 longtext,col_5 longtext,
-col_6 longtext , col_7 int )
-engine = innodb row_format=compressed key_block_size=4;
-
-CREATE INDEX idx1 ON tab2(col_3(10));
-CREATE INDEX idx2 ON tab2(col_4(10));
-CREATE INDEX idx3 ON tab2(col_5(10));
-
-# load the with repeat function
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-
-# insert 5 records
-let $i = 5;
-while ($i) {
- eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
- VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
- dec $i;
-}
-
---disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [1(a)]: Rewrite into new checksum=InnoDB for all *.ibd file and ibdata1
---exec $INNOCHECKSUM --write=InnoDB $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --write=InnoDB $MYSQLD_DATADIR/test/tab2.ibd
---exec $INNOCHECKSUM --write=InnoDB $MYSQLD_DATADIR/ibdata1
-perl;
-foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=InnoDB $_")
-}
-EOF
-
---echo : start the server with innodb_checksum_algorithm=strict_innodb
---let $restart_parameters= --innodb_checksum_algorithm=strict_innodb
---source include/start_mysqld.inc
-
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (2, ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'), ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'));
-
-# load the with repeat function
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-
-# check the table status is GOOD with DML
-let $i = 6;
-eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
-
--- disable_result_log
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-
--- disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [1(b)]: Rewrite into new checksum=crc32 for all *.ibd file and ibdata1
---exec $INNOCHECKSUM --write=CRC32 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --write=CRC32 $MYSQLD_DATADIR/test/tab2.ibd
---exec $INNOCHECKSUM --write=CRC32 $MYSQLD_DATADIR/ibdata1
-perl;
-foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=crc32 $_")
-}
-EOF
-
---echo # start the server with innodb_checksum_algorithm=strict_crc32
---let $restart_parameters= --innodb_checksum_algorithm=strict_crc32
---source include/start_mysqld.inc
-
-# check the table status is GOOD with DML
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (3, ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'),
-ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'));
-
-# load the with repeat function
-SET @col_1 = repeat('g', 5);
-SET @col_2 = repeat('h', 20);
-SET @col_3 = repeat('i', 100);
-SET @col_4 = repeat('j', 100);
-SET @col_5 = repeat('k', 100);
-SET @col_6 = repeat('l', 100);
-
-# check the table status is GOOD with DML
-let $i = 7;
-eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
-
-# check the records from table
--- disable_result_log
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-
--- disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [1(c)]: Rewrite into new checksum=none for all *.ibd file and ibdata1
---exec $INNOCHECKSUM --write=none $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --write=none $MYSQLD_DATADIR/test/tab2.ibd
---exec $INNOCHECKSUM --write=none $MYSQLD_DATADIR/ibdata1
-perl;
-foreach (glob("$ENV{MYSQLD_DATADIR}/undo*")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=NONE $_")
-}
-foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=NONE $_")
-}
-EOF
-
---let $restart_parameters= --innodb_checksum_algorithm=strict_none
---source include/start_mysqld.inc
---let $restart_parameters=
-# check the table status is GOOD with DML
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (4, ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '), ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '));
-
-# load the with repeat function
-SET @col_1 = repeat('m', 5);
-SET @col_2 = repeat('n', 20);
-SET @col_3 = repeat('o', 100);
-SET @col_4 = repeat('p', 100);
-SET @col_5 = repeat('q', 100);
-SET @col_6 = repeat('r', 100);
-
-# check the table status is GOOD with DML
-let $i = 8;
-eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
-
-# check the records from table
--- disable_result_log
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-
---disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
---enable_result_log
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [2]: Check the page type summary with shortform for tab1.ibd
---replace_regex /File.*.ibd/File::tab1.ibd/ /[0-9]+/#/
---exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/tab1.ibd 2>$MYSQLTEST_VARDIR/tmp/page_summary_short.txt
-
---echo [3]: Check the page type summary with longform for tab1.ibd
---replace_regex /File.*.ibd/File::tab1.ibd/ /[0-9]+/#/
---exec $INNOCHECKSUM --page-type-summary $MYSQLD_DATADIR/test/tab1.ibd 2>$MYSQLTEST_VARDIR/tmp/page_summary_long.txt
-
---remove_file $MYSQLTEST_VARDIR/tmp/page_summary_short.txt
---remove_file $MYSQLTEST_VARDIR/tmp/page_summary_long.txt
---echo [4]: Page type dump for with longform for tab1.ibd
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $INNOCHECKSUM --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-opendir(DIR, $dir) or die $!;
-my $file= 'dump.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!;
-while(<IN_FILE>)
-{
- # Replace the intergers to # and complete file path to file name only.
- $_=~ s/Filename.+/Filename::tab1.ibd/g;
- $_=~ s/\d+/#/g;
- print OUT_FILE $_;
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file");
-closedir(DIR);
-EOF
-
---echo # Print the contents stored in dump.txt
-cat_file $MYSQLTEST_VARDIR/tmp/dump.txt;
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
---echo # Variables used by page type dump for ibdata1
---exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/ibdata1 > $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt
-
---file_exists $MYSQLTEST_VARDIR/tmp/dump.txt
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-opendir(DIR, $dir) or die $!;
-my $file= 'page_verbose_summary.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!;
-while(<IN_FILE>)
-{
- # Replace complete file path to file name only.
- $_=~ s/$dir/MYSQLTEST_VARDIR/;
- # Remove debug option, which is not in all builds
- next if (/debug/);
- print OUT_FILE $_;
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file");
-closedir(DIR);
-EOF
-
-cat_file $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt;
---remove_file $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt
-
---echo [5]: Page type dump for with shortform for tab1.ibd
---exec $INNOCHECKSUM -D $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-opendir(DIR, $dir) or die $!;
-my $file= 'dump.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!;
-while(<IN_FILE>)
-{
- # Replace the intergers to # and complete file path to file name only.
- $_=~ s/Filename.+/Filename::tab1.ibd/g;
- $_=~ s/\d+/#/g;
- print OUT_FILE $_;
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file");
-closedir(DIR);
-EOF
-
-# Print the contents stored in dump.txt
-cat_file $MYSQLTEST_VARDIR/tmp/dump.txt;
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
---echo [6]: check the valid lower bound values for option
---echo # allow-mismatches,page,start-page,end-page
---exec $INNOCHECKSUM --allow-mismatches=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -a 0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --page=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -p 0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --start-page=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -s 0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --end-page=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -e 0 $MYSQLD_DATADIR/test/tab1.ibd
-
-#
-# These produce now errors
-#
-#--echo [7]: check the negative values for option
-#--echo # allow-mismatches,page,start-page,end-page.
-#--echo # They will reset to zero for negative values.
-#--echo # check the invalid lower bound values
-#--exec $INNOCHECKSUM --allow-mismatches=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -a -1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --page=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -p -1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --start-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -s -1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --end-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -e -1 $MYSQLD_DATADIR/test/tab1.ibd
-#
-#--echo [8]: check the valid upper bound values for
-#--echo # both short and long options "allow-mismatches" and "end-page"
-#
-#--exec $INNOCHECKSUM --allow-mismatches=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -a 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --end-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -e 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [9]: check the both short and long options "page" and "start-page" when
---echo # seek value is larger than file size.
---error 1
---exec $INNOCHECKSUM --page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -p 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --start-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -s 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---echo [34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page.
---echo # innochecksum will fail with error code: 1
---error 1
---exec $INNOCHECKSUM --allow-mismatches=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -a 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --end-page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -e 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -p 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --start-page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -s 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
-
-# Cleanup
---source include/start_mysqld.inc
-
-DROP TABLE tab1,tab2;
diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test
index fd7fbe94450..b1679023e11 100644
--- a/mysql-test/suite/innodb/t/instant_alter.test
+++ b/mysql-test/suite/innodb/t/instant_alter.test
@@ -397,6 +397,242 @@ ALTER TABLE t1 ADD COLUMN t TEXT;
SELECT * FROM t1;
DROP TABLE t1;
+#
+# MDEV-17735 Assertion failure in row_parse_int() on first ADD/DROP COLUMN
+# when an AUTO_INCREMENT column is not in PRIMARY KEY
+#
+eval CREATE TABLE t1 (a INT AUTO_INCREMENT, b INT, KEY(a)) $engine;
+INSERT INTO t1 SET a=NULL;
+ALTER TABLE t1 DROP COLUMN b;
+ALTER TABLE t1 ADD COLUMN c INT NOT NULL DEFAULT 42;
+INSERT INTO t1 SET a=NULL;
+UPDATE t1 SET a=a+2;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+eval CREATE TABLE t1 (i INT) $engine;
+INSERT INTO t1 SET i=1;
+ALTER TABLE t1 ADD COLUMN b BIT FIRST;
+ALTER TABLE t1 ADD COLUMN v INT AS (i) VIRTUAL;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# MDEV-17721 Corrupted data dictionary after instant DROP COLUMN
+eval CREATE TABLE t1 (ts TIMESTAMP) $engine;
+ALTER TABLE t1 ADD COLUMN f VARCHAR(8), ADD COLUMN dt DATETIME;
+ALTER TABLE t1 ADD COLUMN b BIT, DROP COLUMN f, ADD COLUMN t TIME FIRST;
+ALTER TABLE t1 ADD COLUMN ts2 TIMESTAMP;
+DROP TABLE t1;
+
+eval CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) $engine;
+INSERT INTO t1 VALUES (4,4,4);
+ALTER TABLE t1 DROP f1, DROP f2, ADD f4 INT, ADD f5 INT;
+DELETE FROM t1;
+ALTER TABLE t1 DROP COLUMN f4;
+DROP TABLE t1;
+
+eval CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) $engine;
+ALTER TABLE t1 DROP f2, ADD COLUMN f4 INT;
+ALTER TABLE t1 DROP f4;
+ALTER TABLE t1 DROP f1;
+DROP TABLE t1;
+
+# MDEV-17901 Crash after instant DROP COLUMN of AUTO_INCREMENT column
+eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) $engine;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 () VALUES (),();
+SELECT * FROM t1;
+# Adding AUTO_INCREMENT column will always require rebuild.
+ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# MDEV-18149 Crash after DROP COLUMN of AUTO_INCREMENT column on nonempty table
+eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) $engine;
+INSERT INTO t1 SET f=NULL;
+ALTER TABLE t1 DROP COLUMN id;
+INSERT INTO t1 SET f=NULL;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# MDEV-18076/MDEV-18077 Crash on AUTO_INCREMENT column after instant DROP
+eval CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) $engine;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+
+eval CREATE TABLE t1(pk INT PRIMARY KEY, f INT, k INT AUTO_INCREMENT, KEY(k))
+$engine;
+ALTER TABLE t1 DROP COLUMN f;
+INSERT INTO t1 (pk) VALUES (1);
+DROP TABLE t1;
+
+# MDEV-17763 Assertion `len == 20U' failed in rec_convert_dtuple_to_rec_comp
+# upon DROP COLUMN
+eval CREATE TABLE t1 (
+ pk INT PRIMARY KEY,
+ f1 INT,
+ f2 CHAR(255),
+ f3 BIGINT,
+ f4 INT,
+ f5 CHAR(255),
+ f6 CHAR(255),
+ f7 CHAR(255) NOT NULL,
+ f8 INT,
+ f9 CHAR(10)
+) $engine;
+
+INSERT INTO t1 VALUES
+ (1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
+ (2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
+ (3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
+ (4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
+ (5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
+ (6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
+ (7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
+ (8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
+ (9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
+ (10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
+ (11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
+ (12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
+ (13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
+ (14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
+ (15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
+
+DELETE FROM t1 WHERE pk=1;
+--source include/wait_all_purged.inc
+INSERT INTO t1 VALUES
+ (1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
+ALTER TABLE t1 DROP COLUMN f1;
+DROP TABLE t1;
+
+# MDEV-17820 Assertion failures on DROP COLUMN
+eval CREATE TABLE t1 (
+ pk INT PRIMARY KEY,
+ f1 INT, f2 CHAR(32) NOT NULL,
+ f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL,
+ f7 CHAR(32), f8 CHAR(32)
+) $engine;
+
+INSERT INTO t1 VALUES
+ (1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''),
+ (3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''),
+ (5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''),
+ (7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''),
+ (9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''),
+ (11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''),
+ (13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''),
+ (15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''),
+ (17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''),
+ (19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''),
+ (21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''),
+ (23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''),
+ (25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''),
+ (51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''),
+ (53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''),
+ (55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''),
+ (57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''),
+ (59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''),
+ (61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''),
+ (63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''),
+ (101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''),
+ (103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''),
+ (105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''),
+ (107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''),
+ (109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''),
+ (151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''),
+ (153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''),
+ (155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''),
+ (157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''),
+ (159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''),
+ (201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''),
+ (203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''),
+ (205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''),
+ (207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''),
+ (252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''),
+ (254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''),
+ (256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''),
+ (258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''),
+ (301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''),
+ (303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''),
+ (305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''),
+ (307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''),
+ (351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''),
+ (353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''),
+ (355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''),
+ (357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''),
+ (359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''),
+ (361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''),
+ (363,75,'',66,76,52,'','','');
+
+ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar ';
+UPDATE t1 SET f1 = 0;
+ALTER TABLE t1 DROP COLUMN x;
+DROP TABLE t1;
+
+eval CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) $engine;
+ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST;
+DROP TABLE t1;
+
+# MDEV-18035 Failing assertion on DELETE
+eval CREATE TABLE t1 (a INT UNIQUE, b INT UNIQUE, PRIMARY KEY(a,b)) $engine;
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 CHANGE COLUMN a a INT;
+DELETE FROM t1 WHERE a = NULL OR a IS NULL;
+DROP TABLE t1;
+
+# MDEV-18048 Failing assertion on ALTER
+eval CREATE TABLE t1 (a INT, b INT, c INT NOT NULL, d INT,
+e INT, f INT, g INT, h INT, j INT) $engine;
+ALTER TABLE t1 MODIFY COLUMN c INT, MODIFY COLUMN a INT AFTER b;
+DROP TABLE t1;
+
+# MDEV-18033/MDEV-18034 Failing assertion on ALTER
+eval CREATE TABLE t1 (a INT NOT NULL) $engine;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ADD COLUMN b INT;
+ALTER TABLE t1 MODIFY COLUMN a INT NULL;
+DROP TABLE t1;
+
+# MDEV-18160/MDEV-18162 Failing assertion on ALTER
+eval CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT) $engine;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+
+eval CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT) $engine;
+INSERT INTO t1 SET a=1;
+ALTER TABLE t1 DROP c;
+ALTER TABLE t1 DROP b, ADD v INT AS (a);
+DROP TABLE t1;
+
+# MDEV-18218 Assertion `0' failed in btr_page_reorganize_low upon DROP COLUMN
+eval CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, b BLOB NOT NULL) $engine;
+INSERT INTO t1 VALUES (1,10,REPEAT('foobar',2000));
+ALTER TABLE t1 DROP COLUMN b;
+INSERT INTO t1 VALUES (2,20);
+# this evicts and reloads the table definition until MDEV-17468 is fixed
+ALTER TABLE t1 ADD COLUMN vpk INT AS (pk);
+# this would load wrong metadata from the previous DROP COLUMN b, causing a crash
+ALTER TABLE t1 DROP COLUMN i;
+DROP TABLE t1;
+
+# MDEV-18315 Assertion instant.fields[i].col->same_format(*fields[i].col)
+# failed in dict_index_t::instant_add_field
+eval CREATE TABLE t1 (a INT, b INT) $engine;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD f DATE AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
+
+# MDEV-18316 Assertion is_added() failed in dict_col_t::instant_value
+eval CREATE TABLE t1 (a INT, b INT) $engine;
+INSERT INTO t1 VALUES (1,1);
+ALTER TABLE t1 ADD COLUMN f INT AFTER a;
+ALTER TABLE t1 DROP b, DROP f;
+DROP TABLE t1;
+
dec $format;
}
disconnect analyze;
diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test
new file mode 100644
index 00000000000..18ace4cc521
--- /dev/null
+++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test
@@ -0,0 +1,138 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-17821 Assertion `!page_rec_is_supremum(rec)' failed
+--echo # in btr_pcur_store_position
+--echo #
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, c INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2);
+ALTER TABLE t1 ADD COLUMN f VARCHAR(255);
+ALTER TABLE t1 DROP COLUMN f;
+DELETE FROM t1;
+HANDLER t1 OPEN;
+HANDLER t1 READ `PRIMARY` <= (3);
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ pk INT AUTO_INCREMENT,
+ f1 CHAR(32),
+ f2 CHAR(32),
+ f3 CHAR(32),
+ f4 INT,
+ f5 CHAR(32),
+ f6 INT,
+ f7 INT,
+ f8 INT,
+ PRIMARY KEY (pk),
+ UNIQUE (f6)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES
+ ('reality', 'llt', 'within', -1996816384, 'j', 160, 7, -1822687232),
+ ('h', 'j', 'j', 251, 'civilian', NULL, 211, NULL),
+ ('ltq', 'b', 'mud', 111, 'v', 90, 0, NULL),
+ ('toxic', 'breakfast', 'series', 2, 'x', NULL, 118, 2),
+ ('h', 'n', 'vision', 84, 'n', NULL, 197, 103),
+ ('h', 'tq', 'q', 6, 'bet', -1927151616, -446038016, 3),
+ ('pocket', 'qjt', 'jtl', 0, 'blink', NULL, 12, 0),
+ ('k', 'uv', 'exist', 37, 'g', 149, -1610219520, NULL),
+ ('parent', 'motion', 'u', 70, 'promote', NULL, 178, NULL),
+ ('get', 'convict', 'liquid', -780337152, 'd', NULL, 4, NULL),
+ ('vp', 'px', 'xi', -631111680, 'support', NULL, 8, NULL),
+ ('ck', 'z', 'minority', 8, 'k', NULL, 864878592, NULL),
+ ('kxx', 'g', 'container', 1, 'cholesterol', NULL, 4, 1404436480),
+ ('xxv', 'rail', 'j', 219, 'serious', NULL, -816119808, 62),
+ ('x', 'v', 'vr', 146, 'm', 16, 170, -1765867520),
+ ('age', 'm', 'q', -1251278848, 'rte', 6, 224, NULL),
+ ('discrimination', 't', 'q', 31, 'exl', 0, 2, 244),
+ ('water', 'x', 'ldb', 98, 'r', 235, 4, 63),
+ ('d', 'db', 'p', 248, 'so-called', 102, -255524864, 198),
+ ('last', 'bz', 'us', 0, 'experienced', 137, 240, 134),
+ ('q', 'z', 'attract', 67, 'code', 67, 75, 1758920704),
+ ('yellow', 'c', 'u', 6, 'v', 1731985408, 528154624, 2),
+ ('cognitive', 'he', 'protective', 590020608, 'sentence', NULL, 4, 102),
+ ('eih', 'l', 'ih', 1266024448, 'traditionally', NULL, 190, NULL),
+ ('pine', 'i', 'y', 6, 'glimpse', 214, 7, -1486880768),
+ ('jo', 'everyone', 'ol', 0, 'lj', NULL, 1, 0),
+ ('blood', 'f', 'scientist', 54, 'j', 1341128704, 168, NULL),
+ ('z', 'brief', 'ambassador', 115, 'ygp', 82, 129, NULL),
+ ('gp', 'severe', 'consist', 7, 'p', -1829961728, 602669056, 154),
+ ('admit', 'poetry', 'x', 116, 'enemy', 174, -2128543744, -407764992),
+ ('s', 'norm', 'decide', 2055667712, 'rtz', NULL, 99, -1233715200),
+ ('tzg', 'f', 'beg', 2016280576, 'w', NULL, -643825664, 137),
+ ('zgg', 'x', 'f', 148, 'y', -987496448, -708116480, 8),
+ ('attorney', 'perfectly', 's', 49, 'z', -1865285632, 56, -1518534656),
+ ('concentrate', 's', 'k', -1028849664, 'tir', 83, -1592459264, 1820065792),
+ ('t', 'sacrifice', 'ir', -2143879168, 'recipe', 156, 217, NULL),
+ ('wdf', 'd', 'f', 137, 'empty', NULL, 188, NULL),
+ ('o', 'customer', 'qd', -2135293952, 'z', 1527840768, 227, -1174929408),
+ ('d', 'qow', 'o', 1472266240, 'whe', NULL, 7, 197),
+ ('deny', 'reputation', 'dutch', 59, 'v', 124, 2, 191),
+ ('m', 'liver', 'fv', 0, 'policy', 781582336, 198574080, 177),
+ ('vk', 'kx', 'immigrant', -1452736512, 'x', 163, 76, 6) ,
+ ('j', 'ru', 'r', 67, 'joke', NULL, 3, NULL),
+ ('o', 'u', 'a', -569442304, 'uz', NULL, 933298176, NULL),
+ ('g', 'zb', 'c', -1694760960, 'fish', 18, -390463488, 1),
+ ('bb', 'o', 'b', 6, 'z', 9, 12, NULL),
+ ('compelling', 'xe', 'debut', 89, 'e', -734724096, 119, 175),
+ ('md', 'r', 'object', 1046478848, 'frequently', 915537920, 0, 1506410496),
+ ('dwn', 'wnz', 'x', 1767571456, 'nz', 241, -882180096, 9),
+ ('zvf', 'vfo', 'g', -844824576, 'w', NULL, 1, 9),
+ ('w', 'pose', 'r', 1029308416, 'a', -48627712, 1756168192, NULL),
+ ('o', 'jwp', 'patient', 172, 'i', 297140224, 45809664, 3),
+ ('w', 'p', 'american', 450297856, 'z', 20, 4, 186),
+ ('ridiculous', 'helpful', 'vy', -2022899712, 'conspiracy', NULL, 162, -264634368),
+ ('t', 'g', 'spite', 289931264, 'y', 4, 13, NULL),
+ ('performer', 'i', 'tomato', -1519386624, 'mz', 8, 87, 106),
+ ('m', 'z', 'hang', 3, 'crowded', -537919488, 1, 2),
+ ('fu', 'uot', 'j', 1, 'o', 179, 220, -2084569088),
+ ('ts', 'n', 'su', 1, 'o', 198, 9, 68),
+ ('ball', 'halfway', 'uf', 40, 'l', 145948672, 9, 149),
+ ('hunting', 'n', 'teenager', 0, 'neat', 209, 2044461056, 68),
+ ('independent', 'along', 'fpn', 5, 'pn', 3, 1353252864, 217),
+ ('p', 'presumably', 'n', -1977548800, 'balanced', 1909260288, 197, NULL),
+ ('pink', 'h', 'tear', 8, 'n', 254, 8, 1006305280),
+ ('tyy', 'n', 'yyr', 1107820544, 'yr', NULL, 0, 219),
+ ('u', 'retirement', 'thread', -2083192832, 'rx', -678232064, 209, 1048969216),
+ ('xk', 'kb', 'z', 9, 'ba', 218, 7, 8),
+ ('a', 'plenty', 'forget', 36, 'c', 215, 2027094016, NULL),
+ ('i', 'compromise', 'n', -1090256896, 'o', 10, 66, 1872887808),
+ ('x', 'disappointment', 'cognitive', 753860608, 'ua', 77, 123, 10),
+ ('e', 'added', 'aub', 2, 'u', NULL, 9, 92),
+ ('bc', 'h', 'n', 146, 'master', NULL, 1003945984, NULL),
+ ('execution', 'f', 'cgp', 574423040, 'gp', 2, -518782976, -1189085184),
+ ('pv', 'bad', 'v', 132, 'r', 195, 6, 5),
+ ('modify', 'participation', 'vol', 237, 'j', -842924032, 88, -747765760),
+ ('substantially', 'i', 'congressional', 2, 'edit', NULL, 1003159552, NULL),
+ ('tell', 'forty', 'v', -910098432, 'd', 43, 3, NULL),
+ ('crawl', 'ad', 'respect', -1851195392, 'p', 72, -1709047808, 1343225856),
+ ('w', 'reception', 'fiber', 56, 's', NULL, 2, -993787904),
+ ('successful', 'instruct', 'dug', 2, 'u', 7, -411500544, NULL),
+ ('appointment', 'pregnant', 'weird', 2, 'r', NULL, -897384448, 76),
+ ('g', 'j', 'thin', 663617536, 'oan', 1, 7, NULL),
+ ('secretary', 'a', 'o', 103, 'nj', 1977745408, -1291124736, -1314521088),
+ ('g', 'jq', 'q', 1875116032, 'blame', NULL, 1, 4),
+ ('oj', 'j', 'breast', 150, 'c', NULL, 3, NULL),
+ ('rd', 'm', 'comprehensive', 1723334656, 't', NULL, 155, -312344576) ,
+ ('a', 'd', 'criminal', -1155137536, 'airplane', 242, -662896640, 1),
+ ('fast', 'i', 'k', -386662400, 'zxe', NULL, 7, 119),
+ ('xe', 'mouse', 'c', -205717504, 'ew', NULL, -729612288, 86),
+ ('hang', 'j', 'o', 3, 'hungry', NULL, 200, 49),
+ ('expense', 'z', 'sum', 2, 'gob', -472055808, -538181632, NULL),
+ ('nest', 'o', 'k', 116, 'weak', NULL, 223, NULL);
+--error ER_DUP_ENTRY
+INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3);
+
+ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT '';
+SELECT * INTO OUTFILE 'load.data' FROM t1;
+UPDATE IGNORE t1 SET pk = 0;
+LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1;
+HANDLER t1 OPEN AS h;
+HANDLER h READ `PRIMARY` PREV WHERE 0;
+
+# Cleanup
+HANDLER h CLOSE;
+DROP TABLE t1;
+--let $datadir= `select @@datadir`
+--remove_file $datadir/test/load.data
diff --git a/mysql-test/suite/innodb/t/instant_alter_crash.test b/mysql-test/suite/innodb/t/instant_alter_crash.test
index b1615041393..d16ee6c929a 100644
--- a/mysql-test/suite/innodb/t/instant_alter_crash.test
+++ b/mysql-test/suite/innodb/t/instant_alter_crash.test
@@ -16,7 +16,7 @@ let MYSQLD_DATADIR=`select @@datadir`;
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES(1,2);
+INSERT INTO t1 VALUES(0,2);
BEGIN;
INSERT INTO t2 VALUES(2,1);
ALTER TABLE t2 ADD COLUMN (c3 TEXT NOT NULL DEFAULT 'De finibus bonorum');
@@ -29,7 +29,7 @@ ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT NULL DEFAULT ' et malorum');
connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-COMMIT;
+INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium');
--source include/kill_mysqld.inc
disconnect ddl;
@@ -54,7 +54,7 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere';
connection default;
SET DEBUG_SYNC='now WAIT_FOR ddl';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-DELETE FROM t1;
+UPDATE t1 SET c2=c2+1;
--source include/kill_mysqld.inc
disconnect ddl;
@@ -91,6 +91,10 @@ disconnect ddl;
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_PATTERN= \[Note\] InnoDB: Rolled back recovered transaction ;
+-- source include/search_pattern_in_file.inc
+
SELECT * FROM t1;
SELECT * FROM t2;
BEGIN;
diff --git a/mysql-test/suite/innodb/t/instant_alter_debug.test b/mysql-test/suite/innodb/t/instant_alter_debug.test
index 05812322317..fcccbd9a750 100644
--- a/mysql-test/suite/innodb/t/instant_alter_debug.test
+++ b/mysql-test/suite/innodb/t/instant_alter_debug.test
@@ -5,6 +5,10 @@
SET @save_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+SET @old_instant=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_instant_alter_column');
+
CREATE TABLE t1 (
pk INT AUTO_INCREMENT PRIMARY KEY,
c1 INT,
@@ -296,4 +300,40 @@ SET DEBUG_SYNC = RESET;
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-17899 Assertion failures on rollback of instant ADD/DROP
+--echo # MDEV-18098 Crash after rollback of instant DROP COLUMN
+--echo #
+
+SET @save_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,ib_commit_inplace_fail_1';
+CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2);
+--error ER_INTERNAL_ERROR
+ALTER TABLE t1 DROP COLUMN b;
+--error ER_INTERNAL_ERROR
+ALTER TABLE t1 DROP COLUMN b;
+--error ER_INTERNAL_ERROR
+ALTER TABLE t1 ADD COLUMN c INT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
+--error ER_INTERNAL_ERROR
+ALTER TABLE t1 ADD COLUMN c INT;
+BEGIN;
+INSERT INTO t1 VALUES(1, 1);
+ROLLBACK;
+--error ER_INTERNAL_ERROR
+ALTER TABLE t1 DROP COLUMN b;
+INSERT INTO t1 values (1,1);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+SET debug_dbug = @save_dbug;
+
+SELECT variable_value-@old_instant instants
+FROM information_schema.global_status
+WHERE variable_name = 'innodb_instant_alter_column';
+
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
diff --git a/mysql-test/suite/innodb/t/instant_alter_null.test b/mysql-test/suite/innodb/t/instant_alter_null.test
new file mode 100644
index 00000000000..69fb1ae4495
--- /dev/null
+++ b/mysql-test/suite/innodb/t/instant_alter_null.test
@@ -0,0 +1,57 @@
+--source include/have_innodb.inc
+
+create table t (a int NOT NULL) engine=innodb row_format= compressed;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t modify a int NULL, algorithm=instant;
+drop table t;
+
+create table t (a int NOT NULL) engine=innodb row_format= dynamic;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t modify a int NULL, algorithm=instant;
+drop table t;
+
+create table t (a int NOT NULL) engine=innodb row_format= compact;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t modify a int NULL, algorithm=instant;
+drop table t;
+
+create table t (
+ id int primary key,
+ a int NOT NULL default 0,
+ b int NOT NULL default 0,
+ c int NOT NULL default 0,
+ index idx (a,b,c)
+) engine=innodb row_format=redundant;
+
+--error ER_BAD_NULL_ERROR
+insert into t (id, a) values (0, NULL);
+--error ER_BAD_NULL_ERROR
+insert into t (id, b) values (0, NULL);
+--error ER_BAD_NULL_ERROR
+insert into t (id, c) values (0, NULL);
+
+insert into t values (1,1,1,1);
+
+set @id = (select table_id from information_schema.innodb_sys_tables
+where name = 'test/t');
+
+--replace_column 1 TABLE_ID
+select * from information_schema.innodb_sys_columns where table_id=@id;
+
+alter table t modify a int NULL, algorithm=instant;
+insert into t values (2, NULL, 2, 2);
+
+alter table t modify b int NULL, algorithm=nocopy;
+insert into t values (3, NULL, NULL, 3);
+
+alter table t modify c int NULL, algorithm=inplace;
+insert into t values (4, NULL, NULL, NULL);
+
+--replace_column 1 TABLE_ID
+select * from information_schema.innodb_sys_columns where table_id=@id;
+
+select * from t;
+
+check table t;
+
+drop table t;
diff --git a/mysql-test/suite/innodb/t/instant_alter_purge.test b/mysql-test/suite/innodb/t/instant_alter_purge.test
new file mode 100644
index 00000000000..152d200d977
--- /dev/null
+++ b/mysql-test/suite/innodb/t/instant_alter_purge.test
@@ -0,0 +1,75 @@
+--source include/have_innodb.inc
+--source include/maybe_debug.inc
+if ($have_debug) {
+--source include/have_debug_sync.inc
+}
+
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+
+--echo #
+--echo # MDEV-17793 Crash in purge after instant DROP and emptying the table
+--echo #
+
+connect (prevent_purge,localhost,root);
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+connection default;
+CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 () VALUES ();
+ALTER TABLE t1 DROP f2, ADD COLUMN f2 INT;
+ALTER TABLE t1 DROP f1;
+DELETE FROM t1;
+
+connection prevent_purge;
+COMMIT;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+
+ALTER TABLE t1 ADD COLUMN extra TINYINT UNSIGNED NOT NULL DEFAULT 42;
+let $wait_all_purged= 1;
+--source include/wait_all_purged.inc
+ALTER TABLE t1 DROP extra;
+disconnect prevent_purge;
+let $wait_all_purged= 0;
+--source include/wait_all_purged.inc
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17813 Crash in instant ALTER TABLE due to purge
+--echo # concurrently emptying table
+--echo #
+CREATE TABLE t1 (f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 SET f2=1;
+ALTER TABLE t1 ADD COLUMN f1 INT;
+
+connect (purge_control,localhost,root);
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+connection default;
+DELETE FROM t1;
+
+if ($have_debug) {
+SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL go WAIT_FOR do';
+}
+send ALTER TABLE t1 ADD COLUMN f3 INT;
+
+connection purge_control;
+if ($have_debug) {
+SET DEBUG_SYNC='now WAIT_FOR go';
+}
+COMMIT;
+--source include/wait_all_purged.inc
+if ($have_debug) {
+SET DEBUG_SYNC='now SIGNAL do';
+}
+disconnect purge_control;
+
+connection default;
+reap;
+if ($have_debug) {
+SET DEBUG_SYNC=RESET;
+}
+DROP TABLE t1;
+
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
diff --git a/mysql-test/suite/innodb/t/instant_drop.test b/mysql-test/suite/innodb/t/instant_drop.test
index 7be4998dccd..566ac02b314 100644
--- a/mysql-test/suite/innodb/t/instant_drop.test
+++ b/mysql-test/suite/innodb/t/instant_drop.test
@@ -64,7 +64,8 @@ alter table t1 drop column f2, add column f3 int default 3, algorithm=instant;
select * from t1;
update t1 set f3 = 19;
select * from t1;
-alter table t1 drop column f1, add column f5 int default 10, algorithm=instant;
+alter table t1 drop column f1, add column f5 tinyint default 10 first,
+algorithm=instant;
insert into t1 values(4, 10);
select * from t1;
@@ -79,6 +80,10 @@ create table t3(f1 int, f2 int not null)engine=innodb;
insert into t3 values(1, 2);
alter table t3 drop column f2, add column f3 int default 1, add column f4 int default 4, algorithm=instant;
+create table t4(a varchar(1), b int, c int, primary key(a,b))engine=innodb;
+insert into t4 values('4',5,6);
+alter table t4 drop column c;
+
--source include/restart_mysqld.inc
select * from t1;
alter table t1 add column f6 int default 9,drop column f5, algorithm = instant;
@@ -93,6 +98,11 @@ show create table t2;
select * from t3;
alter table t3 add column f5 char(100) default repeat('a', 99), algorithm=instant;
+
+select * from t4;
+alter table t4 add column d varchar(5) default 'fubar';
+insert into t4 values('',0,'snafu');
--source include/restart_mysqld.inc
select * from t3;
-drop table t1,t2,t3;
+select * from t4;
+drop table t1,t2,t3,t4;
diff --git a/mysql-test/suite/innodb/t/instant_varchar_enlarge.test b/mysql-test/suite/innodb/t/instant_varchar_enlarge.test
new file mode 100644
index 00000000000..42689deca11
--- /dev/null
+++ b/mysql-test/suite/innodb/t/instant_varchar_enlarge.test
@@ -0,0 +1,8 @@
+--source include/have_innodb.inc
+
+# LEN must increase here
+create table t (a varchar(100)) engine=innodb;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+alter table t modify a varchar(110), algorithm=inplace;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+drop table t;
diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test
index 0aaf798e2b3..d85fbf08194 100644
--- a/mysql-test/suite/innodb/t/log_file_name_debug.test
+++ b/mysql-test/suite/innodb/t/log_file_name_debug.test
@@ -44,5 +44,7 @@ SELECT * FROM t1;
--let $restart_parameters=
--source include/restart_mysqld.inc
+# Initiate shutdown in order to issue a redo log checkpoint and to discard
+# the redo log record that was emitted due to '+d,fil_names_write_bogus'.
+--source include/restart_mysqld.inc
DROP TABLE t1;
-
diff --git a/mysql-test/suite/innodb/t/purge_thread_shutdown.test b/mysql-test/suite/innodb/t/purge_thread_shutdown.test
index 8a9a834454c..5be29b7a6a3 100644
--- a/mysql-test/suite/innodb/t/purge_thread_shutdown.test
+++ b/mysql-test/suite/innodb/t/purge_thread_shutdown.test
@@ -32,7 +32,9 @@ delete from t1 where a=3;
error ER_WRONG_VALUE_FOR_VAR;
set global innodb_fast_shutdown=0;
-let $me=`select connection_id()`;
+# Get id with space prefix to ensure that replace_result doesn't replace
+# the error code
+let $me=`select concat(' ', connection_id())`;
replace_result $me ID;
error ER_CONNECTION_KILLED;
eval kill $me;
diff --git a/mysql-test/suite/innodb/t/recovery_shutdown.test b/mysql-test/suite/innodb/t/recovery_shutdown.test
index d796189c724..3bd01653065 100644
--- a/mysql-test/suite/innodb/t/recovery_shutdown.test
+++ b/mysql-test/suite/innodb/t/recovery_shutdown.test
@@ -51,6 +51,12 @@ FLUSH TABLES;
--let $shutdown_timeout=60
--source include/restart_mysqld.inc
+# Perform a slow shutdown in order to roll back all recovered transactions
+# and to avoid locking conflicts with the DROP TABLE below.
+--disable_query_log
+SET GLOBAL innodb_fast_shutdown=0;
+--source include/restart_mysqld.inc
+
--disable_query_log
let $c = $trx;
while ($c)
diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test
index 284589a17c8..e979b5fffe0 100644
--- a/mysql-test/suite/innodb/t/table_flags.test
+++ b/mysql-test/suite/innodb/t/table_flags.test
@@ -216,3 +216,9 @@ DROP TABLE tr,tc,td,tz,tp;
--list_files $bugdir
--remove_files_wildcard $bugdir
--rmdir $bugdir
+
+call mtr.add_suppression("ERROR HY000: Can't create table `test`.`t1`");
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1(f1 INT, f2 VARCHAR(1), KEY k1(f2),
+ FULLTEXT KEY(f2),
+ FOREIGN KEY (f2) REFERENCES t1(f3))ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/t/truncate.test b/mysql-test/suite/innodb/t/truncate.test
index cf71ca83c4c..cd1d827e157 100644
--- a/mysql-test/suite/innodb/t/truncate.test
+++ b/mysql-test/suite/innodb/t/truncate.test
@@ -15,3 +15,38 @@ TRUNCATE TABLE t;
disconnect dml;
DROP TABLE t;
+
+--echo #
+--echo # MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED
+--echo #
+CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+TRUNCATE TABLE t1;
+--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 #
+SHOW TABLE STATUS;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17859 Operating system errors in file operations
+--echo # after failed CREATE
+--echo #
+let $MYSQLD_DATADIR= `select @@datadir`;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+call mtr.add_suppression("InnoDB: (Operating system )?[Ee]rror number");
+call mtr.add_suppression("InnoDB: Cannot create file '.*t1\\.ibd");
+FLUSH TABLES;
+--move_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/hidden.frm
+--error ER_TABLESPACE_EXISTS
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+--move_file $MYSQLD_DATADIR/test/hidden.frm $MYSQLD_DATADIR/test/t1.frm
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO
+--echo #
+CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+TRUNCATE t1;
+SELECT * FROM t1;
+DROP TEMPORARY TABLE t1;
diff --git a/mysql-test/suite/innodb/t/undo_truncate_recover.test b/mysql-test/suite/innodb/t/undo_truncate_recover.test
index 56647bcc567..d31bc7821ac 100644
--- a/mysql-test/suite/innodb/t/undo_truncate_recover.test
+++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test
@@ -38,13 +38,9 @@ update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
-# FIXME: remove this work-around, and generate less log!
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
-# FIXME: remove this work-around, and generate less log!
---let $restart_parameters= --innodb-buffer-pool-size=16m
--source include/start_mysqld.inc
drop table t1;
diff --git a/mysql-test/suite/innodb_fts/r/create.result b/mysql-test/suite/innodb_fts/r/create.result
index f3650fb3dc9..55c5c45f643 100644
--- a/mysql-test/suite/innodb_fts/r/create.result
+++ b/mysql-test/suite/innodb_fts/r/create.result
@@ -16,10 +16,10 @@ INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15);
# The data below is not 3-byte UTF-8, but 4-byte chars.
INSERT IGNORE INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84);
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x96\x95\xF0\x9F...' for column 't' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x96\x95\xF0\x9F...' for column `test`.`t`.`t` at row 1
INSERT IGNORE INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85);
Warnings:
-Warning 1366 Incorrect string value: '\xF0\x9F\x96\x96\xF0\x9F...' for column 't' at row 1
+Warning 1366 Incorrect string value: '\xF0\x9F\x96\x96\xF0\x9F...' for column `test`.`t`.`t` at row 1
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST
(REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5));
COUNT(*)
@@ -162,3 +162,19 @@ SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word'
len COUNT(*)
84 6
DROP TABLE t;
+#
+# MDEV-17923 Assertion memcmp(field, field_ref_zero, 7) failed in
+# trx_undo_page_report_modify upon optimizing table
+# under innodb_optimize_fulltext_only
+#
+CREATE TABLE t1 (f1 TEXT, f2 TEXT, FULLTEXT KEY (f2)) ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES ('foo'),('bar');
+DELETE FROM t1 LIMIT 1;
+ALTER TABLE t1 ADD FULLTEXT KEY (f1);
+SET @optimize_fulltext.save= @@innodb_optimize_fulltext_only;
+SET GLOBAL innodb_optimize_fulltext_only= 1;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
+SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
index 6ee5f9f4322..1382457debf 100644
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
@@ -79,7 +79,7 @@ CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
+ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;
SELECT * FROM fts_test WHERE MATCH (title, body)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
@@ -228,3 +228,12 @@ DROP TABLE articles;
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
DROP TABLE t1;
+#
+# MDEV-18152 Assertion 'num_fts_index <= 1' failed
+# in prepare_inplace_alter_table_dict
+#
+CREATE TABLE t1
+(a VARCHAR(128), b VARCHAR(128), FULLTEXT INDEX(a), FULLTEXT INDEX(b))
+ENGINE=InnoDB;
+ALTER TABLE t1 ADD c SERIAL;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result b/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result
index 36d3826be59..f998881f11b 100644
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result
@@ -36,6 +36,8 @@ count
2
ANALYZE TABLE articles;
Table Op Msg_type Msg_text
+test.articles analyze status Engine-independent statistics collected
+test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
test.articles analyze status OK
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result b/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result
index dea2f2360da..cad1acb3b01 100644
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result
@@ -249,6 +249,8 @@ articles CREATE TABLE `articles` (
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
ANALYZE TABLE articles;
Table Op Msg_type Msg_text
+test.articles analyze status Engine-independent statistics collected
+test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
test.articles analyze status OK
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
id title body
@@ -571,6 +573,8 @@ select @@innodb_ft_enable_stopword;
1
ANALYZE TABLE articles;
Table Op Msg_type Msg_text
+test.articles analyze status Engine-independent statistics collected
+test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
test.articles analyze status OK
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
id title body
diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result
index aec3d7f777d..431a95442e6 100644
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result
@@ -37,9 +37,13 @@ DELETE FROM t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'b1'
test.t1 analyze status OK
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze Warning Engine-independent statistics are not collected for column 'b2'
test.t2 analyze status OK
SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
id1
diff --git a/mysql-test/suite/innodb_fts/t/create.test b/mysql-test/suite/innodb_fts/t/create.test
index fe0273af750..4e522994fcc 100644
--- a/mysql-test/suite/innodb_fts/t/create.test
+++ b/mysql-test/suite/innodb_fts/t/create.test
@@ -90,3 +90,19 @@ ENGINE=InnoDB;
# The column length should be 84 bytes (84 characters * 1 byte/character).
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
DROP TABLE t;
+
+--echo #
+--echo # MDEV-17923 Assertion memcmp(field, field_ref_zero, 7) failed in
+--echo # trx_undo_page_report_modify upon optimizing table
+--echo # under innodb_optimize_fulltext_only
+--echo #
+
+CREATE TABLE t1 (f1 TEXT, f2 TEXT, FULLTEXT KEY (f2)) ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES ('foo'),('bar');
+DELETE FROM t1 LIMIT 1;
+ALTER TABLE t1 ADD FULLTEXT KEY (f1);
+SET @optimize_fulltext.save= @@innodb_optimize_fulltext_only;
+SET GLOBAL innodb_optimize_fulltext_only= 1;
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
index ddd92556772..c81ec18a4e6 100644
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
@@ -276,3 +276,13 @@ ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b)
# Cleanup
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-18152 Assertion 'num_fts_index <= 1' failed
+--echo # in prepare_inplace_alter_table_dict
+--echo #
+CREATE TABLE t1
+(a VARCHAR(128), b VARCHAR(128), FULLTEXT INDEX(a), FULLTEXT INDEX(b))
+ENGINE=InnoDB;
+ALTER TABLE t1 ADD c SERIAL;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result
index 03a8543da27..84e7bec53cd 100644
--- a/mysql-test/suite/innodb_gis/r/1.result
+++ b/mysql-test/suite/innodb_gis/r/1.result
@@ -1036,9 +1036,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
SET @a=ST_POLYFROMWKB(@a);
create table t1(a polygon NOT NULL)engine=InnoDB;
insert into t1 values (ST_geomfromtext("point(0 1)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
insert into t1 values (ST_geomfromtext("point(1 0)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
drop table t1;
diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
index d9febe4b6b6..2253c62bebf 100644
--- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
@@ -464,6 +464,7 @@ ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'));
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
ALTER TABLE tab ADD SPATIAL INDEX idx2(c2 ASC);
affected rows: 0
@@ -586,6 +587,7 @@ tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry
tab 1 idx6 1 c4 A # 10 NULL BTREE
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
SET @g2 = ST_GeomFromText('LINESTRING(140 140,150 150,160 160)');
@@ -605,6 +607,7 @@ AND MBREquals(tab.c3,@g2) ORDER BY c1;
c1 ST_Astext(c2) ST_AsText(c3) ST_Astext(c4)
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
SET @g1 = ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))');
SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)');
@@ -644,6 +647,7 @@ tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry
tab 1 idx6 1 c4 A # 10 NULL BTREE
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)');
@@ -678,6 +682,7 @@ ALTER TABLE tab ENGINE Myisam;
ALTER TABLE tab ENGINE InnoDB;
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
SET @g1 = ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))');
SET @g2 = ST_GeomFromText('LINESTRING(400 400,500 500,600 700)');
@@ -789,13 +794,13 @@ DROP TABLE t1;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10;
insert into t1 values(default);
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10;
alter table t1 add column i int;
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`(temporary)`.`p` at row 1
drop table t1;
SET timestamp=default;
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result
index 1af03c251bf..c69d67c411f 100644
--- a/mysql-test/suite/innodb_gis/r/create_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result
@@ -55,6 +55,7 @@ ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'));
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
@@ -483,6 +484,7 @@ ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'));
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
@@ -900,6 +902,7 @@ ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'));
ANALYZE TABLE tab;
Table Op Msg_type Msg_text
+test.tab analyze status Engine-independent statistics collected
test.tab analyze status OK
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result
index 5d825561bf3..65d1e940cd3 100644
--- a/mysql-test/suite/innodb_gis/r/gis.result
+++ b/mysql-test/suite/innodb_gis/r/gis.result
@@ -1032,9 +1032,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
SET @a=ST_POLYFROMWKB(@a);
create table t1(a polygon NOT NULL)engine=innodb;
insert into t1 values (ST_geomfromtext("point(0 1)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
insert into t1 values (ST_geomfromtext("point(1 0)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column 'a' at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
drop table t1;
diff --git a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
index 5d4708dd111..2ef8757339e 100644
--- a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
+++ b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
@@ -744,6 +744,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
diff --git a/mysql-test/suite/innodb_gis/r/rt_precise.result b/mysql-test/suite/innodb_gis/r/rt_precise.result
index 9e2c6adc2d9..c83b88b568c 100644
--- a/mysql-test/suite/innodb_gis/r/rt_precise.result
+++ b/mysql-test/suite/innodb_gis/r/rt_precise.result
@@ -18,6 +18,7 @@ count(*)
150
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result
index d6604314909..53719f12205 100644
--- a/mysql-test/suite/innodb_gis/r/rtree.result
+++ b/mysql-test/suite/innodb_gis/r/rtree.result
@@ -6,6 +6,7 @@ insert into t1 values (1, POINT(3.1,3.1));
insert into t1 values (1, POINT(5,5));
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
@@ -150,6 +151,7 @@ insert into t1 values (4, "444", POINT(3.1,3.1));
insert into t1 values (5, "555", POINT(5,5));
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
diff --git a/mysql-test/suite/innodb_gis/r/rtree_estimate.result b/mysql-test/suite/innodb_gis/r/rtree_estimate.result
index 251685df018..dafcc40aba8 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_estimate.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_estimate.result
@@ -20,6 +20,7 @@ POLYGON((5 5,20 5,20 21,5 21,5 5))
POLYGON((1.79769e308 1.79769e308,20 5,-1.79769e308 -1.79769e308,1.79769e308 1.79769e308))
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRContains(g, @g1);
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/suite/innodb_zip/r/innodb-zip.result b/mysql-test/suite/innodb_zip/r/innodb-zip.result
index 0da1d6bbe85..e0a454b75a4 100644
--- a/mysql-test/suite/innodb_zip/r/innodb-zip.result
+++ b/mysql-test/suite/innodb_zip/r/innodb-zip.result
@@ -121,9 +121,13 @@ disconnect a;
disconnect b;
analyze table t1;
Table Op Msg_type Msg_text
+mysqltest_innodb_zip.t1 analyze status Engine-independent statistics collected
+mysqltest_innodb_zip.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
mysqltest_innodb_zip.t1 analyze status OK
analyze table t2;
Table Op Msg_type Msg_text
+mysqltest_innodb_zip.t2 analyze status Engine-independent statistics collected
+mysqltest_innodb_zip.t2 analyze Warning Engine-independent statistics are not collected for column 'b'
mysqltest_innodb_zip.t2 analyze status OK
SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql' order by table_name;
table_schema table_name row_format data_length index_length
diff --git a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
index 394a2ea1f09..b3a4ad2b0ba 100644
--- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
+++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
@@ -107,12 +107,6 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
-SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Index for table 't1' is corrupt; try to repair it
-SET SESSION debug_dbug=@saved_debug_dbug;
-unlink: t1.ibd
-unlink: t1.cfg
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum.test b/mysql-test/suite/innodb_zip/t/innochecksum.test
index 63a4b418677..fec8acf52c4 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum.test
@@ -79,18 +79,22 @@ let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --
--echo [9]: check the innochecksum with full form --strict-check=innodb
# Server Default checksum = crc32
+--error 1
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
--echo [10]: check the innochecksum with full form --strict-check=none
--echo # when server Default checksum=crc32
+--error 1
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
--echo [11]: check the innochecksum with short form -C innodb
--echo # when server Default checksum=crc32
+--error 1
--exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
--echo [12]: check the innochecksum with short form -C none
--echo # when server Default checksum=crc32
+--error 1
--exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
--echo [13]: check strict-check with invalid values
diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
index 986c0508891..c81eca69db8 100644
--- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
+++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
@@ -282,20 +282,6 @@ do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
-# Test failure after importing the cluster index
-SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
-
---error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-
-SET SESSION debug_dbug=@saved_debug_dbug;
-
-# Left over from the failed IMPORT
-perl;
-do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
-EOF
-
DROP TABLE test_wl5522.t1;
--disable_query_log
diff --git a/mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result b/mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result
index ad704c0c683..5f3ad54662b 100644
--- a/mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result
+++ b/mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result
@@ -17,7 +17,11 @@ include/start_slave.inc
include/stop_slave.inc
connection master;
select event_time from (select event_time from mysql.general_log as t_1 where command_type like 'Connect' order by event_time desc limit 2) as t_2 order by event_time desc limit 1 into @ts_last;
+Warnings:
+Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
select event_time from (select event_time from mysql.general_log as t_1 where command_type like 'Connect' order by event_time desc limit 2) as t_2 order by event_time asc limit 1 into @ts_prev;
+Warnings:
+Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
include/assert.inc [time between last reconnection and the reconnection before that should be >= slave_net_timeout]
connection master;
set @@global.general_log = @save_general_log;
diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result
index d22e705e6de..8fc93e861a7 100644
--- a/mysql-test/suite/maria/icp.result
+++ b/mysql-test/suite/maria/icp.result
@@ -851,7 +851,7 @@ DROP TABLE t1;
create table t1 (a int,b char(5),primary key (a), key (b(1)));
insert ignore into t1 values ('a','b');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`a` at row 1
select 1 from t1 where a and b >= 'aa';
1
drop table t1;
diff --git a/mysql-test/suite/maria/maria-autozerofill.result b/mysql-test/suite/maria/maria-autozerofill.result
index 76ccc67ebb5..064ac9e6496 100644
--- a/mysql-test/suite/maria/maria-autozerofill.result
+++ b/mysql-test/suite/maria/maria-autozerofill.result
@@ -56,6 +56,7 @@ mysqltest.t3 optimize Note Zerofilling moved table ./mysqltest/t3
mysqltest.t3 optimize status OK
analyze table t4;
Table Op Msg_type Msg_text
+mysqltest.t4 analyze status Engine-independent statistics collected
mysqltest.t4 analyze Note Zerofilling moved table ./mysqltest/t4
mysqltest.t4 analyze status OK
repair table t5;
diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
index 8bea5edb6fb..2f8c1b9408c 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
+++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
@@ -749,6 +749,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.result b/mysql-test/suite/maria/maria-gis-rtree-trans.result
index 4a2f97fbd41..1c0d9e756a4 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-trans.result
+++ b/mysql-test/suite/maria/maria-gis-rtree-trans.result
@@ -749,6 +749,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
diff --git a/mysql-test/suite/maria/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result
index 901a7bee397..e39430a2efb 100644
--- a/mysql-test/suite/maria/maria-gis-rtree.result
+++ b/mysql-test/suite/maria/maria-gis-rtree.result
@@ -749,6 +749,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result
index 83210676ed8..76b14024bf4 100644
--- a/mysql-test/suite/maria/maria.result
+++ b/mysql-test/suite/maria/maria.result
@@ -739,6 +739,7 @@ insert into t1 values (0),(1),(2),(3),(4);
insert into t1 select NULL from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -759,6 +760,7 @@ insert into t1 values (11);
delete from t1 where a=11;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -770,7 +772,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-t1 1 a 1 a A 5 NULL NULL YES BTREE
+t1 1 a 1 a A 10 NULL NULL YES BTREE
set aria_stats_method=DEFAULT;
show variables like 'aria_stats_method';
Variable_name Value
@@ -779,6 +781,7 @@ insert into t1 values (11);
delete from t1 where a=11;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -806,6 +809,7 @@ insert into t1 values ('bce','def1', 'yuu', NULL);
insert into t1 values ('bce','def2', NULL, 'quux');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -816,6 +820,7 @@ t1 1 a 4 d A 4 NULL NULL YES BTREE
delete from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -1690,9 +1695,11 @@ create table t1 (a int, key(a));
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result
index 1fd49df00e1..ba8b64f9514 100644
--- a/mysql-test/suite/maria/maria3.result
+++ b/mysql-test/suite/maria/maria3.result
@@ -209,11 +209,13 @@ create table t2 like t1;
insert into t2 select * from t1;
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
delete from t2;
insert into t2 select * from t1;
analyze table t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
drop table t1,t2;
create table t1 (a bigint auto_increment, primary key(a), b char(255), c varchar(20000));
diff --git a/mysql-test/suite/maria/system_tables.result b/mysql-test/suite/maria/system_tables.result
index 32fddf6127e..c9944482638 100644
--- a/mysql-test/suite/maria/system_tables.result
+++ b/mysql-test/suite/maria/system_tables.result
@@ -3,6 +3,7 @@ LOCK TABLE t1 WRITE;
connect con1,localhost,root,,test;
SET lock_wait_timeout= 2;
FLUSH TABLES;
+FLUSH TABLES t1;
connection default;
CALL non_existing_sp;
ERROR 42000: PROCEDURE test.non_existing_sp does not exist
diff --git a/mysql-test/suite/maria/system_tables.test b/mysql-test/suite/maria/system_tables.test
index 7b5c20ded85..950989fa5ca 100644
--- a/mysql-test/suite/maria/system_tables.test
+++ b/mysql-test/suite/maria/system_tables.test
@@ -12,8 +12,8 @@ LOCK TABLE t1 WRITE;
--connect (con1,localhost,root,,test)
SET lock_wait_timeout= 2;
---send
- FLUSH TABLES;
+FLUSH TABLES;
+--send FLUSH TABLES t1
--connection default
--error ER_SP_DOES_NOT_EXIST
CALL non_existing_sp;
diff --git a/mysql-test/suite/mariabackup/backup_grants.result b/mysql-test/suite/mariabackup/backup_grants.result
new file mode 100644
index 00000000000..d8869b7ac82
--- /dev/null
+++ b/mysql-test/suite/mariabackup/backup_grants.result
@@ -0,0 +1,5 @@
+CREATE user backup@localhost;
+FOUND 1 /missing required privilege RELOAD/ in backup.log
+FOUND 1 /missing required privilege PROCESS/ in backup.log
+GRANT RELOAD, PROCESS on *.* to backup@localhost;
+DROP USER backup@localhost;
diff --git a/mysql-test/suite/mariabackup/backup_grants.test b/mysql-test/suite/mariabackup/backup_grants.test
new file mode 100644
index 00000000000..1c0c3f89346
--- /dev/null
+++ b/mysql-test/suite/mariabackup/backup_grants.test
@@ -0,0 +1,30 @@
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+CREATE user backup@localhost;
+
+# backup possible for unprivileges user, with --no-lock
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --no-lock --target-dir=$targetdir;
+--enable_result_log
+rmdir $targetdir;
+
+# backup fails without --no-lock, because of FTWRL
+--disable_result_log
+error 1;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log;
+--enable_result_log
+
+let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log;
+--let SEARCH_PATTERN= missing required privilege RELOAD
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN= missing required privilege PROCESS
+--source include/search_pattern_in_file.inc
+
+# backup succeeds with RELOAD privilege
+GRANT RELOAD, PROCESS on *.* to backup@localhost;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir;
+--enable_result_log
+
+DROP USER backup@localhost;
+# Cleanup
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/drop_table_during_backup.result b/mysql-test/suite/mariabackup/drop_table_during_backup.result
index 1472ddbddcf..8a77945e586 100644
--- a/mysql-test/suite/mariabackup/drop_table_during_backup.result
+++ b/mysql-test/suite/mariabackup/drop_table_during_backup.result
@@ -1,6 +1,8 @@
CREATE TABLE t1 (i int) ENGINE=INNODB;
CREATE TABLE t2 (i int) ENGINE=INNODB;
CREATE TABLE t3 (i int) ENGINE=INNODB;
+CREATE TABLE t4 (i int) ENGINE=INNODB;
+CREATE TABLE t5 (i int) ENGINE=INNODB;
# xtrabackup prepare
# shutdown server
# remove datadir
@@ -11,3 +13,6 @@ DROP TABLE t1;
CREATE TABLE t2(i int);
DROP TABLE t2;
DROP TABLE t3;
+CREATE TABLE t4(i int);
+DROP TABLE t4;
+DROP TABLE t5;
diff --git a/mysql-test/suite/mariabackup/drop_table_during_backup.test b/mysql-test/suite/mariabackup/drop_table_during_backup.test
index 02c7710145b..e3a81b77b71 100644
--- a/mysql-test/suite/mariabackup/drop_table_during_backup.test
+++ b/mysql-test/suite/mariabackup/drop_table_during_backup.test
@@ -3,8 +3,14 @@ let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
CREATE TABLE t1 (i int) ENGINE=INNODB;
CREATE TABLE t2 (i int) ENGINE=INNODB;
CREATE TABLE t3 (i int) ENGINE=INNODB;
+CREATE TABLE t4 (i int) ENGINE=INNODB;
+CREATE TABLE t5 (i int) ENGINE=INNODB;
+
--let before_copy_test_t1=DROP TABLE test.t1
--let after_copy_test_t2=DROP TABLE test.t2;
+# MDEV-18185, drop + rename combination
+--let after_copy_test_t5=BEGIN NOT ATOMIC DROP TABLE test.t5; RENAME TABLE test.t4 TO test.t5; END
+
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
--enable_result_log
@@ -21,4 +27,7 @@ DROP TABLE t1;
CREATE TABLE t2(i int);
DROP TABLE t2;
DROP TABLE t3;
+CREATE TABLE t4(i int);
+DROP TABLE t4;
+DROP TABLE t5;
rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.opt b/mysql-test/suite/mariabackup/encrypted_page_compressed.opt
new file mode 100644
index 00000000000..e5a02a1a1c9
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.opt
@@ -0,0 +1,6 @@
+--innodb-encryption-rotate-key-age=2
+--innodb-encryption-threads=4
+--innodb-tablespaces-encryption
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--loose-file-key-management
+--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt
diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.result b/mysql-test/suite/mariabackup/encrypted_page_compressed.result
new file mode 100644
index 00000000000..293addd2b03
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.result
@@ -0,0 +1,7 @@
+call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
+insert into t1(b, c) values("mariadb", "mariabackup");
+# Corrupt the table
+# xtrabackup backup
+FOUND 1 /Database page corruption detected.*/ in backup.log
+drop table t1;
diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.test b/mysql-test/suite/mariabackup/encrypted_page_compressed.test
new file mode 100644
index 00000000000..b4ca7eded14
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.test
@@ -0,0 +1,48 @@
+source include/have_file_key_management.inc;
+call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
+insert into t1(b, c) values("mariadb", "mariabackup");
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+
+--source include/shutdown_mysqld.inc
+
+--echo # Corrupt the table
+
+perl;
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+
+my $ibd_file = $ENV{'t1_IBD'};
+
+my $chunk;
+my $page_size = $ENV{'INNODB_PAGE_SIZE'};
+
+sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
+sysseek IBD_FILE, $page_size * 3 + 75, SEEK_CUR;
+$chunk = '\xAA\xAA\xAA\xAA';
+syswrite IBD_FILE, $chunk, 4;
+
+close IBD_FILE;
+EOF
+
+--source include/start_mysqld.inc
+
+echo # xtrabackup backup;
+--disable_result_log
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
+--enable_result_log
+
+--let SEARCH_PATTERN=Database page corruption detected.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+remove_file $backuplog;
+
+drop table t1;
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.opt b/mysql-test/suite/mariabackup/encrypted_page_corruption.opt
new file mode 100644
index 00000000000..74a6450a1ef
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.opt
@@ -0,0 +1,6 @@
+--innodb-encrypt-log=ON
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--loose-file-key-management
+--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key
+--loose-file-key-management-filename=$MTR_SUITE_DIR/filekeys-data.enc
+--loose-file-key-management-encryption-algorithm=aes_cbc
diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.result b/mysql-test/suite/mariabackup/encrypted_page_corruption.result
new file mode 100644
index 00000000000..9a6202a5ea1
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.result
@@ -0,0 +1,8 @@
+call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
+CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
+insert into t1 select repeat('a',100);
+# Corrupt the table
+# xtrabackup backup
+FOUND 1 /Database page corruption detected.*/ in backup.log
+drop table t1;
diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.test b/mysql-test/suite/mariabackup/encrypted_page_corruption.test
new file mode 100644
index 00000000000..4491c235ac4
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.test
@@ -0,0 +1,70 @@
+--source include/have_file_key_management.inc
+--source include/innodb_page_size.inc
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
+CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
+insert into t1 select repeat('a',100);
+
+let MYSQLD_DATADIR=`select @@datadir`;
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+
+--source include/shutdown_mysqld.inc
+
+--echo # Corrupt the table
+
+perl;
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
+
+my $page_size = $ENV{INNODB_PAGE_SIZE};
+
+sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR
+|| die "Cannot open t1.ibd\n";
+sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n";
+my $space = unpack("x[34]N", $_);
+sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n";
+
+my $head = pack("Nx[18]", 3); # better to have a valid page number
+my $body = chr(0) x ($page_size - 38 - 8);
+
+# Calculate innodb_checksum_algorithm=crc32 for the unencrypted page.
+# The following bytes are excluded:
+# bytes 0..3 (the checksum is stored there)
+# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id)
+# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN)
+my $polynomial = 0x82f63b78; # CRC-32C
+my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
+
+my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck);
+die unless syswrite(IBD_FILE, $page, $page_size) == $page_size;
+close IBD_FILE;
+EOF
+
+--source include/start_mysqld.inc
+
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
+
+--disable_result_log
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir > $backuplog;
+--enable_result_log
+
+
+--let SEARCH_PATTERN=Database page corruption detected.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+remove_file $backuplog;
+rmdir $targetdir;
+
+# Due to very constructed nature of the "corruption" (faking checksums), the "corruption" won't be found without --extended-validation
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+--enable_result_log
+
+drop table t1;
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/huge_lsn.opt b/mysql-test/suite/mariabackup/huge_lsn.opt
index 74a6450a1ef..c65b76fb7d2 100644
--- a/mysql-test/suite/mariabackup/huge_lsn.opt
+++ b/mysql-test/suite/mariabackup/huge_lsn.opt
@@ -1,4 +1,8 @@
--innodb-encrypt-log=ON
+--innodb-tablespaces-encryption
+--innodb-encrypt-tables=ON
+--innodb-encryption-rotate-key-age=1
+--innodb-encryption-threads=4
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
--loose-file-key-management
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key
diff --git a/mysql-test/suite/mariabackup/partition_partial.opt b/mysql-test/suite/mariabackup/partition_partial.opt
new file mode 100644
index 00000000000..508cf185695
--- /dev/null
+++ b/mysql-test/suite/mariabackup/partition_partial.opt
@@ -0,0 +1 @@
+--innodb --loose-partition
diff --git a/mysql-test/suite/mariabackup/partition_partial.result b/mysql-test/suite/mariabackup/partition_partial.result
new file mode 100644
index 00000000000..62b7adf75f8
--- /dev/null
+++ b/mysql-test/suite/mariabackup/partition_partial.result
@@ -0,0 +1,31 @@
+CREATE TABLE t1(i INT) ENGINE INNODB
+PARTITION BY RANGE (i)
+(PARTITION p1 VALUES LESS THAN (100),
+PARTITION p2 VALUES LESS THAN (200),
+PARTITION p3 VALUES LESS THAN (300),
+PARTITION p4 VALUES LESS THAN (400));
+INSERT INTO t1 VALUES (1), (101), (201), (301);
+# xtrabackup backup
+INSERT INTO t1 VALUES (1), (101), (201), (301);
+# xtrabackup prepare
+CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
+ALTER TABLE t1_placeholder DISCARD TABLESPACE;
+ALTER TABLE t1_placeholder IMPORT TABLESPACE;
+ALTER TABLE t1 EXCHANGE PARTITION p4 WITH TABLE t1_placeholder;
+ALTER TABLE t1_placeholder DISCARD TABLESPACE;
+ALTER TABLE t1_placeholder IMPORT TABLESPACE;
+ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t1_placeholder;
+ALTER TABLE t1_placeholder DISCARD TABLESPACE;
+ALTER TABLE t1_placeholder IMPORT TABLESPACE;
+ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t1_placeholder;
+ALTER TABLE t1_placeholder DISCARD TABLESPACE;
+ALTER TABLE t1_placeholder IMPORT TABLESPACE;
+ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t1_placeholder;
+SELECT * FROM t1;
+i
+1
+101
+201
+301
+DROP TABLE t1;
+DROP TABLE t1_placeholder;
diff --git a/mysql-test/suite/mariabackup/partition_partial.test b/mysql-test/suite/mariabackup/partition_partial.test
new file mode 100644
index 00000000000..8e288ec997f
--- /dev/null
+++ b/mysql-test/suite/mariabackup/partition_partial.test
@@ -0,0 +1,44 @@
+#--source include/innodb_page_size.inc
+
+# import partitioned table from table from partial backup
+
+CREATE TABLE t1(i INT) ENGINE INNODB
+PARTITION BY RANGE (i)
+(PARTITION p1 VALUES LESS THAN (100),
+ PARTITION p2 VALUES LESS THAN (200),
+ PARTITION p3 VALUES LESS THAN (300),
+ PARTITION p4 VALUES LESS THAN (400));
+
+INSERT INTO t1 VALUES (1), (101), (201), (301);
+
+echo # xtrabackup backup;
+
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.t1" --target-dir=$targetdir;
+--enable_result_log
+INSERT INTO t1 VALUES (1), (101), (201), (301);
+
+
+echo # xtrabackup prepare;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
+--enable_result_log
+
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
+let $i=4;
+while($i)
+{
+ eval ALTER TABLE t1_placeholder DISCARD TABLESPACE;
+ copy_file $targetdir/test/t1#P#p$i.cfg $MYSQLD_DATADIR/test/t1_placeholder.cfg;
+ copy_file $targetdir/test/t1#P#p$i.ibd $MYSQLD_DATADIR/test/t1_placeholder.ibd;
+ eval ALTER TABLE t1_placeholder IMPORT TABLESPACE;
+ eval ALTER TABLE t1 EXCHANGE PARTITION p$i WITH TABLE t1_placeholder;
+ dec $i;
+}
+SELECT * FROM t1;
+DROP TABLE t1;
+DROP TABLE t1_placeholder;
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/rename_during_backup.result b/mysql-test/suite/mariabackup/rename_during_backup.result
index 6e8f365f643..a4cf06b7633 100644
--- a/mysql-test/suite/mariabackup/rename_during_backup.result
+++ b/mysql-test/suite/mariabackup/rename_during_backup.result
@@ -4,6 +4,8 @@ CREATE TABLE t2(i int) ENGINE INNODB;
INSERT INTO t2 values(2);
CREATE TABLE t3(i int) ENGINE INNODB;
CREATE TABLE t4(i int) ENGINE INNODB;
+CREATE TABLE t5(i int) ENGINE INNODB;
+INSERT INTO t5 VALUES(5);
CREATE TABLE a(a int) ENGINE INNODB;
INSERT INTO a values(1);
CREATE TABLE b(b CHAR(1)) ENGINE INNODB;
@@ -51,3 +53,10 @@ SELECT * FROM b1;
a1
1
DROP TABLE a,b,a1,b1;
+SELECT * from t5;
+i
+DROP TABLE t5;
+SELECT * from t6;
+i
+5
+DROP TABLE t6;
diff --git a/mysql-test/suite/mariabackup/rename_during_backup.test b/mysql-test/suite/mariabackup/rename_during_backup.test
index f176af1451b..238a8b1985c 100644
--- a/mysql-test/suite/mariabackup/rename_during_backup.test
+++ b/mysql-test/suite/mariabackup/rename_during_backup.test
@@ -10,6 +10,8 @@ INSERT INTO t2 values(2);
CREATE TABLE t3(i int) ENGINE INNODB;
CREATE TABLE t4(i int) ENGINE INNODB;
+CREATE TABLE t5(i int) ENGINE INNODB;
+INSERT INTO t5 VALUES(5);
CREATE TABLE a(a int) ENGINE INNODB;
INSERT INTO a values(1);
@@ -28,6 +30,7 @@ INSERT INTO b1 VALUES('b1');
--let after_copy_test_t3=BEGIN NOT ATOMIC RENAME TABLE test.t3 TO test.t3_tmp; INSERT INTO test.t3_tmp VALUES(3); RENAME TABLE test.t3_tmp TO test.t3; END
--let before_copy_test_t4=RENAME TABLE test.t4 TO test.t4_tmp
--let after_copy_test_t4=RENAME TABLE test.t4_tmp TO test.t4
+--let after_copy_test_t5=BEGIN NOT ATOMIC RENAME TABLE test.t5 TO test.t6; CREATE TABLE test.t5(i int) ENGINE INNODB; END
# Test circular renames
--let before_copy_test_b=RENAME TABLE test.a to test.tmp, test.b to test.a, test.tmp to test.b
@@ -81,6 +84,10 @@ SELECT * FROM a1;
SELECT * FROM b1;
DROP TABLE a,b,a1,b1;
+SELECT * from t5;
+DROP TABLE t5;
+SELECT * from t6;
+DROP TABLE t6;
rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.result b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
new file mode 100644
index 00000000000..71eac085769
--- /dev/null
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
@@ -0,0 +1,11 @@
+call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
+insert into t1(b, c) values("mariadb", "mariabackup");
+InnoDB 0 transactions not purged
+# Corrupt the table
+# xtrabackup backup
+FOUND 1 /Database page corruption detected.*/ in backup.log
+drop table t1;
+Warnings:
+Warning 192 Table test/t1 in file ./test/t1.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
new file mode 100644
index 00000000000..b41d177e572
--- /dev/null
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
@@ -0,0 +1,50 @@
+call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
+insert into t1(b, c) values("mariadb", "mariabackup");
+--source ../innodb/include/wait_all_purged.inc
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+
+--source include/shutdown_mysqld.inc
+
+--echo # Corrupt the table
+
+perl;
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+
+my $ibd_file = $ENV{'t1_IBD'};
+
+my $chunk;
+my $page_size = $ENV{'INNODB_PAGE_SIZE'};
+
+sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
+sysseek IBD_FILE, 16384 * 3 + 75, SEEK_CUR;
+$chunk = '\xAA\xAA\xAA\xAA';
+syswrite IBD_FILE, $chunk, 4;
+
+close IBD_FILE;
+EOF
+
+--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup
+--source include/start_mysqld.inc
+
+echo # xtrabackup backup;
+--disable_result_log
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
+--enable_result_log
+
+--let SEARCH_PATTERN=Database page corruption detected.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+remove_file $backuplog;
+
+drop table t1;
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/xb_aws_key_management.result b/mysql-test/suite/mariabackup/xb_aws_key_management.result
index 6efc76a8be3..ccad423f631 100644
--- a/mysql-test/suite/mariabackup/xb_aws_key_management.result
+++ b/mysql-test/suite/mariabackup/xb_aws_key_management.result
@@ -1,7 +1,4 @@
CREATE TABLE t(c VARCHAR(10)) ENGINE INNODB encrypted=yes;
-Warnings:
-Note 1105 AWS KMS plugin: generated encrypted datakey for key id=1, version=1
-Note 1105 AWS KMS plugin: loaded key 1, version 1, key length 128 bit
INSERT INTO t VALUES('foobar1');
# xtrabackup backup
# shutdown server
@@ -11,6 +8,4 @@ INSERT INTO t VALUES('foobar1');
SELECT * from t;
c
foobar1
-Warnings:
-Note 1105 AWS KMS plugin: loaded key 1, version 1, key length 128 bit
DROP TABLE t;
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
index 5f3610b7999..0e8db677cdf 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
@@ -517,6 +517,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1009,6 +1010,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1516,6 +1518,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2017,6 +2020,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2516,6 +2520,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3026,6 +3031,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3538,6 +3544,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4038,6 +4045,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4531,6 +4539,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5023,6 +5032,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5530,6 +5540,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6031,6 +6042,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6530,6 +6542,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7040,6 +7053,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7552,6 +7566,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8052,6 +8067,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8562,6 +8578,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9070,6 +9087,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9593,6 +9611,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10110,6 +10129,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10625,6 +10645,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11151,6 +11172,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11679,6 +11701,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12195,6 +12218,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12704,6 +12728,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13212,6 +13237,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13735,6 +13761,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14252,6 +14279,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14767,6 +14795,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15293,6 +15322,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15821,6 +15851,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16337,6 +16368,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16832,6 +16864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17325,6 +17358,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17833,6 +17867,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18335,6 +18370,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18835,6 +18871,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19346,6 +19383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19859,6 +19897,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20360,6 +20399,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20854,6 +20894,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21347,6 +21388,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21855,6 +21897,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22357,6 +22400,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22857,6 +22901,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23368,6 +23413,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23881,6 +23927,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24382,6 +24429,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24876,6 +24924,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25369,6 +25418,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25877,6 +25927,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26379,6 +26430,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26879,6 +26931,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27390,6 +27443,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27903,6 +27957,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28404,6 +28459,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result
index ce3dd51496e..0f12c15e4e9 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result
@@ -543,6 +543,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1066,6 +1067,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1610,6 +1612,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2144,6 +2147,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2680,6 +2684,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3227,6 +3232,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3776,6 +3782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4315,6 +4322,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4833,6 +4841,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5356,6 +5365,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5900,6 +5910,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6434,6 +6445,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6970,6 +6982,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7517,6 +7530,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8066,6 +8080,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8605,6 +8620,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
index 12f028782ed..919e6344615 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
@@ -835,6 +835,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1327,6 +1328,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1834,6 +1836,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2335,6 +2338,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2836,6 +2840,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3346,6 +3351,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3858,6 +3864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4358,6 +4365,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4851,6 +4859,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5343,6 +5352,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5850,6 +5860,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6351,6 +6362,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6852,6 +6864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7362,6 +7375,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7874,6 +7888,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8374,6 +8389,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8884,6 +8900,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9392,6 +9409,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9915,6 +9933,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10432,6 +10451,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10949,6 +10969,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11475,6 +11496,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12003,6 +12025,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12519,6 +12542,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13028,6 +13052,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13536,6 +13561,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14059,6 +14085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14576,6 +14603,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15093,6 +15121,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15619,6 +15648,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16147,6 +16177,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16663,6 +16694,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result
index a276e1593ee..05176399246 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_myisam.result
@@ -702,6 +702,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1225,6 +1226,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1769,6 +1771,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2303,6 +2306,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2841,6 +2845,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3388,6 +3393,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3937,6 +3943,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4476,6 +4483,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4994,6 +5002,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5517,6 +5526,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6061,6 +6071,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6595,6 +6606,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7133,6 +7145,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7680,6 +7693,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8229,6 +8243,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8768,6 +8783,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
index 36823665fa1..3f720024f72 100644
--- a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
@@ -464,6 +464,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -904,6 +905,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1359,6 +1361,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1808,6 +1811,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2257,6 +2261,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2715,6 +2720,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3175,6 +3181,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3623,6 +3630,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4064,6 +4072,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4504,6 +4513,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4959,6 +4969,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5408,6 +5419,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5857,6 +5869,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6315,6 +6328,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6775,6 +6789,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7223,6 +7238,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7680,6 +7696,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8136,6 +8153,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8607,6 +8625,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9072,6 +9091,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9537,6 +9557,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10011,6 +10032,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10487,6 +10509,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10951,6 +10974,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11396,6 +11420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11836,6 +11861,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12291,6 +12317,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12740,6 +12767,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13187,6 +13215,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13645,6 +13674,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14105,6 +14135,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14553,6 +14584,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14994,6 +15026,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15434,6 +15467,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15889,6 +15923,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16338,6 +16373,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16785,6 +16821,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17243,6 +17280,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17703,6 +17741,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18151,6 +18190,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18609,6 +18649,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19065,6 +19106,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19536,6 +19578,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20001,6 +20044,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20464,6 +20508,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20938,6 +20983,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21414,6 +21460,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21878,6 +21925,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22335,6 +22383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22791,6 +22840,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23262,6 +23312,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23727,6 +23778,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24190,6 +24242,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24664,6 +24717,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25140,6 +25194,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25604,6 +25659,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26046,6 +26102,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26486,6 +26543,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26941,6 +26999,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27390,6 +27449,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27837,6 +27897,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28295,6 +28356,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28755,6 +28817,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29203,6 +29266,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29644,6 +29708,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30084,6 +30149,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30539,6 +30605,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30988,6 +31055,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31435,6 +31503,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31893,6 +31962,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32353,6 +32423,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32801,6 +32872,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33258,6 +33330,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33714,6 +33787,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34185,6 +34259,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34650,6 +34725,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35113,6 +35189,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35587,6 +35664,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36063,6 +36141,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36527,6 +36606,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result
index b4e1ddc577b..ba6a7e7fbbd 100644
--- a/mysql-test/suite/parts/r/partition_alter1_2_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter1_2_myisam.result
@@ -489,6 +489,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -960,6 +961,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1452,6 +1454,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1934,6 +1937,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2420,6 +2424,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2915,6 +2920,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3412,6 +3418,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3899,6 +3906,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4369,6 +4377,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4840,6 +4849,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5332,6 +5342,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5814,6 +5825,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6298,6 +6310,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6793,6 +6806,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7290,6 +7304,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7777,6 +7792,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8243,6 +8259,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8714,6 +8731,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9206,6 +9224,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9688,6 +9707,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10172,6 +10192,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10667,6 +10688,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11164,6 +11186,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11651,6 +11674,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12117,6 +12141,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12588,6 +12613,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13080,6 +13106,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13562,6 +13589,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14046,6 +14074,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14541,6 +14570,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15038,6 +15068,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15525,6 +15556,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
index 586b24e4049..ff7d659613d 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
@@ -481,6 +481,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -937,6 +938,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1408,6 +1410,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1873,6 +1876,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2338,6 +2342,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2812,6 +2817,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3288,6 +3294,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3752,6 +3759,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4248,6 +4256,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4742,6 +4751,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5251,6 +5261,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5754,6 +5765,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6257,6 +6269,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6769,6 +6782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7283,6 +7297,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7785,6 +7800,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8280,6 +8296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8774,6 +8791,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9283,6 +9301,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9786,6 +9805,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10289,6 +10309,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10801,6 +10822,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11315,6 +11337,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11817,6 +11840,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12327,6 +12351,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12835,6 +12860,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13358,6 +13384,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13875,6 +13902,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14392,6 +14420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14918,6 +14947,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15446,6 +15476,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15962,6 +15993,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16471,6 +16503,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16979,6 +17012,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17502,6 +17536,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18019,6 +18054,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18536,6 +18572,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19062,6 +19099,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19590,6 +19628,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20106,6 +20145,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
index 5a71f1063f5..a537b74201d 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
@@ -477,6 +477,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -933,6 +934,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1404,6 +1406,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1869,6 +1872,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2332,6 +2336,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2806,6 +2811,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3282,6 +3288,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3746,6 +3753,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4243,6 +4251,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4738,6 +4747,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5248,6 +5258,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5752,6 +5763,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6254,6 +6266,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6767,6 +6780,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7282,6 +7296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7785,6 +7800,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8281,6 +8297,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8776,6 +8793,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9286,6 +9304,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9790,6 +9809,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10292,6 +10312,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10805,6 +10826,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11320,6 +11342,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11823,6 +11846,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12333,6 +12357,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12841,6 +12866,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13364,6 +13390,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13881,6 +13908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14396,6 +14424,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14922,6 +14951,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15450,6 +15480,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15966,6 +15997,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16475,6 +16507,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16983,6 +17016,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17506,6 +17540,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18023,6 +18058,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18538,6 +18574,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19064,6 +19101,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19592,6 +19630,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20108,6 +20147,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_maria.result b/mysql-test/suite/parts/r/partition_alter2_1_maria.result
index 7196be3a602..0af69f09639 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_maria.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_maria.result
@@ -491,6 +491,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -962,6 +963,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1454,6 +1456,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1936,6 +1939,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2422,6 +2426,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2917,6 +2922,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3414,6 +3420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3901,6 +3908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4420,6 +4428,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4943,6 +4952,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5487,6 +5497,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6021,6 +6032,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6559,6 +6571,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7106,6 +7119,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7655,6 +7669,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8194,6 +8209,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8712,6 +8728,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9235,6 +9252,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9779,6 +9797,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10313,6 +10332,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10851,6 +10871,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11398,6 +11419,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11947,6 +11969,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12486,6 +12509,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12957,6 +12981,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13428,6 +13453,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13920,6 +13946,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14402,6 +14429,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14886,6 +14914,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15381,6 +15410,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15878,6 +15908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16365,6 +16396,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16884,6 +16916,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17407,6 +17440,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17951,6 +17985,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18485,6 +18520,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19021,6 +19057,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19568,6 +19605,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20117,6 +20155,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20656,6 +20695,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21174,6 +21214,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21697,6 +21738,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22241,6 +22283,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22775,6 +22818,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23311,6 +23355,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23858,6 +23903,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24407,6 +24453,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24946,6 +24993,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result
index 59039b97f65..60cb5a2e733 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_myisam.result
@@ -491,6 +491,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -962,6 +963,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1454,6 +1456,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1936,6 +1939,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2422,6 +2426,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2917,6 +2922,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3414,6 +3420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3901,6 +3908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4420,6 +4428,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4943,6 +4952,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5487,6 +5497,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6021,6 +6032,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6559,6 +6571,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7106,6 +7119,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7655,6 +7669,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8194,6 +8209,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8712,6 +8728,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9235,6 +9252,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9779,6 +9797,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10313,6 +10332,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10851,6 +10871,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11398,6 +11419,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11947,6 +11969,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12486,6 +12509,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12957,6 +12981,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13428,6 +13453,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13920,6 +13946,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14402,6 +14429,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14886,6 +14914,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15381,6 +15410,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15878,6 +15908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16365,6 +16396,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16884,6 +16916,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17407,6 +17440,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17951,6 +17985,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18485,6 +18520,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19021,6 +19057,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19568,6 +19605,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20117,6 +20155,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20656,6 +20695,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21174,6 +21214,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21697,6 +21738,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22241,6 +22283,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22775,6 +22818,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23311,6 +23355,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23858,6 +23903,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24407,6 +24453,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24946,6 +24993,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
index 1d90f8f6368..d0d4e1602fd 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
@@ -483,6 +483,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -941,6 +942,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1414,6 +1416,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1879,6 +1882,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2346,6 +2350,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2820,6 +2825,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3298,6 +3304,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3764,6 +3771,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4261,6 +4269,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4757,6 +4766,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5268,6 +5278,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5771,6 +5782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6276,6 +6288,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6788,6 +6801,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7304,6 +7318,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7808,6 +7823,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8305,6 +8321,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8801,6 +8818,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9312,6 +9330,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9815,6 +9834,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10320,6 +10340,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10832,6 +10853,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11348,6 +11370,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11852,6 +11875,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12364,6 +12388,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12874,6 +12899,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13399,6 +13425,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13916,6 +13943,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14435,6 +14463,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14961,6 +14990,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15491,6 +15521,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16009,6 +16040,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16520,6 +16552,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17030,6 +17063,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17555,6 +17589,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18072,6 +18107,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18591,6 +18627,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19117,6 +19154,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19647,6 +19685,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20165,6 +20204,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
index 4b0a481340f..4332588fda7 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
@@ -479,6 +479,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -938,6 +939,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1412,6 +1414,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1882,6 +1885,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2350,6 +2354,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2829,6 +2834,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3308,6 +3314,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3775,6 +3782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4275,6 +4283,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4773,6 +4782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5286,6 +5296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5795,6 +5806,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6302,6 +6314,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6820,6 +6833,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7338,6 +7352,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7844,6 +7859,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8343,6 +8359,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8841,6 +8858,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9354,6 +9372,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9863,6 +9882,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10370,6 +10390,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10888,6 +10909,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11406,6 +11428,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11912,6 +11935,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12425,6 +12449,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12936,6 +12961,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13462,6 +13488,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13984,6 +14011,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14504,6 +14532,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15035,6 +15064,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15566,6 +15596,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16085,6 +16116,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16597,6 +16629,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17108,6 +17141,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17634,6 +17668,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18156,6 +18191,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18676,6 +18712,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19207,6 +19244,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19738,6 +19776,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20257,6 +20296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_maria.result b/mysql-test/suite/parts/r/partition_alter2_2_maria.result
index 66d5770e20e..9cc64b8239b 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_maria.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_maria.result
@@ -493,6 +493,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -966,6 +967,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1460,6 +1462,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1942,6 +1945,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2430,6 +2434,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2925,6 +2930,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3424,6 +3430,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3913,6 +3920,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4434,6 +4442,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4959,6 +4968,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5505,6 +5515,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6039,6 +6050,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6579,6 +6591,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7126,6 +7139,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7677,6 +7691,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8218,6 +8233,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8738,6 +8754,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9263,6 +9280,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9809,6 +9827,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10343,6 +10362,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10883,6 +10903,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11430,6 +11451,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11981,6 +12003,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12522,6 +12545,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12995,6 +13019,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13469,6 +13494,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13964,6 +13990,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14451,6 +14478,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14940,6 +14968,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15440,6 +15469,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15940,6 +15970,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16430,6 +16461,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16952,6 +16984,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17478,6 +17511,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18025,6 +18059,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18564,6 +18599,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19105,6 +19141,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19657,6 +19694,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20209,6 +20247,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20751,6 +20790,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21272,6 +21312,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21798,6 +21839,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22345,6 +22387,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22884,6 +22927,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23425,6 +23469,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23977,6 +24022,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24529,6 +24575,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25071,6 +25118,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result
index 69548fdb94b..32a840c1577 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_myisam.result
@@ -493,6 +493,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -966,6 +967,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1460,6 +1462,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1942,6 +1945,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2430,6 +2434,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2925,6 +2930,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3424,6 +3430,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3913,6 +3920,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4434,6 +4442,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4959,6 +4968,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5505,6 +5515,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6039,6 +6050,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6579,6 +6591,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7126,6 +7139,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7677,6 +7691,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8218,6 +8233,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8738,6 +8754,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9263,6 +9280,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9809,6 +9827,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10343,6 +10362,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10883,6 +10903,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11430,6 +11451,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11981,6 +12003,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12522,6 +12545,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12995,6 +13019,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13469,6 +13494,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13964,6 +13990,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14451,6 +14478,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14940,6 +14968,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15440,6 +15469,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15940,6 +15970,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16430,6 +16461,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16952,6 +16984,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17478,6 +17511,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18025,6 +18059,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18564,6 +18599,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19105,6 +19141,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19657,6 +19694,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20209,6 +20247,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20751,6 +20790,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21272,6 +21312,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21798,6 +21839,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22345,6 +22387,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22884,6 +22927,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23425,6 +23469,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23977,6 +24022,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24529,6 +24575,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25071,6 +25118,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result
index 644a5f32f84..d88bdfcbe00 100644
--- a/mysql-test/suite/parts/r/partition_alter4_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result
@@ -60,6 +60,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -483,6 +484,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -519,6 +521,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -945,6 +948,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -989,6 +993,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -1418,6 +1423,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1460,6 +1466,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -1885,6 +1892,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1925,6 +1933,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -2352,6 +2361,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2396,6 +2406,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -2828,6 +2839,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2872,6 +2884,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -3306,6 +3319,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3346,6 +3360,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -3772,6 +3787,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3810,6 +3826,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -4233,6 +4250,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4269,6 +4287,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -4695,6 +4714,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4739,6 +4759,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -5168,6 +5189,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5210,6 +5232,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -5635,6 +5658,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5675,6 +5699,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -6102,6 +6127,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6146,6 +6172,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -6578,6 +6605,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6622,6 +6650,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -7056,6 +7085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7096,6 +7126,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -7522,6 +7553,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7983,6 +8015,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8445,6 +8478,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8918,6 +8952,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9385,6 +9420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9852,6 +9888,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10328,6 +10365,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10806,6 +10844,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11272,6 +11311,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11733,6 +11773,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12195,6 +12236,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12668,6 +12710,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13135,6 +13178,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13602,6 +13646,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14078,6 +14123,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14556,6 +14602,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15022,6 +15069,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15060,6 +15108,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -15483,6 +15532,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15519,6 +15569,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -15945,6 +15996,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15989,6 +16041,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -16418,6 +16471,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16460,6 +16514,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -16885,6 +16940,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16925,6 +16981,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -17352,6 +17409,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17396,6 +17454,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -17828,6 +17887,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17872,6 +17932,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -18306,6 +18367,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18346,6 +18408,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -18772,6 +18835,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19236,6 +19300,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19698,6 +19763,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20171,6 +20237,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20638,6 +20705,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21105,6 +21173,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21581,6 +21650,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22059,6 +22129,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22525,6 +22596,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22986,6 +23058,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23448,6 +23521,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23921,6 +23995,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24388,6 +24463,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24855,6 +24931,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25331,6 +25408,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25809,6 +25887,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26275,6 +26354,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26736,6 +26816,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27198,6 +27279,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27671,6 +27753,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28138,6 +28221,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28605,6 +28689,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29081,6 +29166,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29559,6 +29645,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30025,6 +30112,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30486,6 +30574,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30948,6 +31037,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31421,6 +31511,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31888,6 +31979,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32355,6 +32447,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32831,6 +32924,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33309,6 +33403,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33775,6 +33870,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34236,6 +34332,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34698,6 +34795,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35171,6 +35269,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35638,6 +35737,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36105,6 +36205,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36581,6 +36682,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37059,6 +37161,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37525,6 +37628,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37990,6 +38094,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -38453,6 +38558,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -38927,6 +39033,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -39395,6 +39502,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -39863,6 +39971,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -40340,6 +40449,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -40819,6 +40929,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -41286,6 +41397,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -41748,6 +41860,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -42211,6 +42324,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -42685,6 +42799,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -43153,6 +43268,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -43621,6 +43737,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -44098,6 +44215,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -44577,6 +44695,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45044,6 +45163,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45505,6 +45625,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45967,6 +46088,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -46440,6 +46562,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -46907,6 +47030,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -47374,6 +47498,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -47850,6 +47975,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -48328,6 +48454,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -48794,6 +48921,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -49255,6 +49383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -49717,6 +49846,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -50190,6 +50320,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -50657,6 +50788,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -51124,6 +51256,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -51600,6 +51733,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -52078,6 +52212,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -52544,6 +52679,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53006,6 +53142,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53469,6 +53606,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53943,6 +54081,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -54411,6 +54550,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -54879,6 +55019,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -55356,6 +55497,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -55835,6 +55977,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -56302,6 +56445,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -56764,6 +56908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -57224,6 +57369,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -57695,6 +57841,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -58160,6 +58307,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -58625,6 +58773,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -59099,6 +59248,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -59575,6 +59725,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60039,6 +60190,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60498,6 +60650,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60958,6 +61111,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -61429,6 +61583,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -61894,6 +62049,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -62359,6 +62515,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -62833,6 +62990,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -63309,6 +63467,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -63773,6 +63932,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -64552,6 +64712,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65012,6 +65173,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65483,6 +65645,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65948,6 +66111,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -66413,6 +66577,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -66887,6 +67052,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -67363,6 +67529,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -67827,6 +67994,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -68291,6 +68459,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -68753,6 +68922,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -69226,6 +69396,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -69693,6 +69864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -70160,6 +70332,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -70636,6 +70809,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -71114,6 +71288,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -71580,6 +71755,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72041,6 +72217,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72503,6 +72680,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72976,6 +73154,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -73443,6 +73622,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -73910,6 +74090,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -74386,6 +74567,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -74864,6 +75046,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -75330,6 +75513,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -75791,6 +75975,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -76253,6 +76438,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -76726,6 +76912,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -77193,6 +77380,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -77660,6 +77848,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -78136,6 +78325,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -78614,6 +78804,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -79080,6 +79271,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -79541,6 +79733,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80003,6 +80196,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80476,6 +80670,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80943,6 +81138,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -81410,6 +81606,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -81886,6 +82083,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -82364,6 +82562,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -82830,6 +83029,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -83291,6 +83491,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -83753,6 +83954,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -84226,6 +84428,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -84693,6 +84896,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -85160,6 +85364,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -85636,6 +85841,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -86114,6 +86320,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -86580,6 +86787,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87039,6 +87247,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87493,6 +87702,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87955,6 +88165,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -88415,6 +88626,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -88873,6 +89085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -89335,6 +89548,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -89797,6 +90011,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -90255,6 +90470,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_alter4_myisam.result b/mysql-test/suite/parts/r/partition_alter4_myisam.result
index 41723a268e1..90edd1b2210 100644
--- a/mysql-test/suite/parts/r/partition_alter4_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter4_myisam.result
@@ -60,6 +60,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -493,6 +494,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -528,6 +530,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -970,6 +973,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1013,6 +1017,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -1464,6 +1469,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1505,6 +1511,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -1948,6 +1955,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1987,6 +1995,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -2436,6 +2445,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2479,6 +2489,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -2933,6 +2944,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2976,6 +2988,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -3432,6 +3445,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3471,6 +3485,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -3921,6 +3936,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3958,6 +3974,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -4391,6 +4408,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4426,6 +4444,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -4868,6 +4887,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4911,6 +4931,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -5362,6 +5383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5403,6 +5425,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -5846,6 +5869,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5885,6 +5909,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -6334,6 +6359,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6377,6 +6403,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -6831,6 +6858,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6874,6 +6902,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -7330,6 +7359,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7369,6 +7399,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -7819,6 +7850,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8289,6 +8321,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8766,6 +8799,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9260,6 +9294,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9744,6 +9779,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10232,6 +10268,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10729,6 +10766,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11228,6 +11266,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11717,6 +11756,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12187,6 +12227,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12664,6 +12705,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13158,6 +13200,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13642,6 +13685,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14130,6 +14174,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14627,6 +14672,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15126,6 +15172,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15615,6 +15662,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15652,6 +15700,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -16085,6 +16134,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16120,6 +16170,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -16562,6 +16613,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16605,6 +16657,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -17056,6 +17109,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17097,6 +17151,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -17540,6 +17595,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17579,6 +17635,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -18028,6 +18085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18071,6 +18129,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -18525,6 +18584,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18568,6 +18628,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -19024,6 +19085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19063,6 +19125,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -19513,6 +19576,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19986,6 +20050,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20463,6 +20528,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20957,6 +21023,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21441,6 +21508,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21929,6 +21997,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22426,6 +22495,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22925,6 +22995,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23414,6 +23485,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23884,6 +23956,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24361,6 +24434,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24855,6 +24929,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25339,6 +25414,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25827,6 +25903,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26324,6 +26401,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26823,6 +26901,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27312,6 +27391,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27782,6 +27862,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28259,6 +28340,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28753,6 +28835,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29237,6 +29320,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29725,6 +29809,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30222,6 +30307,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30721,6 +30807,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31210,6 +31297,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31680,6 +31768,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32157,6 +32246,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32651,6 +32741,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33135,6 +33226,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33623,6 +33715,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34120,6 +34213,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34619,6 +34713,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35108,6 +35203,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35578,6 +35674,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36055,6 +36152,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36549,6 +36647,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37033,6 +37132,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37521,6 +37621,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -38018,6 +38119,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -38517,6 +38619,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -39006,6 +39109,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -39479,6 +39583,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -39956,6 +40061,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -40450,6 +40556,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -40934,6 +41041,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -41422,6 +41530,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -41919,6 +42028,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -42418,6 +42528,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -42907,6 +43018,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -43377,6 +43489,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -43854,6 +43967,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -44348,6 +44462,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -44832,6 +44947,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45320,6 +45436,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45817,6 +45934,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -46316,6 +46434,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -46805,6 +46924,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -47275,6 +47395,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -47752,6 +47873,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -48246,6 +48368,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -48730,6 +48853,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -49218,6 +49342,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -49715,6 +49840,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -50214,6 +50340,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -50703,6 +50830,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -51173,6 +51301,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -51650,6 +51779,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -52144,6 +52274,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -52628,6 +52759,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53116,6 +53248,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53613,6 +53746,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -54112,6 +54246,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -54601,6 +54736,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -55071,6 +55207,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -55548,6 +55685,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -56042,6 +56180,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -56526,6 +56665,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -57014,6 +57154,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -57511,6 +57652,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -58010,6 +58152,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -58499,6 +58642,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -58970,6 +59114,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -59445,6 +59590,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -59937,6 +60083,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60419,6 +60566,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60905,6 +61053,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -61400,6 +61549,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -61897,6 +62047,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -62384,6 +62535,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -62852,6 +63004,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -63327,6 +63480,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -63819,6 +63973,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -64301,6 +64456,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -64787,6 +64943,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65282,6 +65439,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65779,6 +65937,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -66266,6 +66425,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -67054,6 +67214,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -67529,6 +67690,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -68021,6 +68183,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -68503,6 +68666,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -68989,6 +69153,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -69484,6 +69649,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -69981,6 +70147,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -70468,6 +70635,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -70941,6 +71109,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -71418,6 +71587,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -71912,6 +72082,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72396,6 +72567,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72884,6 +73056,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -73381,6 +73554,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -73880,6 +74054,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -74369,6 +74544,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -74839,6 +75015,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -75316,6 +75493,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -75810,6 +75988,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -76294,6 +76473,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -76782,6 +76962,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -77279,6 +77460,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -77778,6 +77960,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -78267,6 +78450,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -78737,6 +78921,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -79214,6 +79399,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -79708,6 +79894,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80192,6 +80379,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80680,6 +80868,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -81177,6 +81366,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -81676,6 +81866,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -82165,6 +82356,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -82635,6 +82827,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -83112,6 +83305,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -83606,6 +83800,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -84090,6 +84285,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -84578,6 +84774,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -85075,6 +85272,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -85574,6 +85772,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -86063,6 +86262,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -86533,6 +86733,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87010,6 +87211,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87504,6 +87706,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87988,6 +88191,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -88476,6 +88680,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -88973,6 +89178,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -89472,6 +89678,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -89961,6 +90168,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -90426,6 +90634,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -90886,6 +91095,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -91354,6 +91564,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -91820,6 +92031,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -92284,6 +92496,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -92752,6 +92965,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -93220,6 +93434,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -93684,6 +93899,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_basic_innodb.result b/mysql-test/suite/parts/r/partition_basic_innodb.result
index 570a30bcd81..5ea1f98ddcb 100644
--- a/mysql-test/suite/parts/r/partition_basic_innodb.result
+++ b/mysql-test/suite/parts/r/partition_basic_innodb.result
@@ -486,6 +486,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -946,6 +947,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1424,6 +1426,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1894,6 +1897,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2366,6 +2370,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2847,6 +2852,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3334,6 +3340,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3806,6 +3813,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4265,6 +4273,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4725,6 +4734,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5203,6 +5213,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5673,6 +5684,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6143,6 +6155,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6624,6 +6637,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7107,6 +7121,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7579,6 +7594,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8079,6 +8095,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8576,6 +8593,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9091,6 +9109,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9598,6 +9617,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10107,6 +10127,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10625,6 +10646,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11149,6 +11171,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11658,6 +11681,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12153,6 +12177,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12650,6 +12675,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13165,6 +13191,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13672,6 +13699,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14181,6 +14209,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14699,6 +14728,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15223,6 +15253,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15732,6 +15763,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16243,6 +16275,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16756,6 +16789,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17287,6 +17321,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17810,6 +17845,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18335,6 +18371,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18869,6 +18906,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19409,6 +19447,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19934,6 +19973,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20434,6 +20474,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20931,6 +20972,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21446,6 +21488,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21953,6 +21996,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22460,6 +22504,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22978,6 +23023,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23498,6 +23544,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24007,6 +24054,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24502,6 +24550,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24999,6 +25048,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25514,6 +25564,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26021,6 +26072,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26528,6 +26580,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27046,6 +27099,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27566,6 +27620,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28075,6 +28130,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28586,6 +28642,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29099,6 +29156,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29630,6 +29688,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30153,6 +30212,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30676,6 +30736,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31210,6 +31271,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31746,6 +31808,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32271,6 +32334,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_basic_myisam.result b/mysql-test/suite/parts/r/partition_basic_myisam.result
index 3b84c0295f2..06bf043b382 100644
--- a/mysql-test/suite/parts/r/partition_basic_myisam.result
+++ b/mysql-test/suite/parts/r/partition_basic_myisam.result
@@ -490,6 +490,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -956,6 +957,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1443,6 +1445,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1920,6 +1923,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2401,6 +2405,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2891,6 +2896,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3387,6 +3393,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3869,6 +3876,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4331,6 +4339,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4797,6 +4806,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5284,6 +5294,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5761,6 +5772,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6240,6 +6252,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6730,6 +6743,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7222,6 +7236,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7704,6 +7719,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8223,6 +8239,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8742,6 +8759,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9282,6 +9300,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9812,6 +9831,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10346,6 +10366,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10889,6 +10910,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11438,6 +11460,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11973,6 +11996,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12492,6 +12516,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13011,6 +13036,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13551,6 +13577,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14081,6 +14108,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14613,6 +14641,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15156,6 +15185,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15701,6 +15731,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16236,6 +16267,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result
index 5e59c8f08ba..df141a93033 100644
--- a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result
+++ b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result
@@ -505,6 +505,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1000,6 +1001,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1511,6 +1513,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2012,6 +2015,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2517,6 +2521,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3027,6 +3032,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3559,6 +3565,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4065,6 +4072,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4538,6 +4546,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5033,6 +5042,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5544,6 +5554,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6045,6 +6056,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6548,6 +6560,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7058,6 +7071,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7590,6 +7604,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8096,6 +8111,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8626,6 +8642,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9174,6 +9191,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9738,6 +9756,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10292,6 +10311,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10850,6 +10870,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11413,6 +11434,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11998,6 +12020,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12557,6 +12580,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13087,6 +13111,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13635,6 +13660,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14199,6 +14225,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14753,6 +14780,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15309,6 +15337,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15872,6 +15901,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16457,6 +16487,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17016,6 +17047,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17540,6 +17572,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18078,6 +18111,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18635,6 +18669,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19177,6 +19212,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19723,6 +19759,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20279,6 +20316,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20830,6 +20868,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_engine_innodb.result b/mysql-test/suite/parts/r/partition_engine_innodb.result
index 002fe90c78a..38221951ae8 100644
--- a/mysql-test/suite/parts/r/partition_engine_innodb.result
+++ b/mysql-test/suite/parts/r/partition_engine_innodb.result
@@ -475,6 +475,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -933,6 +934,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1395,6 +1397,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1920,6 +1923,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2421,6 +2425,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2883,6 +2888,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3342,6 +3348,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3804,6 +3811,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4269,6 +4277,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4723,6 +4732,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5178,6 +5188,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_engine_myisam.result b/mysql-test/suite/parts/r/partition_engine_myisam.result
index f940b250c19..683729fa2f3 100644
--- a/mysql-test/suite/parts/r/partition_engine_myisam.result
+++ b/mysql-test/suite/parts/r/partition_engine_myisam.result
@@ -485,6 +485,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -952,6 +953,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1427,6 +1429,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1965,6 +1968,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2479,6 +2483,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2954,6 +2959,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3422,6 +3428,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3897,6 +3904,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4375,6 +4383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4836,6 +4845,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5300,6 +5310,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result
index 88469a339ad..023195e9760 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result
@@ -1020,6 +1020,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+MySQL_Test_DB.t1 analyze status Engine-independent statistics collected
MySQL_Test_DB.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result
index 585bd24dca6..0b5f96696b0 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc0_memory.result
@@ -1020,6 +1020,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+MySQL_Test_DB.t1 analyze status Engine-independent statistics collected
MySQL_Test_DB.t1 analyze note The storage engine for the table doesn't support analyze
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result
index 59181388bd0..8461d4136e0 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result
@@ -1020,6 +1020,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+MySQL_Test_DB.t1 analyze status Engine-independent statistics collected
MySQL_Test_DB.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result
index c4d63f663e1..4c541d9467e 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result
@@ -987,6 +987,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result
index d29dfd343a6..8f934506ee2 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc1_memory.result
@@ -987,6 +987,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze note The storage engine for the table doesn't support analyze
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result
index f26b975b75e..47e07ecc3a6 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result
@@ -987,6 +987,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result
index a1dad1b34b3..6cd4c4991b7 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result
@@ -987,6 +987,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result
index 88f59da8f13..d1b7a599923 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result
@@ -987,6 +987,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze note The storage engine for the table doesn't support analyze
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result
index a498d4667b1..ad83e95929a 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result
@@ -987,6 +987,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/mysql-test/suite/parts/r/partition_repair_myisam.result b/mysql-test/suite/parts/r/partition_repair_myisam.result
index 6e99f1d3632..0521263df12 100644
--- a/mysql-test/suite/parts/r/partition_repair_myisam.result
+++ b/mysql-test/suite/parts/r/partition_repair_myisam.result
@@ -322,7 +322,8 @@ FLUSH TABLES;
# replacing p6 with a crashed MYD file (1) (splitted dynamic record)
ANALYZE TABLE t1_will_crash;
Table Op Msg_type Msg_text
-test.t1_will_crash analyze status OK
+test.t1_will_crash analyze Warning Engine-independent statistics are not collected for column 'c'
+test.t1_will_crash analyze status Operation failed
OPTIMIZE TABLE t1_will_crash;
Table Op Msg_type Msg_text
test.t1_will_crash optimize info Found row block followed by deleted block
diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
index ff184806e2e..e43841c80ac 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@ -19,16 +19,16 @@ where name like 'Wait/Synch/Rwlock/sql/%'
and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
order by name limit 10;
NAME ENABLED TIMED
+wait/synch/rwlock/sql/LOCK_all_status_vars YES YES
wait/synch/rwlock/sql/LOCK_dboptions YES YES
wait/synch/rwlock/sql/LOCK_grant YES YES
wait/synch/rwlock/sql/LOCK_SEQUENCE YES YES
+wait/synch/rwlock/sql/LOCK_ssl_refresh YES YES
wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES
wait/synch/rwlock/sql/LOCK_sys_init_connect YES YES
wait/synch/rwlock/sql/LOCK_sys_init_slave YES YES
wait/synch/rwlock/sql/LOGGER::LOCK_logger YES YES
wait/synch/rwlock/sql/MDL_context::LOCK_waiting_for YES YES
-wait/synch/rwlock/sql/MDL_lock::rwlock YES YES
-wait/synch/rwlock/sql/Query_cache_query::lock YES YES
select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Cond/sql/%'
and name not in (
diff --git a/mysql-test/suite/perfschema/r/event_aggregate.result b/mysql-test/suite/perfschema/r/event_aggregate.result
index 9ab62329fc9..7fa08534bb1 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate.result
@@ -235,38 +235,38 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -363,10 +363,10 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 0
user2 localhost stage/sql/Closing tables 0
user2 localhost stage/sql/Init 0
@@ -375,10 +375,10 @@ user2 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 0
user2 stage/sql/Closing tables 0
user2 stage/sql/Init 0
@@ -387,24 +387,24 @@ user2 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -518,10 +518,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -530,10 +530,10 @@ user2 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -542,24 +542,24 @@ user2 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -677,10 +677,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -694,10 +694,10 @@ user3 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -711,24 +711,24 @@ user3 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -863,10 +863,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -880,10 +880,10 @@ user3 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -897,24 +897,24 @@ user3 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1053,10 +1053,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1075,10 +1075,10 @@ user4 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1097,24 +1097,24 @@ user4 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1270,10 +1270,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1292,10 +1292,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1314,24 +1314,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 20
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1478,10 +1478,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1500,10 +1500,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1522,24 +1522,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 21
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1684,10 +1684,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1706,10 +1706,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1728,24 +1728,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 22
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1887,10 +1887,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1909,10 +1909,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1931,24 +1931,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 23
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2087,10 +2087,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2109,10 +2109,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2131,24 +2131,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2288,10 +2288,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2310,10 +2310,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2332,24 +2332,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2488,10 +2488,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2510,10 +2510,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2532,24 +2532,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2688,10 +2688,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2710,10 +2710,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2732,24 +2732,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2888,10 +2888,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2910,10 +2910,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2932,24 +2932,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3088,10 +3088,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -3110,10 +3110,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -3132,24 +3132,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3288,10 +3288,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -3310,10 +3310,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -3332,24 +3332,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3510,10 +3510,10 @@ user4 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -3532,24 +3532,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3732,24 +3732,24 @@ user4 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3939,17 +3939,17 @@ localhost stage/sql/Opening tables 0
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4146,10 +4146,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4346,10 +4346,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4546,10 +4546,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4746,10 +4746,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4946,10 +4946,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -5146,10 +5146,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -5310,10 +5310,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -5418,10 +5418,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -5506,10 +5506,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
index ece0402335d..19dec52aa47 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
@@ -217,31 +217,31 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -326,10 +326,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 0
user2 stage/sql/Closing tables 0
user2 stage/sql/Init 0
@@ -338,24 +338,24 @@ user2 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -452,10 +452,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -464,24 +464,24 @@ user2 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -578,10 +578,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -595,24 +595,24 @@ user3 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -721,10 +721,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -738,24 +738,24 @@ user3 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -864,10 +864,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -886,24 +886,24 @@ user4 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1024,10 +1024,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1046,24 +1046,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 20
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1175,10 +1175,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1197,24 +1197,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 21
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1324,10 +1324,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1346,24 +1346,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 22
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1470,10 +1470,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1492,24 +1492,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 23
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1613,10 +1613,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1635,24 +1635,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1757,10 +1757,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1779,24 +1779,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1900,10 +1900,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1922,24 +1922,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2043,10 +2043,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2065,24 +2065,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2186,10 +2186,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2208,24 +2208,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2329,10 +2329,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2351,24 +2351,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2472,10 +2472,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2494,24 +2494,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2615,10 +2615,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2637,24 +2637,24 @@ user4 stage/sql/Opening tables 3
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2780,24 +2780,24 @@ user4 stage/sql/Opening tables 0
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2930,17 +2930,17 @@ localhost stage/sql/Opening tables 0
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3080,10 +3080,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3223,10 +3223,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3366,10 +3366,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3509,10 +3509,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3652,10 +3652,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3795,10 +3795,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3938,10 +3938,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -4045,10 +4045,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -4132,10 +4132,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
index 083e1bffdd2..3aa27664cac 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
@@ -185,26 +185,26 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
execute dump_stages_host;
host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -280,10 +280,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 0
user2 stage/sql/Closing tables 0
user2 stage/sql/Init 0
@@ -294,17 +294,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -392,10 +392,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -406,17 +406,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -504,10 +504,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -523,17 +523,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -633,10 +633,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -652,17 +652,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -762,10 +762,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -786,17 +786,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -908,10 +908,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -932,17 +932,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1045,10 +1045,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1069,17 +1069,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1180,10 +1180,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1204,17 +1204,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1312,10 +1312,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1336,17 +1336,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1441,10 +1441,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1465,17 +1465,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1571,10 +1571,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1595,17 +1595,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1700,10 +1700,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1724,17 +1724,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1829,10 +1829,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1853,17 +1853,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1958,10 +1958,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1982,17 +1982,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2087,10 +2087,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2111,17 +2111,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2216,10 +2216,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2240,17 +2240,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2345,10 +2345,10 @@ user host event_name count_star
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2369,17 +2369,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2498,17 +2498,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2627,17 +2627,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2763,10 +2763,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2892,10 +2892,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3021,10 +3021,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3150,10 +3150,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3279,10 +3279,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3408,10 +3408,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3537,10 +3537,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3630,10 +3630,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3703,10 +3703,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
index c9b2b768691..4d4a842948f 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
@@ -199,24 +199,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -289,24 +289,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -386,24 +386,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -479,24 +479,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -579,24 +579,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -675,24 +675,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -778,24 +778,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 20
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -872,24 +872,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 21
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -964,24 +964,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 22
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1053,24 +1053,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 23
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1139,24 +1139,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1226,24 +1226,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1312,24 +1312,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1398,24 +1398,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1484,24 +1484,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1570,24 +1570,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1656,24 +1656,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1742,24 +1742,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1828,24 +1828,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1921,17 +1921,17 @@ localhost stage/sql/Opening tables 0
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2014,10 +2014,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2100,10 +2100,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2186,10 +2186,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2272,10 +2272,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2358,10 +2358,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2444,10 +2444,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2530,10 +2530,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2616,10 +2616,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2702,10 +2702,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
index 89443515f31..db281652c0c 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
@@ -169,17 +169,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -245,17 +245,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -328,17 +328,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -407,17 +407,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -493,17 +493,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -575,17 +575,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -664,17 +664,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -744,17 +744,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -822,17 +822,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -897,17 +897,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -969,17 +969,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1042,17 +1042,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1114,17 +1114,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1186,17 +1186,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1258,17 +1258,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1330,17 +1330,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1402,17 +1402,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1474,17 +1474,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1546,17 +1546,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1618,17 +1618,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1697,10 +1697,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1769,10 +1769,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1841,10 +1841,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1913,10 +1913,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -1985,10 +1985,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2057,10 +2057,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2129,10 +2129,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2201,10 +2201,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -2273,10 +2273,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
index 0ea5d90ea41..c8996fa2846 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
@@ -203,33 +203,33 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
execute dump_stages_host;
host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -317,10 +317,10 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 0
user2 localhost stage/sql/Closing tables 0
user2 localhost stage/sql/Init 0
@@ -329,10 +329,10 @@ user2 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 0
user2 stage/sql/Closing tables 0
user2 stage/sql/Init 0
@@ -343,17 +343,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -458,10 +458,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -470,10 +470,10 @@ user2 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -484,17 +484,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -603,10 +603,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -620,10 +620,10 @@ user3 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -639,17 +639,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -775,10 +775,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -792,10 +792,10 @@ user3 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -811,17 +811,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -951,10 +951,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -973,10 +973,10 @@ user4 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -997,17 +997,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1154,10 +1154,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1176,10 +1176,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 5
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1200,17 +1200,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1348,10 +1348,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1370,10 +1370,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 5
@@ -1394,17 +1394,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1540,10 +1540,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1562,10 +1562,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1586,17 +1586,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1729,10 +1729,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1751,10 +1751,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1775,17 +1775,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1915,10 +1915,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1937,10 +1937,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -1961,17 +1961,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2102,10 +2102,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2124,10 +2124,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2148,17 +2148,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2288,10 +2288,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2310,10 +2310,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2334,17 +2334,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2474,10 +2474,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2496,10 +2496,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2520,17 +2520,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2660,10 +2660,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2682,10 +2682,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2706,17 +2706,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2846,10 +2846,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2868,10 +2868,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -2892,17 +2892,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3032,10 +3032,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -3054,10 +3054,10 @@ user4 localhost stage/sql/Opening tables 3
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -3078,17 +3078,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3240,10 +3240,10 @@ user4 localhost stage/sql/Opening tables 0
execute dump_stages_user;
user event_name count_star
user1 stage/sql/Checking permissions 3
-user1 stage/sql/Closing tables 4
+user1 stage/sql/Closing tables 6
user1 stage/sql/Init 6
user1 stage/sql/Init for update 1
-user1 stage/sql/Opening tables 3
+user1 stage/sql/Opening tables 4
user2 stage/sql/Checking permissions 3
user2 stage/sql/Closing tables 4
user2 stage/sql/Init 6
@@ -3264,17 +3264,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3450,17 +3450,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3636,17 +3636,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3829,10 +3829,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4015,10 +4015,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4201,10 +4201,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4387,10 +4387,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4573,10 +4573,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4759,10 +4759,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -4909,10 +4909,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -5003,10 +5003,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -5077,10 +5077,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
index 52c674024bd..508a65d9ba0 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
@@ -215,33 +215,33 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
execute dump_stages_user;
user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -324,10 +324,10 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 0
user2 localhost stage/sql/Closing tables 0
user2 localhost stage/sql/Init 0
@@ -338,24 +338,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 3
-localhost stage/sql/Closing tables 4
+localhost stage/sql/Closing tables 6
localhost stage/sql/Init 5
localhost stage/sql/Init for update 1
-localhost stage/sql/Opening tables 3
+localhost stage/sql/Opening tables 4
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -450,10 +450,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -464,24 +464,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -576,10 +576,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -595,24 +595,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 6
-localhost stage/sql/Closing tables 8
+localhost stage/sql/Closing tables 10
localhost stage/sql/Init 10
localhost stage/sql/Init for update 2
-localhost stage/sql/Opening tables 6
+localhost stage/sql/Opening tables 7
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -719,10 +719,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -738,24 +738,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -862,10 +862,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -886,24 +886,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 9
-localhost stage/sql/Closing tables 12
+localhost stage/sql/Closing tables 14
localhost stage/sql/Init 15
localhost stage/sql/Init for update 3
-localhost stage/sql/Opening tables 9
+localhost stage/sql/Opening tables 10
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1022,10 +1022,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1046,24 +1046,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 20
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1173,10 +1173,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1197,24 +1197,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 21
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1322,10 +1322,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1346,24 +1346,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 22
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1468,10 +1468,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1492,24 +1492,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 23
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1611,10 +1611,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1635,24 +1635,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1755,10 +1755,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1779,24 +1779,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1898,10 +1898,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1922,24 +1922,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2041,10 +2041,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2065,24 +2065,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2184,10 +2184,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2208,24 +2208,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2327,10 +2327,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2351,24 +2351,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2470,10 +2470,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2494,24 +2494,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2637,24 +2637,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2780,24 +2780,24 @@ user event_name count_star
execute dump_stages_host;
host event_name count_star
localhost stage/sql/Checking permissions 12
-localhost stage/sql/Closing tables 16
+localhost stage/sql/Closing tables 18
localhost stage/sql/Init 24
localhost stage/sql/Init for update 4
-localhost stage/sql/Opening tables 12
+localhost stage/sql/Opening tables 13
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2930,17 +2930,17 @@ localhost stage/sql/Opening tables 0
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3080,10 +3080,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3223,10 +3223,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3366,10 +3366,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3509,10 +3509,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3652,10 +3652,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3795,10 +3795,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3902,10 +3902,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3989,10 +3989,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -4076,10 +4076,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
index a493631d71f..579fadc51c0 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
@@ -183,10 +183,10 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
execute dump_stages_user;
user event_name count_star
execute dump_stages_host;
@@ -194,17 +194,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -278,10 +278,10 @@ wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 0
user2 localhost stage/sql/Closing tables 0
user2 localhost stage/sql/Init 0
@@ -294,17 +294,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 3
-stage/sql/Closing tables 4
+stage/sql/Closing tables 6
stage/sql/Init 5
stage/sql/Init for update 1
-stage/sql/Opening tables 3
+stage/sql/Opening tables 4
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -390,10 +390,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -406,17 +406,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -502,10 +502,10 @@ wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -523,17 +523,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 6
-stage/sql/Closing tables 8
+stage/sql/Closing tables 10
stage/sql/Init 10
stage/sql/Init for update 2
-stage/sql/Opening tables 6
+stage/sql/Opening tables 7
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -631,10 +631,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -652,17 +652,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -760,10 +760,10 @@ wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -786,17 +786,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 9
-stage/sql/Closing tables 12
+stage/sql/Closing tables 14
stage/sql/Init 15
stage/sql/Init for update 3
-stage/sql/Opening tables 9
+stage/sql/Opening tables 10
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -906,10 +906,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 5
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -932,17 +932,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 20
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1043,10 +1043,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 5
@@ -1069,17 +1069,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 21
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1178,10 +1178,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1204,17 +1204,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 22
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1310,10 +1310,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1336,17 +1336,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 23
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1439,10 +1439,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1465,17 +1465,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1569,10 +1569,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1595,17 +1595,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1698,10 +1698,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1724,17 +1724,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1827,10 +1827,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1853,17 +1853,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -1956,10 +1956,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -1982,17 +1982,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2085,10 +2085,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2111,17 +2111,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2214,10 +2214,10 @@ wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/Checking permissions 3
-user1 localhost stage/sql/Closing tables 4
+user1 localhost stage/sql/Closing tables 6
user1 localhost stage/sql/Init 6
user1 localhost stage/sql/Init for update 1
-user1 localhost stage/sql/Opening tables 3
+user1 localhost stage/sql/Opening tables 4
user2 localhost stage/sql/Checking permissions 3
user2 localhost stage/sql/Closing tables 4
user2 localhost stage/sql/Init 6
@@ -2240,17 +2240,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2369,17 +2369,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2498,17 +2498,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2627,17 +2627,17 @@ host event_name count_star
execute dump_stages_global;
event_name count_star
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2763,10 +2763,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -2892,10 +2892,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3021,10 +3021,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3150,10 +3150,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3279,10 +3279,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3408,10 +3408,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
user1 localhost statement/com/Error 0
@@ -3501,10 +3501,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3574,10 +3574,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
@@ -3647,10 +3647,10 @@ stage/sql/Opening tables 0
execute dump_stages_history;
event_name count(event_name)
stage/sql/Checking permissions 12
-stage/sql/Closing tables 16
+stage/sql/Closing tables 18
stage/sql/Init 24
stage/sql/Init for update 4
-stage/sql/Opening tables 12
+stage/sql/Opening tables 13
execute dump_statements_account;
user host event_name count_star
execute dump_statements_user;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result
index a172dff7935..7963bed8213 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result
@@ -118,7 +118,7 @@ Con4 is alive
Con4 is alive
select current_user();
current_user()
-root@192.0.2.4
+root@santa.claus.ipv4.example.com
disconnect con4;
connection default;
"Dumping performance_schema.host_cache"
@@ -155,7 +155,7 @@ Con5 is alive
Con5 is alive
select current_user();
current_user()
-root@192.0.2.4
+root@santa.claus.ipv4.example.com
disconnect con5;
connection default;
"Dumping performance_schema.host_cache"
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result
index 4fdc6ef1b4c..baddc88b116 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result
@@ -118,7 +118,7 @@ Con4 is alive
Con4 is alive
select current_user();
current_user()
-root@2001:db8::6:6
+root@santa.claus.ipv6.example.com
disconnect con4;
connection default;
"Dumping performance_schema.host_cache"
@@ -155,7 +155,7 @@ Con5 is alive
Con5 is alive
select current_user();
current_user()
-root@2001:db8::6:6
+root@santa.claus.ipv6.example.com
disconnect con5;
connection default;
"Dumping performance_schema.host_cache"
diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result
index 68e55f64880..baa73d28c90 100644
--- a/mysql-test/suite/perfschema/r/privilege_table_io.result
+++ b/mysql-test/suite/perfschema/r/privilege_table_io.result
@@ -95,11 +95,11 @@ where event_name like 'wait/io/table/%'
and object_schema in ("test", "mysql")
order by thread_id, event_id;
event_name short_source object_type object_schema pretty_name operation number_of_bytes
-wait/io/table/sql/handler handler.cc: TABLE mysql user fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE mysql user fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE mysql user fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE mysql user fetch NULL
-wait/io/table/sql/handler handler.cc: TABLE mysql user fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE mysql global_priv fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE mysql global_priv fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE mysql global_priv fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE mysql global_priv fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE mysql global_priv fetch NULL
wait/io/table/sql/handler handler.cc: TABLE mysql db fetch NULL
wait/io/table/sql/handler handler.cc: TABLE mysql db fetch NULL
wait/io/table/sql/handler handler.cc: TABLE mysql db fetch NULL
@@ -110,6 +110,8 @@ wait/io/table/sql/handler handler.cc: TABLE mysql roles_mapping fetch NULL
wait/io/table/sql/handler handler.cc: TABLE mysql tables_priv fetch NULL
wait/io/table/sql/handler handler.cc: TABLE mysql procs_priv fetch NULL
wait/io/table/sql/handler handler.cc: TABLE mysql servers fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE mysql table_stats fetch NULL
+wait/io/table/sql/handler handler.cc: TABLE mysql column_stats fetch NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
wait/io/table/sql/handler handler.cc: TABLE test marker insert NULL
diff --git a/mysql-test/suite/perfschema/r/setup_instruments_defaults.result b/mysql-test/suite/perfschema/r/setup_instruments_defaults.result
index f31bb1a8b7a..9ce90a2effa 100644
--- a/mysql-test/suite/perfschema/r/setup_instruments_defaults.result
+++ b/mysql-test/suite/perfschema/r/setup_instruments_defaults.result
@@ -25,7 +25,6 @@ WHERE name IN (
AND enabled = 'yes' AND timed = 'yes'
ORDER BY name;
NAME ENABLED TIMED
-wait/synch/mutex/sql/LOG_INFO::lock YES YES
wait/synch/mutex/sql/THD::LOCK_thd_data YES YES
SELECT * FROM performance_schema.setup_instruments
WHERE name = 'wait/synch/mutex/sql/hash_filo::lock'
diff --git a/mysql-test/suite/perfschema/r/socket_connect.result b/mysql-test/suite/perfschema/r/socket_connect.result
index 1ac22f6ca34..304521b044f 100644
--- a/mysql-test/suite/perfschema/r/socket_connect.result
+++ b/mysql-test/suite/perfschema/r/socket_connect.result
@@ -167,19 +167,6 @@ connection default;
# 6.1 Verify that there are no TCP/IP connections in the socket instance table
-SELECT COUNT(*) = 0 AS 'Expect 1'
-FROM performance_schema.socket_instances
-WHERE EVENT_NAME LIKE '%client_connection%'
- AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
-AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1');
-Expect 1
-1
# 6.2 Verify that there are no TCP/IP connections in the summary instance table
-SELECT COUNT(*) = 0 AS 'Expect 1'
-FROM performance_schema.socket_summary_by_instance
-WHERE EVENT_NAME LIKE '%client_connection%'
- AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
-Expect 1
-1
diff --git a/mysql-test/suite/perfschema/r/stage_mdl_global.result b/mysql-test/suite/perfschema/r/stage_mdl_global.result
index 7d15b250bd9..11531124cae 100644
--- a/mysql-test/suite/perfschema/r/stage_mdl_global.result
+++ b/mysql-test/suite/perfschema/r/stage_mdl_global.result
@@ -22,7 +22,7 @@ call dump_one_thread('user2');
username event_name sql_text
user2 statement/sql/insert insert into test.t1 values (1), (2), (3)
username event_name nesting_event_type
-user2 stage/sql/Waiting for global read lock STATEMENT
+user2 stage/sql/Waiting for backup lock STATEMENT
username event_name nesting_event_type
user2 stage/sql/Init STATEMENT
user2 stage/sql/Checking permissions STATEMENT
diff --git a/mysql-test/suite/perfschema/t/socket_connect.test b/mysql-test/suite/perfschema/t/socket_connect.test
index 909840144ef..b4579605eb5 100644
--- a/mysql-test/suite/perfschema/t/socket_connect.test
+++ b/mysql-test/suite/perfschema/t/socket_connect.test
@@ -273,18 +273,21 @@ WHERE EVENT_NAME LIKE '%client_connection%'
--echo
--echo # 6.1 Verify that there are no TCP/IP connections in the socket instance table
--echo
-eval SELECT COUNT(*) = 0 AS 'Expect 1'
+let $wait_condition=
+SELECT COUNT(*) = 0 AS 'Expect 1'
FROM performance_schema.socket_instances
WHERE EVENT_NAME LIKE '%client_connection%'
AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
AND $ip_localhost;
+--source include/wait_condition.inc
--echo
--echo # 6.2 Verify that there are no TCP/IP connections in the summary instance table
--echo
-eval SELECT COUNT(*) = 0 AS 'Expect 1'
+let $wait_condition=
+SELECT COUNT(*) = 0 AS 'Expect 1'
FROM performance_schema.socket_summary_by_instance
WHERE EVENT_NAME LIKE '%client_connection%'
AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
-
+--source include/wait_condition.inc
exit;
diff --git a/mysql-test/suite/perfschema/t/stage_mdl_global.test b/mysql-test/suite/perfschema/t/stage_mdl_global.test
index 8863d2da903..03c3d315899 100644
--- a/mysql-test/suite/perfschema/t/stage_mdl_global.test
+++ b/mysql-test/suite/perfschema/t/stage_mdl_global.test
@@ -9,7 +9,7 @@ flush tables with read lock;
connect (con2, localhost, user2, , );
-# Will wait on con1, "Waiting for global read lock"
+# Will wait on con1, "Waiting for backup lock"
--send
insert into test.t1 values (1), (2), (3);
@@ -26,7 +26,7 @@ let $wait_condition=
let $wait_condition=
select count(*) = 1 from performance_schema.threads
where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user2'
- and PROCESSLIST_STATE = 'Waiting for global read lock';
+ and PROCESSLIST_STATE = 'Waiting for backup lock';
--source include/wait_condition.inc
call dump_one_thread('user1');
diff --git a/mysql-test/suite/plugins/r/audit_null.result b/mysql-test/suite/plugins/r/audit_null.result
index 75eb5a9f682..ada85b661ee 100644
--- a/mysql-test/suite/plugins/r/audit_null.result
+++ b/mysql-test/suite/plugins/r/audit_null.result
@@ -74,6 +74,9 @@ root[root] @ localhost [] >> create table t1 (a int)
root[root] @ localhost [] test.t1 : create
root[root] @ localhost [] >> insert t1 values (1), (2)
root[root] @ localhost [] test.t1 : write
+root[root] @ localhost [] mysql.table_stats : read
+root[root] @ localhost [] mysql.column_stats : read
+root[root] @ localhost [] mysql.index_stats : read
root[root] @ localhost [] >> select * from t1
root[root] @ localhost [] test.t1 : read
root[root] @ localhost [] >> rename table t1 to t2
@@ -90,6 +93,9 @@ root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] >> select * from v1
root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] mysql.table_stats : read
+root[root] @ localhost [] mysql.column_stats : read
+root[root] @ localhost [] mysql.index_stats : read
root[root] @ localhost [] >> drop view v1
root[root] @ localhost [] >> create temporary table t2 (a date)
root[root] @ localhost [] >> insert t2 values ('2020-10-09')
diff --git a/mysql-test/suite/plugins/r/auth_ed25519.result b/mysql-test/suite/plugins/r/auth_ed25519.result
index 2d9bb81ae86..7b26530ed12 100644
--- a/mysql-test/suite/plugins/r/auth_ed25519.result
+++ b/mysql-test/suite/plugins/r/auth_ed25519.result
@@ -27,7 +27,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE AUTHENTICATION
PLUGIN_TYPE_VERSION 2.2
PLUGIN_LIBRARY auth_ed25519.so
-PLUGIN_LIBRARY_VERSION 1.13
+PLUGIN_LIBRARY_VERSION 1.14
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Elliptic curve ED25519 based authentication
PLUGIN_LICENSE GPL
diff --git a/mysql-test/suite/plugins/r/cracklib_password_check.result b/mysql-test/suite/plugins/r/cracklib_password_check.result
index 6b4e30b3d81..1194e6eef5a 100644
--- a/mysql-test/suite/plugins/r/cracklib_password_check.result
+++ b/mysql-test/suite/plugins/r/cracklib_password_check.result
@@ -6,7 +6,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE PASSWORD VALIDATION
PLUGIN_TYPE_VERSION 1.0
PLUGIN_LIBRARY cracklib_password_check.so
-PLUGIN_LIBRARY_VERSION 1.13
+PLUGIN_LIBRARY_VERSION 1.14
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Password validation via CrackLib
PLUGIN_LICENSE GPL
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index 8770ce19f49..330f4325f76 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -20,7 +20,7 @@ WHERE VARIABLE_NAME LIKE 'Collation used %'
ORDER BY VARIABLE_NAME;
VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used binary
-1 Collation used latin1_bin
1 Collation used latin1_swedish_ci
+1 Collation used utf8mb4_bin
1 Collation used utf8_bin
1 Collation used utf8_general_ci
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index 935ea11d67b..b09af006e70 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -20,8 +20,8 @@ WHERE VARIABLE_NAME LIKE 'Collation used %'
ORDER BY VARIABLE_NAME;
VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used binary
-1 Collation used latin1_bin
1 Collation used latin1_swedish_ci
+1 Collation used utf8mb4_bin
1 Collation used utf8_bin
1 Collation used utf8_general_ci
set global sql_mode=ONLY_FULL_GROUP_BY;
diff --git a/mysql-test/suite/plugins/r/max_password_errors_auth_named_pipe.result b/mysql-test/suite/plugins/r/max_password_errors_auth_named_pipe.result
new file mode 100644
index 00000000000..82d464e3cb2
--- /dev/null
+++ b/mysql-test/suite/plugins/r/max_password_errors_auth_named_pipe.result
@@ -0,0 +1,12 @@
+set @old_max_password_errors=@@max_password_errors;
+create user nosuchuser identified with 'named_pipe';
+set global max_password_errors=1;
+connect(localhost,nosuchuser,,test,MASTER_PORT,MASTER_SOCKET);
+connect pipe_con,localhost,nosuchuser,,,,,PIPE;
+ERROR 28000: Access denied for user 'nosuchuser'@'localhost'
+connect(localhost,nosuchuser,,test,MASTER_PORT,MASTER_SOCKET);
+connect pipe_con,localhost,nosuchuser,,,,,PIPE;
+ERROR 28000: Access denied for user 'nosuchuser'@'localhost'
+DROP USER nosuchuser;
+FLUSH PRIVILEGES;
+set global max_password_errors=@old_max_password_errors;
diff --git a/mysql-test/suite/plugins/r/max_password_errors_auth_socket.result b/mysql-test/suite/plugins/r/max_password_errors_auth_socket.result
new file mode 100644
index 00000000000..eb7cb64167b
--- /dev/null
+++ b/mysql-test/suite/plugins/r/max_password_errors_auth_socket.result
@@ -0,0 +1,12 @@
+set @old_max_password_errors=@@max_password_errors;
+create user nosuchuser identified with 'unix_socket';
+set global max_password_errors=1;
+connect(localhost,nosuchuser,,test,MASTER_PORT,MASTER_SOCKET);
+connect pipe_con,localhost,nosuchuser;
+ERROR 28000: Access denied for user 'nosuchuser'@'localhost'
+connect(localhost,nosuchuser,,test,MASTER_PORT,MASTER_SOCKET);
+connect pipe_con,localhost,nosuchuser;
+ERROR 28000: Access denied for user 'nosuchuser'@'localhost'
+DROP USER nosuchuser;
+FLUSH PRIVILEGES;
+set global max_password_errors=@old_max_password_errors;
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index 01392760317..b63419a6e9f 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -261,11 +261,17 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users=\'odin, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t2,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
@@ -290,6 +296,9 @@ TIME,HOSTNAME,root,localhost,ID,0,CONNECT,test,,0
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t1 (id2 int)',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
@@ -302,6 +311,9 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,sa_db,sa_t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table sa_t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into sa_t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
@@ -315,34 +327,34 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,,,0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
diff --git a/mysql-test/suite/plugins/r/show_all_plugins.result b/mysql-test/suite/plugins/r/show_all_plugins.result
index dd6cbfce4c4..3bdaf39d0d0 100644
--- a/mysql-test/suite/plugins/r/show_all_plugins.result
+++ b/mysql-test/suite/plugins/r/show_all_plugins.result
@@ -4,8 +4,8 @@ Variable_name Value
Opened_plugin_libraries 0
select * from information_schema.all_plugins where plugin_library='ha_example.so';
PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_TYPE_VERSION PLUGIN_LIBRARY PLUGIN_LIBRARY_VERSION PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION PLUGIN_MATURITY PLUGIN_AUTH_VERSION
-EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.13 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
-UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.13 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
+EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.14 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
+UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.14 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
show status like '%libraries%';
Variable_name Value
Opened_plugin_libraries 1
diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result
index 91b1fef0745..2e706115bd1 100644
--- a/mysql-test/suite/plugins/r/simple_password_check.result
+++ b/mysql-test/suite/plugins/r/simple_password_check.result
@@ -6,7 +6,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE PASSWORD VALIDATION
PLUGIN_TYPE_VERSION 1.0
PLUGIN_LIBRARY simple_password_check.so
-PLUGIN_LIBRARY_VERSION 1.13
+PLUGIN_LIBRARY_VERSION 1.14
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Simple password strength checks
PLUGIN_LICENSE GPL
@@ -139,7 +139,7 @@ grant select on *.* to foo2 identified with mysql_old_password using '';
ERROR HY000: Your password does not satisfy the current policy requirements
grant select on *.* to foo2 identified with mysql_old_password;
ERROR HY000: Your password does not satisfy the current policy requirements
-update mysql.user set password='xxx' where user='foo1';
+update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'xxx') where user='foo1';
set global strict_password_validation=0;
set password for foo1 = '';
ERROR HY000: Your password does not satisfy the current policy requirements
diff --git a/mysql-test/suite/plugins/r/sql_error_log.result b/mysql-test/suite/plugins/r/sql_error_log.result
index a583cf91a83..98dfe0374fd 100644
--- a/mysql-test/suite/plugins/r/sql_error_log.result
+++ b/mysql-test/suite/plugins/r/sql_error_log.result
@@ -30,7 +30,7 @@ drop procedure test_error;
SET SQL_MODE = STRICT_ALL_TABLES;
create table t1(id int);
insert into t1 values ('aa');
-ERROR 22007: Incorrect integer value: 'aa' for column 'id' at row 1
+ERROR 22007: Incorrect integer value: 'aa' for column `test`.`t1`.`id` at row 1
SET SQL_MODE = '';
drop table t1;
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists';
@@ -53,5 +53,5 @@ TIME HOSTNAME ERROR 1146: Table 'test.temptab' doesn't exist : SELECT `c` FROM `
TIME HOSTNAME ERROR 1000: new message : RESIGNAL SQLSTATE '40000' SET
MYSQL_ERRNO = 1000,
MESSAGE_TEXT = 'new message'
-TIME HOSTNAME ERROR 1366: Incorrect integer value: 'aa' for column 'id' at row 1 : insert into t1 values ('aa')
+TIME HOSTNAME ERROR 1366: Incorrect integer value: 'aa' for column `test`.`t1`.`id` at row 1 : insert into t1 values ('aa')
TIME HOSTNAME ERROR 1146: Table 'test.non_exists' doesn't exist : INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */
diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
index cf09ccb3a51..eceb2280ed4 100644
--- a/mysql-test/suite/plugins/r/thread_pool_server_audit.result
+++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
@@ -250,11 +250,17 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users=\'odin, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t2,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t2,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
@@ -279,6 +285,9 @@ TIME,HOSTNAME,root,localhost,ID,0,CONNECT,test,,0
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t1 (id2 int)',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
@@ -291,6 +300,9 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,sa_db,sa_t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table sa_t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,sa_db,sa_t1,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
+TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into sa_t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
@@ -304,34 +316,34 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,,,0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
-TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test
index 8b4aee28362..cfaf68ce96d 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_load.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test
@@ -28,11 +28,11 @@ select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%debug%';
# Embedded server does not use the table mysqld.user and thus
-# does not automatically use latin1_bin on startup. Use it manually.
+# does not automatically use utf8mb4 on startup. Use it manually.
--disable_query_log
if (`SELECT VERSION() LIKE '%embedded%'`)
{
- DO _latin1'test' COLLATE latin1_bin;
+ create temporary table t1 (a json);
}
--enable_query_log
SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK
diff --git a/mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.opt b/mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.opt
new file mode 100644
index 00000000000..52bf94f3511
--- /dev/null
+++ b/mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.opt
@@ -0,0 +1 @@
+--loose-enable-named-pipe --plugin-load=$AUTH_NAMED_PIPE_SO
diff --git a/mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.test b/mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.test
new file mode 100644
index 00000000000..79aeb7d3cbe
--- /dev/null
+++ b/mysql-test/suite/plugins/t/max_password_errors_auth_named_pipe.test
@@ -0,0 +1,22 @@
+# Tests that max_password_errors has no effect on login errors with
+# passwordless plugins (Windows version / auth_named_pipe)
+
+--source include/not_embedded.inc
+--source include/have_auth_named_pipe.inc
+if (`SELECT '$USERNAME' = 'nosuchuser'`) {
+ skip skipped for nosuchuser;
+}
+set @old_max_password_errors=@@max_password_errors;
+create user nosuchuser identified with 'named_pipe';
+
+set global max_password_errors=1;
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_NO_PASSWORD_ERROR;
+connect(pipe_con,localhost,nosuchuser,,,,,PIPE);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_NO_PASSWORD_ERROR;
+connect(pipe_con,localhost,nosuchuser,,,,,PIPE);
+
+DROP USER nosuchuser;
+FLUSH PRIVILEGES;
+set global max_password_errors=@old_max_password_errors;
diff --git a/mysql-test/suite/plugins/t/max_password_errors_auth_socket.opt b/mysql-test/suite/plugins/t/max_password_errors_auth_socket.opt
new file mode 100644
index 00000000000..91bb73e34f7
--- /dev/null
+++ b/mysql-test/suite/plugins/t/max_password_errors_auth_socket.opt
@@ -0,0 +1 @@
+--loose-enable-named-pipe --plugin-load=$AUTH_SOCKET_SO
diff --git a/mysql-test/suite/plugins/t/max_password_errors_auth_socket.test b/mysql-test/suite/plugins/t/max_password_errors_auth_socket.test
new file mode 100644
index 00000000000..495a68a0b59
--- /dev/null
+++ b/mysql-test/suite/plugins/t/max_password_errors_auth_socket.test
@@ -0,0 +1,23 @@
+# Tests that max_password_errors has no effect on login errors with
+# passwordless plugins (Unix version / auth_unix_socket)
+
+--source include/not_embedded.inc
+--source include/have_unix_socket.inc
+
+if (`SELECT '$USER' = 'nosuchuser'`) {
+ skip USER is nosuchuser;
+}
+set @old_max_password_errors=@@max_password_errors;
+create user nosuchuser identified with 'unix_socket';
+
+set global max_password_errors=1;
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_NO_PASSWORD_ERROR;
+connect(pipe_con,localhost,nosuchuser);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+error ER_ACCESS_DENIED_NO_PASSWORD_ERROR;
+connect(pipe_con,localhost,nosuchuser);
+
+DROP USER nosuchuser;
+FLUSH PRIVILEGES;
+set global max_password_errors=@old_max_password_errors;
diff --git a/mysql-test/suite/plugins/t/simple_password_check.test b/mysql-test/suite/plugins/t/simple_password_check.test
index 213d061247d..b7d631ab4bb 100644
--- a/mysql-test/suite/plugins/t/simple_password_check.test
+++ b/mysql-test/suite/plugins/t/simple_password_check.test
@@ -89,7 +89,7 @@ grant select on *.* to foo2 identified with mysql_old_password using '';
grant select on *.* to foo2 identified with mysql_old_password;
# direct updates are not protected
-update mysql.user set password='xxx' where user='foo1';
+update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'xxx') where user='foo1';
set global strict_password_validation=0;
diff --git a/mysql-test/suite/roles/create_and_drop_role.result b/mysql-test/suite/roles/create_and_drop_role.result
index a163ee82f42..21aecdb9bc0 100644
--- a/mysql-test/suite/roles/create_and_drop_role.result
+++ b/mysql-test/suite/roles/create_and_drop_role.result
@@ -7,7 +7,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
create role test_role1;
create role test_role2, test_role3;
select user, host, is_role from user where user like 'test%';
-user host is_role
+User Host is_role
test_role1 Y
test_role2 Y
test_role3 Y
@@ -19,7 +19,7 @@ ERROR HY000: Operation CREATE ROLE failed for 'test_role1'
create role test_role1, test_role2;
ERROR HY000: Operation CREATE ROLE failed for 'test_role1'
select user, host, is_role from user where user like 'test%';
-user host is_role
+User Host is_role
test_role1 Y
test_role2 Y
drop role test_role1;
@@ -34,7 +34,7 @@ drop role dummy;
ERROR HY000: Operation DROP ROLE failed for 'dummy'
drop user dummy@'';
select user, host, is_role from user where user like 'test%';
-user host is_role
+User Host is_role
disconnect mysql;
connection default;
create role '';
diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result
index afe00ed7729..5902ae0e16c 100644
--- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result
+++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result
@@ -15,7 +15,6 @@ create role test_role;
create user test_user@localhost;
grant test_role to test_user@localhost;
set default role test_role for root@localhost;
-ERROR HY000: Column count of mysql.user is wrong. Expected 46, found 45. Created with MariaDB MYSQL_VERSION_ID, now running MYSQL_VERSION_ID. Please use mysql_upgrade to fix this error
drop role test_role;
drop user test_user@localhost;
alter table user add column default_role char(80) binary default '' not null
diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test
index ebd75c34ca1..9cf0d7b4aff 100644
--- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test
+++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test
@@ -3,6 +3,7 @@
# that don't have 'default_role' column
#
source include/not_embedded.inc;
+source include/switch_to_mysql_user.inc;
connect (mysql, localhost, root,,);
use mysql;
@@ -29,8 +30,8 @@ after password_expired;
create role test_role;
create user test_user@localhost;
grant test_role to test_user@localhost;
---replace_regex /10\d\d\d\d/MYSQL_VERSION_ID/
---error ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE
+#--replace_regex /10\d\d\d\d/MYSQL_VERSION_ID/
+#--error ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE
set default role test_role for root@localhost;
drop role test_role;
drop user test_user@localhost;
@@ -46,3 +47,5 @@ update user set is_role='N';
flush privileges;
create role test_role;
drop role test_role;
+
+source include/switch_to_mysql_global_priv.inc;
diff --git a/mysql-test/suite/roles/default_create_user_not_role.result b/mysql-test/suite/roles/default_create_user_not_role.result
index 171015f6e82..3f32329b80c 100644
--- a/mysql-test/suite/roles/default_create_user_not_role.result
+++ b/mysql-test/suite/roles/default_create_user_not_role.result
@@ -2,7 +2,7 @@ connect mysql, localhost, root,,;
use mysql;
create user 'test'@'localhost';
select user, host, is_role from user where user='test' and host='localhost';
-user host is_role
+User Host is_role
test localhost N
drop user 'test'@'localhost';
disconnect mysql;
diff --git a/mysql-test/suite/roles/flush_roles-17898.result b/mysql-test/suite/roles/flush_roles-17898.result
new file mode 100644
index 00000000000..c142a496c10
--- /dev/null
+++ b/mysql-test/suite/roles/flush_roles-17898.result
@@ -0,0 +1,9 @@
+use mysql;
+insert db (db,user,select_priv) values ('foo','dwr_foo','Y'), ('bar','dwr_bar','Y');
+insert roles_mapping (user,role) values ('dwr_qux_dev','dwr_foo'),('dwr_qux_dev','dwr_bar');
+insert global_priv values ('','dwr_foo','{"is_role":true}'), ('','dwr_bar','{"is_role":true}'),
+('','dwr_qux_dev','{"access":16384,"is_role":true}');
+flush privileges;
+drop role dwr_foo;
+drop role dwr_bar;
+drop role dwr_qux_dev;
diff --git a/mysql-test/suite/roles/flush_roles-17898.test b/mysql-test/suite/roles/flush_roles-17898.test
new file mode 100644
index 00000000000..55611d31e7b
--- /dev/null
+++ b/mysql-test/suite/roles/flush_roles-17898.test
@@ -0,0 +1,12 @@
+#
+# MDEV-17898 FLUSH PRIVILEGES crashes server with segfault
+#
+use mysql;
+insert db (db,user,select_priv) values ('foo','dwr_foo','Y'), ('bar','dwr_bar','Y');
+insert roles_mapping (user,role) values ('dwr_qux_dev','dwr_foo'),('dwr_qux_dev','dwr_bar');
+insert global_priv values ('','dwr_foo','{"is_role":true}'), ('','dwr_bar','{"is_role":true}'),
+ ('','dwr_qux_dev','{"access":16384,"is_role":true}');
+flush privileges;
+drop role dwr_foo;
+drop role dwr_bar;
+drop role dwr_qux_dev;
diff --git a/mysql-test/suite/roles/grant_revoke_current.result b/mysql-test/suite/roles/grant_revoke_current.result
index 436bec92a8f..681c0857edb 100644
--- a/mysql-test/suite/roles/grant_revoke_current.result
+++ b/mysql-test/suite/roles/grant_revoke_current.result
@@ -1,3 +1,4 @@
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
grant select on *.* to current_role;
ERROR 0L000: Invalid definer
revoke select on *.* from current_role;
@@ -39,5 +40,5 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*34391
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'r1'
set password='';
-update mysql.user set plugin='';
drop role r1;
+update mysql.global_priv set priv=@root_priv;
diff --git a/mysql-test/suite/roles/grant_revoke_current.test b/mysql-test/suite/roles/grant_revoke_current.test
index bffc04087b1..65a0809ac9c 100644
--- a/mysql-test/suite/roles/grant_revoke_current.test
+++ b/mysql-test/suite/roles/grant_revoke_current.test
@@ -1,4 +1,5 @@
--source include/not_embedded.inc
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
--error ER_MALFORMED_DEFINER
grant select on *.* to current_role;
@@ -25,7 +26,7 @@ show grants;
grant r1 to current_user() identified by 'barfoo';
show grants;
set password='';
-#cleanup after MDEV-16238
-update mysql.user set plugin='';
+#cleanup
drop role r1;
+update mysql.global_priv set priv=@root_priv;
diff --git a/mysql-test/suite/roles/grant_role_auto_create_user.result b/mysql-test/suite/roles/grant_role_auto_create_user.result
index 3f6139e84d0..61ce0359c0d 100644
--- a/mysql-test/suite/roles/grant_role_auto_create_user.result
+++ b/mysql-test/suite/roles/grant_role_auto_create_user.result
@@ -23,7 +23,7 @@ grant auto_create to foo@localhost;
ERROR 28000: Can't find any matching row in the user table
grant auto_create to bar@localhost identified by 'baz';
select user, host from mysql.user where user = 'bar';
-user host
+User Host
bar localhost
set sql_mode = '';
connect con1,localhost,bar,baz,;
diff --git a/mysql-test/suite/roles/i_s_applicable_roles_is_default.result b/mysql-test/suite/roles/i_s_applicable_roles_is_default.result
index 63127f8b176..32498d11390 100644
--- a/mysql-test/suite/roles/i_s_applicable_roles_is_default.result
+++ b/mysql-test/suite/roles/i_s_applicable_roles_is_default.result
@@ -78,3 +78,4 @@ drop role role3;
drop role role2;
drop role role1;
drop user foo;
+update mysql.global_priv set priv=json_remove(priv, '$.default_role');
diff --git a/mysql-test/suite/roles/i_s_applicable_roles_is_default.test b/mysql-test/suite/roles/i_s_applicable_roles_is_default.test
index 59ba1f8bf75..b6f6f9ba879 100644
--- a/mysql-test/suite/roles/i_s_applicable_roles_is_default.test
+++ b/mysql-test/suite/roles/i_s_applicable_roles_is_default.test
@@ -51,7 +51,6 @@ set default role role3;
--sorted_result
select * from information_schema.applicable_roles;
-
set default role none;
--sorted_result
select * from information_schema.applicable_roles;
@@ -60,3 +59,4 @@ drop role role3;
drop role role2;
drop role role1;
drop user foo;
+update mysql.global_priv set priv=json_remove(priv, '$.default_role');
diff --git a/mysql-test/suite/roles/none_public.result b/mysql-test/suite/roles/none_public.result
index 5dd1480e8c3..c253ae1478b 100644
--- a/mysql-test/suite/roles/none_public.result
+++ b/mysql-test/suite/roles/none_public.result
@@ -40,17 +40,9 @@ ERROR OP000: Invalid role specification `none`
create definer=public view test.v1 as select 1;
ERROR OP000: Invalid role specification `public`
drop role role1;
-optimize table mysql.user;
-Table Op Msg_type Msg_text
-mysql.user optimize status OK
-insert ignore mysql.user (user, is_role) values ('none', 'Y'), ('public', 'Y');
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
+insert mysql.global_priv values ('', 'none', '{"is_role":true}'), ('', 'public', '{"is_role":true}');
flush privileges;
Warnings:
Error 1959 Invalid role specification `none`
Error 1959 Invalid role specification `public`
-delete from mysql.user where is_role='Y';
+delete from mysql.global_priv where host='';
diff --git a/mysql-test/suite/roles/none_public.test b/mysql-test/suite/roles/none_public.test
index 838a4955df5..a0ec2315cfc 100644
--- a/mysql-test/suite/roles/none_public.test
+++ b/mysql-test/suite/roles/none_public.test
@@ -50,8 +50,6 @@ create definer=public view test.v1 as select 1;
drop role role1;
-optimize table mysql.user; # to remove deleted rows and have stable row order
-insert ignore mysql.user (user, is_role) values ('none', 'Y'), ('public', 'Y');
+insert mysql.global_priv values ('', 'none', '{"is_role":true}'), ('', 'public', '{"is_role":true}');
flush privileges;
-delete from mysql.user where is_role='Y';
-
+delete from mysql.global_priv where host='';
diff --git a/mysql-test/suite/roles/prepare_stmt_with_role.result b/mysql-test/suite/roles/prepare_stmt_with_role.result
index 0352502c35c..758dca735e1 100644
--- a/mysql-test/suite/roles/prepare_stmt_with_role.result
+++ b/mysql-test/suite/roles/prepare_stmt_with_role.result
@@ -13,7 +13,7 @@ EXECUTE stmtCreateRole;
#
SELECT user, host,is_role FROM mysql.user
WHERE user = 'developers';
-user host is_role
+User Host is_role
developers Y
SHOW GRANTS;
Grants for root@localhost
@@ -73,7 +73,7 @@ EXECUTE stmtDropRole;
#
SELECT user, host,is_role FROM mysql.user
WHERE user = 'developers';
-user host is_role
+User Host is_role
SELECT * FROM mysql.roles_mapping;
Host User Role Admin_option
SHOW GRANTS;
@@ -89,7 +89,7 @@ GRANT USAGE ON *.* TO 'test_user'@'%'
EXECUTE stmtCreateRole;
SELECT user, host,is_role FROM mysql.user
WHERE user = 'developers';
-user host is_role
+User Host is_role
developers Y
SELECT * FROM mysql.roles_mapping;
Host User Role Admin_option
diff --git a/mysql-test/suite/roles/rename_user.result b/mysql-test/suite/roles/rename_user.result
index 987d90a5820..9550e15953a 100644
--- a/mysql-test/suite/roles/rename_user.result
+++ b/mysql-test/suite/roles/rename_user.result
@@ -12,7 +12,7 @@ localhost root test_role2 Y
localhost test_user test_role1 N
rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost';
select user, host from user where user like 'test%';
-user host
+User Host
test_role1
test_role2
test_user_rm newhost
diff --git a/mysql-test/suite/roles/role_case_sensitive-10744.result b/mysql-test/suite/roles/role_case_sensitive-10744.result
index b898310e83c..baec3c5f2a1 100644
--- a/mysql-test/suite/roles/role_case_sensitive-10744.result
+++ b/mysql-test/suite/roles/role_case_sensitive-10744.result
@@ -11,7 +11,7 @@ create role test_role;
# Test if mysql.user has the roles created.
#
select user, host from mysql.user where is_role='y' and user like 'test%';
-user host
+User Host
test_ROLE
test_role
create database secret_db;
diff --git a/mysql-test/suite/roles/set_default_role_clear.result b/mysql-test/suite/roles/set_default_role_clear.result
index 7f54b5eabcc..70628059f65 100644
--- a/mysql-test/suite/roles/set_default_role_clear.result
+++ b/mysql-test/suite/roles/set_default_role_clear.result
@@ -10,7 +10,7 @@ set default role test_role;
select user, host, default_role from mysql.user;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user'
select user, host, default_role from mysql.user where user='test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
show grants;
Grants for test_user@localhost
@@ -18,16 +18,16 @@ GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
select user, host, default_role from mysql.user where user='test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
set default role NONE;
select user, host, default_role from mysql.user where user='test_user';
-user host default_role
+User Host default_role
test_user localhost
set default role invalid_role;
ERROR OP000: Invalid role specification `invalid_role`
select user, host, default_role from mysql.user where user='test_user';
-user host default_role
+User Host default_role
test_user localhost
select user, host, default_role from mysql.user;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user'
diff --git a/mysql-test/suite/roles/set_default_role_for.result b/mysql-test/suite/roles/set_default_role_for.result
index 9880671ba09..706ba3fba7b 100644
--- a/mysql-test/suite/roles/set_default_role_for.result
+++ b/mysql-test/suite/roles/set_default_role_for.result
@@ -22,17 +22,17 @@ GRANT role_a TO 'user_a'@'localhost'
GRANT USAGE ON *.* TO 'user_a'@'localhost'
GRANT SELECT ON *.* TO 'role_a'
select user, host, default_role from mysql.user where user like 'user_%';
-user host default_role
+User Host default_role
user_a localhost role_a
user_b localhost role_b
set default role NONE for current_user;
select user, host, default_role from mysql.user where user like 'user_%';
-user host default_role
+User Host default_role
user_a localhost
user_b localhost role_b
set default role current_role for current_user;
select user, host, default_role from mysql.user where user like 'user_%';
-user host default_role
+User Host default_role
user_a localhost role_a
user_b localhost role_b
set default role role_b for current_user;
@@ -44,12 +44,6 @@ GRANT USAGE ON *.* TO 'user_b'@'localhost'
GRANT INSERT, UPDATE ON *.* TO 'role_b'
select user, host, default_role from mysql.user where user like 'user_%';
ERROR 42000: SELECT command denied to user 'user_b'@'localhost' for table 'user'
-insert ignore into mysql.user (user, host) values ('someuser', 'somehost');
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
set default role NONE for user_a@localhost;
show grants;
Grants for user_a@localhost
@@ -60,6 +54,5 @@ select user, host, default_role from mysql.user where user like 'user_%';
ERROR 42000: SELECT command denied to user 'user_a'@'localhost' for table 'user'
drop role role_a;
drop role role_b;
-delete from mysql.user where user = 'someuser' && host = 'somehost';
drop user user_a@localhost;
drop user user_b@localhost;
diff --git a/mysql-test/suite/roles/set_default_role_for.test b/mysql-test/suite/roles/set_default_role_for.test
index 985eaa16e3d..eff999a522b 100644
--- a/mysql-test/suite/roles/set_default_role_for.test
+++ b/mysql-test/suite/roles/set_default_role_for.test
@@ -65,8 +65,6 @@ show grants;
--error ER_TABLEACCESS_DENIED_ERROR
select user, host, default_role from mysql.user where user like 'user_%';
-# Make sure the default role setting worked from root.
-insert ignore into mysql.user (user, host) values ('someuser', 'somehost');
# Since we have update privileges on the mysql.user table, we should
# be able to set a default role for a different user.
set default role NONE for user_a@localhost;
@@ -82,6 +80,5 @@ change_user 'root';
drop role role_a;
drop role role_b;
-delete from mysql.user where user = 'someuser' && host = 'somehost';
drop user user_a@localhost;
drop user user_b@localhost;
diff --git a/mysql-test/suite/roles/set_default_role_invalid.result b/mysql-test/suite/roles/set_default_role_invalid.result
index 5bcaa9acb86..77c317c6a02 100644
--- a/mysql-test/suite/roles/set_default_role_invalid.result
+++ b/mysql-test/suite/roles/set_default_role_invalid.result
@@ -17,7 +17,7 @@ set default role test_role;
select user, host, default_role from mysql.user;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user'
select user, host, default_role from mysql.user where user='test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
show grants;
Grants for test_user@localhost
@@ -25,12 +25,12 @@ GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
select user, host, default_role from mysql.user where user='test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
set default role invalid_role;
ERROR OP000: Invalid role specification `invalid_role`
select user, host, default_role from mysql.user where user='test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
revoke test_role from test_user@localhost;
select user, host, default_role from mysql.user where user='test_user';
diff --git a/mysql-test/suite/roles/set_default_role_new_connection.result b/mysql-test/suite/roles/set_default_role_new_connection.result
index a59ecbd75f7..8590d33e16d 100644
--- a/mysql-test/suite/roles/set_default_role_new_connection.result
+++ b/mysql-test/suite/roles/set_default_role_new_connection.result
@@ -15,7 +15,7 @@ ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'us
disconnect c1;
connection default;
select user, host, default_role from mysql.user where user = 'test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
connect c1, localhost, test_user,,;
show grants;
@@ -24,13 +24,13 @@ GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
select user, host, default_role from mysql.user where user = 'test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
set default role NONE;
disconnect c1;
connection default;
select user, host, default_role from mysql.user where user = 'test_user';
-user host default_role
+User Host default_role
test_user localhost
connect c1, localhost, test_user,,;
show grants;
@@ -42,7 +42,7 @@ ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'us
disconnect c1;
connection default;
select user, host, default_role from mysql.user where user = 'test_user';
-user host default_role
+User Host default_role
test_user localhost
set default role test_role for test_user@localhost;
connect c1, localhost, test_user,,;
@@ -52,7 +52,7 @@ GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
select user, host, default_role from mysql.user where user = 'test_user';
-user host default_role
+User Host default_role
test_user localhost test_role
disconnect c1;
connection default;
diff --git a/mysql-test/suite/roles/set_default_role_ps-6960.result b/mysql-test/suite/roles/set_default_role_ps-6960.result
index c186e7bccb0..505861e89df 100644
--- a/mysql-test/suite/roles/set_default_role_ps-6960.result
+++ b/mysql-test/suite/roles/set_default_role_ps-6960.result
@@ -1,3 +1,4 @@
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
create role r1;
prepare stmt from "set password = '11111111111111111111111111111111111111111'";
execute stmt;
@@ -6,4 +7,4 @@ execute stmt;
set password = '';
set default role NONE;
drop role r1;
-update mysql.user set plugin='';
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
diff --git a/mysql-test/suite/roles/set_default_role_ps-6960.test b/mysql-test/suite/roles/set_default_role_ps-6960.test
index 8af95c9e8a0..fd965c2aa75 100644
--- a/mysql-test/suite/roles/set_default_role_ps-6960.test
+++ b/mysql-test/suite/roles/set_default_role_ps-6960.test
@@ -4,6 +4,8 @@
--source include/not_embedded.inc
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
+
create role r1;
prepare stmt from "set password = '11111111111111111111111111111111111111111'";
execute stmt;
@@ -13,5 +15,6 @@ execute stmt;
set password = '';
set default role NONE;
drop role r1;
-#cleanup after MDEV-16238
-update mysql.user set plugin='';
+
+#cleanup
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
diff --git a/mysql-test/suite/roles/set_role-database-recursive.result b/mysql-test/suite/roles/set_role-database-recursive.result
index 479e553c3d1..2c8c21d97c3 100644
--- a/mysql-test/suite/roles/set_role-database-recursive.result
+++ b/mysql-test/suite/roles/set_role-database-recursive.result
@@ -5,7 +5,7 @@ grant test_role1 to test_user@localhost;
grant test_role2 to test_user@localhost;
grant test_role2 to test_role1;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_role2
test_user localhost
diff --git a/mysql-test/suite/roles/set_role-database-simple.result b/mysql-test/suite/roles/set_role-database-simple.result
index e21a55edf2e..156a4453b69 100644
--- a/mysql-test/suite/roles/set_role-database-simple.result
+++ b/mysql-test/suite/roles/set_role-database-simple.result
@@ -2,7 +2,7 @@ create user 'test_user'@'localhost';
create role test_role1;
grant test_role1 to test_user@localhost;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_user localhost
select * from mysql.roles_mapping;
diff --git a/mysql-test/suite/roles/set_role-recursive.result b/mysql-test/suite/roles/set_role-recursive.result
index 2b34c3eeebe..0b37b1a3fc8 100644
--- a/mysql-test/suite/roles/set_role-recursive.result
+++ b/mysql-test/suite/roles/set_role-recursive.result
@@ -4,7 +4,7 @@ grant test_role1 to test_user@localhost;
create role test_role2;
grant test_role2 to test_role1;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_role2
test_user localhost
diff --git a/mysql-test/suite/roles/set_role-routine-simple.result b/mysql-test/suite/roles/set_role-routine-simple.result
index 3e17a78ad77..b86bf3045f3 100644
--- a/mysql-test/suite/roles/set_role-routine-simple.result
+++ b/mysql-test/suite/roles/set_role-routine-simple.result
@@ -6,7 +6,7 @@ grant test_role1 to test_user@localhost;
grant test_role3 to test_user@localhost;
grant test_role2 to test_role1;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_role2
test_role3
diff --git a/mysql-test/suite/roles/set_role-simple.result b/mysql-test/suite/roles/set_role-simple.result
index 9af698c7b09..dec5a0b4436 100644
--- a/mysql-test/suite/roles/set_role-simple.result
+++ b/mysql-test/suite/roles/set_role-simple.result
@@ -2,7 +2,7 @@ create user test_user@localhost;
create role test_role1;
grant test_role1 to test_user@localhost;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_user localhost
select * from mysql.roles_mapping;
diff --git a/mysql-test/suite/roles/set_role-table-column-priv.result b/mysql-test/suite/roles/set_role-table-column-priv.result
index 721bd3039a3..57c6ce01c9f 100644
--- a/mysql-test/suite/roles/set_role-table-column-priv.result
+++ b/mysql-test/suite/roles/set_role-table-column-priv.result
@@ -4,7 +4,7 @@ create role test_role2;
grant test_role1 to test_user@localhost;
grant test_role2 to test_role1;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_role2
test_user localhost
diff --git a/mysql-test/suite/roles/set_role-table-simple.result b/mysql-test/suite/roles/set_role-table-simple.result
index f5688dbe62e..3ecc66ba7f0 100644
--- a/mysql-test/suite/roles/set_role-table-simple.result
+++ b/mysql-test/suite/roles/set_role-table-simple.result
@@ -4,7 +4,7 @@ create role test_role2;
grant test_role1 to test_user@localhost;
grant test_role2 to test_role1;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_role2
test_user localhost
diff --git a/mysql-test/suite/roles/show_grants.result b/mysql-test/suite/roles/show_grants.result
index 5d46b038cf8..31df0113b8e 100644
--- a/mysql-test/suite/roles/show_grants.result
+++ b/mysql-test/suite/roles/show_grants.result
@@ -5,7 +5,7 @@ grant test_role1 to test_user@localhost;
grant test_role2 to test_user@localhost;
grant test_role2 to test_role1;
select user, host from mysql.user where user not like 'root';
-user host
+User Host
test_role1
test_role2
test_user localhost
diff --git a/mysql-test/suite/roles/show_grants_replicated.result b/mysql-test/suite/roles/show_grants_replicated.result
index cb9df65dbbd..7b090c982f0 100644
--- a/mysql-test/suite/roles/show_grants_replicated.result
+++ b/mysql-test/suite/roles/show_grants_replicated.result
@@ -17,7 +17,7 @@ connection slave;
# it's visible in mysql.user and I_S:
#
select user, host, is_role from mysql.user where user in ('u1', 'r1');
-user host is_role
+User Host is_role
r1 Y
u1 % N
select * from information_schema.applicable_roles;
diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def
index d4617398c64..9f43bc3c339 100644
--- a/mysql-test/suite/rpl/disabled.def
+++ b/mysql-test/suite/rpl/disabled.def
@@ -19,3 +19,4 @@ rpl_row_mysqlbinlog : MDEV-11095
rpl_row_index_choice : MDEV-11666
rpl_parallel2 : fails after MDEV-16172
rpl_semi_sync_after_sync : fails after MDEV-16172
+rpl_auto_increment_update_failure : disabled for now
diff --git a/mysql-test/suite/rpl/include/rpl_EE_err.test b/mysql-test/suite/rpl/include/rpl_EE_err.test
index 0b3fec1f605..fa135d12436 100644
--- a/mysql-test/suite/rpl/include/rpl_EE_err.test
+++ b/mysql-test/suite/rpl/include/rpl_EE_err.test
@@ -15,7 +15,7 @@
-- source include/master-slave.inc
eval create table t1 (a int) engine=$engine_type;
-flush tables;
+flush tables t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/t1.MYI ;
drop table if exists t1;
diff --git a/mysql-test/suite/rpl/include/rpl_row_001.test b/mysql-test/suite/rpl/include/rpl_row_001.test
deleted file mode 100644
index 4df2d793244..00000000000
--- a/mysql-test/suite/rpl/include/rpl_row_001.test
+++ /dev/null
@@ -1,96 +0,0 @@
-let $LOAD_FILE= $MYSQLTEST_VARDIR/std_data/words.dat;
-CREATE TABLE t1 (word CHAR(20) NOT NULL);
---replace_result $LOAD_FILE LOAD_FILE
-eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1;
---replace_result $LOAD_FILE LOAD_FILE
-eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1;
-SELECT * FROM t1 ORDER BY word LIMIT 10;
-
-#
-# Save password row for root
-#
-
-create temporary table tmp select * from mysql.user where host="localhost" and user="root";
-
-#
-# Test slave with wrong password
-#
-
-save_master_pos;
-connection slave;
-sync_with_master;
-STOP SLAVE;
-connection master;
-UPDATE mysql.user SET password=password('foo') WHERE host='localhost' AND user='root';
-connection slave;
-START SLAVE;
-connection master;
-#
-# Give slave time to do at last one failed connect retry
-# This one must be short so that the slave will not stop retrying
-real_sleep 2;
-UPDATE mysql.user SET password=password('') WHERE host='localhost' AND user='root';
-# Give slave time to connect (will retry every second)
-
-sleep 2;
-
-CREATE TABLE t3(n INT);
-INSERT INTO t3 VALUES(1),(2);
-sync_slave_with_master;
-SELECT * FROM t3 ORDER BY n;
-SELECT SUM(LENGTH(word)) FROM t1;
-connection master;
-DROP TABLE t1,t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# Test if the slave SQL thread can be more than 16K behind the slave
-# I/O thread (> IO_SIZE)
-
-connection master;
-# we'll use table-level locking to delay slave SQL thread
-eval CREATE TABLE t1 (n INT) ENGINE=$engine_type;
-sync_slave_with_master;
-connection master;
-RESET MASTER;
-connection slave;
-STOP SLAVE;
-RESET SLAVE;
-
-connection master;
-let $1=5000;
-# Generate 16K of relay log
-disable_query_log;
-while ($1)
-{
- eval INSERT INTO t1 VALUES($1);
- dec $1;
-}
-enable_query_log;
-SELECT COUNT(*) FROM t1;
-save_master_pos;
-
-# Try to cause a large relay log lag on the slave by locking t1
-connection slave;
-LOCK TABLES t1 READ;
-START SLAVE;
-UNLOCK TABLES;
-sync_with_master;
-SELECT COUNT(*) FROM t1;
-
-connection master;
-DROP TABLE t1;
-CREATE TABLE t1 (n INT);
-INSERT INTO t1 VALUES(3456);
-sync_slave_with_master;
-SELECT n FROM t1;
-
-connection master;
-DROP TABLE t1;
-
-# resttore old passwords
-replace into mysql.user select * from tmp;
-drop temporary table tmp;
-
-sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/include/rpl_row_annotate.test b/mysql-test/suite/rpl/include/rpl_row_annotate.test
index 317a9c86539..8b4b704cef9 100644
--- a/mysql-test/suite/rpl/include/rpl_row_annotate.test
+++ b/mysql-test/suite/rpl/include/rpl_row_annotate.test
@@ -147,7 +147,7 @@ let $start_pos= `select @binlog_start_pos`;
connection master;
SET SESSION binlog_annotate_row_events = ON;
INSERT DELAYED INTO test1.t4 VALUES (1,1);
-FLUSH TABLES;
+FLUSH TABLES test1.t4;
SELECT * FROM test1.t4 ORDER BY a;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/include/rpl_row_delayed_ins.test b/mysql-test/suite/rpl/include/rpl_row_delayed_ins.test
index bad308ff814..03c7b5282a8 100644
--- a/mysql-test/suite/rpl/include/rpl_row_delayed_ins.test
+++ b/mysql-test/suite/rpl/include/rpl_row_delayed_ins.test
@@ -10,7 +10,7 @@ eval create table t1(a int not null primary key) engine=$engine_type;
insert delayed into t1 values (1);
insert delayed into t1 values (2);
insert delayed into t1 values (3);
-flush tables;
+flush tables t1;
SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result
index 1f605935005..0b0ee84229f 100644
--- a/mysql-test/suite/rpl/r/rpl_EE_err.result
+++ b/mysql-test/suite/rpl/r/rpl_EE_err.result
@@ -1,7 +1,7 @@
include/master-slave.inc
[connection master]
create table t1 (a int) engine=myisam;
-flush tables;
+flush tables t1;
drop table if exists t1;
Warnings:
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
diff --git a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result
index c163cc552ab..8fcbba1c4cd 100644
--- a/mysql-test/suite/rpl/r/rpl_bug31076.result
+++ b/mysql-test/suite/rpl/r/rpl_bug31076.result
@@ -58,7 +58,7 @@ SET @@session.time_zone='UTC'/*!*/;
INSERT INTO visits (myid, user_id, src, ip, cc, org, ref, time, host, entry, visit_exit, visit_start)
VALUES ('3m3l4rhs6do0sf5p1i9lr94g928a272v', '', '', INET_ATON('71.118.124.98'), '', '', 'http://dev.mysql.com/downloads/connector/j/3.0.html', NULL, 'dev.mysql.com', '/get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick', '/get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick', NOW())/*!*/;
Warnings:
-Warning 1366 Incorrect integer value: '' for column 'user_id' at row 1
+Warning 1366 Incorrect integer value: '' for column `track`.`visits`.`user_id` at row 1
SELECT * FROM visits;
visits_id myid src ip cc org ref time host entry visit_exit user_id visit_start
21231039 3m3l4rhs6do0sf5p1i9lr94g928a272v 1198947426 http://dev.mysql.com/downloads/connector/j/3.0.html 2007-09-18 03:59:02 dev.mysql.com /get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick /get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick 0 2007-09-18 03:59:02
diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_user.result b/mysql-test/suite/rpl/r/rpl_create_drop_user.result
index f9069530e82..61b351b50df 100644
--- a/mysql-test/suite/rpl/r/rpl_create_drop_user.result
+++ b/mysql-test/suite/rpl/r/rpl_create_drop_user.result
@@ -18,13 +18,13 @@ u2@localhost
disconnect user_a;
connection master;
SELECT user,password,plugin,authentication_string FROM mysql.user WHERE user LIKE 'u%' ;
-user password plugin authentication_string
-u1 mysql_native_password *D9553C4CE316A9845CE49E30A2D7E3857AF966C4
+User Password plugin authentication_string
+u1 *D9553C4CE316A9845CE49E30A2D7E3857AF966C4 mysql_native_password *D9553C4CE316A9845CE49E30A2D7E3857AF966C4
u2 mysql_native_password
connection slave;
SELECT user,password,plugin,authentication_string FROM mysql.user WHERE user LIKE 'u%' ;
-user password plugin authentication_string
-u1 mysql_native_password *D9553C4CE316A9845CE49E30A2D7E3857AF966C4
+User Password plugin authentication_string
+u1 *D9553C4CE316A9845CE49E30A2D7E3857AF966C4 mysql_native_password *D9553C4CE316A9845CE49E30A2D7E3857AF966C4
u2 mysql_native_password
connection master;
CREATE OR REPLACE USER u1@localhost IDENTIFIED BY 'abcdefghijk2';
@@ -36,13 +36,13 @@ u1@localhost
disconnect user_a;
connection master;
SELECT user,password,plugin,authentication_string FROM mysql.user WHERE user LIKE 'u%' ;
-user password plugin authentication_string
-u1 mysql_native_password *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E
+User Password plugin authentication_string
+u1 *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E mysql_native_password *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E
u2 mysql_native_password
connection slave;
SELECT user,password,plugin,authentication_string FROM mysql.user WHERE user LIKE 'u%' ;
-user password plugin authentication_string
-u1 mysql_native_password *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E
+User Password plugin authentication_string
+u1 *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E mysql_native_password *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E
u2 mysql_native_password
connection master;
CREATE USER u1@localhost;
@@ -51,8 +51,8 @@ DROP USER u3@localhost;
ERROR HY000: Operation DROP USER failed for 'u3'@'localhost'
connection slave;
SELECT user,password,plugin,authentication_string FROM mysql.user WHERE user LIKE 'u%' ;
-user password plugin authentication_string
-u1 mysql_native_password *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E
+User Password plugin authentication_string
+u1 *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E mysql_native_password *A9A5EF53CE2EFAA6F4A746D63A917B2370971A7E
u2 mysql_native_password
connection master;
DROP USER IF EXISTS u1@localhost;
@@ -62,5 +62,5 @@ Warnings:
Note 1974 Can't drop user 'u3'@'localhost'; it doesn't exist
connection slave;
SELECT user,password,plugin,authentication_string FROM mysql.user WHERE user LIKE 'u%' ;
-user password plugin authentication_string
+User Password plugin authentication_string
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
index d74fd07189c..b31eacfc236 100644
--- a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
+++ b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
@@ -25,8 +25,6 @@ connection slave;
connection slave;
SHOW TABLES in mysqltest;
Tables_in_mysqltest
-t
-t1
SHOW EVENTS in mysqltest;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
mysqltest e root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
diff --git a/mysql-test/suite/rpl/r/rpl_ddl.result b/mysql-test/suite/rpl/r/rpl_ddl.result
index 68c5e91f42e..22ce9a288c1 100644
--- a/mysql-test/suite/rpl/r/rpl_ddl.result
+++ b/mysql-test/suite/rpl/r/rpl_ddl.result
@@ -1354,11 +1354,11 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
connection master;
SELECT user FROM mysql.user WHERE user = 'user1';
-user
+User
user1
connection slave;
SELECT user FROM mysql.user WHERE user = 'user1';
-user
+User
user1
connection master;
@@ -1399,11 +1399,11 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
connection master;
SELECT user FROM mysql.user WHERE user = 'rename1';
-user
+User
rename1
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
-user
+User
rename1
connection master;
@@ -1444,10 +1444,10 @@ MAX(f1)
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
connection master;
SELECT user FROM mysql.user WHERE user = 'rename1';
-user
+User
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
-user
+User
use test;
connection master;
DROP TEMPORARY TABLE mysqltest1.t22;
diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result
index 9f6328bce8e..5fa1002f9ac 100644
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result
@@ -1,14 +1,6 @@
include/master-slave.inc
[connection master]
connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-connection slave;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-connection master;
create user rpl_do_grant@localhost;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
@@ -20,11 +12,11 @@ GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost'
connection master;
set password for rpl_do_grant@localhost=password("does it work?");
connection slave;
-select authentication_string<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
-authentication_string<>_binary''
+select authentication_string<>'' from mysql.user where user='rpl_do_grant';
+authentication_string<>''
1
connection master;
-update mysql.user set authentication_string='' where user='rpl_do_grant';
+update mysql.global_priv set priv=json_remove(priv, '$.authentication_string') where user='rpl_do_grant';
flush privileges;
select authentication_string<>'' from mysql.user where user='rpl_do_grant';
authentication_string<>''
@@ -37,13 +29,8 @@ select authentication_string<>'' from mysql.user where user='rpl_do_grant';
authentication_string<>''
1
connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
+drop user rpl_do_grant@localhost;
connection slave;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
connection master;
show grants for rpl_do_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
@@ -328,5 +315,6 @@ Grantor
root@localhost
connection master;
DROP USER user_bug27606@localhost;
-update mysql.user set plugin='';
+select priv into @root_priv from mysql.global_priv where user='root' and host='127.0.0.1';
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
index b59c21724b2..3aa7c07a845 100644
--- a/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
@@ -194,7 +194,7 @@ INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
insert ignore into t31 set f1=1, f2=1, f3=2, f4='second',
f9=2.2, f10='seven samurai', f28=222.222, f35='222';
Warnings:
-Warning 1366 Incorrect integer value: 'seven samurai' for column 'f10' at row 1
+Warning 1366 Incorrect integer value: 'seven samurai' for column `test`.`t31`.`f10` at row 1
insert ignore into t31 values (1, 1, 3, 'third',
/* f5 BIGINT, */ 333333333333333333333333,
/* f6 BLOB, */ '3333333333333333333333',
diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
index b9d254e1b42..0918364b28e 100644
--- a/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
@@ -194,7 +194,7 @@ INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
insert ignore into t31 set f1=1, f2=1, f3=2, f4='second',
f9=2.2, f10='seven samurai', f28=222.222, f35='222';
Warnings:
-Warning 1366 Incorrect integer value: 'seven samurai' for column 'f10' at row 1
+Warning 1366 Incorrect integer value: 'seven samurai' for column `test`.`t31`.`f10` at row 1
insert ignore into t31 values (1, 1, 3, 'third',
/* f5 BIGINT, */ 333333333333333333333333,
/* f6 BLOB, */ '3333333333333333333333',
diff --git a/mysql-test/suite/rpl/r/rpl_grant.result b/mysql-test/suite/rpl/r/rpl_grant.result
index 0f546f7edc4..274a8505fb8 100644
--- a/mysql-test/suite/rpl/r/rpl_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_grant.result
@@ -4,7 +4,7 @@ connection master;
CREATE USER dummy@localhost;
CREATE USER dummy1@localhost, dummy2@localhost;
SELECT user, host FROM mysql.user WHERE user like 'dummy%';
-user host
+User Host
dummy localhost
dummy1 localhost
dummy2 localhost
@@ -14,7 +14,7 @@ COUNT(*)
connection slave;
**** On Slave ****
SELECT user,host FROM mysql.user WHERE user like 'dummy%';
-user host
+User Host
dummy localhost
dummy1 localhost
dummy2 localhost
@@ -28,13 +28,13 @@ DROP USER nonexisting@localhost, dummy@localhost;
ERROR HY000: Operation DROP USER failed for 'nonexisting'@'localhost'
DROP USER dummy1@localhost, dummy2@localhost;
SELECT user, host FROM mysql.user WHERE user like 'dummy%';
-user host
+User Host
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
COUNT(*)
0
connection slave;
SELECT user,host FROM mysql.user WHERE user like 'dummy%';
-user host
+User Host
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
COUNT(*)
0
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev4484.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev4484.result
index 00307a8c104..5dffdd9809c 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_mdev4484.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev4484.result
@@ -16,36 +16,32 @@ INSERT INTO t1 VALUES (1);
connection slave;
connection slave;
include/stop_slave.inc
+SET @old_gtid_cleanup_batch_size= @@GLOBAL.gtid_cleanup_batch_size;
+SET GLOBAL gtid_cleanup_batch_size= 2;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,gtid_slave_pos_simulate_failed_delete";
SET sql_log_bin= 0;
-CALL mtr.add_suppression("Can't find file");
+CALL mtr.add_suppression("<DEBUG> Error deleting old GTID row");
SET sql_log_bin= 1;
include/start_slave.inc
connection master;
-INSERT INTO t1 VALUES (2);
-connection slave;
-include/wait_for_slave_sql_error.inc [errno=1942]
-STOP SLAVE IO_THREAD;
-SELECT domain_id, server_id, seq_no FROM mysql.gtid_slave_pos
-ORDER BY domain_id, sub_id DESC LIMIT 1;
-domain_id server_id seq_no
-0 1 3
+connection slave;
+SELECT COUNT(*), MAX(seq_no) INTO @pre_count, @pre_max_seq_no
+FROM mysql.gtid_slave_pos;
+SELECT IF(@pre_count >= 20, "OK", CONCAT("Error: too few rows seen while errors injected: ", @pre_count));
+IF(@pre_count >= 20, "OK", CONCAT("Error: too few rows seen while errors injected: ", @pre_count))
+OK
SET GLOBAL debug_dbug= @old_dbug;
-include/start_slave.inc
connection master;
-INSERT INTO t1 VALUES (3);
-connection slave;
-connection slave;
-SELECT domain_id, server_id, seq_no FROM mysql.gtid_slave_pos
-ORDER BY domain_id, sub_id DESC LIMIT 1;
-domain_id server_id seq_no
-0 1 4
-SELECT * FROM t1 ORDER BY i;
-i
-1
-2
-3
+connection slave;
+connection slave;
+SELECT IF(COUNT(*) >= 1, "OK", CONCAT("Error: too few rows seen after errors no longer injected: ", COUNT(*)))
+FROM mysql.gtid_slave_pos
+WHERE seq_no <= @pre_max_seq_no;
+IF(COUNT(*) >= 1, "OK", CONCAT("Error: too few rows seen after errors no longer injected: ", COUNT(*)))
+OK
connection master;
DROP TABLE t1;
+connection slave;
+SET GLOBAL gtid_cleanup_batch_size= @old_gtid_cleanup_batch_size;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
index 1647b6c998c..50f24d56e9a 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
@@ -171,7 +171,7 @@ include/start_slave.inc
*** MDEV-4692: mysql.gtid_slave_pos accumulates values for a domain ***
SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
domain_id COUNT(*)
-0 2
+0 3
1 2
connection server_1;
INSERT INTO t1 VALUES (11);
@@ -179,7 +179,7 @@ connection server_2;
FLUSH NO_WRITE_TO_BINLOG TABLES;
SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
domain_id COUNT(*)
-0 2
+0 4
1 2
include/start_slave.inc
connection server_1;
@@ -189,8 +189,8 @@ connection server_2;
FLUSH NO_WRITE_TO_BINLOG TABLES;
SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
domain_id COUNT(*)
-0 2
-1 2
+0 3
+1 1
*** MDEV-4650: show variables; ERROR 1946 (HY000): Failed to load replication slave GTID position ***
connection server_2;
SET sql_log_bin=0;
diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result
index a9485ca8933..09e084ce448 100644
--- a/mysql-test/suite/rpl/r/rpl_idempotency.result
+++ b/mysql-test/suite/rpl/r/rpl_idempotency.result
@@ -79,8 +79,25 @@ a
-3
1
include/check_slave_no_error.inc
+connection slave;
+drop table t1, t2;
connection master;
DROP TABLE t1, t2;
connection slave;
+include/check_slave_no_error.inc
+create database d;
+create database e;
+connection master;
+create database d;
+create database if not exists e;
+connection slave;
+include/check_slave_no_error.inc
+drop database d;
+drop database e;
+connection master;
+drop database d;
+drop database if exists e;
+connection slave;
+include/check_slave_no_error.inc
SET @@global.slave_exec_mode= @old_slave_exec_mode;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_revoke.result b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result
index c86f2f4e4df..cc65d9dacfd 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_revoke.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result
@@ -4,26 +4,26 @@ connection master;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-select_priv
+Select_priv
N
connection slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
-select_priv
+Select_priv
N
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
-select_priv
+Select_priv
Y
connection master;
revoke select on *.* from 'user_foo';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-select_priv
+Select_priv
N
connection slave;
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
-select_priv
+Select_priv
Y
connection slave;
revoke select on *.* FROM 'user_foo';
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result
index 4eeb333d10c..511eff51d22 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_table.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result
@@ -1,7 +1,7 @@
include/master-slave.inc
[connection master]
call mtr.add_suppression("Can't find record in 't.'");
-call mtr.add_suppression("Can't find record in 'user'");
+call mtr.add_suppression("Can't find record in 'global_priv'");
call mtr.add_suppression("Can't find record in 'tables_priv'");
**** Test case for BUG#16487 ****
connection master;
@@ -32,12 +32,7 @@ to mysqltest3@localhost;
create database mysqltest2;
create table mysqltest2.t2 (id int);
GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
-insert into mysql.user (user, host) values ("mysqltest5", "somehost");
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
+insert into mysql.global_priv (user, host) values ("mysqltest5", "somehost");
GRANT SELECT ON *.* TO mysqltest6@localhost;
GRANT INSERT ON *.* TO mysqltest6@localhost;
GRANT INSERT ON test.* TO mysqltest6@localhost;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index 45742c989c4..89f59deae73 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -481,77 +481,78 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
******************** CREATE USER ********************
CREATE USER 'user_test_rpl'@'localhost' IDENTIFIED BY PASSWORD '*1111111111111111111111111111111111111111';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection master;
******************** GRANT ********************
GRANT SELECT ON *.* TO 'user_test_rpl'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 Y
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 Y
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 Y
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 Y
connection master;
******************** REVOKE ********************
REVOKE SELECT ON *.* FROM 'user_test_rpl'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection master;
******************** SET PASSWORD ********************
SET PASSWORD FOR 'user_test_rpl'@'localhost' = '*0000000000000000000000000000000000000000';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection master;
******************** RENAME USER ********************
RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection master;
******************** DROP USER ********************
DROP USER 'user_test_rpl_2'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
+Host User Password plugin authentication_string Select_priv
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
+Host User Password plugin authentication_string Select_priv
connection master;
INSERT INTO t1 VALUES(100, 'test');
******************** ANALYZE ********************
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test_rpl.t1 analyze status Engine-independent statistics collected
test_rpl.t1 analyze status OK
******************** CHECK TABLE ********************
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
index f900a8b0e9a..e768c5c6f7c 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
@@ -30,6 +30,7 @@ test.tt_2 preload_keys note The storage engine for the table doesn't support pre
INSERT INTO tt_1(ddl_case) VALUES (39);
ANALYZE TABLE nt_1;
Table Op Msg_type Msg_text
+test.nt_1 analyze status Engine-independent statistics collected
test.nt_1 analyze status Table is already up to date
INSERT INTO tt_1(ddl_case) VALUES (38);
CHECK TABLE nt_1;
diff --git a/mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result b/mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result
new file mode 100644
index 00000000000..bedd103c2a0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result
@@ -0,0 +1,22 @@
+#
+# MDEV-8894 Inserting fractional seconds into MySQL 5.6 master breaks consistency on MariaDB 10 slave
+#
+include/master-slave.inc
+[connection master]
+connection slave;
+CREATE TABLE t1 (id SERIAL, a DATETIME(3));
+include/stop_slave.inc
+connection master;
+include/rpl_stop_server.inc [server_number=1]
+include/rpl_start_server.inc [server_number=1]
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+include/start_slave.inc
+connection master;
+connection slave;
+SELECT * FROM t1 ORDER BY id;
+id a
+1 2001-01-01 00:00:01.000
+include/stop_slave.inc
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result b/mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result
new file mode 100644
index 00000000000..23b3217895a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result
@@ -0,0 +1,23 @@
+#
+# MDEV-8894 Inserting fractional seconds into MySQL 5.6 master breaks consistency on MariaDB 10 slave
+#
+include/master-slave.inc
+[connection master]
+connection slave;
+CREATE TABLE t1 (id SERIAL, a DATETIME(3));
+include/stop_slave.inc
+connection master;
+include/rpl_stop_server.inc [server_number=1]
+include/rpl_start_server.inc [server_number=1]
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+include/start_slave.inc
+connection master;
+connection slave;
+SELECT * FROM t1 ORDER BY id;
+id a
+1 2001-01-01 00:00:01.000
+2 2001-01-01 00:00:00.999
+include/stop_slave.inc
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result
index d994e4fdef6..9258deadaca 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel.result
@@ -1517,6 +1517,7 @@ SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10000;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
INSERT INTO t3 VALUES (120, 0);
SET @commit_id= 10001;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
index ca202a66b0e..bf7a8192f56 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
@@ -12,6 +12,8 @@ SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='optimistic';
+SET @old_gtid_cleanup_batch_size= @@GLOBAL.gtid_cleanup_batch_size;
+SET GLOBAL gtid_cleanup_batch_size= 1000000;
connection server_1;
INSERT INTO t1 VALUES(1,1);
BEGIN;
@@ -131,6 +133,11 @@ c
204
205
206
+SELECT IF(COUNT(*) >= 30, "OK", CONCAT("Error: too few old rows found: ", COUNT(*)))
+FROM mysql.gtid_slave_pos;
+IF(COUNT(*) >= 30, "OK", CONCAT("Error: too few old rows found: ", COUNT(*)))
+OK
+SET GLOBAL gtid_cleanup_batch_size=1;
*** Test @@skip_parallel_replication. ***
connection server_2;
include/stop_slave.inc
@@ -358,6 +365,7 @@ connection server_1;
ALTER TABLE t2 COMMENT "123abc";
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
INSERT INTO t1 VALUES (1,2);
INSERT INTO t1 VALUES (2,2);
@@ -478,6 +486,7 @@ SET @old_server_id= @@SESSION.server_id;
SET SESSION server_id= 100;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SET SESSION server_id= @old_server_id;
INSERT INTO t1 VALUES (37,0);
@@ -651,9 +660,10 @@ DROP TABLE t1, t2, t3;
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
-Check that no more than the expected last four GTIDs are in mysql.gtid_slave_pos
-select count(4) <= 4 from mysql.gtid_slave_pos order by domain_id, sub_id;
-count(4) <= 4
+SELECT COUNT(*) <= 5*@@GLOBAL.gtid_cleanup_batch_size
+FROM mysql.gtid_slave_pos;
+COUNT(*) <= 5*@@GLOBAL.gtid_cleanup_batch_size
1
+SET GLOBAL gtid_cleanup_batch_size= @old_gtid_cleanup_batch_size;
connection server_1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
index f6c7e4ad54e..5230283fd6c 100644
--- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result
+++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
@@ -79,10 +79,10 @@ load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
+Warning 1366 Incorrect integer value: 'error ' for column `test`.`t1`.`a` at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
Note 1265 Data truncated for column 'a' at row 4
-Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
+Warning 1366 Incorrect integer value: 'wrong end ' for column `test`.`t1`.`a` at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
connection slave;
connection slave;
@@ -101,7 +101,7 @@ Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: '
-' for column 'a' at row 4
+' for column `test`.`t1`.`a` at row 4
Warning 1261 Row 4 doesn't contain data for all columns
connection slave;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result
index f7684d5ad97..976ac0996bf 100644
--- a/mysql-test/suite/rpl/r/rpl_row_001.result
+++ b/mysql-test/suite/rpl/r/rpl_row_001.result
@@ -1,44 +1,6 @@
include/master-slave.inc
[connection master]
-CREATE TABLE t1 (word CHAR(20) NOT NULL);
-LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1;
-LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1;
-SELECT * FROM t1 ORDER BY word LIMIT 10;
-word
-Aarhus
-Aarhus
-Aarhus
-Aarhus
-Aaron
-Aaron
-Aaron
-Aaron
-Ababa
-Ababa
-create temporary table tmp select * from mysql.user where host="localhost" and user="root";
-connection slave;
-STOP SLAVE;
-connection master;
-UPDATE mysql.user SET password=password('foo') WHERE host='localhost' AND user='root';
-connection slave;
-START SLAVE;
-connection master;
-UPDATE mysql.user SET password=password('') WHERE host='localhost' AND user='root';
-CREATE TABLE t3(n INT);
-INSERT INTO t3 VALUES(1),(2);
-connection slave;
-SELECT * FROM t3 ORDER BY n;
-n
-1
-2
-SELECT SUM(LENGTH(word)) FROM t1;
-SUM(LENGTH(word))
-1022
-connection master;
-DROP TABLE t1,t3;
-connection slave;
-connection master;
-CREATE TABLE t1 (n INT) ENGINE=MYISAM;
+CREATE TABLE t1 (n INT);
connection slave;
connection master;
RESET MASTER;
@@ -66,7 +28,5 @@ n
3456
connection master;
DROP TABLE t1;
-replace into mysql.user select * from tmp;
-drop temporary table tmp;
connection slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
index 52f7b180fae..ba1922566bf 100644
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
@@ -180,7 +180,7 @@ slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
connection master;
SET SESSION binlog_annotate_row_events = ON;
INSERT DELAYED INTO test1.t4 VALUES (1,1);
-FLUSH TABLES;
+FLUSH TABLES test1.t4;
SELECT * FROM test1.t4 ORDER BY a;
a b
1 1
diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
index c657cf2fbb5..65535d5d417 100644
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
@@ -160,7 +160,7 @@ slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
connection master;
SET SESSION binlog_annotate_row_events = ON;
INSERT DELAYED INTO test1.t4 VALUES (1,1);
-FLUSH TABLES;
+FLUSH TABLES test1.t4;
SELECT * FROM test1.t4 ORDER BY a;
a b
1 1
diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff
new file mode 100644
index 00000000000..2ff34004702
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff
@@ -0,0 +1,31 @@
+--- r/rpl_row_big_table_id.result 2019-01-23 19:58:07.204914873 +0200
++++ r/rpl_row_big_table_id_32bit.result 2019-01-23 19:43:54.590640934 +0200
+@@ -22,22 +22,22 @@
+ master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
+ master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
+ master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 1
+-master-bin.000002 # Table_map 1 # table_id: 4294967298 (test.t)
+-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
++master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t)
++master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
+ master-bin.000002 # Query 1 # COMMIT
+ master-bin.000002 # Gtid 1 # GTID #-#-#
+ master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
+ master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
+ master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 2
+-master-bin.000002 # Table_map 1 # table_id: 4294967299 (test.t)
+-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967299 flags: STMT_END_F
++master-bin.000002 # Table_map 1 # table_id: 1 (test.t)
++master-bin.000002 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F
+ master-bin.000002 # Query 1 # COMMIT
+ master-bin.000002 # Gtid 1 # GTID #-#-#
+ master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
+ master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
+ master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 3
+-master-bin.000002 # Table_map 1 # table_id: 4294967300 (test.t)
+-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967300 flags: STMT_END_F
++master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t)
++master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
+ master-bin.000002 # Query 1 # COMMIT
+ connection slave;
+ connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
new file mode 100644
index 00000000000..7a0a964dc5e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
@@ -0,0 +1,46 @@
+include/master-slave.inc
+[connection master]
+connection master;
+include/rpl_restart_server.inc [server_number=1]
+SET @@debug_dbug="d,simulate_big_table_id";
+CREATE TABLE t (a int);
+INSERT INTO t SET a= 0;
+ALTER TABLE t comment '';
+INSERT INTO t SET a= 1;
+ALTER TABLE t comment '';
+INSERT INTO t SET a= 2;
+ALTER TABLE t comment '';
+INSERT INTO t SET a= 3;
+show binlog events in <file> from <pos>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 0
+master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t)
+master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
+master-bin.000002 # Query 1 # COMMIT
+master-bin.000002 # Gtid 1 # GTID #-#-#
+master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
+master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 1
+master-bin.000002 # Table_map 1 # table_id: 4294967298 (test.t)
+master-bin.000002 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
+master-bin.000002 # Query 1 # COMMIT
+master-bin.000002 # Gtid 1 # GTID #-#-#
+master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
+master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 2
+master-bin.000002 # Table_map 1 # table_id: 4294967299 (test.t)
+master-bin.000002 # Write_rows_v1 1 # table_id: 4294967299 flags: STMT_END_F
+master-bin.000002 # Query 1 # COMMIT
+master-bin.000002 # Gtid 1 # GTID #-#-#
+master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
+master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 3
+master-bin.000002 # Table_map 1 # table_id: 4294967300 (test.t)
+master-bin.000002 # Write_rows_v1 1 # table_id: 4294967300 flags: STMT_END_F
+master-bin.000002 # Query 1 # COMMIT
+connection slave;
+connection master;
+DROP TABLE t;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result
index 978c3d30dbd..4d439c202f5 100644
--- a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result
+++ b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result
@@ -5,7 +5,7 @@ create table t1(a int not null primary key) engine=myisam;
insert delayed into t1 values (1);
insert delayed into t1 values (2);
insert delayed into t1 values (3);
-flush tables;
+flush tables t1;
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
index ef393873b97..a2f3bb44ae1 100644
--- a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
@@ -30,6 +30,7 @@ test.tt_2 preload_keys note The storage engine for the table doesn't support pre
INSERT INTO tt_1(ddl_case) VALUES (39);
ANALYZE TABLE nt_1;
Table Op Msg_type Msg_text
+test.nt_1 analyze status Engine-independent statistics collected
test.nt_1 analyze status Table is already up to date
INSERT INTO tt_1(ddl_case) VALUES (38);
CHECK TABLE nt_1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result
index 47567ef7b72..9ef2ca3bc53 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_000001.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result
@@ -19,12 +19,12 @@ abandons
connection slave;
stop slave;
connection master;
-create temporary table tmp select * from mysql.user where host="localhost" and user="root";
+create temporary table tmp select * from mysql.global_priv where host="localhost" and user="root";
set password for root@"localhost" = password('foo');
connection slave;
start slave;
connection master;
-replace into mysql.user select * from tmp;
+replace into mysql.global_priv select * from tmp;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave
drop temporary table tmp;
@@ -43,7 +43,7 @@ connection master;
drop table t1,t3;
connection slave;
connection master;
-create table t1 (n int) engine=myisam;
+create table t1 (n int);
connection slave;
connection master;
reset master;
@@ -81,31 +81,4 @@ count(*)
5000
connection master1;
drop table t1;
-create table t1 (n int);
-insert into t1 values(3456);
-insert ignore into mysql.user (Host, User, Password)
-VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-Warnings:
-Warning 1364 Field 'ssl_cipher' doesn't have a default value
-Warning 1364 Field 'x509_issuer' doesn't have a default value
-Warning 1364 Field 'x509_subject' doesn't have a default value
-Warning 1364 Field 'authentication_string' doesn't have a default value
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-select_priv user
-N blafasel2
-update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-select_priv user
-Y blafasel2
-connection slave;
-select n from t1;
-n
-3456
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-select_priv user
-Y blafasel2
-connection master1;
-drop table t1;
-delete from mysql.user where user="blafasel2";
-connection slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
index f900a8b0e9a..e768c5c6f7c 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
@@ -30,6 +30,7 @@ test.tt_2 preload_keys note The storage engine for the table doesn't support pre
INSERT INTO tt_1(ddl_case) VALUES (39);
ANALYZE TABLE nt_1;
Table Op Msg_type Msg_text
+test.nt_1 analyze status Engine-independent statistics collected
test.nt_1 analyze status Table is already up to date
INSERT INTO tt_1(ddl_case) VALUES (38);
CHECK TABLE nt_1;
diff --git a/mysql-test/suite/rpl/r/rpl_temporal_round.result b/mysql-test/suite/rpl/r/rpl_temporal_round.result
new file mode 100644
index 00000000000..df8cc431a74
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_temporal_round.result
@@ -0,0 +1,50 @@
+include/master-slave.inc
+[connection master]
+SET sql_mode=TIME_ROUND_FRACTIONAL;
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+CREATE TABLE t1 (id SERIAL, a TIMESTAMP(4));
+INSERT INTO t1 (a) VALUES (now(6));
+INSERT INTO t1 (a) VALUES ('2011-01-01 23:59:59.999999');
+CREATE TABLE t2 (id SERIAL, a DATETIME(4));
+INSERT INTO t2 (a) VALUES (now(6));
+INSERT INTO t2 (a) VALUES ('2011-01-01 23:59:59.999999');
+CREATE TABLE t3 (id SERIAL, a TIME(4));
+INSERT INTO t3 (a) VALUES (now(6));
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+INSERT INTO t3 (a) VALUES ('2011-01-01 23:59:59.999999');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+id a
+1 2011-01-01 00:00:00.0000
+2 2011-01-02 00:00:00.0000
+SELECT * FROM t2;
+id a
+1 2011-01-01 00:00:00.0000
+2 2011-01-02 00:00:00.0000
+SELECT * FROM t3;
+id a
+1 24:00:00.0000
+2 24:00:00.0000
+connection slave;
+connection slave;
+SET time_zone='+00:00';
+SELECT * FROM t1;
+id a
+1 2011-01-01 00:00:00.0000
+2 2011-01-02 00:00:00.0000
+SELECT * FROM t2;
+id a
+1 2011-01-01 00:00:00.0000
+2 2011-01-02 00:00:00.0000
+SELECT * FROM t3;
+id a
+1 24:00:00.0000
+2 24:00:00.0000
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
index e8e95ab7c4c..45070949f79 100644
--- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
+++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
@@ -145,43 +145,43 @@ UNLOCK TABLE;
DROP DATABASE mysqltest2;
LOCK TABLE t1 WRITE;
CREATE USER test_1@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'db' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("CREATE USER test_1@localhost with table locked");
UNLOCK TABLE;
CREATE USER test_2@localhost;
LOCK TABLE t1 WRITE;
GRANT SELECT ON t1 TO test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'tables_priv' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("GRANT select on table to user with table locked");
GRANT ALL ON f2 TO test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'tables_priv' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("GRANT ALL ON f2 TO test_2 with table locked");
GRANT ALL ON p2 TO test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'tables_priv' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("GRANT ALL ON p2 TO test_2 with table locked");
GRANT USAGE ON *.* TO test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'db' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("GRANT USAGE ON *.* TO test_2 with table locked");
REVOKE ALL PRIVILEGES ON f2 FROM test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'tables_priv' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("REVOKE ALL PRIVILEGES on function to user with table locked");
REVOKE ALL PRIVILEGES ON p2 FROM test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'tables_priv' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("REVOKE ALL PRIVILEGES on procedure to user with table locked");
REVOKE ALL PRIVILEGES ON t1 FROM test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'tables_priv' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("REVOKE ALL PRIVILEGES on table to user with table locked");
REVOKE USAGE ON *.* FROM test_2@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'db' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("REVOKE USAGE ON *.* TO test_2 with table locked");
RENAME USER test_2@localhost TO test_3@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'db' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("RENAME USER test_2 TO test_3 with table locked");
UNLOCK TABLE;
RENAME USER test_2@localhost TO test_3@localhost;
LOCK TABLE t1 WRITE;
DROP USER test_3@localhost;
-ERROR HY000: Table 'user' was not locked with LOCK TABLES
+ERROR HY000: Table 'db' was not locked with LOCK TABLES
INSERT INTO t2 VALUES ("DROP USER test_3@localhost with table locked");
UNLOCK TABLE;
CREATE DATABASE db;
diff --git a/mysql-test/suite/rpl/r/rpl_user.result b/mysql-test/suite/rpl/r/rpl_user.result
index 34f15d41209..2a8bf69501c 100644
--- a/mysql-test/suite/rpl/r/rpl_user.result
+++ b/mysql-test/suite/rpl/r/rpl_user.result
@@ -31,6 +31,13 @@ Host User
fakehost barbar
fakehost foofoo
connection master;
+alter user 'foofoo'@'fakehost' identified by 'foo';
+alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'barbar'@'fakehost' identified by 'bar';
+ERROR HY000: Operation ALTER USER failed for 'non_exist_user1'@'fakehost'
+alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'non_exist_user2'@'fakehost' identified by 'bar';
+ERROR HY000: Operation ALTER USER failed for 'non_exist_user1'@'fakehost','non_exist_user2'@'fakehost'
+connection slave;
+connection master;
drop user 'foofoo'@'fakehost';
drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost';
ERROR HY000: Operation DROP USER failed for 'not_exist_user1'@'fakehost'
@@ -51,6 +58,10 @@ master-bin.000001 # Query # # use `test`; rename user 'foo'@'fakehost' to 'foofo
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost'
master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; alter user 'foofoo'@'fakehost' identified by 'foo'
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'barbar'@'fakehost' identified by 'bar'
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; drop user 'foofoo'@'fakehost'
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost'
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
index ba70eda6358..1350585ff93 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -3,18 +3,6 @@
-- source include/master-slave.inc
-# do not be influenced by other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-sync_slave_with_master;
-# if these DELETE did nothing on the master, we need to do them manually on the
-# slave.
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-
# test replication of GRANT
connection master;
create user rpl_do_grant@localhost;
@@ -27,13 +15,13 @@ show grants for rpl_do_grant@localhost;
connection master;
set password for rpl_do_grant@localhost=password("does it work?");
sync_slave_with_master;
-select authentication_string<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
+select authentication_string<>'' from mysql.user where user='rpl_do_grant';
#
# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
#
connection master;
-update mysql.user set authentication_string='' where user='rpl_do_grant';
+update mysql.global_priv set priv=json_remove(priv, '$.authentication_string') where user='rpl_do_grant';
flush privileges;
select authentication_string<>'' from mysql.user where user='rpl_do_grant';
set sql_mode='ANSI_QUOTES';
@@ -42,18 +30,10 @@ set sql_mode='';
sync_slave_with_master;
select authentication_string<>'' from mysql.user where user='rpl_do_grant';
-
# clear what we have done, to not influence other tests.
connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
+drop user rpl_do_grant@localhost;
sync_slave_with_master;
-# The mysql database is not replicated, so we have to do the deletes
-# manually on the slave as well.
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
# End of 4.1 tests
@@ -363,6 +343,8 @@ SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
--connection master
DROP USER user_bug27606@localhost;
-update mysql.user set plugin='';
+select priv into @root_priv from mysql.global_priv where user='root' and host='127.0.0.1';
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
index 5cf28b6e49a..3c5542f4b2f 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
@@ -162,6 +162,7 @@ EOF
wait
EOF
START SLAVE;
+--error 0,2006,2013
SET GLOBAL debug_dbug="+d,crash_commit_before";
--connection server_1
@@ -186,6 +187,7 @@ EOF
wait
EOF
START SLAVE;
+--error 0,2006,2013
SET GLOBAL debug_dbug="+d,crash_commit_after";
--connection server_1
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test
index 1e5d1abbb3b..5c17653da8a 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test
@@ -28,37 +28,79 @@ INSERT INTO t1 VALUES (1);
# Inject an artificial error deleting entries, and check that the error handling code works.
--connection slave
--source include/stop_slave.inc
+SET @old_gtid_cleanup_batch_size= @@GLOBAL.gtid_cleanup_batch_size;
+SET GLOBAL gtid_cleanup_batch_size= 2;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,gtid_slave_pos_simulate_failed_delete";
SET sql_log_bin= 0;
-CALL mtr.add_suppression("Can't find file");
+CALL mtr.add_suppression("<DEBUG> Error deleting old GTID row");
SET sql_log_bin= 1;
--source include/start_slave.inc
--connection master
-INSERT INTO t1 VALUES (2);
+--disable_query_log
+let $i = 20;
+while ($i) {
+ eval INSERT INTO t1 VALUES ($i+10);
+ dec $i;
+}
+--enable_query_log
+--save_master_pos
--connection slave
---let $slave_sql_errno= 1942
---source include/wait_for_slave_sql_error.inc
-STOP SLAVE IO_THREAD;
-SELECT domain_id, server_id, seq_no FROM mysql.gtid_slave_pos
- ORDER BY domain_id, sub_id DESC LIMIT 1;
+--sync_with_master
+
+# Now wait for the slave background thread to try to delete old rows and
+# hit the error injection.
+--let _TEST_MYSQLD_ERROR_LOG=$MYSQLTEST_VARDIR/log/mysqld.2.err
+--perl
+ open F, '<', $ENV{'_TEST_MYSQLD_ERROR_LOG'} or die;
+ outer: while (1) {
+ inner: while (<F>) {
+ last outer if /<DEBUG> Error deleting old GTID row/;
+ }
+ # Easy way to do sub-second sleep without extra modules.
+ select(undef, undef, undef, 0.1);
+ }
+EOF
+
+# Since we injected error in the cleanup code, the rows should remain in
+# mysql.gtid_slave_pos. Check that we have at least 20 (more robust against
+# non-deterministic cleanup and future changes than checking for exact number).
+SELECT COUNT(*), MAX(seq_no) INTO @pre_count, @pre_max_seq_no
+ FROM mysql.gtid_slave_pos;
+SELECT IF(@pre_count >= 20, "OK", CONCAT("Error: too few rows seen while errors injected: ", @pre_count));
SET GLOBAL debug_dbug= @old_dbug;
---source include/start_slave.inc
--connection master
-INSERT INTO t1 VALUES (3);
+--disable_query_log
+let $i = 20;
+while ($i) {
+ eval INSERT INTO t1 VALUES ($i+40);
+ dec $i;
+}
+--enable_query_log
--sync_slave_with_master
--connection slave
-SELECT domain_id, server_id, seq_no FROM mysql.gtid_slave_pos
- ORDER BY domain_id, sub_id DESC LIMIT 1;
-SELECT * FROM t1 ORDER BY i;
-
+# Now check that 1) rows are being deleted again after removing error
+# injection, and 2) old rows are left that failed their delete while errors
+# where injected (again compensating for non-deterministic deletion).
+# Deletion is async and slightly non-deterministic, so we wait for at
+# least 10 of the 20 new rows to be deleted.
+let $wait_condition=
+ SELECT COUNT(*) <= 20-10
+ FROM mysql.gtid_slave_pos
+ WHERE seq_no > @pre_max_seq_no;
+--source include/wait_condition.inc
+SELECT IF(COUNT(*) >= 1, "OK", CONCAT("Error: too few rows seen after errors no longer injected: ", COUNT(*)))
+ FROM mysql.gtid_slave_pos
+ WHERE seq_no <= @pre_max_seq_no;
# Clean up
--connection master
DROP TABLE t1;
+--connection slave
+SET GLOBAL gtid_cleanup_batch_size= @old_gtid_cleanup_batch_size;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test
index fcfe6f65e6d..12dec236d45 100644
--- a/mysql-test/suite/rpl/t/rpl_idempotency.test
+++ b/mysql-test/suite/rpl/t/rpl_idempotency.test
@@ -77,9 +77,30 @@ SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--source include/check_slave_no_error.inc
+connection slave;
+drop table t1, t2;
+
connection master;
DROP TABLE t1, t2;
sync_slave_with_master;
+--source include/check_slave_no_error.inc
+create database d;
+create database e;
+
+connection master;
+create database d;
+create database if not exists e;
+
+sync_slave_with_master;
+--source include/check_slave_no_error.inc
+drop database d;
+drop database e;
+
+connection master;
+drop database d;
+drop database if exists e;
+sync_slave_with_master;
+--source include/check_slave_no_error.inc
SET @@global.slave_exec_mode= @old_slave_exec_mode;
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test
index 3360b789475..a3fcfc95901 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test
@@ -3,7 +3,7 @@ source include/have_collation.inc;
source include/master-slave.inc;
call mtr.add_suppression("Can't find record in 't.'");
-call mtr.add_suppression("Can't find record in 'user'");
+call mtr.add_suppression("Can't find record in 'global_priv'");
call mtr.add_suppression("Can't find record in 'tables_priv'");
#
@@ -69,7 +69,7 @@ create table mysqltest2.t2 (id int);
GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
# Create a grant manually
-insert into mysql.user (user, host) values ("mysqltest5", "somehost");
+insert into mysql.global_priv (user, host) values ("mysqltest5", "somehost");
# Partial replicate 3 with *.*
GRANT SELECT ON *.* TO mysqltest6@localhost;
diff --git a/mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test b/mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test
new file mode 100644
index 00000000000..675b7db0603
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test
@@ -0,0 +1,58 @@
+--source include/have_binlog_format_statement.inc
+
+--echo #
+--echo # MDEV-8894 Inserting fractional seconds into MySQL 5.6 master breaks consistency on MariaDB 10 slave
+--echo #
+
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--connection slave
+CREATE TABLE t1 (id SERIAL, a DATETIME(3));
+--source include/stop_slave.inc
+
+--connection master
+--let $datadir= `SELECT @@datadir`
+
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
+
+--remove_file $datadir/master-bin.000001
+
+#
+# Simulate MySQL 5.7.x master
+#
+# mysql-5.7.11-stm-temporal-round-binlog.000001 was recorded against a
+# table with this structure:
+#CREATE TABLE t1 (id SERIAL, a DATETIME(3));
+# (note, the CREATE statement is not inside the binary log)
+#
+# using this command line:
+# mysqld --log-bin --binlog-format=statement
+# with the following single SQL statement:
+#
+#INSERT INTO t1 (a) VALUES ('2001-01-01 00:00:00.999999');
+#
+
+--copy_file $MYSQL_TEST_DIR/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001 $datadir/master-bin.000001
+
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+
+--source include/wait_until_connected_again.inc
+
+--connection slave
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+
+--source include/start_slave.inc
+
+--connection master
+--sync_slave_with_master
+SELECT * FROM t1 ORDER BY id;
+
+--source include/stop_slave.inc
+DROP TABLE t1;
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test b/mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test
new file mode 100644
index 00000000000..ad6df9d9993
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test
@@ -0,0 +1,62 @@
+--source include/have_binlog_format_statement.inc
+
+--echo #
+--echo # MDEV-8894 Inserting fractional seconds into MySQL 5.6 master breaks consistency on MariaDB 10 slave
+--echo #
+
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--connection slave
+CREATE TABLE t1 (id SERIAL, a DATETIME(3));
+--source include/stop_slave.inc
+
+--connection master
+--let $datadir= `SELECT @@datadir`
+
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
+
+--remove_file $datadir/master-bin.000001
+
+#
+# Simulate MySQL 8.0.x master
+#
+# mysql-8.0.13-stm-temporal-round-binlog.000001 was recorded against a
+# table with this structure:
+#CREATE TABLE t1 (id SERIAL, a DATETIME(3));
+# (note, the CREATE statement is not inside the binary log)
+#
+# using this command line:
+# mysqld --log-bin --binlog-format=statement --server-id=1 --character-set-server=latin1
+# with the following SQL script:
+#
+#SET NAMES latin1 COLLATE latin1_swedish_ci;
+#SET sql_mode='';
+#INSERT INTO t1 (a) VALUES ('2001-01-01 00:00:00.999999');
+#SET sql_mode=TIME_TRUNCATE_FRACTIONAL;
+#INSERT INTO t1 (a) VALUES ('2001-01-01 00:00:00.999999');
+#
+
+--copy_file $MYSQL_TEST_DIR/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001 $datadir/master-bin.000001
+
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+
+--source include/wait_until_connected_again.inc
+
+--connection slave
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+
+--source include/start_slave.inc
+
+--connection master
+--sync_slave_with_master
+SELECT * FROM t1 ORDER BY id;
+
+--source include/stop_slave.inc
+DROP TABLE t1;
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
index e08472d5f51..0060cf4416c 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
@@ -21,6 +21,10 @@ SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='optimistic';
+# Run the first part of the test with high batch size and see that
+# old rows remain in the table.
+SET @old_gtid_cleanup_batch_size= @@GLOBAL.gtid_cleanup_batch_size;
+SET GLOBAL gtid_cleanup_batch_size= 1000000;
--connection server_1
@@ -108,7 +112,12 @@ SELECT * FROM t3 ORDER BY c;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
SELECT * FROM t3 ORDER BY c;
-#SHOW STATUS LIKE 'Slave_retried_transactions';
+# Check that we have a bunch of old rows left-over - they were not deleted
+# due to high @@gtid_cleanup_batch_size. Then set a low
+# @@gtid_cleanup_batch_size so we can test that rows start being deleted.
+SELECT IF(COUNT(*) >= 30, "OK", CONCAT("Error: too few old rows found: ", COUNT(*)))
+ FROM mysql.gtid_slave_pos;
+SET GLOBAL gtid_cleanup_batch_size=1;
--echo *** Test @@skip_parallel_replication. ***
@@ -557,25 +566,18 @@ DROP TABLE t1, t2, t3;
--connection server_2
--source include/sync_with_master_gtid.inc
-# Check for left-over rows in table mysql.gtid_slave_pos (MDEV-12147).
-#
-# There was a bug when a transaction got a conflict and was rolled back. It
-# might have also handled deletion of some old rows, and these deletions would
-# then also be rolled back. And since the deletes were never re-tried, old no
-# longer needed rows would accumulate in the table without limit.
-#
-# The earlier part of this test file have plenty of transactions being rolled
-# back. But the last DROP TABLE statement runs on its own and should never
-# conflict, thus at this point the mysql.gtid_slave_pos table should be clean.
-#
-# To support @@gtid_pos_auto_engines, when a row is inserted in the table, it
-# is associated with the engine of the table at insertion time, and it will
-# only be deleted during record_gtid from a table of the same engine. Since we
-# alter the table from MyISAM to InnoDB at the start of this test, we should
-# end up with 4 rows: two left-over from when the table was MyISAM, and two
-# left-over from the InnoDB part.
---echo Check that no more than the expected last four GTIDs are in mysql.gtid_slave_pos
-select count(4) <= 4 from mysql.gtid_slave_pos order by domain_id, sub_id;
+# Check that old rows are deleted from mysql.gtid_slave_pos.
+# Deletion is asynchronous, so use wait_condition.inc.
+# Also, there is a small amount of non-determinism in the deletion of old
+# rows, so it is not guaranteed that there can never be more than
+# @@gtid_cleanup_batch_size rows in the table; so allow a bit of slack
+# here.
+let $wait_condition=
+ SELECT COUNT(*) <= 5*@@GLOBAL.gtid_cleanup_batch_size
+ FROM mysql.gtid_slave_pos;
+--source include/wait_condition.inc
+eval $wait_condition;
+SET GLOBAL gtid_cleanup_batch_size= @old_gtid_cleanup_batch_size;
--connection server_1
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_001.test b/mysql-test/suite/rpl/t/rpl_row_001.test
index 06d01f2476e..f66c61ffb6e 100644
--- a/mysql-test/suite/rpl/t/rpl_row_001.test
+++ b/mysql-test/suite/rpl/t/rpl_row_001.test
@@ -2,10 +2,50 @@
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
########################################################
-- source include/have_binlog_format_row.inc
-# Slow test, don't run during staging part
--- source include/not_staging.inc
-- source include/master-slave.inc
-let $engine_type=MYISAM;
--- source include/rpl_row_001.test
+# Test if the slave SQL thread can be more than 16K behind the slave
+# I/O thread (> IO_SIZE)
+
+# we'll use table-level locking to delay slave SQL thread
+eval CREATE TABLE t1 (n INT);
+sync_slave_with_master;
+connection master;
+RESET MASTER;
+connection slave;
+STOP SLAVE;
+RESET SLAVE;
+
+connection master;
+let $1=5000;
+# Generate 16K of relay log
+disable_query_log;
+while ($1)
+{
+ eval INSERT INTO t1 VALUES($1);
+ dec $1;
+}
+enable_query_log;
+SELECT COUNT(*) FROM t1;
+save_master_pos;
+
+# Try to cause a large relay log lag on the slave by locking t1
+connection slave;
+LOCK TABLES t1 READ;
+START SLAVE;
+UNLOCK TABLES;
+sync_with_master;
+SELECT COUNT(*) FROM t1;
+
+connection master;
+DROP TABLE t1;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES(3456);
+sync_slave_with_master;
+SELECT n FROM t1;
+
+connection master;
+DROP TABLE t1;
+
+sync_slave_with_master;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test
new file mode 100644
index 00000000000..0c6f9d5e862
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test
@@ -0,0 +1,57 @@
+##################################################################
+# rpl_row_big_table_id
+#
+# MDEV-17803 Row-based event is not applied when
+# table map id is greater 32 bit int
+#
+# Verify row-based events applying when table map id value is about and greater
+# than 1 << 32.
+##################################################################
+--source include/word_size.inc
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--connection master
+# To reset last table id
+--let $rpl_server_number= 1
+--source include/rpl_restart_server.inc
+
+SET @@debug_dbug="d,simulate_big_table_id";
+CREATE TABLE t (a int);
+
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
+INSERT INTO t SET a= 0;
+ALTER TABLE t comment '';
+INSERT INTO t SET a= 1;
+ALTER TABLE t comment '';
+INSERT INTO t SET a= 2;
+ALTER TABLE t comment '';
+INSERT INTO t SET a= 3;
+
+# display simulated big table_id
+--let $_in_from=in '$binlog_file' from $binlog_pos
+--replace_result "$_in_from" "in <file> from <pos>"
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
+--eval show binlog events in '$binlog_file' from $binlog_pos
+
+
+--sync_slave_with_master
+
+if (`SELECT sum(a) != 6 FROM t`)
+{
+ --echo *** unexpected result; check slave applier ***
+ --die
+}
+
+
+# Cleanup
+
+--connection master
+DROP TABLE t;
+
+--sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001.test b/mysql-test/suite/rpl/t/rpl_stm_000001.test
index 72c89789af4..62b5c5b1cd0 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_000001.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_000001.test
@@ -4,7 +4,6 @@
-- source include/master-slave.inc
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---let $engine_type= myisam
# Load some data into t1
create table t1 (word char(20) not null);
@@ -19,7 +18,7 @@ select * from t1 limit 10;
sync_slave_with_master;
stop slave;
connection master;
-create temporary table tmp select * from mysql.user where host="localhost" and user="root";
+create temporary table tmp select * from mysql.global_priv where host="localhost" and user="root";
set password for root@"localhost" = password('foo');
connection slave;
start slave;
@@ -28,7 +27,7 @@ connection master;
# Give slave time to do at last one failed connect retry
# This one must be short so that the slave will not stop retrying
real_sleep 2;
-replace into mysql.user select * from tmp;
+replace into mysql.global_priv select * from tmp;
drop temporary table tmp;
flush privileges;
# Give slave time to connect (will retry every second)
@@ -48,7 +47,7 @@ sync_slave_with_master;
connection master;
# we'll use table-level locking to delay slave SQL thread
-eval create table t1 (n int) engine=$engine_type;
+eval create table t1 (n int);
sync_slave_with_master;
connection master;
reset master;
@@ -114,20 +113,6 @@ connection slave;
select count(*) from t1;
connection master1;
drop table t1;
-create table t1 (n int);
-insert into t1 values(3456);
-insert ignore into mysql.user (Host, User, Password)
- VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-sync_slave_with_master;
-select n from t1;
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-connection master1;
-drop table t1;
-delete from mysql.user where user="blafasel2";
-sync_slave_with_master;
# End of 4.1 tests
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_temporal_round.test b/mysql-test/suite/rpl/t/rpl_temporal_round.test
new file mode 100644
index 00000000000..c13c18bddb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_temporal_round.test
@@ -0,0 +1,35 @@
+--source include/master-slave.inc
+
+SET sql_mode=TIME_ROUND_FRACTIONAL;
+SET time_zone='+00:00';
+SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999');
+
+CREATE TABLE t1 (id SERIAL, a TIMESTAMP(4));
+INSERT INTO t1 (a) VALUES (now(6));
+INSERT INTO t1 (a) VALUES ('2011-01-01 23:59:59.999999');
+
+CREATE TABLE t2 (id SERIAL, a DATETIME(4));
+INSERT INTO t2 (a) VALUES (now(6));
+INSERT INTO t2 (a) VALUES ('2011-01-01 23:59:59.999999');
+
+CREATE TABLE t3 (id SERIAL, a TIME(4));
+INSERT INTO t3 (a) VALUES (now(6));
+INSERT INTO t3 (a) VALUES ('2011-01-01 23:59:59.999999');
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+sync_slave_with_master;
+connection slave;
+SET time_zone='+00:00';
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_user.test b/mysql-test/suite/rpl/t/rpl_user.test
index caa17b47733..079c2bf27d5 100644
--- a/mysql-test/suite/rpl/t/rpl_user.test
+++ b/mysql-test/suite/rpl/t/rpl_user.test
@@ -42,6 +42,17 @@ sync_slave_with_master;
select Host,User from mysql.user where Host='fakehost';
#
+# Test alter user
+#
+connection master;
+alter user 'foofoo'@'fakehost' identified by 'foo';
+--error ER_CANNOT_USER
+alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'barbar'@'fakehost' identified by 'bar';
+--error ER_CANNOT_USER
+alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'non_exist_user2'@'fakehost' identified by 'bar';
+sync_slave_with_master;
+
+#
# Test drop user
#
connection master;
diff --git a/mysql-test/suite/storage_engine/type_bool.result b/mysql-test/suite/storage_engine/type_bool.result
index 87308ed63fc..10cfc08102f 100644
--- a/mysql-test/suite/storage_engine/type_bool.result
+++ b/mysql-test/suite/storage_engine/type_bool.result
@@ -42,8 +42,8 @@ b1 b2
0 0
INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
-Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1
+Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1
SELECT b1,b2 FROM t1;
b1 b2
-1 -2
diff --git a/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result
index 1798bd5d6e0..f833f417290 100644
--- a/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result
+++ b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result
@@ -70,6 +70,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 17 Using where; Using join buffer (flat, BNL join)
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET MAX_SEEKS_FOR_KEY=1;
EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
diff --git a/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result b/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result
index cae0e68765b..75fe06e2faf 100644
--- a/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result
+++ b/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result
@@ -20,6 +20,7 @@ INSERT INTO t1 SELECT NULL FROM t1;
SET myisam_stats_method = nulls_unequal;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -38,6 +39,7 @@ INSERT INTO t1 VALUES (11);
DELETE FROM t1 WHERE a = 11;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -49,7 +51,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-t1 1 a 1 a A 5 NULL NULL YES BTREE
+t1 1 a 1 a A 10 NULL NULL YES BTREE
'Set nulls to be ignored'
SET myisam_stats_method = nulls_ignored;
SHOW VARIABLES LIKE 'myisam_stats_method';
@@ -66,6 +68,7 @@ INSERT INTO t1 VALUES ('bce','def1', 'yuu', NULL);
INSERT INTO t1 VALUES ('bce','def2', NULL, 'quux');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -76,6 +79,7 @@ t1 1 a 4 d A 4 NULL NULL YES BTREE
DELETE FROM t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/mysql-test/suite/sys_vars/r/optimizer_use_condition_selectivity_basic.result b/mysql-test/suite/sys_vars/r/optimizer_use_condition_selectivity_basic.result
index a030bae3750..941b7699747 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_use_condition_selectivity_basic.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_use_condition_selectivity_basic.result
@@ -1,33 +1,33 @@
SET @start_global_value = @@global.optimizer_use_condition_selectivity;
SELECT @start_global_value;
@start_global_value
-1
+4
SET @start_session_value = @@session.optimizer_use_condition_selectivity;
SELECT @start_session_value;
@start_session_value
-1
+4
'#--------------------FN_DYNVARS_115_01-------------------------#'
SET @@global.optimizer_use_condition_selectivity = DEFAULT;
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
-1
+4
SET @@session.optimizer_use_condition_selectivity = DEFAULT;
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
-1
+4
'#--------------------FN_DYNVARS_115_02-------------------------#'
SET @@global.optimizer_use_condition_selectivity = DEFAULT;
SELECT @@global.optimizer_use_condition_selectivity = 1;
@@global.optimizer_use_condition_selectivity = 1
-1
+0
SET @@session.optimizer_use_condition_selectivity = DEFAULT;
SELECT @@session.optimizer_use_condition_selectivity = 1;
@@session.optimizer_use_condition_selectivity = 1
-1
+0
'#--------------------FN_DYNVARS_115_03-------------------------#'
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
-1
+4
SET @@global.optimizer_use_condition_selectivity = 0;
Warnings:
Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '0'
@@ -63,7 +63,7 @@ SELECT @@global.optimizer_use_condition_selectivity;
'#--------------------FN_DYNVARS_115_04-------------------------#'
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
-1
+4
SET @@session.optimizer_use_condition_selectivity = 0;
Warnings:
Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '0'
@@ -134,8 +134,8 @@ SELECT @@local.optimizer_use_condition_selectivity = @@session.optimizer_use_con
SET @@global.optimizer_use_condition_selectivity = @start_global_value;
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
-1
+4
SET @@session.optimizer_use_condition_selectivity = @start_session_value;
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
-1
+4
diff --git a/mysql-test/suite/sys_vars/r/sql_mode_basic.result b/mysql-test/suite/sys_vars/r/sql_mode_basic.result
index a200f620a7c..d911e80b780 100644
--- a/mysql-test/suite/sys_vars/r/sql_mode_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_mode_basic.result
@@ -367,7 +367,15 @@ SELECT @@global.sql_mode;
@@global.sql_mode
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH,EMPTY_STRING_IS_NULL,SIMULTANEOUS_ASSIGNMENT
SET @@global.sql_mode = 17179869184;
-ERROR 42000: Variable 'sql_mode' can't be set to the value of '17179869184'
+SELECT @@global.sql_mode;
+@@global.sql_mode
+TIME_ROUND_FRACTIONAL
+SET @@global.sql_mode = 34359738367;
+SELECT @@global.sql_mode;
+@@global.sql_mode
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH,EMPTY_STRING_IS_NULL,SIMULTANEOUS_ASSIGNMENT,TIME_ROUND_FRACTIONAL
+SET @@global.sql_mode = 34359738368;
+ERROR 42000: Variable 'sql_mode' can't be set to the value of '34359738368'
SET @@global.sql_mode = 0.4;
ERROR 42000: Incorrect argument type to variable 'sql_mode'
'#---------------------FN_DYNVARS_152_08----------------------#'
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 835145531b9..926ac8b2668 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -881,10 +881,10 @@ ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME EQ_RANGE_INDEX_DIVE_LIMIT
-SESSION_VALUE 0
-GLOBAL_VALUE 0
+SESSION_VALUE 10
+GLOBAL_VALUE 10
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 10
VARIABLE_SCOPE SESSION
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The optimizer will use existing index statistics instead of doing index dives for equality ranges if the number of equality ranges for the index is larger than or equal to this number. If set to 0, index dives are always used.
@@ -2210,6 +2210,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME MAX_PASSWORD_ERRORS
+SESSION_VALUE NULL
+GLOBAL_VALUE 4294967295
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 4294967295
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT If there is more than this number of failed connect attempts due to invalid password, user will be blocked from further connections until FLUSH_PRIVILEGES.
+NUMERIC_MIN_VALUE 1
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_PREPARED_STMT_COUNT
SESSION_VALUE NULL
GLOBAL_VALUE 16382
@@ -2729,10 +2743,10 @@ ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_USE_CONDITION_SELECTIVITY
-SESSION_VALUE 1
-GLOBAL_VALUE 1
+SESSION_VALUE 4
+GLOBAL_VALUE 4
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 1
+DEFAULT_VALUE 4
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples
@@ -3066,9 +3080,9 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
SESSION_VALUE NULL
-GLOBAL_VALUE 200
+GLOBAL_VALUE 202
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 200
+DEFAULT_VALUE 202
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Maximum number of statement instruments.
@@ -3845,7 +3859,7 @@ VARIABLE_COMMENT Sets the sql mode
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH,EMPTY_STRING_IS_NULL,SIMULTANEOUS_ASSIGNMENT
+ENUM_VALUE_LIST REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH,EMPTY_STRING_IS_NULL,SIMULTANEOUS_ASSIGNMENT,TIME_ROUND_FRACTIONAL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SQL_NOTES
@@ -4151,7 +4165,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
-NUMERIC_MAX_VALUE 524288
+NUMERIC_MAX_VALUE 2097152
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -4507,17 +4521,17 @@ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME USE_STAT_TABLES
-SESSION_VALUE NEVER
-GLOBAL_VALUE NEVER
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE NEVER
+SESSION_VALUE PREFERABLY
+GLOBAL_VALUE PREFERABLY
+GLOBAL_VALUE_ORIGIN CONFIG
+DEFAULT_VALUE PREFERABLY_FOR_QUERIES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Specifies how to use system statistics tables
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST NEVER,COMPLEMENTARY,PREFERABLY
+ENUM_VALUE_LIST NEVER,COMPLEMENTARY,PREFERABLY,COMPLEMENTARY_FOR_QUERIES,PREFERABLY_FOR_QUERIES
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WAIT_TIMEOUT
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 26acbfad9c6..219b550d83e 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -895,10 +895,10 @@ ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME EQ_RANGE_INDEX_DIVE_LIMIT
-SESSION_VALUE 0
-GLOBAL_VALUE 0
+SESSION_VALUE 10
+GLOBAL_VALUE 10
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 0
+DEFAULT_VALUE 10
VARIABLE_SCOPE SESSION
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The optimizer will use existing index statistics instead of doing index dives for equality ranges if the number of equality ranges for the index is larger than or equal to this number. If set to 0, index dives are always used.
@@ -1202,6 +1202,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
+VARIABLE_NAME GTID_CLEANUP_BATCH_SIZE
+SESSION_VALUE NULL
+GLOBAL_VALUE 64
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 64
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Normally does not need tuning. How many old rows must accumulate in the mysql.gtid_slave_pos table before a background job will be run to delete them. Can be increased to reduce number of commits if using many different engines with --gtid_pos_auto_engines, or to reduce CPU overhead if using a huge number of different gtid_domain_ids. Can be decreased to reduce number of old rows in the table.
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 2147483647
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME GTID_CURRENT_POS
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -2406,6 +2420,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME MAX_PASSWORD_ERRORS
+SESSION_VALUE NULL
+GLOBAL_VALUE 4294967295
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 4294967295
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT If there is more than this number of failed connect attempts due to invalid password, user will be blocked from further connections until FLUSH_PRIVILEGES.
+NUMERIC_MIN_VALUE 1
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_PREPARED_STMT_COUNT
SESSION_VALUE NULL
GLOBAL_VALUE 16382
@@ -2939,10 +2967,10 @@ ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_USE_CONDITION_SELECTIVITY
-SESSION_VALUE 1
-GLOBAL_VALUE 1
+SESSION_VALUE 4
+GLOBAL_VALUE 4
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 1
+DEFAULT_VALUE 4
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples
@@ -3276,9 +3304,9 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
SESSION_VALUE NULL
-GLOBAL_VALUE 200
+GLOBAL_VALUE 202
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 200
+DEFAULT_VALUE 202
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Maximum number of statement instruments.
@@ -4755,7 +4783,7 @@ VARIABLE_COMMENT Sets the sql mode
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH,EMPTY_STRING_IS_NULL,SIMULTANEOUS_ASSIGNMENT
+ENUM_VALUE_LIST REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH,EMPTY_STRING_IS_NULL,SIMULTANEOUS_ASSIGNMENT,TIME_ROUND_FRACTIONAL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SQL_NOTES
@@ -5103,7 +5131,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
-NUMERIC_MAX_VALUE 524288
+NUMERIC_MAX_VALUE 2097152
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -5557,17 +5585,17 @@ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME USE_STAT_TABLES
-SESSION_VALUE NEVER
-GLOBAL_VALUE NEVER
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE NEVER
+SESSION_VALUE PREFERABLY
+GLOBAL_VALUE PREFERABLY
+GLOBAL_VALUE_ORIGIN CONFIG
+DEFAULT_VALUE PREFERABLY_FOR_QUERIES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Specifies how to use system statistics tables
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST NEVER,COMPLEMENTARY,PREFERABLY
+ENUM_VALUE_LIST NEVER,COMPLEMENTARY,PREFERABLY,COMPLEMENTARY_FOR_QUERIES,PREFERABLY_FOR_QUERIES
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WAIT_TIMEOUT
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index db932ae8223..ac83a0a8c7f 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -211,6 +211,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME WSREP_IGNORE_APPLY_ERRORS
+SESSION_VALUE NULL
+GLOBAL_VALUE 7
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 7
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Ignore replication errors
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 7
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_LOAD_DATA_SPLITTING
SESSION_VALUE NULL
GLOBAL_VALUE ON
@@ -218,7 +232,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT To commit LOAD DATA transaction after every 10K rows inserted
+VARIABLE_COMMENT To commit LOAD DATA transaction after every 10K rows inserted (deprecating)
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -519,6 +533,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME WSREP_SR_STORE
+SESSION_VALUE NULL
+GLOBAL_VALUE table
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE table
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Storage for streaming replication fragments
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST none,table
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_SST_AUTH
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -617,3 +645,31 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME WSREP_TRX_FRAGMENT_SIZE
+SESSION_VALUE 0
+GLOBAL_VALUE 0
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE 0
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT Size of transaction fragments for streaming replication (measured in units of 'wsrep_trx_fragment_unit')
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 2147483647
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME WSREP_TRX_FRAGMENT_UNIT
+SESSION_VALUE bytes
+GLOBAL_VALUE bytes
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE bytes
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Unit for streaming replication transaction fragments' size: bytes, rows, statements
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST bytes,rows,statements
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
diff --git a/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result
index 54b50c5ff75..69f3d42d2fb 100644
--- a/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result
+++ b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result
@@ -28,14 +28,14 @@ Warning 1292 Truncated incorrect table_definition_cache value: '2'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
400
-SET @@global.table_definition_cache = 524287;
+SET @@global.table_definition_cache = 2097151;
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
-524287
-SET @@global.table_definition_cache = 524288;
+2097151
+SET @@global.table_definition_cache = 2097152;
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
-524288
+2097152
'#--------------------FN_DYNVARS_019_04-------------------------#'
SET @@global.table_definition_cache = 0;
Warnings:
@@ -49,18 +49,18 @@ Warning 1292 Truncated incorrect table_definition_cache value: '-1024'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
400
-SET @@global.table_definition_cache = 524289;
+SET @@global.table_definition_cache = 2097153;
Warnings:
-Warning 1292 Truncated incorrect table_definition_cache value: '524289'
+Warning 1292 Truncated incorrect table_definition_cache value: '2097153'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
-524288
+2097152
SET @@global.table_definition_cache = 42949672950;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '42949672950'
SELECT @@global.table_definition_cache;
@@global.table_definition_cache
-524288
+2097152
SET @@global.table_definition_cache = 21221204.10;
ERROR 42000: Incorrect argument type to variable 'table_definition_cache'
SET @@global.table_definition_cache = ON;
diff --git a/mysql-test/suite/sys_vars/r/use_stat_tables_basic.result b/mysql-test/suite/sys_vars/r/use_stat_tables_basic.result
index 64f6d868fa6..1de75b65caf 100644
--- a/mysql-test/suite/sys_vars/r/use_stat_tables_basic.result
+++ b/mysql-test/suite/sys_vars/r/use_stat_tables_basic.result
@@ -1,16 +1,16 @@
SET @start_global_value = @@global.use_stat_tables;
SELECT @start_global_value;
@start_global_value
-NEVER
+PREFERABLY
SET @start_session_value = @@session.use_stat_tables;
SELECT @start_session_value;
@start_session_value
-NEVER
+PREFERABLY
SET @@global.use_stat_tables = 2;
SET @@global.use_stat_tables = DEFAULT;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
-NEVER
+PREFERABLY_FOR_QUERIES
SET @@global.use_stat_tables = 0;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
@@ -87,9 +87,9 @@ USE_STAT_TABLES COMPLEMENTARY
SET @@global.use_stat_tables = @start_global_value;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
-NEVER
+PREFERABLY
SET @@session.use_stat_tables = @start_session_value;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
-NEVER
+PREFERABLY
set sql_mode='';
diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
index b2e07c55b38..15949a14e39 100644
--- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
+++ b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
@@ -2,9 +2,6 @@
# wsrep_provider_options
#
call mtr.add_suppression("WSREP: Failed to get provider options");
-SET @@global.wsrep_provider = @@global.wsrep_provider;
-# save the initial value
-SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options;
# default
SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
@@ -16,18 +13,21 @@ ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable
SET @@global.wsrep_provider_options='option1';
SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
-option1
+
# valid values
SET @@global.wsrep_provider_options='name1=value1;name2=value2';
+ERROR HY000: WSREP (galera) not started
SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
-name1=value1;name2=value2
+
SET @@global.wsrep_provider_options='hyphenated-name:value';
+ERROR HY000: WSREP (galera) not started
SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
-hyphenated-name:value
+
SET @@global.wsrep_provider_options=default;
+ERROR HY000: WSREP (galera) not started
SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
@@ -42,8 +42,5 @@ SET @@global.wsrep_provider_options=NULL;
Got one of the listed errors
SELECT @@global.wsrep_provider_options;
@@global.wsrep_provider_options
-NULL
-# restore the initial value
-SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved;
# End of test
diff --git a/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result
index cbdac640c36..51f167b8f47 100644
--- a/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result
+++ b/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result
@@ -33,6 +33,10 @@ SET @@global.wsrep_sst_method="xtrabackup-v2";
SELECT @@global.wsrep_sst_method;
@@global.wsrep_sst_method
xtrabackup-v2
+SET @@global.wsrep_sst_method="mariabackup";
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+mariabackup
SET @@global.wsrep_sst_method=default;
SELECT @@global.wsrep_sst_method;
@@global.wsrep_sst_method
diff --git a/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test b/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test
index e962dcf178d..07f0c431138 100644
--- a/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test
+++ b/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test
@@ -1,5 +1,6 @@
# bool readonly
+--source include/have_aria_used_for_temp_tables.inc
--source include/have_maria.inc
#
# show the global and session values;
diff --git a/mysql-test/suite/sys_vars/t/sql_mode_basic.test b/mysql-test/suite/sys_vars/t/sql_mode_basic.test
index b4841ecd3ff..68be8ba969b 100644
--- a/mysql-test/suite/sys_vars/t/sql_mode_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_mode_basic.test
@@ -310,8 +310,14 @@ SELECT @@global.sql_mode;
SET @@global.sql_mode = 17179869183;
SELECT @@global.sql_mode;
---Error ER_WRONG_VALUE_FOR_VAR
SET @@global.sql_mode = 17179869184;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 34359738367;
+SELECT @@global.sql_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = 34359738368;
# use of decimal values
diff --git a/mysql-test/suite/sys_vars/t/sysvars_aria.test b/mysql-test/suite/sys_vars/t/sysvars_aria.test
index 5ff5c0d4b2b..67fb0baa4f1 100644
--- a/mysql-test/suite/sys_vars/t/sysvars_aria.test
+++ b/mysql-test/suite/sys_vars/t/sysvars_aria.test
@@ -1,4 +1,5 @@
--source include/have_aria.inc
+--source include/have_aria_used_for_temp_tables.inc
--source include/word_size.inc
--vertical_results
diff --git a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test
index dc0903c5d40..d7a6ff25a0b 100644
--- a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test
+++ b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test
@@ -64,9 +64,9 @@ SET @@global.table_definition_cache = 1;
SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 2;
SELECT @@global.table_definition_cache;
-SET @@global.table_definition_cache = 524287;
+SET @@global.table_definition_cache = 2097151;
SELECT @@global.table_definition_cache;
-SET @@global.table_definition_cache = 524288;
+SET @@global.table_definition_cache = 2097152;
SELECT @@global.table_definition_cache;
@@ -79,7 +79,7 @@ SET @@global.table_definition_cache = 0;
SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = -1024;
SELECT @@global.table_definition_cache;
-SET @@global.table_definition_cache = 524289;
+SET @@global.table_definition_cache = 2097153;
SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 42949672950;
SELECT @@global.table_definition_cache;
diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
index bf93b4646d9..9c1e596d3e4 100644
--- a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
+++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
@@ -1,5 +1,7 @@
###################### tmp_memory_table_size_func.test ########################
+--source include/have_aria_used_for_temp_tables.inc
+
--source include/load_sysvars.inc
--source include/have_sequence.inc
diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
index d2ea32a0637..6eb3a94b6a4 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
+++ b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
@@ -6,11 +6,6 @@
call mtr.add_suppression("WSREP: Failed to get provider options");
-SET @@global.wsrep_provider = @@global.wsrep_provider;
-
---echo # save the initial value
-SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options;
-
--echo # default
SELECT @@global.wsrep_provider_options;
@@ -24,13 +19,13 @@ SELECT @@global.wsrep_provider_options;
--echo
--echo # valid values
---error 0,ER_WRONG_ARGUMENTS
+--error ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options='name1=value1;name2=value2';
SELECT @@global.wsrep_provider_options;
---error 0,ER_WRONG_ARGUMENTS
+--error ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options='hyphenated-name:value';
SELECT @@global.wsrep_provider_options;
---error 0,ER_WRONG_ARGUMENTS
+--error ER_WRONG_ARGUMENTS
SET @@global.wsrep_provider_options=default;
SELECT @@global.wsrep_provider_options;
@@ -43,9 +38,4 @@ SELECT @@global.wsrep_provider_options;
SET @@global.wsrep_provider_options=NULL;
SELECT @@global.wsrep_provider_options;
---echo
---echo # restore the initial value
---error 0,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved;
-
--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test
index 3f40a3922dd..be038eb4baf 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test
+++ b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test
@@ -23,10 +23,15 @@ SET @@global.wsrep_sst_method=rsync;
SELECT @@global.wsrep_sst_method;
SET @@global.wsrep_sst_method=mysqldump;
SELECT @@global.wsrep_sst_method;
+# The xtrabackup and xtrabackup-v2 methods are obsolete,
+# but we can still select them (they will be automatically
+# replaced to mariabackup):
SET @@global.wsrep_sst_method=xtrabackup;
SELECT @@global.wsrep_sst_method;
SET @@global.wsrep_sst_method="xtrabackup-v2";
SELECT @@global.wsrep_sst_method;
+SET @@global.wsrep_sst_method="mariabackup";
+SELECT @@global.wsrep_sst_method;
SET @@global.wsrep_sst_method=default;
SELECT @@global.wsrep_sst_method;
diff --git a/mysql-test/suite/vcol/r/update.result b/mysql-test/suite/vcol/r/update.result
index 5a6355e1773..5b67c9dd0f7 100644
--- a/mysql-test/suite/vcol/r/update.result
+++ b/mysql-test/suite/vcol/r/update.result
@@ -122,7 +122,7 @@ select * from t;
a b c d e
10 5 5 5 5
replace delayed t (a,b,d) values (10,6,6);
-flush tables;
+flush tables t;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -130,7 +130,7 @@ select * from t;
a b c d e
10 6 6 6 6
insert delayed t(a,b,d) values (10,6,6) on duplicate key update b=7, d=7;
-flush tables;
+flush tables t;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
diff --git a/mysql-test/suite/vcol/r/update_binlog.result b/mysql-test/suite/vcol/r/update_binlog.result
index d4102fc460a..c29200513b0 100644
--- a/mysql-test/suite/vcol/r/update_binlog.result
+++ b/mysql-test/suite/vcol/r/update_binlog.result
@@ -124,7 +124,7 @@ select * from t;
a b c d e
10 5 5 5 5
replace delayed t (a,b,d) values (10,6,6);
-flush tables;
+flush tables t;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -132,7 +132,7 @@ select * from t;
a b c d e
10 6 6 6 6
insert delayed t(a,b,d) values (10,6,6) on duplicate key update b=7, d=7;
-flush tables;
+flush tables t;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -304,7 +304,7 @@ select * from t;
a b c d e
10 5 5 5 5
replace delayed t (a,b,d) values (10,6,6);
-flush tables;
+flush tables t;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -312,7 +312,7 @@ select * from t;
a b c d e
10 6 6 6 6
insert delayed t(a,b,d) values (10,6,6) on duplicate key update b=7, d=7;
-flush tables;
+flush tables t;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
diff --git a/mysql-test/suite/vcol/r/upgrade.result b/mysql-test/suite/vcol/r/upgrade.result
index 75684bf0e41..527bc5f3abf 100644
--- a/mysql-test/suite/vcol/r/upgrade.result
+++ b/mysql-test/suite/vcol/r/upgrade.result
@@ -16,3 +16,19 @@ select * from vcol_autoinc;
pk v3
1 1
drop table vcol_autoinc;
+check table t1 for upgrade;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+flush tables;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `Date` datetime(6) NOT NULL,
+ `Data` varbinary(2000) NOT NULL,
+ `a` varchar(100) GENERATED ALWAYS AS (column_get(`Data`,1 as char(100) charset latin1)) VIRTUAL,
+ PRIMARY KEY (`Date`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (to_days(`Date`))
+(PARTITION `p20181029` VALUES LESS THAN (737361) ENGINE = MyISAM,
+ PARTITION `p20181128` VALUES LESS THAN (737391) ENGINE = MyISAM)
+drop table t1;
diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result
index bd013da9b03..0b257d12ca0 100644
--- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result
@@ -277,6 +277,7 @@ a b c d
delete from t1 where b=12;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index f3edfa9c026..9eb4616949c 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -182,16 +182,36 @@ a b c
2 3 y
0 1 y,n
drop table t1,t2;
-CREATE TABLE t1 (
+SET @old_debug= @@global.debug;
+SET @old_debug= @@global.debug;
+SET GLOBAL debug_dbug= "+d,write_delay_wakeup";
+CREATE TABLE t1 (a int,
ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL
) ENGINE=MyISAM;
-INSERT INTO t1 (tsv) VALUES (DEFAULT);
-INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT);
+# First test FLUSH TABLES
+INSERT INTO t1 (a,tsv) VALUES (1,DEFAULT);
+INSERT DELAYED INTO t1 (a,tsv) VALUES (2,DEFAULT);
FLUSH TABLES;
+SELECT COUNT(*) > 0 FROM t1;
+COUNT(*) > 0
+1
+# Then test FLUSH TABLES t1;
+INSERT INTO t1 (a,tsv) VALUES (3,DEFAULT);
+INSERT DELAYED INTO t1 (a,tsv) VALUES (4,DEFAULT);
+FLUSH TABLES t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+# Then test FLUSH TABLES WITH READ LOCK;
+INSERT INTO t1 (a,tsv) VALUES (5,DEFAULT);
+INSERT DELAYED INTO t1 (a,tsv) VALUES (6,DEFAULT);
+FLUSH TABLES WITH READ LOCK;
SELECT COUNT(*) FROM t1;
COUNT(*)
-2
+6
+set GLOBAL debug_dbug= @old_debug;
+unlock tables;
DROP TABLE t1;
#
# MDEV-4823 Server crashes in Item_func_not::fix_fields on
diff --git a/mysql-test/suite/vcol/t/update.test b/mysql-test/suite/vcol/t/update.test
index 53189ee3219..e1351986968 100644
--- a/mysql-test/suite/vcol/t/update.test
+++ b/mysql-test/suite/vcol/t/update.test
@@ -93,10 +93,10 @@ check table t; select * from t;
insert t(a,b,d) select 10,4,4 on duplicate key update b=5, d=5;
check table t; select * from t;
replace delayed t (a,b,d) values (10,6,6);
-flush tables;
+flush tables t;
check table t; select * from t;
insert delayed t(a,b,d) values (10,6,6) on duplicate key update b=7, d=7;
-flush tables;
+flush tables t;
check table t; select * from t;
--write_file $MYSQLTEST_VARDIR/tmp/vblobs.txt
10 8 foo 8 foo
diff --git a/mysql-test/suite/vcol/t/upgrade.test b/mysql-test/suite/vcol/t/upgrade.test
index 3e221747dfa..146495d8ed0 100644
--- a/mysql-test/suite/vcol/t/upgrade.test
+++ b/mysql-test/suite/vcol/t/upgrade.test
@@ -11,3 +11,18 @@ select * from vcol_autoinc;
insert vcol_autoinc (pk) values (1);
select * from vcol_autoinc;
drop table vcol_autoinc;
+
+#
+# MDEV-17909 Problem by MariaDB Update 10.1.32 -> 10.2.19 (Incorrect information in file: .frm)
+#
+source include/have_partition.inc;
+copy_file std_data/mdev17909#P#p20181029.MYD $datadir/test/t1#P#p20181029.MYD;
+copy_file std_data/mdev17909#P#p20181029.MYI $datadir/test/t1#P#p20181029.MYI;
+copy_file std_data/mdev17909#P#p20181128.MYD $datadir/test/t1#P#p20181128.MYD;
+copy_file std_data/mdev17909#P#p20181128.MYI $datadir/test/t1#P#p20181128.MYI;
+copy_file std_data/mdev17909.frm $datadir/test/t1.frm;
+copy_file std_data/mdev17909.par $datadir/test/t1.par;
+check table t1 for upgrade;
+flush tables;
+show create table t1;
+drop table t1;
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index b351e1eb4a6..95b707e3e12 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -1,4 +1,5 @@
--source include/have_ucs2.inc
+--source include/have_debug.inc
let $MYSQLD_DATADIR= `select @@datadir`;
@@ -184,19 +185,35 @@ drop table t1,t2;
# Bug mdev-3938: INSERT DELAYED for a table with virtual columns
#
-CREATE TABLE t1 (
+SET @old_debug= @@global.debug;
+SET @old_debug= @@global.debug;
+SET GLOBAL debug_dbug= "+d,write_delay_wakeup";
+CREATE TABLE t1 (a int,
ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL
) ENGINE=MyISAM;
-INSERT INTO t1 (tsv) VALUES (DEFAULT);
-
-INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT);
-
+--echo # First test FLUSH TABLES
+INSERT INTO t1 (a,tsv) VALUES (1,DEFAULT);
+INSERT DELAYED INTO t1 (a,tsv) VALUES (2,DEFAULT);
FLUSH TABLES;
+# Count may be 1 or 2, depending on FLUSH happened before or after delayed
+SELECT COUNT(*) > 0 FROM t1;
+--echo # Then test FLUSH TABLES t1;
+INSERT INTO t1 (a,tsv) VALUES (3,DEFAULT);
+INSERT DELAYED INTO t1 (a,tsv) VALUES (4,DEFAULT);
+FLUSH TABLES t1;
SELECT COUNT(*) FROM t1;
+--echo # Then test FLUSH TABLES WITH READ LOCK;
+
+INSERT INTO t1 (a,tsv) VALUES (5,DEFAULT);
+INSERT DELAYED INTO t1 (a,tsv) VALUES (6,DEFAULT);
+FLUSH TABLES WITH READ LOCK;
+SELECT COUNT(*) FROM t1;
+set GLOBAL debug_dbug= @old_debug;
+unlock tables;
DROP TABLE t1;
--echo #
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result
index 7cddc374f5f..350ebf260ac 100644
--- a/mysql-test/suite/versioning/r/alter.result
+++ b/mysql-test/suite/versioning/r/alter.result
@@ -527,7 +527,7 @@ ERROR HY000: Table `t` is already system-versioned
use mysql;
create or replace table t (x int) with system versioning;
ERROR HY000: System versioning tables in the `mysql` database are not suported
-alter table user add system versioning;
+alter table db add system versioning;
ERROR HY000: System versioning tables in the `mysql` database are not suported
use test;
# MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
diff --git a/mysql-test/suite/versioning/r/cte.result b/mysql-test/suite/versioning/r/cte.result
index fc070a70120..44135a83eb6 100644
--- a/mysql-test/suite/versioning/r/cte.result
+++ b/mysql-test/suite/versioning/r/cte.result
@@ -138,7 +138,7 @@ where e.mgr = a.emp_id
select name from emp where emp_id in (select emp_id from ancestors for system_time as of timestamp @ts_1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery4> ALL distinct_key NULL NULL NULL 4 100.00
-1 PRIMARY emp ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY emp ALL PRIMARY NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
4 MATERIALIZED <derived2> ALL NULL NULL NULL NULL 4 100.00
2 DERIVED e ALL NULL NULL NULL NULL 4 100.00 Using where
3 RECURSIVE UNION e ALL mgr-fk NULL NULL NULL 4 100.00 Using where
diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result
index 8169ddeaa92..a5dbd3fca36 100644
--- a/mysql-test/suite/versioning/r/foreign.result
+++ b/mysql-test/suite/versioning/r/foreign.result
@@ -292,3 +292,12 @@ select count(*) from subchild;
count(*)
0
drop table subchild, child, parent;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 INT, FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
+SET FOREIGN_KEY_CHECKS= OFF;
+INSERT IGNORE INTO t2 VALUES (1);
+SET FOREIGN_KEY_CHECKS= ON;
+UPDATE t2 SET f2= 2;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`))
+DELETE FROM t2;
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/versioning/r/online.result b/mysql-test/suite/versioning/r/online.result
index 580500544d6..e78db22bd2c 100644
--- a/mysql-test/suite/versioning/r/online.result
+++ b/mysql-test/suite/versioning/r/online.result
@@ -124,5 +124,33 @@ alter table t add index idx(a), lock=none;
alter table t drop column s, drop column e;
alter table t drop system versioning, lock=none;
ERROR 0A000: LOCK=NONE is not supported. Reason: Not implemented for system-versioned operations. Try LOCK=SHARED
+#
+# MDEV-17697 Broken versioning info after instant drop column
+#
+set @@system_versioning_alter_history= keep;
+create or replace table t1 (a int, b int) with system versioning;
+insert into t1 values (1, 1);
+alter table t1 drop column b, algorithm=instant;
+alter table t1 drop system versioning;
+create or replace table t1 (a int, b int) with system versioning;
+insert into t1 values (1, 1);
+alter table t1 drop system versioning;
+#
+# MDEV-18173 Assertion `o->ind == vers_end' or `o->ind == vers_start' failed in dict_table_t::instant_column
+#
+set @@system_versioning_alter_history= keep;
+create or replace table t1 (pk integer primary key, a int, b int, v int as (a))
+with system versioning;
+alter table t1 force;
+alter table t1 drop column b;
+#
+# MDEV-18122 Assertion `table->versioned() == m_prebuilt->table->versioned()' failed in ha_innobase::open
+#
+create or replace table t1 (
+x int,
+v int as (x) virtual,
+y int
+) with system versioning;
+alter table t1 drop system versioning;
drop database test;
create database test;
diff --git a/mysql-test/suite/versioning/r/sysvars.result b/mysql-test/suite/versioning/r/sysvars.result
index b23742462d1..79aa8fce746 100644
--- a/mysql-test/suite/versioning/r/sysvars.result
+++ b/mysql-test/suite/versioning/r/sysvars.result
@@ -53,7 +53,7 @@ Variable_name Value
system_versioning_asof 1900-01-01 00:00:00.000000
set global system_versioning_asof= timestamp'1911-11-11 11:11:11.1111119';
Warnings:
-Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
+Note 1292 Truncated incorrect DATETIME value: '1911-11-11 11:11:11.1111119'
show global variables like 'system_versioning_asof';
Variable_name Value
system_versioning_asof 1911-11-11 11:11:11.111111
@@ -80,7 +80,7 @@ Variable_name Value
system_versioning_asof 1900-01-01 00:00:00.000000
set system_versioning_asof= timestamp'1911-11-11 11:11:11.1111119';
Warnings:
-Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
+Note 1292 Truncated incorrect DATETIME value: '1911-11-11 11:11:11.1111119'
show variables like 'system_versioning_asof';
Variable_name Value
system_versioning_asof 1911-11-11 11:11:11.111111
@@ -130,3 +130,14 @@ show status like "Feature_system_versioning";
Variable_name Value
Feature_system_versioning 2
drop table t;
+#
+# MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP
+#
+SET sql_mode=TIME_ROUND_FRACTIONAL;
+SET @@global.system_versioning_asof= timestamp'2001-12-31 23:59:59.9999999';
+Warnings:
+Note 1292 Truncated incorrect DATETIME value: '2001-12-31 23:59:59.9999999'
+SELECT @@global.system_versioning_asof;
+@@global.system_versioning_asof
+2002-01-01 00:00:00.000000
+SET @@global.system_versioning_asof= DEFAULT;
diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test
index 05bd6019a32..01cb2d72f8d 100644
--- a/mysql-test/suite/versioning/t/alter.test
+++ b/mysql-test/suite/versioning/t/alter.test
@@ -450,7 +450,7 @@ use mysql;
--error ER_VERS_DB_NOT_SUPPORTED
create or replace table t (x int) with system versioning;
--error ER_VERS_DB_NOT_SUPPORTED
-alter table user add system versioning;
+alter table db add system versioning;
use test;
--echo # MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test
index 566d481c2a8..075f15a216c 100644
--- a/mysql-test/suite/versioning/t/foreign.test
+++ b/mysql-test/suite/versioning/t/foreign.test
@@ -317,4 +317,18 @@ select count(*) from subchild;
drop table subchild, child, parent;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 INT, FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
+
+SET FOREIGN_KEY_CHECKS= OFF;
+INSERT IGNORE INTO t2 VALUES (1);
+
+SET FOREIGN_KEY_CHECKS= ON;
+--error ER_NO_REFERENCED_ROW_2
+UPDATE t2 SET f2= 2;
+DELETE FROM t2;
+
+DROP TABLE t2, t1;
+
+
--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/versioning/t/online.test b/mysql-test/suite/versioning/t/online.test
index 9de4937d8da..02fde474d55 100644
--- a/mysql-test/suite/versioning/t/online.test
+++ b/mysql-test/suite/versioning/t/online.test
@@ -148,5 +148,49 @@ alter table t drop column s, drop column e;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t drop system versioning, lock=none;
+--echo #
+--echo # MDEV-17697 Broken versioning info after instant drop column
+--echo #
+set @@system_versioning_alter_history= keep;
+create or replace table t1 (a int, b int) with system versioning;
+insert into t1 values (1, 1);
+alter table t1 drop column b, algorithm=instant;
+alter table t1 drop system versioning;
+
+create or replace table t1 (a int, b int) with system versioning;
+insert into t1 values (1, 1);
+
+if ($have_debug) {
+--disable_query_log
+--disable_result_log
+set debug_dbug='+d,ib_commit_inplace_fail_1';
+--error ER_INTERNAL_ERROR
+alter table t1 drop column b, algorithm=instant;
+set debug_dbug= default;
+--enable_query_log
+--enable_result_log
+}
+alter table t1 drop system versioning;
+
+--echo #
+--echo # MDEV-18173 Assertion `o->ind == vers_end' or `o->ind == vers_start' failed in dict_table_t::instant_column
+--echo #
+set @@system_versioning_alter_history= keep;
+create or replace table t1 (pk integer primary key, a int, b int, v int as (a))
+with system versioning;
+
+alter table t1 force;
+alter table t1 drop column b;
+
+--echo #
+--echo # MDEV-18122 Assertion `table->versioned() == m_prebuilt->table->versioned()' failed in ha_innobase::open
+--echo #
+create or replace table t1 (
+ x int,
+ v int as (x) virtual,
+ y int
+) with system versioning;
+alter table t1 drop system versioning;
+
drop database test;
create database test;
diff --git a/mysql-test/suite/versioning/t/sysvars.test b/mysql-test/suite/versioning/t/sysvars.test
index 160af12fe02..52fab81b8e6 100644
--- a/mysql-test/suite/versioning/t/sysvars.test
+++ b/mysql-test/suite/versioning/t/sysvars.test
@@ -87,3 +87,13 @@ select * from t for system_time between '0-0-0' and current_timestamp(6);
show status like "Feature_system_versioning";
drop table t;
+
+
+--echo #
+--echo # MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP
+--echo #
+
+SET sql_mode=TIME_ROUND_FRACTIONAL;
+SET @@global.system_versioning_asof= timestamp'2001-12-31 23:59:59.9999999';
+SELECT @@global.system_versioning_asof;
+SET @@global.system_versioning_asof= DEFAULT;
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
index c7c8f2c6216..61142398372 100644
--- a/mysql-test/suite/wsrep/disabled.def
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -1,2 +1,3 @@
wsrep.foreign_key : Sporadic failure "WSREP has not yet prepared node for application use"
-
+wsrep.pool_of_threads : Sporadic failure "WSREP has not yet prepared node for application use"
+wsrep.variables : Global wsrep_on manipulation causes debug asserts
diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf
index 7e51b0750a1..e90686850a9 100644
--- a/mysql-test/suite/wsrep/my.cnf
+++ b/mysql-test/suite/wsrep/my.cnf
@@ -1,10 +1,8 @@
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
-[mysqld]
-wsrep-on=1
-
[mysqld.1]
+wsrep-on=OFF
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index cb371b33bfd..388fe7b8f4f 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -139,9 +139,6 @@ wsrep_local_state_comment #
SHOW STATUS LIKE 'x';
Variable_name Value
SET GLOBAL wsrep_provider=none;
-#
-# MDEV#6079: xtrabackup SST failing with maria-10.0-galera
-#
SHOW STATUS LIKE 'wsrep_local_state_uuid';
Variable_name Value
diff --git a/mysql-test/suite/wsrep/r/wsrep-recover,binlogon.rdiff b/mysql-test/suite/wsrep/r/wsrep-recover,binlogon.rdiff
new file mode 100644
index 00000000000..8b1b1e4c035
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep-recover,binlogon.rdiff
@@ -0,0 +1,28 @@
+--- r/wsrep-recover.result 2019-01-11 16:22:46.329012579 +0200
++++ r/wsrep-recover.reject 2019-01-11 16:23:55.313137675 +0200
+@@ -48,19 +48,17 @@
+ SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1";
+ connection default;
+ # Kill the server
+-Expect seqno 9
+-9
++Expect seqno 7
++7
+ disconnect con1;
+ disconnect con2;
+ disconnect con_ctrl;
+ connection default;
+-SELECT VARIABLE_VALUE `expect 10` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+-expect 10
+-10
+-Expect rows 5, 9, 10
++SELECT VARIABLE_VALUE `expect 8` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
++expect 8
++8
++Expect row 5
+ SELECT * FROM t1;
+ f1
+ 5
+-9
+-10
+ DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/r/wsrep-recover.result b/mysql-test/suite/wsrep/r/wsrep-recover.result
new file mode 100644
index 00000000000..10ad4e58fc5
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep-recover.result
@@ -0,0 +1,66 @@
+# Kill the server
+Expect seqno 1
+1
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+# Kill the server
+Expect seqno 3
+3
+INSERT INTO t1 VALUES (5);
+# Kill the server
+Expect seqno 5
+5
+SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+expect 6
+6
+connect con1, localhost, root;
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue";
+INSERT INTO t1 VALUES (7);
+connect con_ctrl, localhost, root;
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+connect con2, localhost, root;
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached WAIT_FOR continue";
+INSERT INTO t1 VALUES (8);
+connection con_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached";
+connection default;
+# Kill the server
+Expect seqno 6
+6
+disconnect con1;
+disconnect con2;
+disconnect con_ctrl;
+connection default;
+SELECT VARIABLE_VALUE `expect 7` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+expect 7
+7
+connect con1, localhost, root;
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification";
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1";
+INSERT INTO t1 VALUES (9);
+connect con_ctrl, localhost, root;
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+connect con2, localhost, root;
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2";
+INSERT INTO t1 VALUES (10);
+connection con_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2";
+SET DEBUG_SYNC = "now SIGNAL continue_after_certification";
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1";
+connection default;
+# Kill the server
+Expect seqno 9
+9
+disconnect con1;
+disconnect con2;
+disconnect con_ctrl;
+connection default;
+SELECT VARIABLE_VALUE `expect 10` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+expect 10
+10
+Expect rows 5, 9, 10
+SELECT * FROM t1;
+f1
+5
+9
+10
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm
index 03e23b8d7cb..fbaf5aa2b22 100644
--- a/mysql-test/suite/wsrep/suite.pm
+++ b/mysql-test/suite/wsrep/suite.pm
@@ -9,9 +9,9 @@ return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib64/galera-3/libgalera_smm.so",
+ "/usr/lib64/galera-4/libgalera_smm.so",
"/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-3/libgalera_smm.so",
+ "/usr/lib/galera-4/libgalera_smm.so",
"/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
diff --git a/mysql-test/suite/wsrep/t/binlog_format.cnf b/mysql-test/suite/wsrep/t/binlog_format.cnf
new file mode 100644
index 00000000000..7ec24c14d80
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/binlog_format.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
+innodb_autoinc_lock_mode=2
+
diff --git a/mysql-test/suite/wsrep/t/binlog_format.opt b/mysql-test/suite/wsrep/t/binlog_format.opt
deleted file mode 100644
index e3f2470c6e5..00000000000
--- a/mysql-test/suite/wsrep/t/binlog_format.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test
index 07001b17a84..695859a2ad3 100644
--- a/mysql-test/suite/wsrep/t/binlog_format.test
+++ b/mysql-test/suite/wsrep/t/binlog_format.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
diff --git a/mysql-test/suite/wsrep/t/mdev_10186.cnf b/mysql-test/suite/wsrep/t/mdev_10186.cnf
new file mode 100644
index 00000000000..3c4ca003f76
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_10186.cnf
@@ -0,0 +1,6 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=OFF
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/mdev_10186.opt b/mysql-test/suite/wsrep/t/mdev_10186.opt
deleted file mode 100644
index e2655959c62..00000000000
--- a/mysql-test/suite/wsrep/t/mdev_10186.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=0
diff --git a/mysql-test/suite/wsrep/t/mdev_10186.test b/mysql-test/suite/wsrep/t/mdev_10186.test
index 98ea5192634..f86c69f8a5b 100644
--- a/mysql-test/suite/wsrep/t/mdev_10186.test
+++ b/mysql-test/suite/wsrep/t/mdev_10186.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
diff --git a/mysql-test/suite/wsrep/t/mdev_6832.cnf b/mysql-test/suite/wsrep/t/mdev_6832.cnf
new file mode 100644
index 00000000000..0bf01f81fc5
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_6832.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
+
diff --git a/mysql-test/suite/wsrep/t/mdev_6832.opt b/mysql-test/suite/wsrep/t/mdev_6832.opt
deleted file mode 100644
index 16f8962dba2..00000000000
--- a/mysql-test/suite/wsrep/t/mdev_6832.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1
diff --git a/mysql-test/suite/wsrep/t/mdev_6832.test b/mysql-test/suite/wsrep/t/mdev_6832.test
index 9efccface57..226be1b788c 100644
--- a/mysql-test/suite/wsrep/t/mdev_6832.test
+++ b/mysql-test/suite/wsrep/t/mdev_6832.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.cnf b/mysql-test/suite/wsrep/t/mdev_7798.cnf
new file mode 100644
index 00000000000..0bf01f81fc5
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_7798.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
+
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.opt b/mysql-test/suite/wsrep/t/mdev_7798.opt
deleted file mode 100644
index 1007d5c0b78..00000000000
--- a/mysql-test/suite/wsrep/t/mdev_7798.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.test b/mysql-test/suite/wsrep/t/mdev_7798.test
index 9dfff0959bc..b9938d936cc 100644
--- a/mysql-test/suite/wsrep/t/mdev_7798.test
+++ b/mysql-test/suite/wsrep/t/mdev_7798.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.cnf b/mysql-test/suite/wsrep/t/pool_of_threads.cnf
new file mode 100644
index 00000000000..b63e3324796
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/pool_of_threads.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
+thread_handling=pool-of-threads
+
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt
deleted file mode 100644
index 814417e5b0f..00000000000
--- a/mysql-test/suite/wsrep/t/pool_of_threads.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
index f74b26167b2..c13a8c5f281 100644
--- a/mysql-test/suite/wsrep/t/variables.test
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -49,15 +49,11 @@ SHOW STATUS LIKE 'x';
# Reset it back.
SET GLOBAL wsrep_provider=none;
---echo #
---echo # MDEV#6079: xtrabackup SST failing with maria-10.0-galera
---echo #
-
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--enable_query_log
-# The following 2 variables are used in innobackupex during xtrabackup-based
+# The following 2 variables are used by mariabackup
# SST.
--echo
--replace_column 2 #
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-step.inc b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc
new file mode 100644
index 00000000000..22669438fe0
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc
@@ -0,0 +1,41 @@
+#
+# Macro to run wsrep recovery step. This is adapted from
+# suite/galera/include/galera_wsrep_recover.inc, with additional
+# option to pass binlog argument to recovery command. The macro
+# returns recovered position split in uuid and seqno parts.
+#
+# Arguments:
+#
+# wsrep_recover_binlog_opt - Binlog options to recovery command
+#
+# Return:
+#
+# wsrep_recover_start_position_uuid - UUID corresponding to recovered position
+# wsrep_recover_start_position_seqno - seqno corresponding to recovered position
+#
+
+--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.log --innodb --wsrep-recover $wsrep_recover_binlog_opt --core-file > $MYSQL_TMP_DIR/galera_wsrep_recover.log 2>&1
+
+--perl
+ use strict;
+ my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
+ chomp($wsrep_start_position);
+ die if $wsrep_start_position eq '';
+ open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;
+ my ($uuid, $seqno) = split /:/, $wsrep_start_position;
+ print FILE "--let \$wsrep_recover_start_position_uuid = $uuid\n";
+ print FILE "--let \$wsrep_recover_start_position_seqno = $seqno\n";
+ close FILE;
+EOF
+
+--source $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
+
+if ($wsrep_recover_start_position_uuid == '') {
+ --die "Could not obtain start_position_uuid."
+}
+
+if ($wsrep_recover_start_position_seqno == '') {
+ --die "Could not obtain start_position_seqno."
+}
+
+--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.cnf b/mysql-test/suite/wsrep/t/wsrep-recover.cnf
new file mode 100644
index 00000000000..19986cd97bc
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover.cnf
@@ -0,0 +1,9 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+binlog-format=ROW
+innodb-flush-log-at-trx-commit=1
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+innodb-autoinc-lock-mode=2 \ No newline at end of file
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.combinations b/mysql-test/suite/wsrep/t/wsrep-recover.combinations
new file mode 100644
index 00000000000..1ce3b45aa1a
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover.combinations
@@ -0,0 +1,4 @@
+[binlogon]
+log-bin
+
+[binlogoff]
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.test b/mysql-test/suite/wsrep/t/wsrep-recover.test
new file mode 100644
index 00000000000..8f00f19c27f
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover.test
@@ -0,0 +1,204 @@
+#
+# Verify that the wsrep XID gets updated in InnoDB rollback segment
+# properly and can be recovered with --wsrep-recover
+#
+# The test runs the following scenarios:
+#
+# 1) The server is started but no SQL is run
+# 2) DDL is executed
+# 3) INSERT is executed
+# 4) Two INSERTs are executed so that the first one in order will be
+# blocked after certification and the second one before entering
+# commit order critical section.
+# 5) Two DMLs are executed so that the prepare step is run out of order.
+# Both transactions are blocked before commit order critical section.
+#
+# After each scenario server is killed and the recovered position
+# is validated.
+#
+
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_debug_sync.inc
+
+#
+# Binlog option for recovery run. This must be set in the test because
+# combinations file causes log-bin option to be set from command line,
+# not via my.cnf.
+#
+--let $log_bin = `SELECT @@log_bin`
+if ($log_bin) {
+--let $wsrep_recover_binlog_opt = --log-bin
+}
+
+#
+# Scenario 1
+# The expected recovered seqno is 1 corresponding to initial cluster
+# configuration change.
+#
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 1
+--echo $wsrep_recover_start_position_seqno
+
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+#
+# Senario 2
+# The expected recovered seqno is 3 corresponding to two configuration
+# change events and CREATE TABLE.
+#
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 3
+--echo $wsrep_recover_start_position_seqno
+
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+#
+# Scenario 3
+# The expected recovered seqno is 5 corresponding to three configuration
+# change events, CREATE TABLE and INSERT.
+#
+# The expected wsrep_last_committed after the server is restarted is 6.
+#
+
+INSERT INTO t1 VALUES (5);
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 5
+--echo $wsrep_recover_start_position_seqno
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+
+#
+# Scenario 4
+#
+# This will cause the following
+#
+# Seqno 7 - the first INSERT is blocked after it is certified but before
+# it gets prepared
+# Seqno 8 - the second INSERT is blocked before it will be ordered for
+# commit, so it becomes prepared
+#
+# As an outcome, the recovery process should return seqno 6 because
+# the range of prepared transactions found after the crash recovery
+# is not continuous up to 8.
+#
+# The expected wsrep_last_committed after server is restarted is 7.
+#
+
+# Send INSERT which will block after certification
+--connect con1, localhost, root
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue";
+--send INSERT INTO t1 VALUES (7)
+
+--connect con_ctrl, localhost, root
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+
+# Send INSERT which will block before commit order critical section
+--connect con2, localhost, root
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached WAIT_FOR continue";
+--send INSERT INTO t1 VALUES (8)
+
+--connection con_ctrl
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached";
+
+--connection default
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 6
+--echo $wsrep_recover_start_position_seqno
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+--disconnect con1
+--disconnect con2
+--disconnect con_ctrl
+--connection default
+
+SELECT VARIABLE_VALUE `expect 7` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+
+#
+# Scenario 5
+#
+# This scenario will run two INSERTs in parallel so that they are
+# prepared out of order. The execution is stopped before commit
+# and the server is killed. The outcome of this scenario depends
+# on binlog settings:
+#
+# If binlog is off, the transactions will be recovered from InnoDB and
+# committed during recovery. The expected recovered seqno is 9, the
+# expected wsrep_last_committed after server is restarted is 10.
+#
+# If binlog is on, the transactions will be recovered from InnoDB but
+# will be rolled back since they are not logged yet in binlog. The
+# expected recovered seqno is 7, the expected wsrep_last_committed
+# after server is restarted is 8.
+#
+
+--connect con1, localhost, root
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification";
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1";
+--send INSERT INTO t1 VALUES (9)
+
+--connect con_ctrl, localhost, root
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+
+--connect con2, localhost, root
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2";
+--send INSERT INTO t1 VALUES (10)
+
+--connection con_ctrl
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2";
+SET DEBUG_SYNC = "now SIGNAL continue_after_certification";
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1";
+
+--connection default
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+if ($log_bin) {
+ --echo Expect seqno 7
+}
+if (!$log_bin) {
+ --echo Expect seqno 9
+}
+--echo $wsrep_recover_start_position_seqno
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+--disconnect con1
+--disconnect con2
+--disconnect con_ctrl
+--connection default
+
+if ($log_bin) {
+ SELECT VARIABLE_VALUE `expect 8` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+}
+if (!$log_bin) {
+ SELECT VARIABLE_VALUE `expect 10` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+}
+
+#
+# Final sanity check: The successful inserts into t1 should result
+if ($log_bin) {
+ --echo Expect row 5
+}
+if (!$log_bin) {
+ --echo Expect rows 5, 9, 10
+}
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 6150473c2f0..3794d2fe4dc 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -115,12 +115,15 @@ init_functions(IO_CACHE* info)
DBUG_ASSERT(!(info->myflags & MY_ENCRYPT));
info->read_function = info->share ? _my_b_cache_read_r : _my_b_cache_read;
info->write_function = info->share ? _my_b_cache_write_r : _my_b_cache_write;
- info->myflags&= ~MY_FULL_IO;
break;
case TYPE_NOT_SET:
DBUG_ASSERT(0);
break;
}
+ if (type == READ_CACHE || type == WRITE_CACHE || type == SEQ_READ_APPEND)
+ info->myflags|= MY_FULL_IO;
+ else
+ info->myflags&= ~MY_FULL_IO;
}
@@ -297,10 +300,6 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
}
info->inited=info->aio_result.pending=0;
#endif
- if (type == READ_CACHE || type == WRITE_CACHE || type == SEQ_READ_APPEND)
- info->myflags|= MY_FULL_IO;
- else
- info->myflags&= ~MY_FULL_IO;
DBUG_RETURN(0);
} /* init_io_cache */
@@ -469,8 +468,6 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
{
info->read_end=info->write_pos;
info->end_of_file=my_b_tell(info);
- /* Ensure we will read all data */
- info->myflags|= MY_FULL_IO;
/*
Trigger a new seek only if we have a valid
file handle.
@@ -485,7 +482,6 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
info->seek_not_done=1;
}
info->end_of_file = ~(my_off_t) 0;
- info->myflags&= ~MY_FULL_IO;
}
pos=info->request_pos+(seek_offset-info->pos_in_file);
if (type == WRITE_CACHE)
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index ae8993fbf00..2795eb3ffee 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -285,8 +285,8 @@ static void warn(const char *format,...)
va_list args;
DBUG_PRINT("error", ("%s", format));
va_start(args,format);
- fflush(stderr);
vfprintf(stderr, format, args);
+ fflush(stderr);
va_end(args);
#ifdef HAVE_BACKTRACE
@@ -319,7 +319,7 @@ static int bad_ptr(const char *where, void *ptr)
if (irem->marker != MAGICSTART)
{
DBUG_PRINT("error",("Unallocated data or underrun buffer %p", ptr));
- warn("Error: %s unallocated data or underrun buffer %p", ptr, where);
+ warn("Error: %s unallocated data or underrun buffer %p", where, ptr);
return 1;
}
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 357923cf388..09c4984c069 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -731,7 +731,8 @@ static void *signal_hand(void *arg __attribute__((unused)))
DBUG_PRINT("info",("Starting signal and alarm handling thread"));
for(;;)
{
- while ((error=my_sigwait(&set,&sig)) == EINTR)
+ int code;
+ while ((error=my_sigwait(&set,&sig,&code)) == EINTR)
printf("sigwait restarted\n");
if (error)
{
@@ -805,8 +806,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
/* Start signal thread and wait for it to start */
mysql_mutex_lock(&LOCK_thread_count);
- mysql_thread_create(0,
- &tid, &thr_attr, signal_hand, NULL);
+ mysql_thread_create(0, &tid, &thr_attr, signal_hand, NULL);
mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
DBUG_PRINT("info",("signal thread created"));
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index b025879b6ee..6ed5ed10cb2 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -90,9 +90,7 @@ static int prepare_for_fill(TABLE_LIST *tables)
in SHOW STATUS and we want to avoid skewing the statistics)
*/
thd->variables.pseudo_thread_id= thd->thread_id;
- mysql_mutex_lock(&LOCK_thread_count);
- threads.append(thd);
- mysql_mutex_unlock(&LOCK_thread_count);
+ server_threads.insert(thd);
thd->thread_stack= (char*) &tables;
if (thd->store_globals())
return 1;
@@ -139,7 +137,7 @@ static int prepare_for_fill(TABLE_LIST *tables)
*/
static bool going_down()
{
- return shutdown_plugin || shutdown_in_progress || (thd && thd->killed);
+ return shutdown_plugin || abort_loop || (thd && thd->killed);
}
/**
@@ -258,12 +256,9 @@ ret:
reset all thread local status variables to minimize
the effect of the background thread on SHOW STATUS.
*/
- mysql_mutex_lock(&LOCK_thread_count);
+ server_threads.erase(thd);
thd->set_status_var_init();
thd->killed= KILL_CONNECTION;
- thd->unlink();
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
delete thd;
thd= 0;
}
diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp
index a76428b29d3..52ea8f2a8c4 100644
--- a/plugin/handler_socket/handlersocket/database.cpp
+++ b/plugin/handler_socket/handlersocket/database.cpp
@@ -280,7 +280,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag)
DBG_THR(fprintf(stderr,
"thread_stack = %p sizeof(THD)=%zu sizeof(mtx)=%zu "
"O: %zu %zu %zu %zu %zu %zu %zu\n",
- thd->thread_stack, sizeof(THD), sizeof(LOCK_thread_count),
+ thd->thread_stack, sizeof(THD), sizeof(mysql_mutex_t),
DENA_THR_OFFSETOF(mdl_context),
DENA_THR_OFFSETOF(net),
DENA_THR_OFFSETOF(LOCK_thd_data),
@@ -307,7 +307,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag)
}
{
thd->thread_id = next_thread_id();
- add_to_active_threads(thd);
+ server_threads.insert(thd);
}
DBG_THR(fprintf(stderr, "HNDSOCK init thread wsts\n"));
@@ -341,10 +341,8 @@ dbcontext::term_thread()
close_tables_if();
my_pthread_setspecific_ptr(THR_THD, 0);
{
- pthread_mutex_lock(&LOCK_thread_count);
delete thd;
thd = 0;
- pthread_mutex_unlock(&LOCK_thread_count);
my_thread_end();
}
}
diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc
index e32bbc55f3e..37c0ca3a460 100644
--- a/plugin/metadata_lock_info/metadata_lock_info.cc
+++ b/plugin/metadata_lock_info/metadata_lock_info.cc
@@ -21,7 +21,7 @@
#include "sql_show.h"
static const LEX_STRING metadata_lock_info_lock_name[] = {
- { C_STRING_WITH_LEN("Global read lock") },
+ { C_STRING_WITH_LEN("Backup lock") },
{ C_STRING_WITH_LEN("Schema metadata lock") },
{ C_STRING_WITH_LEN("Table metadata lock") },
{ C_STRING_WITH_LEN("Stored function metadata lock") },
@@ -29,23 +29,9 @@ static const LEX_STRING metadata_lock_info_lock_name[] = {
{ C_STRING_WITH_LEN("Stored package body metadata lock") },
{ C_STRING_WITH_LEN("Trigger metadata lock") },
{ C_STRING_WITH_LEN("Event metadata lock") },
- { C_STRING_WITH_LEN("Commit lock") },
{ C_STRING_WITH_LEN("User lock") },
};
-static const LEX_STRING metadata_lock_info_lock_mode[] = {
- { C_STRING_WITH_LEN("MDL_INTENTION_EXCLUSIVE") },
- { C_STRING_WITH_LEN("MDL_SHARED") },
- { C_STRING_WITH_LEN("MDL_SHARED_HIGH_PRIO") },
- { C_STRING_WITH_LEN("MDL_SHARED_READ") },
- { C_STRING_WITH_LEN("MDL_SHARED_WRITE") },
- { C_STRING_WITH_LEN("MDL_SHARED_UPGRADABLE") },
- { C_STRING_WITH_LEN("MDL_SHARED_READ_ONLY") },
- { C_STRING_WITH_LEN("MDL_SHARED_NO_WRITE") },
- { C_STRING_WITH_LEN("MDL_SHARED_NO_READ_WRITE") },
- { C_STRING_WITH_LEN("MDL_EXCLUSIVE") },
-};
-
static ST_FIELD_INFO i_s_metadata_lock_info_fields_info[] =
{
{"THREAD_ID", 20, MYSQL_TYPE_LONGLONG, 0,
@@ -71,22 +57,21 @@ struct st_i_s_metadata_param
int i_s_metadata_lock_info_fill_row(
MDL_ticket *mdl_ticket,
- void *arg
+ void *arg,
+ bool granted
) {
st_i_s_metadata_param *param = (st_i_s_metadata_param *) arg;
THD *thd = param->thd;
TABLE *table = param->table;
DBUG_ENTER("i_s_metadata_lock_info_fill_row");
MDL_context *mdl_ctx = mdl_ticket->get_ctx();
- enum_mdl_type mdl_ticket_type = mdl_ticket->get_type();
MDL_key *mdl_key = mdl_ticket->get_key();
MDL_key::enum_mdl_namespace mdl_namespace = mdl_key->mdl_namespace();
+ if (!granted)
+ DBUG_RETURN(0);
table->field[0]->store((longlong) mdl_ctx->get_thread_id(), TRUE);
table->field[1]->set_notnull();
- table->field[1]->store(
- metadata_lock_info_lock_mode[(int) mdl_ticket_type].str,
- metadata_lock_info_lock_mode[(int) mdl_ticket_type].length,
- system_charset_info);
+ table->field[1]->store(mdl_ticket->get_type_name(), system_charset_info);
table->field[2]->set_null();
table->field[3]->set_notnull();
table->field[3]->store(
@@ -122,8 +107,6 @@ static int i_s_metadata_lock_info_init(
compile_time_assert(sizeof(metadata_lock_info_lock_name)/sizeof(LEX_STRING)
== MDL_key::NAMESPACE_END);
- compile_time_assert(sizeof(metadata_lock_info_lock_mode)/sizeof(LEX_STRING)
- == MDL_TYPE_END);
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
DBUG_ENTER("i_s_metadata_lock_info_init");
diff --git a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result
index 5803d7d1290..12afd5010cc 100644
--- a/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result
+++ b/plugin/metadata_lock_info/mysql-test/metadata_lock_info/r/global_read_lock.result
@@ -3,8 +3,7 @@ lock_mode lock_duration lock_type table_schema table_name
FLUSH TABLES WITH READ LOCK;
SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info;
lock_mode lock_duration lock_type table_schema table_name
-MDL_SHARED NULL Commit lock
-MDL_SHARED NULL Global read lock
+MDL_BACKUP_FTWRL2 NULL Backup lock
UNLOCK TABLES;
SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info;
lock_mode lock_duration lock_type table_schema table_name
diff --git a/plugin/query_response_time/query_response_time.cc b/plugin/query_response_time/query_response_time.cc
index 5d6119d20ef..a669f7d4236 100644
--- a/plugin/query_response_time/query_response_time.cc
+++ b/plugin/query_response_time/query_response_time.cc
@@ -147,42 +147,36 @@ void print_time(char* buffer, std::size_t buffer_size, const char* format,
class time_collector
{
+ utility *m_utility;
+ Atomic_counter<uint32_t> m_count[OVERALL_POWER_COUNT + 1];
+ Atomic_counter<uint64_t> m_total[OVERALL_POWER_COUNT + 1];
+
public:
- time_collector(utility& u) : m_utility(&u)
- { }
- ~time_collector()
- { }
- uint32 count(uint index)
- {
- return my_atomic_load32((int32*)&m_count[index]);
- }
- uint64 total(uint index)
- {
- return my_atomic_load64((int64*)&m_total[index]);
- }
-public:
+ time_collector(utility& u): m_utility(&u) { flush(); }
+ ~time_collector() { }
+ uint32_t count(uint index) { return m_count[index]; }
+ uint64_t total(uint index) { return m_total[index]; }
void flush()
{
- memset((void*)&m_count,0,sizeof(m_count));
- memset((void*)&m_total,0,sizeof(m_total));
+ for (auto i= 0; i < OVERALL_POWER_COUNT + 1; i++)
+ {
+ m_count[i]= 0;
+ m_total[i]= 0;
+ }
}
- void collect(uint64 time)
+ void collect(uint64_t time)
{
int i= 0;
for(int count= m_utility->bound_count(); count > i; ++i)
{
if(m_utility->bound(i) > time)
{
- my_atomic_add32((int32*)(&m_count[i]), 1);
- my_atomic_add64((int64*)(&m_total[i]), time);
+ m_count[i]++;
+ m_total[i]+= time;
break;
}
}
}
-private:
- utility* m_utility;
- uint32 m_count[OVERALL_POWER_COUNT + 1];
- uint64 m_total[OVERALL_POWER_COUNT + 1];
};
class collector
@@ -191,7 +185,6 @@ public:
collector() : m_time(m_utility)
{
m_utility.setup(DEFAULT_BASE);
- m_time.flush();
}
public:
void flush()
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
index 70682178ca1..1c7a8ad4122 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
@@ -2,23 +2,26 @@
!include include/default_mysqld.cnf
[mysqld]
-wsrep-on=1
binlog-format=row
innodb-autoinc-lock-mode=2
innodb-locks-unsafe-for-binlog=1
-wsrep-cluster-address=gcomm://
wsrep_provider=@ENV.WSREP_PROVIDER
[mysqld.1]
#galera_port=@OPT.port
+#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
+wsrep-cluster-address=gcomm://
wsrep_provider_options='base_port=@mysqld.1.#galera_port'
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
wsrep_node_name=test-node-1
[mysqld.2]
#galera_port=@OPT.port
+#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.2.#galera_port'
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result b/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result
index f33a628d428..f99f27f3539 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/r/plugin.result
@@ -1,8 +1,10 @@
+connection node_2;
+connection node_1;
# On node 1
connection node_1;
SELECT * FROM INFORMATION_SCHEMA.WSREP_STATUS;
-NODE_INDEX NODE_STATUS CLUSTER_STATUS CLUSTER_SIZE CLUSTER_STATE_UUID CLUSTER_STATE_SEQNO CLUSTER_CONF_ID GAP PROTOCOL_VERSION
-<IDX> Synced Primary 2 <CLUSTER_STATE_UUID> 0 <CLUSTER_CONF_ID> NO 3
+NODE_INDEX NODE_STATUS CLUSTER_STATUS CLUSTER_SIZE CLUSTER_STATE_UUID CLUSTER_STATE_SEQNO CLUSTER_CONF_ID PROTOCOL_VERSION
+<IDX> synced primary 2 <CLUSTER_STATE_UUID> 2 <CLUSTER_CONF_ID> 4
SELECT * FROM INFORMATION_SCHEMA.WSREP_MEMBERSHIP ORDER BY NAME;
INDEX UUID NAME ADDRESS
<IDX> <MEMBER_ID> test-node-1 <ADDRESS>
@@ -10,8 +12,8 @@ INDEX UUID NAME ADDRESS
# On node 2
connection node_2;
SELECT * FROM INFORMATION_SCHEMA.WSREP_STATUS;
-NODE_INDEX NODE_STATUS CLUSTER_STATUS CLUSTER_SIZE CLUSTER_STATE_UUID CLUSTER_STATE_SEQNO CLUSTER_CONF_ID GAP PROTOCOL_VERSION
-<IDX> Synced Primary 2 <CLUSTER_STATE_UUID> 0 <CLUSTER_CONF_ID> YES 3
+NODE_INDEX NODE_STATUS CLUSTER_STATUS CLUSTER_SIZE CLUSTER_STATE_UUID CLUSTER_STATE_SEQNO CLUSTER_CONF_ID PROTOCOL_VERSION
+<IDX> synced primary 2 <CLUSTER_STATE_UUID> 2 <CLUSTER_CONF_ID> 4
SELECT * FROM INFORMATION_SCHEMA.WSREP_MEMBERSHIP ORDER BY NAME;
INDEX UUID NAME ADDRESS
<IDX> <MEMBER_ID> test-node-1 <ADDRESS>
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
index 9268cb3e06b..2adc6811f3f 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
@@ -9,9 +9,9 @@ return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib64/galera-3/libgalera_smm.so",
+ "/usr/lib64/galera-4/libgalera_smm.so",
"/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-3/libgalera_smm.so",
+ "/usr/lib/galera-4/libgalera_smm.so",
"/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
diff --git a/plugin/wsrep_info/plugin.cc b/plugin/wsrep_info/plugin.cc
index 428bcc5dcfc..18e41b20c98 100644
--- a/plugin/wsrep_info/plugin.cc
+++ b/plugin/wsrep_info/plugin.cc
@@ -52,37 +52,9 @@
#define COLUMN_WSREP_STATUS_CLUSTER_STATE_SEQNO 5
/* Cluster membership changes */
#define COLUMN_WSREP_STATUS_CLUSTER_CONF_ID 6
-/* Gap between global and local states ? */
-#define COLUMN_WSREP_STATUS_GAP 7
/* Application protocol version */
-#define COLUMN_WSREP_STATUS_PROTO_VERSION 8
+#define COLUMN_WSREP_STATUS_PROTO_VERSION 7
-static const char* get_member_status(wsrep_member_status_t status)
-{
- switch (status)
- {
- case WSREP_MEMBER_UNDEFINED: return "Undefined";
- case WSREP_MEMBER_JOINER: return "Joiner";
- case WSREP_MEMBER_DONOR: return "Donor";
- case WSREP_MEMBER_JOINED: return "Joined";
- case WSREP_MEMBER_SYNCED: return "Synced";
- case WSREP_MEMBER_ERROR: return "Error";
- default: break;
- }
- return "UNKNOWN";
-}
-
-static const char* get_cluster_status(wsrep_view_status_t status)
-{
- switch (status)
- {
- case WSREP_VIEW_PRIMARY: return "Primary";
- case WSREP_VIEW_NON_PRIMARY: return "Non-primary";
- case WSREP_VIEW_DISCONNECTED: return "Disconnected";
- default: break;
- }
- return "UNKNOWN";
-}
static ST_FIELD_INFO wsrep_memb_fields[]=
{
@@ -107,7 +79,6 @@ static ST_FIELD_INFO wsrep_status_fields[]=
0, 0, 0, 0},
{"CLUSTER_CONF_ID", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
0, 0, 0, 0},
- {"GAP", 10, MYSQL_TYPE_STRING, 0, 0, 0, 0},
{"PROTOCOL_VERSION", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG,
0, 0, 0, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
@@ -122,25 +93,26 @@ static int wsrep_memb_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
wsrep_config_state->lock();
- Dynamic_array<wsrep_member_info_t> *memb_arr=
- wsrep_config_state->get_member_info();
+ const wsrep::view& view(wsrep_config_state->get_view_info());
+ const std::vector<wsrep::view::member>& members(view.members());
+
TABLE *table= tables->table;
- for (unsigned int i= 0; i < memb_arr->elements(); i ++)
+ for (unsigned int i= 0; i < members.size(); i++)
{
- wsrep_member_info_t memb= memb_arr->at(i);
-
table->field[COLUMN_WSREP_MEMB_INDEX]->store(i, 0);
- char uuid[40];
- wsrep_uuid_print(&memb.id, uuid, sizeof(uuid));
- table->field[COLUMN_WSREP_MEMB_UUID]->store(uuid, sizeof(uuid),
+ std::ostringstream os;
+ os << members[i].id();
+ table->field[COLUMN_WSREP_MEMB_UUID]->store(os.str().c_str(),
+ os.str().length(),
system_charset_info);
- table->field[COLUMN_WSREP_MEMB_NAME]->store(memb.name, strlen(memb.name),
+ table->field[COLUMN_WSREP_MEMB_NAME]->store(members[i].name().c_str(),
+ members[i].name().length(),
system_charset_info);
- table->field[COLUMN_WSREP_MEMB_ADDRESS]->store(memb.incoming,
- strlen(memb.incoming),
+ table->field[COLUMN_WSREP_MEMB_ADDRESS]->store(members[i].incoming().c_str(),
+ members[i].incoming().length(),
system_charset_info);
if (schema_table_store_record(thd, table))
@@ -177,35 +149,34 @@ static int wsrep_status_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
wsrep_config_state->lock();
- wsrep_view_info_t view= wsrep_config_state->get_view_info();
- wsrep_member_status_t status= wsrep_config_state->get_status();
+ const wsrep::view& view= wsrep_config_state->get_view_info();
+ enum wsrep::server_state::state status= wsrep_config_state->get_status();
TABLE *table= tables->table;
table->field[COLUMN_WSREP_STATUS_NODE_INDEX]
- ->store(view.my_idx, 0);
+ ->store(view.own_index(), 0);
table->field[COLUMN_WSREP_STATUS_NODE_STATUS]
- ->store(get_member_status(status), strlen(get_member_status(status)),
+ ->store(to_c_string(status),
+ strlen(to_c_string(status)),
system_charset_info);
table->field[COLUMN_WSREP_STATUS_CLUSTER_STATUS]
- ->store(get_cluster_status(view.status),
- strlen(get_cluster_status(view.status)),
+ ->store(to_c_string(view.status()),
+ strlen(to_c_string(view.status())),
system_charset_info);
- table->field[COLUMN_WSREP_STATUS_CLUSTER_SIZE]->store(view.memb_num, 0);
+ table->field[COLUMN_WSREP_STATUS_CLUSTER_SIZE]->store(view.members().size(), 0);
- char uuid[40];
- wsrep_uuid_print(&view.state_id.uuid, uuid, sizeof(uuid));
+ std::ostringstream os;
+ os << view.state_id().id();
table->field[COLUMN_WSREP_STATUS_CLUSTER_STATE_UUID]
- ->store(uuid, sizeof(uuid), system_charset_info);
+ ->store(os.str().c_str(), os.str().length(), system_charset_info);
table->field[COLUMN_WSREP_STATUS_CLUSTER_STATE_SEQNO]
- ->store(view.state_id.seqno, 0);
- table->field[COLUMN_WSREP_STATUS_CLUSTER_CONF_ID]->store(view.view, 0);
-
- const char *gap= (view.state_gap == true) ? "YES" : "NO";
- table->field[COLUMN_WSREP_STATUS_GAP]->store(gap, strlen(gap),
- system_charset_info);
- table->field[COLUMN_WSREP_STATUS_PROTO_VERSION]->store(view.proto_ver, 0);
+ ->store(view.state_id().seqno().get(), 0);
+ table->field[COLUMN_WSREP_STATUS_CLUSTER_CONF_ID]
+ ->store(view.view_seqno().get(), 0);
+ table->field[COLUMN_WSREP_STATUS_PROTO_VERSION]
+ ->store(view.protocol_version(), 0);
if (schema_table_store_record(thd, table))
rc= 1;
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 464c00d57da..eca5b7ad3e5 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -31,7 +31,7 @@ ENDIF()
IF(CAT_EXECUTABLE)
SET(CAT_COMMAND COMMAND
${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
- ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql mysql_performance_tables.sql >
+ ${CAT_EXECUTABLE} mysql_system_tables_fix.sql mysql_system_tables.sql mysql_performance_tables.sql >
${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
)
ELSEIF(WIN32)
@@ -39,7 +39,7 @@ ELSEIF(WIN32)
native_outfile )
SET(CAT_COMMAND
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
- cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql + mysql_performance_tables.sql
+ cmd /c copy /b mysql_system_tables_fix.sql + mysql_system_tables.sql + mysql_performance_tables.sql
${native_outfile} )
ELSE()
MESSAGE(FATAL_ERROR "Cannot concatenate files")
@@ -274,8 +274,6 @@ ELSE()
SET(WSREP_SCRIPTS
wsrep_sst_mysqldump
wsrep_sst_rsync
- wsrep_sst_xtrabackup
- wsrep_sst_xtrabackup-v2
wsrep_sst_mariabackup
)
# The following script is sourced from other SST scripts, so it should
diff --git a/scripts/galera_new_cluster.sh b/scripts/galera_new_cluster.sh
index 5a8ca6958a7..e0763ed516a 100755
--- a/scripts/galera_new_cluster.sh
+++ b/scripts/galera_new_cluster.sh
@@ -28,4 +28,4 @@ extcode=$?
systemctl set-environment _WSREP_NEW_CLUSTER=''
-return $extcode
+exit $extcode
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 8a0ade99d69..82a8e175753 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -473,6 +473,13 @@ then
args="$args --user=$user"
fi
+if test -f "$ldata/mysql/user.frm"
+then
+ echo "mysql.user table already exists!"
+ echo "Run mysql_upgrade, not mysql_install_db"
+ exit 0
+fi
+
# When doing a "cross bootstrap" install, no reference to the current
# host should be added to the system tables. So we filter out any
# lines which contain the current host name.
diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
index 57e4d43dfad..1bd21513d4d 100644
--- a/scripts/mysql_secure_installation.sh
+++ b/scripts/mysql_secure_installation.sh
@@ -304,7 +304,7 @@ set_root_password() {
fi
esc_pass=`basic_single_escape "$password1"`
- do_query "UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root';"
+ do_query "UPDATE mysql.global_priv SET priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', PASSWORD('$esc_pass')) WHERE User='root';"
if [ $? -eq 0 ]; then
echo "Password updated successfully!"
echo "Reloading privilege tables.."
@@ -324,7 +324,7 @@ set_root_password() {
}
remove_anonymous_users() {
- do_query "DELETE FROM mysql.user WHERE User='';"
+ do_query "DELETE FROM mysql.global_priv WHERE User='';"
if [ $? -eq 0 ]; then
echo " ... Success!"
else
@@ -336,7 +336,7 @@ remove_anonymous_users() {
}
remove_remote_root() {
- do_query "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
+ do_query "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
if [ $? -eq 0 ]; then
echo " ... Success!"
else
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 0d59862f26f..f788f5d67d5 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -33,7 +33,57 @@ CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db c
-- Remember for later if db table already existed
set @had_db_table= @@warning_count != 0;
-CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_history_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) DEFAULT 0 NOT NULL, plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, authentication_string TEXT NOT NULL, password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, default_role char(80) binary DEFAULT '' NOT NULL, max_statement_time decimal(12,6) DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+CREATE TABLE IF NOT EXISTS global_priv (Host char(60) binary DEFAULT '', User char(80) binary DEFAULT '', Priv JSON NOT NULL DEFAULT '{}' CHECK(JSON_VALID(Priv)), PRIMARY KEY Host (Host,User)) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+
+CREATE DEFINER=root@localhost SQL SECURITY DEFINER VIEW IF NOT EXISTS user AS SELECT
+ Host,
+ User,
+ IF(JSON_VALUE(Priv, '$.plugin') IN ('mysql_native_password', 'mysql_old_password'), IFNULL(JSON_VALUE(Priv, '$.authentication_string'), ''), '') AS Password,
+ IF(JSON_VALUE(Priv, '$.access') & 1, 'Y', 'N') AS Select_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2, 'Y', 'N') AS Insert_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4, 'Y', 'N') AS Update_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8, 'Y', 'N') AS Delete_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16, 'Y', 'N') AS Create_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 32, 'Y', 'N') AS Drop_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 64, 'Y', 'N') AS Reload_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 128, 'Y', 'N') AS Shutdown_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 256, 'Y', 'N') AS Process_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 512, 'Y', 'N') AS File_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 1024, 'Y', 'N') AS Grant_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2048, 'Y', 'N') AS References_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4096, 'Y', 'N') AS Index_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8192, 'Y', 'N') AS Alter_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16384, 'Y', 'N') AS Show_db_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 32768, 'Y', 'N') AS Super_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 65536, 'Y', 'N') AS Create_tmp_table_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 131072, 'Y', 'N') AS Lock_tables_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 262144, 'Y', 'N') AS Execute_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 524288, 'Y', 'N') AS Repl_slave_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 1048576, 'Y', 'N') AS Repl_client_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2097152, 'Y', 'N') AS Create_view_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4194304, 'Y', 'N') AS Show_view_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8388608, 'Y', 'N') AS Create_routine_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16777216, 'Y', 'N') AS Alter_routine_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 33554432, 'Y', 'N') AS Create_user_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 67108864, 'Y', 'N') AS Event_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 134217728, 'Y', 'N') AS Trigger_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 268435456, 'Y', 'N') AS Create_tablespace_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 536870912, 'Y', 'N') AS Delete_history_priv,
+ ELT(IFNULL(JSON_VALUE(Priv, '$.ssl_type'), 0) + 1, '', 'ANY','X509', 'SPECIFIED') AS ssl_type,
+ IFNULL(JSON_VALUE(Priv, '$.ssl_cipher'), '') AS ssl_cipher,
+ IFNULL(JSON_VALUE(Priv, '$.x509_issuer'), '') AS x509_issuer,
+ IFNULL(JSON_VALUE(Priv, '$.x509_subject'), '') AS x509_subject,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_questions'), 0) AS UNSIGNED) AS max_questions,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_updates'), 0) AS UNSIGNED) AS max_updates,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_connections'), 0) AS UNSIGNED) AS max_connections,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_user_connections'), 0) AS SIGNED) AS max_user_connections,
+ IFNULL(JSON_VALUE(Priv, '$.plugin'), '') AS plugin,
+ IFNULL(JSON_VALUE(Priv, '$.authentication_string'), '') AS authentication_string,
+ 'N' AS password_expired,
+ ELT(IFNULL(JSON_VALUE(Priv, '$.is_role'), 0) + 1, 'N', 'Y') AS is_role,
+ IFNULL(JSON_VALUE(Priv, '$.default_role'), '') AS default_role,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_statement_time'), 0.0) AS DECIMAL(12,6)) AS max_statement_time
+ FROM global_priv;
-- Remember for later if user table already existed
set @had_user_table= @@warning_count != 0;
@@ -80,7 +130,7 @@ CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsign
CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Leap seconds information for time zones';
-CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob NOT NULL, body longblob NOT NULL, definer char(141) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH', 'EMPTY_STRING_IS_NULL', 'SIMULTANEOUS_ASSIGNMENT') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, aggregate enum('NONE', 'GROUP') DEFAULT 'NONE' NOT NULL, PRIMARY KEY (db,name,type)) engine=Aria transactional=1 character set utf8 comment='Stored Procedures';
+CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob NOT NULL, body longblob NOT NULL, definer char(141) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH', 'EMPTY_STRING_IS_NULL', 'SIMULTANEOUS_ASSIGNMENT', 'TIME_ROUND_FRACTIONAL') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, aggregate enum('NONE', 'GROUP') DEFAULT 'NONE' NOT NULL, PRIMARY KEY (db,name,type)) engine=Aria transactional=1 character set utf8 comment='Stored Procedures';
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
@@ -101,7 +151,7 @@ PREPARE stmt FROM @str;
EXECUTE stmt;
DROP PREPARE stmt;
-CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) engine=Aria transactional=1 DEFAULT CHARSET=utf8 COMMENT 'Events';
+CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) engine=Aria transactional=1 DEFAULT CHARSET=utf8 COMMENT 'Events';
SET @create_innodb_table_stats="CREATE TABLE IF NOT EXISTS innodb_table_stats (
database_name VARCHAR(64) NOT NULL,
@@ -232,6 +282,13 @@ CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NUL
-- Remember for later if proxies_priv table already existed
set @had_proxies_priv_table= @@warning_count != 0;
+-- The following needs to be done both for new installations
+-- and for upgrades
+CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
+INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
+INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
+DROP TABLE tmp_proxies_priv;
+
--
-- Tables unique for MariaDB
--
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql
index 4761fe51dcc..f14dcf01594 100644
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -25,28 +25,28 @@
-- add escape character in front of wildcard character to convert "_" or "%" to
-- a plain character
SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname;
+SELECT json_object('access',cast(-1 as unsigned)) INTO @all_privileges;
--- Fill "user" table with default users allowing root access
--- from local machine if "user" table didn't exist before
-CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE user;
-CREATE TEMPORARY TABLE tmp_user_socket LIKE user;
+-- Fill "global_priv" table with default users allowing root access
+-- from local machine if "global_priv" table didn't exist before
+CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE global_priv;
+CREATE TEMPORARY TABLE tmp_user_socket LIKE global_priv;
-- Classic passwordless root account.
-INSERT INTO tmp_user_nopasswd VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N', 'N','', 0);
-REPLACE INTO tmp_user_nopasswd SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0 FROM dual WHERE @current_hostname != 'localhost';
-REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0);
-REPLACE INTO tmp_user_nopasswd VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
+INSERT INTO tmp_user_nopasswd VALUES ('localhost','root',@all_privileges);
+REPLACE INTO tmp_user_nopasswd SELECT @current_hostname,'root',@all_privileges FROM dual WHERE @current_hostname != 'localhost';
+REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root',@all_privileges);
+REPLACE INTO tmp_user_nopasswd VALUES ('::1','root',@all_privileges);
-- More secure root account using unix socket auth.
-INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),'','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'unix_socket','','N', 'N','', 0);
+INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),@all_privileges);
IF @auth_root_socket is not null THEN
IF not exists(select 1 from information_schema.plugins where plugin_name='unix_socket') THEN
INSTALL SONAME 'auth_socket'; END IF; END IF;
-INSERT INTO user SELECT * FROM tmp_user_nopasswd WHERE @had_user_table=0 AND @skip_auth_root_nopasswd IS NULL;
-INSERT INTO user SELECT * FROM tmp_user_socket WHERE @had_user_table=0 AND @auth_root_socket IS NOT NULL;
+INSERT INTO global_priv SELECT * FROM tmp_user_nopasswd WHERE @had_user_table=0 AND @skip_auth_root_nopasswd IS NULL;
+INSERT INTO global_priv SELECT * FROM tmp_user_socket WHERE @had_user_table=0 AND @auth_root_socket IS NOT NULL;
DROP TABLE tmp_user_nopasswd, tmp_user_socket;
CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
-INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
-REPLACE INTO tmp_proxies_priv SELECT @current_hostname, 'root', '', '', TRUE, '', now() FROM DUAL WHERE @current_hostname != 'localhost';
+INSERT INTO tmp_proxies_priv SELECT @current_hostname, 'root', '', '', TRUE, '', now() FROM DUAL WHERE @current_hostname != 'localhost';
INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
DROP TABLE tmp_proxies_priv;
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index fd68367b42a..82ec2faa12d 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -28,6 +28,8 @@ set sql_mode='';
set storage_engine=Aria;
set enforce_storage_engine=NULL;
+set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');
+
ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
# Detect whether or not we had the Grant_priv column
@@ -417,7 +419,8 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
'NO_ENGINE_SUBSTITUTION',
'PAD_CHAR_TO_FULL_LENGTH',
'EMPTY_STRING_IS_NULL',
- 'SIMULTANEOUS_ASSIGNMENT'
+ 'SIMULTANEOUS_ASSIGNMENT',
+ 'TIME_ROUND_FRACTIONAL'
) DEFAULT '' NOT NULL,
DEFAULT CHARACTER SET utf8;
@@ -553,7 +556,8 @@ ALTER TABLE event MODIFY sql_mode
'NO_ENGINE_SUBSTITUTION',
'PAD_CHAR_TO_FULL_LENGTH',
'EMPTY_STRING_IS_NULL',
- 'SIMULTANEOUS_ASSIGNMENT'
+ 'SIMULTANEOUS_ASSIGNMENT',
+ 'TIME_ROUND_FRACTIONAL'
) DEFAULT '' NOT NULL AFTER on_completion;
ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default '';
@@ -647,30 +651,18 @@ ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL;
ALTER TABLE user MODIFY password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE user MODIFY is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
--- Need to pre-fill mysql.proxies_priv with access for root even when upgrading from
--- older versions
-
-CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
-INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
-INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
-DROP TABLE tmp_proxies_priv;
-
-- Checking for any duplicate hostname and username combination are exists.
-- If exits we will throw error.
-DROP PROCEDURE IF EXISTS mysql.count_duplicate_host_names;
DELIMITER //
-CREATE PROCEDURE mysql.count_duplicate_host_names()
-BEGIN
+BEGIN NOT ATOMIC
SET @duplicate_hosts=(SELECT count(*) FROM mysql.user GROUP BY user, lower(host) HAVING count(*) > 1 LIMIT 1);
IF @duplicate_hosts > 1 THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Multiple accounts exist for @user_name, @host_name that differ only in Host lettercase; remove all except one of them';
END IF;
END //
DELIMITER ;
-CALL mysql.count_duplicate_host_names();
-- Get warnings (if any)
SHOW WARNINGS;
-DROP PROCEDURE mysql.count_duplicate_host_names;
# Convering the host name to lower case for existing users
UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host;
@@ -758,7 +750,7 @@ ALTER TABLE proc ENGINE=Aria transactional=1;
ALTER TABLE event ENGINE=Aria transactional=1;
ALTER TABLE proxies_priv ENGINE=Aria transactional=1;
--- The folloing tables doesn't have to be transactional
+-- The following tables doesn't have to be transactional
ALTER TABLE help_topic ENGINE=Aria transactional=0;
ALTER TABLE help_category ENGINE=Aria transactional=0;
ALTER TABLE help_relation ENGINE=Aria transactional=0;
@@ -766,3 +758,55 @@ ALTER TABLE help_keyword ENGINE=Aria transactional=0;
ALTER TABLE table_stats ENGINE=Aria transactional=0;
ALTER TABLE column_stats ENGINE=Aria transactional=0;
ALTER TABLE index_stats ENGINE=Aria transactional=0;
+
+DELIMITER //
+IF 'BASE TABLE' = (select table_type from information_schema.tables where table_name='user') THEN
+ CREATE TABLE IF NOT EXISTS global_priv (Host char(60) binary DEFAULT '', User char(80) binary DEFAULT '', Priv JSON NOT NULL DEFAULT '{}' CHECK(JSON_VALID(Priv)), PRIMARY KEY Host (Host,User)) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'
+ SELECT Host, User, JSON_COMPACT(JSON_OBJECT('access',
+ 1*('Y'=Select_priv)+
+ 2*('Y'=Insert_priv)+
+ 4*('Y'=Update_priv)+
+ 8*('Y'=Delete_priv)+
+ 16*('Y'=Create_priv)+
+ 32*('Y'=Drop_priv)+
+ 64*('Y'=Reload_priv)+
+ 128*('Y'=Shutdown_priv)+
+ 256*('Y'=Process_priv)+
+ 512*('Y'=File_priv)+
+ 1024*('Y'=Grant_priv)+
+ 2048*('Y'=References_priv)+
+ 4096*('Y'=Index_priv)+
+ 8192*('Y'=Alter_priv)+
+ 16384*('Y'=Show_db_priv)+
+ 32768*('Y'=Super_priv)+
+ 65536*('Y'=Create_tmp_table_priv)+
+ 131072*('Y'=Lock_tables_priv)+
+ 262144*('Y'=Execute_priv)+
+ 524288*('Y'=Repl_slave_priv)+
+ 1048576*('Y'=Repl_client_priv)+
+ 2097152*('Y'=Create_view_priv)+
+ 4194304*('Y'=Show_view_priv)+
+ 8388608*('Y'=Create_routine_priv)+
+ 16777216*('Y'=Alter_routine_priv)+
+ 33554432*('Y'=Create_user_priv)+
+ 67108864*('Y'=Event_priv)+
+ 134217728*('Y'=Trigger_priv)+
+ 268435456*('Y'=Create_tablespace_priv)+
+ 536870912*('Y'=Delete_history_priv),
+ 'ssl_type', ssl_type-1,
+ 'ssl_cipher', ssl_cipher,
+ 'x509_issuer', x509_issuer,
+ 'x509_subject', x509_subject,
+ 'max_questions', max_questions,
+ 'max_updates', max_updates,
+ 'max_connections', max_connections,
+ 'max_user_connections', max_user_connections,
+ 'max_statement_time', max_statement_time,
+ 'plugin', if(plugin>'',plugin,if(length(password)=16,'mysql_old_password','mysql_native_password')),
+ 'authentication_string', if(plugin>'',authentication_string,password),
+ 'default_role', default_role,
+ 'is_role', 'Y'=is_role)) as Priv
+ FROM user;
+ DROP TABLE user;
+END IF//
+DELIMITER ;
diff --git a/scripts/mysql_test_db.sql b/scripts/mysql_test_db.sql
index c1bb3661ec3..9f8a0cf604c 100644
--- a/scripts/mysql_test_db.sql
+++ b/scripts/mysql_test_db.sql
@@ -24,8 +24,8 @@ INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
DROP TABLE tmp_db;
-- Anonymous user with no privileges.
-CREATE TEMPORARY TABLE tmp_user_anonymous LIKE user;
+CREATE TEMPORARY TABLE tmp_user_anonymous LIKE global_priv;
INSERT INTO tmp_user_anonymous (host,user) VALUES ('localhost','');
INSERT INTO tmp_user_anonymous (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
-INSERT INTO user SELECT * FROM tmp_user_anonymous WHERE @had_user_table=0;
+INSERT INTO global_priv SELECT * FROM tmp_user_anonymous WHERE @had_user_table=0;
DROP TABLE tmp_user_anonymous;
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 5797bdc68d7..5f09ac3c235 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -265,7 +265,16 @@ wsrep_recover_position() {
wsrep_start_position_opt="--wsrep_start_position=$start_pos"
fi
- [ $ret -eq 0 ] && rm $wr_logfile
+ if [ $ret -eq 0 ] ; then
+ local wr_logfile_permanent="$DATADIR/wsrep_recovery.ok"
+ else
+ local wr_logfile_permanent="$DATADIR/wsrep_recovery.fail"
+ fi
+ touch $wr_logfile_permanent
+ [ "$euid" = "0" ] && chown $user $wr_logfile_permanent
+ chmod 600 $wr_logfile_permanent
+ cat "$wr_logfile" >> $wr_logfile_permanent
+ rm -f "$wr_logfile"
return $ret
}
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index 17a87e9efd2..3ef0a59f27f 100644
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -437,7 +437,7 @@ while (1)
if ($key eq 'C')
{
- if ( $HAS_COLOR )
+ if ( $HAS_COLOR )
{
$HAS_COLOR = 0;
}
@@ -817,11 +817,11 @@ sub GetData()
if ($config{header})
{
my @recs = "";
- if ( $db_release > 4 )
+ if ( $db_release > 4 )
{
@recs = Hashes("show global status");
- }
- else
+ }
+ else
{
@recs = Hashes("show status");
}
@@ -978,7 +978,7 @@ sub GetData()
# print("q_diff: $STATUS{Questions} - $OLD_STATUS{Questions} / $t_delta = $q_diff\n");
printf(" Sorts: %5.0f qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f\n",
- ( $STATUS{Sort_rows} - $OLD_STATUS{Sort_rows} ) / $t_delta,
+ ( $STATUS{Sort_rows} - $OLD_STATUS{Sort_rows} ) / $t_delta,
( $STATUS{Questions} - $OLD_STATUS{Questions} ) / $t_delta,
( # slow now (qps)
($STATUS{Slow_queries} ) ?
@@ -989,7 +989,7 @@ sub GetData()
$STATUS{Threads_running},
$STATUS{Threads_cached},
- (100 * ($STATUS{Com_select} - $OLD_STATUS{Com_select} +
+ (100 * ($STATUS{Com_select} - $OLD_STATUS{Com_select} +
($STATUS{Qcache_hits}||0) - ($OLD_STATUS{Qcache_hits}||0)
) ) / ($q_diff ),
(100 * ($STATUS{Com_insert} - $OLD_STATUS{Com_insert} +
@@ -1075,7 +1075,7 @@ sub GetData()
$t_delta,
($STATUS{Rows_tmp_read} - $OLD_STATUS{Rows_tmp_read}) /
$t_delta,
- ($STATUS{Handler_tmp_write}
+ ($STATUS{Handler_tmp_write}
-$OLD_STATUS{Handler_tmp_write})/$t_delta,
($STATUS{Handler_tmp_update} -
$OLD_STATUS{Handler_tmp_update})/$t_delta);
@@ -1119,6 +1119,7 @@ sub GetData()
}
}
print " Replication ";
+ print "Master:$data->{Master_Host} ";
print "IO:$data->{Slave_IO_Running} ";
print "SQL:$data->{Slave_SQL_Running} ";
print RESET() if ($HAS_COLOR);
@@ -1225,9 +1226,9 @@ sub GetData()
$thread->{State} ||= "";
$thread->{Progress} ||= 0;
- ## alter double hyphen comments so they don't break
+ ## alter double hyphen comments so they don't break
## the query when newlines are removed - http://freshmeat.net/users/jerjones
- $thread->{Info} =~ s~\s--(.*)$~ /* $1 */ ~mg;
+ $thread->{Info} =~ s~\s--(.*)$~ /* $1 */ ~mg;
## Normalize spaces -- mostly disabled for now. This can
## break EXPLAIN if you try to explain a mangled query. It
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index 5683b166163..3e82d379a6d 100755
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -44,13 +44,15 @@ case "$1" in
addr_no_bracket=${WSREP_SST_OPT_ADDR#\[}
readonly WSREP_SST_OPT_HOST_UNESCAPED=${addr_no_bracket%%\]*}
readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]"
+ readonly WSREP_SST_OPT_HOST_ESCAPED="\\[${WSREP_SST_OPT_HOST_UNESCAPED}\\]"
;;
*)
readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*}
readonly WSREP_SST_OPT_HOST_UNESCAPED=$WSREP_SST_OPT_HOST
+ readonly WSREP_SST_OPT_HOST_ESCAPED=$WSREP_SST_OPT_HOST
;;
esac
- remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST}}
+ remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST_ESCAPED}}
remain=${remain#:}
readonly WSREP_SST_OPT_ADDR_PORT=${remain%%/*}
remain=${remain#*/}
@@ -274,7 +276,7 @@ wsrep_check_programs()
}
#
-# user can specify xtrabackup specific settings that will be used during sst
+# user can specify mariabackup specific settings that will be used during sst
# process like encryption, etc.....
# parse such configuration option. (group for xb settings is [sst] in my.cnf
#
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 8173db26291..5362389a59d 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -22,6 +22,7 @@
. $(dirname $0)/wsrep_sst_common
+OS=$(uname)
ealgo=""
ekey=""
ekeyfile=""
@@ -82,7 +83,7 @@ fi
pcmd="pv $pvopts"
declare -a RC
-INNOBACKUPEX_BIN=mariabackup
+INNOBACKUPEX_BIN=$(which mariabackup)
XBSTREAM_BIN=mbstream
XBCRYPT_BIN=xbcrypt # Not available in MariaBackup
@@ -90,6 +91,9 @@ DATA="${WSREP_SST_OPT_DATA}"
INFO_FILE="xtrabackup_galera_info"
IST_FILE="xtrabackup_ist"
MAGIC_FILE="${DATA}/${INFO_FILE}"
+INNOAPPLYLOG="${DATA}/mariabackup.prepare.log"
+INNOMOVELOG="${DATA}/mariabackup.move.log"
+INNOBACKUPLOG="${DATA}/mariabackup.backup.log"
# Setting the path for ss and ip
export PATH="/usr/sbin:/sbin:$PATH"
@@ -327,6 +331,7 @@ read_cnf()
rebuild=$(parse_cnf sst rebuild 0)
ttime=$(parse_cnf sst time 0)
cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
+ [[ $OS == "FreeBSD" ]] && cpat=$(parse_cnf sst cpat '.*galera\.cache$|.*sst_in_progress$|.*\.sst$|.*gvwstate\.dat$|.*grastate\.dat$|.*\.err$|.*\.log$|.*RPM_UPGRADE_MARKER$|.*RPM_UPGRADE_HISTORY$')
ealgo=$(parse_cnf xtrabackup encrypt "")
ekey=$(parse_cnf xtrabackup encrypt-key "")
ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "")
@@ -350,6 +355,8 @@ read_cnf()
ssyslog=$(parse_cnf sst sst-syslog 0)
ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}")
ssystag+="-"
+ sstlogarchive=$(parse_cnf sst sst-log-archive 1)
+ sstlogarchivedir=$(parse_cnf sst sst-log-archive-dir "/tmp/sst_log_archive")
if [[ $speciald -eq 0 ]];then
wsrep_log_error "sst-special-dirs equal to 0 is not supported, falling back to 1"
@@ -509,12 +516,24 @@ kill_xtrabackup()
setup_ports()
{
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then
- SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }')
- REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }')
- lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }')
- sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }')
+ if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then
+ remain=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\][:/]' '{ print $2 }')
+ REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\]:' '{ print $1 }')"]"
+ SST_PORT=$(echo $remain | awk -F '[:/]' '{ print $1 }')
+ lsn=$(echo $remain | awk -F '[:/]' '{ print $3 }')
+ sst_ver=$(echo $remain | awk -F '[:/]' '{ print $4 }')
+ else
+ SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }')
+ REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }')
+ lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }')
+ sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }')
+ fi
else
- SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }')
+ if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then
+ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $2 }')
+ else
+ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }')
+ fi
fi
}
@@ -527,7 +546,11 @@ wait_for_listen()
local MODULE=$3
for i in {1..50}
do
- ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
+ if [ "$OS" = "FreeBSD" ];then
+ sockstat -46lp $PORT | grep -qE "^[^ ]* *(socat|nc) *[^ ]* *[^ ]* *[^ ]* *[^ ]*:$PORT" && break
+ else
+ ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
+ fi
sleep 0.2
done
echo "ready ${ADDR}/${MODULE}//$sst_ver"
@@ -639,13 +662,12 @@ monitor_process()
while true ; do
- if ! ps --pid "${WSREP_SST_OPT_PARENT}" &>/dev/null; then
+ if ! ps -p "${WSREP_SST_OPT_PARENT}" &>/dev/null; then
wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
- kill -- -"${WSREP_SST_OPT_PARENT}"
exit 32
fi
- if ! ps --pid "${sst_stream_pid}" &>/dev/null; then
+ if ! ps -p "${sst_stream_pid}" &>/dev/null; then
break
fi
@@ -678,6 +700,30 @@ fi
INNOEXTRA=""
+INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
+# Try to set INNODB_DATA_HOME_DIR from the command line:
+if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
+ INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG
+fi
+# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf
+if [ -z "$INNODB_DATA_HOME_DIR" ]; then
+ INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
+fi
+if [ -z "$INNODB_DATA_HOME_DIR" ]; then
+ INNODB_DATA_HOME_DIR=$(parse_cnf --mysqld innodb-data-home-dir "")
+fi
+if [ ! -z "$INNODB_DATA_HOME_DIR" ]; then
+ INNOEXTRA+=" --innodb-data-home-dir=$INNODB_DATA_HOME_DIR"
+fi
+
+if [ -n "$INNODB_DATA_HOME_DIR" ]; then
+ # handle both relative and absolute paths
+ INNODB_DATA_HOME_DIR=$(cd $DATA; mkdir -p "$INNODB_DATA_HOME_DIR"; cd $INNODB_DATA_HOME_DIR; pwd -P)
+else
+ # default to datadir
+ INNODB_DATA_HOME_DIR=$(cd $DATA; pwd -P)
+fi
+
if [[ $ssyslog -eq 1 ]];then
if ! command -v logger >/dev/null;then
@@ -698,15 +744,73 @@ if [[ $ssyslog -eq 1 ]];then
logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
}
- INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
+ INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
fi
-else
- INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
- INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log"
- INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
+else
+
+if [[ "$sstlogarchive" -eq 1 ]]
+then
+ ARCHIVETIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S")
+ newfile=""
+
+ if [[ ! -z "$sstlogarchivedir" ]]
+ then
+ if [[ ! -d "$sstlogarchivedir" ]]
+ then
+ mkdir -p "$sstlogarchivedir"
+ fi
+ fi
+
+ if [ -e "${INNOAPPLYLOG}" ]
+ then
+ if [[ ! -z "$sstlogarchivedir" ]]
+ then
+ newfile=$sstlogarchivedir/$(basename "${INNOAPPLYLOG}").${ARCHIVETIMESTAMP}
+ else
+ newfile=${INNOAPPLYLOG}.${ARCHIVETIMESTAMP}
+ fi
+
+ wsrep_log_info "Moving ${INNOAPPLYLOG} to ${newfile}"
+ mv "${INNOAPPLYLOG}" "${newfile}"
+ gzip "${newfile}"
+ fi
+
+ if [ -e "${INNOMOVELOG}" ]
+ then
+ if [[ ! -z "$sstlogarchivedir" ]]
+ then
+ newfile=$sstlogarchivedir/$(basename "${INNOMOVELOG}").${ARCHIVETIMESTAMP}
+ else
+ newfile=${INNOMOVELOG}.${ARCHIVETIMESTAMP}
+ fi
+
+ wsrep_log_info "Moving ${INNOMOVELOG} to ${newfile}"
+ mv "${INNOMOVELOG}" "${newfile}"
+ gzip "${newfile}"
+ fi
+
+ if [ -e "${INNOBACKUPLOG}" ]
+ then
+ if [[ ! -z "$sstlogarchivedir" ]]
+ then
+ newfile=$sstlogarchivedir/$(basename "${INNOBACKUPLOG}").${ARCHIVETIMESTAMP}
+ else
+ newfile=${INNOBACKUPLOG}.${ARCHIVETIMESTAMP}
+ fi
+
+ wsrep_log_info "Moving ${INNOBACKUPLOG} to ${newfile}"
+ mv "${INNOBACKUPLOG}" "${newfile}"
+ gzip "${newfile}"
+ fi
+
+fi
+
+ INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} &> ${INNOAPPLYLOG}"
+ INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &> ${INNOMOVELOG}"
+ INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> ${INNOBACKUPLOG}"
fi
get_stream
@@ -803,7 +907,7 @@ then
if [ ${RC[0]} -ne 0 ]; then
wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \
- "Check ${DATA}/innobackup.backup.log"
+ "Check syslog or ${INNOBACKUPLOG} for details"
exit 22
elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
wsrep_log_error "$tcmd finished with error: ${RC[1]}"
@@ -847,7 +951,7 @@ then
[[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
[[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE
- ib_home_dir=$(parse_cnf mysqld innodb-data-home-dir "")
+ ib_home_dir=$INNODB_DATA_HOME_DIR
ib_log_dir=$(parse_cnf mysqld innodb-log-group-home-dir "")
ib_undo_dir=$(parse_cnf mysqld innodb-undo-directory "")
@@ -868,7 +972,11 @@ then
if [ -z "${SST_PORT}" ]
then
SST_PORT=4444
- ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}"
+ if [[ ${ADDR:0:1} == '[' ]];then
+ ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $1 }')]:${SST_PORT}"
+ else
+ ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}"
+ fi
fi
wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} &
@@ -917,7 +1025,11 @@ then
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
- find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+
+ if [ "${OS}" = "FreeBSD" ]; then
+ find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
+ else
+ find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
+ fi
tempdir=$(parse_cnf mysqld log-bin "")
if [[ -n ${tempdir:-} ]];then
@@ -1024,13 +1136,12 @@ then
if [ $? -ne 0 ];
then
- wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check ${DATA}/innobackup.prepare.log"
+ wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check syslog or ${INNOAPPLYLOG} for details"
exit 22
fi
MAGIC_FILE="${TDATA}/${INFO_FILE}"
set +e
- rm $TDATA/innobackup.prepare.log $TDATA/innobackup.move.log
set -e
wsrep_log_info "Moving the backup to ${TDATA}"
timeit "Xtrabackup move stage" "$INNOMOVE"
@@ -1040,7 +1151,7 @@ then
DATA=${TDATA}
else
wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis"
- wsrep_log_error "Check ${DATA}/innobackup.move.log for details"
+ wsrep_log_error "Check syslog or ${INNOMOVELOG} for details"
exit 22
fi
diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh
index faa3f10639b..d36deb5759f 100644
--- a/scripts/wsrep_sst_mysqldump.sh
+++ b/scripts/wsrep_sst_mysqldump.sh
@@ -25,6 +25,7 @@ EINVAL=22
local_ip()
{
[ "$1" = "127.0.0.1" ] && return 0
+ [ "$1" = "127.0.0.2" ] && return 0
[ "$1" = "localhost" ] && return 0
[ "$1" = "[::1]" ] && return 0
[ "$1" = "$(hostname -s)" ] && return 0
@@ -138,8 +139,8 @@ then
# turned off for the session so that gtid state does not get altered while
# the dump gets replayed on joiner.
if [[ "$LOG_BIN" == 'ON' ]]; then
- RESET_MASTER="RESET MASTER;"
- SET_GTID_BINLOG_STATE="SET @@global.gtid_binlog_state='$GTID_BINLOG_STATE';"
+ RESET_MASTER="SET GLOBAL wsrep_on=OFF; RESET MASTER; SET GLOBAL wsrep_on=ON;"
+ SET_GTID_BINLOG_STATE="SET GLOBAL wsrep_on=OFF; SET @@global.gtid_binlog_state='$GTID_BINLOG_STATE'; SET GLOBAL wsrep_on=ON;"
SQL_LOG_BIN_OFF="SET @@session.sql_log_bin=OFF;"
fi
fi
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 6417ee7f704..1fecb6f09d9 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -ue
+#!/bin/bash -ue
# Copyright (C) 2010-2014 Codership Oy
#
@@ -88,7 +88,7 @@ check_pid_and_port()
local is_listening_all="$(echo $port_info | \
grep "*:$rsync_port" 2>/dev/null)"
local is_listening_addr="$(echo $port_info | \
- grep "$rsync_addr:$rsync_port" 2>/dev/null)"
+ grep -F "$rsync_addr:$rsync_port" 2>/dev/null)"
if [ ! -z "$is_listening_all" -o ! -z "$is_listening_addr" ]; then
if [ -z "$is_rsync" ]; then
@@ -119,7 +119,7 @@ is_local_ip()
address="$address "
fi
- $get_addr_bin | grep "$address" > /dev/null
+ $get_addr_bin | grep -F "$address" > /dev/null
}
STUNNEL_CONF="$WSREP_SST_OPT_DATA/stunnel.conf"
@@ -269,8 +269,9 @@ EOF
cd $BINLOG_DIRNAME
if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
- binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index)
then
+ binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index)
+ else
cd $BINLOG_INDEX_DIRNAME
binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_INDEX_FILENAME}.index)
fi
@@ -398,12 +399,17 @@ then
rm -rf "$RSYNC_PID"
ADDR=$WSREP_SST_OPT_ADDR
- RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }')
- RSYNC_ADDR=$(echo $ADDR | awk -F ':' '{ print $1 }')
+ if [[ ${ADDR:0:1} == '[' ]]; then
+ RSYNC_PORT=$(echo $ADDR | awk -F '\\]:' '{ print $2 }')
+ RSYNC_ADDR=$(echo $ADDR | awk -F '\\]:' '{ print $1 }')"]"
+ else
+ RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }')
+ RSYNC_ADDR=$(echo $ADDR | awk -F ':' '{ print $1 }')
+ fi
if [ -z "$RSYNC_PORT" ]
then
RSYNC_PORT=4444
- ADDR="$(echo $ADDR | awk -F ':' '{ print $1 }'):$RSYNC_PORT"
+ ADDR="$RSYNC_ADDR:$RSYNC_PORT"
fi
trap "exit 32" HUP PIPE
@@ -508,9 +514,10 @@ EOF
for ii in $(ls -1 ${BINLOG_FILENAME}.*)
do
if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
- echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
- then
- echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_INDEX_DIRNAME}/${BINLOG_INDEX_FILENAME}.index
+ then
+ echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
+ else
+ echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_INDEX_DIRNAME}/${BINLOG_INDEX_FILENAME}.index
fi
done
fi
diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh
deleted file mode 100644
index 2de384806b2..00000000000
--- a/scripts/wsrep_sst_xtrabackup-v2.sh
+++ /dev/null
@@ -1,1260 +0,0 @@
-#!/bin/bash -ue
-# Copyright (C) 2013 Percona Inc
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
-# MA 02110-1301 USA.
-
-# Documentation: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
-# Make sure to read that before proceeding!
-
-
-
-
-. $(dirname $0)/wsrep_sst_common
-
-ealgo=""
-ekey=""
-ekeyfile=""
-encrypt=0
-nproc=1
-ecode=0
-ssyslog=""
-ssystag=""
-XTRABACKUP_PID=""
-tca=""
-tcert=""
-tkey=""
-sockopt=""
-progress=""
-ttime=0
-totime=0
-ecmd=""
-rlimit=""
-# Initially
-stagemsg="${WSREP_SST_OPT_ROLE}"
-cpat=""
-ib_home_dir=""
-ib_log_dir=""
-ib_undo_dir=""
-
-sfmt="tar"
-strmcmd=""
-tfmt=""
-tcmd=""
-rebuild=0
-rebuildcmd=""
-payload=0
-pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' "
-pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE "
-STATDIR=""
-uextra=0
-disver=""
-
-tmpopts=""
-itmpdir=""
-xtmpdir=""
-
-scomp=""
-sdecomp=""
-ssl_dhparams=""
-
-ssl_cert=""
-ssl_ca=""
-ssl_key=""
-
-if pv --help 2>/dev/null | grep -q FORMAT;then
- pvopts+=$pvformat
-fi
-pcmd="pv $pvopts"
-declare -a RC
-
-INNOBACKUPEX_BIN=innobackupex
-DATA="${WSREP_SST_OPT_DATA}"
-INFO_FILE="xtrabackup_galera_info"
-IST_FILE="xtrabackup_ist"
-MAGIC_FILE="${DATA}/${INFO_FILE}"
-
-# Setting the path for ss and ip
-export PATH="/usr/sbin:/sbin:$PATH"
-
-OS=$(uname)
-
-if ! which lsof > /dev/null; then
- wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed."
- exit 2 # ENOENT
-fi
-
-timeit(){
- local stage=$1
- shift
- local cmd="$@"
- local x1 x2 took extcode
-
- if [[ $ttime -eq 1 ]];then
- x1=$(date +%s)
- wsrep_log_info "Evaluating $cmd"
- eval "$cmd"
- extcode=$?
- x2=$(date +%s)
- took=$(( x2-x1 ))
- wsrep_log_info "NOTE: $stage took $took seconds"
- totime=$(( totime+took ))
- else
- wsrep_log_info "Evaluating $cmd"
- eval "$cmd"
- extcode=$?
- fi
- return $extcode
-}
-
-get_keys()
-{
- # $encrypt -eq 1 is for internal purposes only
- if [[ $encrypt -ge 2 || $encrypt -eq -1 ]];then
- return
- fi
-
- if [[ $encrypt -eq 0 ]];then
- if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then
- wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html "
- fi
- return
- fi
-
- if [[ $sfmt == 'tar' ]];then
- wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format"
- encrypt=-1
- return
- fi
-
- wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4"
-
- if [[ -z $ealgo ]];then
- wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out"
- exit 3
- fi
-
- if [[ -z $ekey && ! -r $ekeyfile ]];then
- wsrep_log_error "FATAL: Either key or keyfile must be readable"
- exit 3
- fi
-
- if [[ -z $ekey ]];then
- ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile"
- else
- wsrep_log_warning "Using the 'encrypt-key' option causes the encryption key"
- wsrep_log_warning "to be set via the command-line and is considered insecure."
- wsrep_log_warning "It is recommended to use the 'encrypt-key-file' option instead."
-
- ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey"
- fi
-
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- ecmd+=" -d"
- fi
-
- stagemsg+="-XB-Encrypted"
-}
-
-#
-# If the ssl_dhparams variable is already set, uses that as a source
-# of dh parameters for OpenSSL. Otherwise, looks for dhparams.pem in the
-# datadir, and creates it there if it can't find the file.
-# No input parameters
-#
-check_for_dhparams()
-{
- if [[ -z "$ssl_dhparams" ]]; then
- if ! [[ -r "$DATA/dhparams.pem" ]]; then
- wsrep_check_programs openssl
- wsrep_log_info "Could not find dhparams file, creating $DATA/dhparams.pem"
-
- if ! openssl dhparam -out "$DATA/dhparams.pem" 2048 >/dev/null 2>&1
- then
- wsrep_log_error "******** FATAL ERROR ********************************* "
- wsrep_log_error "* Could not create the dhparams.pem file with OpenSSL. "
- wsrep_log_error "****************************************************** "
- exit 22
- fi
- fi
- ssl_dhparams="$DATA/dhparams.pem"
- fi
-}
-
-#
-# verifies that the certificate matches the private key
-# doing this will save us having to wait for a timeout that would
-# otherwise occur.
-#
-# 1st param: path to the cert
-# 2nd param: path to the private key
-#
-verify_cert_matches_key()
-{
- local cert_path=$1
- local key_path=$2
-
- wsrep_check_programs openssl diff
-
- # generate the public key from the cert and the key
- # they should match (otherwise we can't create an SSL connection)
- if ! diff <(openssl x509 -in "$cert_path" -pubkey -noout) <(openssl rsa -in "$key_path" -pubout 2>/dev/null) >/dev/null 2>&1
- then
- wsrep_log_error "******** FATAL ERROR ************************* "
- wsrep_log_error "* The certifcate and private key do not match. "
- wsrep_log_error "* Please check your certificate and key files. "
- wsrep_log_error "********************************************** "
- exit 22
- fi
-}
-
-# Checks to see if the file exists
-# If the file does not exist (or cannot be read), issues an error
-# and exits
-#
-# 1st param: file name to be checked (for read access)
-# 2nd param: 1st error message (header)
-# 3rd param: 2nd error message (footer, optional)
-#
-verify_file_exists()
-{
- local file_path=$1
- local error_message1=$2
- local error_message2=$3
-
- if ! [[ -r "$file_path" ]]; then
- wsrep_log_error "******** FATAL ERROR ************************* "
- wsrep_log_error "* $error_message1 "
- wsrep_log_error "* Could not find/access : $file_path "
-
- if ! [[ -z "$error_message2" ]]; then
- wsrep_log_error "* $error_message2 "
- fi
-
- wsrep_log_error "********************************************** "
- exit 22
- fi
-}
-
-get_transfer()
-{
- TSST_PORT=${WSREP_SST_OPT_PORT:-4444}
-
- if [[ $tfmt == 'nc' ]];then
- wsrep_check_programs nc
-
- if [[ $encrypt -eq 2 || $encrypt -eq 3 || $encrypt -eq 4 ]]; then
- wsrep_log_error "******** FATAL ERROR *********************** "
- wsrep_log_error "* Using SSL encryption (encrypt= 2, 3, or 4) "
- wsrep_log_error "* is not supported when using nc(netcat). "
- wsrep_log_error "******************************************** "
- exit 22
- fi
-
- wsrep_log_info "Using netcat as streamer"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- if nc -h 2>&1 | grep -q ncat; then
- # Ncat
- tcmd="nc $sockopt -l ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
- # Debian netcat
- tcmd="nc $sockopt -dl ${TSST_PORT}"
- else
- # traditional netcat
- tcmd="nc $sockopt -l -p ${TSST_PORT}"
- fi
- else
- if nc -h 2>&1 | grep -q ncat;then
- # Ncat
- tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
- # Debian netcat
- tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
- else
- # traditional netcat
- tcmd="nc -q0 ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
- fi
- fi
- else
- tfmt='socat'
- wsrep_log_info "Using socat as streamer"
- wsrep_check_programs socat
-
- donor_extra=""
- joiner_extra=""
- if [[ $encrypt -eq 2 || $encrypt -eq 3 || $encrypt -eq 4 ]]; then
- if ! socat -V | grep -q WITH_OPENSSL; then
- wsrep_log_error "******** FATAL ERROR ****************** "
- wsrep_log_error "* socat is not openssl enabled. "
- wsrep_log_error "* Unable to encrypt SST communications. "
- wsrep_log_error "*************************************** "
- exit 2
- fi
-
- # Determine the socat version
- SOCAT_VERSION=`socat -V 2>&1 | grep -oe '[0-9]\.[0-9][\.0-9]*' | head -n1`
- if [[ -z "$SOCAT_VERSION" ]]; then
- wsrep_log_error "******** FATAL ERROR **************** "
- wsrep_log_error "* Cannot determine the socat version. "
- wsrep_log_error "************************************* "
- exit 2
- fi
-
- # socat versions < 1.7.3 will have 512-bit dhparams (too small)
- # so create 2048-bit dhparams and send that as a parameter
- # socat version >= 1.7.3, checks to see if the peername matches the hostname
- # set commonname="" to disable the peername checks
- #
- if ! check_for_version "$SOCAT_VERSION" "1.7.3"; then
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then
- # dhparams check (will create ssl_dhparams if needed)
- check_for_dhparams
- joiner_extra=",dhparam=$ssl_dhparams"
- fi
- fi
- if check_for_version "$SOCAT_VERSION" "1.7.3"; then
- donor_extra=',commonname=""'
- fi
- fi
-
- if [[ $encrypt -eq 2 ]]; then
- wsrep_log_warning "**** WARNING **** encrypt=2 is deprecated and will be removed in a future release"
- wsrep_log_info "Using openssl based encryption with socat: with crt and ca"
-
- verify_file_exists "$tcert" "Both certificate and CA files are required." \
- "Please check the 'tcert' option. "
- verify_file_exists "$tca" "Both certificate and CA files are required." \
- "Please check the 'tca' option. "
-
- stagemsg+="-OpenSSL-Encrypted-2"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- wsrep_log_info "Decrypting with CERT: $tcert, CA: $tca"
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},cafile=${tca}${joiner_extra}${sockopt} stdio"
- else
- wsrep_log_info "Encrypting with CERT: $tcert, CA: $tca"
- tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},cafile=${tca}${donor_extra}${sockopt}"
- fi
- elif [[ $encrypt -eq 3 ]];then
- wsrep_log_warning "**** WARNING **** encrypt=3 is deprecated and will be removed in a future release"
- wsrep_log_info "Using openssl based encryption with socat: with key and crt"
-
- verify_file_exists "$tcert" "Both certificate and key files are required." \
- "Please check the 'tcert' option. "
- verify_file_exists "$tkey" "Both certificate and key files are required." \
- "Please check the 'tkey' option. "
-
- stagemsg+="-OpenSSL-Encrypted-3"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- wsrep_log_info "Decrypting with CERT: $tcert, KEY: $tkey"
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},key=${tkey},verify=0${joiner_extra}${sockopt} stdio"
- else
- wsrep_log_info "Encrypting with CERT: $tcert, KEY: $tkey"
- tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}"
- fi
- elif [[ $encrypt -eq 4 ]]; then
- wsrep_log_info "Using openssl based encryption with socat: with key, crt, and ca"
-
- verify_file_exists "$ssl_ca" "CA, certificate, and key files are required." \
- "Please check the 'ssl-ca' option. "
- verify_file_exists "$ssl_cert" "CA, certificate, and key files are required." \
- "Please check the 'ssl-cert' option. "
- verify_file_exists "$ssl_key" "CA, certificate, and key files are required." \
- "Please check the 'ssl-key' option. "
-
- # Check to see that the key matches the cert
- verify_cert_matches_key $ssl_cert $ssl_key
-
- stagemsg+="-OpenSSL-Encrypted-4"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then
- wsrep_log_info "Decrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca"
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${joiner_extra}${sockopt} stdio"
- else
- wsrep_log_info "Encrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca"
- tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}"
- fi
-
- else
- if [[ $encrypt -eq 1 ]]; then
- wsrep_log_warning "**** WARNING **** encrypt=1 is deprecated and will be removed in a future release"
- fi
-
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then
- tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
- else
- tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}"
- fi
- fi
- fi
-}
-
-get_footprint()
-{
- pushd $WSREP_SST_OPT_DATA 1>/dev/null
- payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }')
- if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then
- # QuickLZ has around 50% compression ratio
- # When compression/compaction used, the progress is only an approximate.
- payload=$(( payload*1/2 ))
- fi
- popd 1>/dev/null
- pcmd+=" -s $payload"
- adjust_progress
-}
-
-adjust_progress()
-{
-
- if ! command -v pv >/dev/null;then
- wsrep_log_error "pv not found in path: $PATH"
- wsrep_log_error "Disabling all progress/rate-limiting"
- pcmd=""
- rlimit=""
- progress=""
- return
- fi
-
- if [[ -n $progress && $progress != '1' ]];then
- if [[ -e $progress ]];then
- pcmd+=" 2>>$progress"
- else
- pcmd+=" 2>$progress"
- fi
- elif [[ -z $progress && -n $rlimit ]];then
- # When rlimit is non-zero
- pcmd="pv -q"
- fi
-
- if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then
- wsrep_log_info "Rate-limiting SST to $rlimit"
- pcmd+=" -L \$rlimit"
- fi
-}
-
-read_cnf()
-{
- sfmt=$(parse_cnf sst streamfmt "xbstream")
- tfmt=$(parse_cnf sst transferfmt "socat")
- tca=$(parse_cnf sst tca "")
- tcert=$(parse_cnf sst tcert "")
- tkey=$(parse_cnf sst tkey "")
- encrypt=$(parse_cnf sst encrypt 0)
- sockopt=$(parse_cnf sst sockopt "")
- progress=$(parse_cnf sst progress "")
- rebuild=$(parse_cnf sst rebuild 0)
- ttime=$(parse_cnf sst time 0)
- if [ "${OS}" = "FreeBSD" ]; then
- cpat=$(parse_cnf sst cpat '.*\.pem$|.*init\.ok$|.*galera\.cache$|.*sst_in_progress$|.*\.sst$|.*gvwstate\.dat$|.*grastate\.dat$|.*\.err$|.*\.log$|.*RPM_UPGRADE_MARKER$|.*RPM_UPGRADE_HISTORY$')
- else
- cpat=$(parse_cnf sst cpat '.*\.pem$\|.*init\.ok$\|.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
- fi
- ealgo=$(parse_cnf xtrabackup encrypt "")
- ekey=$(parse_cnf xtrabackup encrypt-key "")
- ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "")
- scomp=$(parse_cnf sst compressor "")
- sdecomp=$(parse_cnf sst decompressor "")
-
-
- # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
- if [[ -z $ealgo ]];then
- ealgo=$(parse_cnf sst encrypt-algo "")
- ekey=$(parse_cnf sst encrypt-key "")
- ekeyfile=$(parse_cnf sst encrypt-key-file "")
- fi
-
- # Pull the parameters needed for encrypt=4
- ssl_ca=$(parse_cnf sst ssl-ca "")
- if [[ -z "$ssl_ca" ]]; then
- ssl_ca=$(parse_cnf --mysqld ssl-ca "")
- fi
- ssl_cert=$(parse_cnf sst ssl-cert "")
- if [[ -z "$ssl_cert" ]]; then
- ssl_cert=$(parse_cnf --mysqld ssl-cert "")
- fi
- ssl_key=$(parse_cnf sst ssl-key "")
- if [[ -z "$ssl_key" ]]; then
- ssl_key=$(parse_cnf --mysqld ssl-key "")
- fi
-
- rlimit=$(parse_cnf sst rlimit "")
- uextra=$(parse_cnf sst use-extra 0)
- iopts=$(parse_cnf sst inno-backup-opts "")
- iapts=$(parse_cnf sst inno-apply-opts "")
- impts=$(parse_cnf sst inno-move-opts "")
- stimeout=$(parse_cnf sst sst-initial-timeout 100)
- ssyslog=$(parse_cnf sst sst-syslog 0)
- ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}")
- ssystag+="-"
-
- if [[ $ssyslog -ne -1 ]];then
- if $MY_PRINT_DEFAULTS mysqld_safe | grep -q -- "--syslog";then
- ssyslog=1
- fi
- fi
-}
-
-get_stream()
-{
- if [[ $sfmt == 'xbstream' ]];then
- wsrep_log_info "Streaming with xbstream"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- strmcmd="xbstream -x"
- else
- strmcmd="xbstream -c \${INFO_FILE}"
- fi
- else
- sfmt="tar"
- wsrep_log_info "Streaming with tar"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- strmcmd="tar xfi - "
- else
- strmcmd="tar cf - \${INFO_FILE} "
- fi
-
- fi
-}
-
-get_proc()
-{
- set +e
- nproc=$(grep -c processor /proc/cpuinfo)
- [[ -z $nproc || $nproc -eq 0 ]] && nproc=1
- set -e
-}
-
-sig_joiner_cleanup()
-{
- wsrep_log_error "Removing $MAGIC_FILE file due to signal"
- rm -f "$MAGIC_FILE"
-}
-
-cleanup_joiner()
-{
- # Since this is invoked just after exit NNN
- local estatus=$?
- if [[ $estatus -ne 0 ]];then
- wsrep_log_error "Cleanup after exit with status:$estatus"
- elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then
- wsrep_log_info "Removing the sst_in_progress file"
- wsrep_cleanup_progress_file
- fi
- if [[ -n $progress && -p $progress ]];then
- wsrep_log_info "Cleaning up fifo file $progress"
- rm $progress
- fi
- if [[ -n ${STATDIR:-} ]];then
- [[ -d $STATDIR ]] && rm -rf $STATDIR
- fi
-
- # Final cleanup
- pgid=$(ps -o pgid= $$ | grep -o '[0-9]*')
-
- # This means no setsid done in mysqld.
- # We don't want to kill mysqld here otherwise.
- if [[ $$ -eq $pgid ]];then
-
- # This means a signal was delivered to the process.
- # So, more cleanup.
- if [[ $estatus -ge 128 ]];then
- kill -KILL -$$ || true
- fi
-
- fi
-
- exit $estatus
-}
-
-check_pid()
-{
- local pid_file="$1"
- [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1
-}
-
-cleanup_donor()
-{
- # Since this is invoked just after exit NNN
- local estatus=$?
- if [[ $estatus -ne 0 ]];then
- wsrep_log_error "Cleanup after exit with status:$estatus"
- fi
-
- if [[ -n ${XTRABACKUP_PID:-} ]];then
- if check_pid $XTRABACKUP_PID
- then
- wsrep_log_error "xtrabackup process is still running. Killing... "
- kill_xtrabackup
- fi
-
- fi
- rm -f ${DATA}/${IST_FILE} || true
-
- if [[ -n $progress && -p $progress ]];then
- wsrep_log_info "Cleaning up fifo file $progress"
- rm -f $progress || true
- fi
-
- wsrep_log_info "Cleaning up temporary directories"
-
- if [[ -n $xtmpdir ]];then
- [[ -d $xtmpdir ]] && rm -rf $xtmpdir || true
- fi
-
- if [[ -n $itmpdir ]];then
- [[ -d $itmpdir ]] && rm -rf $itmpdir || true
- fi
-
- # Final cleanup
- pgid=$(ps -o pgid= $$ | grep -o '[0-9]*')
-
- # This means no setsid done in mysqld.
- # We don't want to kill mysqld here otherwise.
- if [[ $$ -eq $pgid ]];then
-
- # This means a signal was delivered to the process.
- # So, more cleanup.
- if [[ $estatus -ge 128 ]];then
- kill -KILL -$$ || true
- fi
-
- fi
-
- exit $estatus
-
-}
-
-kill_xtrabackup()
-{
- local PID=$(cat $XTRABACKUP_PID)
- [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || :
- wsrep_log_info "Removing xtrabackup pid file $XTRABACKUP_PID"
- rm -f "$XTRABACKUP_PID" || true
-}
-
-# waits ~1 minute for nc/socat to open the port and then reports ready
-# (regardless of timeout)
-wait_for_listen()
-{
- local HOST=$1
- local PORT=$2
- local MODULE=$3
- local LSOF_OUT
-
- for i in {1..300}
- do
- LSOF_OUT=$(lsof -sTCP:LISTEN -i TCP:${PORT} -a -c nc -c socat -F c 2> /dev/null || :)
- [ -n "${LSOF_OUT}" ] && break
- sleep 0.2
- done
-
- echo "ready ${HOST}:${PORT}/${MODULE}//${WSREP_SST_OPT_SST_VER:-1}"
-}
-
-check_extra()
-{
- local use_socket=1
- if [[ $uextra -eq 1 ]];then
- if [ $(parse_cnf --mysqld thread-handling) = 'pool-of-threads'];then
- local eport=$(parse_cnf --mysqld extra-port)
- if [[ -n $eport ]];then
- # Xtrabackup works only locally.
- # Hence, setting host to 127.0.0.1 unconditionally.
- wsrep_log_info "SST through extra_port $eport"
- INNOEXTRA+=" --host=127.0.0.1 --port=$eport "
- use_socket=0
- else
- wsrep_log_error "Extra port $eport null, failing"
- exit 1
- fi
- else
- wsrep_log_info "Thread pool not set, ignore the option use_extra"
- fi
- fi
- if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then
- INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}"
- fi
-}
-
-recv_joiner()
-{
- local dir=$1
- local msg=$2
- local tmt=$3
- local checkf=$4
- local ltcmd
-
- if [[ ! -d ${dir} ]];then
- # This indicates that IST is in progress
- return
- fi
-
- pushd ${dir} 1>/dev/null
- set +e
-
- if [[ $tmt -gt 0 ]] && command -v timeout >/dev/null;then
- if timeout --help | grep -q -- '-k';then
- ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd"
- else
- ltcmd="timeout -s9 $tmt $tcmd"
- fi
- timeit "$msg" "$ltcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
- else
- timeit "$msg" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
- fi
-
- set -e
- popd 1>/dev/null
-
- if [[ ${RC[0]} -eq 124 ]];then
- wsrep_log_error "Possible timeout in receving first data from donor in gtid stage"
- exit 32
- fi
-
- for ecode in "${RC[@]}";do
- if [[ $ecode -ne 0 ]];then
- wsrep_log_error "Error while getting data from donor node: " \
- "exit codes: ${RC[@]}"
- exit 32
- fi
- done
-
- if [[ $checkf -eq 1 && ! -r "${MAGIC_FILE}" ]];then
- # this message should cause joiner to abort
- wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'"
- wsrep_log_info "Contents of datadir"
- wsrep_log_info "$(ls -l ${dir}/*)"
- exit 32
- fi
-}
-
-
-send_donor()
-{
- local dir=$1
- local msg=$2
-
- pushd ${dir} 1>/dev/null
- set +e
- timeit "$msg" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
- set -e
- popd 1>/dev/null
-
-
- for ecode in "${RC[@]}";do
- if [[ $ecode -ne 0 ]];then
- wsrep_log_error "Error while getting data from donor node: " \
- "exit codes: ${RC[@]}"
- exit 32
- fi
- done
-
-}
-
-# Returns the version string in a standardized format
-# Input "1.2.3" => echoes "010203"
-# Wrongly formatted values => echoes "000000"
-normalize_version()
-{
- local major=0
- local minor=0
- local patch=0
-
- # Only parses purely numeric version numbers, 1.2.3
- # Everything after the first three values are ignored
- if [[ $1 =~ ^([0-9]+)\.([0-9]+)\.?([0-9]*)([\.0-9])*$ ]]; then
- major=${BASH_REMATCH[1]}
- minor=${BASH_REMATCH[2]}
- patch=${BASH_REMATCH[3]}
- fi
-
- printf %02d%02d%02d $major $minor $patch
-}
-
-# Compares two version strings
-# The first parameter is the version to be checked
-# The second parameter is the minimum version required
-# Returns 1 (failure) if $1 >= $2, 0 (success) otherwise
-check_for_version()
-{
- local local_version_str="$( normalize_version $1 )"
- local required_version_str="$( normalize_version $2 )"
-
- if [[ "$local_version_str" < "$required_version_str" ]]; then
- return 1
- else
- return 0
- fi
-}
-
-monitor_process()
-{
- local sst_stream_pid=$1
-
- while true ; do
-
- if ! ps --pid "${WSREP_SST_OPT_PARENT}" &>/dev/null; then
- wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
- kill -- -"${WSREP_SST_OPT_PARENT}"
- exit 32
- fi
-
- if ! ps --pid "${sst_stream_pid}" &>/dev/null; then
- break
- fi
-
- sleep 0.1
-
- done
-}
-
-
-wsrep_check_programs "$INNOBACKUPEX_BIN"
-
-# check the version, we require XB-2.4 to ensure that we can pass the
-# datadir via the command-line option
-XB_REQUIRED_VERSION="2.3.5"
-
-XB_VERSION=`$INNOBACKUPEX_BIN --version 2>&1 | grep -oe '[0-9]\.[0-9][\.0-9]*' | head -n1`
-if [[ -z $XB_VERSION ]]; then
- wsrep_log_error "FATAL: Cannot determine the $INNOBACKUPEX_BIN version. Needs xtrabackup-$XB_REQUIRED_VERSION or higher to perform SST"
- exit 2
-fi
-
-if ! check_for_version $XB_VERSION $XB_REQUIRED_VERSION; then
- wsrep_log_error "FATAL: The $INNOBACKUPEX_BIN version is $XB_VERSION. Needs xtrabackup-$XB_REQUIRED_VERSION or higher to perform SST"
- exit 2
-fi
-
-
-rm -f "${MAGIC_FILE}"
-
-if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then
- wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}"
- exit 22
-fi
-
-read_cnf
-
-if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; then
- disver="--no-version-check"
-fi
-
-if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then
- wsrep_log_info "Forcing FTWRL due to environment variable FORCE_FTWRL equal to $FORCE_FTWRL"
- iopts+=" --no-backup-locks "
-fi
-
-
-INNOEXTRA=""
-
-if [[ $ssyslog -eq 1 ]];then
-
- if ! command -v logger >/dev/null;then
- wsrep_log_error "logger not in path: $PATH. Ignoring"
- else
-
- wsrep_log_info "Logging all stderr of SST/Innobackupex to syslog"
-
- exec 2> >(logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE)
-
- wsrep_log_error()
- {
- logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
- }
-
- wsrep_log_info()
- {
- logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
- }
-
- INNOAPPLY="2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
- INNOMOVE="2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
- INNOBACKUP="2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
- fi
-
-else
- INNOAPPLY="&>\${DATA}/innobackup.prepare.log"
- INNOMOVE="&>\${DATA}/innobackup.move.log"
- INNOBACKUP="2>\${DATA}/innobackup.backup.log"
-fi
-
-get_stream
-get_transfer
-
-INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
-# Try to set INNODB_DATA_HOME_DIR from the command line:
-if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
- INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG
-fi
-# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf
-if [ -z "$INNODB_DATA_HOME_DIR" ]; then
- INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
-fi
-if [ -z "$INNODB_DATA_HOME_DIR" ]; then
- INNODB_DATA_HOME_DIR=$(parse_cnf --mysqld innodb-data-home-dir "")
-fi
-if [ ! -z "$INNODB_DATA_HOME_DIR" ]; then
- INNOEXTRA+=" --innodb-data-home-dir=$INNODB_DATA_HOME_DIR"
-fi
-
-if [ -n "$INNODB_DATA_HOME_DIR" ]; then
- # handle both relative and absolute paths
- INNODB_DATA_HOME_DIR=$(cd $DATA; mkdir -p "$INNODB_DATA_HOME_DIR"; cd $INNODB_DATA_HOME_DIR; pwd -P)
-else
- # default to datadir
- INNODB_DATA_HOME_DIR=$(cd $DATA; pwd -P)
-fi
-
-INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} ${INNOAPPLY}"
-INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} ${INNOMOVE}"
-INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir ${INNOBACKUP}"
-
-if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
-then
- trap cleanup_donor EXIT
-
- if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
- then
- usrst=0
- if [[ -z $WSREP_SST_OPT_SST_VER ]];then
- wsrep_log_error "Upgrade joiner to 5.6.21 or higher for backup locks support"
- wsrep_log_error "The joiner is not supported for this version of donor"
- exit 93
- fi
-
- if [[ -z $(parse_cnf --mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then
- xtmpdir=$(mktemp -d)
- tmpopts=" --tmpdir=$xtmpdir "
- wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory"
- fi
-
- itmpdir=$(mktemp -d)
- wsrep_log_info "Using $itmpdir as innobackupex temporary directory"
-
- if [[ -n "${WSREP_SST_OPT_USER:-}" && "$WSREP_SST_OPT_USER" != "(null)" ]]; then
- INNOEXTRA+=" --user=$WSREP_SST_OPT_USER"
- usrst=1
- fi
-
- if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then
- INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD"
- elif [[ $usrst -eq 1 ]];then
- # Empty password, used for testing, debugging etc.
- INNOEXTRA+=" --password="
- fi
-
- get_keys
- check_extra
-
- wsrep_log_info "Streaming GTID file before SST"
-
- # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
- # (separated by a space).
- echo "${WSREP_SST_OPT_GTID} ${WSREP_SST_OPT_GTID_DOMAIN_ID}" > "${MAGIC_FILE}"
-
- ttcmd="$tcmd"
-
- if [[ $encrypt -eq 1 ]];then
- if [[ -n $scomp ]];then
- tcmd=" \$ecmd | $scomp | $tcmd "
- else
- tcmd=" \$ecmd | $tcmd "
- fi
- elif [[ -n $scomp ]];then
- tcmd=" $scomp | $tcmd "
- fi
-
- send_donor $DATA "${stagemsg}-gtid"
-
- # Restore the transport commmand to its original state
- tcmd="$ttcmd"
- if [[ -n $progress ]];then
- get_footprint
- tcmd="$pcmd | $tcmd"
- elif [[ -n $rlimit ]];then
- adjust_progress
- tcmd="$pcmd | $tcmd"
- fi
-
- wsrep_log_info "Sleeping before data transfer for SST"
- sleep 10
-
- wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT:-4444}"
-
- # Add compression to the head of the stream (if specified)
- if [[ -n $scomp ]]; then
- tcmd="$scomp | $tcmd"
- fi
-
- # Add encryption to the head of the stream (if specified)
- if [[ $encrypt -eq 1 ]]; then
- tcmd=" \$ecmd | $tcmd "
- fi
-
- set +e
- timeit "${stagemsg}-SST" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
- set -e
-
- if [ ${RC[0]} -ne 0 ]; then
- wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \
- "Check ${DATA}/innobackup.backup.log"
- exit 22
- elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
- wsrep_log_error "$tcmd finished with error: ${RC[1]}"
- exit 22
- fi
-
- # innobackupex implicitly writes PID to fixed location in $xtmpdir
- XTRABACKUP_PID="$xtmpdir/xtrabackup_pid"
-
-
- else # BYPASS FOR IST
-
- wsrep_log_info "Bypassing the SST for IST"
- echo "continue" # now server can resume updating data
-
- # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
- # (separated by a space).
- echo "${WSREP_SST_OPT_GTID} ${WSREP_SST_OPT_GTID_DOMAIN_ID}" > "${MAGIC_FILE}"
- echo "1" > "${DATA}/${IST_FILE}"
- get_keys
- if [[ $encrypt -eq 1 ]];then
- if [[ -n $scomp ]];then
- tcmd=" \$ecmd | $scomp | $tcmd "
- else
- tcmd=" \$ecmd | $tcmd "
- fi
- elif [[ -n $scomp ]];then
- tcmd=" $scomp | $tcmd "
- fi
- strmcmd+=" \${IST_FILE}"
-
- send_donor $DATA "${stagemsg}-IST"
-
- fi
-
- echo "done ${WSREP_SST_OPT_GTID}"
- wsrep_log_info "Total time on donor: $totime seconds"
-
-elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ]
-then
- [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
- [[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE
-
- ib_home_dir=$INNODB_DATA_HOME_DIR
- ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "")
- ib_undo_dir=$(parse_cnf --mysqld innodb-undo-directory "")
-
- stagemsg="Joiner-Recv"
-
- sencrypted=1
- nthreads=1
-
- MODULE="xtrabackup_sst"
-
- rm -f "${DATA}/${IST_FILE}"
-
- # May need xtrabackup_checkpoints later on
- rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile
-
- wait_for_listen ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT:-4444} ${MODULE} &
-
- trap sig_joiner_cleanup HUP PIPE INT TERM
- trap cleanup_joiner EXIT
-
- if [[ -n $progress ]];then
- adjust_progress
- tcmd+=" | $pcmd"
- fi
-
- get_keys
- if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then
- if [[ -n $sdecomp ]];then
- strmcmd=" $sdecomp | \$ecmd | $strmcmd"
- else
- strmcmd=" \$ecmd | $strmcmd"
- fi
- elif [[ -n $sdecomp ]];then
- strmcmd=" $sdecomp | $strmcmd"
- fi
-
- STATDIR=$(mktemp -d)
- MAGIC_FILE="${STATDIR}/${INFO_FILE}"
- recv_joiner $STATDIR "${stagemsg}-gtid" $stimeout 1
-
-
- if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null
- then
- wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
- exit 32
- fi
-
- if [ ! -r "${STATDIR}/${IST_FILE}" ]
- then
-
- if [[ -d ${DATA}/.sst ]];then
- wsrep_log_info "WARNING: Stale temporary SST directory: ${DATA}/.sst from previous state transfer. Removing"
- rm -rf ${DATA}/.sst
- fi
- mkdir -p ${DATA}/.sst
- (recv_joiner $DATA/.sst "${stagemsg}-SST" 0 0) &
- jpid=$!
- wsrep_log_info "Proceeding with SST"
-
-
- wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
- if [ "${OS}" = "FreeBSD" ]; then
- find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
- else
- find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
- fi
-
- tempdir=$(parse_cnf --mysqld log-bin "")
- if [[ -n ${tempdir:-} ]];then
- binlog_dir=$(dirname $tempdir)
- binlog_file=$(basename $tempdir)
- if [[ -n ${binlog_dir:-} && $binlog_dir != '.' && $binlog_dir != $DATA ]];then
- pattern="$binlog_dir/$binlog_file\.[0-9]+$"
- wsrep_log_info "Cleaning the binlog directory $binlog_dir as well"
- find $binlog_dir -maxdepth 1 -type f -regex $pattern -exec rm -fv {} 1>&2 \+ || true
- rm $binlog_dir/*.index || true
- fi
- fi
-
-
-
- TDATA=${DATA}
- DATA="${DATA}/.sst"
-
-
- MAGIC_FILE="${DATA}/${INFO_FILE}"
- wsrep_log_info "Waiting for SST streaming to complete!"
- monitor_process $jpid
-
- get_proc
-
- if [[ ! -s ${DATA}/xtrabackup_checkpoints ]];then
- wsrep_log_error "xtrabackup_checkpoints missing, failed innobackupex/SST on donor"
- exit 2
- fi
-
- # Rebuild indexes for compact backups
- if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then
- wsrep_log_info "Index compaction detected"
- rebuild=1
- fi
-
- if [[ $rebuild -eq 1 ]];then
- nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc)
- wsrep_log_info "Rebuilding during prepare with $nthreads threads"
- rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads"
- fi
-
- if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then
-
- wsrep_log_info "Compressed qpress files found"
-
- if ! command -v qpress >/dev/null;then
- wsrep_log_error "qpress not found in path: $PATH"
- exit 22
- fi
-
- if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then
- count=$(find ${DATA} -type f -name '*.qp' | wc -l)
- count=$(( count*2 ))
- if pv --help | grep -q FORMAT;then
- pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'"
- else
- pvopts="-f -s $count -l -N Decompression"
- fi
- pcmd="pv $pvopts"
- adjust_progress
- dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d"
- else
- dcmd="xargs -n 2 qpress -T${nproc}d"
- fi
-
-
- # Decompress the qpress files
- wsrep_log_info "Decompression with $nproc threads"
- timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
- extcode=$?
-
- if [[ $extcode -eq 0 ]];then
- wsrep_log_info "Removing qpress files after decompression"
- find ${DATA} -type f -name '*.qp' -delete
- if [[ $? -ne 0 ]];then
- wsrep_log_error "Something went wrong with deletion of qpress files. Investigate"
- fi
- else
- wsrep_log_error "Decompression failed. Exit code: $extcode"
- exit 22
- fi
- fi
-
-
- if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then
-
- BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
- BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG)
-
- # To avoid comparing data directory and BINLOG_DIRNAME
- mv $DATA/${BINLOG_FILENAME}.* $BINLOG_DIRNAME/ 2>/dev/null || true
-
- pushd $BINLOG_DIRNAME &>/dev/null
- for bfiles in $(ls -1 ${BINLOG_FILENAME}.[0-9]*);do
- echo ${BINLOG_DIRNAME}/${bfiles} >> ${BINLOG_FILENAME}.index
- done
- popd &> /dev/null
-
- fi
-
- wsrep_log_info "Preparing the backup at ${DATA}"
- timeit "Xtrabackup prepare stage" "$INNOAPPLY"
-
- if [ $? -ne 0 ];
- then
- wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check ${DATA}/innobackup.prepare.log"
- exit 22
- fi
-
- MAGIC_FILE="${TDATA}/${INFO_FILE}"
- set +e
- rm $TDATA/innobackup.prepare.log $TDATA/innobackup.move.log
- set -e
- wsrep_log_info "Moving the backup to ${TDATA}"
- timeit "Xtrabackup move stage" "$INNOMOVE"
- if [[ $? -eq 0 ]];then
- wsrep_log_info "Move successful, removing ${DATA}"
- rm -rf $DATA
- DATA=${TDATA}
- else
- wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis"
- wsrep_log_error "Check ${DATA}/innobackup.move.log for details"
- exit 22
- fi
-
-
- else
- wsrep_log_info "${IST_FILE} received from donor: Running IST"
- fi
-
- if [[ ! -r ${MAGIC_FILE} ]];then
- wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable"
- exit 2
- fi
- wsrep_log_info "Galera co-ords from recovery: $(cat ${MAGIC_FILE})"
- cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id
- wsrep_log_info "Total time on joiner: $totime seconds"
-fi
-
-exit 0
diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh
deleted file mode 100644
index 41ed4485de5..00000000000
--- a/scripts/wsrep_sst_xtrabackup.sh
+++ /dev/null
@@ -1,692 +0,0 @@
-#!/bin/bash -ue
-# Copyright (C) 2013 Percona Inc
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
-# MA 02110-1301 USA.
-
-# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
-# Make sure to read that before proceeding!
-
-
-
-
-. $(dirname $0)/wsrep_sst_common
-
-ealgo=""
-ekey=""
-ekeyfile=""
-encrypt=0
-nproc=1
-ecode=0
-XTRABACKUP_PID=""
-tcert=""
-tpem=""
-sockopt=""
-progress=""
-ttime=0
-totime=0
-lsn="${WSREP_SST_OPT_LSN}"
-incremental=0
-ecmd=""
-rlimit=""
-
-sfmt="tar"
-strmcmd=""
-tfmt=""
-tcmd=""
-rebuild=0
-rebuildcmd=""
-payload=0
-pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' "
-pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE "
-uextra=0
-
-if pv --help 2>/dev/null | grep -q FORMAT;then
- pvopts+=$pvformat
-fi
-pcmd="pv $pvopts"
-declare -a RC
-
-INNOBACKUPEX_BIN=innobackupex
-DATA="${WSREP_SST_OPT_DATA}"
-INFO_FILE="xtrabackup_galera_info"
-IST_FILE="xtrabackup_ist"
-MAGIC_FILE="${DATA}/${INFO_FILE}"
-
-# Setting the path for ss and ip
-export PATH="/usr/sbin:/sbin:$PATH"
-
-timeit(){
- local stage=$1
- shift
- local cmd="$@"
- local x1 x2 took extcode
-
- if [[ $ttime -eq 1 ]];then
- x1=$(date +%s)
- wsrep_log_info "Evaluating $cmd"
- eval "$cmd"
- extcode=$?
- x2=$(date +%s)
- took=$(( x2-x1 ))
- wsrep_log_info "NOTE: $stage took $took seconds"
- totime=$(( totime+took ))
- else
- wsrep_log_info "Evaluating $cmd"
- eval "$cmd"
- extcode=$?
- fi
- return $extcode
-}
-
-get_keys()
-{
- if [[ $encrypt -eq 2 ]];then
- return
- fi
-
- if [[ $encrypt -eq 0 ]];then
- if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then
- wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html "
- fi
- return
- fi
-
- if [[ $sfmt == 'tar' ]];then
- wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format"
- encrypt=0
- return
- fi
-
- wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4"
-
- if [[ -z $ealgo ]];then
- wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out"
- exit 3
- fi
-
- if [[ -z $ekey && ! -r $ekeyfile ]];then
- wsrep_log_error "FATAL: Either key or keyfile must be readable"
- exit 3
- fi
-
- if [[ -z $ekey ]];then
- ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile"
- else
- ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey"
- fi
-
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- ecmd+=" -d"
- fi
-}
-
-get_transfer()
-{
- TSST_PORT=${WSREP_SST_OPT_PORT:-4444}
-
- if [[ $tfmt == 'nc' ]];then
- wsrep_check_programs nc
- wsrep_log_info "Using netcat as streamer"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- if nc -h 2>&1 | grep -q ncat;then
- # Ncat
- tcmd="nc -l ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
- # Debian netcat
- tcmd="nc -dl ${TSST_PORT}"
- else
- # traditional netcat
- tcmd="nc -l -p ${TSST_PORT}"
- fi
- else
- if nc -h 2>&1 | grep -q ncat;then
- # Ncat
- tcmd="nc ${REMOTEIP} ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
- # Debian netcat
- tcmd="nc ${REMOTEIP} ${TSST_PORT}"
- else
- # traditional netcat
- tcmd="nc -q0 ${REMOTEIP} ${TSST_PORT}"
- fi
- fi
- else
- tfmt='socat'
- wsrep_check_programs socat
- wsrep_log_info "Using socat as streamer"
-
- if [[ $encrypt -eq 2 ]] && ! socat -V | grep -q OPENSSL;then
- wsrep_log_info "NOTE: socat is not openssl enabled, falling back to plain transfer"
- encrypt=0
- fi
-
- if [[ $encrypt -eq 2 ]];then
- wsrep_log_info "Using openssl based encryption with socat"
- if [[ -z $tpem || -z $tcert ]];then
- wsrep_log_error "Both PEM and CRT files required"
- exit 22
- fi
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert"
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio"
- else
- wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert"
- tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}"
- fi
- else
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
- else
- tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}"
- fi
- fi
- fi
-
-}
-
-get_footprint()
-{
- pushd $WSREP_SST_OPT_DATA 1>/dev/null
- payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }')
- if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then
- # QuickLZ has around 50% compression ratio
- # When compression/compaction used, the progress is only an approximate.
- payload=$(( payload*1/2 ))
- fi
- popd 1>/dev/null
- pcmd+=" -s $payload"
- adjust_progress
-}
-
-adjust_progress()
-{
- if [[ -n $progress && $progress != '1' ]];then
- if [[ -e $progress ]];then
- pcmd+=" 2>>$progress"
- else
- pcmd+=" 2>$progress"
- fi
- elif [[ -z $progress && -n $rlimit ]];then
- # When rlimit is non-zero
- pcmd="pv -q"
- fi
-
- if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then
- wsrep_log_info "Rate-limiting SST to $rlimit"
- pcmd+=" -L \$rlimit"
- fi
-}
-
-read_cnf()
-{
- sfmt=$(parse_cnf sst streamfmt "tar")
- tfmt=$(parse_cnf sst transferfmt "socat")
- tcert=$(parse_cnf sst tca "")
- tpem=$(parse_cnf sst tcert "")
- encrypt=$(parse_cnf sst encrypt 0)
- sockopt=$(parse_cnf sst sockopt "")
- progress=$(parse_cnf sst progress "")
- rebuild=$(parse_cnf sst rebuild 0)
- ttime=$(parse_cnf sst time 0)
- incremental=$(parse_cnf sst incremental 0)
- ealgo=$(parse_cnf xtrabackup encrypt "")
- ekey=$(parse_cnf xtrabackup encrypt-key "")
- ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "")
-
- # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
- if [[ -z $ealgo ]];then
- ealgo=$(parse_cnf sst encrypt-algo "")
- ekey=$(parse_cnf sst encrypt-key "")
- ekeyfile=$(parse_cnf sst encrypt-key-file "")
- fi
- rlimit=$(parse_cnf sst rlimit "")
- uextra=$(parse_cnf sst use_extra 0)
-}
-
-get_stream()
-{
- if [[ $sfmt == 'xbstream' ]];then
- wsrep_log_info "Streaming with xbstream"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- strmcmd="xbstream -x"
- else
- strmcmd="xbstream -c \${INFO_FILE} \${IST_FILE}"
- fi
- else
- sfmt="tar"
- wsrep_log_info "Streaming with tar"
- if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- strmcmd="tar xfi - --recursive-unlink -h"
- else
- strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}"
- fi
-
- fi
-}
-
-get_proc()
-{
- set +e
- nproc=$(grep -c processor /proc/cpuinfo)
- [[ -z $nproc || $nproc -eq 0 ]] && nproc=1
- set -e
-}
-
-sig_joiner_cleanup()
-{
- wsrep_log_error "Removing $MAGIC_FILE file due to signal"
- rm -f "$MAGIC_FILE"
-}
-
-cleanup_joiner()
-{
- # Since this is invoked just after exit NNN
- local estatus=$?
- if [[ $estatus -ne 0 ]];then
- wsrep_log_error "Cleanup after exit with status:$estatus"
- fi
- if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then
- wsrep_log_info "Removing the sst_in_progress file"
- wsrep_cleanup_progress_file
- fi
- if [[ -n $progress && -p $progress ]];then
- wsrep_log_info "Cleaning up fifo file $progress"
- rm $progress
- fi
-}
-
-check_pid()
-{
- local pid_file="$1"
- [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1
-}
-
-cleanup_donor()
-{
- # Since this is invoked just after exit NNN
- local estatus=$?
- if [[ $estatus -ne 0 ]];then
- wsrep_log_error "Cleanup after exit with status:$estatus"
- fi
-
- if [[ -n $XTRABACKUP_PID ]];then
- if check_pid $XTRABACKUP_PID
- then
- wsrep_log_error "xtrabackup process is still running. Killing... "
- kill_xtrabackup
- fi
-
- rm -f $XTRABACKUP_PID
- fi
- rm -f ${DATA}/${IST_FILE}
-
- if [[ -n $progress && -p $progress ]];then
- wsrep_log_info "Cleaning up fifo file $progress"
- rm $progress
- fi
-}
-
-kill_xtrabackup()
-{
- local PID=$(cat $XTRABACKUP_PID)
- [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || :
- rm -f "$XTRABACKUP_PID"
-}
-
-# waits ~10 seconds for nc to open the port and then reports ready
-# (regardless of timeout)
-wait_for_listen()
-{
- local PORT=$1
- local ADDR=$2
- local MODULE=$3
- for i in {1..50}
- do
- ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
- sleep 0.2
- done
- if [[ $incremental -eq 1 ]];then
- echo "ready ${ADDR}/${MODULE}/$lsn"
- else
- echo "ready ${ADDR}/${MODULE}"
- fi
-}
-
-check_extra()
-{
- local use_socket=1
- if [[ $uextra -eq 1 ]];then
- if [ $(parse_cnf --mysqld thread-handling) = 'pool-of-threads'];then
- local eport=$(parse_cnf --mysqld extra-port)
- if [[ -n $eport ]];then
- # Xtrabackup works only locally.
- # Hence, setting host to 127.0.0.1 unconditionally.
- wsrep_log_info "SST through extra_port $eport"
- INNOEXTRA+=" --host=127.0.0.1 --port=$eport "
- use_socket=0
- else
- wsrep_log_error "Extra port $eport null, failing"
- exit 1
- fi
- else
- wsrep_log_info "Thread pool not set, ignore the option use_extra"
- fi
- fi
- if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then
- INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}"
- fi
-}
-
-wsrep_check_programs "innobackupex"
-
-rm -f "${MAGIC_FILE}"
-
-if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then
- wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}"
- exit 22
-fi
-
-read_cnf
-get_stream
-get_transfer
-
-INNOEXTRA=""
-INNOAPPLY="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
-INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} \$INNOEXTRA --galera-info --stream=\$sfmt \${TMPDIR} 2>\${DATA}/innobackup.backup.log"
-
-if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
-then
- trap cleanup_donor EXIT
-
- if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
- then
- usrst=0
- TMPDIR="${TMPDIR:-/tmp}"
-
- if [[ -n "${WSREP_SST_OPT_USER:-}" && "$WSREP_SST_OPT_USER" != "(null)" ]]; then
- INNOEXTRA+=" --user=$WSREP_SST_OPT_USER"
- usrst=1
- fi
-
- if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then
- INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD"
- elif [[ $usrst -eq 1 ]];then
- # Empty password, used for testing, debugging etc.
- INNOEXTRA+=" --password="
- fi
-
- get_keys
- if [[ $encrypt -eq 1 ]];then
- if [[ -n $ekey ]];then
- INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey "
- else
- INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile "
- fi
- fi
-
- if [[ -n $lsn ]];then
- INNOEXTRA+=" --incremental --incremental-lsn=$lsn "
- fi
-
- check_extra
-
- wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT}"
-
- if [[ -n $progress ]];then
- get_footprint
- tcmd="$pcmd | $tcmd"
- elif [[ -n $rlimit ]];then
- adjust_progress
- tcmd="$pcmd | $tcmd"
- fi
-
- set +e
- timeit "Donor-Transfer" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
- set -e
-
- if [ ${RC[0]} -ne 0 ]; then
- wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \
- "Check ${DATA}/innobackup.backup.log"
- exit 22
- elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
- wsrep_log_error "$tcmd finished with error: ${RC[1]}"
- exit 22
- fi
-
- # innobackupex implicitly writes PID to fixed location in ${TMPDIR}
- XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid"
-
- else # BYPASS FOR IST
-
- wsrep_log_info "Bypassing the SST for IST"
- echo "continue" # now server can resume updating data
-
- # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
- # (separated by a space)
- echo "${WSREP_SST_OPT_GTID} ${WSREP_SST_OPT_GTID_DOMAIN_ID}" > "${MAGIC_FILE}"
- echo "1" > "${DATA}/${IST_FILE}"
- get_keys
- pushd ${DATA} 1>/dev/null
- set +e
- if [[ $encrypt -eq 1 ]];then
- tcmd=" $ecmd | $tcmd"
- fi
- timeit "Donor-IST-Unencrypted-transfer" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
- set -e
- popd 1>/dev/null
-
- for ecode in "${RC[@]}";do
- if [[ $ecode -ne 0 ]];then
- wsrep_log_error "Error while streaming data to joiner node: " \
- "exit codes: ${RC[@]}"
- exit 1
- fi
- done
- fi
-
- echo "done ${WSREP_SST_OPT_GTID}"
- wsrep_log_info "Total time on donor: $totime seconds"
-
-elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ]
-then
- [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
- touch $SST_PROGRESS_FILE
-
- if [[ ! -e ${DATA}/ibdata1 ]];then
- incremental=0
- fi
-
- if [[ $incremental -eq 1 ]];then
- wsrep_log_info "Incremental SST enabled"
- #lsn=$(/pxc/bin/mysqld $WSREP_SST_OPT_CONF --basedir=/pxc --wsrep-recover 2>&1 | grep -o 'log sequence number .*' | cut -d " " -f 4 | head -1)
- lsn=$(grep to_lsn xtrabackup_checkpoints | cut -d= -f2 | tr -d ' ')
- wsrep_log_info "Recovered LSN: $lsn"
- fi
-
- sencrypted=1
- nthreads=1
-
- MODULE="xtrabackup_sst"
-
- # May need xtrabackup_checkpoints later on
- rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile
-
- ADDR="${WSREP_SST_OPT_HOST}:${WSREP_SST_OPT_PORT:-4444}"
-
- wait_for_listen ${WSREP_SST_OPT_PORT:-4444} ${ADDR} ${MODULE} &
-
- trap sig_joiner_cleanup HUP PIPE INT TERM
- trap cleanup_joiner EXIT
-
- if [[ -n $progress ]];then
- adjust_progress
- tcmd+=" | $pcmd"
- fi
-
- if [[ $incremental -eq 1 ]];then
- BDATA=$DATA
- DATA=$(mktemp -d)
- MAGIC_FILE="${DATA}/${INFO_FILE}"
- fi
-
- get_keys
- set +e
- if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then
- strmcmd=" $ecmd | $strmcmd"
- fi
-
- pushd ${DATA} 1>/dev/null
- timeit "Joiner-Recv-Unencrypted" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
- popd 1>/dev/null
-
- set -e
-
- if [[ $sfmt == 'xbstream' ]];then
- # Special handling till lp:1193240 is fixed"
- if [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
- wsrep_log_error "Xbstream failed"
- wsrep_log_error "Data directory ${DATA} may not be empty: lp:1193240" \
- "Manual intervention required in that case"
- exit 32
- fi
- fi
-
- wait %% # join for wait_for_listen thread
-
- for ecode in "${RC[@]}";do
- if [[ $ecode -ne 0 ]];then
- wsrep_log_error "Error while getting data from donor node: " \
- "exit codes: ${RC[@]}"
- exit 32
- fi
- done
-
- if [ ! -r "${MAGIC_FILE}" ]
- then
- # this message should cause joiner to abort
- wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'"
- wsrep_log_info "Contents of datadir"
- wsrep_log_info "$(ls -l ${DATA}/**/*)"
- exit 32
- fi
-
- if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null
- then
- wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
- exit 32
- fi
-
- if [ ! -r "${DATA}/${IST_FILE}" ]
- then
- wsrep_log_info "Proceeding with SST"
- wsrep_log_info "Removing existing ib_logfile files"
- if [[ $incremental -ne 1 ]];then
- rm -f ${DATA}/ib_logfile*
- else
- rm -f ${BDATA}/ib_logfile*
- fi
-
- get_proc
-
- # Rebuild indexes for compact backups
- if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then
- wsrep_log_info "Index compaction detected"
- rebuild=1
- fi
-
- if [[ $rebuild -eq 1 ]];then
- nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc)
- wsrep_log_info "Rebuilding during prepare with $nthreads threads"
- rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads"
- fi
-
- if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then
-
- wsrep_log_info "Compressed qpress files found"
-
- if ! command -v qpress >/dev/null;then
- wsrep_log_error "qpress not found in path: $PATH"
- exit 22
- fi
-
- if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then
- count=$(find ${DATA} -type f -name '*.qp' | wc -l)
- count=$(( count*2 ))
- if pv --help | grep -q FORMAT;then
- pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'"
- else
- pvopts="-f -s $count -l -N Decompression"
- fi
- pcmd="pv $pvopts"
- adjust_progress
- dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d"
- else
- dcmd="xargs -n 2 qpress -T${nproc}d"
- fi
-
- wsrep_log_info "Removing existing ibdata1 file"
- rm -f ${DATA}/ibdata1
-
- # Decompress the qpress files
- wsrep_log_info "Decompression with $nproc threads"
- timeit "Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
- extcode=$?
-
- if [[ $extcode -eq 0 ]];then
- wsrep_log_info "Removing qpress files after decompression"
- find ${DATA} -type f -name '*.qp' -delete
- if [[ $? -ne 0 ]];then
- wsrep_log_error "Something went wrong with deletion of qpress files. Investigate"
- fi
- else
- wsrep_log_error "Decompression failed. Exit code: $extcode"
- exit 22
- fi
- fi
-
- if [[ $incremental -eq 1 ]];then
- # Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues.
- INNOAPPLY="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} \
- --ibbackup=xtrabackup_55 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log"
- fi
-
- wsrep_log_info "Preparing the backup at ${DATA}"
- timeit "Xtrabackup prepare stage" "$INNOAPPLY"
-
- if [[ $incremental -eq 1 ]];then
- wsrep_log_info "Cleaning up ${DATA} after incremental SST"
- [[ -d ${DATA} ]] && rm -rf ${DATA}
- DATA=$BDATA
- fi
-
- if [ $? -ne 0 ];
- then
- wsrep_log_error "${INNOBACKUPEX_BIN} finished with errors. Check ${DATA}/innobackup.prepare.log"
- exit 22
- fi
- else
- wsrep_log_info "${IST_FILE} received from donor: Running IST"
- fi
-
- if [[ ! -r ${MAGIC_FILE} ]];then
- wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable"
- exit 2
- fi
-
- cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id
- wsrep_log_info "Total time on joiner: $totime seconds"
-fi
-
-exit 0
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 249ed48713a..2aa657ca14e 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -63,9 +63,7 @@ uint calc_days_in_year(uint year)
static const ulonglong C_KNOWN_FLAGS= C_TIME_NO_ZERO_IN_DATE |
C_TIME_NO_ZERO_DATE |
- C_TIME_INVALID_DATES |
- C_TIME_TIME_ONLY |
- C_TIME_DATETIME_ONLY;
+ C_TIME_INVALID_DATES;
#define C_FLAGS_OK(flags) (((flags) & ~C_KNOWN_FLAGS) == 0)
@@ -161,7 +159,8 @@ static int get_punct(const char **str, const char *end)
return 1;
}
-static int get_date_time_separator(uint *number_of_fields, ulonglong flags,
+static int get_date_time_separator(uint *number_of_fields,
+ my_bool punct_is_date_time_separator,
const char **str, const char *end)
{
const char *s= *str;
@@ -180,11 +179,11 @@ static int get_date_time_separator(uint *number_of_fields, ulonglong flags,
but
cast("11:11:11.12.12.12" as time) should give 11:11:11.12
that is, a punctuation character can be accepted as a date/time separator
- only if TIME_DATETIME_ONLY (see str_to_time) is not set.
+ only if "punct_is_date_time_separator" is set.
*/
if (my_ispunct(&my_charset_latin1, *s))
{
- if (flags & C_TIME_DATETIME_ONLY)
+ if (!punct_is_date_time_separator)
{
/* see above, returning 1 is not enough, we need hard abort here */
*number_of_fields= 0;
@@ -257,18 +256,39 @@ static void get_microseconds(ulong *val, MYSQL_TIME_STATUS *status,
*val= (ulong) (tmp * log_10_int[6 - (*str - start)]);
else
*val= tmp;
+ if (str[0] < end && my_isdigit(&my_charset_latin1, str[0][0]))
+ {
+ /*
+ We don't need the exact nanoseconds value.
+ Knowing the first digit is enough for rounding.
+ */
+ status->nanoseconds= 100 * (uint)(str[0][0] - '0');
+ }
if (skip_digits(str, end))
status->warnings|= MYSQL_TIME_NOTE_TRUNCATED;
}
static int check_time_range_internal(MYSQL_TIME *ltime,
- ulong max_hour, uint dec,
- int *warning);
+ ulong max_hour, ulong err_hour,
+ uint dec, int *warning);
int check_time_range(MYSQL_TIME *ltime, uint dec, int *warning)
{
- return check_time_range_internal(ltime, TIME_MAX_HOUR, dec, warning);
+ return check_time_range_internal(ltime, TIME_MAX_HOUR, UINT_MAX32,
+ dec, warning);
+}
+
+
+static my_bool
+set_neg(my_bool neg, MYSQL_TIME_STATUS *st, MYSQL_TIME *ltime)
+{
+ if ((ltime->neg= neg) && ltime->time_type != MYSQL_TIMESTAMP_TIME)
+ {
+ st->warnings|= MYSQL_TIME_WARN_OUT_OF_RANGE;
+ return TRUE;
+ }
+ return FALSE;
}
@@ -352,20 +372,51 @@ static my_bool find_body(my_bool *neg, const char *str, size_t length,
}
+typedef struct
+{
+ uint count_punct;
+ uint count_colon;
+ uint count_iso_date_time_separator;
+} MYSQL_TIME_USED_CHAR_STATISTICS;
+
+
+static void
+mysql_time_used_char_statistics_init(MYSQL_TIME_USED_CHAR_STATISTICS *to,
+ const char *str, const char *end)
+{
+ const char *s;
+ bzero((void *) to, sizeof(MYSQL_TIME_USED_CHAR_STATISTICS));
+ for (s= str; s < end; s++)
+ {
+ if (my_ispunct(&my_charset_latin1, *s))
+ to->count_punct++;
+ if (*s == ':')
+ to->count_colon++;
+ if (*s == 'T')
+ to->count_iso_date_time_separator++;
+ }
+}
+
+
static my_bool
-is_datetime_body_candidate(const char *str, size_t length)
+is_datetime_body_candidate(const char *str, size_t length,
+ my_bool allow_dates_delimited,
+ my_bool allow_dates_numeric)
{
static uint min_date_length= 5; /* '1-1-1' -> '0001-01-01' */
- uint pos;
+ uint pos, count_punct= 0;
+ uint date_time_separator_length= MY_TEST(!allow_dates_delimited);
if (length >= 12)
return TRUE;
/*
The shortest possible DATE is '1-1-1', which is 5 characters.
To make a full datetime it should be at least followed by a space or a 'T'.
+ To make a date it should be just not less that 5 characters.
*/
- if (length < min_date_length + 1/* DATE/TIME separator */)
+ if (length < min_date_length + date_time_separator_length &&
+ !allow_dates_numeric)
return FALSE;
- for (pos= min_date_length; pos < length; pos++)
+ for (pos= 0; pos < length; pos++)
{
if (str[pos] == 'T') /* Date/time separator */
return TRUE;
@@ -382,21 +433,23 @@ is_datetime_body_candidate(const char *str, size_t length)
TIME('111 11') -> 838:59:59 = 111 days 11 hours with overflow
TIME('1111 11') -> 838:59:59 = 1111 days 11 hours with overflow
*/
- for (pos= 0 ; pos < min_date_length; pos++)
- {
- if (my_ispunct(&my_charset_latin1, str[pos])) /* Can be a DATE */
- return TRUE;
- }
- return FALSE;
+ return count_punct > 0; /* Can be a DATE if already had separators*/
+ }
+ if (my_ispunct(&my_charset_latin1, str[pos]))
+ {
+ if (allow_dates_delimited && str[pos] != ':')
+ return TRUE;
+ count_punct++;
}
}
- return FALSE;
+ return allow_dates_numeric && count_punct == 0;
}
static my_bool
str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
- MYSQL_TIME *l_time, ulong max_hour,
+ MYSQL_TIME *l_time,
+ ulong max_hour, ulong err_hour,
MYSQL_TIME_STATUS *status,
const char **endptr);
@@ -414,6 +467,9 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
TIME_NO_ZERO_IN_DATE Don't allow partial dates
TIME_NO_ZERO_DATE Don't allow 0000-00-00 date
TIME_INVALID_DATES Allow 2000-02-31
+ punct_is_date_time_separator
+ Allow punctuation as a date/time separator,
+ or return a hard error.
status Conversion status
@@ -448,13 +504,20 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
static my_bool
str_to_datetime_or_date_body(const char *str, size_t length, MYSQL_TIME *l_time,
- ulonglong flags, MYSQL_TIME_STATUS *status)
+ ulonglong flags,
+ my_bool punct_is_date_time_separator,
+ MYSQL_TIME_STATUS *status,
+ uint *number_of_fields,
+ const char **endptr)
{
const char *end=str+length, *pos;
- uint number_of_fields= 0, digits, year_length, not_zero_date;
+ uint digits, year_length, not_zero_date;
+ int warn= 0;
DBUG_ENTER("str_to_datetime_or_date_body");
DBUG_ASSERT(C_FLAGS_OK(flags));
bzero(l_time, sizeof(*l_time));
+ *number_of_fields= 0;
+ *endptr= str;
/*
Calculate number of digits in first part.
@@ -482,49 +545,53 @@ str_to_datetime_or_date_body(const char *str, size_t length, MYSQL_TIME *l_time,
(only numbers like [YY]YYMMDD[T][hhmmss[.uuuuuu]])
*/
year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
- if (get_digits(&l_time->year, &number_of_fields, &str, end, year_length)
- || get_digits(&l_time->month, &number_of_fields, &str, end, 2)
- || get_digits(&l_time->day, &number_of_fields, &str, end, 2)
+ if (get_digits(&l_time->year, number_of_fields, &str, end, year_length)
+ || get_digits(&l_time->month, number_of_fields, &str, end, 2)
+ || get_digits(&l_time->day, number_of_fields, &str, end, 2)
|| get_maybe_T(&str, end)
- || get_digits(&l_time->hour, &number_of_fields, &str, end, 2)
- || get_digits(&l_time->minute, &number_of_fields, &str, end, 2)
- || get_digits(&l_time->second, &number_of_fields, &str, end, 2))
- status->warnings|= MYSQL_TIME_WARN_TRUNCATED;
+ || get_digits(&l_time->hour, number_of_fields, &str, end, 2)
+ || get_digits(&l_time->minute, number_of_fields, &str, end, 2)
+ || get_digits(&l_time->second, number_of_fields, &str, end, 2))
+ warn|= MYSQL_TIME_WARN_TRUNCATED;
}
else
{
const char *start= str;
- if (get_number(&l_time->year, &number_of_fields, &str, end))
- status->warnings|= MYSQL_TIME_WARN_TRUNCATED;
+ if (get_number(&l_time->year, number_of_fields, &str, end))
+ warn|= MYSQL_TIME_WARN_TRUNCATED;
year_length= (uint)(str - start);
- if (!status->warnings &&
+ if (!warn &&
(get_punct(&str, end)
- || get_number(&l_time->month, &number_of_fields, &str, end)
+ || get_number(&l_time->month, number_of_fields, &str, end)
|| get_punct(&str, end)
- || get_number(&l_time->day, &number_of_fields, &str, end)
- || get_date_time_separator(&number_of_fields, flags, &str, end)
- || get_number(&l_time->hour, &number_of_fields, &str, end)
+ || get_number(&l_time->day, number_of_fields, &str, end)
+ || get_date_time_separator(number_of_fields,
+ punct_is_date_time_separator, &str, end)
+ || get_number(&l_time->hour, number_of_fields, &str, end)
|| get_punct(&str, end)
- || get_number(&l_time->minute, &number_of_fields, &str, end)
+ || get_number(&l_time->minute, number_of_fields, &str, end)
|| get_punct(&str, end)
- || get_number(&l_time->second, &number_of_fields, &str, end)))
- status->warnings|= MYSQL_TIME_WARN_TRUNCATED;
+ || get_number(&l_time->second, number_of_fields, &str, end)))
+ warn|= MYSQL_TIME_WARN_TRUNCATED;
}
+ status->warnings|= warn;
+ *endptr= str;
/* we're ok if date part is correct. even if the rest is truncated */
- if (number_of_fields < 3)
+ if (*number_of_fields < 3)
{
l_time->time_type= MYSQL_TIMESTAMP_NONE;
status->warnings|= MYSQL_TIME_WARN_TRUNCATED;
DBUG_RETURN(TRUE);
}
- if (!status->warnings && str < end && *str == '.')
+ if (!warn && str < end && *str == '.')
{
str++;
get_microseconds(&l_time->second_part, status,
- &number_of_fields, &str, end);
+ number_of_fields, &str, end);
+ *endptr= str;
}
not_zero_date = l_time->year || l_time->month || l_time->day ||
@@ -544,7 +611,7 @@ str_to_datetime_or_date_body(const char *str, size_t length, MYSQL_TIME *l_time,
if (check_date(l_time, not_zero_date, flags, &status->warnings))
goto err;
- l_time->time_type= (number_of_fields <= 3 ?
+ l_time->time_type= (*number_of_fields <= 3 ?
MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME);
if (str != end)
@@ -587,27 +654,104 @@ err:
TRUE on error
*/
-my_bool str_to_datetime_or_date_or_time_body(const char *str, size_t length,
- MYSQL_TIME *l_time,
- ulonglong fuzzydate,
- MYSQL_TIME_STATUS *status)
+static my_bool
+str_to_datetime_or_date_or_time_body(const char *str, size_t length,
+ MYSQL_TIME *l_time,
+ ulonglong fuzzydate,
+ MYSQL_TIME_STATUS *status,
+ ulong time_max_hour,
+ ulong time_err_hour,
+ my_bool allow_dates_delimited,
+ my_bool allow_dates_numeric)
{
const char *endptr;
DBUG_ASSERT(C_FLAGS_OK(fuzzydate));
/* Check first if this is a full TIMESTAMP */
- if (is_datetime_body_candidate(str, length))
+ if (is_datetime_body_candidate(str, length,
+ allow_dates_delimited,
+ allow_dates_numeric))
{ /* Probably full timestamp */
- (void) str_to_datetime_or_date_body(str, length, l_time,
- (fuzzydate & ~C_TIME_TIME_ONLY) |
- C_TIME_DATETIME_ONLY,
- status);
- if (l_time->time_type >= MYSQL_TIMESTAMP_ERROR)
- return l_time->time_type == MYSQL_TIMESTAMP_ERROR;
+ int warn_copy= status->warnings; /* could already be set by find_body() */
+ uint number_of_fields;
+ (void) str_to_datetime_or_date_body(str, length, l_time, fuzzydate,
+ FALSE, status,
+ &number_of_fields, &endptr);
+ DBUG_ASSERT(endptr >= str);
+ DBUG_ASSERT(endptr <= str + length);
+ switch (l_time->time_type) {
+ case MYSQL_TIMESTAMP_DATETIME:
+ return FALSE;
+ case MYSQL_TIMESTAMP_DATE:
+ {
+ /*
+ Successfully parsed as DATE, but it can also be a TIME:
+ '24:02:03' - continue and parse as TIME
+ '24:02:03 garbage /////' - continue and parse as TIME
+ '24:02:03T' - return DATE
+ '24-02-03' - return DATE
+ '24/02/03' - return DATE
+ '11111' - return DATE
+ */
+ MYSQL_TIME_USED_CHAR_STATISTICS used_chars;
+ mysql_time_used_char_statistics_init(&used_chars, str, endptr);
+ if (used_chars.count_iso_date_time_separator || !used_chars.count_colon)
+ return FALSE;
+ }
+ break;
+ case MYSQL_TIMESTAMP_ERROR:
+ {
+ MYSQL_TIME_USED_CHAR_STATISTICS used_chars;
+ /*
+ Check if it parsed as DATETIME but then failed as out of range:
+ '2011-02-32 8:46:06.23434' - return error
+ */
+ if (number_of_fields > 3)
+ return TRUE;
+ /*
+ Check if it parsed as DATE but then failed as out of range:
+ '100000:02:03' - continue and parse as TIME
+ '100000:02:03T' - return error
+ '100000/02/03' - return error
+ '100000-02-03' - return error
+ */
+ mysql_time_used_char_statistics_init(&used_chars, str, endptr);
+ if (used_chars.count_iso_date_time_separator || !used_chars.count_colon)
+ return TRUE;
+ }
+ break;
+ case MYSQL_TIMESTAMP_NONE:
+ {
+ if (allow_dates_numeric && endptr >= str + length)
+ {
+ /*
+ For backward compatibility this parses as DATE and fails:
+ EXTRACT(DAY FROM '1111') -- return error
+ EXTRACT(DAY FROM '1') -- return error
+ */
+ MYSQL_TIME_USED_CHAR_STATISTICS used_chars;
+ mysql_time_used_char_statistics_init(&used_chars, str, endptr);
+ if (!used_chars.count_iso_date_time_separator &&
+ !used_chars.count_colon &&
+ !used_chars.count_punct)
+ return TRUE;
+ }
+ /*
+ - '256 10:30:30' - continue and parse as TIME
+ - '4294967296:59:59.123456456' - continue and parse as TIME
+ */
+ }
+ break;
+ case MYSQL_TIMESTAMP_TIME:
+ DBUG_ASSERT(0);
+ break;
+ }
my_time_status_init(status);
+ status->warnings= warn_copy;
}
- if (!str_to_DDhhmmssff_internal(FALSE, str, length, l_time, TIME_MAX_HOUR,
+ if (!str_to_DDhhmmssff_internal(FALSE, str, length, l_time,
+ time_max_hour, time_err_hour,
status, &endptr))
return FALSE;
@@ -616,25 +760,28 @@ my_bool str_to_datetime_or_date_or_time_body(const char *str, size_t length,
}
+/*
+ Convert a string with INTERVAL DAY TO SECOND to MYSQL_TIME.
+ Input format: [-][DD ]hh:mm:ss.ffffff
+
+ If the input string appears to be a DATETIME, error is returned.
+*/
my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *ltime,
ulong max_hour, MYSQL_TIME_STATUS *status)
{
my_bool neg;
const char *endptr;
- int warn;
my_time_status_init(status);
- if (find_body(&neg, str, length, ltime, &warn, &str, &length))
- {
- status->warnings= warn;
+ if (find_body(&neg, str, length, ltime, &status->warnings, &str, &length))
return TRUE;
- }
/* Reject anything that might be parsed as a full TIMESTAMP */
- if (is_datetime_body_candidate(str, length))
+ if (is_datetime_body_candidate(str, length, FALSE, FALSE))
{
- (void) str_to_datetime_or_date_body(str, length, ltime,
- C_TIME_DATETIME_ONLY, status);
+ uint number_of_fields;
+ (void) str_to_datetime_or_date_body(str, length, ltime, 0, FALSE,
+ status, &number_of_fields, &endptr);
if (ltime->time_type > MYSQL_TIMESTAMP_ERROR)
{
status->warnings|= MYSQL_TIME_WARN_TRUNCATED;
@@ -650,70 +797,117 @@ my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *ltime,
will scan only '2001'.
*/
if (str_to_DDhhmmssff_internal(neg, str, length, ltime, max_hour,
- status, &endptr) ||
+ UINT_MAX32, status, &endptr) ||
(endptr < str + length && endptr[0] == '-'))
return TRUE;
- status->warnings|= warn;
return FALSE;
}
-my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time,
- ulonglong fuzzydate, MYSQL_TIME_STATUS *status)
+my_bool
+str_to_datetime_or_date_or_time(const char *str, size_t length,
+ MYSQL_TIME *to, ulonglong mode,
+ MYSQL_TIME_STATUS *status,
+ ulong time_max_hour,
+ ulong time_err_hour)
{
my_bool neg;
- int warn;
- DBUG_ASSERT(C_FLAGS_OK(fuzzydate));
+ DBUG_ASSERT(C_FLAGS_OK(mode));
+ my_time_status_init(status);
+ return
+ find_body(&neg, str, length, to, &status->warnings, &str, &length) ||
+ str_to_datetime_or_date_or_time_body(str, length, to, mode, status,
+ time_max_hour, time_err_hour,
+ FALSE, FALSE) ||
+ set_neg(neg, status, to);
+}
+
+
+my_bool
+str_to_datetime_or_date_or_interval_hhmmssff(const char *str, size_t length,
+ MYSQL_TIME *to, ulonglong mode,
+ MYSQL_TIME_STATUS *status,
+ ulong time_max_hour,
+ ulong time_err_hour)
+{
+ my_bool neg;
+ DBUG_ASSERT(C_FLAGS_OK(mode));
+ my_time_status_init(status);
+ return
+ find_body(&neg, str, length, to, &status->warnings, &str, &length) ||
+ str_to_datetime_or_date_or_time_body(str, length, to, mode, status,
+ time_max_hour, time_err_hour,
+ TRUE, FALSE) ||
+ set_neg(neg, status, to);
+}
+
+
+my_bool
+str_to_datetime_or_date_or_interval_day(const char *str, size_t length,
+ MYSQL_TIME *to, ulonglong mode,
+ MYSQL_TIME_STATUS *status,
+ ulong time_max_hour,
+ ulong time_err_hour)
+{
+ my_bool neg;
+ DBUG_ASSERT(C_FLAGS_OK(mode));
my_time_status_init(status);
- if (find_body(&neg, str, length, l_time, &warn, &str, &length))
- {
- status->warnings= warn;
- return TRUE;
- }
/*
- QQ: Perhaps we should modify xxx_body() to return endptr.
- If endptr points to '-', return an error.
+ For backward compatibility we allow to parse non-delimited
+ values as DATE rather than as TIME:
+ EXTRACT(DAY FROM '11111')
*/
- if (str_to_datetime_or_date_or_time_body(str, length, l_time,
- fuzzydate, status))
- return TRUE;
- status->warnings|= warn;
- l_time->neg= neg;
- return FALSE;
+ return
+ find_body(&neg, str, length, to, &status->warnings, &str, &length) ||
+ str_to_datetime_or_date_or_time_body(str, length, to, mode, status,
+ time_max_hour, time_err_hour,
+ TRUE, TRUE) ||
+ set_neg(neg, status, to);
}
my_bool
-str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time,
- ulonglong flags, MYSQL_TIME_STATUS *status)
+str_to_datetime_or_date(const char *str, size_t length, MYSQL_TIME *l_time,
+ ulonglong flags, MYSQL_TIME_STATUS *status)
{
- my_bool neg, rc;
- int warn;
+ my_bool neg;
+ uint number_of_fields;
+ const char *endptr;
DBUG_ASSERT(C_FLAGS_OK(flags));
my_time_status_init(status);
- if (find_body(&neg, str, length, l_time, &warn, &str, &length))
- {
- status->warnings= warn;
- return TRUE;
- }
- rc= (flags & C_TIME_TIME_ONLY) ?
- str_to_datetime_or_date_or_time_body(str, length, l_time, flags, status) :
- str_to_datetime_or_date_body(str, length, l_time, flags, status);
- status->warnings|= warn;
- if (rc)
- return rc;
- if ((l_time->neg= neg) && l_time->time_type != MYSQL_TIMESTAMP_TIME)
- {
- status->warnings|= MYSQL_TIME_WARN_OUT_OF_RANGE;
- return TRUE;
- }
- return FALSE;
+ return
+ find_body(&neg, str, length, l_time, &status->warnings, &str, &length) ||
+ str_to_datetime_or_date_body(str, length, l_time, flags, TRUE,
+ status, &number_of_fields, &endptr) ||
+ set_neg(neg, status, l_time);
}
+
+/**
+ Convert a string to INTERVAL DAY TO SECOND.
+ Input format: [DD ]hh:mm:ss.ffffff
+
+ Datetime or date formats are not understood.
+
+ Optional leading spaces and signs must be scanned by the caller.
+ "str" should point to the first digit.
+
+ @param neg - set the value to be negative
+ @param str - the input string
+ @param length - length of "str"
+ @param[OUT] l_time - write the result here
+ @param max_hour - if the result hour value appears to be greater than
+ max_hour, then cut to result to 'max_hour:59:59.999999'
+ @param err_hour - if the hour appears to be greater than err_hour,
+ return an error (without cut)
+ @param status
+ @param endptr
+*/
static my_bool
str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
- MYSQL_TIME *l_time, ulong max_hour,
+ MYSQL_TIME *l_time,
+ ulong max_hour, ulong err_hour,
MYSQL_TIME_STATUS *status, const char **endptr)
{
ulong date[5];
@@ -801,7 +995,7 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length,
fractional:
/* Get fractional second part */
- if (!status->warnings && str < end && *str == '.')
+ if (str < end && *str == '.')
{
uint number_of_fields= 0;
str++;
@@ -866,7 +1060,8 @@ fractional:
*endptr= str;
/* Check if the value is valid and fits into MYSQL_TIME range */
- if (check_time_range_internal(l_time, max_hour, 6, &status->warnings))
+ if (check_time_range_internal(l_time, max_hour, err_hour,
+ 6, &status->warnings))
return TRUE;
/* Check if there is garbage at end of the MYSQL_TIME specification */
@@ -886,7 +1081,9 @@ err:
SYNOPSIS:
check_time_range_internal()
time pointer to MYSQL_TIME value
- ulong max_hour - maximum allowed hour value
+ ulong max_hour - maximum allowed hour value. if the hour is greater,
+ cut the time value to 'max_hour:59:59.999999'
+ ulong err_hour - if hour is greater than this value, return an error
uint dec
warning set MYSQL_TIME_WARN_OUT_OF_RANGE flag if the value is out of range
@@ -901,13 +1098,15 @@ err:
*/
int check_time_range_internal(struct st_mysql_time *my_time,
- ulong max_hour, uint dec, int *warning)
+ ulong max_hour, ulong err_hour,
+ uint dec, int *warning)
{
ulonglong hour;
static ulong max_sec_part[TIME_SECOND_PART_DIGITS+1]= {000000, 900000, 990000,
999000, 999900, 999990, 999999};
- if (my_time->minute >= 60 || my_time->second >= 60)
+ if (my_time->minute >= 60 || my_time->second >= 60 ||
+ my_time->hour > err_hour)
{
*warning|= MYSQL_TIME_WARN_TRUNCATED;
return 1;
@@ -1274,6 +1473,46 @@ static char* fmt_number(uint val, char *out, uint digits)
}
+static int my_mmssff_to_str(const MYSQL_TIME *ltime, char *to, uint fsp)
+{
+ char *pos= to;
+ if (fsp == AUTO_SEC_PART_DIGITS)
+ fsp= ltime->second_part ? TIME_SECOND_PART_DIGITS : 0;
+ DBUG_ASSERT(fsp <= TIME_SECOND_PART_DIGITS);
+ pos= fmt_number(ltime->minute, pos, 2);
+ *pos++= ':';
+ pos= fmt_number(ltime->second, pos, 2);
+ if (fsp)
+ {
+ *pos++= '.';
+ pos= fmt_number((uint)sec_part_shift(ltime->second_part, fsp), pos, fsp);
+ }
+ return (int) (pos - to);
+}
+
+
+int my_interval_DDhhmmssff_to_str(const MYSQL_TIME *ltime, char *to, uint fsp)
+{
+ uint hour= ltime->day * 24 + ltime->hour;
+ char *pos= to;
+ DBUG_ASSERT(!ltime->year);
+ DBUG_ASSERT(!ltime->month);
+
+ if(ltime->neg)
+ *pos++= '-';
+ if (hour >= 24)
+ {
+ pos= longlong10_to_str((longlong) hour / 24, pos, 10);
+ *pos++= ' ';
+ }
+ pos= fmt_number(hour % 24, pos, 2);
+ *pos++= ':';
+ pos+= my_mmssff_to_str(ltime, pos, fsp);
+ *pos= 0;
+ return (int) (pos-to);
+}
+
+
/*
Functions to convert time/date/datetime value to a string,
using default format.
@@ -1291,11 +1530,6 @@ int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits)
uint hour= day * 24 + l_time->hour;
char*pos= to;
- if (digits == AUTO_SEC_PART_DIGITS)
- digits= l_time->second_part ? TIME_SECOND_PART_DIGITS : 0;
-
- DBUG_ASSERT(digits <= TIME_SECOND_PART_DIGITS);
-
if(l_time->neg)
*pos++= '-';
@@ -1306,17 +1540,7 @@ int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits)
pos= fmt_number(hour, pos, 2);
*pos++= ':';
- pos= fmt_number(l_time->minute, pos, 2);
- *pos++= ':';
- pos= fmt_number(l_time->second, pos, 2);
-
- if (digits)
- {
- *pos++= '.';
- pos= fmt_number((uint)sec_part_shift(l_time->second_part, digits),
- pos, digits);
- }
-
+ pos+= my_mmssff_to_str(l_time, pos, digits);
*pos= 0;
return (int) (pos-to);
}
@@ -1338,12 +1562,6 @@ int my_date_to_str(const MYSQL_TIME *l_time, char *to)
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits)
{
char *pos= to;
-
- if (digits == AUTO_SEC_PART_DIGITS)
- digits= l_time->second_part ? TIME_SECOND_PART_DIGITS : 0;
-
- DBUG_ASSERT(digits <= TIME_SECOND_PART_DIGITS);
-
pos= fmt_number(l_time->year, pos, 4);
*pos++='-';
pos= fmt_number(l_time->month, pos, 2);
@@ -1352,17 +1570,7 @@ int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits)
*pos++=' ';
pos= fmt_number(l_time->hour, pos, 2);
*pos++= ':';
- pos= fmt_number(l_time->minute, pos, 2);
- *pos++= ':';
- pos= fmt_number(l_time->second, pos, 2);
-
- if (digits)
- {
- *pos++='.';
- pos= fmt_number((uint) sec_part_shift(l_time->second_part, digits), pos,
- digits);
- }
-
+ pos+= my_mmssff_to_str(l_time, pos, digits);
*pos= 0;
return (int)(pos - to);
}
@@ -1428,7 +1636,7 @@ int my_timeval_to_str(const struct timeval *tm, char *to, uint dec)
representation and form value of DATETIME type as side-effect.
SYNOPSIS
- number_to_datetime()
+ number_to_datetime_or_date()
nr - datetime value as number
time_res - pointer for structure for broken-down representation
flags - flags to use in validating date, as in str_to_datetime()
@@ -1449,8 +1657,9 @@ int my_timeval_to_str(const struct timeval *tm, char *to, uint dec)
Datetime value in YYYYMMDDHHMMSS format.
*/
-longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
- ulonglong flags, int *was_cut)
+longlong number_to_datetime_or_date(longlong nr, ulong sec_part,
+ MYSQL_TIME *time_res,
+ ulonglong flags, int *was_cut)
{
long part1,part2;
DBUG_ASSERT(C_FLAGS_OK(flags));
@@ -1554,22 +1763,20 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
0 time value is valid, but was possibly truncated
-1 time value is invalid
*/
-int number_to_time(my_bool neg, ulonglong nr, ulong sec_part,
- MYSQL_TIME *ltime, int *was_cut)
+int number_to_time_only(my_bool neg, ulonglong nr, ulong sec_part,
+ ulong max_hour, MYSQL_TIME *ltime, int *was_cut)
{
- if (nr > 9999999 && nr <= 99991231235959ULL && neg == 0)
- return number_to_datetime(nr, sec_part, ltime,
- C_TIME_INVALID_DATES, was_cut) < 0 ? -1 : 0;
-
+ static const ulonglong TIME_MAX_mmss= TIME_MAX_MINUTE*100 + TIME_MAX_SECOND;
+ ulonglong time_max_value= max_hour * 10000ULL + TIME_MAX_mmss;
*was_cut= 0;
ltime->year= ltime->month= ltime->day= 0;
ltime->time_type= MYSQL_TIMESTAMP_TIME;
ltime->neg= neg;
- if (nr > TIME_MAX_VALUE)
+ if (nr > time_max_value)
{
- nr= TIME_MAX_VALUE;
+ nr= time_max_value;
sec_part= TIME_MAX_SECOND_PART;
*was_cut= MYSQL_TIME_WARN_OUT_OF_RANGE;
}
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index b37962d0fc9..6cb78f4b7b3 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -16,21 +16,27 @@
IF(WITH_WSREP AND NOT EMBEDDED_LIBRARY)
- SET(WSREP_INCLUDES ${CMAKE_SOURCE_DIR}/wsrep)
SET(WSREP_SOURCES
+ wsrep_client_service.cc
+ wsrep_high_priority_service.cc
+ wsrep_server_service.cc
+ wsrep_storage_service.cc
+ wsrep_server_state.cc
+ wsrep_utils.cc
+ wsrep_xid.cc
wsrep_check_opts.cc
- wsrep_hton.cc
- wsrep_mysqld.cc
+ wsrep_mysqld.cc
wsrep_notify.cc
wsrep_sst.cc
- wsrep_utils.cc
wsrep_var.cc
wsrep_binlog.cc
wsrep_applier.cc
wsrep_thd.cc
- wsrep_xid.cc
+ wsrep_schema.cc
+ wsrep_plugin.cc
+ service_wsrep.cc
)
- SET(WSREP_LIB wsrep)
+ SET(WSREP_LIB wsrep-lib wsrep_api_v26)
ELSE()
SET(WSREP_SOURCES wsrep_dummy.cc)
ENDIF()
@@ -42,7 +48,6 @@ ${PCRE_INCLUDES}
${ZLIB_INCLUDE_DIR}
${SSL_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/sql
-${WSREP_INCLUDES}
)
@@ -137,7 +142,7 @@ SET (SQL_SOURCE
rowid_filter.cc rowid_filter.h
${WSREP_SOURCES}
table_cache.cc encryption.cc temporary_tables.cc
- proxy_protocol.cc
+ proxy_protocol.cc backup.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.cc
@@ -491,9 +496,11 @@ IF(WIN32)
ADD_LIBRARY(winservice STATIC winservice.c)
TARGET_LINK_LIBRARIES(winservice shell32)
+
MYSQL_ADD_EXECUTABLE(mysql_upgrade_service
mysql_upgrade_service.cc
- COMPONENT Server)
+ upgrade_conf_file.cc
+ COMPONENT Server)
TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys winservice)
ENDIF(WIN32)
diff --git a/sql/backup.cc b/sql/backup.cc
new file mode 100644
index 00000000000..99c18e1260b
--- /dev/null
+++ b/sql/backup.cc
@@ -0,0 +1,385 @@
+/* Copyright (c) 2018, MariaDB Corporation
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/*
+ Implementation of BACKUP STAGE, an interface for external backup tools.
+
+ TODO:
+ - At backup_start() we call ha_prepare_for_backup() for all active
+ storage engines. If someone tries to load a new storage engine
+ that requires prepare_for_backup() for it to work, that storage
+ engines has to be blocked from loading until backup finishes.
+ As we currently don't have any loadable storage engine that
+ requires this and we have not implemented that part.
+ This can easily be done by adding a
+ PLUGIN_CANT_BE_LOADED_WHILE_BACKUP_IS_RUNNING flag to
+ maria_declare_plugin and check this before calling
+ plugin_initialize()
+*/
+
+#include "mariadb.h"
+#include "sql_class.h"
+#include "sql_base.h" // flush_tables
+#include "sql_insert.h" // kill_delayed_threads
+#include "sql_handler.h" // mysql_ha_cleanup_no_free
+#include <my_sys.h>
+
+static const char *stage_names[]=
+{"START", "FLUSH", "BLOCK_DDL", "BLOCK_COMMIT", "END", 0};
+
+TYPELIB backup_stage_names=
+{ array_elements(stage_names)-1, "", stage_names, 0 };
+
+static MDL_ticket *backup_flush_ticket;
+
+static bool backup_start(THD *thd);
+static bool backup_flush(THD *thd);
+static bool backup_block_ddl(THD *thd);
+static bool backup_block_commit(THD *thd);
+
+/**
+ Run next stage of backup
+*/
+
+void backup_init()
+{
+ backup_flush_ticket= 0;
+}
+
+bool run_backup_stage(THD *thd, backup_stages stage)
+{
+ backup_stages next_stage;
+ DBUG_ENTER("run_backup_stage");
+
+ if (thd->current_backup_stage == BACKUP_FINISHED)
+ {
+ if (stage != BACKUP_START)
+ {
+ my_error(ER_BACKUP_NOT_RUNNING, MYF(0));
+ DBUG_RETURN(1);
+ }
+ next_stage= BACKUP_START;
+ }
+ else
+ {
+ if ((uint) thd->current_backup_stage >= (uint) stage)
+ {
+ my_error(ER_BACKUP_WRONG_STAGE, MYF(0), stage_names[stage],
+ stage_names[thd->current_backup_stage]);
+ DBUG_RETURN(1);
+ }
+ if (stage == BACKUP_END)
+ {
+ /*
+ If end is given, jump directly to stage end. This is to allow one
+ to abort backup quickly.
+ */
+ next_stage= stage;
+ }
+ else
+ {
+ /* Go trough all not used stages until we reach 'stage' */
+ next_stage= (backup_stages) ((uint) thd->current_backup_stage + 1);
+ }
+ }
+
+ do
+ {
+ bool res;
+ backup_stages previous_stage= thd->current_backup_stage;
+ thd->current_backup_stage= next_stage;
+ switch (next_stage) {
+ case BACKUP_START:
+ if (!(res= backup_start(thd)))
+ break;
+ /* Reset backup stage to start for next backup try */
+ previous_stage= BACKUP_FINISHED;
+ break;
+ case BACKUP_FLUSH:
+ res= backup_flush(thd);
+ break;
+ case BACKUP_WAIT_FOR_FLUSH:
+ res= backup_block_ddl(thd);
+ break;
+ case BACKUP_LOCK_COMMIT:
+ res= backup_block_commit(thd);
+ break;
+ case BACKUP_END:
+ res= backup_end(thd);
+ break;
+ case BACKUP_FINISHED:
+ DBUG_ASSERT(0);
+ res= 0;
+ }
+ if (res)
+ {
+ thd->current_backup_stage= previous_stage;
+ my_error(ER_BACKUP_STAGE_FAILED, MYF(0), stage_names[(uint) stage]);
+ DBUG_RETURN(1);
+ }
+ next_stage= (backup_stages) ((uint) next_stage + 1);
+ } while ((uint) next_stage <= (uint) stage);
+
+ DBUG_RETURN(0);
+}
+
+
+/**
+ Start the backup
+
+ - Wait for previous backup to stop running
+ - Start service to log changed tables (TODO)
+ - Block purge of redo files (Required at least for Aria)
+ - An handler can optionally do a checkpoint of all tables,
+ to speed up the recovery stage of the backup.
+*/
+
+static bool backup_start(THD *thd)
+{
+ MDL_request mdl_request;
+ DBUG_ENTER("backup_start");
+
+ thd->current_backup_stage= BACKUP_FINISHED; // For next test
+ if (thd->has_read_only_protection())
+ DBUG_RETURN(1);
+ thd->current_backup_stage= BACKUP_START;
+
+ if (thd->locked_tables_mode)
+ {
+ my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
+ DBUG_RETURN(1);
+ }
+
+ mdl_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_START, MDL_EXPLICIT);
+ if (thd->mdl_context.acquire_lock(&mdl_request,
+ thd->variables.lock_wait_timeout))
+ DBUG_RETURN(1);
+
+ backup_flush_ticket= mdl_request.ticket;
+
+ ha_prepare_for_backup();
+ DBUG_RETURN(0);
+}
+
+/**
+ backup_flush()
+
+ - FLUSH all changes for not active non transactional tables, except
+ for statistics and log tables. Close the tables, to ensure they
+ are marked as closed after backup.
+
+ - BLOCK all NEW write locks for all non transactional tables
+ (except statistics and log tables). Already granted locks are
+ not affected (Running statements with non transaction tables will
+ continue running).
+
+ - The following DDL's doesn't have to be blocked as they can't set
+ the table in a non consistent state:
+ CREATE, RENAME, DROP
+*/
+
+static bool backup_flush(THD *thd)
+{
+ DBUG_ENTER("backup_flush");
+ /*
+ Lock all non transactional normal tables to be used in new DML's
+ */
+ if (thd->mdl_context.upgrade_shared_lock(backup_flush_ticket,
+ MDL_BACKUP_FLUSH,
+ thd->variables.lock_wait_timeout))
+ DBUG_RETURN(1);
+
+ /*
+ Free unused tables and table shares so that mariabackup knows what
+ is safe to copy
+ */
+ tc_purge(false);
+ tdc_purge(true);
+
+ DBUG_RETURN(0);
+}
+
+/**
+ backup_block_ddl()
+
+ - Kill all insert delay handlers, to ensure that all non transactional
+ tables are closed (can be improved in the future).
+
+ - Close handlers as other threads may wait for these, which can cause deadlocks.
+
+ - Wait for all statements using write locked non-transactional tables to end.
+
+ - Mark all not used active non transactional tables (except
+ statistics and log tables) to be closed with
+ handler->extra(HA_EXTRA_FLUSH)
+
+ - Block TRUNCATE TABLE, CREATE TABLE, DROP TABLE and RENAME
+ TABLE. Block also start of a new ALTER TABLE and the final rename
+ phase of ALTER TABLE. Running ALTER TABLES are not blocked. Both normal
+ and inline ALTER TABLE'S should be blocked when copying is completed but
+ before final renaming of the tables / new table is activated.
+ This will probably require a callback from the InnoDB code.
+*/
+
+static bool backup_block_ddl(THD *thd)
+{
+ DBUG_ENTER("backup_block_ddl");
+
+ kill_delayed_threads();
+ mysql_ha_cleanup_no_free(thd);
+
+ /* Wait until all non trans statements has ended */
+ if (thd->mdl_context.upgrade_shared_lock(backup_flush_ticket,
+ MDL_BACKUP_WAIT_FLUSH,
+ thd->variables.lock_wait_timeout))
+ DBUG_RETURN(1);
+
+ /*
+ Remove not used tables from the table share. Flush all changes to
+ non transaction tables and mark those that are not in use in write
+ operations as closed. From backup purposes it's not critical if
+ flush_tables() returns an error. It's ok to continue with next
+ backup stage even if we got an error.
+ */
+ (void) flush_tables(thd, FLUSH_NON_TRANS_TABLES);
+
+ /*
+ block new DDL's, in addition to all previous blocks
+ We didn't do this lock above, as we wanted DDL's to be executed while
+ we wait for non transactional tables (which may take a while).
+ */
+ if (thd->mdl_context.upgrade_shared_lock(backup_flush_ticket,
+ MDL_BACKUP_WAIT_DDL,
+ thd->variables.lock_wait_timeout))
+ {
+ /*
+ Could be a timeout. Downgrade lock to what is was before this function
+ was called so that this function can be called again
+ */
+ backup_flush_ticket->downgrade_lock(MDL_BACKUP_FLUSH);
+ DBUG_RETURN(1);
+ }
+ DBUG_RETURN(0);
+}
+
+/**
+ backup_block_commit()
+
+ Block commits, writes to log and statistics tables and binary log
+*/
+
+static bool backup_block_commit(THD *thd)
+{
+ DBUG_ENTER("backup_block_commit");
+ if (thd->mdl_context.upgrade_shared_lock(backup_flush_ticket,
+ MDL_BACKUP_WAIT_COMMIT,
+ thd->variables.lock_wait_timeout))
+ DBUG_RETURN(1);
+ flush_tables(thd, FLUSH_SYS_TABLES);
+ DBUG_RETURN(0);
+}
+
+/**
+ backup_end()
+
+ Safe to run, even if backup has not been run by this thread.
+ This is for example the case when a THD ends.
+*/
+
+bool backup_end(THD *thd)
+{
+ DBUG_ENTER("backup_end");
+
+ if (thd->current_backup_stage != BACKUP_FINISHED)
+ {
+ ha_end_backup();
+ thd->current_backup_stage= BACKUP_FINISHED;
+ thd->mdl_context.release_lock(backup_flush_ticket);
+ }
+ DBUG_RETURN(0);
+}
+
+
+/**
+ backup_set_alter_copy_lock()
+
+ @param thd
+ @param table From table that is part of ALTER TABLE. This is only used
+ for the assert to ensure we use this function correctly.
+
+ Downgrades the MDL_BACKUP_DDL lock to MDL_BACKUP_ALTER_COPY to allow
+ copy of altered table to proceed under MDL_BACKUP_WAIT_DDL
+
+ Note that in some case when using non transactional tables,
+ the lock may be of type MDL_BACKUP_DML.
+*/
+
+void backup_set_alter_copy_lock(THD *thd, TABLE *table)
+{
+ MDL_ticket *ticket= thd->mdl_backup_ticket;
+
+ /* Ticket maybe NULL in case of LOCK TABLES or for temporary tables*/
+ DBUG_ASSERT(ticket || thd->locked_tables_mode ||
+ table->s->tmp_table != NO_TMP_TABLE);
+ if (ticket)
+ ticket->downgrade_lock(MDL_BACKUP_ALTER_COPY);
+}
+
+/**
+ backup_reset_alter_copy_lock
+
+ Upgrade the lock of the original ALTER table MDL_BACKUP_DDL
+ Can fail if MDL lock was killed
+*/
+
+bool backup_reset_alter_copy_lock(THD *thd)
+{
+ bool res= 0;
+ MDL_ticket *ticket= thd->mdl_backup_ticket;
+
+ /* Ticket maybe NULL in case of LOCK TABLES or for temporary tables*/
+ if (ticket)
+ res= thd->mdl_context.upgrade_shared_lock(ticket, MDL_BACKUP_DDL,
+ thd->variables.lock_wait_timeout);
+ return res;
+}
+
+
+/*****************************************************************************
+ Backup locks
+ These functions are used by maria_backup to ensure that there are no active
+ ddl's on the object the backup is going to copy
+*****************************************************************************/
+
+
+bool backup_lock(THD *thd, TABLE_LIST *table)
+{
+ backup_unlock(thd);
+ table->mdl_request.duration= MDL_EXPLICIT;
+ if (thd->mdl_context.acquire_lock(&table->mdl_request,
+ thd->variables.lock_wait_timeout))
+ return 1;
+ thd->mdl_backup_lock= table->mdl_request.ticket;
+ return 0;
+}
+
+
+/* Release old backup lock if it exists */
+
+void backup_unlock(THD *thd)
+{
+ if (thd->mdl_backup_lock)
+ thd->mdl_context.release_lock(thd->mdl_backup_lock);
+ thd->mdl_backup_lock= 0;
+}
diff --git a/sql/backup.h b/sql/backup.h
new file mode 100644
index 00000000000..8d8a28b6082
--- /dev/null
+++ b/sql/backup.h
@@ -0,0 +1,34 @@
+#ifndef BACKUP_INCLUDED
+#define BACKUP_INCLUDED
+/* Copyright (c) 2018, MariaDB Corporation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+enum backup_stages
+{
+ BACKUP_START, BACKUP_FLUSH, BACKUP_WAIT_FOR_FLUSH, BACKUP_LOCK_COMMIT,
+ BACKUP_END, BACKUP_FINISHED
+};
+
+extern TYPELIB backup_stage_names;
+
+void backup_init();
+bool run_backup_stage(THD *thd, backup_stages stage);
+bool backup_end(THD *thd);
+void backup_set_alter_copy_lock(THD *thd, TABLE *altered_table);
+bool backup_reset_alter_copy_lock(THD *thd);
+
+bool backup_lock(THD *thd, TABLE_LIST *table);
+void backup_unlock(THD *thd);
+#endif /* BACKUP_INCLUDED */
diff --git a/sql/compat56.cc b/sql/compat56.cc
index d1cb8b0042c..1285de9fd12 100644
--- a/sql/compat56.cc
+++ b/sql/compat56.cc
@@ -20,6 +20,19 @@
#include "myisampack.h"
#include "my_time.h"
+
+static const int my_max_usec_value[7]
+{
+ 0,
+ 900000,
+ 990000,
+ 999000,
+ 999900,
+ 999990,
+ 999999
+};
+
+
/*** MySQL56 TIME low-level memory and disk representation routines ***/
/*
@@ -397,19 +410,21 @@ void my_timestamp_from_binary(struct timeval *tm, const uchar *ptr, uint dec)
case 0:
default:
tm->tv_usec= 0;
- break;
+ return;
case 1:
case 2:
tm->tv_usec= ((int) ptr[4]) * 10000;
break;
case 3:
case 4:
- tm->tv_usec= mi_sint2korr(ptr + 4) * 100;
+ tm->tv_usec= (uint) mi_uint2korr(ptr + 4) * 100;
break;
case 5:
case 6:
- tm->tv_usec= mi_sint3korr(ptr + 4);
+ tm->tv_usec= (uint) mi_uint3korr(ptr + 4);
}
+ // The binary data my be corrupt. Cut fractional seconds to the valid range.
+ set_if_smaller(tm->tv_usec, my_max_usec_value[dec]);
}
diff --git a/sql/compat56.h b/sql/compat56.h
index bb5e2670f7d..ff887ebf1bb 100644
--- a/sql/compat56.h
+++ b/sql/compat56.h
@@ -19,6 +19,15 @@
/** MySQL56 routines and macros **/
+
+/*
+ Buffer size for a native TIMESTAMP representation, for use with NativBuffer.
+ 4 bytes for seconds
+ 3 bytes for microseconds
+ 1 byte for the trailing '\0' (class Native reserves extra 1 byte for '\0')
+*/
+#define STRING_BUFFER_TIMESTAMP_BINARY_SIZE 8 /* 4 + 3 + 1 */
+
#define MY_PACKED_TIME_GET_INT_PART(x) ((x) >> 24)
#define MY_PACKED_TIME_GET_FRAC_PART(x) ((x) % (1LL << 24))
#define MY_PACKED_TIME_MAKE(i, f) ((((longlong) (i)) << 24) + (f))
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index a6803982171..6327cd138de 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -32,7 +32,9 @@
#include "event_db_repository.h"
#include "sp_head.h"
#include "sql_show.h" // append_definer, append_identifier
-
+#ifdef WITH_WSREP
+#include "wsrep_trans_observer.h"
+#endif /* WITH_WSREP */
/**
@addtogroup Event_Scheduler
@{
@@ -479,14 +481,24 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
uint not_used;
if (!starts_null)
{
- table->field[ET_FIELD_STARTS]->get_date(&time, TIME_NO_ZERO_DATE);
+ /*
+ The expected data type for these columns in mysql.events:
+ starts, ends, execute_at, last_executed
+ is DATETIME. No nanosecond truncation should normally be needed,
+ unless the DBA changes them, e.g. to VARCHAR, DECIMAL, etc.
+ For this unexpected case let's use the default round mode,
+ according to the current session settings.
+ */
+ table->field[ET_FIELD_STARTS]->get_date(&time, TIME_NO_ZERO_DATE |
+ thd->temporal_round_mode());
starts= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
ends_null= table->field[ET_FIELD_ENDS]->is_null();
if (!ends_null)
{
- table->field[ET_FIELD_ENDS]->get_date(&time, TIME_NO_ZERO_DATE);
+ table->field[ET_FIELD_ENDS]->get_date(&time, TIME_NO_ZERO_DATE |
+ thd->temporal_round_mode());
ends= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
@@ -502,8 +514,8 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
DBUG_ASSERT(!(starts_null && ends_null && !expression && execute_at_null));
if (!expression && !execute_at_null)
{
- if (table->field[ET_FIELD_EXECUTE_AT]->get_date(&time,
- TIME_NO_ZERO_DATE))
+ if (table->field[ET_FIELD_EXECUTE_AT]->get_date(&time, TIME_NO_ZERO_DATE |
+ thd->temporal_round_mode()))
DBUG_RETURN(TRUE);
execute_at= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
@@ -535,8 +547,8 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
if (!table->field[ET_FIELD_LAST_EXECUTED]->is_null())
{
- table->field[ET_FIELD_LAST_EXECUTED]->get_date(&time,
- TIME_NO_ZERO_DATE);
+ table->field[ET_FIELD_LAST_EXECUTED]->get_date(&time, TIME_NO_ZERO_DATE |
+ thd->temporal_round_mode());
last_executed= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
@@ -1343,6 +1355,10 @@ Event_job_data::execute(THD *thd, bool drop)
thd->reset_for_next_command();
+#ifdef WITH_WSREP
+ wsrep_open(thd);
+ wsrep_before_command(thd);
+#endif /* WITH_WSREP */
/*
MySQL parser currently assumes that current database is either
present in THD or all names in all statements are fully specified.
@@ -1517,6 +1533,10 @@ end:
if (save_sctx)
event_sctx.restore_security_context(thd, save_sctx);
#endif
+#ifdef WITH_WSREP
+ wsrep_after_command_ignore_result(thd);
+ wsrep_close(thd);
+#endif /* WITH_WSREP */
thd->lex->unit.cleanup();
thd->end_statement();
thd->cleanup_after_query();
diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc
index bfda8438885..00d625879de 100644
--- a/sql/event_parse_data.cc
+++ b/sql/event_parse_data.cc
@@ -216,7 +216,13 @@ Event_parse_data::init_execute_at(THD *thd)
(starts_null && ends_null)));
DBUG_ASSERT(starts_null && ends_null);
- if (item_execute_at->get_date(thd, &ltime, TIME_NO_ZERO_DATE))
+ /*
+ The expected data type is DATETIME. No nanoseconds truncation should
+ normally be needed. Using the default rounding mode.
+ See more comments in event_data_object.cc.
+ */
+ if (item_execute_at->get_date(thd, &ltime, TIME_NO_ZERO_DATE |
+ thd->temporal_round_mode()))
goto wrong_value;
ltime_utc= TIME_to_timestamp(thd,&ltime,&not_used);
@@ -378,7 +384,8 @@ Event_parse_data::init_starts(THD *thd)
if (item_starts->fix_fields(thd, &item_starts))
goto wrong_value;
- if (item_starts->get_date(thd, &ltime, TIME_NO_ZERO_DATE))
+ if (item_starts->get_date(thd, &ltime, TIME_NO_ZERO_DATE |
+ thd->temporal_round_mode()))
goto wrong_value;
ltime_utc= TIME_to_timestamp(thd, &ltime, &not_used);
@@ -433,7 +440,8 @@ Event_parse_data::init_ends(THD *thd)
goto error_bad_params;
DBUG_PRINT("info", ("convert to TIME"));
- if (item_ends->get_date(thd, &ltime, TIME_NO_ZERO_DATE))
+ if (item_ends->get_date(thd, &ltime, TIME_NO_ZERO_DATE |
+ thd->temporal_round_mode()))
goto error_bad_params;
ltime_utc= TIME_to_timestamp(thd, &ltime, &not_used);
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index f459fd34aee..99b3c9b93fb 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -150,7 +150,7 @@ deinit_event_thread(THD *thd)
{
thd->proc_info= "Clearing";
DBUG_PRINT("exit", ("Event thread finishing"));
- unlink_not_visible_thd(thd);
+ server_threads.erase(thd);
delete thd;
}
@@ -185,7 +185,7 @@ pre_init_event_thread(THD* thd)
thd->net.read_timeout= slave_net_timeout;
thd->variables.option_bits|= OPTION_AUTO_IS_NULL;
thd->client_capabilities|= CLIENT_MULTI_RESULTS;
- add_to_active_threads(thd);
+ server_threads.insert(thd);
/*
Guarantees that we will see the thread in SHOW PROCESSLIST though its
@@ -679,20 +679,20 @@ end:
Event_scheduler::workers_count()
*/
+static my_bool workers_count_callback(THD *thd, uint32_t *count)
+{
+ if (thd->system_thread == SYSTEM_THREAD_EVENT_WORKER)
+ ++*count;
+ return 0;
+}
+
+
uint
Event_scheduler::workers_count()
{
- THD *tmp;
- uint count= 0;
-
+ uint32_t count= 0;
DBUG_ENTER("Event_scheduler::workers_count");
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- if (tmp->system_thread == SYSTEM_THREAD_EVENT_WORKER)
- ++count;
- mysql_mutex_unlock(&LOCK_thread_count);
- DBUG_PRINT("exit", ("%d", count));
+ server_threads.iterate(workers_count_callback, &count);
DBUG_RETURN(count);
}
diff --git a/sql/field.cc b/sql/field.cc
index 7e27ed1bfc3..dd125a06bad 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -33,11 +33,6 @@
#include "rpl_rli.h" // Pull in Relay_log_info
#include "slave.h" // Pull in rpl_master_has_bug()
#include "strfunc.h" // find_type2, find_set
-#include "sql_time.h" // str_to_datetime_with_warn,
- // str_to_time_with_warn,
- // TIME_to_timestamp,
- // make_time, make_date,
- // make_truncated_value_warning
#include "tztime.h" // struct Time_zone
#include "filesort.h" // change_double_for_sort
#include "log_event.h" // class Table_map_log_event
@@ -62,12 +57,20 @@ const char field_separator=',';
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
((ulong) ((1LL << MY_MIN(arg, 4) * 8) - 1))
-#define ASSERT_COLUMN_MARKED_FOR_READ \
- DBUG_ASSERT(!table || !table->read_set || \
- bitmap_is_set(table->read_set, field_index))
-#define ASSERT_COLUMN_MARKED_FOR_WRITE \
- DBUG_ASSERT(is_stat_field || !table || !table->write_set || \
- bitmap_is_set(table->write_set, field_index))
+// Column marked for read or the field set to read out or record[0] or [1]
+#define ASSERT_COLUMN_MARKED_FOR_READ \
+ DBUG_ASSERT(!table || \
+ (!table->read_set || \
+ bitmap_is_set(table->read_set, field_index) || \
+ (!(ptr >= table->record[0] && \
+ ptr < table->record[0] + table->s->reclength))))
+
+#define ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED \
+ DBUG_ASSERT(is_stat_field || !table || \
+ (!table->write_set || \
+ bitmap_is_set(table->write_set, field_index) || \
+ (!(ptr >= table->record[0] && \
+ ptr < table->record[0] + table->s->reclength))))
#define FLAGSTR(S,F) ((S) & (F) ? #F " " : "")
@@ -1828,12 +1831,9 @@ int Field::store(const char *to, size_t length, CHARSET_INFO *cs,
}
-int Field::store_timestamp(my_time_t ts, ulong sec_part)
+int Field::store_timestamp_dec(const timeval &ts, uint dec)
{
- MYSQL_TIME ltime;
- THD *thd= get_thd();
- thd->timestamp_to_TIME(&ltime, ts, sec_part, date_mode_t(0));
- return store_time_dec(&ltime, decimals());
+ return store_time_dec(Datetime(get_thd(), ts).get_mysql_time(), dec);
}
/**
@@ -2034,7 +2034,7 @@ longlong Field::convert_decimal2longlong(const my_decimal *val,
int Field_int::store_decimal(const my_decimal *val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int err= 0;
longlong i= convert_decimal2longlong(val, unsigned_flag, &err);
return MY_TEST(err | store(i, unsigned_flag));
@@ -2069,7 +2069,7 @@ bool Field_int::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate)
ASSERT_COLUMN_MARKED_FOR_READ;
Longlong_hybrid nr(val_int(), (flags & UNSIGNED_FLAG));
return int_to_datetime_with_warn(get_thd(), nr, ltime,
- fuzzydate, field_name.str);
+ fuzzydate, table->s, field_name.str);
}
@@ -2201,7 +2201,7 @@ void Field_num::make_send_field(Send_field *field)
int Field_str::store_decimal(const my_decimal *d)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
double val;
/* TODO: use decimal2string? */
int err= warn_if_overflow(my_decimal2double(E_DEC_FATAL_ERROR &
@@ -2256,7 +2256,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
bool Field::get_date(MYSQL_TIME *to, date_mode_t mode)
{
StringBuffer<40> tmp;
- Temporal::Warn_push warn(get_thd(), NullS, to, mode);
+ Temporal::Warn_push warn(get_thd(), NULL, NullS, to, mode);
Temporal_hybrid *t= new(to) Temporal_hybrid(get_thd(), &warn,
val_str(&tmp), mode);
return !t->is_valid_temporal();
@@ -2271,7 +2271,7 @@ bool Field::get_date(MYSQL_TIME *to, date_mode_t mode)
int Field::store_time_dec(const MYSQL_TIME *ltime, uint dec)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
char buff[MAX_DATE_STRING_REP_LENGTH];
uint length= (uint) my_TIME_to_str(ltime, buff, dec);
/* Avoid conversion when field character set is ASCII compatible */
@@ -2528,7 +2528,7 @@ void Field_decimal::overflow(bool negative)
int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
char buff[STRING_BUFFER_USUAL_SIZE];
String tmp(buff,sizeof(buff), &my_charset_bin);
const uchar *from= (uchar*) from_arg;
@@ -2894,7 +2894,7 @@ int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
int Field_decimal::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
if (unsigned_flag && nr < 0)
{
overflow(1);
@@ -2932,7 +2932,7 @@ int Field_decimal::store(double nr)
int Field_decimal::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
char buff[22];
uint length, int_part;
char fyllchar;
@@ -3175,7 +3175,7 @@ void Field_new_decimal::set_value_on_overflow(my_decimal *decimal_value,
bool Field_new_decimal::store_value(const my_decimal *decimal_value,
int *native_error)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
DBUG_ENTER("Field_new_decimal::store_value");
#ifndef DBUG_OFF
@@ -3233,7 +3233,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
int Field_new_decimal::store(const char *from, size_t length,
CHARSET_INFO *charset_arg)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
my_decimal decimal_value;
THD *thd= get_thd();
DBUG_ENTER("Field_new_decimal::store(char*)");
@@ -3317,7 +3317,7 @@ int Field_new_decimal::store(const char *from, size_t length,
int Field_new_decimal::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
my_decimal decimal_value;
int err;
THD *thd= get_thd();
@@ -3342,7 +3342,7 @@ int Field_new_decimal::store(double nr)
int Field_new_decimal::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
my_decimal decimal_value;
int err;
@@ -3364,7 +3364,7 @@ int Field_new_decimal::store(longlong nr, bool unsigned_val)
int Field_new_decimal::store_decimal(const my_decimal *decimal_value)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
return store_value(decimal_value);
}
@@ -3581,7 +3581,7 @@ int Field_int::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
int Field_tiny::store(const char *from,size_t len,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error;
longlong rnd;
@@ -3593,7 +3593,7 @@ int Field_tiny::store(const char *from,size_t len,CHARSET_INFO *cs)
int Field_tiny::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
nr=rint(nr);
if (unsigned_flag)
@@ -3636,7 +3636,7 @@ int Field_tiny::store(double nr)
int Field_tiny::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
if (unsigned_flag)
@@ -3741,7 +3741,7 @@ void Field_tiny::sql_type(String &res) const
int Field_short::store(const char *from,size_t len,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int store_tmp;
int error;
longlong rnd;
@@ -3755,7 +3755,7 @@ int Field_short::store(const char *from,size_t len,CHARSET_INFO *cs)
int Field_short::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
int16 res;
nr=rint(nr);
@@ -3800,7 +3800,7 @@ int Field_short::store(double nr)
int Field_short::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
int16 res;
@@ -3915,7 +3915,7 @@ void Field_short::sql_type(String &res) const
int Field_medium::store(const char *from,size_t len,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int store_tmp;
int error;
longlong rnd;
@@ -3929,7 +3929,7 @@ int Field_medium::store(const char *from,size_t len,CHARSET_INFO *cs)
int Field_medium::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
nr=rint(nr);
if (unsigned_flag)
@@ -3975,7 +3975,7 @@ int Field_medium::store(double nr)
int Field_medium::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
if (unsigned_flag)
@@ -4113,7 +4113,7 @@ void Field_medium::sql_type(String &res) const
int Field_long::store(const char *from,size_t len,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
long store_tmp;
int error;
longlong rnd;
@@ -4127,7 +4127,7 @@ int Field_long::store(const char *from,size_t len,CHARSET_INFO *cs)
int Field_long::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
int32 res;
nr=rint(nr);
@@ -4172,7 +4172,7 @@ int Field_long::store(double nr)
int Field_long::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
int32 res;
@@ -4286,7 +4286,7 @@ void Field_long::sql_type(String &res) const
int Field_longlong::store(const char *from,size_t len,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
char *end;
ulonglong tmp;
@@ -4309,7 +4309,7 @@ int Field_longlong::store(const char *from,size_t len,CHARSET_INFO *cs)
int Field_longlong::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
Converter_double_to_longlong conv(nr, unsigned_flag);
if (unlikely(conv.error()))
@@ -4322,7 +4322,7 @@ int Field_longlong::store(double nr)
int Field_longlong::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
if (unlikely(nr < 0)) // Only possible error
@@ -4433,7 +4433,7 @@ void Field_longlong::sql_type(String &res) const
void Field_longlong::set_max()
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
set_notnull();
int8store(ptr, unsigned_flag ? ULONGLONG_MAX : LONGLONG_MAX);
}
@@ -4470,7 +4470,7 @@ int Field_float::store(const char *from,size_t len,CHARSET_INFO *cs)
int Field_float::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= truncate_double(&nr, field_length,
not_fixed ? NOT_FIXED_DEC : dec,
unsigned_flag, FLT_MAX);
@@ -4649,7 +4649,7 @@ int Field_double::store(const char *from,size_t len,CHARSET_INFO *cs)
int Field_double::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= truncate_double(&nr, field_length,
not_fixed ? NOT_FIXED_DEC : dec,
unsigned_flag, DBL_MAX);
@@ -4832,7 +4832,7 @@ bool Field_real::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate)
ASSERT_COLUMN_MARKED_FOR_READ;
double nr= val_real();
return double_to_datetime_with_warn(get_thd(), nr, ltime, fuzzydate,
- field_name.str);
+ table->s, field_name.str);
}
@@ -5011,7 +5011,7 @@ int Field_timestamp::save_in_field(Field *to)
{
ulong sec_part;
my_time_t ts= get_timestamp(&sec_part);
- return to->store_timestamp(ts, sec_part);
+ return to->store_timestamp_dec(Timeval(ts, sec_part), decimals());
}
my_time_t Field_timestamp::get_timestamp(const uchar *pos,
@@ -5023,17 +5023,26 @@ my_time_t Field_timestamp::get_timestamp(const uchar *pos,
}
+bool Field_timestamp::val_native(Native *to)
+{
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ my_time_t sec= (my_time_t) sint4korr(ptr);
+ return Timestamp_or_zero_datetime(Timestamp(sec, 0), sec == 0).
+ to_native(to, 0);
+}
+
+
int Field_timestamp::store_TIME_with_warning(THD *thd, const Datetime *dt,
const ErrConv *str, int was_cut)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
- static const timeval zero= {0, (uint) 0 };
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
+ static const Timestamp zero(0, 0);
// Handle totally bad values
if (!dt->is_valid_datetime())
{
- set_datetime_warning(WARN_DATA_TRUNCATED, str, MYSQL_TIMESTAMP_DATETIME, 1);
- store_TIMEVAL(zero);
+ set_datetime_warning(WARN_DATA_TRUNCATED, str, "datetime", 1);
+ store_TIMESTAMP(zero);
return 1;
}
@@ -5045,9 +5054,8 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, const Datetime *dt,
Return success or a warning about non-fatal truncation, e.g.:
INSERT INTO t1 (ts) VALUES ('0000-00-00 00:00:00 some tail');
*/
- store_TIMEVAL(zero);
- return store_TIME_return_code_with_warnings(was_cut, str,
- MYSQL_TIMESTAMP_DATETIME);
+ store_TIMESTAMP(zero);
+ return store_TIME_return_code_with_warnings(was_cut, str, "datetime");
}
// Convert DATETIME to TIMESTAMP
@@ -5056,30 +5064,30 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, const Datetime *dt,
my_time_t timestamp= TIME_to_timestamp(thd, l_time, &conversion_error);
if (timestamp == 0 && l_time->second_part == 0)
{
- set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE, str, MYSQL_TIMESTAMP_DATETIME, 1);
- store_TIMEVAL(zero);
+ set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE, str, "datetime", 1);
+ store_TIMESTAMP(zero);
return 1; // date was fine but pointed to a DST gap
}
// Store the value
DBUG_ASSERT(!dt->fraction_remainder(decimals()));
- store_TIMEVAL(Timeval(timestamp, l_time->second_part));
+ store_TIMESTAMP(Timestamp(timestamp, l_time->second_part));
// Calculate return value and send warnings if needed
if (unlikely(conversion_error)) // e.g. DATETIME in the DST gap
{
- set_datetime_warning(conversion_error, str, MYSQL_TIMESTAMP_DATETIME, 1);
+ set_datetime_warning(conversion_error, str, "datetime", 1);
return 1;
}
- return store_TIME_return_code_with_warnings(was_cut, str,
- MYSQL_TIMESTAMP_DATETIME);
+ return store_TIME_return_code_with_warnings(was_cut, str, "datetime");
}
-date_mode_t Field_timestamp::sql_mode_for_timestamp(THD *thd) const
+date_conv_mode_t Timestamp::sql_mode_for_timestamp(THD *thd)
{
// We don't want to store invalid or fuzzy datetime values in TIMESTAMP
- return date_mode_t((thd->variables.sql_mode & MODE_NO_ZERO_DATE) | MODE_NO_ZERO_IN_DATE);
+ return date_conv_mode_t((thd->variables.sql_mode & MODE_NO_ZERO_DATE) |
+ MODE_NO_ZERO_IN_DATE);
}
@@ -5088,7 +5096,7 @@ int Field_timestamp::store_time_dec(const MYSQL_TIME *ltime, uint dec)
int warn;
ErrConvTime str(ltime);
THD *thd= get_thd();
- Datetime dt(thd, &warn, ltime, sql_mode_for_timestamp(thd), decimals());
+ Datetime dt(thd, &warn, ltime, Timestamp::DatetimeOptions(thd), decimals());
return store_TIME_with_warning(thd, &dt, &str, warn);
}
@@ -5098,7 +5106,7 @@ int Field_timestamp::store(const char *from,size_t len,CHARSET_INFO *cs)
ErrConvString str(from, len, cs);
THD *thd= get_thd();
MYSQL_TIME_STATUS st;
- Datetime dt(&st, from, len, cs, sql_mode_for_timestamp(thd), decimals());
+ Datetime dt(thd, &st, from, len, cs, Timestamp::DatetimeOptions(thd), decimals());
return store_TIME_with_warning(thd, &dt, &str, st.warnings);
}
@@ -5108,7 +5116,7 @@ int Field_timestamp::store(double nr)
int error;
ErrConvDouble str(nr);
THD *thd= get_thd();
- Datetime dt(&error, Sec6(nr), sql_mode_for_timestamp(thd), decimals());
+ Datetime dt(thd, &error, nr, Timestamp::DatetimeOptions(thd), decimals());
return store_TIME_with_warning(thd, &dt, &str, error);
}
@@ -5116,26 +5124,67 @@ int Field_timestamp::store(double nr)
int Field_timestamp::store(longlong nr, bool unsigned_val)
{
int error;
- ErrConvInteger str(Longlong_hybrid(nr, unsigned_val));
+ Longlong_hybrid tmp(nr, unsigned_val);
+ ErrConvInteger str(tmp);
THD *thd= get_thd();
- Datetime dt(&error, Sec6(nr, unsigned_val), sql_mode_for_timestamp(thd));
+ Datetime dt(&error, tmp, Timestamp::DatetimeOptions(thd));
return store_TIME_with_warning(thd, &dt, &str, error);
}
-int Field_timestamp::store_timestamp(my_time_t ts, ulong sec_part)
+int Field_timestamp::store_timestamp_dec(const timeval &ts, uint dec)
{
- store_TIME(ts, sec_part);
- if (ts == 0 && sec_part == 0 &&
+ int warn= 0;
+ time_round_mode_t mode= Datetime::default_round_mode(get_thd());
+ store_TIMESTAMP(Timestamp(ts).round(decimals(), mode, &warn));
+ if (warn)
+ {
+ /*
+ We're here if rounding would overflow outside of the supported TIMESTAMP
+ range, so truncation happened instead:
+ CREATE TABLE t1 (a TIMESTAMP(6));
+ INSERT INTO t1 VALUES ('maximum-possible-timestamp.999999');
+ ALTER TABLE t1 MODIFY a TIMESTAMP(5);
+ SELECT * FROM t1; --> 'maximum-possible-timestamp.99999' (5 digits)
+ Raise a warning, like DATETIME does for '9999-12-31 23:59:59.999999'.
+ */
+ set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ }
+ if (ts.tv_sec == 0 && ts.tv_usec == 0 &&
get_thd()->variables.sql_mode & (ulonglong) TIME_NO_ZERO_DATE)
+ return zero_time_stored_return_code_with_warning();
+ return 0;
+}
+
+
+int Field_timestamp::zero_time_stored_return_code_with_warning()
+{
+ if (get_thd()->variables.sql_mode & (ulonglong) TIME_NO_ZERO_DATE)
{
ErrConvString s(
STRING_WITH_LEN("0000-00-00 00:00:00.000000") - (decimals() ? 6 - decimals() : 7),
system_charset_info);
- set_datetime_warning(WARN_DATA_TRUNCATED, &s, MYSQL_TIMESTAMP_DATETIME, 1);
+ set_datetime_warning(WARN_DATA_TRUNCATED, &s, "datetime", 1);
return 1;
}
return 0;
+
+}
+
+
+int Field_timestamp::store_native(const Native &value)
+{
+ if (!value.length()) // Zero datetime
+ {
+ reset();
+ return zero_time_stored_return_code_with_warning();
+ }
+ /*
+ The exact second precision is not important here.
+ Field_timestamp*::store_timestamp_dec() do not use the "dec" parameter.
+ Passing TIME_SECOND_PART_DIGITS is OK.
+ */
+ return store_timestamp_dec(Timestamp(value).tv(), TIME_SECOND_PART_DIGITS);
}
@@ -5148,7 +5197,7 @@ double Field_timestamp::val_real(void)
longlong Field_timestamp::val_int(void)
{
MYSQL_TIME ltime;
- if (get_date(&ltime, TIME_NO_ZERO_DATE))
+ if (get_date(&ltime, Datetime::Options(TIME_NO_ZERO_DATE, get_thd())))
return 0;
return ltime.year * 10000000000LL + ltime.month * 100000000LL +
@@ -5168,7 +5217,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
to= (char*) val_buffer->ptr();
val_buffer->length(field_length);
- if (get_date(&ltime, TIME_NO_ZERO_DATE))
+ if (get_date(&ltime, Datetime::Options(TIME_NO_ZERO_DATE, get_thd())))
{ /* Zero time is "000000" */
val_ptr->set(zero_timestamp, field_length, &my_charset_numeric);
return val_ptr;
@@ -5290,7 +5339,7 @@ void Field_timestamp::sql_type(String &res) const
int Field_timestamp::set_time()
{
set_notnull();
- store_TIME(get_thd()->query_start(), 0);
+ store_TIMESTAMP(Timestamp(get_thd()->query_start(), 0));
return 0;
}
@@ -5395,10 +5444,22 @@ my_time_t Field_timestamp_hires::get_timestamp(const uchar *pos,
return mi_uint4korr(pos);
}
+
+bool Field_timestamp_hires::val_native(Native *to)
+{
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ struct timeval tm;
+ tm.tv_sec= mi_uint4korr(ptr);
+ tm.tv_usec= (ulong) sec_part_unshift(read_bigendian(ptr+4, sec_part_bytes(dec)), dec);
+ return Timestamp_or_zero_datetime(Timestamp(tm), tm.tv_sec == 0).
+ to_native(to, dec);
+}
+
+
double Field_timestamp_with_dec::val_real(void)
{
MYSQL_TIME ltime;
- if (get_date(&ltime, TIME_NO_ZERO_DATE))
+ if (get_date(&ltime, Datetime::Options(TIME_NO_ZERO_DATE, get_thd())))
return 0;
return ltime.year * 1e10 + ltime.month * 1e8 +
@@ -5418,7 +5479,7 @@ int Field_timestamp::store_decimal(const my_decimal *d)
int error;
THD *thd= get_thd();
ErrConvDecimal str(d);
- Datetime dt(&error, Sec6(d), sql_mode_for_timestamp(thd), decimals());
+ Datetime dt(thd, &error, d, Timestamp::DatetimeOptions(thd), decimals());
return store_TIME_with_warning(thd, &dt, &str, error);
}
@@ -5427,7 +5488,8 @@ int Field_timestamp_with_dec::set_time()
THD *thd= get_thd();
set_notnull();
// Avoid writing microseconds into binlog for FSP=0
- store_TIME(thd->query_start(), decimals() ? thd->query_start_sec_part() : 0);
+ ulong msec= decimals() ? thd->query_start_sec_part() : 0;
+ store_TIMESTAMP(Timestamp(thd->query_start(), msec).trunc(decimals()));
return 0;
}
@@ -5471,7 +5533,7 @@ void Field_timestampf::store_TIMEVAL(const timeval &tm)
void Field_timestampf::set_max()
{
DBUG_ENTER("Field_timestampf::set_max");
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
DBUG_ASSERT(dec == TIME_SECOND_PART_DIGITS);
set_notnull();
@@ -5500,6 +5562,19 @@ my_time_t Field_timestampf::get_timestamp(const uchar *pos,
}
+bool Field_timestampf::val_native(Native *to)
+{
+ ASSERT_COLUMN_MARKED_FOR_READ;
+ // Check if it's '0000-00-00 00:00:00' rather than a real timestamp
+ if (ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0)
+ {
+ to->length(0);
+ return false;
+ }
+ return Field::val_native(to);
+}
+
+
/*************************************************************/
uint Field_temporal::is_equal(Create_field *new_field)
{
@@ -5510,7 +5585,7 @@ uint Field_temporal::is_equal(Create_field *new_field)
void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
const ErrConv *str, int was_cut,
- timestamp_type ts_type)
+ const char *typestr)
{
/*
error code logic:
@@ -5523,9 +5598,9 @@ void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
a DATE field and non-zero time part is thrown away.
*/
if (was_cut & MYSQL_TIME_WARN_TRUNCATED)
- set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED, str, ts_type, 1);
+ set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED, str, typestr, 1);
if (was_cut & MYSQL_TIME_WARN_OUT_OF_RANGE)
- set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE, str, ts_type, 1);
+ set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE, str, typestr, 1);
}
@@ -5543,16 +5618,15 @@ int Field_datetime::store_TIME_with_warning(const Datetime *dt,
const ErrConv *str,
int was_cut)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
// Handle totally bad values
if (!dt->is_valid_datetime())
- return store_invalid_with_warning(str, was_cut, MYSQL_TIMESTAMP_DATETIME);
+ return store_invalid_with_warning(str, was_cut, "datetime");
// Store the value
DBUG_ASSERT(!dt->fraction_remainder(decimals()));
- store_TIME(dt->get_mysql_time());
+ store_datetime(*dt);
// Caclulate return value and send warnings if needed
- return store_TIME_return_code_with_warnings(was_cut, str,
- MYSQL_TIMESTAMP_DATETIME);
+ return store_TIME_return_code_with_warnings(was_cut, str, "datetime");
}
@@ -5560,7 +5634,8 @@ int Field_datetime::store(const char *from, size_t len, CHARSET_INFO *cs)
{
MYSQL_TIME_STATUS st;
ErrConvString str(from, len, cs);
- Datetime dt(&st, from, len, cs, sql_mode_for_dates(get_thd()), decimals());
+ THD *thd= get_thd();
+ Datetime dt(thd, &st, from, len, cs, Datetime::Options(thd), decimals());
return store_TIME_with_warning(&dt, &str, st.warnings);
}
@@ -5568,7 +5643,8 @@ int Field_datetime::store(double nr)
{
int error;
ErrConvDouble str(nr);
- Datetime dt(&error, Sec6(nr), sql_mode_for_dates(get_thd()), decimals());
+ THD *thd= get_thd();
+ Datetime dt(thd, &error, nr, Datetime::Options(thd), decimals());
return store_TIME_with_warning(&dt, &str, error);
}
@@ -5576,8 +5652,10 @@ int Field_datetime::store(double nr)
int Field_datetime::store(longlong nr, bool unsigned_val)
{
int error;
- ErrConvInteger str(Longlong_hybrid(nr, unsigned_val));
- Datetime dt(&error, Sec6(nr, unsigned_val), sql_mode_for_dates(get_thd()));
+ Longlong_hybrid tmp(nr, unsigned_val);
+ ErrConvInteger str(tmp);
+ THD *thd= get_thd();
+ Datetime dt(&error, tmp, Datetime::Options(thd));
return store_TIME_with_warning(&dt, &str, error);
}
@@ -5586,7 +5664,7 @@ int Field_datetime::store_time_dec(const MYSQL_TIME *ltime, uint dec)
int error;
ErrConvTime str(ltime);
THD *thd= get_thd();
- Datetime dt(thd, &error, ltime, sql_mode_for_dates(thd), decimals());
+ Datetime dt(thd, &error, ltime, Datetime::Options(thd), decimals());
return store_TIME_with_warning(&dt, &str, error);
}
@@ -5595,17 +5673,19 @@ int Field_datetime::store_decimal(const my_decimal *d)
{
int error;
ErrConvDecimal str(d);
- Datetime tm(&error, Sec6(d), sql_mode_for_dates(get_thd()), decimals());
+ THD *thd= get_thd();
+ Datetime tm(thd, &error, d, Datetime::Options(thd), decimals());
return store_TIME_with_warning(&tm, &str, error);
}
+
bool
Field_temporal_with_date::validate_value_in_record(THD *thd,
const uchar *record) const
{
DBUG_ASSERT(!is_null_in_record(record));
MYSQL_TIME ltime;
- return get_TIME(&ltime, ptr_in_record(record), sql_mode_for_dates(thd));
+ return get_TIME(&ltime, ptr_in_record(record), Datetime::Options(thd));
}
@@ -5645,7 +5725,8 @@ Item *Field_temporal::get_equal_const_item_datetime(THD *thd,
const_item->field_type() != MYSQL_TYPE_TIMESTAMP) ||
const_item->decimals != decimals())
{
- Datetime dt(thd, const_item, date_mode_t(0));
+ Datetime::Options opt(TIME_CONV_NONE, thd);
+ Datetime dt(thd, const_item, opt, decimals());
if (!dt.is_valid_datetime())
return NULL;
/*
@@ -5660,7 +5741,7 @@ Item *Field_temporal::get_equal_const_item_datetime(THD *thd,
case ANY_SUBST:
if (!is_temporal_type_with_date(const_item->field_type()))
{
- Datetime dt(thd, const_item, Datetime::comparison_flags_for_get_date());
+ Datetime dt(thd, const_item, Datetime::Options_cmp(thd));
if (!dt.is_valid_datetime())
return NULL;
return new (thd->mem_root)
@@ -5684,15 +5765,15 @@ Item *Field_temporal::get_equal_const_item_datetime(THD *thd,
int Field_time::store_TIME_with_warning(const Time *t,
const ErrConv *str, int warn)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
// Handle totally bad values
if (!t->is_valid_time())
- return store_invalid_with_warning(str, warn, MYSQL_TIMESTAMP_TIME);
+ return store_invalid_with_warning(str, warn, "time");
// Store the value
DBUG_ASSERT(!t->fraction_remainder(decimals()));
- store_TIME(t->get_mysql_time());
+ store_TIME(*t);
// Calculate return value and send warnings if needed
- return store_TIME_return_code_with_warnings(warn, str, MYSQL_TIMESTAMP_TIME);
+ return store_TIME_return_code_with_warnings(warn, str, "time");
}
@@ -5712,7 +5793,17 @@ int Field_time::store(const char *from,size_t len,CHARSET_INFO *cs)
ErrConvString str(from, len, cs);
MYSQL_TIME_STATUS st;
THD *thd= get_thd();
- Time tm(thd, &st, from, len, cs, sql_mode_for_dates(thd), decimals());
+ /*
+ Unlike number-to-time conversion, we need to additionally pass
+ MODE_NO_ZERO_DATE here (if it presents in the current sql_mode):
+ SET sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
+ INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); -- error
+ INSERT INTO t1 VALUES (0); -- ok
+ In the first INSERT we have a zero date.
+ In the second INSERT we don't have a zero date (it is just a zero time).
+ */
+ Time::Options opt(sql_mode_for_dates(thd), thd);
+ Time tm(thd, &st, from, len, cs, opt, decimals());
return store_TIME_with_warning(&tm, &str, st.warnings);
}
@@ -5721,7 +5812,7 @@ int Field_time::store_time_dec(const MYSQL_TIME *ltime, uint dec)
{
ErrConvTime str(ltime);
int warn;
- Time tm(&warn, ltime, curdays, decimals());
+ Time tm(&warn, ltime, curdays, Time::Options(get_thd()), decimals());
return store_TIME_with_warning(&tm, &str, warn);
}
@@ -5730,17 +5821,24 @@ int Field_time::store(double nr)
{
ErrConvDouble str(nr);
int was_cut;
- Time tm(get_thd(), &was_cut, Sec6(nr), decimals());
+ Time tm(get_thd(), &was_cut, nr, Time::Options(get_thd()), decimals());
return store_TIME_with_warning(&tm, &str, was_cut);
}
int Field_time::store(longlong nr, bool unsigned_val)
{
- ErrConvInteger str(Longlong_hybrid(nr, unsigned_val));
+ Longlong_hybrid tmp(nr, unsigned_val);
+ ErrConvInteger str(tmp);
int was_cut;
- // Need fractional digit truncation if nr overflows to '838:59:59.999999'
- Time tm(get_thd(), &was_cut, Sec6(nr, unsigned_val), decimals());
+ THD *thd= get_thd();
+ /*
+ Need fractional digit truncation if nr overflows to '838:59:59.999999'.
+ The constructor used below will always truncate (never round).
+ We don't need to care to overwrite the default session rounding mode
+ from HALF_UP to TRUNCATE.
+ */
+ Time tm(thd, &was_cut, tmp, Time::Options(thd), decimals());
return store_TIME_with_warning(&tm, &str, was_cut);
}
@@ -5792,7 +5890,7 @@ String *Field_time::val_str(String *str,
{
ASSERT_COLUMN_MARKED_FOR_READ;
MYSQL_TIME ltime;
- get_date(&ltime, TIME_TIME_ONLY);
+ get_date(&ltime, Datetime::Options(TIME_TIME_ONLY, get_thd()));
str->alloc(field_length + 1);
str->length(my_time_to_str(&ltime, const_cast<char*>(str->ptr()), decimals()));
str->set_charset(&my_charset_numeric);
@@ -5802,7 +5900,8 @@ String *Field_time::val_str(String *str,
bool Field_time::check_zero_in_date_with_warn(date_mode_t fuzzydate)
{
- if (!(fuzzydate & TIME_TIME_ONLY) && (fuzzydate & TIME_NO_ZERO_IN_DATE))
+ date_conv_mode_t tmp= date_conv_mode_t(fuzzydate);
+ if (!(tmp & TIME_TIME_ONLY) && (tmp & TIME_NO_ZERO_IN_DATE))
{
THD *thd= get_thd();
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -5847,7 +5946,7 @@ bool Field_time::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
bool Field_time::send_binary(Protocol *protocol)
{
MYSQL_TIME ltime;
- get_date(&ltime, TIME_TIME_ONLY);
+ get_date(&ltime, Time::Options(TIME_TIME_ONLY, get_thd()));
return protocol->store_time(&ltime, decimals());
}
@@ -5898,7 +5997,7 @@ int Field_time::store_decimal(const my_decimal *d)
{
ErrConvDecimal str(d);
int was_cut;
- Time tm(get_thd(), &was_cut, Sec6(d), decimals());
+ Time tm(get_thd(), &was_cut, d, Time::Options(get_thd()), decimals());
return store_TIME_with_warning(&tm, &str, was_cut);
}
@@ -5958,8 +6057,7 @@ Item *Field_time::get_equal_const_item(THD *thd, const Context &ctx,
if (const_item->field_type() != MYSQL_TYPE_TIME)
{
// Get the value of const_item with conversion from DATETIME to TIME
- Time tm(get_thd(), const_item,
- Time::Options(Time::comparison_flags_for_get_date(), mode));
+ Time tm(get_thd(), const_item, Time::Options_cmp(thd, mode));
if (!tm.is_valid_time())
return NULL;
/*
@@ -5983,10 +6081,6 @@ Item *Field_time::get_equal_const_item(THD *thd, const Context &ctx,
if (const_item->field_type() != MYSQL_TYPE_TIME ||
const_item->decimals != decimals())
{
- Time tm(get_thd(), const_item,
- Time::Options(TIME_TIME_ONLY, mode));
- if (!tm.is_valid_time())
- return NULL;
/*
Note, the value returned in "ltime" can have more fractional
digits that decimals(). The Item_time_literal constructor will
@@ -6001,6 +6095,10 @@ Item *Field_time::get_equal_const_item(THD *thd, const Context &ctx,
The optimized WHERE will return with "Impossible WHERE", without
having to do the full table scan.
*/
+ Time tm(thd, const_item, Time::Options(TIME_TIME_ONLY, thd, mode),
+ decimals());
+ if (!tm.is_valid_time())
+ return NULL;
return new (thd->mem_root) Item_time_literal(thd, tm.get_mysql_time(),
decimals());
}
@@ -6014,7 +6112,7 @@ longlong Field_time_with_dec::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
MYSQL_TIME ltime;
- get_date(&ltime, TIME_TIME_ONLY);
+ get_date(&ltime, Time::Options(TIME_TIME_ONLY, get_thd()));
longlong val= TIME_to_ulonglong_time(&ltime);
return ltime.neg ? -val : val;
}
@@ -6023,7 +6121,7 @@ double Field_time_with_dec::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
MYSQL_TIME ltime;
- get_date(&ltime, TIME_TIME_ONLY);
+ get_date(&ltime, Time::Options(TIME_TIME_ONLY, get_thd()));
return TIME_to_double(&ltime);
}
@@ -6096,7 +6194,7 @@ bool Field_timef::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
int Field_year::store(const char *from, size_t len,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
char *end;
int error;
longlong nr= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
@@ -6144,7 +6242,7 @@ int Field_year::store(double nr)
int Field_year::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155)
{
*ptr= 0;
@@ -6169,7 +6267,8 @@ int Field_year::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
if (Field_year::store(ltime->year, 0))
return 1;
- set_datetime_warning(WARN_DATA_TRUNCATED, &str, ltime->time_type, 1);
+ const char *typestr= Temporal::type_name_by_timestamp_type(ltime->time_type);
+ set_datetime_warning(WARN_DATA_TRUNCATED, &str, typestr, 1);
return 0;
}
@@ -6219,8 +6318,8 @@ bool Field_year::get_date(MYSQL_TIME *ltime,date_mode_t fuzzydate)
if (tmp || field_length != 4)
tmp+= 1900;
return int_to_datetime_with_warn(get_thd(),
- Longlong_hybrid(tmp * 10000, true),
- ltime, fuzzydate, field_name.str);
+ Longlong_hybrid(tmp * 10000, true),
+ ltime, fuzzydate, table->s, field_name.str);
}
@@ -6238,24 +6337,24 @@ int Field_date_common::store_TIME_with_warning(const Datetime *dt,
const ErrConv *str,
int was_cut)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
// Handle totally bad values
if (!dt->is_valid_datetime())
- return store_invalid_with_warning(str, was_cut, MYSQL_TIMESTAMP_DATE);
+ return store_invalid_with_warning(str, was_cut, "date");
// Store the value
if (!dt->hhmmssff_is_zero())
was_cut|= MYSQL_TIME_NOTE_TRUNCATED;
- store_TIME(dt->get_mysql_time());
+ store_datetime(*dt);
// Caclulate return value and send warnings if needed
- return store_TIME_return_code_with_warnings(was_cut, str,
- MYSQL_TIMESTAMP_DATE);
+ return store_TIME_return_code_with_warnings(was_cut, str, "date");
}
int Field_date_common::store(const char *from, size_t len, CHARSET_INFO *cs)
{
MYSQL_TIME_STATUS st;
ErrConvString str(from, len, cs);
- Datetime dt(&st, from, len, cs, sql_mode_for_dates(get_thd()));
+ THD *thd= get_thd();
+ Datetime dt(thd, &st, from, len, cs, Date::Options(thd), 0);
return store_TIME_with_warning(&dt, &str, st.warnings);
}
@@ -6263,15 +6362,18 @@ int Field_date_common::store(double nr)
{
int error;
ErrConvDouble str(nr);
- Datetime dt(&error, Sec6(nr), sql_mode_for_dates(get_thd()));
+ THD *thd= get_thd();
+ Datetime dt(thd, &error, nr, Date::Options(thd), 0);
return store_TIME_with_warning(&dt, &str, error);
}
int Field_date_common::store(longlong nr, bool unsigned_val)
{
int error;
- ErrConvInteger str(Longlong_hybrid(nr, unsigned_val));
- Datetime dt(&error, Sec6(nr, unsigned_val), sql_mode_for_dates(get_thd()));
+ Longlong_hybrid tmp(nr, unsigned_val);
+ ErrConvInteger str(tmp);
+ THD *thd= get_thd();
+ Datetime dt(&error, tmp, Date::Options(thd));
return store_TIME_with_warning(&dt, &str, error);
}
@@ -6280,7 +6382,7 @@ int Field_date_common::store_time_dec(const MYSQL_TIME *ltime, uint dec)
int error;
ErrConvTime str(ltime);
THD *thd= get_thd();
- Datetime dt(thd, &error, ltime, sql_mode_for_dates(thd));
+ Datetime dt(thd, &error, ltime, Date::Options(thd), 0);
return store_TIME_with_warning(&dt, &str, error);
}
@@ -6288,7 +6390,8 @@ int Field_date_common::store_decimal(const my_decimal *d)
{
int error;
ErrConvDecimal str(d);
- Datetime tm(&error, Sec6(d), sql_mode_for_dates(get_thd()));
+ THD *thd= get_thd();
+ Datetime tm(thd, &error, d, Date::Options(thd), 0);
return store_TIME_with_warning(&tm, &str, error);
}
@@ -6498,8 +6601,14 @@ Item *Field_newdate::get_equal_const_item(THD *thd, const Context &ctx,
case ANY_SUBST:
if (!is_temporal_type_with_date(const_item->field_type()))
{
- // Get the value of const_item with conversion from TIME to DATETIME
- Datetime dt(thd, const_item, Datetime::comparison_flags_for_get_date());
+ /*
+ DATE is compared to DATETIME-alike non-temporal values
+ (such as VARCHAR, DECIMAL) as DATETIME, e.g.:
+ WHERE date_column=20010101235959.0000009
+ So here we convert the constant to DATETIME normally.
+ In case if TIME_ROUND_FRACTIONAL is enabled, nanoseconds will round.
+ */
+ Datetime dt(thd, const_item, Datetime::Options_cmp(thd));
if (!dt.is_valid_datetime())
return NULL;
/*
@@ -6526,10 +6635,17 @@ Item *Field_newdate::get_equal_const_item(THD *thd, const Context &ctx,
case IDENTITY_SUBST:
if (const_item->field_type() != MYSQL_TYPE_DATE)
{
- Date d(thd, const_item, date_mode_t(0));
- if (!d.is_valid_date())
+ /*
+ DATE is compared to non-temporal as DATETIME.
+ We need to convert to DATETIME first, taking into account the
+ current session rounding mode (even though this is IDENTITY_SUBSTS!),
+ then convert the result to DATE.
+ */
+ Datetime dt(thd, const_item, Datetime::Options(TIME_CONV_NONE, thd));
+ if (!dt.is_valid_datetime())
return NULL;
- return new (thd->mem_root) Item_date_literal(thd, d.get_mysql_time());
+ return new (thd->mem_root)
+ Item_date_literal(thd, Date(&dt).get_mysql_time());
}
break;
}
@@ -6678,13 +6794,9 @@ void Field_datetime::sql_type(String &res) const
int Field_datetime::set_time()
{
THD *thd= table->in_use;
- MYSQL_TIME now_time;
- thd->variables.time_zone->gmt_sec_to_TIME(&now_time, thd->query_start());
- now_time.second_part= thd->query_start_sec_part();
set_notnull();
- my_time_trunc(&now_time, decimals());
- store_TIME(&now_time);
- thd->time_zone_used= 1;
+ // Here we always truncate (not round), no matter what sql_mode is
+ store_datetime(Datetime(thd, thd->query_start_timeval()).trunc(decimals()));
return 0;
}
@@ -6876,7 +6988,7 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
uint copy_length;
int rc;
@@ -6922,7 +7034,7 @@ int Field_str::store(longlong nr, bool unsigned_val)
int Field_str::store(double nr)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
uint local_char_length= MY_MIN(sizeof(buff),
field_length / field_charset->mbmaxlen);
@@ -7419,7 +7531,7 @@ int Field_varstring::save_field_metadata(uchar *metadata_ptr)
int Field_varstring::store(const char *from,size_t length,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
uint copy_length;
int rc;
@@ -7956,7 +8068,7 @@ String *Field_longstr::uncompress(String *val_buffer, String *val_ptr,
int Field_varstring_compressed::store(const char *from, size_t length,
CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
uint compressed_length;
int rc= compress((char*) get_data(), field_length, from, (uint) length,
Field_varstring_compressed::max_display_length(),
@@ -8088,7 +8200,7 @@ int Field_blob::copy_value(Field_blob *from)
int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
size_t copy_length, new_length;
uint copy_len;
char *tmp;
@@ -8576,7 +8688,7 @@ uint Field_blob::is_equal(Create_field *new_field)
int Field_blob_compressed::store(const char *from, size_t length,
CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
uint compressed_length;
uint max_length= max_data_length();
uint to_length= (uint) MY_MIN(max_length,
@@ -8807,10 +8919,18 @@ int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
geom_type != Field::GEOM_GEOMETRYCOLLECTION &&
(uint32) geom_type != wkb_type)
{
+ const char *db= table->s->db.str;
+ const char *tab_name= table->s->error_table_name();
+
+ if (!db)
+ db= "";
+ if (!tab_name)
+ tab_name= "";
+
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
Geometry::ci_collection[geom_type]->m_name.str,
Geometry::ci_collection[wkb_type]->m_name.str,
- field_name.str,
+ db, tab_name, field_name.str,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
goto err_exit;
@@ -8919,7 +9039,7 @@ void Field_enum::store_type(ulonglong value)
int Field_enum::store(const char *from,size_t length,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int err= 0;
char buff[STRING_BUFFER_USUAL_SIZE];
String tmpstr(buff,sizeof(buff), &my_charset_bin);
@@ -8971,7 +9091,7 @@ int Field_enum::store(double nr)
int Field_enum::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
if ((ulonglong) nr > typelib->count || nr == 0)
{
@@ -9102,7 +9222,7 @@ Field *Field_enum::make_new_field(MEM_ROOT *root, TABLE *new_table,
int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
bool got_warning= 0;
int err= 0;
char *not_used;
@@ -9142,7 +9262,7 @@ int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
int Field_set::store(longlong nr, bool unsigned_val)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
ulonglong max_nr;
@@ -9521,7 +9641,7 @@ uint Field_bit::is_equal(Create_field *new_field)
int Field_bit::store(const char *from, size_t length, CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int delta;
for (; length && !*from; from++, length--) // skip left 0's
@@ -9957,7 +10077,7 @@ Field_bit_as_char::Field_bit_as_char(uchar *ptr_arg, uint32 len_arg,
int Field_bit_as_char::store(const char *from, size_t length, CHARSET_INFO *cs)
{
- ASSERT_COLUMN_MARKED_FOR_WRITE;
+ ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int delta;
uchar bits= (uchar) (field_length & 7);
@@ -10799,12 +10919,14 @@ Field::set_warning(Sql_condition::enum_warning_level level, uint code,
void Field::set_datetime_warning(Sql_condition::enum_warning_level level,
uint code, const ErrConv *str,
- timestamp_type ts_type, int cuted_increment)
+ const char *typestr, int cuted_increment)
const
{
THD *thd= get_thd();
if (thd->really_abort_on_warning() && level >= Sql_condition::WARN_LEVEL_WARN)
- make_truncated_value_warning(thd, level, str, ts_type, field_name.str);
+ thd->push_warning_truncated_value_for_field(level, typestr,
+ str->ptr(), table->s,
+ field_name.str);
else
set_warning(level, code, cuted_increment);
}
@@ -10814,10 +10936,18 @@ void Field::set_warning_truncated_wrong_value(const char *type_arg,
const char *value)
{
THD *thd= get_thd();
+ const char *db_name= table->s->db.str;
+ const char *table_name= table->s->error_table_name();
+
+ if (!db_name)
+ db_name= "";
+ if (!table_name)
+ table_name= "";
+
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- type_arg, value, field_name.str,
+ type_arg, value, db_name, table_name, field_name.str,
static_cast<ulong>(thd->get_stmt_da()->
current_row_for_warning()));
}
diff --git a/sql/field.h b/sql/field.h
index eb39b6bcec9..e762e45c024 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -541,6 +541,7 @@ public:
bool utf8; /* Already in utf8 */
Item *expr;
LEX_CSTRING name; /* Name of constraint */
+ /* see VCOL_* (VCOL_FIELD_REF, ...) */
uint flags;
Virtual_column_info()
@@ -609,7 +610,9 @@ protected:
static void do_field_int(Copy_field *copy);
static void do_field_real(Copy_field *copy);
static void do_field_string(Copy_field *copy);
- static void do_field_temporal(Copy_field *copy);
+ static void do_field_date(Copy_field *copy);
+ static void do_field_temporal(Copy_field *copy, date_mode_t fuzzydate);
+ static void do_field_datetime(Copy_field *copy);
static void do_field_timestamp(Copy_field *copy);
static void do_field_decimal(Copy_field *copy);
public:
@@ -781,7 +784,21 @@ public:
virtual int store(longlong nr, bool unsigned_val)=0;
virtual int store_decimal(const my_decimal *d)=0;
virtual int store_time_dec(const MYSQL_TIME *ltime, uint dec);
- virtual int store_timestamp(my_time_t timestamp, ulong sec_part);
+ virtual int store_timestamp_dec(const timeval &ts, uint dec);
+ int store_timestamp(my_time_t timestamp, ulong sec_part)
+ {
+ return store_timestamp_dec(Timeval(timestamp, sec_part),
+ TIME_SECOND_PART_DIGITS);
+ }
+ /**
+ Store a value represented in native format
+ */
+ virtual int store_native(const Native &value)
+ {
+ DBUG_ASSERT(0);
+ reset();
+ return 0;
+ }
int store_time(const MYSQL_TIME *ltime)
{ return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
int store(const char *to, size_t length, CHARSET_INFO *cs,
@@ -828,6 +845,11 @@ public:
This trickery is used to decrease a number of malloc calls.
*/
virtual String *val_str(String*,String *)=0;
+ virtual bool val_native(Native *to)
+ {
+ DBUG_ASSERT(!is_null());
+ return to->copy((const char *) ptr, pack_length());
+ }
String *val_int_as_str(String *val_buffer, bool unsigned_flag);
/*
Return the field value as a LEX_CSTRING, without padding to full length
@@ -1343,7 +1365,6 @@ public:
void copy_from_tmp(int offset);
uint fill_cache_field(struct st_cache_field *copy);
virtual bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
- bool get_time(MYSQL_TIME *ltime) { return get_date(ltime, TIME_TIME_ONLY); }
virtual TYPELIB *get_typelib() const { return NULL; }
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
virtual CHARSET_INFO *charset_for_protocol(void) const
@@ -1366,13 +1387,13 @@ protected:
return set_warning(Sql_condition::WARN_LEVEL_NOTE, code, cuted_increment);
}
void set_datetime_warning(Sql_condition::enum_warning_level, uint code,
- const ErrConv *str, timestamp_type ts_type,
+ const ErrConv *str, const char *typestr,
int cuted_increment) const;
void set_datetime_warning(uint code,
- const ErrConv *str, timestamp_type ts_type,
+ const ErrConv *str, const char *typestr,
int cuted_increment) const
{
- set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, code, str, ts_type,
+ set_datetime_warning(Sql_condition::WARN_LEVEL_WARN, code, str, typestr,
cuted_increment);
}
void set_warning_truncated_wrong_value(const char *type, const char *value);
@@ -2079,7 +2100,7 @@ public:
{
my_decimal nr(ptr, precision, dec);
return decimal_to_datetime_with_warn(get_thd(), &nr, ltime,
- fuzzydate, field_name.str);
+ fuzzydate, table->s, field_name.str);
}
bool val_bool()
{
@@ -2596,33 +2617,32 @@ protected:
Item *get_equal_const_item_datetime(THD *thd, const Context &ctx,
Item *const_item);
void set_warnings(Sql_condition::enum_warning_level trunc_level,
- const ErrConv *str, int was_cut, timestamp_type ts_type);
+ const ErrConv *str, int was_cut, const char *typestr);
int store_TIME_return_code_with_warnings(int warn, const ErrConv *str,
- timestamp_type ts_type)
+ const char *typestr)
{
if (!MYSQL_TIME_WARN_HAVE_WARNINGS(warn) &&
MYSQL_TIME_WARN_HAVE_NOTES(warn))
{
set_warnings(Sql_condition::WARN_LEVEL_NOTE, str,
- warn | MYSQL_TIME_WARN_TRUNCATED, ts_type);
+ warn | MYSQL_TIME_WARN_TRUNCATED, typestr);
return 3;
}
- set_warnings(Sql_condition::WARN_LEVEL_WARN, str, warn, ts_type);
+ set_warnings(Sql_condition::WARN_LEVEL_WARN, str, warn, typestr);
return warn ? 2 : 0;
}
int store_invalid_with_warning(const ErrConv *str, int was_cut,
- timestamp_type ts_type)
+ const char *typestr)
{
DBUG_ASSERT(was_cut);
reset();
Sql_condition::enum_warning_level level= Sql_condition::WARN_LEVEL_WARN;
if (was_cut & MYSQL_TIME_WARN_ZERO_DATE)
{
- DBUG_ASSERT(ts_type != MYSQL_TIMESTAMP_TIME);
- set_warnings(level, str, MYSQL_TIME_WARN_OUT_OF_RANGE, ts_type);
+ set_warnings(level, str, MYSQL_TIME_WARN_OUT_OF_RANGE, typestr);
return 2;
}
- set_warnings(level, str, MYSQL_TIME_WARN_TRUNCATED, ts_type);
+ set_warnings(level, str, MYSQL_TIME_WARN_TRUNCATED, typestr);
return 1;
}
public:
@@ -2640,7 +2660,8 @@ public:
int save_in_field(Field *to)
{
MYSQL_TIME ltime;
- if (get_date(&ltime, date_mode_t(0)))
+ // For temporal types no truncation needed. Rounding mode is not important.
+ if (get_date(&ltime, TIME_CONV_NONE | TIME_FRAC_NONE))
return to->reset();
return to->store_time_dec(&ltime, decimals());
}
@@ -2689,6 +2710,10 @@ public:
class Field_temporal_with_date: public Field_temporal {
protected:
virtual void store_TIME(const MYSQL_TIME *ltime) = 0;
+ void store_datetime(const Datetime &dt)
+ {
+ return store_TIME(dt.get_mysql_time());
+ }
virtual bool get_TIME(MYSQL_TIME *ltime, const uchar *pos,
date_mode_t fuzzydate) const = 0;
bool validate_MMDD(bool not_zero_date, uint month, uint day,
@@ -2714,13 +2739,17 @@ public:
class Field_timestamp :public Field_temporal {
protected:
- date_mode_t sql_mode_for_timestamp(THD *thd) const;
int store_TIME_with_warning(THD *, const Datetime *,
const ErrConv *, int warn);
virtual void store_TIMEVAL(const timeval &tv)
{
int4store(ptr, tv.tv_sec);
}
+ void store_TIMESTAMP(const Timestamp &ts)
+ {
+ store_TIMEVAL(ts.tv());
+ }
+ int zero_time_stored_return_code_with_warning();
public:
Field_timestamp(uchar *ptr_arg, uint32 len_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
@@ -2735,7 +2764,7 @@ public:
int store(longlong nr, bool unsigned_val);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
int store_decimal(const my_decimal *);
- int store_timestamp(my_time_t timestamp, ulong sec_part);
+ int store_timestamp_dec(const timeval &ts, uint dec);
int save_in_field(Field *to);
double val_real(void);
longlong val_int(void);
@@ -2760,11 +2789,19 @@ public:
{
return get_timestamp(ptr, sec_part);
}
- void store_TIME(my_time_t timestamp, ulong sec_part)
+ /*
+ This method is used by storage/perfschema and
+ Item_func_now_local::save_in_field().
+ */
+ void store_TIME(my_time_t ts, ulong sec_part)
{
- store_TIMEVAL(Timeval(timestamp, sec_part).trunc(decimals()));
+ int warn;
+ time_round_mode_t mode= Datetime::default_round_mode(get_thd());
+ store_TIMESTAMP(Timestamp(ts, sec_part).round(decimals(), mode, &warn));
}
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ int store_native(const Native &value);
+ bool val_native(Native *to);
uchar *pack(uchar *to, const uchar *from,
uint max_length __attribute__((unused)))
{
@@ -2844,6 +2881,7 @@ public:
{
DBUG_ASSERT(dec);
}
+ bool val_native(Native *to);
my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
int cmp(const uchar *,const uchar *);
uint32 pack_length() const { return 4 + sec_part_bytes(dec); }
@@ -2894,6 +2932,7 @@ public:
{
return get_timestamp(ptr, sec_part);
}
+ bool val_native(Native *to);
uint size_of() const { return sizeof(*this); }
};
@@ -2923,7 +2962,7 @@ public:
return do_field_string;
}
case TIME_RESULT:
- return do_field_temporal;
+ return do_field_date;
case DECIMAL_RESULT:
return do_field_decimal;
case REAL_RESULT:
@@ -2969,6 +3008,7 @@ public:
null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg)
{}
+ Copy_func *get_copy_func(const Field *from) const;
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part,
const Item_bool_func *cond,
scalar_comparison_op op, Item *value);
@@ -3053,6 +3093,10 @@ class Field_time :public Field_temporal {
long curdays;
protected:
virtual void store_TIME(const MYSQL_TIME *ltime);
+ void store_TIME(const Time &t)
+ {
+ return store_TIME(t.get_mysql_time());
+ }
int store_TIME_with_warning(const Time *ltime, const ErrConv *str, int warn);
bool check_zero_in_date_with_warn(date_mode_t fuzzydate);
static void do_field_time(Copy_field *copy);
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 8b3d9c04656..2f56be60dd6 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -425,24 +425,32 @@ void Field::do_field_timestamp(Copy_field *copy)
}
-void Field::do_field_temporal(Copy_field *copy)
+void Field::do_field_temporal(Copy_field *copy, date_mode_t fuzzydate)
{
MYSQL_TIME ltime;
// TODO: we now need to check result
- if (copy->from_field->get_date(&ltime, date_mode_t(0)))
+ if (copy->from_field->get_date(&ltime, fuzzydate))
copy->to_field->reset();
else
copy->to_field->store_time_dec(&ltime, copy->from_field->decimals());
}
+void Field::do_field_datetime(Copy_field *copy)
+{
+ return do_field_temporal(copy, Datetime::Options(TIME_CONV_NONE, current_thd));
+}
+
+
+void Field::do_field_date(Copy_field *copy)
+{
+ return do_field_temporal(copy, Date::Options(TIME_CONV_NONE));
+}
+
+
void Field_time::do_field_time(Copy_field *copy)
{
- MYSQL_TIME ltime;
- if (copy->from_field->get_date(&ltime, TIME_TIME_ONLY))
- copy->to_field->reset();
- else
- copy->to_field->store_time_dec(&ltime, copy->from_field->decimals());
+ return do_field_temporal(copy, Time::Options(current_thd));
}
@@ -720,13 +728,20 @@ void Copy_field::set(Field *to,Field *from,bool save)
Field::Copy_func *Field_timestamp::get_copy_func(const Field *from) const
{
Field::Copy_func *copy= Field_temporal::get_copy_func(from);
- if (copy == do_field_temporal && from->type() == MYSQL_TYPE_TIMESTAMP)
+ if (copy == do_field_datetime && from->type() == MYSQL_TYPE_TIMESTAMP)
return do_field_timestamp;
else
return copy;
}
+Field::Copy_func *Field_date_common::get_copy_func(const Field *from) const
+{
+ Field::Copy_func *copy= Field_temporal::get_copy_func(from);
+ return copy == do_field_datetime ? do_field_date : copy;
+}
+
+
Field::Copy_func *Field_temporal::get_copy_func(const Field *from) const
{
/* If types are not 100 % identical then convert trough get_date() */
@@ -739,7 +754,7 @@ Field::Copy_func *Field_temporal::get_copy_func(const Field *from) const
if (!eq_def(from) ||
(table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE)))
- return do_field_temporal;
+ return do_field_datetime;
return get_identical_copy_func();
}
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 6f2a6096aa2..c76295e666a 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -60,9 +60,7 @@ static bool save_index(Sort_param *param, uint count,
static uint suffix_length(ulong string_length);
static uint sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
bool *multi_byte_charset);
-static SORT_ADDON_FIELD *get_addon_fields(ulong max_length_for_sort_data,
- Field **ptabfield,
- uint sortlength,
+static SORT_ADDON_FIELD *get_addon_fields(TABLE *table, uint sortlength,
LEX_STRING *addon_buf);
static void unpack_addon_fields(struct st_sort_addon_field *addon_field,
uchar *buff, uchar *buff_end);
@@ -71,7 +69,6 @@ static bool check_if_pq_applicable(Sort_param *param, SORT_INFO *info,
ha_rows records, size_t memory_available);
void Sort_param::init_for_filesort(uint sortlen, TABLE *table,
- ulong max_length_for_sort_data,
ha_rows maxrows, bool sort_positions)
{
DBUG_ASSERT(addon_field == 0 && addon_buf.length == 0);
@@ -85,8 +82,7 @@ void Sort_param::init_for_filesort(uint sortlen, TABLE *table,
Get the descriptors of all fields whose values are appended
to sorted fields and get its total length in addon_buf.length
*/
- addon_field= get_addon_fields(max_length_for_sort_data,
- table->field, sort_length, &addon_buf);
+ addon_field= get_addon_fields(table, sort_length, &addon_buf);
}
if (addon_field)
{
@@ -190,9 +186,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
param.init_for_filesort(sortlength(thd, filesort->sortorder, s_length,
&multi_byte_charset),
- table,
- thd->variables.max_length_for_sort_data,
- max_rows, filesort->sort_positions);
+ table, max_rows, filesort->sort_positions);
sort->addon_buf= param.addon_buf;
sort->addon_field= param.addon_field;
@@ -1057,7 +1051,10 @@ Type_handler_temporal_result::make_sort_key(uchar *to, Item *item,
Sort_param *param) const
{
MYSQL_TIME buf;
- if (item->get_date_result(current_thd, &buf, TIME_INVALID_DATES))
+ // This is a temporal type. No nanoseconds. Rounding mode is not important.
+ DBUG_ASSERT(item->cmp_type() == TIME_RESULT);
+ static const Temporal::Options opt(TIME_INVALID_DATES, TIME_FRAC_NONE);
+ if (item->get_date_result(current_thd, &buf, opt))
{
DBUG_ASSERT(item->maybe_null);
DBUG_ASSERT(item->null_value);
@@ -1071,6 +1068,28 @@ Type_handler_temporal_result::make_sort_key(uchar *to, Item *item,
void
+Type_handler_timestamp_common::make_sort_key(uchar *to, Item *item,
+ const SORT_FIELD_ATTR *sort_field,
+ Sort_param *param) const
+{
+ uint binlen= my_timestamp_binary_length(item->decimals);
+ Timestamp_or_zero_datetime_native_null native(current_thd, item);
+ if (native.is_null() || native.is_zero_datetime())
+ {
+ // NULL or '0000-00-00 00:00:00'
+ bzero(to, item->maybe_null ? binlen + 1 : binlen);
+ }
+ else
+ {
+ DBUG_ASSERT(native.length() == binlen);
+ if (item->maybe_null)
+ *to++= 1;
+ memcpy((char *) to, native.ptr(), binlen);
+ }
+}
+
+
+void
Type_handler::make_sort_key_longlong(uchar *to,
bool maybe_null,
bool null_value,
@@ -1877,6 +1896,15 @@ Type_handler_temporal_result::sortlength(THD *thd,
void
+Type_handler_timestamp_common::sortlength(THD *thd,
+ const Type_std_attributes *item,
+ SORT_FIELD_ATTR *sortorder) const
+{
+ sortorder->length= my_timestamp_binary_length(item->decimals);
+}
+
+
+void
Type_handler_int_result::sortlength(THD *thd,
const Type_std_attributes *item,
SORT_FIELD_ATTR *sortorder) const
@@ -1963,6 +1991,30 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
return length;
}
+bool filesort_use_addons(TABLE *table, uint sortlength,
+ uint *length, uint *fields, uint *null_fields)
+{
+ Field **pfield, *field;
+ *length= *fields= *null_fields= 0;
+
+ for (pfield= table->field; (field= *pfield) ; pfield++)
+ {
+ if (!bitmap_is_set(table->read_set, field->field_index))
+ continue;
+ if (field->flags & BLOB_FLAG)
+ return false;
+ (*length)+= field->max_packed_col_length(field->pack_length());
+ if (field->maybe_null())
+ (*null_fields)++;
+ (*fields)++;
+ }
+ if (!*fields)
+ return false;
+ (*length)+= (*null_fields+7)/8;
+
+ return *length + sortlength <
+ table->in_use->variables.max_length_for_sort_data;
+}
/**
Get descriptors of fields appended to sorted fields and
@@ -1970,7 +2022,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
The function first finds out what fields are used in the result set.
Then it calculates the length of the buffer to store the values of
- these fields together with the value of sort values.
+ these fields together with the value of sort values.
If the calculated length is not greater than max_length_for_sort_data
the function allocates memory for an array of descriptors containing
layouts for the values of the non-sorted fields in the buffer and
@@ -1992,16 +2044,13 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
*/
static SORT_ADDON_FIELD *
-get_addon_fields(ulong max_length_for_sort_data,
- Field **ptabfield, uint sortlength, LEX_STRING *addon_buf)
+get_addon_fields(TABLE *table, uint sortlength, LEX_STRING *addon_buf)
{
Field **pfield;
Field *field;
SORT_ADDON_FIELD *addonf;
- uint length= 0;
- uint fields= 0;
- uint null_fields= 0;
- MY_BITMAP *read_set= (*ptabfield)->table->read_set;
+ uint length, fields, null_fields;
+ MY_BITMAP *read_set= table->read_set;
DBUG_ENTER("get_addon_fields");
/*
@@ -2010,40 +2059,28 @@ get_addon_fields(ulong max_length_for_sort_data,
Note for future refinement:
This this a too strong condition.
Actually we need only the fields referred in the
- result set. And for some of them it makes sense to use
+ result set. And for some of them it makes sense to use
the values directly from sorted fields.
But beware the case when item->cmp_type() != item->result_type()
*/
addon_buf->str= 0;
addon_buf->length= 0;
- for (pfield= ptabfield; (field= *pfield) ; pfield++)
- {
- if (!bitmap_is_set(read_set, field->field_index))
- continue;
- if (field->flags & BLOB_FLAG)
- DBUG_RETURN(0);
- length+= field->max_packed_col_length(field->pack_length());
- if (field->maybe_null())
- null_fields++;
- fields++;
- }
- if (!fields)
- DBUG_RETURN(0);
- length+= (null_fields+7)/8;
+ // see remove_const() for HA_SLOW_RND_POS explanation
+ if (table->file->ha_table_flags() & HA_SLOW_RND_POS)
+ sortlength= 0;
- if (length+sortlength > max_length_for_sort_data ||
- !my_multi_malloc(MYF(MY_WME | MY_THREAD_SPECIFIC),
- &addonf, sizeof(SORT_ADDON_FIELD) * (fields+1),
- &addon_buf->str, length,
- NullS))
+ if (!filesort_use_addons(table, sortlength, &length, &fields, &null_fields) ||
+ !my_multi_malloc(MYF(MY_WME | MY_THREAD_SPECIFIC), &addonf,
+ sizeof(SORT_ADDON_FIELD) * (fields+1),
+ &addon_buf->str, length, NullS))
DBUG_RETURN(0);
addon_buf->length= length;
length= (null_fields+7)/8;
null_fields= 0;
- for (pfield= ptabfield; (field= *pfield) ; pfield++)
+ for (pfield= table->field; (field= *pfield) ; pfield++)
{
if (!bitmap_is_set(read_set, field->field_index))
continue;
@@ -2065,7 +2102,7 @@ get_addon_fields(ulong max_length_for_sort_data,
addonf++;
}
addonf->field= 0; // Put end marker
-
+
DBUG_PRINT("info",("addon_length: %d",length));
DBUG_RETURN(addonf-fields);
}
diff --git a/sql/filesort.h b/sql/filesort.h
index bd1d81f91ef..359f44a3907 100644
--- a/sql/filesort.h
+++ b/sql/filesort.h
@@ -161,6 +161,9 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
Filesort_tracker* tracker, JOIN *join=NULL,
table_map first_table_bit=0);
+bool filesort_use_addons(TABLE *table, uint sortlength,
+ uint *length, uint *fields, uint *null_fields);
+
void change_double_for_sort(double nr,uchar *to);
#endif /* FILESORT_INCLUDED */
diff --git a/sql/gen_lex_token.cc b/sql/gen_lex_token.cc
index c03bfe66f47..7e0cfd097f9 100644
--- a/sql/gen_lex_token.cc
+++ b/sql/gen_lex_token.cc
@@ -33,7 +33,7 @@
from bison.
See also YYMAXUTOK.
*/
-#define MY_MAX_TOKEN 1000
+#define MY_MAX_TOKEN 1100
/** Generated token. */
struct gen_lex_token_string
{
@@ -255,9 +255,11 @@ void compute_tokens()
set_start_expr_token(STARTS_SYM);
set_start_expr_token(ENDS_SYM);
set_start_expr_token(DEFAULT);
- set_start_expr_token(RETURN_SYM);
+ set_start_expr_token(RETURN_MARIADB_SYM);
+ set_start_expr_token(RETURN_ORACLE_SYM);
set_start_expr_token(IF_SYM);
- set_start_expr_token(ELSEIF_SYM);
+ set_start_expr_token(ELSEIF_MARIADB_SYM);
+ set_start_expr_token(ELSEIF_ORACLE_SYM);
set_start_expr_token(CASE_SYM);
set_start_expr_token(WHEN_SYM);
set_start_expr_token(WHILE_SYM);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 651ace759a3..7d5c7c45fbf 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1367,7 +1367,7 @@ bool print_admin_msg(THD* thd, uint len,
protocol->store(msgbuf, msg_length, system_charset_info);
if (protocol->write())
{
- sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
+ sql_print_error("Failed on my_net_write, writing to stderr instead: %s",
msgbuf);
goto err;
}
@@ -3516,7 +3516,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
if (init_partition_bitmaps())
goto err_alloc;
- if (unlikely((error=
+ if (!MY_TEST(m_is_clone_of) &&
+ unlikely((error=
m_part_info->set_partition_bitmaps(m_partitions_to_open))))
goto err_alloc;
@@ -5280,7 +5281,7 @@ bool ha_partition::init_record_priority_queue()
/* Initialize priority queue, initialized to reading forward. */
int (*cmp_func)(void *, uchar *, uchar *);
void *cmp_arg= (void*) this;
- if (!m_using_extended_keys && !(table_flags() & HA_CMP_REF_IS_EXPENSIVE))
+ if (!m_using_extended_keys && !(table_flags() & HA_SLOW_CMP_REF))
cmp_func= cmp_key_rowid_part_id;
else
cmp_func= cmp_key_part_id;
@@ -9812,7 +9813,7 @@ void ha_partition::print_error(int error, myf errflag)
append_row_to_str(str);
/* Log this error, so the DBA can notice it and fix it! */
- sql_print_error("Table '%-192s' corrupted: row in wrong partition: %s\n"
+ sql_print_error("Table '%-192s' corrupted: row in wrong partition: %s"
"Please REPAIR the table!",
table->s->table_name.str,
str.c_ptr_safe());
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index f19e9ff96c8..f385ceb6d3b 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1044,10 +1044,6 @@ public:
with hidden primary key)
(No handler has this limitation currently)
- HA_WANTS_PRIMARY_KEY:
- Can't define a table without primary key except sequences
- (Only InnoDB has this when using innodb_force_primary_key == ON)
-
HA_STATS_RECORDS_IS_EXACT:
Does the counter of records after the info call specify an exact
value or not. If it does this flag is set.
diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc
index d5064af16c3..a199892f971 100644
--- a/sql/ha_sequence.cc
+++ b/sql/ha_sequence.cc
@@ -114,7 +114,7 @@ int ha_sequence::open(const char *name, int mode, uint flags)
if (unlikely((error= table->s->sequence->read_initial_values(table))))
file->ha_close();
}
- else
+ else if (!table->s->tmp_table)
table->m_needs_reopen= true;
/*
diff --git a/sql/handle_connections_win.cc b/sql/handle_connections_win.cc
index b37b4dedad1..6724a2a1f30 100644
--- a/sql/handle_connections_win.cc
+++ b/sql/handle_connections_win.cc
@@ -353,7 +353,7 @@ struct Pipe_Listener : public Listener
if (pipe_handle == INVALID_HANDLE_VALUE)
{
sql_perror("Create named pipe failed");
- sql_print_error("Aborting\n");
+ sql_print_error("Aborting");
exit(1);
}
first_instance= false;
@@ -552,4 +552,4 @@ void handle_connections_win()
listener->cancel();
}
Pipe_Listener::cleanup();
-} \ No newline at end of file
+}
diff --git a/sql/handler.cc b/sql/handler.cc
index 30ce3f654df..932797a8f37 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -55,8 +55,12 @@
#include "semisync_master.h"
#include "wsrep_mysqld.h"
-#include "wsrep.h"
+#ifdef WITH_WSREP
+#include "wsrep_binlog.h"
#include "wsrep_xid.h"
+#include "wsrep_thd.h"
+#include "wsrep_trans_observer.h" /* wsrep transaction hooks */
+#endif /* WITH_WSREP */
/*
While we have legacy_db_type, we have this array to
@@ -252,6 +256,9 @@ handlerton *ha_checktype(THD *thd, handlerton *hton, bool no_substitute)
if (no_substitute)
return NULL;
+#ifdef WITH_WSREP
+ (void)wsrep_after_rollback(thd, false);
+#endif /* WITH_WSREP */
return ha_default_handlerton(thd);
} /* ha_checktype */
@@ -684,7 +691,7 @@ int ha_init()
binary log (which is considered a transaction-capable storage engine in
counting total_ha)
*/
- opt_using_transactions= total_ha>(ulong)opt_bin_log;
+ opt_using_transactions= total_ha > (ulong) opt_bin_log;
savepoint_alloc_size+= sizeof(SAVEPOINT);
DBUG_RETURN(error);
}
@@ -694,7 +701,6 @@ int ha_end()
int error= 0;
DBUG_ENTER("ha_end");
-
/*
This should be eventualy based on the graceful shutdown flag.
So if flag is equal to HA_PANIC_CLOSE, the deallocate
@@ -824,6 +830,43 @@ void ha_kill_query(THD* thd, enum thd_kill_levels level)
}
+/*****************************************************************************
+ Backup functions
+******************************************************************************/
+
+static my_bool plugin_prepare_for_backup(THD *unused1, plugin_ref plugin,
+ void *not_used)
+{
+ handlerton *hton= plugin_hton(plugin);
+ if (hton->state == SHOW_OPTION_YES && hton->prepare_for_backup)
+ hton->prepare_for_backup();
+ return FALSE;
+}
+
+void ha_prepare_for_backup()
+{
+ plugin_foreach_with_mask(0, plugin_prepare_for_backup,
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0);
+}
+
+static my_bool plugin_end_backup(THD *unused1, plugin_ref plugin,
+ void *not_used)
+{
+ handlerton *hton= plugin_hton(plugin);
+ if (hton->state == SHOW_OPTION_YES && hton->end_backup)
+ hton->end_backup();
+ return FALSE;
+}
+
+void ha_end_backup()
+{
+ plugin_foreach_with_mask(0, plugin_end_backup,
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0);
+}
+
+
/* ========================================================================
======================= TRANSACTIONS ===================================*/
@@ -1164,17 +1207,28 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
static int prepare_or_error(handlerton *ht, THD *thd, bool all)
{
+ #ifdef WITH_WSREP
+ if (WSREP(thd) && ht->flags & HTON_WSREP_REPLICATION &&
+ wsrep_before_prepare(thd, all))
+ {
+ return(1);
+ }
+#endif /* WITH_WSREP */
+
int err= ht->prepare(ht, thd, all);
status_var_increment(thd->status_var.ha_prepare_count);
if (err)
{
- /* avoid sending error, if we're going to replay the transaction */
-#ifdef WITH_WSREP
- if (ht != wsrep_hton ||
- err == EMSGSIZE || thd->wsrep_conflict_state != MUST_REPLAY)
-#endif
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
}
+#ifdef WITH_WSREP
+ if (WSREP(thd) && ht->flags & HTON_WSREP_REPLICATION &&
+ wsrep_after_prepare(thd, all))
+ {
+ err= 1;
+ }
+#endif /* WITH_WSREP */
+
return err;
}
@@ -1359,7 +1413,7 @@ int ha_commit_trans(THD *thd, bool all)
}
#ifdef WITH_ARIA_STORAGE_ENGINE
- ha_maria::implicit_commit(thd, TRUE);
+ ha_maria::implicit_commit(thd, TRUE);
#endif
if (!ha_info)
@@ -1369,6 +1423,12 @@ int ha_commit_trans(THD *thd, bool all)
*/
if (is_real_trans)
thd->transaction.cleanup();
+#ifdef WITH_WSREP
+ if (WSREP(thd) && all && !error)
+ {
+ wsrep_commit_empty(thd, all);
+ }
+#endif /* WITH_WSREP */
DBUG_RETURN(0);
}
@@ -1396,8 +1456,7 @@ int ha_commit_trans(THD *thd, bool all)
We allow the owner of FTWRL to COMMIT; we assume that it knows
what it does.
*/
- mdl_request.init(MDL_key::COMMIT, "", "", MDL_INTENTION_EXCLUSIVE,
- MDL_EXPLICIT);
+ mdl_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT, MDL_EXPLICIT);
if (!WSREP(thd) &&
thd->mdl_context.acquire_lock(&mdl_request,
@@ -1455,7 +1514,28 @@ int ha_commit_trans(THD *thd, bool all)
if (trans->no_2pc || (rw_ha_count <= 1))
{
+#ifdef WITH_WSREP
+ /*
+ This commit will not go through log_and_order() where wsrep commit
+ ordering is normally done. Commit ordering must be done here.
+ */
+ bool run_wsrep_commit= (WSREP(thd) &&
+ rw_ha_count &&
+ wsrep_thd_is_local(thd) &&
+ wsrep_has_changes(thd, all));
+ if (run_wsrep_commit)
+ error= wsrep_before_commit(thd, all);
+ if (error)
+ {
+ ha_rollback_trans(thd, FALSE);
+ goto wsrep_err;
+ }
+#endif /* WITH_WSREP */
error= ha_commit_one_phase(thd, all);
+#ifdef WITH_WSREP
+ if (run_wsrep_commit)
+ error= wsrep_after_commit(thd, all);
+#endif /* WITH_WSREP */
goto done;
}
@@ -1487,10 +1567,14 @@ int ha_commit_trans(THD *thd, bool all)
DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_SUICIDE(););
#ifdef WITH_WSREP
- if (!error && WSREP_ON && wsrep_is_wsrep_xid(&thd->transaction.xid_state.xid))
+ if (!error && WSREP_ON)
{
- // xid was rewritten by wsrep
- xid= wsrep_xid_seqno(thd->transaction.xid_state.xid);
+ wsrep::seqno const s= wsrep_xid_seqno(thd->wsrep_xid);
+ if (!s.is_undefined())
+ {
+ // xid was rewritten by wsrep
+ xid= s.get();
+ }
}
#endif /* WITH_WSREP */
@@ -1499,18 +1583,35 @@ int ha_commit_trans(THD *thd, bool all)
error= commit_one_phase_2(thd, all, trans, is_real_trans);
goto done;
}
-
+#ifdef WITH_WSREP
+ if (wsrep_before_commit(thd, all))
+ goto wsrep_err;
+#endif /* WITH_WSREP */
DEBUG_SYNC(thd, "ha_commit_trans_before_log_and_order");
cookie= tc_log->log_and_order(thd, xid, all, need_prepare_ordered,
need_commit_ordered);
if (!cookie)
+ {
+ WSREP_DEBUG("log_and_order has failed %llu %d", thd->thread_id, cookie);
goto err;
-
+ }
DEBUG_SYNC(thd, "ha_commit_trans_after_log_and_order");
DBUG_EXECUTE_IF("crash_commit_after_log", DBUG_SUICIDE(););
error= commit_one_phase_2(thd, all, trans, is_real_trans) ? 2 : 0;
-
+#ifdef WITH_WSREP
+ if (error || wsrep_after_commit(thd, all))
+ {
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (thd->wsrep_trx().state() == wsrep::transaction::s_must_abort)
+ {
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ (void)tc_log->unlog(cookie, xid);
+ goto wsrep_err;
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ }
+#endif /* WITH_WSREP */
DBUG_EXECUTE_IF("crash_commit_before_unlog", DBUG_SUICIDE(););
if (tc_log->unlog(cookie, xid))
{
@@ -1532,6 +1633,19 @@ done:
goto end;
/* Come here if error and we need to rollback. */
+#ifdef WITH_WSREP
+wsrep_err:
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (thd->wsrep_trx().state() == wsrep::transaction::s_must_abort)
+ {
+ WSREP_DEBUG("BF abort has happened after prepare & certify");
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ ha_rollback_trans(thd, TRUE);
+ }
+ else
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+
+#endif /* WITH_WSREP */
err:
error= 1; /* Transaction was rolled back */
/*
@@ -1541,7 +1655,11 @@ err:
*/
if (!(thd->rgi_slave && thd->rgi_slave->is_parallel_exec))
ha_rollback_trans(thd, all);
-
+ else
+ {
+ WSREP_DEBUG("rollback skipped %p %d",thd->rgi_slave,
+ thd->rgi_slave->is_parallel_exec);
+ }
end:
if (rw_trans && mdl_request.ticket)
{
@@ -1553,6 +1671,13 @@ end:
*/
thd->mdl_context.release_lock(mdl_request.ticket);
}
+#ifdef WITH_WSREP
+ if (WSREP(thd) && all && !error && (rw_ha_count == 0))
+ {
+ wsrep_commit_empty(thd, all);
+ }
+#endif /* WITH_WSREP */
+
DBUG_RETURN(error);
}
@@ -1710,6 +1835,9 @@ int ha_rollback_trans(THD *thd, bool all)
DBUG_RETURN(1);
}
+#ifdef WITH_WSREP
+ (void) wsrep_before_rollback(thd, all);
+#endif /* WITH_WSREP */
if (ha_info)
{
/* Close all cursors that can not survive ROLLBACK */
@@ -1725,9 +1853,9 @@ int ha_rollback_trans(THD *thd, bool all)
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
error=1;
#ifdef WITH_WSREP
- WSREP_WARN("handlerton rollback failed, thd %llu %lld conf %d SQL %s",
- thd->thread_id, thd->query_id, thd->wsrep_conflict_state,
- thd->query());
+ WSREP_WARN("handlerton rollback failed, thd %lld %lld conf %d SQL %s",
+ thd->thread_id, thd->query_id, thd->wsrep_trx().state(),
+ thd->query());
#endif /* WITH_WSREP */
}
status_var_increment(thd->status_var.ha_rollback_count);
@@ -1746,6 +1874,15 @@ int ha_rollback_trans(THD *thd, bool all)
thd->transaction.xid_state.xa_state != XA_NOTR)
thd->transaction.xid_state.rm_error= thd->get_stmt_da()->sql_errno();
+#ifdef WITH_WSREP
+ if (thd->is_error())
+ {
+ WSREP_DEBUG("ha_rollback_trans(%lld, %s) rolled back: %s: %s; is_real %d",
+ thd->thread_id, all?"TRUE":"FALSE", WSREP_QUERY(thd),
+ thd->get_stmt_da()->message(), is_real_trans);
+ }
+ (void) wsrep_after_rollback(thd, all);
+#endif /* WITH_WSREP */
/* Always cleanup. Even if nht==0. There may be savepoints. */
if (is_real_trans)
{
@@ -1879,6 +2016,28 @@ static char* xid_to_str(char *buf, XID *xid)
}
#endif
+#ifdef WITH_WSREP
+static my_xid wsrep_order_and_check_continuity(XID *list, int len)
+{
+ wsrep_sort_xid_array(list, len);
+ wsrep::gtid cur_position= wsrep_get_SE_checkpoint();
+ long long cur_seqno= cur_position.seqno().get();
+ for (int i= 0; i < len; ++i)
+ {
+ if (!wsrep_is_wsrep_xid(list + i) ||
+ wsrep_xid_seqno(list + i) != cur_seqno + 1)
+ {
+ WSREP_WARN("Discovered discontinuity in recovered wsrep "
+ "transaction XIDs. Truncating the recovery list to "
+ "%d entries", i);
+ break;
+ }
+ ++cur_seqno;
+ }
+ WSREP_INFO("Last wsrep seqno to be recovered %lld", cur_seqno);
+ return (cur_seqno < 0 ? 0 : cur_seqno);
+}
+#endif /* WITH_WSREP */
/**
recover() step of xa.
@@ -1916,10 +2075,32 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
{
sql_print_information("Found %d prepared transaction(s) in %s",
got, hton_name(hton)->str);
+#ifdef WITH_WSREP
+ /* If wsrep_on=ON, XIDs are first ordered and then the range of
+ recovered XIDs is checked for continuity. All the XIDs which
+ are in continuous range can be safely committed if binlog
+ is off since they have already ordered and certified in the
+ cluster.
+
+ The discontinuity of wsrep XIDs may happen because the GTID
+ is assigned for transaction in wsrep_before_prepare(), but the
+ commit order is entered in wsrep_before_commit(). This means that
+ transactions may run prepare step out of order and may
+ result in gap in wsrep XIDs. This can be the case for example
+ if we have T1 with seqno 1 and T2 with seqno 2 and the server
+ crashes after T2 finishes prepare step but before T1 starts
+ the prepare.
+ */
+ my_xid wsrep_limit= 0;
+ if (WSREP_ON)
+ {
+ wsrep_limit= wsrep_order_and_check_continuity(info->list, got);
+ }
+#endif /* WITH_WSREP */
for (int i=0; i < got; i ++)
{
my_xid x= IF_WSREP(WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ?
- wsrep_xid_seqno(info->list[i]) :
+ wsrep_xid_seqno(&info->list[i]) :
info->list[i].get_my_xid(),
info->list[i].get_my_xid());
if (!x) // not "mine" - that is generated by external TM
@@ -1938,9 +2119,12 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
continue;
}
// recovery mode
- if (info->commit_list ?
- my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 :
- tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)
+ if (IF_WSREP((wsrep_emulate_bin_log &&
+ wsrep_is_wsrep_xid(info->list + i) &&
+ x <= wsrep_limit), false) ||
+ (info->commit_list ?
+ my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 :
+ tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT))
{
#ifndef DBUG_OFF
int rc=
@@ -2298,11 +2482,26 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
{
int err;
handlerton *ht= ha_info->ht();
+#ifdef WITH_WSREP
+ if (WSREP(thd) && ht->flags & HTON_WSREP_REPLICATION)
+ {
+ WSREP_DEBUG("ha_rollback_to_savepoint: run before_rollbackha_rollback_trans hook");
+ (void) wsrep_before_rollback(thd, !thd->in_sub_stmt);
+
+ }
+#endif // WITH_WSREP
if ((err= ht->rollback(ht, thd, !thd->in_sub_stmt)))
{ // cannot happen
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
error=1;
}
+#ifdef WITH_WSREP
+ if (WSREP(thd) && ht->flags & HTON_WSREP_REPLICATION)
+ {
+ WSREP_DEBUG("ha_rollback_to_savepoint: run after_rollback hook");
+ (void) wsrep_after_rollback(thd, !thd->in_sub_stmt);
+ }
+#endif // WITH_WSREP
status_var_increment(thd->status_var.ha_rollback_count);
ha_info_next= ha_info->next();
ha_info->reset(); /* keep it conveniently zero-filled */
@@ -2319,6 +2518,16 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
*/
int ha_savepoint(THD *thd, SAVEPOINT *sv)
{
+#ifdef WITH_WSREP
+ /*
+ Register binlog hton for savepoint processing if wsrep binlog
+ emulation is on.
+ */
+ if (WSREP_EMULATE_BINLOG(thd) && wsrep_thd_is_local(thd))
+ {
+ wsrep_register_binlog_handler(thd, thd->in_multi_stmt_transaction_mode());
+ }
+#endif /* WITH_WSREP */
int error=0;
THD_TRANS *trans= (thd->in_sub_stmt ? &thd->transaction.stmt :
&thd->transaction.all);
@@ -5966,6 +6175,12 @@ bool handler::check_table_binlog_row_based(bool binlog_row)
return false;
if (unlikely((table->in_use->variables.sql_log_bin_off)))
return 0; /* Called by partitioning engine */
+#ifdef WITH_WSREP
+ if (!table->in_use->variables.sql_log_bin &&
+ wsrep_thd_is_applying(table->in_use))
+ return 0; /* wsrep patch sets sql_log_bin to silence binlogging
+ from high priority threads */
+#endif /* WITH_WSREP */
if (unlikely((!check_table_binlog_row_based_done)))
{
check_table_binlog_row_based_done= 1;
@@ -5996,12 +6211,12 @@ bool handler::check_table_binlog_row_based_internal(bool binlog_row)
Otherwise, return 'true' if binary logging is on.
*/
IF_WSREP(((WSREP_EMULATE_BINLOG(thd) &&
- (thd->wsrep_exec_mode != REPL_RECV)) ||
+ wsrep_thd_is_local(thd)) ||
((WSREP(thd) ||
(thd->variables.option_bits & OPTION_BIN_LOG)) &&
mysql_bin_log.is_open())),
- (thd->variables.option_bits & OPTION_BIN_LOG) &&
- mysql_bin_log.is_open()));
+ (thd->variables.option_bits & OPTION_BIN_LOG) &&
+ mysql_bin_log.is_open()));
}
@@ -6126,23 +6341,9 @@ int binlog_log_row(TABLE* table, const uchar *before_record,
/* only InnoDB tables will be replicated through binlog emulation */
if ((WSREP_EMULATE_BINLOG(thd) &&
- table->file->partition_ht()->db_type != DB_TYPE_INNODB) ||
- (thd->wsrep_ignore_table == true))
+ !(table->file->partition_ht()->flags & HTON_WSREP_REPLICATION)) ||
+ thd->wsrep_ignore_table == true)
return 0;
-
- /* enforce wsrep_max_ws_rows */
- if (WSREP(thd) && table->s->tmp_table == NO_TMP_TABLE)
- {
- thd->wsrep_affected_rows++;
- if (wsrep_max_ws_rows &&
- thd->wsrep_exec_mode != REPL_RECV &&
- thd->wsrep_affected_rows > wsrep_max_ws_rows)
- {
- trans_rollback_stmt(thd) || trans_rollback(thd);
- my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
- return ER_ERROR_DURING_COMMIT;
- }
- }
#endif
if (!table->file->check_table_binlog_row_based(1))
@@ -6255,6 +6456,27 @@ int handler::ha_reset()
DBUG_RETURN(reset());
}
+#ifdef WITH_WSREP
+static int wsrep_after_row(THD *thd)
+{
+ DBUG_ENTER("wsrep_after_row");
+ /* enforce wsrep_max_ws_rows */
+ thd->wsrep_affected_rows++;
+ if (wsrep_max_ws_rows &&
+ wsrep_thd_is_local(thd) &&
+ thd->wsrep_affected_rows > wsrep_max_ws_rows)
+ {
+ trans_rollback_stmt(thd) || trans_rollback(thd);
+ my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
+ DBUG_RETURN(ER_ERROR_DURING_COMMIT);
+ }
+ else if (wsrep_after_row(thd, false))
+ {
+ DBUG_RETURN(ER_LOCK_DEADLOCK);
+ }
+ DBUG_RETURN(0);
+}
+#endif /* WITH_WSREP */
int handler::ha_write_row(uchar *buf)
{
@@ -6277,7 +6499,15 @@ int handler::ha_write_row(uchar *buf)
{
rows_changed++;
error= binlog_log_row(table, 0, buf, log_func);
+#ifdef WITH_WSREP
+ if (table_share->tmp_table == NO_TMP_TABLE &&
+ WSREP(ha_thd()) && (error= wsrep_after_row(ha_thd())))
+ {
+ DBUG_RETURN(error);
+ }
+#endif /* WITH_WSREP */
}
+
DEBUG_SYNC_C("ha_write_row_end");
DBUG_RETURN(error);
}
@@ -6309,6 +6539,13 @@ int handler::ha_update_row(const uchar *old_data, const uchar *new_data)
{
rows_changed++;
error= binlog_log_row(table, old_data, new_data, log_func);
+#ifdef WITH_WSREP
+ if (table_share->tmp_table == NO_TMP_TABLE &&
+ WSREP(ha_thd()) && (error= wsrep_after_row(ha_thd())))
+ {
+ return error;
+ }
+#endif /* WITH_WSREP */
}
return error;
}
@@ -6364,6 +6601,13 @@ int handler::ha_delete_row(const uchar *buf)
{
rows_changed++;
error= binlog_log_row(table, buf, 0, log_func);
+#ifdef WITH_WSREP
+ if (table_share->tmp_table == NO_TMP_TABLE &&
+ WSREP(ha_thd()) && (error= wsrep_after_row(ha_thd())))
+ {
+ return error;
+ }
+#endif /* WITH_WSREP */
}
return error;
}
@@ -6553,7 +6797,7 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
DBUG_ENTER("ha_abort_transaction");
if (!WSREP(bf_thd) &&
!(bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU &&
- bf_thd->wsrep_exec_mode == TOTAL_ORDER)) {
+ wsrep_thd_is_toi(bf_thd))) {
DBUG_RETURN(0);
}
@@ -6569,54 +6813,6 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
DBUG_RETURN(0);
}
-
-void ha_fake_trx_id(THD *thd)
-{
- DBUG_ENTER("ha_fake_trx_id");
-
- bool no_fake_trx_id= true;
-
- if (!WSREP(thd))
- {
- DBUG_VOID_RETURN;
- }
-
- if (thd->wsrep_ws_handle.trx_id != WSREP_UNDEFINED_TRX_ID)
- {
- WSREP_DEBUG("fake trx id skipped: %" PRIu64, thd->wsrep_ws_handle.trx_id);
- DBUG_VOID_RETURN;
- }
-
- /* Try statement transaction if standard one is not set. */
- THD_TRANS *trans= (thd->transaction.all.ha_list) ? &thd->transaction.all :
- &thd->transaction.stmt;
-
- Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
-
- for (; ha_info; ha_info= ha_info_next)
- {
- handlerton *hton= ha_info->ht();
- if (hton->fake_trx_id)
- {
- hton->fake_trx_id(hton, thd);
-
- /* Got a fake trx id. */
- no_fake_trx_id= false;
-
- /*
- We need transaction ID from just one storage engine providing
- fake_trx_id (which will most likely be the case).
- */
- break;
- }
- ha_info_next= ha_info->next();
- }
-
- if (unlikely(no_fake_trx_id))
- WSREP_WARN("Cannot get fake transaction ID from storage engine.");
-
- DBUG_VOID_RETURN;
-}
#endif /* WITH_WSREP */
@@ -6904,6 +7100,10 @@ int del_global_index_stat(THD *thd, TABLE* table, KEY* key_info)
DBUG_RETURN(res);
}
+/*****************************************************************************
+ VERSIONING functions
+******************************************************************************/
+
bool Vers_parse_info::is_start(const char *name) const
{
DBUG_ASSERT(name);
diff --git a/sql/handler.h b/sql/handler.h
index ee730e8a725..27e38e9c36f 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -116,7 +116,13 @@ enum enum_alter_inplace_result {
#define HA_NO_BLOBS (1ULL << 9) /* Doesn't support blobs */
#define HA_CAN_INDEX_BLOBS (1ULL << 10)
#define HA_AUTO_PART_KEY (1ULL << 11) /* auto-increment in multi-part key */
-#define HA_REQUIRE_PRIMARY_KEY (1ULL << 12) /* .. and can't create a hidden one */
+/*
+ The engine requires every table to have a user-specified PRIMARY KEY.
+ Do not set the flag if the engine can generate a hidden primary key internally.
+ This flag is ignored if a SEQUENCE is created (which, in turn, needs
+ HA_CAN_TABLES_WITHOUT_ROLLBACK flag)
+*/
+#define HA_REQUIRE_PRIMARY_KEY (1ULL << 12)
#define HA_STATS_RECORDS_IS_EXACT (1ULL << 13) /* stats.records is exact */
/*
INSERT_DELAYED only works with handlers that uses MySQL internal table
@@ -300,10 +306,19 @@ enum enum_alter_inplace_result {
#define HA_CAN_MULTISTEP_MERGE (1LL << 53)
/* calling cmp_ref() on the engine is expensive */
-#define HA_CMP_REF_IS_EXPENSIVE (1ULL << 54)
+#define HA_SLOW_CMP_REF (1ULL << 54)
+#define HA_CMP_REF_IS_EXPENSIVE HA_SLOW_CMP_REF
+
+/**
+ Some engines are unable to provide an efficient implementation for rnd_pos().
+ Server will try to avoid it, if possible
+
+ TODO better to do it with cost estimates, not with an explicit flag
+*/
+#define HA_SLOW_RND_POS (1ULL << 55)
-/* Engine wants primary keys for everything except sequences */
-#define HA_WANTS_PRIMARY_KEY (1ULL << 55)
+/* Safe for online backup */
+#define HA_CAN_ONLINE_BACKUPS (1ULL << 56)
/* bits in index_flags(index_number) for what you can do with index */
#define HA_READ_NEXT 1 /* TODO really use this flag */
@@ -418,6 +433,12 @@ enum enum_alter_inplace_result {
#define HA_KEY_NULL_LENGTH 1
#define HA_KEY_BLOB_LENGTH 2
+/* Maximum length of any index lookup key, in bytes */
+
+#define MAX_KEY_LENGTH (MAX_DATA_LENGTH_FOR_KEY \
+ +(MAX_REF_PARTS \
+ *(HA_KEY_NULL_LENGTH + HA_KEY_BLOB_LENGTH)))
+
#define HA_LEX_CREATE_TMP_TABLE 1U
#define HA_CREATE_TMP_ALTER 8U
#define HA_LEX_CREATE_SEQUENCE 16U
@@ -1467,7 +1488,6 @@ struct handlerton
THD *victim_thd, my_bool signal);
int (*set_checkpoint)(handlerton *hton, const XID* xid);
int (*get_checkpoint)(handlerton *hton, XID* xid);
- void (*fake_trx_id)(handlerton *hton, THD *thd);
/*
Optional clauses in the CREATE/ALTER TABLE
*/
@@ -1604,6 +1624,10 @@ struct handlerton
@return transaction commit ID
@retval 0 if no system-versioned data was affected by the transaction */
ulonglong (*prepare_commit_versioned)(THD *thd, ulonglong *trx_id);
+
+ /* backup */
+ void (*prepare_for_backup)(void);
+ void (*end_backup)(void);
};
@@ -1660,6 +1684,9 @@ handlerton *ha_default_tmp_handlerton(THD *thd);
// Engine needs to access the main connect string in partitions
#define HTON_CAN_READ_CONNECT_STRING_IN_PARTITION (1 <<12)
+/* can be replicated by wsrep replication provider plugin */
+#define HTON_WSREP_REPLICATION (1 << 13)
+
class Ha_trx_info;
struct THD_TRANS
@@ -3829,14 +3856,14 @@ public:
uint max_key_parts() const
{ return MY_MIN(MAX_REF_PARTS, max_supported_key_parts()); }
uint max_key_length() const
- { return MY_MIN(MAX_KEY_LENGTH, max_supported_key_length()); }
+ { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_length()); }
uint max_key_part_length() const
- { return MY_MIN(MAX_KEY_LENGTH, max_supported_key_part_length()); }
+ { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_part_length()); }
virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
virtual uint max_supported_keys() const { return 0; }
virtual uint max_supported_key_parts() const { return MAX_REF_PARTS; }
- virtual uint max_supported_key_length() const { return MAX_KEY_LENGTH; }
+ virtual uint max_supported_key_length() const { return MAX_DATA_LENGTH_FOR_KEY; }
virtual uint max_supported_key_part_length() const { return 255; }
virtual uint min_record_length(uint options) const { return 1; }
@@ -4719,6 +4746,7 @@ public:
{ DBUG_ASSERT(ht); return partition_ht()->flags & HTON_NATIVE_SYS_VERSIONING; }
virtual void update_partition(uint part_id)
{}
+
protected:
Handler_share *get_ha_share_ptr();
void set_ha_share_ptr(Handler_share *arg_ha_share);
@@ -4797,6 +4825,8 @@ int ha_create_table(THD *thd, const char *path,
HA_CREATE_INFO *create_info, LEX_CUSTRING *frm);
int ha_delete_table(THD *thd, handlerton *db_type, const char *path,
const LEX_CSTRING *db, const LEX_CSTRING *alias, bool generate_warning);
+void ha_prepare_for_backup();
+void ha_end_backup();
/* statistics and info */
bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat);
@@ -4864,9 +4894,6 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv);
int ha_release_savepoint(THD *thd, SAVEPOINT *sv);
#ifdef WITH_WSREP
int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal);
-void ha_fake_trx_id(THD *thd);
-#else
-inline void ha_fake_trx_id(THD *thd) { }
#endif
/* these are called by storage engines */
diff --git a/sql/init.h b/sql/init.h
index e96bb478cee..0bb67b293ed 100644
--- a/sql/init.h
+++ b/sql/init.h
@@ -17,6 +17,5 @@
#define INIT_INCLUDED
void unireg_init(ulong options);
-void unireg_end(void);
#endif /* INIT_INCLUDED */
diff --git a/sql/innodb_priv.h b/sql/innodb_priv.h
index 7fbaa7cfc2f..b78724d04b0 100644
--- a/sql/innodb_priv.h
+++ b/sql/innodb_priv.h
@@ -19,15 +19,13 @@
/** @file Declaring server-internal functions that are used by InnoDB. */
#include <sql_priv.h>
+#include <strfunc.h> /* strconvert */
class THD;
int get_quote_char_for_identifier(THD *thd, const char *name, size_t length);
bool schema_table_store_record(THD *thd, TABLE *table);
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
-uint strconvert(CHARSET_INFO *from_cs, const char *from, size_t from_length,
- CHARSET_INFO *to_cs, char *to, size_t to_length,
- uint *errors);
void sql_print_error(const char *format, ...);
diff --git a/sql/item.cc b/sql/item.cc
index d4cfa790986..4387d67e615 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -118,12 +118,12 @@ void Item::push_note_converted_to_positive_complement(THD *thd)
longlong Item::val_datetime_packed_result(THD *thd)
{
MYSQL_TIME ltime, tmp;
- if (get_date_result(thd, &ltime, Datetime::comparison_flags_for_get_date()))
+ if (get_date_result(thd, &ltime, Datetime::Options_cmp(thd)))
return 0;
if (ltime.time_type != MYSQL_TIMESTAMP_TIME)
return pack_time(&ltime);
- if ((null_value= time_to_datetime_with_warn(thd, &ltime,
- &tmp, date_mode_t(0))))
+ if ((null_value= time_to_datetime_with_warn(thd, &ltime, &tmp,
+ TIME_CONV_NONE)))
return 0;
return pack_time(&tmp);
}
@@ -305,7 +305,7 @@ int Item::save_date_in_field(Field *field, bool no_conversions)
{
MYSQL_TIME ltime;
THD *thd= field->table->in_use;
- if (get_date(thd, &ltime, sql_mode_for_dates(thd)))
+ if (get_date(thd, &ltime, Datetime::Options(thd)))
return set_field_to_null_with_conversions(field, no_conversions);
field->set_notnull();
return field->store_time_dec(&ltime, decimals);
@@ -374,6 +374,15 @@ Item::Item(THD *thd):
}
+const TABLE_SHARE *Item::field_table_or_null()
+{
+ if (real_item()->type() != Item::FIELD_ITEM)
+ return NULL;
+
+ return ((Item_field *) this)->field->table->s;
+}
+
+
/**
Constructor used by Item_field, Item_ref & aggregate (sum)
functions.
@@ -1279,6 +1288,7 @@ bool Item::get_date_from_int(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
Longlong_hybrid value(val_int(), unsigned_flag);
return null_value || int_to_datetime_with_warn(thd, value,
ltime, fuzzydate,
+ field_table_or_null(),
field_name_or_null());
}
@@ -1288,6 +1298,7 @@ bool Item::get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate
double value= val_real();
return null_value || double_to_datetime_with_warn(thd, value,
ltime, fuzzydate,
+ field_table_or_null(),
field_name_or_null());
}
@@ -1295,7 +1306,8 @@ bool Item::get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate
bool Item::get_date_from_string(THD *thd, MYSQL_TIME *to, date_mode_t mode)
{
StringBuffer<40> tmp;
- Temporal::Warn_push warn(thd, field_name_or_null(), to, mode);
+ Temporal::Warn_push warn(thd, field_table_or_null(), field_name_or_null(),
+ to, mode);
Temporal_hybrid *t= new(to) Temporal_hybrid(thd, &warn, val_str(&tmp), mode);
return !t->is_valid_temporal();
}
@@ -1526,6 +1538,12 @@ String *Item_sp_variable::val_str(String *sp)
}
+bool Item_sp_variable::val_native(THD *thd, Native *to)
+{
+ return val_native_from_item(thd, this_item(), to);
+}
+
+
my_decimal *Item_sp_variable::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed);
@@ -3178,6 +3196,18 @@ bool Item_field::get_date_result(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzyd
}
+bool Item_field::val_native(THD *thd, Native *to)
+{
+ return val_native_from_field(field, to);
+}
+
+
+bool Item_field::val_native_result(THD *thd, Native *to)
+{
+ return val_native_from_field(result_field, to);
+}
+
+
void Item_field::save_result(Field *to)
{
save_field_in_field(result_field, &null_value, to, TRUE);
@@ -3971,7 +4001,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
{
ErrConvTime str(&value.time);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- &str, time_type, 0);
+ &str, time_type, 0, 0);
set_zero_time(&value.time, time_type);
}
maybe_null= 0;
@@ -4843,6 +4873,12 @@ String* Item_ref_null_helper::val_str(String* s)
}
+bool Item_ref_null_helper::val_native(THD *thd, Native *to)
+{
+ return (owner->was_null|= val_native_from_item(thd, *ref, to));
+}
+
+
bool Item_ref_null_helper::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
return (owner->was_null|= null_value= (*ref)->get_date_result(thd, ltime, fuzzydate));
@@ -7375,13 +7411,21 @@ Item *Item_field::derived_field_transformer_for_having(THD *thd, uchar *arg)
return this;
if (!item_equal && used_tables() != tab_map)
return this;
- return get_field_item_for_having(thd, this, sel);
+ Item *item= get_field_item_for_having(thd, this, sel);
+ if (item)
+ item->marker|= SUBSTITUTION_FL;
+ return item;
}
Item *Item_direct_view_ref::derived_field_transformer_for_having(THD *thd,
uchar *arg)
{
+ if ((*ref)->marker & SUBSTITUTION_FL)
+ {
+ this->marker|= SUBSTITUTION_FL;
+ return this;
+ }
st_select_lex *sel= (st_select_lex *)arg;
table_map tab_map= sel->master_unit()->derived->table->map;
if ((item_equal && !(item_equal->used_tables() & tab_map)) ||
@@ -7432,13 +7476,20 @@ Item *Item_field::derived_field_transformer_for_where(THD *thd, uchar *arg)
st_select_lex *sel= (st_select_lex *)arg;
Item *producing_item= find_producing_item(this, sel);
if (producing_item)
- return producing_item->build_clone(thd);
+ {
+ Item *producing_clone= producing_item->build_clone(thd);
+ if (producing_clone)
+ producing_clone->marker|= SUBSTITUTION_FL;
+ return producing_clone;
+ }
return this;
}
Item *Item_direct_view_ref::derived_field_transformer_for_where(THD *thd,
uchar *arg)
{
+ if ((*ref)->marker & SUBSTITUTION_FL)
+ return (*ref);
if (item_equal)
{
st_select_lex *sel= (st_select_lex *)arg;
@@ -7489,7 +7540,13 @@ Item *Item_field::grouping_field_transformer_for_where(THD *thd, uchar *arg)
st_select_lex *sel= (st_select_lex *)arg;
Field_pair *gr_field= find_matching_grouping_field(this, sel);
if (gr_field)
- return gr_field->corresponding_item->build_clone(thd);
+ {
+ Item *producing_clone=
+ gr_field->corresponding_item->build_clone(thd);
+ if (producing_clone)
+ producing_clone->marker|= SUBSTITUTION_FL;
+ return producing_clone;
+ }
return this;
}
@@ -7498,6 +7555,11 @@ Item *
Item_direct_view_ref::grouping_field_transformer_for_where(THD *thd,
uchar *arg)
{
+ if ((*ref)->marker & SUBSTITUTION_FL)
+ {
+ this->marker|= SUBSTITUTION_FL;
+ return this;
+ }
if (!item_equal)
return this;
st_select_lex *sel= (st_select_lex *)arg;
@@ -8009,7 +8071,9 @@ void Item_ref::print(String *str, enum_query_type query_type)
{
if (ref)
{
- if ((*ref)->type() != Item::CACHE_ITEM && ref_type() != VIEW_REF &&
+ if ((*ref)->type() != Item::CACHE_ITEM &&
+ (*ref)->type() != Item::WINDOW_FUNC_ITEM &&
+ ref_type() != VIEW_REF &&
!table_name && name.str && alias_name_used)
{
THD *thd= current_thd;
@@ -8077,6 +8141,14 @@ String *Item_ref::str_result(String* str)
}
+bool Item_ref::val_native_result(THD *thd, Native *to)
+{
+ return result_field ?
+ val_native_from_field(result_field, to) :
+ val_native(thd, to);
+}
+
+
my_decimal *Item_ref::val_decimal_result(my_decimal *decimal_value)
{
if (result_field)
@@ -8171,6 +8243,12 @@ bool Item_ref::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
}
+bool Item_ref::val_native(THD *thd, Native *to)
+{
+ return val_native_from_item(thd, *ref, to);
+}
+
+
my_decimal *Item_ref::val_decimal(my_decimal *decimal_value)
{
my_decimal *val= (*ref)->val_decimal_result(decimal_value);
@@ -8308,6 +8386,12 @@ bool Item_direct_ref::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydat
}
+bool Item_direct_ref::val_native(THD *thd, Native *to)
+{
+ return val_native_from_item(thd, *ref, to);
+}
+
+
Item_cache_wrapper::~Item_cache_wrapper()
{
DBUG_ASSERT(expr_cache == 0);
@@ -8597,6 +8681,28 @@ String *Item_cache_wrapper::val_str(String* str)
/**
+ Get the native value of the possibly cached item
+*/
+
+bool Item_cache_wrapper::val_native(THD *thd, Native* to)
+{
+ Item *cached_value;
+ DBUG_ENTER("Item_cache_wrapper::val_native");
+ if (!expr_cache)
+ DBUG_RETURN(val_native_from_item(thd, orig_item, to));
+
+ if ((cached_value= check_cache()))
+ DBUG_RETURN(val_native_from_item(thd, cached_value, to));
+
+ cache();
+ if ((null_value= expr_value->null_value))
+ DBUG_RETURN(true);
+ DBUG_RETURN(expr_value->val_native(thd, to));
+}
+
+
+
+/**
Get the decimal value of the possibly cached item
*/
@@ -9021,8 +9127,23 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
fixed= 1;
return FALSE;
}
+
+ /*
+ DEFAULT() do not need table field so should not ask handler to bring
+ field value (mark column for read)
+ */
+ enum_column_usage save_column_usage= thd->column_usage;
+ /*
+ Fields which has defult value could be read, so it is better hide system
+ invisible columns.
+ */
+ thd->column_usage= COLUMNS_WRITE;
if (arg->fix_fields_if_needed(thd, &arg))
+ {
+ thd->column_usage= save_column_usage;
goto error;
+ }
+ thd->column_usage= save_column_usage;
real_arg= arg->real_item();
if (real_arg->type() != FIELD_ITEM)
@@ -9042,15 +9163,19 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
goto error;
memcpy((void *)def_field, (void *)field_arg->field,
field_arg->field->size_of());
- IF_DBUG_ASSERT(def_field->is_stat_field=1,); // a hack to fool ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED
+ // If non-constant default value expression
if (def_field->default_value && def_field->default_value->flags)
{
uchar *newptr= (uchar*) thd->alloc(1+def_field->pack_length());
if (!newptr)
goto error;
+ /*
+ Even if DEFAULT() do not read tables fields, the default value
+ expression can do it.
+ */
fix_session_vcol_expr_for_read(thd, def_field, def_field->default_value);
if (should_mark_column(thd->column_usage))
- def_field->default_value->expr->walk(&Item::register_field_in_read_map, 1, 0);
+ def_field->default_value->expr->update_used_tables();
def_field->move_field(newptr+1, def_field->maybe_null() ? newptr : 0, 1);
}
else
@@ -9074,6 +9199,12 @@ void Item_default_value::print(String *str, enum_query_type query_type)
return;
}
str->append(STRING_WITH_LEN("default("));
+ /*
+ We take DEFAULT from a field so do not need it value in case of const
+ tables but its name so we set QT_NO_DATA_EXPANSION (as we print for
+ table definition, also we do not need table and database name)
+ */
+ query_type= (enum_query_type) (query_type | QT_NO_DATA_EXPANSION);
arg->print(str, query_type);
str->append(')');
}
@@ -9681,7 +9812,8 @@ bool Item_cache_temporal::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzz
int Item_cache_temporal::save_in_field(Field *field, bool no_conversions)
{
MYSQL_TIME ltime;
- if (get_date(field->get_thd(), &ltime, date_mode_t(0)))
+ // This is a temporal type. No nanoseconds, so round mode is not important.
+ if (get_date(field->get_thd(), &ltime, TIME_CONV_NONE | TIME_FRAC_NONE))
return set_field_to_null_with_conversions(field, no_conversions);
field->set_notnull();
int error= field->store_time_dec(&ltime, decimals);
@@ -9742,6 +9874,62 @@ Item *Item_cache_time::make_literal(THD *thd)
return new (thd->mem_root) Item_time_literal(thd, &ltime, decimals);
}
+
+int Item_cache_timestamp::save_in_field(Field *field, bool no_conversions)
+{
+ if (!has_value())
+ return set_field_to_null_with_conversions(field, no_conversions);
+ return m_native.save_in_field(field, decimals);
+}
+
+
+bool Item_cache_timestamp::val_native(THD *thd, Native *to)
+{
+ if (!has_value())
+ {
+ null_value= true;
+ return true;
+ }
+ return null_value= to->copy(m_native);
+}
+
+
+Datetime Item_cache_timestamp::to_datetime(THD *thd)
+{
+ DBUG_ASSERT(is_fixed() == 1);
+ if (!has_value())
+ {
+ null_value= true;
+ return Datetime();
+ }
+ return Datetime(thd, Timestamp_or_zero_datetime(m_native).tv());
+}
+
+
+bool Item_cache_timestamp::get_date(THD *thd, MYSQL_TIME *ltime,
+ date_mode_t fuzzydate)
+{
+ if (!has_value())
+ {
+ set_zero_time(ltime, MYSQL_TIMESTAMP_DATETIME);
+ return true;
+ }
+ Timestamp_or_zero_datetime tm(m_native);
+ return (null_value= tm.to_TIME(thd, ltime, fuzzydate));
+}
+
+
+bool Item_cache_timestamp::cache_value()
+{
+ if (!example)
+ return false;
+ value_cached= true;
+ null_value= example->val_native_with_conversion_result(current_thd, &m_native,
+ type_handler());
+ return true;
+}
+
+
bool Item_cache_real::cache_value()
{
if (!example)
@@ -10262,6 +10450,9 @@ const char *dbug_print_unit(SELECT_LEX_UNIT *un)
return "Couldn't fit into buffer";
}
+const char *dbug_print(Item *x) { return dbug_print_item(x); }
+const char *dbug_print(SELECT_LEX *x) { return dbug_print_select(x); }
+const char *dbug_print(SELECT_LEX_UNIT *x) { return dbug_print_unit(x); }
#endif /*DBUG_OFF*/
diff --git a/sql/item.h b/sql/item.h
index c2666c35c67..fd9261c3424 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -151,6 +151,7 @@ bool mark_unsupported_function(const char *w1, const char *w2,
#define NO_EXTRACTION_FL (1 << 6)
#define FULL_EXTRACTION_FL (1 << 7)
+#define SUBSTITUTION_FL (1 << 8)
#define EXTRACTION_MASK (NO_EXTRACTION_FL | FULL_EXTRACTION_FL)
extern const char *item_empty_name;
@@ -854,6 +855,25 @@ protected:
res= NULL;
return res;
}
+ bool val_native_from_item(THD *thd, Item *item, Native *to)
+ {
+ DBUG_ASSERT(is_fixed());
+ null_value= item->val_native(thd, to);
+ DBUG_ASSERT(null_value == item->null_value);
+ return null_value;
+ }
+ bool val_native_from_field(Field *field, Native *to)
+ {
+ if ((null_value= field->is_null()))
+ return true;
+ return (null_value= field->val_native(to));
+ }
+ bool val_native_with_conversion_from_item(THD *thd, Item *item, Native *to,
+ const Type_handler *handler)
+ {
+ DBUG_ASSERT(is_fixed());
+ return null_value= item->val_native_with_conversion(thd, to, handler);
+ }
my_decimal *val_decimal_from_item(Item *item, my_decimal *decimal_value)
{
DBUG_ASSERT(is_fixed());
@@ -1183,6 +1203,10 @@ public:
If value is not null null_value flag will be reset to FALSE.
*/
virtual longlong val_int()=0;
+ Longlong_hybrid to_longlong_hybrid()
+ {
+ return Longlong_hybrid(val_int(), unsigned_flag);
+ }
Longlong_null to_longlong_null()
{
longlong nr= val_int();
@@ -1225,20 +1249,6 @@ public:
unsigned_flag to check the sign of the item.
*/
inline ulonglong val_uint() { return (ulonglong) val_int(); }
- /*
- Adjust the result of val_int() to an unsigned number:
- - NULL value is converted to 0. The caller can check "null_value"
- to distinguish between 0 and NULL when necessary.
- - Negative numbers are converted to 0.
- - Positive numbers bigger than upper_bound are converted to upper_bound.
- - Other numbers are returned as is.
- */
- ulonglong val_uint_from_val_int(ulonglong upper_bound)
- {
- longlong nr= val_int();
- return (null_value || (nr < 0 && !unsigned_flag)) ? 0 :
- (ulonglong) nr > upper_bound ? upper_bound : (ulonglong) nr;
- }
/*
Return string representation of this item object.
@@ -1271,6 +1281,60 @@ public:
*/
virtual String *val_str(String *str)=0;
+
+ bool val_native_with_conversion(THD *thd, Native *to, const Type_handler *th)
+ {
+ return th->Item_val_native_with_conversion(thd, this, to);
+ }
+ bool val_native_with_conversion_result(THD *thd, Native *to,
+ const Type_handler *th)
+ {
+ return th->Item_val_native_with_conversion_result(thd, this, to);
+ }
+
+ virtual bool val_native(THD *thd, Native *to)
+ {
+ /*
+ The default implementation for the Items that do not need native format:
+ - Item_basic_value
+ - Item_ident_for_show
+ - Item_copy
+ - Item_exists_subselect
+ - Item_sum_field
+ - Item_sum_or_func (default implementation)
+ - Item_proc
+ - Item_type_holder (as val_xxx() are never called for it);
+ - TODO: Item_name_const will need val_native() in the future,
+ when we add this syntax:
+ TIMESTAMP WITH LOCAL TIMEZONE'2001-01-01 00:00:00'
+
+ These hybrid Item types override val_native():
+ - Item_field
+ - Item_param
+ - Item_sp_variable
+ - Item_ref
+ - Item_cache_wrapper
+ - Item_direct_ref
+ - Item_direct_view_ref
+ - Item_ref_null_helper
+ - Item_sum_or_func
+ Note, these hybrid type Item_sum_or_func descendants
+ override the default implementation:
+ * Item_sum_hybrid
+ * Item_func_hybrid_field_type
+ * Item_func_min_max
+ * Item_func_sp
+ * Item_func_last_value
+ * Item_func_rollup_const
+ */
+ DBUG_ASSERT(0);
+ return null_value= true;
+ }
+ virtual bool val_native_result(THD *thd, Native *to)
+ {
+ return val_native(thd, to);
+ }
+
/*
Returns string representation of this item in ASCII format.
@@ -1423,6 +1487,7 @@ public:
virtual const char *full_name() const { return name.str ? name.str : "???"; }
const char *field_name_or_null()
{ return real_item()->type() == Item::FIELD_ITEM ? name.str : NULL; }
+ const TABLE_SHARE *field_table_or_null();
/*
*result* family of methods is analog of *val* family (see above) but
@@ -1631,28 +1696,28 @@ public:
bool get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
bool get_date_from_string(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
bool get_time(THD *thd, MYSQL_TIME *ltime)
- { return get_date(thd, ltime, Time::flags_for_get_date()); }
+ { return get_date(thd, ltime, Time::Options(thd)); }
// Get a DATE or DATETIME value in numeric packed format for comparison
virtual longlong val_datetime_packed(THD *thd)
{
- date_mode_t fuzzydate= Datetime::comparison_flags_for_get_date();
- return Datetime(current_thd, this, fuzzydate).to_packed();
+ return Datetime(thd, this, Datetime::Options_cmp(thd)).to_packed();
}
// Get a TIME value in numeric packed format for comparison
virtual longlong val_time_packed(THD *thd)
{
- return Time(thd, this, Time::comparison_flags_for_get_date()).to_packed();
+ return Time(thd, this, Time::Options_cmp(thd)).to_packed();
}
longlong val_datetime_packed_result(THD *thd);
longlong val_time_packed_result(THD *thd)
{
MYSQL_TIME ltime;
- date_mode_t fuzzydate= Time::comparison_flags_for_get_date();
- return get_date_result(thd, &ltime, fuzzydate) ? 0 : pack_time(&ltime);
+ return get_date_result(thd, &ltime, Time::Options_cmp(thd)) ? 0 :
+ pack_time(&ltime);
}
virtual bool get_date_result(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{ return get_date(thd, ltime,fuzzydate); }
+
/*
The method allows to determine nullness of a complex expression
without fully evaluating it, instead of calling val/result*() then
@@ -2684,6 +2749,7 @@ public:
String *val_str(String *sp);
my_decimal *val_decimal(my_decimal *decimal_value);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ bool val_native(THD *thd, Native *to);
bool is_null();
public:
@@ -3224,6 +3290,8 @@ public:
void save_result(Field *to);
double val_result();
longlong val_int_result();
+ bool val_native(THD *thd, Native *to);
+ bool val_native_result(THD *thd, Native *to);
String *str_result(String* tmp);
my_decimal *val_decimal_result(my_decimal *);
bool val_bool_result();
@@ -3810,6 +3878,11 @@ public:
return can_return_value() ? value.val_str(str, this) : NULL;
}
bool get_date(THD *thd, MYSQL_TIME *tm, date_mode_t fuzzydate);
+ bool val_native(THD *thd, Native *to)
+ {
+ return Item_param::type_handler()->Item_param_val_native(thd, this, to);
+ }
+
int save_in_field(Field *field, bool no_conversions);
void set_default();
@@ -4609,6 +4682,54 @@ public:
};
+class Item_timestamp_literal: public Item_literal
+{
+ Timestamp_or_zero_datetime m_value;
+public:
+ Item_timestamp_literal(THD *thd)
+ :Item_literal(thd)
+ { }
+ const Type_handler *type_handler() const { return &type_handler_timestamp2; }
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ Timestamp_or_zero_datetime_native native(m_value, decimals);
+ return native.save_in_field(field, decimals);
+ }
+ longlong val_int()
+ {
+ return m_value.to_datetime(current_thd).to_longlong();
+ }
+ double val_real()
+ {
+ return m_value.to_datetime(current_thd).to_double();
+ }
+ String *val_str(String *to)
+ {
+ return m_value.to_datetime(current_thd).to_string(to, decimals);
+ }
+ my_decimal *val_decimal(my_decimal *to)
+ {
+ return m_value.to_datetime(current_thd).to_decimal(to);
+ }
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ {
+ bool res= m_value.to_TIME(thd, ltime, fuzzydate);
+ DBUG_ASSERT(!res);
+ return res;
+ }
+ bool val_native(THD *thd, Native *to)
+ {
+ return m_value.to_native(to, decimals);
+ }
+ void set_value(const Timestamp_or_zero_datetime &value)
+ {
+ m_value= value;
+ }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_timestamp_literal>(thd, this); }
+};
+
+
class Item_temporal_literal :public Item_literal
{
protected:
@@ -5057,11 +5178,13 @@ public:
my_decimal *val_decimal(my_decimal *);
bool val_bool();
String *val_str(String* tmp);
+ bool val_native(THD *thd, Native *to);
bool is_null();
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
double val_result();
longlong val_int_result();
String *str_result(String* tmp);
+ bool val_native_result(THD *thd, Native *to);
my_decimal *val_decimal_result(my_decimal *);
bool val_bool_result();
bool is_null_result();
@@ -5266,6 +5389,7 @@ public:
double val_real();
longlong val_int();
String *val_str(String* tmp);
+ bool val_native(THD *thd, Native *to);
my_decimal *val_decimal(my_decimal *);
bool val_bool();
bool is_null();
@@ -5362,6 +5486,7 @@ public:
double val_real();
longlong val_int();
String *val_str(String* tmp);
+ bool val_native(THD *thd, Native *to);
my_decimal *val_decimal(my_decimal *);
bool val_bool();
bool is_null();
@@ -5558,6 +5683,12 @@ public:
else
return Item_direct_ref::val_str(tmp);
}
+ bool val_native(THD *thd, Native *to)
+ {
+ if (check_null_ref())
+ return true;
+ return Item_direct_ref::val_native(thd, to);
+ }
my_decimal *val_decimal(my_decimal *tmp)
{
if (check_null_ref())
@@ -5703,6 +5834,7 @@ public:
my_decimal *val_decimal(my_decimal *);
bool val_bool();
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ bool val_native(THD *thd, Native *to);
virtual void print(String *str, enum_query_type query_type);
table_map used_tables() const;
Item *get_copy(THD *thd)
@@ -5876,6 +6008,76 @@ public:
};
+/**
+ We need a separate class Item_copy_timestamp because
+ TIMESTAMP->string->TIMESTAMP conversion is not round trip safe
+ near the DST change, e.g. '2010-10-31 02:25:26' can mean:
+ - my_time_t(1288477526) - summer time in Moscow
+ - my_time_t(1288481126) - winter time in Moscow, one hour later
+*/
+class Item_copy_timestamp: public Item_copy
+{
+ Timestamp_or_zero_datetime m_value;
+ bool sane() const { return !null_value || m_value.is_zero_datetime(); }
+public:
+ Item_copy_timestamp(THD *thd, Item *arg): Item_copy(thd, arg) { }
+ const Type_handler *type_handler() const { return &type_handler_timestamp2; }
+ void copy()
+ {
+ Timestamp_or_zero_datetime_native_null tmp(current_thd, item, false);
+ null_value= tmp.is_null();
+ m_value= tmp.is_null() ? Timestamp_or_zero_datetime() :
+ Timestamp_or_zero_datetime(tmp);
+ }
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ DBUG_ASSERT(sane());
+ if (null_value)
+ return set_field_to_null(field);
+ Timestamp_or_zero_datetime_native native(m_value, decimals);
+ return native.save_in_field(field, decimals);
+ }
+ longlong val_int()
+ {
+ DBUG_ASSERT(sane());
+ return null_value ? 0 :
+ m_value.to_datetime(current_thd).to_longlong();
+ }
+ double val_real()
+ {
+ DBUG_ASSERT(sane());
+ return null_value ? 0e0 :
+ m_value.to_datetime(current_thd).to_double();
+ }
+ String *val_str(String *to)
+ {
+ DBUG_ASSERT(sane());
+ return null_value ? NULL :
+ m_value.to_datetime(current_thd).to_string(to, decimals);
+ }
+ my_decimal *val_decimal(my_decimal *to)
+ {
+ DBUG_ASSERT(sane());
+ return null_value ? NULL :
+ m_value.to_datetime(current_thd).to_decimal(to);
+ }
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ {
+ DBUG_ASSERT(sane());
+ bool res= m_value.to_TIME(thd, ltime, fuzzydate);
+ DBUG_ASSERT(!res);
+ return null_value || res;
+ }
+ bool val_native(THD *thd, Native *to)
+ {
+ DBUG_ASSERT(sane());
+ return null_value || m_value.to_native(to, decimals);
+ }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_copy_timestamp>(thd, this); }
+};
+
+
/*
Cached_item_XXX objects are not exactly caches. They do the following:
@@ -6020,6 +6222,11 @@ public:
return false;
}
table_map used_tables() const;
+ virtual void update_used_tables()
+ {
+ if (field && field->default_value)
+ field->default_value->expr->update_used_tables();
+ }
Field *get_tmp_table_field() { return 0; }
Item *get_tmp_table_item(THD *thd) { return this; }
Item_field *field_for_view_update() { return 0; }
@@ -6431,8 +6638,8 @@ public:
Item *make_literal(THD *);
longlong val_datetime_packed(THD *thd)
{
- date_mode_t fuzzy= Datetime::comparison_flags_for_get_date();
- return has_value() ? Datetime(thd, this, fuzzy).to_packed() : 0;
+ Datetime::Options_cmp opt(thd);
+ return has_value() ? Datetime(thd, this, opt).to_packed() : 0;
}
longlong val_time_packed(THD *thd)
{
@@ -6471,7 +6678,7 @@ public:
}
longlong val_time_packed(THD *thd)
{
- return Time(thd, this, Time::comparison_flags_for_get_date()).to_packed();
+ return Time(thd, this, Time::Options_cmp(thd)).to_packed();
}
longlong val_int()
{
@@ -6506,7 +6713,7 @@ public:
}
longlong val_time_packed(THD *thd)
{
- return Time(thd, this, Time::comparison_flags_for_get_date()).to_packed();
+ return Time(thd, this, Time::Options_cmp(thd)).to_packed();
}
longlong val_int() { return has_value() ? Date(this).to_longlong() : 0; }
double val_real() { return has_value() ? Date(this).to_double() : 0; }
@@ -6521,6 +6728,48 @@ public:
};
+class Item_cache_timestamp: public Item_cache
+{
+ Timestamp_or_zero_datetime_native m_native;
+ Datetime to_datetime(THD *thd);
+public:
+ Item_cache_timestamp(THD *thd)
+ :Item_cache(thd, &type_handler_timestamp2) { }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_timestamp>(thd, this); }
+ bool cache_value();
+ String* val_str(String *to)
+ {
+ return to_datetime(current_thd).to_string(to, decimals);
+ }
+ my_decimal *val_decimal(my_decimal *to)
+ {
+ return to_datetime(current_thd).to_decimal(to);
+ }
+ longlong val_int()
+ {
+ return to_datetime(current_thd).to_longlong();
+ }
+ double val_real()
+ {
+ return to_datetime(current_thd).to_double();
+ }
+ longlong val_datetime_packed(THD *thd)
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+ longlong val_time_packed(THD *thd)
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ int save_in_field(Field *field, bool no_conversions);
+ bool val_native(THD *thd, Native *to);
+};
+
+
class Item_cache_real: public Item_cache
{
double value;
@@ -6554,7 +6803,8 @@ public:
my_decimal *val_decimal(my_decimal *);
bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode)
{
- return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, NULL);
+ return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode,
+ NULL, NULL);
}
bool cache_value();
Item *convert_to_basic_const_item(THD *thd);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index f5c49214076..4cd63042558 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -31,7 +31,6 @@
#include <m_ctype.h>
#include "sql_select.h"
#include "sql_parse.h" // check_stack_overrun
-#include "sql_time.h" // make_truncated_value_warning
#include "sql_base.h" // dynamic_column_error_message
@@ -568,6 +567,18 @@ bool Arg_comparator::set_cmp_func_datetime()
}
+bool Arg_comparator::set_cmp_func_native()
+{
+ THD *thd= current_thd;
+ m_compare_collation= &my_charset_numeric;
+ func= is_owner_equal_func() ? &Arg_comparator::compare_e_native :
+ &Arg_comparator::compare_native;
+ a= cache_converted_constant(thd, a, &a_cache, compare_type_handler());
+ b= cache_converted_constant(thd, b, &b_cache, compare_type_handler());
+ return false;
+}
+
+
bool Arg_comparator::set_cmp_func_int()
{
THD *thd= current_thd;
@@ -771,6 +782,39 @@ int Arg_comparator::compare_e_string()
}
+int Arg_comparator::compare_native()
+{
+ THD *thd= current_thd;
+ if (!(*a)->val_native_with_conversion(thd, &m_native1,
+ compare_type_handler()))
+ {
+ if (!(*b)->val_native_with_conversion(thd, &m_native2,
+ compare_type_handler()))
+ {
+ if (set_null)
+ owner->null_value= 0;
+ return compare_type_handler()->cmp_native(m_native1, m_native2);
+ }
+ }
+ if (set_null)
+ owner->null_value= 1;
+ return -1;
+}
+
+
+int Arg_comparator::compare_e_native()
+{
+ THD *thd= current_thd;
+ bool res1= (*a)->val_native_with_conversion(thd, &m_native1,
+ compare_type_handler());
+ bool res2= (*b)->val_native_with_conversion(thd, &m_native2,
+ compare_type_handler());
+ if (res1 || res2)
+ return MY_TEST(res1 == res2);
+ return MY_TEST(compare_type_handler()->cmp_native(m_native1, m_native2) == 0);
+}
+
+
int Arg_comparator::compare_real()
{
/*
@@ -2044,7 +2088,7 @@ bool Item_func_between::fix_length_and_dec()
if (!args[0] || !args[1] || !args[2])
return TRUE;
if (m_comparator.aggregate_for_comparison(Item_func_between::func_name(),
- args, 3, true))
+ args, 3, false))
{
DBUG_ASSERT(current_thd->is_error());
return TRUE;
@@ -2122,6 +2166,29 @@ longlong Item_func_between::val_int_cmp_time()
}
+longlong Item_func_between::val_int_cmp_native()
+{
+ THD *thd= current_thd;
+ const Type_handler *h= m_comparator.type_handler();
+ NativeBuffer<STRING_BUFFER_USUAL_SIZE> value, a, b;
+ if (val_native_with_conversion_from_item(thd, args[0], &value, h))
+ return 0;
+ bool ra= args[1]->val_native_with_conversion(thd, &a, h);
+ bool rb= args[2]->val_native_with_conversion(thd, &b, h);
+ if (!ra && !rb)
+ return (longlong)
+ ((h->cmp_native(value, a) >= 0 &&
+ h->cmp_native(value, b) <= 0) != negated);
+ if (ra && rb)
+ null_value= true;
+ else if (ra)
+ null_value= h->cmp_native(value, b) <= 0;
+ else
+ null_value= h->cmp_native(value, a) >= 0;
+ return (longlong) (!null_value && negated);
+}
+
+
longlong Item_func_between::val_int_cmp_string()
{
String *value,*a,*b;
@@ -2152,12 +2219,20 @@ longlong Item_func_between::val_int_cmp_string()
longlong Item_func_between::val_int_cmp_int()
{
- longlong value= args[0]->val_int(), a, b;
+ Longlong_hybrid value= args[0]->to_longlong_hybrid();
if ((null_value= args[0]->null_value))
return 0; /* purecov: inspected */
- a= args[1]->val_int();
- b= args[2]->val_int();
- return val_int_cmp_int_finalize(value, a, b);
+ Longlong_hybrid a= args[1]->to_longlong_hybrid();
+ Longlong_hybrid b= args[2]->to_longlong_hybrid();
+ if (!args[1]->null_value && !args[2]->null_value)
+ return (longlong) ((value.cmp(a) >= 0 && value.cmp(b) <= 0) != negated);
+ if (args[1]->null_value && args[2]->null_value)
+ null_value= true;
+ else if (args[1]->null_value)
+ null_value= value.cmp(b) <= 0; // not null if false range.
+ else
+ null_value= value.cmp(a) >= 0;
+ return (longlong) (!null_value && negated);
}
@@ -2299,12 +2374,22 @@ Item_func_ifnull::str_op(String *str)
}
+bool Item_func_ifnull::native_op(THD *thd, Native *to)
+{
+ DBUG_ASSERT(fixed == 1);
+ if (!val_native_with_conversion_from_item(thd, args[0], to, type_handler()))
+ return false;
+ return val_native_with_conversion_from_item(thd, args[1], to, type_handler());
+}
+
+
bool Item_func_ifnull::date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
DBUG_ASSERT(fixed == 1);
for (uint i= 0; i < 2; i++)
{
- Datetime dt(thd, args[i], fuzzydate & ~TIME_FUZZY_DATES);
+ Datetime_truncation_not_needed dt(thd, args[i],
+ fuzzydate & ~TIME_FUZZY_DATES);
if (!(dt.copy_to_mysql_time(ltime, mysql_timestamp_type())))
return (null_value= false);
}
@@ -2804,7 +2889,7 @@ Item_func_nullif::date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
DBUG_ASSERT(fixed == 1);
if (!compare())
return (null_value= true);
- Datetime dt(thd, args[2], fuzzydate);
+ Datetime_truncation_not_needed dt(thd, args[2], fuzzydate);
return (null_value= dt.copy_to_mysql_time(ltime, mysql_timestamp_type()));
}
@@ -2821,6 +2906,16 @@ Item_func_nullif::time_op(THD *thd, MYSQL_TIME *ltime)
bool
+Item_func_nullif::native_op(THD *thd, Native *to)
+{
+ DBUG_ASSERT(fixed == 1);
+ if (!compare())
+ return (null_value= true);
+ return val_native_with_conversion_from_item(thd, args[2], to, type_handler());
+}
+
+
+bool
Item_func_nullif::is_null()
{
return (null_value= (!compare() ? 1 : args[2]->is_null()));
@@ -2979,7 +3074,7 @@ bool Item_func_case::date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
Item *item= find_item();
if (!item)
return (null_value= true);
- Datetime dt(thd, item, fuzzydate);
+ Datetime_truncation_not_needed dt(thd, item, fuzzydate);
return (null_value= dt.copy_to_mysql_time(ltime, mysql_timestamp_type()));
}
@@ -2994,6 +3089,16 @@ bool Item_func_case::time_op(THD *thd, MYSQL_TIME *ltime)
}
+bool Item_func_case::native_op(THD *thd, Native *to)
+{
+ DBUG_ASSERT(fixed == 1);
+ Item *item= find_item();
+ if (!item)
+ return (null_value= true);
+ return val_native_with_conversion_from_item(thd, item, to, type_handler());
+}
+
+
bool Item_func_case::fix_fields(THD *thd, Item **ref)
{
bool res= Item_func::fix_fields(thd, ref);
@@ -3331,7 +3436,8 @@ bool Item_func_coalesce::date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzyd
DBUG_ASSERT(fixed == 1);
for (uint i= 0; i < arg_count; i++)
{
- Datetime dt(thd, args[i], fuzzydate & ~TIME_FUZZY_DATES);
+ Datetime_truncation_not_needed dt(thd, args[i],
+ fuzzydate & ~TIME_FUZZY_DATES);
if (!dt.copy_to_mysql_time(ltime, mysql_timestamp_type()))
return (null_value= false);
}
@@ -3351,6 +3457,18 @@ bool Item_func_coalesce::time_op(THD *thd, MYSQL_TIME *ltime)
}
+bool Item_func_coalesce::native_op(THD *thd, Native *to)
+{
+ DBUG_ASSERT(fixed == 1);
+ for (uint i= 0; i < arg_count; i++)
+ {
+ if (!val_native_with_conversion_from_item(thd, args[i], to, type_handler()))
+ return false;
+ }
+ return (null_value= true);
+}
+
+
my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -3628,6 +3746,53 @@ Item *in_longlong::create_item(THD *thd)
}
+static int cmp_timestamp(void *cmp_arg,
+ Timestamp_or_zero_datetime *a,
+ Timestamp_or_zero_datetime *b)
+{
+ return a->cmp(*b);
+}
+
+
+in_timestamp::in_timestamp(THD *thd, uint elements)
+ :in_vector(thd, elements, sizeof(Value), (qsort2_cmp) cmp_timestamp, 0)
+{}
+
+
+void in_timestamp::set(uint pos, Item *item)
+{
+ Timestamp_or_zero_datetime *buff= &((Timestamp_or_zero_datetime *) base)[pos];
+ Timestamp_or_zero_datetime_native_null native(current_thd, item, true);
+ if (native.is_null())
+ *buff= Timestamp_or_zero_datetime();
+ else
+ *buff= Timestamp_or_zero_datetime(native);
+}
+
+
+uchar *in_timestamp::get_value(Item *item)
+{
+ Timestamp_or_zero_datetime_native_null native(current_thd, item, true);
+ if (native.is_null())
+ return 0;
+ tmp= Timestamp_or_zero_datetime(native);
+ return (uchar*) &tmp;
+}
+
+
+Item *in_timestamp::create_item(THD *thd)
+{
+ return new (thd->mem_root) Item_timestamp_literal(thd);
+}
+
+
+void in_timestamp::value_to_item(uint pos, Item *item)
+{
+ const Timestamp_or_zero_datetime &buff= (((Timestamp_or_zero_datetime*) base)[pos]);
+ static_cast<Item_timestamp_literal*>(item)->set_value(buff);
+}
+
+
void in_datetime::set(uint pos,Item *item)
{
struct packed_longlong *buff= &((packed_longlong*) base)[pos];
@@ -4035,6 +4200,49 @@ cmp_item *cmp_item_time::make_same()
}
+void cmp_item_timestamp::store_value(Item *item)
+{
+ item->val_native_with_conversion(current_thd, &m_native,
+ &type_handler_timestamp2);
+ m_null_value= item->null_value;
+}
+
+
+int cmp_item_timestamp::cmp_not_null(const Value *val)
+{
+ /*
+ This method will be implemented when we add this syntax:
+ SELECT TIMESTAMP WITH LOCAL TIME ZONE '2001-01-01 10:20:30'
+ For now TIMESTAMP is compared to non-TIMESTAMP using DATETIME.
+ */
+ DBUG_ASSERT(0);
+ return 0;
+}
+
+
+int cmp_item_timestamp::cmp(Item *arg)
+{
+ THD *thd= current_thd;
+ Timestamp_or_zero_datetime_native_null tmp(thd, arg, true);
+ return m_null_value || tmp.is_null() ? UNKNOWN :
+ type_handler_timestamp2.cmp_native(m_native, tmp) != 0;
+}
+
+
+int cmp_item_timestamp::compare(cmp_item *arg)
+{
+ cmp_item_timestamp *tmp= static_cast<cmp_item_timestamp*>(arg);
+ return type_handler_timestamp2.cmp_native(m_native, tmp->m_native);
+}
+
+
+cmp_item* cmp_item_timestamp::make_same()
+{
+ return new cmp_item_timestamp();
+}
+
+
+
bool Item_func_in::count_sargable_conds(void *arg)
{
((SELECT_LEX*) arg)->cond_count++;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index cf210a71433..882f92465b1 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -68,6 +68,7 @@ class Arg_comparator: public Sql_alloc
if (val1 == val2) return 0;
return 1;
}
+ NativeBuffer<STRING_BUFFER_USUAL_SIZE> m_native1, m_native2;
public:
/* Allow owner function to use string buffers. */
String value1, value2;
@@ -89,6 +90,7 @@ public:
bool set_cmp_func_string();
bool set_cmp_func_time();
bool set_cmp_func_datetime();
+ bool set_cmp_func_native();
bool set_cmp_func_int();
bool set_cmp_func_real();
bool set_cmp_func_decimal();
@@ -121,6 +123,8 @@ public:
int compare_e_datetime();
int compare_time();
int compare_e_time();
+ int compare_native();
+ int compare_e_native();
int compare_json_str_basic(Item *j, Item *s);
int compare_json_str();
int compare_str_json();
@@ -935,6 +939,7 @@ public:
longlong val_int_cmp_string();
longlong val_int_cmp_datetime();
longlong val_int_cmp_time();
+ longlong val_int_cmp_native();
longlong val_int_cmp_int();
longlong val_int_cmp_real();
longlong val_int_cmp_decimal();
@@ -1013,6 +1018,7 @@ public:
my_decimal *decimal_op(my_decimal *);
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
bool time_op(THD *thd, MYSQL_TIME *ltime);
+ bool native_op(THD *thd, Native *to);
bool fix_length_and_dec()
{
if (aggregate_for_result(func_name(), args, arg_count, true))
@@ -1092,6 +1098,7 @@ public:
my_decimal *decimal_op(my_decimal *);
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
bool time_op(THD *thd, MYSQL_TIME *ltime);
+ bool native_op(THD *thd, Native *to);
bool fix_length_and_dec()
{
if (Item_func_case_abbreviation2::fix_length_and_dec2(args))
@@ -1127,7 +1134,7 @@ public:
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
- Datetime dt(thd, find_item(), fuzzydate);
+ Datetime_truncation_not_needed dt(thd, find_item(), fuzzydate);
return (null_value= dt.copy_to_mysql_time(ltime, mysql_timestamp_type()));
}
bool time_op(THD *thd, MYSQL_TIME *ltime)
@@ -1150,6 +1157,11 @@ public:
{
return val_str_from_item(find_item(), str);
}
+ bool native_op(THD *thd, Native *to)
+ {
+ return val_native_with_conversion_from_item(thd, find_item(), to,
+ type_handler());
+ }
};
@@ -1249,6 +1261,7 @@ public:
longlong int_op();
String *str_op(String *str);
my_decimal *decimal_op(my_decimal *);
+ bool native_op(THD *thd, Native *to);
bool fix_length_and_dec();
bool walk(Item_processor processor, bool walk_subquery, void *arg);
const char *func_name() const { return "nullif"; }
@@ -1412,6 +1425,19 @@ public:
};
+class in_timestamp :public in_vector
+{
+ Timestamp_or_zero_datetime tmp;
+public:
+ in_timestamp(THD *thd, uint elements);
+ void set(uint pos,Item *item);
+ uchar *get_value(Item *item);
+ Item* create_item(THD *thd);
+ void value_to_item(uint pos, Item *item);
+ const Type_handler *type_handler() const { return &type_handler_timestamp2; }
+};
+
+
/*
Class to represent a vector of constant DATE/DATETIME values.
*/
@@ -1666,6 +1692,20 @@ public:
cmp_item *make_same();
};
+
+class cmp_item_timestamp: public cmp_item_scalar
+{
+ Timestamp_or_zero_datetime_native m_native;
+public:
+ cmp_item_timestamp() :cmp_item_scalar() { }
+ void store_value(Item *item);
+ int cmp_not_null(const Value *val);
+ int cmp(Item *arg);
+ int compare(cmp_item *ci);
+ cmp_item *make_same();
+};
+
+
class cmp_item_real : public cmp_item_scalar
{
double value;
@@ -2132,6 +2172,7 @@ public:
my_decimal *decimal_op(my_decimal *);
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
bool time_op(THD *thd, MYSQL_TIME *ltime);
+ bool native_op(THD *thd, Native *to);
bool fix_fields(THD *thd, Item **ref);
table_map not_null_tables() const { return 0; }
const char *func_name() const { return "case"; }
@@ -2642,6 +2683,9 @@ public:
Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0),
bmGs(0), bmBc(0), escape_item(escape_arg),
escape_used_in_parsing(escape_used), use_sampling(0), negated(0) {}
+
+ bool get_negated() const { return negated; } // Used by ColumnStore
+
longlong val_int();
enum Functype functype() const { return LIKE_FUNC; }
void print(String *str, enum_query_type query_type);
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 87bf69f3c96..ba7a704e29b 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -3193,6 +3193,45 @@ protected:
};
#endif
+#ifdef WITH_WSREP
+class Create_func_wsrep_last_written_gtid : public Create_func_arg0
+{
+public:
+ virtual Item *create_builder(THD *thd);
+
+ static Create_func_wsrep_last_written_gtid s_singleton;
+
+protected:
+ Create_func_wsrep_last_written_gtid() {}
+ virtual ~Create_func_wsrep_last_written_gtid() {}
+};
+
+
+class Create_func_wsrep_last_seen_gtid : public Create_func_arg0
+{
+public:
+ virtual Item *create_builder(THD *thd);
+
+ static Create_func_wsrep_last_seen_gtid s_singleton;
+
+protected:
+ Create_func_wsrep_last_seen_gtid() {}
+ virtual ~Create_func_wsrep_last_seen_gtid() {}
+};
+
+
+class Create_func_wsrep_sync_wait_upto : public Create_native_func
+{
+public:
+ virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+
+ static Create_func_wsrep_sync_wait_upto s_singleton;
+
+protected:
+ Create_func_wsrep_sync_wait_upto() {}
+ virtual ~Create_func_wsrep_sync_wait_upto() {}
+};
+#endif /* WITH_WSREP */
#ifdef HAVE_SPATIAL
class Create_func_x : public Create_func_arg1
@@ -6905,6 +6944,63 @@ Create_func_within::create_2_arg(THD *thd, Item *arg1, Item *arg2)
}
#endif
+#ifdef WITH_WSREP
+Create_func_wsrep_last_written_gtid
+Create_func_wsrep_last_written_gtid::s_singleton;
+
+Item*
+Create_func_wsrep_last_written_gtid::create_builder(THD *thd)
+{
+ thd->lex->safe_to_cache_query= 0;
+ return new (thd->mem_root) Item_func_wsrep_last_written_gtid(thd);
+}
+
+
+Create_func_wsrep_last_seen_gtid
+Create_func_wsrep_last_seen_gtid::s_singleton;
+
+Item*
+Create_func_wsrep_last_seen_gtid::create_builder(THD *thd)
+{
+ thd->lex->safe_to_cache_query= 0;
+ return new (thd->mem_root) Item_func_wsrep_last_seen_gtid(thd);
+}
+
+
+Create_func_wsrep_sync_wait_upto
+Create_func_wsrep_sync_wait_upto::s_singleton;
+
+Item*
+Create_func_wsrep_sync_wait_upto::create_native(THD *thd,
+ LEX_CSTRING *name,
+ List<Item> *item_list)
+{
+ Item *func= NULL;
+ int arg_count= 0;
+ Item *param_1, *param_2;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ switch (arg_count)
+ {
+ case 1:
+ param_1= item_list->pop();
+ func= new (thd->mem_root) Item_func_wsrep_sync_wait_upto(thd, param_1);
+ break;
+ case 2:
+ param_1= item_list->pop();
+ param_2= item_list->pop();
+ func= new (thd->mem_root) Item_func_wsrep_sync_wait_upto(thd, param_1, param_2);
+ break;
+ default:
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ break;
+ }
+ thd->lex->safe_to_cache_query= 0;
+ return func;
+}
+#endif /* WITH_WSREP */
#ifdef HAVE_SPATIAL
Create_func_x Create_func_x::s_singleton;
@@ -7347,6 +7443,11 @@ static Native_func_registry func_array[] =
{ { STRING_WITH_LEN("WEEKDAY") }, BUILDER(Create_func_weekday)},
{ { STRING_WITH_LEN("WEEKOFYEAR") }, BUILDER(Create_func_weekofyear)},
{ { STRING_WITH_LEN("WITHIN") }, GEOM_BUILDER(Create_func_within)},
+#ifdef WITH_WSREP
+ { { STRING_WITH_LEN("WSREP_LAST_WRITTEN_GTID") }, BUILDER(Create_func_wsrep_last_written_gtid)},
+ { { STRING_WITH_LEN("WSREP_LAST_SEEN_GTID") }, BUILDER(Create_func_wsrep_last_seen_gtid)},
+ { { STRING_WITH_LEN("WSREP_SYNC_WAIT_UPTO_GTID") }, BUILDER(Create_func_wsrep_sync_wait_upto)},
+#endif /* WITH_WSREP */
{ { STRING_WITH_LEN("X") }, GEOM_BUILDER(Create_func_x)},
{ { STRING_WITH_LEN("Y") }, GEOM_BUILDER(Create_func_y)},
{ { STRING_WITH_LEN("YEARWEEK") }, BUILDER(Create_func_year_week)},
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c176a7e43a7..a10f381b1dc 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1615,13 +1615,9 @@ longlong Item_func_int_div::val_int()
bool Item_func_int_div::fix_length_and_dec()
{
- Item_result argtype= args[0]->result_type();
- /* use precision ony for the data type it is applicable for and valid */
- uint32 char_length= args[0]->max_char_length() -
- (argtype == DECIMAL_RESULT || argtype == INT_RESULT ?
- args[0]->decimals : 0);
- fix_char_length(char_length > MY_INT64_NUM_DECIMAL_DIGITS ?
- MY_INT64_NUM_DECIMAL_DIGITS : char_length);
+ uint32 prec= args[0]->decimal_int_part();
+ set_if_smaller(prec, MY_INT64_NUM_DECIMAL_DIGITS);
+ fix_char_length(prec);
maybe_null=1;
unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag;
return false;
@@ -2276,11 +2272,11 @@ void Item_func_round::fix_arg_decimal()
{
if (args[1]->const_item())
{
- uint dec= (uint) args[1]->val_uint_from_val_int(DECIMAL_MAX_SCALE);
+ Longlong_hybrid dec= args[1]->to_longlong_hybrid();
if (args[1]->null_value)
fix_length_and_dec_double(NOT_FIXED_DEC);
else
- fix_length_and_dec_decimal(dec);
+ fix_length_and_dec_decimal(dec.to_uint(DECIMAL_MAX_SCALE));
}
else
{
@@ -2296,8 +2292,9 @@ void Item_func_round::fix_arg_double()
{
if (args[1]->const_item())
{
- uint dec= (uint) args[1]->val_uint_from_val_int(NOT_FIXED_DEC);
- fix_length_and_dec_double(args[1]->null_value ? NOT_FIXED_DEC : dec);
+ Longlong_hybrid dec= args[1]->to_longlong_hybrid();
+ fix_length_and_dec_double(args[1]->null_value ? NOT_FIXED_DEC :
+ dec.to_uint(NOT_FIXED_DEC));
}
else
fix_length_and_dec_double(args[0]->decimals);
@@ -2308,17 +2305,14 @@ void Item_func_round::fix_arg_int()
{
if (args[1]->const_item())
{
- longlong val1= args[1]->val_int();
- bool val1_is_negative= val1 < 0 && !args[1]->unsigned_flag;
- uint decimals_to_set= val1_is_negative ?
- 0 : (uint) MY_MIN(val1, DECIMAL_MAX_SCALE);
+ Longlong_hybrid val1= args[1]->to_longlong_hybrid();
if (args[1]->null_value)
fix_length_and_dec_double(NOT_FIXED_DEC);
- else if ((!decimals_to_set && truncate) ||
+ else if ((!val1.to_uint(DECIMAL_MAX_SCALE) && truncate) ||
args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS)
{
// Length can increase in some cases: ROUND(9,-1) -> 10
- int length_can_increase= MY_TEST(!truncate && val1_is_negative);
+ int length_can_increase= MY_TEST(!truncate && val1.neg());
max_length= args[0]->max_length + length_can_increase;
// Here we can keep INT_RESULT
unsigned_flag= args[0]->unsigned_flag;
@@ -2326,7 +2320,7 @@ void Item_func_round::fix_arg_int()
set_handler(type_handler_long_or_longlong());
}
else
- fix_length_and_dec_decimal(decimals_to_set);
+ fix_length_and_dec_decimal(val1.to_uint(DECIMAL_MAX_SCALE));
}
else
fix_length_and_dec_double(args[0]->decimals);
@@ -2457,7 +2451,7 @@ void Item_func_rand::seed_random(Item *arg)
THD *thd= current_thd;
if (WSREP(thd))
{
- if (thd->wsrep_exec_mode==REPL_RECV)
+ if (wsrep_thd_is_applying(thd))
tmp= thd->wsrep_rand;
else
tmp= thd->wsrep_rand= (uint32) arg->val_int();
@@ -2610,13 +2604,13 @@ bool Item_func_min_max::get_time_native(THD *thd, MYSQL_TIME *ltime)
{
DBUG_ASSERT(fixed == 1);
- Time value(thd, args[0], Time::Options(), decimals);
+ Time value(thd, args[0], Time::Options(thd), decimals);
if (!value.is_valid_time())
return (null_value= true);
for (uint i= 1; i < arg_count ; i++)
{
- Time tmp(thd, args[i], Time::Options(), decimals);
+ Time tmp(thd, args[i], Time::Options(thd), decimals);
if (!tmp.is_valid_time())
return (null_value= true);
@@ -2730,6 +2724,28 @@ my_decimal *Item_func_min_max::val_decimal_native(my_decimal *dec)
}
+bool Item_func_min_max::val_native(THD *thd, Native *native)
+{
+ DBUG_ASSERT(fixed == 1);
+ const Type_handler *handler= Item_hybrid_func::type_handler();
+ NativeBuffer<STRING_BUFFER_USUAL_SIZE> cur;
+ for (uint i= 0; i < arg_count; i++)
+ {
+ if (val_native_with_conversion_from_item(thd, args[i],
+ i == 0 ? native : &cur,
+ handler))
+ return true;
+ if (i > 0)
+ {
+ int cmp= handler->cmp_native(*native, cur);
+ if ((cmp_sign < 0 ? cmp : -cmp) < 0 && native->copy(cur))
+ return null_value= true;
+ }
+ }
+ return null_value= false;
+}
+
+
longlong Item_func_bit_length::val_int()
{
DBUG_ASSERT(fixed == 1);
@@ -3147,6 +3163,8 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
func->maybe_null=1;
if (with_sum_func_cache)
with_sum_func_cache->join_with_sum_func(item);
+ func->with_window_func= func->with_window_func ||
+ item->with_window_func;
func->with_field= func->with_field || item->with_field;
func->with_param= func->with_param || item->with_param;
func->With_subquery_cache::join(item);
@@ -6453,6 +6471,14 @@ String *Item_func_last_value::val_str(String *str)
return tmp;
}
+
+bool Item_func_last_value::val_native(THD *thd, Native *to)
+{
+ evaluate_sideeffects();
+ return val_native_from_item(thd, last_value, to);
+}
+
+
longlong Item_func_last_value::val_int()
{
longlong tmp;
diff --git a/sql/item_func.h b/sql/item_func.h
index 660d39f48ea..1081f2919c8 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -768,6 +768,12 @@ public:
Item_func_hybrid_field_type_get_date_with_warn(thd, this, to, mode);
}
+ bool val_native(THD *thd, Native *to)
+ {
+ DBUG_ASSERT(fixed);
+ return native_op(thd, to);
+ }
+
/**
@brief Performs the operation that this functions implements when the
result type is INT.
@@ -838,6 +844,7 @@ public:
*/
virtual bool time_op(THD *thd, MYSQL_TIME *res)= 0;
+ virtual bool native_op(THD *thd, Native *native)= 0;
};
@@ -905,6 +912,11 @@ public:
DBUG_ASSERT(0);
return true;
}
+ bool native_op(THD *thd, Native *to)
+ {
+ DBUG_ASSERT(0);
+ return true;
+ }
};
@@ -1183,7 +1195,8 @@ public:
my_decimal *val_decimal(my_decimal*);
bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode)
{
- return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, NULL);
+ return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode,
+ NULL, NULL);
}
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
void fix_length_and_dec_generic() {}
@@ -1771,6 +1784,7 @@ public:
return Item_func_min_max::type_handler()->
Item_func_min_max_get_date(thd, this, res, fuzzydate);
}
+ bool val_native(THD *thd, Native *to);
void aggregate_attributes_real(Item **items, uint nitems)
{
/*
@@ -1834,6 +1848,8 @@ public:
double val_real() { return val_real_from_item(args[0]); }
longlong val_int() { return val_int_from_item(args[0]); }
String *val_str(String *str) { return val_str_from_item(args[0], str); }
+ bool val_native(THD *thd, Native *to)
+ { return val_native_from_item(thd, args[0], to); }
my_decimal *val_decimal(my_decimal *dec)
{ return val_decimal_from_item(args[0], dec); }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
@@ -3153,6 +3169,13 @@ public:
return str;
}
+ bool val_native(THD *thd, Native *to)
+ {
+ if (execute())
+ return true;
+ return null_value= sp_result_field->val_native(to);
+ }
+
void update_null_value()
{
execute();
@@ -3282,6 +3305,7 @@ public:
String *val_str(String *);
my_decimal *val_decimal(my_decimal *);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ bool val_native(THD *thd, Native *);
bool fix_length_and_dec();
const char *func_name() const { return "last_value"; }
const Type_handler *type_handler() const { return last_value->type_handler(); }
diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc
index 8a3345ecc81..f5fcbf65309 100644
--- a/sql/item_inetfunc.cc
+++ b/sql/item_inetfunc.cc
@@ -21,9 +21,9 @@
///////////////////////////////////////////////////////////////////////////
-static const int IN_ADDR_SIZE= sizeof (in_addr);
-static const int IN6_ADDR_SIZE= sizeof (in6_addr);
-static const int IN6_ADDR_NUM_WORDS= IN6_ADDR_SIZE / 2;
+static const size_t IN_ADDR_SIZE= 4;
+static const size_t IN6_ADDR_SIZE= 16;
+static const size_t IN6_ADDR_NUM_WORDS= IN6_ADDR_SIZE / 2;
static const char HEX_DIGITS[]= "0123456789abcdef";
@@ -89,7 +89,6 @@ err:
return 0;
}
-///////////////////////////////////////////////////////////////////////////
String* Item_func_inet_ntoa::val_str(String* str)
{
@@ -139,91 +138,220 @@ String* Item_func_inet_ntoa::val_str(String* str)
///////////////////////////////////////////////////////////////////////////
-/**
- Check the function argument, handle errors properly.
- @return The function value.
-*/
-
-longlong Item_func_inet_bool_base::val_int()
+class Inet4
{
- DBUG_ASSERT(fixed);
-
- // String argument expected
- if (unlikely(args[0]->result_type() != STRING_RESULT))
- return 0;
-
- String buffer;
- String *arg_str= args[0]->val_str(&buffer);
+ char m_buffer[IN_ADDR_SIZE];
+protected:
+ bool str_to_ipv4(const char *str, size_t length, CHARSET_INFO *cs);
+ bool binary_to_ipv4(const char *str, size_t length)
+ {
+ if (length != sizeof(m_buffer))
+ return true;
+ memcpy(m_buffer, str, length);
+ return false;
+ }
+ // Non-initializing constructor
+ Inet4() { }
+public:
+ void to_binary(char *dst, size_t dstsize) const
+ {
+ DBUG_ASSERT(dstsize >= sizeof(m_buffer));
+ memcpy(dst, m_buffer, sizeof(m_buffer));
+ }
+ bool to_binary(String *to) const
+ {
+ return to->copy(m_buffer, sizeof(m_buffer), &my_charset_bin);
+ }
+ size_t to_string(char *dst, size_t dstsize) const;
+ bool to_string(String *to) const
+ {
+ to->set_charset(&my_charset_latin1);
+ if (to->alloc(INET_ADDRSTRLEN))
+ return true;
+ to->length((uint32) to_string((char*) to->ptr(), INET_ADDRSTRLEN));
+ return false;
+ }
+};
- if (unlikely(!arg_str)) // Out-of memory happened. error has been reported.
- return 0; // Or: the underlying field is NULL
- return calc_value(arg_str) ? 1 : 0;
-}
-
-///////////////////////////////////////////////////////////////////////////
+class Inet4_null: public Inet4, public Null_flag
+{
+public:
+ // Initialize from a text representation
+ Inet4_null(const char *str, size_t length, CHARSET_INFO *cs)
+ :Null_flag(str_to_ipv4(str, length, cs))
+ { }
+ Inet4_null(const String &str)
+ :Inet4_null(str.ptr(), str.length(), str.charset())
+ { }
+ // Initialize from a binary representation
+ Inet4_null(const char *str, size_t length)
+ :Null_flag(binary_to_ipv4(str, length))
+ { }
+ Inet4_null(const Binary_string &str)
+ :Inet4_null(str.ptr(), str.length())
+ { }
+public:
+ const Inet4& to_inet4() const
+ {
+ DBUG_ASSERT(!is_null());
+ return *this;
+ }
+ void to_binary(char *dst, size_t dstsize) const
+ {
+ to_inet4().to_binary(dst, dstsize);
+ }
+ bool to_binary(String *to) const
+ {
+ return to_inet4().to_binary(to);
+ }
+ size_t to_string(char *dst, size_t dstsize) const
+ {
+ return to_inet4().to_string(dst, dstsize);
+ }
+ bool to_string(String *to) const
+ {
+ return to_inet4().to_string(to);
+ }
+};
-/**
- Check the function argument, handle errors properly.
- @param [out] buffer Buffer for string operations.
+class Inet6
+{
+ char m_buffer[IN6_ADDR_SIZE];
+protected:
+ bool make_from_item(Item *item);
+ bool str_to_ipv6(const char *str, size_t str_length, CHARSET_INFO *cs);
+ bool binary_to_ipv6(const char *str, size_t length)
+ {
+ if (length != sizeof(m_buffer))
+ return true;
+ memcpy(m_buffer, str, length);
+ return false;
+ }
+ // Non-initializing constructor
+ Inet6() { }
+public:
+ bool to_binary(String *to) const
+ {
+ return to->copy(m_buffer, sizeof(m_buffer), &my_charset_bin);
+ }
+ size_t to_string(char *dst, size_t dstsize) const;
+ bool to_string(String *to) const
+ {
+ to->set_charset(&my_charset_latin1);
+ if (to->alloc(INET6_ADDRSTRLEN))
+ return true;
+ to->length((uint32) to_string((char*) to->ptr(), INET6_ADDRSTRLEN));
+ return false;
+ }
+ bool is_v4compat() const
+ {
+ static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size");
+ return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
+ }
+ bool is_v4mapped() const
+ {
+ static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size");
+ return IN6_IS_ADDR_V4MAPPED((struct in6_addr *) m_buffer);
+ }
+};
- @return The function value.
-*/
-String *Item_func_inet_str_base::val_str_ascii(String *buffer)
+class Inet6_null: public Inet6, public Null_flag
{
- DBUG_ASSERT(fixed);
-
- // String argument expected
- if (unlikely(args[0]->result_type() != STRING_RESULT))
+public:
+ // Initialize from a text representation
+ Inet6_null(const char *str, size_t length, CHARSET_INFO *cs)
+ :Null_flag(str_to_ipv6(str, length, cs))
+ { }
+ Inet6_null(const String &str)
+ :Inet6_null(str.ptr(), str.length(), str.charset())
+ { }
+ // Initialize from a binary representation
+ Inet6_null(const char *str, size_t length)
+ :Null_flag(binary_to_ipv6(str, length))
+ { }
+ Inet6_null(const Binary_string &str)
+ :Inet6_null(str.ptr(), str.length())
+ { }
+ // Initialize from an Item
+ Inet6_null(Item *item)
+ :Null_flag(make_from_item(item))
+ { }
+public:
+ const Inet6& to_inet6() const
{
- null_value= true;
- return NULL;
+ DBUG_ASSERT(!is_null());
+ return *this;
}
-
- StringBuffer<STRING_BUFFER_USUAL_SIZE> tmp;
- String *arg_str= args[0]->val_str(&tmp);
- if (unlikely(!arg_str))
+ bool to_binary(String *to) const
{
- // Out-of memory happened. error has been reported.
- // Or: the underlying field is NULL
- null_value= true;
- return NULL;
+ DBUG_ASSERT(!is_null());
+ return to_inet6().to_binary(to);
}
+ size_t to_string(char *dst, size_t dstsize) const
+ {
+ return to_inet6().to_string(dst, dstsize);
+ }
+ bool to_string(String *to) const
+ {
+ return to_inet6().to_string(to);
+ }
+ bool is_v4compat() const
+ {
+ return to_inet6().is_v4compat();
+ }
+ bool is_v4mapped() const
+ {
+ return to_inet6().is_v4mapped();
+ }
+};
- null_value= !calc_value(arg_str, buffer);
- return unlikely(null_value) ? NULL : buffer;
-}
+bool Inet6::make_from_item(Item *item)
+{
+ String tmp(m_buffer, sizeof(m_buffer), &my_charset_bin);
+ String *str= item->val_str(&tmp);
+ /*
+ Charset could be tested in item->collation.collation before the val_str()
+ call, but traditionally Inet6 functions still call item->val_str()
+ for non-binary arguments and therefore execute side effects.
+ */
+ if (!str || str->length() != sizeof(m_buffer) ||
+ str->charset() != &my_charset_bin)
+ return true;
+ if (str->ptr() != m_buffer)
+ memcpy(m_buffer, str->ptr(), sizeof(m_buffer));
+ return false;
+};
-///////////////////////////////////////////////////////////////////////////
/**
Tries to convert given string to binary IPv4-address representation.
This is a portable alternative to inet_pton(AF_INET).
@param str String to convert.
- @param str_len String length.
- @param[out] ipv4_address Buffer to store IPv4-address.
+ @param str_length String length.
@return Completion status.
- @retval false Given string does not represent an IPv4-address.
- @retval true The string has been converted sucessfully.
+ @retval true - error, the given string does not represent an IPv4-address.
+ @retval false - ok, the string has been converted sucessfully.
@note The problem with inet_pton() is that it treats leading zeros in
IPv4-part differently on different platforms.
*/
-static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_address)
+bool Inet4::str_to_ipv4(const char *str, size_t str_length, CHARSET_INFO *cs)
{
+ DBUG_ASSERT(cs->mbminlen == 1);
if (str_length < 7)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): "
"invalid IPv4 address: too short.",
(int) str_length, str));
- return false;
+ return true;
}
if (str_length > 15)
@@ -231,17 +359,18 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
DBUG_PRINT("error", ("str_to_ipv4(%.*s): "
"invalid IPv4 address: too long.",
(int) str_length, str));
- return false;
+ return true;
}
- unsigned char *ipv4_bytes= (unsigned char *) ipv4_address;
+ unsigned char *ipv4_bytes= (unsigned char *) &m_buffer;
+ const char *str_end= str + str_length;
const char *p= str;
int byte_value= 0;
int chars_in_group= 0;
int dot_count= 0;
char c= 0;
- while (((p - str) < (int)str_length) && *p)
+ while (p < str_end && *p)
{
c= *p++;
@@ -254,7 +383,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too many characters in a group.",
(int) str_length, str));
- return false;
+ return true;
}
byte_value= byte_value * 10 + (c - '0');
@@ -264,7 +393,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"invalid byte value.",
(int) str_length, str));
- return false;
+ return true;
}
}
else if (c == '.')
@@ -274,7 +403,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too few characters in a group.",
(int) str_length, str));
- return false;
+ return true;
}
ipv4_bytes[dot_count]= (unsigned char) byte_value;
@@ -287,7 +416,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too many dots.", (int) str_length, str));
- return false;
+ return true;
}
}
else
@@ -295,7 +424,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"invalid character at pos %d.",
(int) str_length, str, (int) (p - str)));
- return false;
+ return true;
}
}
@@ -303,7 +432,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"ending at '.'.", (int) str_length, str));
- return false;
+ return true;
}
if (dot_count != 3)
@@ -311,7 +440,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too few groups.",
(int) str_length, str));
- return false;
+ return true;
}
ipv4_bytes[3]= (unsigned char) byte_value;
@@ -320,44 +449,44 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
(int) str_length, str,
ipv4_bytes[0], ipv4_bytes[1],
ipv4_bytes[2], ipv4_bytes[3]));
- return true;
+ return false;
}
-///////////////////////////////////////////////////////////////////////////
/**
Tries to convert given string to binary IPv6-address representation.
This is a portable alternative to inet_pton(AF_INET6).
@param str String to convert.
- @param str_len String length.
- @param[out] ipv6_address Buffer to store IPv6-address.
+ @param str_length String length.
@return Completion status.
- @retval false Given string does not represent an IPv6-address.
- @retval true The string has been converted sucessfully.
+ @retval true - error, the given string does not represent an IPv6-address.
+ @retval false - ok, the string has been converted sucessfully.
@note The problem with inet_pton() is that it treats leading zeros in
IPv4-part differently on different platforms.
*/
-static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
+bool Inet6::str_to_ipv6(const char *str, size_t str_length, CHARSET_INFO *cs)
{
+ DBUG_ASSERT(cs->mbminlen == 1);
+
if (str_length < 2)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: too short.",
- str_length, str));
- return false;
+ (int) str_length, str));
+ return true;
}
if (str_length > 8 * 4 + 7)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: too long.",
- str_length, str));
- return false;
+ (int) str_length, str));
+ return true;
}
- memset(ipv6_address, 0, IN6_ADDR_SIZE);
+ memset(m_buffer, 0, sizeof(m_buffer));
const char *p= str;
@@ -368,20 +497,20 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
if (*p != ':')
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "can not start with ':x'.", str_length, str));
- return false;
+ "can not start with ':x'.", (int) str_length, str));
+ return true;
}
}
- char *ipv6_bytes= (char *) ipv6_address;
- char *ipv6_bytes_end= ipv6_bytes + IN6_ADDR_SIZE;
- char *dst= ipv6_bytes;
+ const char *str_end= str + str_length;
+ char *ipv6_bytes_end= m_buffer + sizeof(m_buffer);
+ char *dst= m_buffer;
char *gap_ptr= NULL;
const char *group_start_ptr= p;
int chars_in_group= 0;
int group_value= 0;
- while (((p - str) < str_length) && *p)
+ while (p < str_end && *p)
{
char c= *p++;
@@ -394,26 +523,26 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
if (gap_ptr)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "too many gaps(::).", str_length, str));
- return false;
+ "too many gaps(::).", (int) str_length, str));
+ return true;
}
gap_ptr= dst;
continue;
}
- if (!*p || ((p - str) >= str_length))
+ if (!*p || p >= str_end)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "ending at ':'.", str_length, str));
- return false;
+ "ending at ':'.", (int) str_length, str));
+ return true;
}
if (dst + 2 > ipv6_bytes_end)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "too many groups (1).", str_length, str));
- return false;
+ "too many groups (1).", (int) str_length, str));
+ return true;
}
dst[0]= (unsigned char) (group_value >> 8) & 0xff;
@@ -428,19 +557,19 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
if (dst + IN_ADDR_SIZE > ipv6_bytes_end)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "unexpected IPv4-part.", str_length, str));
- return false;
+ "unexpected IPv4-part.", (int) str_length, str));
+ return true;
}
- if (!str_to_ipv4(group_start_ptr,
- str + str_length - group_start_ptr,
- (in_addr *) dst))
+ Inet4_null tmp(group_start_ptr, (size_t) (str_end - group_start_ptr), cs);
+ if (tmp.is_null())
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "invalid IPv4-part.", str_length, str));
- return false;
+ "invalid IPv4-part.", (int) str_length, str));
+ return true;
}
+ tmp.to_binary(dst, IN_ADDR_SIZE);
dst += IN_ADDR_SIZE;
chars_in_group= 0;
@@ -454,16 +583,16 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
"invalid character at pos %d.",
- str_length, str, (int) (p - str)));
- return false;
+ (int) str_length, str, (int) (p - str)));
+ return true;
}
if (chars_in_group >= 4)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
"too many digits in group.",
- str_length, str));
- return false;
+ (int) str_length, str));
+ return true;
}
group_value <<= 4;
@@ -480,8 +609,8 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
if (dst + 2 > ipv6_bytes_end)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "too many groups (2).", str_length, str));
- return false;
+ "too many groups (2).", (int) str_length, str));
+ return true;
}
dst[0]= (unsigned char) (group_value >> 8) & 0xff;
@@ -494,8 +623,8 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
if (dst == ipv6_bytes_end)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "no room for a gap (::).", str_length, str));
- return false;
+ "no room for a gap (::).", (int) str_length, str));
+ return true;
}
int bytes_to_move= (int)(dst - gap_ptr);
@@ -512,49 +641,48 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
if (dst < ipv6_bytes_end)
{
DBUG_PRINT("error", ("str_to_ipv6(%.*s): invalid IPv6 address: "
- "too few groups.", str_length, str));
- return false;
+ "too few groups.", (int) str_length, str));
+ return true;
}
- return true;
+ return false;
}
-///////////////////////////////////////////////////////////////////////////
/**
Converts IPv4-binary-address to a string. This function is a portable
alternative to inet_ntop(AF_INET).
@param[in] ipv4 IPv4-address data (byte array)
- @param[out] str A buffer to store string representation of IPv4-address.
- It must be at least of INET_ADDRSTRLEN.
+ @param[out] dst A buffer to store string representation of IPv4-address.
+ @param[in] dstsize Number of bytes avaiable in "dst"
@note The problem with inet_ntop() is that it is available starting from
Windows Vista, but the minimum supported version is Windows 2000.
*/
-static void ipv4_to_str(const in_addr *ipv4, char *str)
+size_t Inet4::to_string(char *dst, size_t dstsize) const
{
- const unsigned char *ipv4_bytes= (const unsigned char *) ipv4;
-
- sprintf(str, "%d.%d.%d.%d",
- ipv4_bytes[0], ipv4_bytes[1], ipv4_bytes[2], ipv4_bytes[3]);
+ return (size_t) my_snprintf(dst, dstsize, "%d.%d.%d.%d",
+ (uchar) m_buffer[0], (uchar) m_buffer[1],
+ (uchar) m_buffer[2], (uchar) m_buffer[3]);
}
-///////////////////////////////////////////////////////////////////////////
+
/**
Converts IPv6-binary-address to a string. This function is a portable
alternative to inet_ntop(AF_INET6).
@param[in] ipv6 IPv6-address data (byte array)
- @param[out] str A buffer to store string representation of IPv6-address.
+ @param[out] dst A buffer to store string representation of IPv6-address.
It must be at least of INET6_ADDRSTRLEN.
+ @param[in] dstsize Number of bytes available dst.
@note The problem with inet_ntop() is that it is available starting from
Windows Vista, but out the minimum supported version is Windows 2000.
*/
-static void ipv6_to_str(const in6_addr *ipv6, char *str)
+size_t Inet6::to_string(char *dst, size_t dstsize) const
{
struct Region
{
@@ -562,6 +690,8 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
int length;
};
+ const char *ipv6= m_buffer;
+ char *dstend= dst + dstsize;
const unsigned char *ipv6_bytes= (const unsigned char *) ipv6;
// 1. Translate IPv6-address bytes to words.
@@ -570,7 +700,8 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
uint16 ipv6_words[IN6_ADDR_NUM_WORDS];
- for (int i= 0; i < IN6_ADDR_NUM_WORDS; ++i)
+ DBUG_ASSERT(dstsize > 0); // Need a space at least for the trailing '\0'
+ for (size_t i= 0; i < IN6_ADDR_NUM_WORDS; ++i)
ipv6_words[i]= (ipv6_bytes[2 * i] << 8) + ipv6_bytes[2 * i + 1];
// 2. Find "the gap" -- longest sequence of zeros in IPv6-address.
@@ -580,7 +711,7 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
{
Region rg= { -1, -1 };
- for (int i = 0; i < IN6_ADDR_NUM_WORDS; ++i)
+ for (size_t i= 0; i < IN6_ADDR_NUM_WORDS; ++i)
{
if (ipv6_words[i] != 0)
{
@@ -601,7 +732,7 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
}
else
{
- rg.pos= i;
+ rg.pos= (int) i;
rg.length= 1;
}
}
@@ -616,10 +747,14 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
// 3. Convert binary data to string.
- char *p= str;
+ char *p= dst;
- for (int i = 0; i < IN6_ADDR_NUM_WORDS; ++i)
+ for (int i= 0; i < (int) IN6_ADDR_NUM_WORDS; ++i)
{
+ DBUG_ASSERT(dstend >= p);
+ size_t dstsize_available= dstend - p;
+ if (dstsize_available < 5)
+ break;
if (i == gap.pos)
{
// We're at the gap position. We should put trailing ':' and jump to
@@ -646,10 +781,11 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
{
// The data represents either IPv4-compatible or IPv4-mapped address.
// The IPv6-part (zeros or zeros + ffff) has been already put into
- // the string (str). Now it's time to dump IPv4-part.
+ // the string (dst). Now it's time to dump IPv4-part.
- ipv4_to_str((const in_addr *) (ipv6_bytes + 12), p);
- return;
+ return (size_t) (p - dst) +
+ Inet4_null((const char *) (ipv6_bytes + 12), 4).
+ to_string(p, dstsize_available);
}
else
{
@@ -660,7 +796,7 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
p += sprintf(p, "%x", ipv6_words[i]);
- if (i != IN6_ADDR_NUM_WORDS - 1)
+ if (i + 1 != IN6_ADDR_NUM_WORDS)
{
*p= ':';
++p;
@@ -669,6 +805,7 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
}
*p= 0;
+ return (size_t) (p - dst);
}
///////////////////////////////////////////////////////////////////////////
@@ -676,161 +813,122 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
/**
Converts IP-address-string to IP-address-data.
- @param arg IP-address-string.
- @param [out] buffer Buffer to store IP-address-data.
+ ipv4-string -> varbinary(4)
+ ipv6-string -> varbinary(16)
@return Completion status.
- @retval false Given string does not represent an IP-address.
- @retval true The string has been converted sucessfully.
+ @retval NULL Given string does not represent an IP-address.
+ @retval !NULL The string has been converted sucessfully.
*/
-bool Item_func_inet6_aton::calc_value(const String *arg, String *buffer)
+String *Item_func_inet6_aton::val_str(String *buffer)
{
- // ipv4-string -> varbinary(4)
- // ipv6-string -> varbinary(16)
+ DBUG_ASSERT(fixed);
- in_addr ipv4_address;
- in6_addr ipv6_address;
+ Ascii_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ if ((null_value= tmp.is_null()))
+ return NULL;
- if (str_to_ipv4(arg->ptr(), arg->length(), &ipv4_address))
+ Inet4_null ipv4(*tmp.string());
+ if (!ipv4.is_null())
{
- buffer->length(0);
- buffer->append((char *) &ipv4_address, sizeof (in_addr), &my_charset_bin);
-
- return true;
+ ipv4.to_binary(buffer);
+ return buffer;
}
- if (str_to_ipv6(arg->ptr(), arg->length(), &ipv6_address))
+ Inet6_null ipv6(*tmp.string());
+ if (!ipv6.is_null())
{
- buffer->length(0);
- buffer->append((char *) &ipv6_address, sizeof (in6_addr), &my_charset_bin);
-
- return true;
+ ipv6.to_binary(buffer);
+ return buffer;
}
- return false;
+ null_value= true;
+ return NULL;
}
-///////////////////////////////////////////////////////////////////////////
/**
Converts IP-address-data to IP-address-string.
-
- @param arg IP-address-data.
- @param [out] buffer Buffer to store IP-address-string.
-
- @return Completion status.
- @retval false The argument does not correspond to IP-address.
- @retval true The string has been converted sucessfully.
*/
-bool Item_func_inet6_ntoa::calc_value(const String *arg, String *buffer)
+String *Item_func_inet6_ntoa::val_str_ascii(String *buffer)
{
- if (arg->charset() != &my_charset_bin)
- return false;
+ DBUG_ASSERT(fixed);
- if ((int) arg->length() == IN_ADDR_SIZE)
+ // Binary string argument expected
+ if (unlikely(args[0]->result_type() != STRING_RESULT ||
+ args[0]->collation.collation != &my_charset_bin))
{
- char str[INET_ADDRSTRLEN];
-
- ipv4_to_str((const in_addr *) arg->ptr(), str);
-
- buffer->length(0);
- buffer->append(str, (uint32) strlen(str), &my_charset_latin1);
-
- return true;
+ null_value= true;
+ return NULL;
}
- else if ((int) arg->length() == IN6_ADDR_SIZE)
- {
- char str[INET6_ADDRSTRLEN];
- ipv6_to_str((const in6_addr *) arg->ptr(), str);
+ String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ if ((null_value= tmp.is_null()))
+ return NULL;
- buffer->length(0);
- buffer->append(str, (uint32) strlen(str), &my_charset_latin1);
+ Inet4_null ipv4(static_cast<const Binary_string&>(*tmp.string()));
+ if (!ipv4.is_null())
+ {
+ ipv4.to_string(buffer);
+ return buffer;
+ }
- return true;
+ Inet6_null ipv6(static_cast<const Binary_string&>(*tmp.string()));
+ if (!ipv6.is_null())
+ {
+ ipv6.to_string(buffer);
+ return buffer;
}
- DBUG_PRINT("info",
- ("INET6_NTOA(): varbinary(4) or varbinary(16) expected."));
- return false;
+ DBUG_PRINT("info", ("INET6_NTOA(): varbinary(4) or varbinary(16) expected."));
+ null_value= true;
+ return NULL;
}
-///////////////////////////////////////////////////////////////////////////
/**
Checks if the passed string represents an IPv4-address.
-
- @param arg The string to check.
-
- @return Check status.
- @retval false The passed string does not represent an IPv4-address.
- @retval true The passed string represents an IPv4-address.
*/
-bool Item_func_is_ipv4::calc_value(const String *arg)
+longlong Item_func_is_ipv4::val_int()
{
- in_addr ipv4_address;
-
- return str_to_ipv4(arg->ptr(), arg->length(), &ipv4_address);
+ DBUG_ASSERT(fixed);
+ String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ return !tmp.is_null() && !Inet4_null(*tmp.string()).is_null();
}
-///////////////////////////////////////////////////////////////////////////
/**
Checks if the passed string represents an IPv6-address.
-
- @param arg The string to check.
-
- @return Check status.
- @retval false The passed string does not represent an IPv6-address.
- @retval true The passed string represents an IPv6-address.
*/
-bool Item_func_is_ipv6::calc_value(const String *arg)
+longlong Item_func_is_ipv6::val_int()
{
- in6_addr ipv6_address;
-
- return str_to_ipv6(arg->ptr(), arg->length(), &ipv6_address);
+ DBUG_ASSERT(fixed);
+ String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
+ return !tmp.is_null() && !Inet6_null(*tmp.string()).is_null();
}
-///////////////////////////////////////////////////////////////////////////
/**
Checks if the passed IPv6-address is an IPv4-compat IPv6-address.
-
- @param arg The IPv6-address to check.
-
- @return Check status.
- @retval false The passed IPv6-address is not an IPv4-compatible IPv6-address.
- @retval true The passed IPv6-address is an IPv4-compatible IPv6-address.
*/
-bool Item_func_is_ipv4_compat::calc_value(const String *arg)
+longlong Item_func_is_ipv4_compat::val_int()
{
- if ((int) arg->length() != IN6_ADDR_SIZE || arg->charset() != &my_charset_bin)
- return false;
-
- return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) arg->ptr());
+ Inet6_null ip6(args[0]);
+ return !ip6.is_null() && ip6.is_v4compat();
}
-///////////////////////////////////////////////////////////////////////////
/**
Checks if the passed IPv6-address is an IPv4-mapped IPv6-address.
-
- @param arg The IPv6-address to check.
-
- @return Check status.
- @retval false The passed IPv6-address is not an IPv4-mapped IPv6-address.
- @retval true The passed IPv6-address is an IPv4-mapped IPv6-address.
*/
-bool Item_func_is_ipv4_mapped::calc_value(const String *arg)
+longlong Item_func_is_ipv4_mapped::val_int()
{
- if ((int) arg->length() != IN6_ADDR_SIZE || arg->charset() != &my_charset_bin)
- return false;
-
- return IN6_IS_ADDR_V4MAPPED((struct in6_addr *) arg->ptr());
+ Inet6_null ip6(args[0]);
+ return !ip6.is_null() && ip6.is_v4mapped();
}
diff --git a/sql/item_inetfunc.h b/sql/item_inetfunc.h
index 024ff8ce4f0..feeac9fa457 100644
--- a/sql/item_inetfunc.h
+++ b/sql/item_inetfunc.h
@@ -81,33 +81,7 @@ public:
{
null_value= false;
}
-
-public:
- virtual longlong val_int();
bool need_parentheses_in_default() { return false; }
-
-protected:
- virtual bool calc_value(const String *arg) = 0;
-};
-
-
-/*************************************************************************
- Item_func_inet_str_base implements common code for INET6/IP-related
- functions returning string value.
-*************************************************************************/
-
-class Item_func_inet_str_base : public Item_str_ascii_func
-{
-public:
- inline Item_func_inet_str_base(THD *thd, Item *arg):
- Item_str_ascii_func(thd, arg)
- { }
-
-public:
- virtual String *val_str_ascii(String *buffer);
-
-protected:
- virtual bool calc_value(const String *arg, String *buffer) = 0;
};
@@ -115,11 +89,11 @@ protected:
Item_func_inet6_aton implements INET6_ATON() SQL-function.
*************************************************************************/
-class Item_func_inet6_aton : public Item_func_inet_str_base
+class Item_func_inet6_aton : public Item_str_func
{
public:
inline Item_func_inet6_aton(THD *thd, Item *ip_addr):
- Item_func_inet_str_base(thd, ip_addr)
+ Item_str_func(thd, ip_addr)
{ }
public:
@@ -136,8 +110,7 @@ public:
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_inet6_aton>(thd, this); }
-protected:
- virtual bool calc_value(const String *arg, String *buffer);
+ String *val_str(String *to);
};
@@ -145,11 +118,11 @@ protected:
Item_func_inet6_ntoa implements INET6_NTOA() SQL-function.
*************************************************************************/
-class Item_func_inet6_ntoa : public Item_func_inet_str_base
+class Item_func_inet6_ntoa : public Item_str_ascii_func
{
public:
inline Item_func_inet6_ntoa(THD *thd, Item *ip_addr):
- Item_func_inet_str_base(thd, ip_addr)
+ Item_str_ascii_func(thd, ip_addr)
{ }
public:
@@ -168,11 +141,9 @@ public:
maybe_null= 1;
return FALSE;
}
+ String *val_str_ascii(String *to);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_inet6_ntoa>(thd, this); }
-
-protected:
- virtual bool calc_value(const String *arg, String *buffer);
};
@@ -193,8 +164,7 @@ public:
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4>(thd, this); }
-protected:
- virtual bool calc_value(const String *arg);
+ longlong val_int();
};
@@ -209,14 +179,12 @@ public:
Item_func_inet_bool_base(thd, ip_addr)
{ }
-public:
virtual const char *func_name() const
{ return "is_ipv6"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv6>(thd, this); }
-protected:
- virtual bool calc_value(const String *arg);
+ longlong val_int();
};
@@ -230,15 +198,11 @@ public:
inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr):
Item_func_inet_bool_base(thd, ip_addr)
{ }
-
-public:
virtual const char *func_name() const
{ return "is_ipv4_compat"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4_compat>(thd, this); }
-
-protected:
- virtual bool calc_value(const String *arg);
+ longlong val_int();
};
@@ -252,15 +216,11 @@ public:
inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr):
Item_func_inet_bool_base(thd, ip_addr)
{ }
-
-public:
virtual const char *func_name() const
{ return "is_ipv4_mapped"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); }
-
-protected:
- virtual bool calc_value(const String *arg);
+ longlong val_int();
};
#endif // ITEM_INETFUNC_INCLUDED
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 4ec481cf439..54bdadc3a32 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -374,17 +374,11 @@ static int path_setup_nwc(json_path_t *p, CHARSET_INFO *i_cs,
longlong Item_func_json_valid::val_int()
{
String *js= args[0]->val_json(&tmp_value);
- json_engine_t je;
if ((null_value= args[0]->null_value))
return 0;
- json_scan_start(&je, js->charset(), (const uchar *) js->ptr(),
- (const uchar *) js->ptr()+js->length());
-
- while (json_scan_next(&je) == 0) {}
-
- return je.s.error == 0;
+ return json_valid(js->ptr(), js->length(), js->charset());
}
@@ -1563,6 +1557,7 @@ bool Item_func_json_array_append::fix_length_and_dec()
}
fix_char_length_ulonglong(char_length);
+ maybe_null= 1;
return FALSE;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 6c82c580858..77e870b297d 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -4544,7 +4544,7 @@ bool Item_func_dyncol_create::prepare_arguments(THD *thd, bool force_names_arg)
case DYN_COL_DATETIME:
case DYN_COL_DATE:
args[valpos]->get_date(thd, &vals[i].x.time_value,
- sql_mode_for_dates(thd));
+ Datetime::Options(thd));
break;
case DYN_COL_TIME:
args[valpos]->get_time(thd, &vals[i].x.time_value);
@@ -5135,7 +5135,7 @@ bool Item_dyncol_get::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydat
{
longlong llval = (longlong)val.x.ulong_value;
if (int_to_datetime_with_warn(thd, Longlong_hybrid(llval, !signed_value),
- ltime, fuzzydate, 0 /* TODO */))
+ ltime, fuzzydate, 0, 0 /* TODO */))
goto null;
return 0;
}
@@ -5144,12 +5144,12 @@ bool Item_dyncol_get::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydat
/* fall through */
case DYN_COL_DOUBLE:
if (double_to_datetime_with_warn(thd, val.x.double_value, ltime, fuzzydate,
- 0 /* TODO */))
+ 0, 0 /* TODO */))
goto null;
return 0;
case DYN_COL_DECIMAL:
if (decimal_to_datetime_with_warn(thd, (my_decimal*)&val.x.decimal.value,
- ltime, fuzzydate, 0 /* TODO */))
+ ltime, fuzzydate, 0, 0 /* TODO */))
goto null;
return 0;
case DYN_COL_STRING:
@@ -5264,3 +5264,102 @@ String *Item_temptable_rowid::val_str(String *str)
str_value.set((char*)(table->file->ref), max_length, &my_charset_bin);
return &str_value;
}
+#ifdef WITH_WSREP
+
+#include "wsrep_mysqld.h"
+
+String *Item_func_wsrep_last_written_gtid::val_str_ascii(String *str)
+{
+ wsrep::gtid gtid= current_thd->wsrep_cs().last_written_gtid();
+ if (gtid_str.alloc(wsrep::gtid_c_str_len()))
+ {
+ my_error(ER_OUTOFMEMORY, wsrep::gtid_c_str_len());
+ null_value= true;
+ return NULL;
+ }
+
+ ssize_t gtid_len= gtid_print_to_c_str(gtid, (char*) gtid_str.ptr(),
+ wsrep::gtid_c_str_len());
+ if (gtid_len < 0)
+ {
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), func_name(),
+ "wsrep_gtid_print failed");
+ null_value= true;
+ return NULL;
+ }
+ gtid_str.length(gtid_len);
+ return &gtid_str;
+}
+
+String *Item_func_wsrep_last_seen_gtid::val_str_ascii(String *str)
+{
+ /* TODO: Should call Wsrep_server_state.instance().last_committed_gtid()
+ instead. */
+ wsrep::gtid gtid= Wsrep_server_state::instance().provider().last_committed_gtid();
+ if (gtid_str.alloc(wsrep::gtid_c_str_len()))
+ {
+ my_error(ER_OUTOFMEMORY, wsrep::gtid_c_str_len());
+ null_value= true;
+ return NULL;
+ }
+ ssize_t gtid_len= wsrep::gtid_print_to_c_str(gtid, (char*) gtid_str.ptr(),
+ wsrep::gtid_c_str_len());
+ if (gtid_len < 0)
+ {
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), func_name(),
+ "wsrep_gtid_print failed");
+ null_value= true;
+ return NULL;
+ }
+ gtid_str.length(gtid_len);
+ return &gtid_str;
+}
+
+longlong Item_func_wsrep_sync_wait_upto::val_int()
+{
+ int timeout= -1;
+ String* gtid_str= args[0]->val_str(&value);
+ if (gtid_str == NULL)
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), func_name());
+ return 0LL;
+ }
+
+ if (arg_count == 2)
+ {
+ timeout= args[1]->val_int();
+ }
+
+ wsrep_gtid_t gtid;
+ int gtid_len= wsrep_gtid_scan(gtid_str->ptr(), gtid_str->length(), &gtid);
+ if (gtid_len < 0)
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), func_name());
+ return 0LL;
+ }
+
+ if (gtid.seqno == WSREP_SEQNO_UNDEFINED &&
+ wsrep_uuid_compare(&gtid.uuid, &WSREP_UUID_UNDEFINED) == 0)
+ {
+ return 1LL;
+ }
+
+ enum wsrep::provider::status status=
+ wsrep_sync_wait_upto(current_thd, &gtid, timeout);
+
+ if (status)
+ {
+ int err;
+ switch (status) {
+ case wsrep::provider::error_transaction_missing:
+ err= ER_WRONG_ARGUMENTS;
+ break;
+ default:
+ err= ER_LOCK_WAIT_TIMEOUT;
+ }
+ my_error(err, MYF(0), func_name());
+ return 0LL;
+ }
+ return 1LL;
+}
+#endif /* WITH_WSREP */
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 762a3c2559e..2ead0f44e49 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1804,5 +1804,56 @@ public:
Item *get_copy(THD *thd)
{ return get_item_copy<Item_temptable_rowid>(thd, this); }
};
+#ifdef WITH_WSREP
+
+#include "wsrep_api.h"
+
+class Item_func_wsrep_last_written_gtid: public Item_str_ascii_func
+{
+ String gtid_str;
+public:
+ Item_func_wsrep_last_written_gtid(THD *thd): Item_str_ascii_func(thd) {}
+ const char *func_name() const { return "wsrep_last_written_gtid"; }
+ String *val_str_ascii(String *);
+ bool fix_length_and_dec()
+ {
+ max_length= WSREP_GTID_STR_LEN;
+ maybe_null= true;
+ return FALSE;
+ }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_wsrep_last_written_gtid>(thd, this); }
+};
+
+class Item_func_wsrep_last_seen_gtid: public Item_str_ascii_func
+{
+ String gtid_str;
+public:
+ Item_func_wsrep_last_seen_gtid(THD *thd): Item_str_ascii_func(thd) {}
+ const char *func_name() const { return "wsrep_last_seen_gtid"; }
+ String *val_str_ascii(String *);
+ bool fix_length_and_dec()
+ {
+ max_length= WSREP_GTID_STR_LEN;
+ maybe_null= true;
+ return FALSE;
+ }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_wsrep_last_seen_gtid>(thd, this); }
+};
+
+class Item_func_wsrep_sync_wait_upto: public Item_int_func
+{
+ String value;
+public:
+ Item_func_wsrep_sync_wait_upto(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_func_wsrep_sync_wait_upto(THD *thd, Item *a, Item* b): Item_int_func(thd, a, b) {}
+ const Type_handler *type_handler() const { return &type_handler_string; }
+ const char *func_name() const { return "wsrep_sync_wait_upto_gtid"; }
+ longlong val_int();
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_wsrep_sync_wait_upto>(thd, this); }
+};
+#endif /* WITH_WSREP */
#endif /* ITEM_STRFUNC_INCLUDED */
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 7408dc378ef..0ace59fd2fc 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1084,7 +1084,7 @@ void Item_maxmin_subselect::no_rows_in_result()
*/
if (parsing_place != SELECT_LIST || const_item())
return;
- value= (new (thd->mem_root) Item_null(thd))->get_cache(thd);
+ value= get_cache(thd);
null_value= 0;
was_values= 0;
make_const();
@@ -1102,7 +1102,7 @@ void Item_singlerow_subselect::no_rows_in_result()
*/
if (parsing_place != SELECT_LIST || const_item())
return;
- value= (new (thd->mem_root) Item_null(thd))->get_cache(thd);
+ value= get_cache(thd);
reset();
make_const();
}
@@ -1352,6 +1352,24 @@ String *Item_singlerow_subselect::val_str(String *str)
}
+bool Item_singlerow_subselect::val_native(THD *thd, Native *to)
+{
+ DBUG_ASSERT(fixed == 1);
+ if (forced_const)
+ return value->val_native(thd, to);
+ if (!exec() && !value->null_value)
+ {
+ null_value= false;
+ return value->val_native(thd, to);
+ }
+ else
+ {
+ reset();
+ return true;
+ }
+}
+
+
my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -5795,7 +5813,7 @@ int
Ordered_key::cmp_keys_by_row_data(ha_rows a, ha_rows b)
{
uchar *rowid_a, *rowid_b;
- int __attribute__((unused)) error;
+ int error;
int cmp_res;
/* The length in bytes of the rowids (positions) of tmp_table. */
uint rowid_length= tbl->file->ref_length;
@@ -5892,7 +5910,7 @@ int Ordered_key::cmp_key_with_search_key(rownum_t row_num)
/* The length in bytes of the rowids (positions) of tmp_table. */
uint rowid_length= tbl->file->ref_length;
uchar *cur_rowid= row_num_to_rowid + row_num * rowid_length;
- int __attribute__((unused)) error;
+ int error;
int cmp_res;
if (unlikely((error= tbl->file->ha_rnd_pos(tbl->record[0], cur_rowid))))
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 443354f4900..0e771bae42e 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -306,6 +306,7 @@ public:
double val_real();
longlong val_int ();
String *val_str (String *);
+ bool val_native(THD *thd, Native *);
my_decimal *val_decimal(my_decimal *);
bool val_bool();
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 0e52b2988a3..fe901b65aeb 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2381,6 +2381,15 @@ Item_sum_hybrid::val_str(String *str)
}
+bool Item_sum_hybrid::val_native(THD *thd, Native *to)
+{
+ DBUG_ASSERT(fixed == 1);
+ if (null_value)
+ return true;
+ return val_native_from_item(thd, value, to);
+}
+
+
void Item_sum_hybrid::cleanup()
{
DBUG_ENTER("Item_sum_hybrid::cleanup");
@@ -3235,6 +3244,25 @@ bool Item_udf_sum::add()
DBUG_RETURN(0);
}
+
+bool Item_udf_sum::supports_removal() const
+{
+ DBUG_ENTER("Item_udf_sum::supports_remove");
+ DBUG_PRINT("info", ("support: %d", udf.supports_removal()));
+ DBUG_RETURN(udf.supports_removal());
+}
+
+
+void Item_udf_sum::remove()
+{
+ my_bool tmp_null_value;
+ DBUG_ENTER("Item_udf_sum::remove");
+ udf.remove(&tmp_null_value);
+ null_value= tmp_null_value;
+ DBUG_VOID_RETURN;
+}
+
+
void Item_udf_sum::cleanup()
{
/*
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 1a21c257221..50e41990b13 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -384,7 +384,9 @@ protected:
Item **orig_args, *tmp_orig_args[2];
static size_t ram_limitation(THD *thd);
-
+public:
+ // Methods used by ColumnStore
+ Item **get_orig_args() const { return orig_args; }
public:
void mark_as_sum_func();
@@ -1070,6 +1072,7 @@ protected:
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
void reset_field();
String *val_str(String *);
+ bool val_native(THD *thd, Native *);
const Type_handler *real_type_handler() const
{
return get_arg(0)->real_type_handler();
@@ -1561,6 +1564,8 @@ public:
void clear();
bool add();
+ bool supports_removal() const;
+ void remove();
void reset_field() {};
void update_field() {};
void cleanup();
@@ -1826,6 +1831,14 @@ class Item_func_group_concat : public Item_sum
element_count count __attribute__((unused)),
void* item_arg);
public:
+ // Methods used by ColumnStore
+ bool get_distinct() const { return distinct; }
+ uint get_count_field() const { return arg_count_field; }
+ uint get_order_field() const { return arg_count_order; }
+ const String* get_separator() const { return separator; }
+ ORDER** get_order() const { return order; }
+
+public:
Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
bool is_distinct, List<Item> *is_select,
const SQL_I_List<ORDER> &is_order, String *is_separator,
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 2da92f971d1..cccb5a4b37f 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -131,7 +131,7 @@ static bool extract_date_time(THD *thd, DATE_TIME_FORMAT *format,
timestamp_type cached_timestamp_type,
const char **sub_pattern_end,
const char *date_time_type,
- date_mode_t fuzzydate)
+ date_conv_mode_t fuzzydate)
{
int weekday= 0, yearday= 0, daypart= 0;
int week_number= -1;
@@ -453,7 +453,7 @@ static bool extract_date_time(THD *thd, DATE_TIME_FORMAT *format,
{
ErrConvString err(val_begin, length, &my_charset_bin);
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- &err, cached_timestamp_type, NullS);
+ &err, cached_timestamp_type, 0, NullS);
break;
}
} while (++val != val_end);
@@ -808,8 +808,9 @@ longlong Item_func_period_diff::val_int()
longlong Item_func_to_days::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE);
- return (null_value= !d.is_valid_date()) ? 0 : d.daynr();
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
+ return (null_value= !d.is_valid_datetime()) ? 0 : d.daynr();
}
@@ -817,14 +818,15 @@ longlong Item_func_to_seconds::val_int_endpoint(bool left_endp,
bool *incl_endp)
{
DBUG_ASSERT(fixed == 1);
- Datetime dt(current_thd, args[0], TIME_FUZZY_DATES);
+ // val_int_endpoint() is called only if args[0] is a temporal Item_field
+ Datetime_from_temporal dt(current_thd, args[0], TIME_FUZZY_DATES);
if ((null_value= !dt.is_valid_datetime()))
{
/* got NULL, leave the incl_endp intact */
return LONGLONG_MIN;
}
/* Set to NULL if invalid date, but keep the value */
- null_value= dt.check_date(TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE);
+ null_value= dt.check_date(TIME_NO_ZEROS);
/*
Even if the evaluation return NULL, seconds is useful for pruning
*/
@@ -835,7 +837,11 @@ longlong Item_func_to_seconds::val_int()
{
DBUG_ASSERT(fixed == 1);
THD *thd= current_thd;
- Datetime dt(thd, args[0], TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE);
+ /*
+ Unlike val_int_endpoint(), we cannot use Datetime_from_temporal here.
+ The argument can be of a non-temporal data type.
+ */
+ Datetime dt(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
return (null_value= !dt.is_valid_datetime()) ? 0 : dt.to_seconds();
}
@@ -880,7 +886,8 @@ enum_monotonicity_info Item_func_to_seconds::get_monotonicity_info() const
longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
{
DBUG_ASSERT(fixed == 1);
- Datetime dt(current_thd, args[0], date_mode_t(0));
+ // val_int_endpoint() is only called if args[0] is a temporal Item_field
+ Datetime_from_temporal dt(current_thd, args[0], TIME_CONV_NONE);
longlong res;
if ((null_value= !dt.is_valid_datetime()))
{
@@ -889,7 +896,7 @@ longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
}
res= (longlong) dt.daynr();
/* Set to NULL if invalid date, but keep the value */
- null_value= dt.check_date(TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE);
+ null_value= dt.check_date(TIME_NO_ZEROS);
if (null_value)
{
/*
@@ -933,22 +940,25 @@ longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
longlong Item_func_dayofyear::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE);
- return (null_value= !d.is_valid_date()) ? 0 : d.dayofyear();
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
+ return (null_value= !d.is_valid_datetime()) ? 0 : d.dayofyear();
}
longlong Item_func_dayofmonth::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], date_mode_t(0));
- return (null_value= !d.is_valid_date()) ? 0 : d.get_mysql_time()->day;
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd));
+ return (null_value= !d.is_valid_datetime()) ? 0 : d.get_mysql_time()->day;
}
longlong Item_func_month::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], date_mode_t(0));
- return (null_value= !d.is_valid_date()) ? 0 : d.get_mysql_time()->month;
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd));
+ return (null_value= !d.is_valid_datetime()) ? 0 : d.get_mysql_time()->month;
}
@@ -970,9 +980,9 @@ String* Item_func_monthname::val_str(String* str)
DBUG_ASSERT(fixed == 1);
const char *month_name;
uint err;
- Date d(current_thd, args[0], date_mode_t(0));
-
- if ((null_value= (!d.is_valid_date() || !d.get_mysql_time()->month)))
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd));
+ if ((null_value= (!d.is_valid_datetime() || !d.get_mysql_time()->month)))
return (String *) 0;
month_name= locale->month_names->type_names[d.get_mysql_time()->month - 1];
@@ -989,21 +999,24 @@ String* Item_func_monthname::val_str(String* str)
longlong Item_func_quarter::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], date_mode_t(0));
- return (null_value= !d.is_valid_date()) ? 0 : d.quarter();
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd));
+ return (null_value= !d.is_valid_datetime()) ? 0 : d.quarter();
}
longlong Item_func_hour::val_int()
{
DBUG_ASSERT(fixed == 1);
- Time tm(current_thd, args[0], Time::Options_for_cast());
+ THD *thd= current_thd;
+ Time tm(thd, args[0], Time::Options_for_cast(thd));
return (null_value= !tm.is_valid_time()) ? 0 : tm.get_mysql_time()->hour;
}
longlong Item_func_minute::val_int()
{
DBUG_ASSERT(fixed == 1);
- Time tm(current_thd, args[0], Time::Options_for_cast());
+ THD *thd= current_thd;
+ Time tm(thd, args[0], Time::Options_for_cast(thd));
return (null_value= !tm.is_valid_time()) ? 0 : tm.get_mysql_time()->minute;
}
@@ -1013,7 +1026,8 @@ longlong Item_func_minute::val_int()
longlong Item_func_second::val_int()
{
DBUG_ASSERT(fixed == 1);
- Time tm(current_thd, args[0], Time::Options_for_cast());
+ THD *thd= current_thd;
+ Time tm(thd, args[0], Time::Options_for_cast(thd));
return (null_value= !tm.is_valid_time()) ? 0 : tm.get_mysql_time()->second;
}
@@ -1062,8 +1076,8 @@ longlong Item_func_week::val_int()
DBUG_ASSERT(fixed == 1);
uint week_format;
THD *thd= current_thd;
- Date d(thd, args[0], TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE);
- if ((null_value= !d.is_valid_date()))
+ Datetime d(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
+ if ((null_value= !d.is_valid_datetime()))
return 0;
if (arg_count > 1)
week_format= (uint)args[1]->val_int();
@@ -1076,8 +1090,9 @@ longlong Item_func_week::val_int()
longlong Item_func_yearweek::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE);
- return (null_value= !d.is_valid_date()) ? 0 :
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
+ return (null_value= !d.is_valid_datetime()) ? 0 :
d.yearweek((week_mode((uint) args[1]->val_int()) | WEEK_YEAR));
}
@@ -1085,8 +1100,9 @@ longlong Item_func_yearweek::val_int()
longlong Item_func_weekday::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE);
- return ((null_value= !d.is_valid_date())) ? 0 :
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
+ return ((null_value= !d.is_valid_datetime())) ? 0 :
calc_weekday(d.daynr(), odbc_type) + MY_TEST(odbc_type);
}
@@ -1123,8 +1139,9 @@ String* Item_func_dayname::val_str(String* str)
longlong Item_func_year::val_int()
{
DBUG_ASSERT(fixed == 1);
- Date d(current_thd, args[0], date_mode_t(0));
- return (null_value= !d.is_valid_date()) ? 0 : d.get_mysql_time()->year;
+ THD *thd= current_thd;
+ Datetime d(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd));
+ return (null_value= !d.is_valid_datetime()) ? 0 : d.get_mysql_time()->year;
}
@@ -1155,7 +1172,8 @@ enum_monotonicity_info Item_func_year::get_monotonicity_info() const
longlong Item_func_year::val_int_endpoint(bool left_endp, bool *incl_endp)
{
DBUG_ASSERT(fixed == 1);
- Datetime dt(current_thd, args[0], date_mode_t(0));
+ // val_int_endpoint() is cally only if args[0] is a temporal Item_field
+ Datetime_from_temporal dt(current_thd, args[0], TIME_CONV_NONE);
if ((null_value= !dt.is_valid_datetime()))
{
/* got NULL, leave the incl_endp intact */
@@ -1199,15 +1217,13 @@ bool Item_func_unix_timestamp::get_timestamp_value(my_time_t *seconds,
}
}
- THD *thd= current_thd;
- Datetime dt(thd, args[0], TIME_NO_ZERO_IN_DATE);
- if ((null_value= !dt.is_valid_datetime()))
+ Timestamp_or_zero_datetime_native_null native(current_thd, args[0], true);
+ if ((null_value= native.is_null() || native.is_zero_datetime()))
return true;
-
- uint error_code;
- *seconds= TIME_to_timestamp(thd, dt.get_mysql_time(), &error_code);
- *second_part= dt.get_mysql_time()->second_part;
- return (null_value= (error_code == ER_WARN_DATA_OUT_OF_RANGE));
+ Timestamp_or_zero_datetime tm(native);
+ *seconds= tm.tv().tv_sec;
+ *second_part= tm.tv().tv_usec;
+ return false;
}
@@ -1264,7 +1280,8 @@ longlong Item_func_unix_timestamp::val_int_endpoint(bool left_endp, bool *incl_e
longlong Item_func_time_to_sec::int_op()
{
DBUG_ASSERT(fixed == 1);
- Time tm(current_thd, args[0], Time::Options_for_cast());
+ THD *thd= current_thd;
+ Time tm(thd, args[0], Time::Options_for_cast(thd));
return ((null_value= !tm.is_valid_time())) ? 0 : tm.to_seconds();
}
@@ -1272,7 +1289,8 @@ longlong Item_func_time_to_sec::int_op()
my_decimal *Item_func_time_to_sec::decimal_op(my_decimal* buf)
{
DBUG_ASSERT(fixed == 1);
- Time tm(current_thd, args[0], Time::Options_for_cast());
+ THD *thd= current_thd;
+ Time tm(thd, args[0], Time::Options_for_cast(thd));
if ((null_value= !tm.is_valid_time()))
return 0;
const MYSQL_TIME *ltime= tm.get_mysql_time();
@@ -1621,9 +1639,8 @@ int Item_func_now_local::save_in_field(Field *field, bool no_conversions)
{
THD *thd= field->get_thd();
my_time_t ts= thd->query_start();
- uint dec= MY_MIN(decimals, field->decimals());
- ulong sec_part= dec ? thd->query_start_sec_part() : 0;
- sec_part-= my_time_fraction_remainder(sec_part, dec);
+ ulong sec_part= decimals ? thd->query_start_sec_part() : 0;
+ sec_part-= my_time_fraction_remainder(sec_part, decimals);
field->set_notnull();
((Field_timestamp*)field)->store_TIME(ts, sec_part);
return 0;
@@ -1698,9 +1715,10 @@ bool Item_func_sysdate_local::get_date(THD *thd, MYSQL_TIME *res,
bool Item_func_sec_to_time::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
DBUG_ASSERT(fixed == 1);
- VSec6 sec(thd, args[0], "seconds", LONGLONG_MAX);
+ VSec9 sec(thd, args[0], "seconds", LONGLONG_MAX);
if ((null_value= sec.is_null()))
return true;
+ sec.round(decimals, thd->temporal_round_mode());
if (sec.sec_to_time(ltime, decimals) && !sec.truncated())
sec.make_truncated_warning(thd, "seconds");
return false;
@@ -1858,10 +1876,10 @@ String *Item_func_date_format::val_str(String *str)
uint size;
const MY_LOCALE *lc= 0;
DBUG_ASSERT(fixed == 1);
-
- if ((null_value= args[0]->get_date(current_thd, &l_time,
- is_time_format ? TIME_TIME_ONLY :
- date_mode_t(0))))
+ date_conv_mode_t mode= is_time_format ? TIME_TIME_ONLY : TIME_CONV_NONE;
+ THD *thd= current_thd;
+ if ((null_value= args[0]->get_date(thd, &l_time,
+ Temporal::Options(mode, thd))))
return 0;
if (!(format = args[1]->val_str(str)) || !format->length())
@@ -1918,12 +1936,16 @@ bool Item_func_from_unixtime::get_date(THD *thd, MYSQL_TIME *ltime,
bzero((char *)ltime, sizeof(*ltime));
ltime->time_type= MYSQL_TIMESTAMP_TIME;
- VSec6 sec(thd, args[0], "unixtime", TIMESTAMP_MAX_VALUE);
+ VSec9 sec(thd, args[0], "unixtime", TIMESTAMP_MAX_VALUE);
DBUG_ASSERT(sec.sec() <= TIMESTAMP_MAX_VALUE);
if (sec.is_null() || sec.truncated() || sec.neg())
return (null_value= 1);
+ sec.round(MY_MIN(decimals, TIME_SECOND_PART_DIGITS), thd->temporal_round_mode());
+ if (sec.sec() > TIMESTAMP_MAX_VALUE)
+ return (null_value= true); // Went out of range after rounding
+
tz->gmt_sec_to_TIME(ltime, (my_time_t) sec.sec());
ltime->second_part= sec.usec();
@@ -1952,7 +1974,8 @@ bool Item_func_convert_tz::get_date(THD *thd, MYSQL_TIME *ltime,
if ((null_value= (from_tz == 0 || to_tz == 0)))
return true;
- Datetime *dt= new(ltime) Datetime(thd, args[0], TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE);
+ Datetime::Options opt(TIME_NO_ZEROS, thd);
+ Datetime *dt= new(ltime) Datetime(thd, args[0], opt);
if ((null_value= !dt->is_valid_datetime()))
return true;
@@ -2092,16 +2115,18 @@ void Item_extract::print(String *str, enum_query_type query_type)
bool Item_extract::fix_length_and_dec()
{
maybe_null=1; // If wrong date
+ uint32 daylen= args[0]->cmp_type() == TIME_RESULT ? 2 :
+ TIME_MAX_INTERVAL_DAY_CHAR_LENGTH;
switch (int_type) {
case INTERVAL_YEAR: set_date_length(4); break; // YYYY
case INTERVAL_YEAR_MONTH: set_date_length(6); break; // YYYYMM
case INTERVAL_QUARTER: set_date_length(2); break; // 1..4
case INTERVAL_MONTH: set_date_length(2); break; // MM
case INTERVAL_WEEK: set_date_length(2); break; // 0..52
- case INTERVAL_DAY: set_day_length(2); break; // DD
- case INTERVAL_DAY_HOUR: set_time_length(4); break; // DDhh
- case INTERVAL_DAY_MINUTE: set_time_length(6); break; // DDhhmm
- case INTERVAL_DAY_SECOND: set_time_length(8); break; // DDhhmmss
+ case INTERVAL_DAY: set_day_length(daylen); break; // DD
+ case INTERVAL_DAY_HOUR: set_day_length(daylen+2); break; // DDhh
+ case INTERVAL_DAY_MINUTE: set_day_length(daylen+4); break; // DDhhmm
+ case INTERVAL_DAY_SECOND: set_day_length(daylen+6); break; // DDhhmmss
case INTERVAL_HOUR: set_time_length(2); break; // hh
case INTERVAL_HOUR_MINUTE: set_time_length(4); break; // hhmm
case INTERVAL_HOUR_SECOND: set_time_length(6); break; // hhmmss
@@ -2109,7 +2134,7 @@ bool Item_extract::fix_length_and_dec()
case INTERVAL_MINUTE_SECOND: set_time_length(4); break; // mmss
case INTERVAL_SECOND: set_time_length(2); break; // ss
case INTERVAL_MICROSECOND: set_time_length(6); break; // ffffff
- case INTERVAL_DAY_MICROSECOND: set_time_length(14); break; // DDhhmmssffffff
+ case INTERVAL_DAY_MICROSECOND: set_time_length(daylen+12); break; // DDhhmmssffffff
case INTERVAL_HOUR_MICROSECOND: set_time_length(12); break; // hhmmssffffff
case INTERVAL_MINUTE_MICROSECOND: set_time_length(10); break; // mmssffffff
case INTERVAL_SECOND_MICROSECOND: set_time_length(8); break; // ssffffff
@@ -2131,7 +2156,8 @@ uint Extract_source::week(THD *thd) const
longlong Item_extract::val_int()
{
DBUG_ASSERT(fixed == 1);
- Extract_source dt(current_thd, args[0], m_date_mode);
+ THD *thd= current_thd;
+ Extract_source dt(thd, args[0], m_date_mode);
if ((null_value= !dt.is_valid_extract_source()))
return 0;
switch (int_type) {
@@ -2139,7 +2165,7 @@ longlong Item_extract::val_int()
case INTERVAL_YEAR_MONTH: return dt.year_month();
case INTERVAL_QUARTER: return dt.quarter();
case INTERVAL_MONTH: return dt.month();
- case INTERVAL_WEEK: return dt.week(current_thd);
+ case INTERVAL_WEEK: return dt.week(thd);
case INTERVAL_DAY: return dt.day();
case INTERVAL_DAY_HOUR: return dt.day_hour();
case INTERVAL_DAY_MINUTE: return dt.day_minute();
@@ -2418,7 +2444,7 @@ void Item_char_typecast::fix_length_and_dec_internal(CHARSET_INFO *from_cs)
bool Item_time_typecast::get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode)
{
- Time *tm= new(to) Time(thd, args[0], Time::Options_for_cast(mode),
+ Time *tm= new(to) Time(thd, args[0], Time::Options_for_cast(mode, thd),
MY_MIN(decimals, TIME_SECOND_PART_DIGITS));
return (null_value= !tm->is_valid_time());
}
@@ -2427,7 +2453,8 @@ bool Item_time_typecast::get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode)
bool Item_date_typecast::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
date_mode_t tmp= (fuzzydate | sql_mode_for_dates(thd)) & ~TIME_TIME_ONLY;
- Date *d= new(ltime) Date(thd, args[0], tmp);
+ // Force truncation
+ Date *d= new(ltime) Date(thd, args[0], Date::Options(date_conv_mode_t(tmp)));
return (null_value= !d->is_valid_date());
}
@@ -2435,7 +2462,9 @@ bool Item_date_typecast::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy
bool Item_datetime_typecast::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
date_mode_t tmp= (fuzzydate | sql_mode_for_dates(thd)) & ~TIME_TIME_ONLY;
- Datetime *dt= new(ltime) Datetime(thd, args[0], tmp,
+ // Force rounding if the current sql_mode says so
+ Datetime::Options opt(date_conv_mode_t(tmp), thd);
+ Datetime *dt= new(ltime) Datetime(thd, args[0], opt,
MY_MIN(decimals, TIME_SECOND_PART_DIGITS));
return (null_value= !dt->is_valid_datetime());
}
@@ -2556,6 +2585,7 @@ bool Item_func_timediff::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy
return (null_value= adjust_time_range_with_warn(thd, ltime, decimals));
}
+
/**
MAKETIME(h,m,s) is a time function that calculates a time value
from the total number of hours, minutes, and seconds.
@@ -2567,25 +2597,17 @@ bool Item_func_maketime::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy
DBUG_ASSERT(fixed == 1);
Longlong_hybrid hour(args[0]->val_int(), args[0]->unsigned_flag);
longlong minute= args[1]->val_int();
- VSec6 sec(thd, args[2], "seconds", 59);
+ VSec9 sec(thd, args[2], "seconds", 59);
DBUG_ASSERT(sec.sec() <= 59);
if (args[0]->null_value || args[1]->null_value || sec.is_null() ||
minute < 0 || minute > 59 || sec.neg() || sec.truncated())
return (null_value= 1);
- bzero(ltime, sizeof(*ltime));
- ltime->time_type= MYSQL_TIMESTAMP_TIME;
- ltime->neg= hour.neg();
-
- if (hour.abs() <= TIME_MAX_HOUR)
- {
- ltime->hour= (uint) hour.abs();
- ltime->minute= (uint) minute;
- ltime->second= (uint) sec.sec();
- ltime->second_part= sec.usec();
- }
- else
+ int warn;
+ new(ltime) Time(&warn, hour.neg(), hour.abs(), (uint) minute, sec,
+ thd->temporal_round_mode(), decimals);
+ if (warn)
{
// use check_time_range() to set ltime to the max value depending on dec
int unused;
@@ -2614,7 +2636,8 @@ bool Item_func_maketime::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy
longlong Item_func_microsecond::val_int()
{
DBUG_ASSERT(fixed == 1);
- Time tm(current_thd, args[0], Time::Options_for_cast());
+ THD *thd= current_thd;
+ Time tm(thd, args[0], Time::Options_for_cast(thd));
return ((null_value= !tm.is_valid_time())) ?
0 : tm.get_mysql_time()->second_part;
}
@@ -2628,12 +2651,12 @@ longlong Item_func_timestamp_diff::val_int()
long months= 0;
int neg= 1;
THD *thd= current_thd;
- date_mode_t fuzzydate= TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE;
+ Datetime::Options opt(TIME_NO_ZEROS, thd);
null_value= 0;
- if (Datetime(thd, args[0], fuzzydate).copy_to_mysql_time(&ltime1) ||
- Datetime(thd, args[1], fuzzydate).copy_to_mysql_time(&ltime2))
+ if (Datetime(thd, args[0], opt).copy_to_mysql_time(&ltime1) ||
+ Datetime(thd, args[1], opt).copy_to_mysql_time(&ltime2))
goto null_date;
if (calc_time_diff(&ltime2,&ltime1, 1,
@@ -2942,7 +2965,8 @@ bool Item_func_str_to_date::get_date_common(THD *thd, MYSQL_TIME *ltime,
date_time_format.format.length= format->length();
if (extract_date_time(thd, &date_time_format, val->ptr(), val->length(),
ltime, tstype, 0, "datetime",
- fuzzydate | sql_mode_for_dates(thd)))
+ date_conv_mode_t(fuzzydate) |
+ sql_mode_for_dates(thd)))
return (null_value=1);
return (null_value= 0);
}
@@ -2950,8 +2974,10 @@ bool Item_func_str_to_date::get_date_common(THD *thd, MYSQL_TIME *ltime,
bool Item_func_last_day::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
- Date *d= new(ltime) Date(thd, args[0], fuzzydate & ~TIME_TIME_ONLY);
- if ((null_value= (!d->is_valid_date() || ltime->month == 0)))
+ Datetime::Options opt(date_conv_mode_t(fuzzydate & ~TIME_TIME_ONLY),
+ time_round_mode_t(fuzzydate));
+ Datetime *d= new(ltime) Datetime(thd, args[0], opt);
+ if ((null_value= (!d->is_valid_datetime() || ltime->month == 0)))
return true;
uint month_idx= ltime->month-1;
ltime->day= days_in_month[month_idx];
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index d2a4e87a3d1..d9ab45ed46d 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -993,12 +993,12 @@ class Item_extract :public Item_int_func,
EXTRACT(DAY FROM '-24:00:00') -> -1
*/
set_handler(handler_by_length(max_length= length + 1/*sign*/, 11));
- m_date_mode= date_mode_t(0);
+ m_date_mode= Temporal::Options(TIME_INTERVAL_DAY, current_thd);
}
void set_time_length(uint32 length)
{
set_handler(handler_by_length(max_length= length + 1/*sign*/, 11));
- m_date_mode= TIME_TIME_ONLY;
+ m_date_mode= Temporal::Options(TIME_INTERVAL_hhmmssff, current_thd);
}
public:
const interval_type int_type; // keep it public
@@ -1080,6 +1080,9 @@ class Item_char_typecast :public Item_str_func
void check_truncation_with_warn(String *src, size_t dstlen);
void fix_length_and_dec_internal(CHARSET_INFO *fromcs);
public:
+ // Methods used by ColumnStore
+ uint get_cast_length() const { return cast_length; }
+public:
Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg):
Item_str_func(thd, a), cast_length(length_arg), cast_cs(cs_arg),
m_suppress_warning_to_error_escalation(false) {}
@@ -1106,6 +1109,24 @@ public:
};
+class Item_interval_DDhhmmssff_typecast :public Item_char_typecast
+{
+ uint m_fsp;
+public:
+ Item_interval_DDhhmmssff_typecast(THD *thd, Item *a, uint fsp)
+ :Item_char_typecast(thd, a,Interval_DDhhmmssff::max_char_length(fsp),
+ &my_charset_latin1),
+ m_fsp(fsp)
+ { }
+ String *val_str(String *to)
+ {
+ Interval_DDhhmmssff it(current_thd, args[0], m_fsp);
+ null_value= !it.is_valid_interval_DDhhmmssff();
+ return it.to_string(to, m_fsp);
+ }
+};
+
+
class Item_date_typecast :public Item_datefunc
{
public:
@@ -1204,7 +1225,7 @@ public:
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
- Datetime dt(thd, args[0], date_mode_t(0));
+ Datetime dt(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd));
if (!dt.is_valid_datetime())
return null_value= true;
Interval_DDhhmmssff it(thd, args[1]);
@@ -1232,6 +1253,9 @@ class Item_func_add_time :public Item_handled_func
{
int sign;
public:
+ // Methods used by ColumnStore
+ int get_sign() const { return sign; }
+public:
Item_func_add_time(THD *thd, Item *a, Item *b, bool neg_arg)
:Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1)
{ }
@@ -1317,6 +1341,9 @@ class Item_func_timestamp_diff :public Item_longlong_func
{ return check_argument_types_can_return_date(0, arg_count); }
const interval_type int_type;
public:
+ // Methods used by ColumnStore
+ interval_type get_int_type() const { return int_type; };
+public:
Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg):
Item_longlong_func(thd, a, b), int_type(type_arg) {}
const char *func_name() const { return "timestampdiff"; }
@@ -1443,7 +1470,8 @@ public:
bool get_date(THD *thd, Item_handled_func *item,
MYSQL_TIME *to, date_mode_t fuzzy) const
{
- Datetime dt(thd, item->arguments()[0], date_mode_t(0));
+ Datetime::Options opt(TIME_CONV_NONE, thd);
+ Datetime dt(thd, item->arguments()[0], opt);
if (!dt.is_valid_datetime() ||
dt.check_date_with_warn(thd, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
return (item->null_value= true);
@@ -1471,7 +1499,11 @@ public:
bool get_date(THD *thd, Item_handled_func *item,
MYSQL_TIME *to, date_mode_t fuzzy) const
{
- Date d(thd, item->arguments()[0], date_mode_t(0));
+ /*
+ The first argument is known to be of the DATE data type (not DATETIME).
+ We don't need rounding here.
+ */
+ Date d(thd, item->arguments()[0], TIME_CONV_NONE);
if (!d.is_valid_date() ||
d.check_date_with_warn(thd, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
return (item->null_value= true);
@@ -1524,10 +1556,10 @@ public:
bool get_date(THD *thd, Item_handled_func *item,
MYSQL_TIME *to, date_mode_t fuzzy) const
{
- if (item->arguments()[0]->get_date(thd, to, date_mode_t(0)) ||
+ if (item->arguments()[0]->
+ get_date(thd, to, Datetime::Options(TIME_CONV_NONE, thd)) ||
(to->time_type != MYSQL_TIMESTAMP_TIME &&
- check_date_with_warn(thd, to, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE,
- MYSQL_TIMESTAMP_ERROR)))
+ check_date_with_warn(thd, to, TIME_NO_ZEROS, MYSQL_TIMESTAMP_ERROR)))
return (item->null_value= true);
return (item->null_value= add(thd, item->arguments()[1],
int_type(item), sub(item), to));
@@ -1563,7 +1595,8 @@ public:
MYSQL_TIME *to, date_mode_t fuzzy) const
{
DBUG_ASSERT(item->is_fixed());
- Datetime dt(thd, item->arguments()[0], date_mode_t(0));
+ Datetime::Options opt(TIME_CONV_NONE, thd);
+ Datetime dt(thd, item->arguments()[0], opt);
if (!dt.is_valid_datetime())
return item->null_value= true;
Interval_DDhhmmssff it(thd, item->arguments()[1]);
@@ -1632,7 +1665,8 @@ public:
{
DBUG_ASSERT(item->is_fixed());
// Detect a proper timestamp type based on the argument values
- Temporal_hybrid l_time1(thd, item->arguments()[0], TIME_TIME_ONLY);
+ Temporal_hybrid l_time1(thd, item->arguments()[0],
+ Temporal::Options(TIME_TIME_ONLY, thd));
if (!l_time1.is_valid_temporal())
return (item->null_value= true);
Interval_DDhhmmssff l_time2(thd, item->arguments()[1]);
diff --git a/sql/item_vers.cc b/sql/item_vers.cc
index 6946ae0e1e5..c4bb734096f 100644
--- a/sql/item_vers.cc
+++ b/sql/item_vers.cc
@@ -142,7 +142,9 @@ Item_func_trt_id::val_int()
else
{
MYSQL_TIME commit_ts;
- if (args[0]->get_date(current_thd, &commit_ts, date_mode_t(0)))
+ THD *thd= current_thd;
+ Datetime::Options opt(TIME_CONV_NONE, thd);
+ if (args[0]->get_date(thd, &commit_ts, opt))
{
null_value= true;
return 0;
diff --git a/sql/lex.h b/sql/lex.h
index d336c273a18..5ffe07fa415 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -82,15 +82,15 @@ static SYMBOL symbols[] = {
{ "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH)},
{ "BACKUP", SYM(BACKUP_SYM)},
{ "BEFORE", SYM(BEFORE_SYM)},
- { "BEGIN", SYM(BEGIN_SYM)},
+ { "BEGIN", SYM(BEGIN_MARIADB_SYM)},
{ "BETWEEN", SYM(BETWEEN_SYM)},
{ "BIGINT", SYM(BIGINT)},
{ "BINARY", SYM(BINARY)},
{ "BINLOG", SYM(BINLOG_SYM)},
{ "BIT", SYM(BIT_SYM)},
- { "BLOB", SYM(BLOB_SYM)},
+ { "BLOB", SYM(BLOB_MARIADB_SYM)},
{ "BLOCK", SYM(BLOCK_SYM)},
- { "BODY", SYM(BODY_SYM)},
+ { "BODY", SYM(BODY_MARIADB_SYM)},
{ "BOOL", SYM(BOOL_SYM)},
{ "BOOLEAN", SYM(BOOLEAN_SYM)},
{ "BOTH", SYM(BOTH)},
@@ -115,7 +115,7 @@ static SYMBOL symbols[] = {
{ "CIPHER", SYM(CIPHER_SYM)},
{ "CLASS_ORIGIN", SYM(CLASS_ORIGIN_SYM)},
{ "CLIENT", SYM(CLIENT_SYM)},
- { "CLOB", SYM(CLOB)},
+ { "CLOB", SYM(CLOB_MARIADB_SYM)},
{ "CLOSE", SYM(CLOSE_SYM)},
{ "COALESCE", SYM(COALESCE)},
{ "CODE", SYM(CODE_SYM)},
@@ -145,7 +145,7 @@ static SYMBOL symbols[] = {
{ "CONSTRAINT_SCHEMA", SYM(CONSTRAINT_SCHEMA_SYM)},
{ "CONTAINS", SYM(CONTAINS_SYM)},
{ "CONTEXT", SYM(CONTEXT_SYM)},
- { "CONTINUE", SYM(CONTINUE_SYM)},
+ { "CONTINUE", SYM(CONTINUE_MARIADB_SYM)},
{ "CONTRIBUTORS", SYM(CONTRIBUTORS_SYM)},
{ "CONVERT", SYM(CONVERT_SYM)},
{ "CPU", SYM(CPU_SYM)},
@@ -176,7 +176,7 @@ static SYMBOL symbols[] = {
{ "DEALLOCATE", SYM(DEALLOCATE_SYM)},
{ "DEC", SYM(DECIMAL_SYM)},
{ "DECIMAL", SYM(DECIMAL_SYM)},
- { "DECLARE", SYM(DECLARE_SYM)},
+ { "DECLARE", SYM(DECLARE_MARIADB_SYM)},
{ "DEFAULT", SYM(DEFAULT)},
{ "DEFINER", SYM(DEFINER_SYM)},
{ "DELAYED", SYM(DELAYED_SYM)},
@@ -205,8 +205,8 @@ static SYMBOL symbols[] = {
{ "DYNAMIC", SYM(DYNAMIC_SYM)},
{ "EACH", SYM(EACH_SYM)},
{ "ELSE", SYM(ELSE)},
- { "ELSEIF", SYM(ELSEIF_SYM)},
- { "ELSIF", SYM(ELSIF_SYM)},
+ { "ELSEIF", SYM(ELSEIF_MARIADB_SYM)},
+ { "ELSIF", SYM(ELSIF_MARIADB_SYM)},
{ "ENABLE", SYM(ENABLE_SYM)},
{ "ENCLOSED", SYM(ENCLOSED)},
{ "END", SYM(END)},
@@ -226,9 +226,9 @@ static SYMBOL symbols[] = {
{ "EXCHANGE", SYM(EXCHANGE_SYM)},
{ "EXCLUDE", SYM(EXCLUDE_SYM)},
{ "EXECUTE", SYM(EXECUTE_SYM)},
- { "EXCEPTION", SYM(EXCEPTION_SYM)},
+ { "EXCEPTION", SYM(EXCEPTION_MARIADB_SYM)},
{ "EXISTS", SYM(EXISTS)},
- { "EXIT", SYM(EXIT_SYM)},
+ { "EXIT", SYM(EXIT_MARIADB_SYM)},
{ "EXPANSION", SYM(EXPANSION_SYM)},
{ "EXPORT", SYM(EXPORT_SYM)},
{ "EXPLAIN", SYM(DESCRIBE)},
@@ -264,7 +264,7 @@ static SYMBOL symbols[] = {
{ "GET_FORMAT", SYM(GET_FORMAT)},
{ "GET", SYM(GET_SYM)},
{ "GLOBAL", SYM(GLOBAL_SYM)},
- { "GOTO", SYM(GOTO_SYM)},
+ { "GOTO", SYM(GOTO_MARIADB_SYM)},
{ "GRANT", SYM(GRANT)},
{ "GRANTS", SYM(GRANTS)},
{ "GROUP", SYM(GROUP_SYM)},
@@ -434,7 +434,7 @@ static SYMBOL symbols[] = {
{ "NOTFOUND", SYM(NOTFOUND_SYM)},
{ "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG)},
{ "NULL", SYM(NULL_SYM)},
- { "NUMBER", SYM(NUMBER_SYM)},
+ { "NUMBER", SYM(NUMBER_MARIADB_SYM)},
{ "NUMERIC", SYM(NUMERIC_SYM)},
{ "NVARCHAR", SYM(NVARCHAR_SYM)},
{ "OF", SYM(OF_SYM)},
@@ -451,13 +451,13 @@ static SYMBOL symbols[] = {
{ "OPTIONALLY", SYM(OPTIONALLY)},
{ "OR", SYM(OR_SYM)},
{ "ORDER", SYM(ORDER_SYM)},
- { "OTHERS", SYM(OTHERS_SYM)},
+ { "OTHERS", SYM(OTHERS_MARIADB_SYM)},
{ "OUT", SYM(OUT_SYM)},
{ "OUTER", SYM(OUTER)},
{ "OUTFILE", SYM(OUTFILE)},
{ "OVER", SYM(OVER_SYM)},
{ "OWNER", SYM(OWNER_SYM)},
- { "PACKAGE", SYM(PACKAGE_SYM)},
+ { "PACKAGE", SYM(PACKAGE_MARIADB_SYM)},
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
{ "PAGE", SYM(PAGE_SYM)},
{ "PAGE_CHECKSUM", SYM(PAGE_CHECKSUM_SYM)},
@@ -495,9 +495,9 @@ static SYMBOL symbols[] = {
{ "QUARTER", SYM(QUARTER_SYM)},
{ "QUERY", SYM(QUERY_SYM)},
{ "QUICK", SYM(QUICK)},
- { "RAISE", SYM(RAISE_SYM)},
+ { "RAISE", SYM(RAISE_MARIADB_SYM)},
{ "RANGE", SYM(RANGE_SYM)},
- { "RAW", SYM(RAW)},
+ { "RAW", SYM(RAW_MARIADB_SYM)},
{ "READ", SYM(READ_SYM)},
{ "READ_ONLY", SYM(READ_ONLY_SYM)},
{ "READ_WRITE", SYM(READ_WRITE_SYM)},
@@ -534,7 +534,7 @@ static SYMBOL symbols[] = {
{ "RESTRICT", SYM(RESTRICT)},
{ "RESUME", SYM(RESUME_SYM)},
{ "RETURNED_SQLSTATE",SYM(RETURNED_SQLSTATE_SYM)},
- { "RETURN", SYM(RETURN_SYM)},
+ { "RETURN", SYM(RETURN_MARIADB_SYM)},
{ "RETURNING", SYM(RETURNING_SYM)},
{ "RETURNS", SYM(RETURNS_SYM)},
{ "REUSE", SYM(REUSE_SYM)},
@@ -549,7 +549,7 @@ static SYMBOL symbols[] = {
{ "ROW", SYM(ROW_SYM)},
{ "ROWCOUNT", SYM(ROWCOUNT_SYM)}, /* Oracle-N */
{ "ROWS", SYM(ROWS_SYM)},
- { "ROWTYPE", SYM(ROWTYPE_SYM)},
+ { "ROWTYPE", SYM(ROWTYPE_MARIADB_SYM)},
{ "ROW_COUNT", SYM(ROW_COUNT_SYM)},
{ "ROW_FORMAT", SYM(ROW_FORMAT_SYM)},
{ "RTREE", SYM(RTREE_SYM)},
@@ -589,6 +589,7 @@ static SYMBOL symbols[] = {
{ "SONAME", SYM(SONAME_SYM)},
{ "SOUNDS", SYM(SOUNDS_SYM)},
{ "SOURCE", SYM(SOURCE_SYM)},
+ { "STAGE", SYM(STAGE_SYM)},
{ "STORED", SYM(STORED_SYM)},
{ "SPATIAL", SYM(SPATIAL_SYM)},
{ "SPECIFIC", SYM(SPECIFIC_SYM)},
@@ -694,7 +695,7 @@ static SYMBOL symbols[] = {
{ "VARBINARY", SYM(VARBINARY)},
{ "VARCHAR", SYM(VARCHAR)},
{ "VARCHARACTER", SYM(VARCHAR)},
- { "VARCHAR2", SYM(VARCHAR2)},
+ { "VARCHAR2", SYM(VARCHAR2_MARIADB_SYM)},
{ "VARIABLES", SYM(VARIABLES)},
{ "VARYING", SYM(VARYING)},
{ "VIA", SYM(VIA_SYM)},
@@ -739,7 +740,7 @@ static SYMBOL sql_functions[] = {
{ "DATE_ADD", SYM(DATE_ADD_INTERVAL)},
{ "DATE_SUB", SYM(DATE_SUB_INTERVAL)},
{ "DATE_FORMAT", SYM(DATE_FORMAT_SYM)},
- { "DECODE", SYM(DECODE_SYM)},
+ { "DECODE", SYM(DECODE_MARIADB_SYM)},
{ "DENSE_RANK", SYM(DENSE_RANK_SYM)},
{ "EXTRACT", SYM(EXTRACT_SYM)},
{ "FIRST_VALUE", SYM(FIRST_VALUE_SYM)},
diff --git a/sql/lock.cc b/sql/lock.cc
index 5420e9f42b5..c1140eddaae 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -77,6 +77,7 @@
#include "sql_base.h" // close_tables_for_reopen
#include "sql_parse.h" // is_log_table_write_query
#include "sql_acl.h" // SUPER_ACL
+#include "sql_handler.h"
#include <hash.h>
#include "wsrep_mysqld.h"
@@ -860,10 +861,9 @@ bool lock_schema_name(THD *thd, const char *db)
return TRUE;
}
- if (thd->global_read_lock.can_acquire_protection())
+ if (thd->has_read_only_protection())
return TRUE;
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
- MDL_STATEMENT);
+ global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT);
mdl_request.init(MDL_key::SCHEMA, db, "", MDL_EXCLUSIVE, MDL_TRANSACTION);
mdl_requests.push_front(&mdl_request);
@@ -919,10 +919,9 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
DBUG_ASSERT(name);
DEBUG_SYNC(thd, "before_wait_locked_pname");
- if (thd->global_read_lock.can_acquire_protection())
+ if (thd->has_read_only_protection())
return TRUE;
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
- MDL_STATEMENT);
+ global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT);
schema_request.init(MDL_key::SCHEMA, db, "", MDL_INTENTION_EXCLUSIVE,
MDL_TRANSACTION);
mdl_request.init(mdl_type, db, name, MDL_EXCLUSIVE, MDL_TRANSACTION);
@@ -953,10 +952,10 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
semi-automatic. We assume that any statement which should be blocked
by global read lock will either open and acquires write-lock on tables
or acquires metadata locks on objects it is going to modify. For any
- such statement global IX metadata lock is automatically acquired for
- its duration (in case of LOCK TABLES until end of LOCK TABLES mode).
- And lock_global_read_lock() simply acquires global S metadata lock
- and thus prohibits execution of statements which modify data (unless
+ such statement MDL_BACKUP_STMT metadata lock is automatically acquired
+ for its duration (in case of LOCK TABLES until end of LOCK TABLES mode).
+ And lock_global_read_lock() simply acquires MDL_BACKUP_FTWRL1 metadata
+ lock and thus prohibits execution of statements which modify data (unless
they modify only temporary tables). If deadlock happens it is detected
by MDL subsystem and resolved in the standard fashion (by backing-off
metadata locks acquired so far and restarting open tables process
@@ -997,11 +996,23 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
/**
Take global read lock, wait if there is protection against lock.
- If the global read lock is already taken by this thread, then nothing is done.
+ If the global read lock is already taken by this thread, then nothing is
+ done.
+
+ Concurrent thread can acquire protection against global read lock either
+ before or after it got table metadata lock. This may lead to a deadlock if
+ there is pending global read lock request. E.g.
+ t1 does DML, holds SHARED table lock, waiting for t3 (GRL protection)
+ t2 does DDL, holds GRL protection, waiting for t1 (EXCLUSIVE)
+ t3 does FTWRL, has pending GRL, waiting for t2 (GRL)
+
+ Since this is very seldom deadlock and FTWRL connection must not hold any
+ other locks, FTWRL connection is made deadlock victim and attempt to acquire
+ GRL retried.
See also "Handling of global read locks" above.
- @param thd Reference to thread.
+ @param thd Reference to thread.
@retval False Success, global read lock set, commits are NOT blocked.
@retval True Failure, thread was killed.
@@ -1013,17 +1024,38 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
if (!m_state)
{
+ MDL_deadlock_and_lock_abort_error_handler mdl_deadlock_handler;
MDL_request mdl_request;
+ bool result;
- DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
- MDL_SHARED));
- mdl_request.init(MDL_key::GLOBAL, "", "", MDL_SHARED, MDL_EXPLICIT);
-
- if (thd->mdl_context.acquire_lock(&mdl_request,
- thd->variables.lock_wait_timeout))
+ if (thd->current_backup_stage != BACKUP_FINISHED)
+ {
+ my_error(ER_BACKUP_LOCK_IS_ACTIVE, MYF(0));
DBUG_RETURN(1);
+ }
+
+ mysql_ha_cleanup_no_free(thd);
+
+ DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
+ MDL_BACKUP_FTWRL1));
+ DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
+ MDL_BACKUP_FTWRL2));
+ mdl_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_FTWRL1,
+ MDL_EXPLICIT);
+
+ do
+ {
+ mdl_deadlock_handler.init();
+ thd->push_internal_handler(&mdl_deadlock_handler);
+ result= thd->mdl_context.acquire_lock(&mdl_request,
+ thd->variables.lock_wait_timeout);
+ thd->pop_internal_handler();
+ } while (mdl_deadlock_handler.need_reopen());
+
+ if (result)
+ DBUG_RETURN(true);
- m_mdl_global_shared_lock= mdl_request.ticket;
+ m_mdl_global_read_lock= mdl_request.ticket;
m_state= GRL_ACQUIRED;
}
/*
@@ -1052,7 +1084,7 @@ void Global_read_lock::unlock_global_read_lock(THD *thd)
{
DBUG_ENTER("unlock_global_read_lock");
- DBUG_ASSERT(m_mdl_global_shared_lock && m_state);
+ DBUG_ASSERT(m_mdl_global_read_lock && m_state);
if (thd->global_disable_checkpoint)
{
@@ -1063,31 +1095,26 @@ void Global_read_lock::unlock_global_read_lock(THD *thd)
}
}
- if (m_mdl_blocks_commits_lock)
- {
- thd->mdl_context.release_lock(m_mdl_blocks_commits_lock);
- m_mdl_blocks_commits_lock= NULL;
+ thd->mdl_context.release_lock(m_mdl_global_read_lock);
+
#ifdef WITH_WSREP
- if (WSREP(thd) || wsrep_node_is_donor())
+ if (m_state == GRL_ACQUIRED_AND_BLOCKS_COMMIT)
+ {
+ Wsrep_server_state& server_state= Wsrep_server_state::instance();
+ if (server_state.state() == Wsrep_server_state::s_donor)
{
+ /* TODO: maybe redundant here?: */
wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED;
- wsrep->resume(wsrep);
- /* resync here only if we did implicit desync earlier */
- if (!wsrep_desync && wsrep_node_is_synced())
- {
- int ret = wsrep->resync(wsrep);
- if (ret != WSREP_OK)
- {
- WSREP_WARN("resync failed %d for FTWRL: db: %s, query: %s",
- ret, thd->get_db(), thd->query());
- DBUG_VOID_RETURN;
- }
- }
+ server_state.resume();
+ }
+ else if (WSREP(thd))
+ {
+ server_state.resume_and_resync();
}
-#endif /* WITH_WSREP */
}
- thd->mdl_context.release_lock(m_mdl_global_shared_lock);
- m_mdl_global_shared_lock= NULL;
+#endif /* WITH_WSREP */
+
+ m_mdl_global_read_lock= NULL;
m_state= GRL_NONE;
DBUG_VOID_RETURN;
@@ -1111,7 +1138,6 @@ void Global_read_lock::unlock_global_read_lock(THD *thd)
bool Global_read_lock::make_global_read_lock_block_commit(THD *thd)
{
- MDL_request mdl_request;
DBUG_ENTER("make_global_read_lock_block_commit");
/*
If we didn't succeed lock_global_read_lock(), or if we already suceeded
@@ -1121,77 +1147,38 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd)
if (m_state != GRL_ACQUIRED)
DBUG_RETURN(0);
-#ifdef WITH_WSREP
- if (WSREP(thd) && m_mdl_blocks_commits_lock)
- {
- WSREP_DEBUG("GRL was in block commit mode when entering "
- "make_global_read_lock_block_commit");
- DBUG_RETURN(FALSE);
- }
-#endif /* WITH_WSREP */
-
- mdl_request.init(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT);
-
- if (thd->mdl_context.acquire_lock(&mdl_request,
- thd->variables.lock_wait_timeout))
+ if (thd->mdl_context.upgrade_shared_lock(m_mdl_global_read_lock,
+ MDL_BACKUP_FTWRL2,
+ thd->variables.lock_wait_timeout))
DBUG_RETURN(TRUE);
- m_mdl_blocks_commits_lock= mdl_request.ticket;
m_state= GRL_ACQUIRED_AND_BLOCKS_COMMIT;
#ifdef WITH_WSREP
+
/* Native threads should bail out before wsrep oprations to follow.
- Donor servicing thread is an exception, it should pause provider but not desync,
- as it is already desynced in donor state
+ Donor servicing thread is an exception, it should pause provider
+ but not desync, as it is already desynced in donor state
*/
- if (!WSREP(thd) && !wsrep_node_is_donor())
+ Wsrep_server_state& server_state= Wsrep_server_state::instance();
+ if (!WSREP(thd) && server_state.state() != Wsrep_server_state::s_donor)
{
DBUG_RETURN(FALSE);
}
- /* if already desynced or donor, avoid double desyncing
- if not in PC and synced, desyncing is not possible either
- */
- if (wsrep_desync || !wsrep_node_is_synced())
+ wsrep::seqno paused_seqno;
+ if (server_state.state() == Wsrep_server_state::s_donor)
{
- WSREP_DEBUG("desync set upfont, skipping implicit desync for FTWRL: %d",
- wsrep_desync);
+ paused_seqno= server_state.pause();
}
else
{
- int rcode;
- WSREP_DEBUG("running implicit desync for node");
- rcode = wsrep->desync(wsrep);
- if (rcode != WSREP_OK)
- {
- WSREP_WARN("FTWRL desync failed %d for schema: %s, query: %s",
- rcode, thd->get_db(), thd->query());
- my_message(ER_LOCK_DEADLOCK, "wsrep desync failed for FTWRL", MYF(0));
- DBUG_RETURN(TRUE);
- }
- }
-
- long long ret = wsrep->pause(wsrep);
- if (ret >= 0)
- {
- wsrep_locked_seqno= ret;
+ paused_seqno= server_state.desync_and_pause();
}
- else if (ret != -ENOSYS) /* -ENOSYS - no provider */
+ WSREP_INFO("Server paused at: %lld", paused_seqno.get());
+ if (paused_seqno.get() >= 0)
{
- long long ret = wsrep->pause(wsrep);
- if (ret >= 0)
- {
- wsrep_locked_seqno= ret;
- }
- else if (ret != -ENOSYS) /* -ENOSYS - no provider */
- {
- WSREP_ERROR("Failed to pause provider: %lld (%s)", -ret, strerror(-ret));
-
- DBUG_ASSERT(m_mdl_blocks_commits_lock == NULL);
- wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED;
- my_error(ER_LOCK_DEADLOCK, MYF(0));
- DBUG_RETURN(TRUE);
- }
+ wsrep_locked_seqno= paused_seqno.get();
}
#endif /* WITH_WSREP */
DBUG_RETURN(FALSE);
@@ -1206,10 +1193,8 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd)
void Global_read_lock::set_explicit_lock_duration(THD *thd)
{
- if (m_mdl_global_shared_lock)
- thd->mdl_context.set_lock_duration(m_mdl_global_shared_lock, MDL_EXPLICIT);
- if (m_mdl_blocks_commits_lock)
- thd->mdl_context.set_lock_duration(m_mdl_blocks_commits_lock, MDL_EXPLICIT);
+ if (m_mdl_global_read_lock)
+ thd->mdl_context.set_lock_duration(m_mdl_global_read_lock, MDL_EXPLICIT);
}
/**
diff --git a/sql/log.cc b/sql/log.cc
index a56117a4ac1..a4a2b4b1e37 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -55,10 +55,14 @@
#include "sql_show.h"
#include "my_pthread.h"
#include "semisync_master.h"
-#include "wsrep_mysqld.h"
#include "sp_rcontext.h"
#include "sp_head.h"
+#include "wsrep_mysqld.h"
+#ifdef WITH_WSREP
+#include "wsrep_trans_observer.h"
+#endif /* WITH_WSREP */
+
/* max size of the log message */
#define MAX_LOG_BUFFER_SIZE 1024
#define MAX_TIME_SIZE 32
@@ -1703,7 +1707,7 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
#ifdef WITH_WSREP
if (cache_mngr && !cache_mngr->trx_cache.empty()) {
- IO_CACHE* cache= get_trans_log(thd);
+ IO_CACHE* cache= cache_mngr->get_binlog_cache_log(true);
uchar *buf;
size_t len=0;
wsrep_write_cache_buf(cache, &buf, &len);
@@ -2297,8 +2301,17 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
non-transactional table. Otherwise, truncate the binlog cache starting
from the SAVEPOINT command.
*/
+#ifdef WITH_WSREP
+ /* for streaming replication, we must replicate savepoint rollback so that
+ slaves can maintain SR transactions
+ */
+ if (unlikely(thd->wsrep_trx().is_streaming() ||
+ (trans_has_updated_non_trans_table(thd)) ||
+ (thd->variables.option_bits & OPTION_KEEP_LOG)))
+#else
if (unlikely(trans_has_updated_non_trans_table(thd) ||
(thd->variables.option_bits & OPTION_KEEP_LOG)))
+#endif /* WITH_WSREP */
{
char buf[1024];
String log_query(buf, sizeof(buf), &my_charset_bin);
@@ -5970,7 +5983,9 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
DBUG_PRINT("enter", ("standalone: %d", standalone));
#ifdef WITH_WSREP
- if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1 && wsrep_gtid_mode && !thd->variables.gtid_seq_no)
+ if (WSREP(thd) &&
+ (wsrep_thd_trx_seqno(thd) > 0) &&
+ wsrep_gtid_mode && !thd->variables.gtid_seq_no)
{
domain_id= wsrep_gtid_domain_id;
} else {
@@ -6073,7 +6088,7 @@ MYSQL_BIN_LOG::write_state_to_file()
goto end;
err:
- sql_print_error("Error writing binlog state to file '%s'.\n", buf);
+ sql_print_error("Error writing binlog state to file '%s'.", buf);
if (log_inited)
end_io_cache(&cache);
end:
@@ -6133,7 +6148,7 @@ MYSQL_BIN_LOG::read_state_from_file()
goto end;
err:
- sql_print_error("Error reading binlog GTID state from file '%s'.\n", buf);
+ sql_print_error("Error reading binlog GTID state from file '%s'.", buf);
end:
if (log_inited)
end_io_cache(&cache);
@@ -6287,7 +6302,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
*/
/* applier and replayer can skip writing binlog events */
if ((WSREP_EMULATE_BINLOG(thd) &&
- IF_WSREP(thd->wsrep_exec_mode != REPL_RECV, 0)) || is_open())
+ IF_WSREP(thd->wsrep_cs().mode() == wsrep::client_state::m_local, 0)) || is_open())
{
my_off_t UNINIT_VAR(my_org_b_tell);
#ifdef HAVE_REPLICATION
@@ -7257,7 +7272,7 @@ MYSQL_BIN_LOG::write_binlog_checkpoint_event_already_locked(const char *name_arg
ability to do crash recovery - crash recovery will just have to scan a
bit more of the binlog than strictly necessary.
*/
- sql_print_error("Failed to write binlog checkpoint event to binary log\n");
+ sql_print_error("Failed to write binlog checkpoint event to binary log");
}
offset= my_b_tell(&log_file);
@@ -7670,7 +7685,11 @@ bool
MYSQL_BIN_LOG::write_transaction_to_binlog_events(group_commit_entry *entry)
{
int is_leader= queue_for_group_commit(entry);
-
+#ifdef WITH_WSREP
+ if (is_leader >= 0 &&
+ wsrep_ordered_commit(entry->thd, entry->all, wsrep_apply_error()))
+ return true;
+#endif /* WITH_WSREP */
/*
The first in the queue handles group commit for all; the others just wait
to be signalled when group commit is done.
@@ -10467,7 +10486,7 @@ set_binlog_snapshot_file(const char *src)
Copy out current values of status variables, for SHOW STATUS or
information_schema.global_status.
- This is called only under LOCK_show_status, so we can fill in a static array.
+ This is called only under LOCK_all_status_vars, so we can fill in a static array.
*/
void
TC_LOG_BINLOG::set_status_variables(THD *thd)
@@ -10592,7 +10611,10 @@ maria_declare_plugin(binlog)
maria_declare_plugin_end;
#ifdef WITH_WSREP
-IO_CACHE * get_trans_log(THD * thd)
+#include "wsrep_trans_observer.h"
+#include "wsrep_mysqld.h"
+
+IO_CACHE *wsrep_get_trans_cache(THD * thd)
{
DBUG_ASSERT(binlog_hton->slot != HA_SLOT_UNDEF);
binlog_cache_mngr *cache_mngr = (binlog_cache_mngr*)
@@ -10605,17 +10627,10 @@ IO_CACHE * get_trans_log(THD * thd)
return NULL;
}
-
-bool wsrep_trans_cache_is_empty(THD *thd)
-{
- binlog_cache_mngr *const cache_mngr=
- (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
- return (!cache_mngr || cache_mngr->trx_cache.empty());
-}
-
-
-void thd_binlog_trx_reset(THD * thd)
+void wsrep_thd_binlog_trx_reset(THD * thd)
{
+ DBUG_ENTER("wsrep_thd_binlog_trx_reset");
+ WSREP_DEBUG("wsrep_thd_binlog_reset");
/*
todo: fix autocommit select to not call the caller
*/
@@ -10634,6 +10649,7 @@ void thd_binlog_trx_reset(THD * thd)
}
}
thd->clear_binlog_table_maps();
+ DBUG_VOID_RETURN;
}
@@ -10646,4 +10662,78 @@ void thd_binlog_rollback_stmt(THD * thd)
if (cache_mngr)
cache_mngr->trx_cache.set_prev_position(MY_OFF_T_UNDEF);
}
+
+bool wsrep_stmt_rollback_is_safe(THD* thd)
+{
+ bool ret(true);
+
+ DBUG_ENTER("wsrep_binlog_stmt_rollback_is_safe");
+
+ binlog_cache_mngr *cache_mngr=
+ (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
+
+
+ if (binlog_hton && cache_mngr)
+ {
+ binlog_cache_data * trx_cache = &cache_mngr->trx_cache;
+ if (thd->wsrep_sr().fragments_certified() > 0 &&
+ (trx_cache->get_prev_position() == MY_OFF_T_UNDEF ||
+ trx_cache->get_prev_position() < thd->wsrep_sr().bytes_certified()))
+ {
+ WSREP_DEBUG("statement rollback is not safe for streaming replication"
+ " pre-stmt_pos: %llu, frag repl pos: %lu\n"
+ "Thread: %llu, SQL: %s",
+ trx_cache->get_prev_position(),
+ thd->wsrep_sr().bytes_certified(),
+ thd->thread_id, thd->query());
+ ret = false;
+ }
+ }
+ DBUG_RETURN(ret);
+}
+
+void wsrep_register_binlog_handler(THD *thd, bool trx)
+{
+ DBUG_ENTER("register_binlog_handler");
+ /*
+ If this is the first call to this function while processing a statement,
+ the transactional cache does not have a savepoint defined. So, in what
+ follows:
+ . an implicit savepoint is defined;
+ . callbacks are registered;
+ . binary log is set as read/write.
+
+ The savepoint allows for truncating the trx-cache transactional changes
+ fail. Callbacks are necessary to flush caches upon committing or rolling
+ back a statement or a transaction. However, notifications do not happen
+ if the binary log is set as read/write.
+ */
+ //binlog_cache_mngr *cache_mngr= thd_get_cache_mngr(thd);
+ binlog_cache_mngr *cache_mngr=
+ (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
+ /* cache_mngr may be missing e.g. in mtr test ev51914.test */
+ if (cache_mngr && cache_mngr->trx_cache.get_prev_position() == MY_OFF_T_UNDEF)
+ {
+ /*
+ Set an implicit savepoint in order to be able to truncate a trx-cache.
+ */
+ my_off_t pos= 0;
+ binlog_trans_log_savepos(thd, &pos);
+ cache_mngr->trx_cache.set_prev_position(pos);
+
+ /*
+ Set callbacks in order to be able to call commmit or rollback.
+ */
+ if (trx)
+ trans_register_ha(thd, TRUE, binlog_hton);
+ trans_register_ha(thd, FALSE, binlog_hton);
+
+ /*
+ Set the binary log as read/write otherwise callbacks are not called.
+ */
+ thd->ha_data[binlog_hton->slot].ha_info[0].set_trx_read_write();
+ }
+ DBUG_VOID_RETURN;
+}
+
#endif /* WITH_WSREP */
diff --git a/sql/log.h b/sql/log.h
index 7dfdb36c442..2d4cc7a74a1 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -18,7 +18,6 @@
#define LOG_H
#include "handler.h" /* my_xid */
-#include "wsrep.h"
#include "wsrep_mysqld.h"
#include "rpl_constants.h"
@@ -248,10 +247,6 @@ extern TC_LOG_DUMMY tc_log_dummy;
class Relay_log_info;
-#ifdef HAVE_PSI_INTERFACE
-extern PSI_mutex_key key_LOG_INFO_lock;
-#endif
-
/*
Note that we destroy the lock mutex in the desctructor here.
This means that object instances cannot be destroyed/go out of scope,
@@ -263,19 +258,11 @@ typedef struct st_log_info
my_off_t index_file_offset, index_file_start_offset;
my_off_t pos;
bool fatal; // if the purge happens to give us a negative offset
- mysql_mutex_t lock;
st_log_info() : index_file_offset(0), index_file_start_offset(0),
pos(0), fatal(0)
{
DBUG_ENTER("LOG_INFO");
log_file_name[0] = '\0';
- mysql_mutex_init(key_LOG_INFO_lock, &lock, MY_MUTEX_INIT_FAST);
- DBUG_VOID_RETURN;
- }
- ~st_log_info()
- {
- DBUG_ENTER("~LOG_INFO");
- mysql_mutex_destroy(&lock);
DBUG_VOID_RETURN;
}
} LOG_INFO;
@@ -1212,6 +1199,10 @@ static inline TC_LOG *get_tc_log_implementation()
return &tc_log_mmap;
}
+#ifdef WITH_WSREP
+IO_CACHE* wsrep_get_trans_cache(THD *);
+void wsrep_thd_binlog_trx_reset(THD * thd);
+#endif /* WITH_WSREP */
class Gtid_list_log_event;
const char *
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 651fb4ce5b1..bbadda3167e 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2009, 2018, MariaDB
+ Copyright (c) 2009, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -53,7 +53,6 @@
#include "rpl_constants.h"
#include "sql_digest.h"
#include "zlib.h"
-#include "my_atomic.h"
#define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1))
@@ -101,16 +100,11 @@ TYPELIB binlog_checksum_typelib=
TODO: correct the constant when it has been determined
(which main tree to push and when)
*/
-const uchar checksum_version_split_mysql[3]= {5, 6, 1};
-const ulong checksum_version_product_mysql=
- (checksum_version_split_mysql[0] * 256 +
- checksum_version_split_mysql[1]) * 256 +
- checksum_version_split_mysql[2];
-const uchar checksum_version_split_mariadb[3]= {5, 3, 0};
-const ulong checksum_version_product_mariadb=
- (checksum_version_split_mariadb[0] * 256 +
- checksum_version_split_mariadb[1]) * 256 +
- checksum_version_split_mariadb[2];
+const Version checksum_version_split_mysql(5, 6, 1);
+const Version checksum_version_split_mariadb(5, 3, 0);
+
+// First MySQL version with fraction seconds
+const Version fsp_version_split_mysql(5, 6, 0);
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD* thd);
@@ -4541,6 +4535,7 @@ code_name(int code)
}
#endif
+
/**
Macro to check that there is enough space to read from memory.
@@ -4764,6 +4759,30 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
}
}
+#if !defined(MYSQL_CLIENT)
+ if (description_event->server_version_split.kind ==
+ Format_description_log_event::master_version_split::KIND_MYSQL)
+ {
+ // Handle MariaDB/MySQL incompatible sql_mode bits
+ sql_mode_t mysql_sql_mode= sql_mode;
+ sql_mode&= MODE_MASK_MYSQL_COMPATIBLE; // Unset MySQL specific bits
+
+ /*
+ sql_mode flags related to fraction second rounding/truncation
+ have opposite meaning in MySQL vs MariaDB.
+ MySQL:
+ - rounds fractional seconds by default
+ - truncates if TIME_TRUNCATE_FRACTIONAL is set
+ MariaDB:
+ - truncates fractional seconds by default
+ - rounds if TIME_ROUND_FRACTIONAL is set
+ */
+ if (description_event->server_version_split >= fsp_version_split_mysql &&
+ !(mysql_sql_mode & MODE_MYSQL80_TIME_TRUNCATE_FRACTIONAL))
+ sql_mode|= MODE_TIME_ROUND_FRACTIONAL;
+ }
+#endif
+
/**
Layout for the data buffer is as follows
+--------+-----------+------+------+---------+----+-------+
@@ -5581,7 +5600,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
gtid= rgi->current_gtid;
if (unlikely(rpl_global_gtid_slave_state->record_gtid(thd, &gtid,
sub_id,
- rgi, false,
+ true, false,
&hton)))
{
int errcode= thd->get_stmt_da()->sql_errno();
@@ -5761,6 +5780,14 @@ compare_errors:
"unexpected success or fatal error"),
thd->get_db(), query_arg);
thd->is_slave_error= 1;
+#ifdef WITH_WSREP
+ if (thd->wsrep_apply_toi && wsrep_must_ignore_error(thd))
+ {
+ thd->clear_error(1);
+ thd->killed= NOT_KILLED;
+ thd->wsrep_has_ignored_error= true;
+ }
+#endif /* WITH_WSREP */
}
/*
@@ -6549,26 +6576,24 @@ bool Format_description_log_event::start_decryption(Start_encryption_log_event*
return crypto_data.init(sele->crypto_scheme, sele->key_version);
}
-static inline void
-do_server_version_split(char* version,
- Format_description_log_event::master_version_split *split_versions)
+
+Version::Version(const char *version, const char **endptr)
{
- char *p= version, *r;
+ const char *p= version;
ulong number;
for (uint i= 0; i<=2; i++)
{
+ char *r;
number= strtoul(p, &r, 10);
/*
It is an invalid version if any version number greater than 255 or
first number is not followed by '.'.
*/
if (number < 256 && (*r == '.' || i != 0))
- split_versions->ver[i]= (uchar) number;
+ m_ver[i]= (uchar) number;
else
{
- split_versions->ver[0]= 0;
- split_versions->ver[1]= 0;
- split_versions->ver[2]= 0;
+ *this= Version();
break;
}
@@ -6576,12 +6601,19 @@ do_server_version_split(char* version,
if (*r == '.')
p++; // skip the dot
}
+ endptr[0]= p;
+}
+
+
+Format_description_log_event::
+ master_version_split::master_version_split(const char *version)
+{
+ const char *p;
+ static_cast<Version*>(this)[0]= Version(version, &p);
if (strstr(p, "MariaDB") != 0 || strstr(p, "-maria-") != 0)
- split_versions->kind=
- Format_description_log_event::master_version_split::KIND_MARIADB;
+ kind= KIND_MARIADB;
else
- split_versions->kind=
- Format_description_log_event::master_version_split::KIND_MYSQL;
+ kind= KIND_MYSQL;
}
@@ -6595,20 +6627,14 @@ do_server_version_split(char* version,
*/
void Format_description_log_event::calc_server_version_split()
{
- do_server_version_split(server_version, &server_version_split);
+ server_version_split= master_version_split(server_version);
DBUG_PRINT("info",("Format_description_log_event::server_version_split:"
" '%s' %d %d %d", server_version,
- server_version_split.ver[0],
- server_version_split.ver[1], server_version_split.ver[2]));
+ server_version_split[0],
+ server_version_split[1], server_version_split[2]));
}
-static inline ulong
-version_product(const Format_description_log_event::master_version_split* version_split)
-{
- return ((version_split->ver[0] * 256 + version_split->ver[1]) * 256
- + version_split->ver[2]);
-}
/**
@return TRUE is the event's version is earlier than one that introduced
@@ -6618,9 +6644,9 @@ bool
Format_description_log_event::is_version_before_checksum(const master_version_split
*version_split)
{
- return version_product(version_split) <
+ return *version_split <
(version_split->kind == master_version_split::KIND_MARIADB ?
- checksum_version_product_mariadb : checksum_version_product_mysql);
+ checksum_version_split_mariadb : checksum_version_split_mysql);
}
/**
@@ -6636,7 +6662,6 @@ enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len)
{
enum enum_binlog_checksum_alg ret;
char version[ST_SERVER_VER_LEN];
- Format_description_log_event::master_version_split version_split;
DBUG_ENTER("get_checksum_alg");
DBUG_ASSERT(buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT);
@@ -6646,7 +6671,7 @@ enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len)
ST_SERVER_VER_LEN);
version[ST_SERVER_VER_LEN - 1]= 0;
- do_server_version_split(version, &version_split);
+ Format_description_log_event::master_version_split version_split(version);
ret= Format_description_log_event::is_version_before_checksum(&version_split)
? BINLOG_CHECKSUM_ALG_UNDEF
: (enum_binlog_checksum_alg)buf[len - BINLOG_CHECKSUM_LEN - BINLOG_CHECKSUM_ALG_DESC_LEN];
@@ -8037,16 +8062,13 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi)
switch (flags2 & (FL_DDL | FL_TRANSACTIONAL))
{
case FL_TRANSACTIONAL:
- my_atomic_add64_explicit((volatile int64 *)&mi->total_trans_groups, 1,
- MY_MEMORY_ORDER_RELAXED);
+ mi->total_trans_groups++;
break;
case FL_DDL:
- my_atomic_add64_explicit((volatile int64 *)&mi->total_ddl_groups, 1,
- MY_MEMORY_ORDER_RELAXED);
+ mi->total_ddl_groups++;
break;
default:
- my_atomic_add64_explicit((volatile int64 *)&mi->total_non_trans_groups, 1,
- MY_MEMORY_ORDER_RELAXED);
+ mi->total_non_trans_groups++;
}
if (flags2 & FL_STANDALONE)
@@ -8378,7 +8400,7 @@ Gtid_list_log_event::do_apply_event(rpl_group_info *rgi)
{
if ((ret= rpl_global_gtid_slave_state->record_gtid(thd, &list[i],
sub_id_list[i],
- NULL, false, &hton)))
+ false, false, &hton)))
return ret;
rpl_global_gtid_slave_state->update_state_hash(sub_id_list[i], &list[i],
hton, NULL);
@@ -8915,7 +8937,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
rgi->gtid_pending= false;
gtid= rgi->current_gtid;
- err= rpl_global_gtid_slave_state->record_gtid(thd, &gtid, sub_id, rgi,
+ err= rpl_global_gtid_slave_state->record_gtid(thd, &gtid, sub_id, true,
false, &hton);
if (unlikely(err))
{
@@ -11273,13 +11295,13 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
{
WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d "
"wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)",
- thd->get_stmt_da()->sql_errno(),
- thd->is_fatal_error,
- thd->wsrep_exec_mode,
- thd->wsrep_conflict_state,
- (long long)wsrep_thd_trx_seqno(thd));
+ thd->get_stmt_da()->sql_errno(),
+ thd->is_fatal_error,
+ thd->wsrep_cs().mode(),
+ thd->wsrep_trx().state(),
+ (long long) wsrep_thd_trx_seqno(thd));
}
-#endif
+#endif /* WITH_WSREP */
if ((thd->is_slave_error || thd->is_fatal_error) &&
!is_parallel_retry_error(rgi, actual_error))
{
@@ -11416,10 +11438,10 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
#ifdef HAVE_QUERY_CACHE
#ifdef WITH_WSREP
/*
- Moved invalidation right before the call to rows_event_stmt_cleanup(),
- to avoid query cache being polluted with stale entries.
+ Moved invalidation right before the call to rows_event_stmt_cleanup(),
+ to avoid query cache being polluted with stale entries,
*/
- if (! (WSREP(thd) && (thd->wsrep_exec_mode == REPL_RECV)))
+ if (! (WSREP(thd) && wsrep_thd_is_applying(thd)))
{
#endif /* WITH_WSREP */
query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
@@ -11532,6 +11554,13 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
bool ignored_error= (idempotent_error == 0 ?
ignored_error_code(actual_error) : 0);
+#ifdef WITH_WSREP
+ if (WSREP(thd) && wsrep_ignored_error_code(this, actual_error))
+ {
+ idempotent_error= true;
+ thd->wsrep_has_ignored_error= true;
+ }
+#endif /* WITH_WSREP */
if (idempotent_error || ignored_error)
{
if (global_system_variables.log_warnings)
@@ -11619,7 +11648,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
restore_empty_query_table_list(thd->lex);
#if defined(WITH_WSREP) && defined(HAVE_QUERY_CACHE)
- if (WSREP(thd) && thd->wsrep_exec_mode == REPL_RECV)
+ if (WSREP(thd) && wsrep_thd_is_applying(thd))
{
query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
}
@@ -12630,7 +12659,7 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
table_list->updating= 1;
table_list->required_type= TABLE_TYPE_NORMAL;
- DBUG_PRINT("debug", ("table: %s is mapped to %u",
+ DBUG_PRINT("debug", ("table: %s is mapped to %lu",
table_list->table_name.str,
table_list->table_id));
table_list->master_had_triggers= ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? 1 : 0);
@@ -13441,9 +13470,8 @@ err:
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
uint8 Write_rows_log_event::get_trg_event_map()
{
- return (static_cast<uint8> (1 << static_cast<int>(TRG_EVENT_INSERT)) |
- static_cast<uint8> (1 << static_cast<int>(TRG_EVENT_UPDATE)) |
- static_cast<uint8> (1 << static_cast<int>(TRG_EVENT_DELETE)));
+ return trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_UPDATE) |
+ trg2bit(TRG_EVENT_DELETE);
}
#endif
@@ -14150,7 +14178,7 @@ err:
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
uint8 Delete_rows_log_event::get_trg_event_map()
{
- return static_cast<uint8> (1 << static_cast<int>(TRG_EVENT_DELETE));
+ return trg2bit(TRG_EVENT_DELETE);
}
#endif
@@ -14425,7 +14453,7 @@ err:
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
uint8 Update_rows_log_event::get_trg_event_map()
{
- return static_cast<uint8> (1 << static_cast<int>(TRG_EVENT_UPDATE));
+ return trg2bit(TRG_EVENT_UPDATE);
}
#endif
diff --git a/sql/log_event.h b/sql/log_event.h
index 84025554ee9..38a40c90799 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -2728,6 +2728,38 @@ protected:
};
+class Version
+{
+protected:
+ uchar m_ver[3];
+ int cmp(const Version &other) const
+ {
+ return memcmp(m_ver, other.m_ver, 3);
+ }
+public:
+ Version()
+ {
+ m_ver[0]= m_ver[1]= m_ver[2]= '\0';
+ }
+ Version(uchar v0, uchar v1, uchar v2)
+ {
+ m_ver[0]= v0;
+ m_ver[1]= v1;
+ m_ver[2]= v2;
+ }
+ Version(const char *version, const char **endptr);
+ const uchar& operator [] (size_t i) const
+ {
+ DBUG_ASSERT(i < 3);
+ return m_ver[i];
+ }
+ bool operator<(const Version &other) const { return cmp(other) < 0; }
+ bool operator>(const Version &other) const { return cmp(other) > 0; }
+ bool operator<=(const Version &other) const { return cmp(other) <= 0; }
+ bool operator>=(const Version &other) const { return cmp(other) >= 0; }
+};
+
+
/**
@class Format_description_log_event
@@ -2754,10 +2786,17 @@ public:
by the checksum alg decription byte
*/
uint8 *post_header_len;
- struct master_version_split {
+ class master_version_split: public Version {
+ public:
enum {KIND_MYSQL, KIND_MARIADB};
int kind;
- uchar ver[3];
+ master_version_split() :kind(KIND_MARIADB) { }
+ master_version_split(const char *version);
+ bool version_is_valid() const
+ {
+ /* It is invalid only when all version numbers are 0 */
+ return !(m_ver[0] == 0 && m_ver[1] == 0 && m_ver[2] == 0);
+ }
};
master_version_split server_version_split;
const uint8 *event_type_permutation;
@@ -2781,17 +2820,9 @@ public:
(post_header_len != NULL));
}
- bool version_is_valid() const
- {
- /* It is invalid only when all version numbers are 0 */
- return !(server_version_split.ver[0] == 0 &&
- server_version_split.ver[1] == 0 &&
- server_version_split.ver[2] == 0);
- }
-
bool is_valid() const
{
- return header_is_valid() && version_is_valid();
+ return header_is_valid() && server_version_split.version_is_valid();
}
int get_data_size()
diff --git a/sql/mdl.cc b/sql/mdl.cc
index f03fc89fcc1..ccd7a71e9f4 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -24,9 +24,6 @@
#include <mysql/plugin.h>
#include <mysql/service_thd_wait.h>
#include <mysql/psi/mysql_stage.h>
-#include "wsrep_mysqld.h"
-#include "wsrep_thd.h"
-
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_MDL_wait_LOCK_wait_status;
@@ -80,7 +77,7 @@ static void init_mdl_psi_keys(void)
PSI_stage_info MDL_key::m_namespace_to_wait_state_name[NAMESPACE_END]=
{
- {0, "Waiting for global read lock", 0},
+ {0, "Waiting for backup lock", 0},
{0, "Waiting for schema metadata lock", 0},
{0, "Waiting for table metadata lock", 0},
{0, "Waiting for stored function metadata lock", 0},
@@ -88,10 +85,44 @@ PSI_stage_info MDL_key::m_namespace_to_wait_state_name[NAMESPACE_END]=
{0, "Waiting for stored package body metadata lock", 0},
{0, "Waiting for trigger metadata lock", 0},
{0, "Waiting for event metadata lock", 0},
- {0, "Waiting for commit lock", 0},
{0, "User lock", 0} /* Be compatible with old status. */
};
+
+static const LEX_STRING lock_types[]=
+{
+ { C_STRING_WITH_LEN("MDL_INTENTION_EXCLUSIVE") },
+ { C_STRING_WITH_LEN("MDL_SHARED") },
+ { C_STRING_WITH_LEN("MDL_SHARED_HIGH_PRIO") },
+ { C_STRING_WITH_LEN("MDL_SHARED_READ") },
+ { C_STRING_WITH_LEN("MDL_SHARED_WRITE") },
+ { C_STRING_WITH_LEN("MDL_SHARED_UPGRADABLE") },
+ { C_STRING_WITH_LEN("MDL_SHARED_READ_ONLY") },
+ { C_STRING_WITH_LEN("MDL_SHARED_NO_WRITE") },
+ { C_STRING_WITH_LEN("MDL_SHARED_NO_READ_WRITE") },
+ { C_STRING_WITH_LEN("MDL_EXCLUSIVE") },
+};
+
+
+static const LEX_STRING backup_lock_types[]=
+{
+ { C_STRING_WITH_LEN("MDL_BACKUP_START") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_FLUSH") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_WAIT_FLUSH") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_WAIT_DDL") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_WAIT_COMMIT") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_FTWRL1") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_FTWRL2") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_DML") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_TRANS_DML") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_SYS_DML") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_DDL") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_BLOCK_DDL") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_ALTER_COPY") },
+ { C_STRING_WITH_LEN("MDL_BACKUP_COMMIT") }
+};
+
+
#ifdef HAVE_PSI_INTERFACE
void MDL_key::init_psi_keys()
{
@@ -128,11 +159,9 @@ public:
LF_PINS *get_pins() { return lf_hash_get_pins(&m_locks); }
private:
LF_HASH m_locks; /**< All acquired locks in the server. */
- /** Pre-allocated MDL_lock object for GLOBAL namespace. */
- MDL_lock *m_global_lock;
- /** Pre-allocated MDL_lock object for COMMIT namespace. */
- MDL_lock *m_commit_lock;
- friend int mdl_iterate(int (*)(MDL_ticket *, void *), void *);
+ /** Pre-allocated MDL_lock object for BACKUP namespace. */
+ MDL_lock *m_backup_lock;
+ friend int mdl_iterate(mdl_iterator_callback, void *);
};
@@ -279,8 +308,6 @@ Deadlock_detection_visitor::opt_change_victim_to(MDL_context *new_victim)
and compatibility matrices.
*/
-#define MDL_BIT(A) static_cast<MDL_lock::bitmap_t>(1U << A)
-
/**
The lock context. Created internally for an acquired lock.
For a given name, there exists only one MDL_lock instance,
@@ -295,7 +322,7 @@ Deadlock_detection_visitor::opt_change_victim_to(MDL_context *new_victim)
class MDL_lock
{
public:
- typedef unsigned short bitmap_t;
+ typedef mdl_bitmap_t bitmap_t;
class Ticket_list
{
@@ -328,9 +355,10 @@ public:
/**
Helper struct which defines how different types of locks are handled
- for a specific MDL_lock. In practice we use only two strategies: "scoped"
- lock strategy for locks in GLOBAL, COMMIT and SCHEMA namespaces and
- "object" lock strategy for all other namespaces.
+ for a specific MDL_lock. In practice we use only three strategies:
+ "backup" lock strategy for locks in BACKUP namespace, "scoped" lock
+ strategy for locks in SCHEMA namespace and "object" lock strategy for
+ all other namespaces.
*/
struct MDL_lock_strategy
{
@@ -394,9 +422,10 @@ public:
{ return m_waiting_incompatible; }
virtual bool needs_notification(const MDL_ticket *ticket) const
{
- return ticket->get_type() == MDL_SHARED_NO_WRITE ||
- ticket->get_type() == MDL_SHARED_NO_READ_WRITE ||
- ticket->get_type() == MDL_EXCLUSIVE;
+ return (MDL_BIT(ticket->get_type()) &
+ (MDL_BIT(MDL_SHARED_NO_WRITE) |
+ MDL_BIT(MDL_SHARED_NO_READ_WRITE) |
+ MDL_BIT(MDL_EXCLUSIVE)));
}
/**
@@ -427,6 +456,43 @@ public:
static const bitmap_t m_waiting_incompatible[MDL_TYPE_END];
};
+
+ struct MDL_backup_lock: public MDL_lock_strategy
+ {
+ MDL_backup_lock() {}
+ virtual const bitmap_t *incompatible_granted_types_bitmap() const
+ { return m_granted_incompatible; }
+ virtual const bitmap_t *incompatible_waiting_types_bitmap() const
+ { return m_waiting_incompatible; }
+ virtual bool needs_notification(const MDL_ticket *ticket) const
+ {
+ return (MDL_BIT(ticket->get_type()) & MDL_BIT(MDL_BACKUP_FTWRL1));
+ }
+
+ /**
+ Insert delayed threads may hold DML or TRANS_DML lock.
+ We need to kill such threads in order to get lock for FTWRL statements.
+ We do this by calling code outside of MDL.
+ */
+ virtual bool conflicting_locks(const MDL_ticket *ticket) const
+ {
+ return (MDL_BIT(ticket->get_type()) &
+ (MDL_BIT(MDL_BACKUP_DML) |
+ MDL_BIT(MDL_BACKUP_TRANS_DML)));
+ }
+
+ /*
+ In backup namespace DML/DDL may starve because of concurrent FTWRL or
+ BACKUP statements. This scenario is partically useless in real world,
+ so we just return 0 here.
+ */
+ virtual bitmap_t hog_lock_types_bitmap() const
+ { return 0; }
+ private:
+ static const bitmap_t m_granted_incompatible[MDL_BACKUP_END];
+ static const bitmap_t m_waiting_incompatible[MDL_BACKUP_END];
+ };
+
public:
/** The key of the object (data) being protected. */
MDL_key key;
@@ -538,10 +604,9 @@ public:
MDL_lock(const MDL_key *key_arg)
: key(key_arg),
m_hog_lock_count(0),
- m_strategy(&m_scoped_lock_strategy)
+ m_strategy(&m_backup_lock_strategy)
{
- DBUG_ASSERT(key_arg->mdl_namespace() == MDL_key::GLOBAL ||
- key_arg->mdl_namespace() == MDL_key::COMMIT);
+ DBUG_ASSERT(key_arg->mdl_namespace() == MDL_key::BACKUP);
mysql_prlock_init(key_MDL_lock_rwlock, &m_rwlock);
}
@@ -557,8 +622,7 @@ public:
static void lf_hash_initializer(LF_HASH *hash __attribute__((unused)),
MDL_lock *lock, MDL_key *key_arg)
{
- DBUG_ASSERT(key_arg->mdl_namespace() != MDL_key::GLOBAL &&
- key_arg->mdl_namespace() != MDL_key::COMMIT);
+ DBUG_ASSERT(key_arg->mdl_namespace() != MDL_key::BACKUP);
new (&lock->key) MDL_key(key_arg);
if (key_arg->mdl_namespace() == MDL_key::SCHEMA)
lock->m_strategy= &m_scoped_lock_strategy;
@@ -568,11 +632,13 @@ public:
const MDL_lock_strategy *m_strategy;
private:
+ static const MDL_backup_lock m_backup_lock_strategy;
static const MDL_scoped_lock m_scoped_lock_strategy;
static const MDL_object_lock m_object_lock_strategy;
};
+const MDL_lock::MDL_backup_lock MDL_lock::m_backup_lock_strategy;
const MDL_lock::MDL_scoped_lock MDL_lock::m_scoped_lock_strategy;
const MDL_lock::MDL_object_lock MDL_lock::m_object_lock_strategy;
@@ -636,7 +702,7 @@ void mdl_destroy()
struct mdl_iterate_arg
{
- int (*callback)(MDL_ticket *ticket, void *arg);
+ mdl_iterator_callback callback;
void *argument;
};
@@ -649,16 +715,19 @@ static my_bool mdl_iterate_lock(MDL_lock *lock, mdl_iterate_arg *arg)
must be empty for such locks anyway.
*/
mysql_prlock_rdlock(&lock->m_rwlock);
- MDL_lock::Ticket_iterator ticket_it(lock->m_granted);
+ MDL_lock::Ticket_iterator granted_it(lock->m_granted);
+ MDL_lock::Ticket_iterator waiting_it(lock->m_waiting);
MDL_ticket *ticket;
- while ((ticket= ticket_it++) && !(res= arg->callback(ticket, arg->argument)))
+ while ((ticket= granted_it++) && !(res= arg->callback(ticket, arg->argument, true)))
+ /* no-op */;
+ while ((ticket= waiting_it++) && !(res= arg->callback(ticket, arg->argument, false)))
/* no-op */;
mysql_prlock_unlock(&lock->m_rwlock);
return MY_TEST(res);
}
-int mdl_iterate(int (*callback)(MDL_ticket *ticket, void *arg), void *arg)
+int mdl_iterate(mdl_iterator_callback callback, void *arg)
{
DBUG_ENTER("mdl_iterate");
mdl_iterate_arg argument= { callback, arg };
@@ -667,8 +736,7 @@ int mdl_iterate(int (*callback)(MDL_ticket *ticket, void *arg), void *arg)
if (pins)
{
- res= mdl_iterate_lock(mdl_locks.m_global_lock, &argument) ||
- mdl_iterate_lock(mdl_locks.m_commit_lock, &argument) ||
+ res= mdl_iterate_lock(mdl_locks.m_backup_lock, &argument) ||
lf_hash_iterate(&mdl_locks.m_locks, pins,
(my_hash_walk_action) mdl_iterate_lock, &argument);
lf_hash_put_pins(pins);
@@ -689,11 +757,9 @@ my_hash_value_type mdl_hash_function(CHARSET_INFO *cs,
void MDL_map::init()
{
- MDL_key global_lock_key(MDL_key::GLOBAL, "", "");
- MDL_key commit_lock_key(MDL_key::COMMIT, "", "");
+ MDL_key backup_lock_key(MDL_key::BACKUP, "", "");
- m_global_lock= new (std::nothrow) MDL_lock(&global_lock_key);
- m_commit_lock= new (std::nothrow) MDL_lock(&commit_lock_key);
+ m_backup_lock= new (std::nothrow) MDL_lock(&backup_lock_key);
lf_hash_init(&m_locks, sizeof(MDL_lock), LF_HASH_UNIQUE, 0, 0,
mdl_locks_key, &my_charset_bin);
@@ -711,10 +777,9 @@ void MDL_map::init()
void MDL_map::destroy()
{
- delete m_global_lock;
- delete m_commit_lock;
+ delete m_backup_lock;
- DBUG_ASSERT(!my_atomic_load32(&m_locks.count));
+ DBUG_ASSERT(!lf_hash_size(&m_locks));
lf_hash_destroy(&m_locks);
}
@@ -732,26 +797,18 @@ MDL_lock* MDL_map::find_or_insert(LF_PINS *pins, const MDL_key *mdl_key)
{
MDL_lock *lock;
- if (mdl_key->mdl_namespace() == MDL_key::GLOBAL ||
- mdl_key->mdl_namespace() == MDL_key::COMMIT)
+ if (mdl_key->mdl_namespace() == MDL_key::BACKUP)
{
/*
- Avoid locking any m_mutex when lock for GLOBAL or COMMIT namespace is
- requested. Return pointer to pre-allocated MDL_lock instance instead.
- Such an optimization allows to save one mutex lock/unlock for any
- statement changing data.
+ Return pointer to pre-allocated MDL_lock instance. Such an optimization
+ allows to save one hash lookup for any statement changing data.
- It works since these namespaces contain only one element so keys
+ It works since this namespace contains only one element so keys
for them look like '<namespace-id>\0\0'.
*/
DBUG_ASSERT(mdl_key->length() == 3);
-
- lock= (mdl_key->mdl_namespace() == MDL_key::GLOBAL) ? m_global_lock :
- m_commit_lock;
-
- mysql_prlock_wrlock(&lock->m_rwlock);
-
- return lock;
+ mysql_prlock_wrlock(&m_backup_lock->m_rwlock);
+ return m_backup_lock;
}
retry:
@@ -780,22 +837,18 @@ retry:
unsigned long
MDL_map::get_lock_owner(LF_PINS *pins, const MDL_key *mdl_key)
{
- MDL_lock *lock;
unsigned long res= 0;
- if (mdl_key->mdl_namespace() == MDL_key::GLOBAL ||
- mdl_key->mdl_namespace() == MDL_key::COMMIT)
+ if (mdl_key->mdl_namespace() == MDL_key::BACKUP)
{
- lock= (mdl_key->mdl_namespace() == MDL_key::GLOBAL) ? m_global_lock :
- m_commit_lock;
- mysql_prlock_rdlock(&lock->m_rwlock);
- res= lock->get_lock_owner();
- mysql_prlock_unlock(&lock->m_rwlock);
+ mysql_prlock_rdlock(&m_backup_lock->m_rwlock);
+ res= m_backup_lock->get_lock_owner();
+ mysql_prlock_unlock(&m_backup_lock->m_rwlock);
}
else
{
- lock= (MDL_lock*) lf_hash_search(&m_locks, pins, mdl_key->ptr(),
- mdl_key->length());
+ MDL_lock *lock= (MDL_lock*) lf_hash_search(&m_locks, pins, mdl_key->ptr(),
+ mdl_key->length());
if (lock)
{
/*
@@ -820,13 +873,9 @@ MDL_map::get_lock_owner(LF_PINS *pins, const MDL_key *mdl_key)
void MDL_map::remove(LF_PINS *pins, MDL_lock *lock)
{
- if (lock->key.mdl_namespace() == MDL_key::GLOBAL ||
- lock->key.mdl_namespace() == MDL_key::COMMIT)
+ if (lock->key.mdl_namespace() == MDL_key::BACKUP)
{
- /*
- Never destroy pre-allocated MDL_lock objects for GLOBAL and
- COMMIT namespaces.
- */
+ /* Never destroy pre-allocated MDL_lock object in BACKUP namespace. */
mysql_prlock_unlock(&lock->m_rwlock);
return;
}
@@ -975,9 +1024,14 @@ void MDL_ticket::destroy(MDL_ticket *ticket)
uint MDL_ticket::get_deadlock_weight() const
{
- return (m_lock->key.mdl_namespace() == MDL_key::GLOBAL ||
- m_type >= MDL_SHARED_UPGRADABLE ?
- DEADLOCK_WEIGHT_DDL : DEADLOCK_WEIGHT_DML);
+ if (m_lock->key.mdl_namespace() == MDL_key::BACKUP)
+ {
+ if (m_type == MDL_BACKUP_FTWRL1)
+ return DEADLOCK_WEIGHT_FTWRL1;
+ return DEADLOCK_WEIGHT_DDL;
+ }
+ return m_type >= MDL_SHARED_UPGRADABLE ?
+ DEADLOCK_WEIGHT_DDL : DEADLOCK_WEIGHT_DML;
}
@@ -1161,10 +1215,9 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket)
wsrep_thd_is_BF(ticket->get_ctx()->get_thd(), false))
{
Ticket_iterator itw(ticket->get_lock()->m_waiting);
- Ticket_iterator itg(ticket->get_lock()->m_granted);
DBUG_ASSERT(WSREP_ON);
- MDL_ticket *waiting, *granted;
+ MDL_ticket *waiting;
MDL_ticket *prev=NULL;
bool added= false;
@@ -1183,20 +1236,8 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket)
}
/* Otherwise, insert the ticket at the back of the waiting list. */
- if (!added) m_list.push_back(ticket);
-
- while ((granted= itg++))
- {
- if (granted->get_ctx() != ticket->get_ctx() &&
- granted->is_incompatible_when_granted(ticket->get_type()))
- {
- if (!wsrep_grant_mdl_exception(ticket->get_ctx(), granted,
- &ticket->get_lock()->key))
- {
- WSREP_DEBUG("MDL victim killed at add_ticket");
- }
- }
- }
+ if (!added)
+ m_list.push_back(ticket);
}
else
#endif /* WITH_WSREP */
@@ -1368,17 +1409,23 @@ void MDL_lock::reschedule_waiters()
/**
Compatibility (or rather "incompatibility") matrices for scoped metadata
- lock. Arrays of bitmaps which elements specify which granted/waiting locks
+ lock.
+ Scoped locks are database (or schema) locks.
+ Arrays of bitmaps which elements specify which granted/waiting locks
are incompatible with type of lock being requested.
The first array specifies if particular type of request can be satisfied
if there is granted scoped lock of certain type.
+ (*) Since intention shared scoped locks (IS) are compatible with all other
+ type of locks, they don't need to be implemented and there is no code
+ for them.
+
| Type of active |
Request | scoped lock |
type | IS(*) IX S X |
---------+------------------+
- IS | + + + + |
+ IS(*) | + + + + |
IX | + + - - |
S | + - + - |
X | + - - - |
@@ -1391,7 +1438,7 @@ void MDL_lock::reschedule_waiters()
Request | scoped lock |
type | IS(*) IX S X |
---------+-----------------+
- IS | + + + + |
+ IS(*) | + + + + |
IX | + + - - |
S | + + + - |
X | + + + + |
@@ -1399,9 +1446,6 @@ void MDL_lock::reschedule_waiters()
Here: "+" -- means that request can be satisfied
"-" -- means that request can't be satisfied and should wait
- (*) Since intention shared scoped locks are compatible with all other
- type of locks we don't even have any accounting for them.
-
Note that relation between scoped locks and objects locks requested
by statement is not straightforward and is therefore fully defined
by SQL-layer.
@@ -1440,41 +1484,41 @@ MDL_lock::MDL_scoped_lock::m_waiting_incompatible[MDL_TYPE_END]=
The first array specifies if particular type of request can be satisfied
if there is granted lock of certain type.
- Request | Granted requests for lock |
- type | S SH SR SW SU SRO SNW SNRW X |
- ----------+---------------------------------------+
- S | + + + + + + + + - |
- SH | + + + + + + + + - |
- SR | + + + + + + + - - |
- SW | + + + + + - - - - |
- SU | + + + + - + - - - |
- SRO | + + + - + + + - - |
- SNW | + + + - - + - - - |
- SNRW | + + - - - - - - - |
- X | - - - - - - - - - |
- SU -> X | - - - - 0 - 0 0 0 |
- SNW -> X | - - - 0 0 - 0 0 0 |
- SNRW -> X | - - 0 0 0 0 0 0 0 |
+ Request | Granted requests for lock |
+ type | S SH SR SW SU SRO SNW SNRW X |
+ ----------+------------------------------------+
+ S | + + + + + + + + - |
+ SH | + + + + + + + + - |
+ SR | + + + + + + + - - |
+ SW | + + + + + - - - - |
+ SU | + + + + - + - - - |
+ SRO | + + + - + + + - - |
+ SNW | + + + - - + - - - |
+ SNRW | + + - - - - - - - |
+ X | - - - - - - - - - |
+ SU -> X | - - - - 0 - 0 0 0 |
+ SNW -> X | - - - 0 0 - 0 0 0 |
+ SNRW -> X | - - 0 0 0 0 0 0 0 |
The second array specifies if particular type of request can be satisfied
if there is waiting request for the same lock of certain type. In other
words it specifies what is the priority of different lock types.
- Request | Pending requests for lock |
- type | S SH SR SW SU SRO SNW SNRW X |
- ----------+--------------------------------------+
- S | + + + + + + + + - |
- SH | + + + + + + + + + |
- SR | + + + + + + + - - |
- SW | + + + + + + - - - |
- SU | + + + + + + + + - |
- SRO | + + + - + + + - - |
- SNW | + + + + + + + + - |
- SNRW | + + + + + + + + - |
- X | + + + + + + + + + |
- SU -> X | + + + + + + + + + |
- SNW -> X | + + + + + + + + + |
- SNRW -> X | + + + + + + + + + |
+ Request | Pending requests for lock |
+ type | S SH SR SW SU SRO SNW SNRW X |
+ ----------+-----------------------------------+
+ S | + + + + + + + + - |
+ SH | + + + + + + + + + |
+ SR | + + + + + + + - - |
+ SW | + + + + + + - - - |
+ SU | + + + + + + + + - |
+ SRO | + + + - + + + - - |
+ SNW | + + + + + + + + - |
+ SNRW | + + + + + + + + - |
+ X | + + + + + + + + + |
+ SU -> X | + + + + + + + + + |
+ SNW -> X | + + + + + + + + + |
+ SNRW -> X | + + + + + + + + + |
Here: "+" -- means that request can be satisfied
"-" -- means that request can't be satisfied and should wait
@@ -1535,9 +1579,126 @@ MDL_lock::MDL_object_lock::m_waiting_incompatible[MDL_TYPE_END]=
/**
+ Compatibility (or rather "incompatibility") matrices for backup metadata
+ lock. Arrays of bitmaps which elements specify which granted/waiting locks
+ are incompatible with type of lock being requested.
+
+ The first array specifies if particular type of request can be satisfied
+ if there is granted backup lock of certain type.
+
+ Request | Type of active backup lock |
+ type | S0 S1 S2 S3 S4 F1 F2 D TD SD DD BL AC C |
+ ----------+---------------------------------------------------------+
+ S0 | - - - - - + + + + + + + + + |
+ S1 | - + + + + + + + + + + + + + |
+ S2 | - + + + + + + - + + + + + + |
+ S3 | - + + + + + + - + + - + + + |
+ S4 | - + + + + + + - + - - + + - |
+ FTWRL1 | + + + + + + + - - - - + - + |
+ FTWRL2 | + + + + + + + - - - - + - - |
+ D | + - - - - - - + + + + + + + |
+ TD | + + + + + - - + + + + + + + |
+ SD | + + + + - - - + + + + + + + |
+ DDL | + + + - - - - + + + + - + + |
+ BLOCK_DDL | + + + + + + + + + + - + + + |
+ ALTER_COP | + + + + + - - + + + + + + + |
+ COMMIT | + + + + - + - + + + + + + + |
+
+ The second array specifies if particular type of request can be satisfied
+ if there is already waiting request for the backup lock of certain type.
+ I.e. it specifies what is the priority of different lock types.
+
+ Request | Pending backup lock |
+ type | S0 S1 S2 S3 S4 F1 F2 D TD SD DD BL AC C |
+ ----------+---------------------------------------------------------+
+ S0 | + - - - - + + + + + + + + + |
+ S1 | + + + + + + + + + + + + + + |
+ S2 | + + + + + + + + + + + + + + |
+ S3 | + + + + + + + + + + + + + + |
+ S4 | + + + + + + + + + + + + + + |
+ FTWRL1 | + + + + + + + + + + + + + + |
+ FTWRL2 | + + + + + + + + + + + + + + |
+ D | + - - - - - - + + + + + + + |
+ TD | + + + + + - - + + + + + + + |
+ SD | + + + + - - - + + + + + + + |
+ DDL | + + + - - - - + + + + - + + |
+ BLOCK_DDL | + + + + + + + + + + + + + + |
+ ALTER_COP | + + + + + - - + + + + + + + |
+ COMMIT | + + + + - + - + + + + + + + |
+
+ Here: "+" -- means that request can be satisfied
+ "-" -- means that request can't be satisfied and should wait
+*/
+
+/*
+ NOTE: If you add a new MDL_BACKUP_XXX level lock, you have to also add it
+ to MDL_BACKUP_START in the two arrays below!
+*/
+
+const MDL_lock::bitmap_t
+MDL_lock::MDL_backup_lock::m_granted_incompatible[MDL_BACKUP_END]=
+{
+ /* MDL_BACKUP_START */
+ MDL_BIT(MDL_BACKUP_START) | MDL_BIT(MDL_BACKUP_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT),
+ MDL_BIT(MDL_BACKUP_START),
+ MDL_BIT(MDL_BACKUP_START) | MDL_BIT(MDL_BACKUP_DML),
+ MDL_BIT(MDL_BACKUP_START) | MDL_BIT(MDL_BACKUP_DML) | MDL_BIT(MDL_BACKUP_DDL),
+ MDL_BIT(MDL_BACKUP_START) | MDL_BIT(MDL_BACKUP_DML) | MDL_BIT(MDL_BACKUP_SYS_DML) | MDL_BIT(MDL_BACKUP_DDL) | MDL_BIT(MDL_BACKUP_COMMIT),
+
+ /* MDL_BACKUP_FTWRL1 */
+ MDL_BIT(MDL_BACKUP_DML) | MDL_BIT(MDL_BACKUP_TRANS_DML) | MDL_BIT(MDL_BACKUP_SYS_DML) | MDL_BIT(MDL_BACKUP_DDL) | MDL_BIT(MDL_BACKUP_ALTER_COPY),
+ MDL_BIT(MDL_BACKUP_DML) | MDL_BIT(MDL_BACKUP_TRANS_DML) | MDL_BIT(MDL_BACKUP_SYS_DML) | MDL_BIT(MDL_BACKUP_DDL) | MDL_BIT(MDL_BACKUP_ALTER_COPY) | MDL_BIT(MDL_BACKUP_COMMIT),
+ /* MDL_BACKUP_DML */
+ MDL_BIT(MDL_BACKUP_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ /* MDL_BACKUP_DDL */
+ MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2) | MDL_BIT(MDL_BACKUP_BLOCK_DDL),
+ /* MDL_BACKUP_BLOCK_DDL */
+ MDL_BIT(MDL_BACKUP_DDL),
+ MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ /* MDL_BACKUP_COMMIT */
+ MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL2)
+};
+
+
+const MDL_lock::bitmap_t
+MDL_lock::MDL_backup_lock::m_waiting_incompatible[MDL_BACKUP_END]=
+{
+ /* MDL_BACKUP_START */
+ MDL_BIT(MDL_BACKUP_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT),
+ 0,
+ 0,
+ 0,
+ 0,
+ /* MDL_BACKUP_FTWRL1 */
+ 0,
+ 0,
+
+ /* MDL_BACKUP_DML */
+ MDL_BIT(MDL_BACKUP_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ /* MDL_BACKUP_DDL */
+ MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2) | MDL_BIT(MDL_BACKUP_BLOCK_DDL),
+ /* MDL_BACKUP_BLOCK_DDL */
+ 0,
+ MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
+ /* MDL_BACKUP_COMMIT */
+ MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL2)
+};
+
+
+/**
Check if request for the metadata lock can be satisfied given its
current state.
+ New lock request can be satisfied iff:
+ - There are no incompatible types of satisfied requests
+ in other contexts
+ - There are no waiting requests which have higher priority
+ than this request when priority was not ignored.
+
@param type_arg The requested lock type.
@param requestor_ctx The MDL context of the requestor.
@param ignore_lock_priority Ignore lock priority.
@@ -1555,78 +1716,72 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
MDL_context *requestor_ctx,
bool ignore_lock_priority) const
{
- bool can_grant= FALSE;
bitmap_t waiting_incompat_map= incompatible_waiting_types_bitmap()[type_arg];
bitmap_t granted_incompat_map= incompatible_granted_types_bitmap()[type_arg];
- bool wsrep_can_grant= TRUE;
+#ifdef WITH_WSREP
/*
- New lock request can be satisfied iff:
- - There are no incompatible types of satisfied requests
- in other contexts
- - There are no waiting requests which have higher priority
- than this request when priority was not ignored.
+ Approve lock request in BACKUP namespace for BF threads.
+ We should get rid of this code and forbid FTWRL/BACKUP statements
+ when wsrep is active.
*/
- if (ignore_lock_priority || !(m_waiting.bitmap() & waiting_incompat_map))
+ if ((wsrep_thd_is_toi(requestor_ctx->get_thd()) ||
+ wsrep_thd_is_applying(requestor_ctx->get_thd())) &&
+ key.mdl_namespace() == MDL_key::BACKUP)
{
- if (! (m_granted.bitmap() & granted_incompat_map))
- can_grant= TRUE;
- else
+ bool waiting_incompatible= m_waiting.bitmap() & waiting_incompat_map;
+ bool granted_incompatible= m_granted.bitmap() & granted_incompat_map;
+ if (waiting_incompatible || granted_incompatible)
{
- Ticket_iterator it(m_granted);
- MDL_ticket *ticket;
+ WSREP_DEBUG("global lock granted for BF%s: %lu %s",
+ waiting_incompatible ? " (waiting queue)" : "",
+ thd_get_thread_id(requestor_ctx->get_thd()),
+ wsrep_thd_query(requestor_ctx->get_thd()));
+ }
+ return true;
+ }
+#endif /* WITH_WSREP */
+
+ if (!ignore_lock_priority && (m_waiting.bitmap() & waiting_incompat_map))
+ return false;
+
+ if (m_granted.bitmap() & granted_incompat_map)
+ {
+ Ticket_iterator it(m_granted);
+ bool can_grant= true;
- /* Check that the incompatible lock belongs to some other context. */
- while ((ticket= it++))
+ /* Check that the incompatible lock belongs to some other context. */
+ while (auto ticket= it++)
+ {
+ if (ticket->get_ctx() != requestor_ctx &&
+ ticket->is_incompatible_when_granted(type_arg))
{
- if (ticket->get_ctx() != requestor_ctx &&
- ticket->is_incompatible_when_granted(type_arg))
- {
+ can_grant= false;
#ifdef WITH_WSREP
- if (wsrep_thd_is_BF(requestor_ctx->get_thd(),false) &&
- key.mdl_namespace() == MDL_key::GLOBAL)
- {
- WSREP_DEBUG("global lock granted for BF: %lu %s",
- thd_get_thread_id(requestor_ctx->get_thd()),
- wsrep_thd_query(requestor_ctx->get_thd()));
- can_grant = true;
- }
- else if (!wsrep_grant_mdl_exception(requestor_ctx, ticket, &key))
+ /*
+ non WSREP threads must report conflict immediately
+ note: RSU processing wsrep threads, have wsrep_on==OFF
+ */
+ if (WSREP(requestor_ctx->get_thd()) ||
+ requestor_ctx->get_thd()->wsrep_cs().mode() ==
+ wsrep::client_state::m_rsu)
+ {
+ wsrep_handle_mdl_conflict(requestor_ctx, ticket, &key);
+ if (wsrep_log_conflicts)
{
- wsrep_can_grant= FALSE;
- if (wsrep_log_conflicts)
- {
- MDL_lock * lock = ticket->get_lock();
- WSREP_INFO(
- "MDL conflict db=%s table=%s ticket=%d solved by %s",
- lock->key.db_name(), lock->key.name(), ticket->get_type(),
- "abort" );
- }
+ auto key= ticket->get_key();
+ WSREP_INFO("MDL conflict db=%s table=%s ticket=%d solved by abort",
+ key->db_name(), key->name(), ticket->get_type());
}
- else
- can_grant= TRUE;
- /* Continue loop */
-#else
- break;
-#endif /* WITH_WSREP */
+ continue;
}
+#endif /* WITH_WSREP */
+ break;
}
- if ((ticket == NULL) && wsrep_can_grant)
- can_grant= TRUE; /* Incompatible locks are our own. */
}
+ return can_grant;
}
- else
- {
- if (wsrep_thd_is_BF(requestor_ctx->get_thd(), false) &&
- key.mdl_namespace() == MDL_key::GLOBAL)
- {
- WSREP_DEBUG("global lock granted for BF (waiting queue): %lu %s",
- thd_get_thread_id(requestor_ctx->get_thd()),
- wsrep_thd_query(requestor_ctx->get_thd()));
- can_grant = true;
- }
- }
- return can_grant;
+ return true;
}
@@ -1739,6 +1894,27 @@ bool MDL_ticket::is_incompatible_when_waiting(enum_mdl_type type) const
}
+static const LEX_STRING
+*get_mdl_lock_name(MDL_key::enum_mdl_namespace mdl_namespace,
+ enum_mdl_type type)
+{
+ return mdl_namespace == MDL_key::BACKUP ?
+ &backup_lock_types[type] :
+ &lock_types[type];
+}
+
+
+const LEX_STRING *MDL_ticket::get_type_name() const
+{
+ return get_mdl_lock_name(get_key()->mdl_namespace(), m_type);
+}
+
+const LEX_STRING *MDL_ticket::get_type_name(enum_mdl_type type) const
+{
+ return get_mdl_lock_name(get_key()->mdl_namespace(), type);
+}
+
+
/**
Check whether the context already holds a compatible lock ticket
on an object.
@@ -1772,8 +1948,10 @@ MDL_context::find_ticket(MDL_request *mdl_request,
if (mdl_request->key.is_equal(&ticket->m_lock->key) &&
ticket->has_stronger_or_equal_type(mdl_request->type))
{
- DBUG_PRINT("info", ("Adding mdl lock %d to %d",
- mdl_request->type, ticket->m_type));
+ DBUG_PRINT("info", ("Adding mdl lock %s to %s",
+ get_mdl_lock_name(mdl_request->key.mdl_namespace(),
+ mdl_request->type)->str,
+ ticket->get_type_name()->str));
*result_duration= duration;
return ticket;
}
@@ -1859,11 +2037,8 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
MDL_ticket *ticket;
enum_mdl_duration found_duration;
- DBUG_ASSERT(mdl_request->type != MDL_EXCLUSIVE ||
- is_lock_owner(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE));
- DBUG_ASSERT(mdl_request->ticket == NULL);
-
/* Don't take chances in production. */
+ DBUG_ASSERT(mdl_request->ticket == NULL);
mdl_request->ticket= NULL;
/*
@@ -2064,7 +2239,10 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
MDL_ticket *ticket;
MDL_wait::enum_wait_status wait_status;
DBUG_ENTER("MDL_context::acquire_lock");
- DBUG_PRINT("enter", ("lock_type: %d", mdl_request->type));
+ DBUG_PRINT("enter", ("lock_type: %s timeout: %f",
+ get_mdl_lock_name(mdl_request->key.mdl_namespace(),
+ mdl_request->type)->str,
+ lock_wait_timeout));
if (try_acquire_lock_impl(mdl_request, &ticket))
DBUG_RETURN(TRUE);
@@ -2180,6 +2358,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
switch (wait_status)
{
case MDL_wait::VICTIM:
+ mdl_dbug_print_locks();
my_error(ER_LOCK_DEADLOCK, MYF(0));
break;
case MDL_wait::TIMEOUT:
@@ -2319,15 +2498,23 @@ MDL_context::upgrade_shared_lock(MDL_ticket *mdl_ticket,
MDL_savepoint mdl_svp= mdl_savepoint();
bool is_new_ticket;
DBUG_ENTER("MDL_context::upgrade_shared_lock");
- DBUG_PRINT("enter",("new_type: %d lock_wait_timeout: %f", new_type,
+ DBUG_PRINT("enter",("old_type: %s new_type: %s lock_wait_timeout: %f",
+ mdl_ticket->get_type_name()->str,
+ mdl_ticket->get_type_name(new_type)->str,
lock_wait_timeout));
DEBUG_SYNC(get_thd(), "mdl_upgrade_lock");
/*
Do nothing if already upgraded. Used when we FLUSH TABLE under
LOCK TABLES and a table is listed twice in LOCK TABLES list.
+
+ In BACKUP namespace upgrade must always happen. Even though
+ MDL_BACKUP_START is not stronger than MDL_BACKUP_FLUSH from
+ has_stronger_or_equal_type(), the latter effectively blocks
+ new MDL_BACKUP_DML while the former doesn't.
*/
- if (mdl_ticket->has_stronger_or_equal_type(new_type))
+ if (mdl_ticket->has_stronger_or_equal_type(new_type) &&
+ mdl_ticket->get_key()->mdl_namespace() != MDL_key::BACKUP)
DBUG_RETURN(FALSE);
mdl_xlock_request.init(&mdl_ticket->m_lock->key, new_type,
@@ -2728,9 +2915,13 @@ void MDL_ticket::downgrade_lock(enum_mdl_type type)
if (m_type == type || !has_stronger_or_equal_type(type))
return;
- /* Only allow downgrade from EXCLUSIVE and SHARED_NO_WRITE. */
- DBUG_ASSERT(m_type == MDL_EXCLUSIVE ||
- m_type == MDL_SHARED_NO_WRITE);
+ /* Only allow downgrade in some specific known cases */
+ DBUG_ASSERT((get_key()->mdl_namespace() != MDL_key::BACKUP &&
+ (m_type == MDL_EXCLUSIVE ||
+ m_type == MDL_SHARED_NO_WRITE)) ||
+ (get_key()->mdl_namespace() == MDL_key::BACKUP &&
+ (m_type == MDL_BACKUP_DDL ||
+ m_type == MDL_BACKUP_WAIT_FLUSH)));
mysql_prlock_wrlock(&m_lock->m_rwlock);
/*
@@ -3016,30 +3207,11 @@ bool MDL_context::has_explicit_locks()
#ifdef WITH_WSREP
static
-const char *wsrep_get_mdl_type_name(enum_mdl_type type)
-{
- switch (type)
- {
- case MDL_INTENTION_EXCLUSIVE : return "intention exclusive";
- case MDL_SHARED : return "shared";
- case MDL_SHARED_HIGH_PRIO : return "shared high prio";
- case MDL_SHARED_READ : return "shared read";
- case MDL_SHARED_WRITE : return "shared write";
- case MDL_SHARED_UPGRADABLE : return "shared upgradable";
- case MDL_SHARED_NO_WRITE : return "shared no write";
- case MDL_SHARED_NO_READ_WRITE : return "shared no read write";
- case MDL_EXCLUSIVE : return "exclusive";
- default: break;
- }
- return "UNKNOWN";
-}
-
-static
const char *wsrep_get_mdl_namespace_name(MDL_key::enum_mdl_namespace ns)
{
switch (ns)
{
- case MDL_key::GLOBAL : return "GLOBAL";
+ case MDL_key::BACKUP : return "BACKUP";
case MDL_key::SCHEMA : return "SCHEMA";
case MDL_key::TABLE : return "TABLE";
case MDL_key::FUNCTION : return "FUNCTION";
@@ -3047,7 +3219,6 @@ const char *wsrep_get_mdl_namespace_name(MDL_key::enum_mdl_namespace ns)
case MDL_key::PACKAGE_BODY: return "PACKAGE BODY";
case MDL_key::TRIGGER : return "TRIGGER";
case MDL_key::EVENT : return "EVENT";
- case MDL_key::COMMIT : return "COMMIT";
case MDL_key::USER_LOCK : return "USER_LOCK";
default: break;
}
@@ -3060,10 +3231,41 @@ void MDL_ticket::wsrep_report(bool debug)
const PSI_stage_info *psi_stage= m_lock->key.get_wait_state_name();
WSREP_DEBUG("MDL ticket: type: %s space: %s db: %s name: %s (%s)",
- wsrep_get_mdl_type_name(get_type()),
+ get_type_name()->str,
wsrep_get_mdl_namespace_name(m_lock->key.mdl_namespace()),
m_lock->key.db_name(),
m_lock->key.name(),
psi_stage->m_name);
}
#endif /* WITH_WSREP */
+
+
+#ifndef DBUG_OFF
+
+/*
+ Print a list of all locks to DBUG trace to help with debugging
+*/
+
+static int mdl_dbug_print_lock(MDL_ticket *mdl_ticket, void *arg, bool granted)
+{
+ String *tmp= (String*) arg;
+ char buffer[128];
+ MDL_key *mdl_key= mdl_ticket->get_key();
+ size_t length;
+ length= my_snprintf(buffer, sizeof(buffer)-1,
+ "\nname: %s db: %.*s key_name: %.*s (%s)",
+ mdl_ticket->get_type_name()->str,
+ (int) mdl_key->db_name_length(), mdl_key->db_name(),
+ (int) mdl_key->name_length(), mdl_key->name(),
+ granted ? "granted" : "waiting");
+ tmp->append(buffer, length);
+ return 0;
+}
+
+void mdl_dbug_print_locks()
+{
+ String tmp;
+ mdl_iterate(mdl_dbug_print_lock, (void*) &tmp);
+ DBUG_PRINT("mdl_locks", ("%s", tmp.c_ptr()));
+}
+#endif /* DBUG_OFF */
diff --git a/sql/mdl.h b/sql/mdl.h
index 952d97d301c..63cec3b65cf 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -28,6 +28,10 @@ class MDL_lock;
class MDL_ticket;
bool ok_for_lower_case_names(const char *name);
+typedef unsigned short mdl_bitmap_t;
+#define MDL_BIT(A) static_cast<mdl_bitmap_t>(1U << A)
+
+
/**
@def ENTER_COND(C, M, S, O)
Start a wait on a condition.
@@ -112,19 +116,25 @@ public:
@sa Comments for MDL_object_lock::can_grant_lock() and
MDL_scoped_lock::can_grant_lock() for details.
+
+ Scoped locks are database (or schema) locks.
+ The object locks are for tables, triggers etc.
*/
enum enum_mdl_type {
/*
- An intention exclusive metadata lock. Used only for scoped locks.
+ An intention exclusive metadata lock (IX). Used only for scoped locks.
Owner of this type of lock can acquire upgradable exclusive locks on
individual objects.
Compatible with other IX locks, but is incompatible with scoped S and
X locks.
+ IX lock is taken in SCHEMA namespace when we intend to modify
+ object metadata. Object may refer table, stored procedure, trigger,
+ view/etc.
*/
MDL_INTENTION_EXCLUSIVE= 0,
/*
- A shared metadata lock.
+ A shared metadata lock (S).
To be used in cases when we are interested in object metadata only
and there is no intention to access object data (e.g. for stored
routines or during preparing prepared statements).
@@ -144,6 +154,9 @@ enum enum_mdl_type {
use SNRW locks for them. It also does not arise when S locks are used
during PREPARE calls as table-level locks are not acquired in this
case.
+ This lock is taken for global read lock, when caching a stored
+ procedure in memory for the duration of the transaction and for
+ tables used by prepared statements.
*/
MDL_SHARED,
/*
@@ -164,8 +177,8 @@ enum enum_mdl_type {
*/
MDL_SHARED_HIGH_PRIO,
/*
- A shared metadata lock for cases when there is an intention to read data
- from table.
+ A shared metadata lock (SR) for cases when there is an intention to read
+ data from table.
A connection holding this kind of lock can read table metadata and read
table data (after acquiring appropriate table and row-level locks).
This means that one can only acquire TL_READ, TL_READ_NO_INSERT, and
@@ -175,7 +188,7 @@ enum enum_mdl_type {
*/
MDL_SHARED_READ,
/*
- A shared metadata lock for cases when there is an intention to modify
+ A shared metadata lock (SW) for cases when there is an intention to modify
(and not just read) data in the table.
A connection holding SW lock can read table metadata and modify or read
table data (after acquiring appropriate table and row-level locks).
@@ -185,8 +198,8 @@ enum enum_mdl_type {
*/
MDL_SHARED_WRITE,
/*
- An upgradable shared metadata lock for cases when there is an intention
- to modify (and not just read) data in the table.
+ An upgradable shared metadata lock for cases when there is an
+ intention to modify (and not just read) data in the table.
Can be upgraded to MDL_SHARED_NO_WRITE and MDL_EXCLUSIVE.
A connection holding SU lock can read table metadata and modify or read
table data (after acquiring appropriate table and row-level locks).
@@ -226,7 +239,7 @@ enum enum_mdl_type {
*/
MDL_SHARED_NO_READ_WRITE,
/*
- An exclusive metadata lock.
+ An exclusive metadata lock (X).
A connection holding this lock can modify both table's metadata and data.
No other type of metadata lock can be granted while this lock is held.
To be used for CREATE/DROP/RENAME TABLE statements and for execution of
@@ -234,7 +247,75 @@ enum enum_mdl_type {
*/
MDL_EXCLUSIVE,
/* This should be the last !!! */
- MDL_TYPE_END};
+ MDL_TYPE_END
+};
+
+
+/** Backup locks */
+
+/**
+ Block concurrent backup
+*/
+#define MDL_BACKUP_START enum_mdl_type(0)
+/**
+ Block new write requests to non transactional tables
+*/
+#define MDL_BACKUP_FLUSH enum_mdl_type(1)
+/**
+ In addition to previous locks, blocks running requests to non trans tables
+ Used to wait until all DML usage of on trans tables are finished
+*/
+#define MDL_BACKUP_WAIT_FLUSH enum_mdl_type(2)
+/**
+ In addition to previous locks, blocks new DDL's from starting
+*/
+#define MDL_BACKUP_WAIT_DDL enum_mdl_type(3)
+/**
+ In addition to previous locks, blocks commits
+*/
+#define MDL_BACKUP_WAIT_COMMIT enum_mdl_type(4)
+
+/**
+ Blocks (or is blocked by) statements that intend to modify data. Acquired
+ before commit lock by FLUSH TABLES WITH READ LOCK.
+*/
+#define MDL_BACKUP_FTWRL1 enum_mdl_type(5)
+
+/**
+ Blocks (or is blocked by) commits. Acquired after global read lock by
+ FLUSH TABLES WITH READ LOCK.
+*/
+#define MDL_BACKUP_FTWRL2 enum_mdl_type(6)
+
+#define MDL_BACKUP_DML enum_mdl_type(7)
+#define MDL_BACKUP_TRANS_DML enum_mdl_type(8)
+#define MDL_BACKUP_SYS_DML enum_mdl_type(9)
+
+/**
+ Must be acquired by DDL statements that intend to modify data.
+ Currently it's also used for LOCK TABLES.
+*/
+#define MDL_BACKUP_DDL enum_mdl_type(10)
+
+/**
+ Blocks new DDL's. Used by backup code to enable DDL logging
+*/
+#define MDL_BACKUP_BLOCK_DDL enum_mdl_type(11)
+
+/*
+ Statement is modifying data, but will not block MDL_BACKUP_DDL or earlier
+ BACKUP stages.
+ ALTER TABLE is started with MDL_BACKUP_DDL, but changed to
+ MDL_BACKUP_ALTER_COPY while alter table is copying or modifing data.
+*/
+
+#define MDL_BACKUP_ALTER_COPY enum_mdl_type(12)
+
+/**
+ Must be acquired during commit.
+*/
+#define MDL_BACKUP_COMMIT enum_mdl_type(13)
+#define MDL_BACKUP_END enum_mdl_type(14)
/** Duration of metadata lock. */
@@ -282,10 +363,13 @@ public:
/**
Object namespaces.
Sic: when adding a new member to this enum make sure to
- update m_namespace_to_wait_state_name array in mdl.cc!
+ update m_namespace_to_wait_state_name array in mdl.cc and
+ metadata_lock_info_lock_name in metadata_lock_info.cc!
Different types of objects exist in different namespaces
+ - SCHEMA is for databases (to protect against DROP DATABASE)
- TABLE is for tables and views.
+ - BACKUP is for locking DML, DDL and COMMIT's during BACKUP STAGES
- FUNCTION is for stored functions.
- PROCEDURE is for stored procedures.
- TRIGGER is for triggers.
@@ -294,7 +378,7 @@ public:
it's necessary to have a separate namespace for them since
MDL_key is also used outside of the MDL subsystem.
*/
- enum enum_mdl_namespace { GLOBAL=0,
+ enum enum_mdl_namespace { BACKUP=0,
SCHEMA,
TABLE,
FUNCTION,
@@ -302,7 +386,6 @@ public:
PACKAGE_BODY,
TRIGGER,
EVENT,
- COMMIT,
USER_LOCK, /* user level locks. */
/* This should be the last ! */
NAMESPACE_END };
@@ -552,7 +635,8 @@ public:
enum enum_deadlock_weight
{
- DEADLOCK_WEIGHT_DML= 0,
+ DEADLOCK_WEIGHT_FTWRL1= 0,
+ DEADLOCK_WEIGHT_DML= 1,
DEADLOCK_WEIGHT_DDL= 100
};
/* A helper used to determine which lock request should be aborted. */
@@ -610,6 +694,8 @@ public:
m_type == MDL_EXCLUSIVE;
}
enum_mdl_type get_type() const { return m_type; }
+ const LEX_STRING *get_type_name() const;
+ const LEX_STRING *get_type_name(enum_mdl_type type) const;
MDL_lock *get_lock() const { return m_lock; }
MDL_key *get_key() const;
void downgrade_lock(enum_mdl_type type);
@@ -1001,6 +1087,13 @@ extern "C" int thd_is_connected(MYSQL_THD thd);
*/
extern "C" ulong max_write_lock_count;
+typedef int (*mdl_iterator_callback)(MDL_ticket *ticket, void *arg,
+ bool granted);
extern MYSQL_PLUGIN_IMPORT
-int mdl_iterate(int (*callback)(MDL_ticket *ticket, void *arg), void *arg);
-#endif
+int mdl_iterate(mdl_iterator_callback callback, void *arg);
+#ifndef DBUG_OFF
+void mdl_dbug_print_locks();
+#else
+ static inline void mdl_dbug_print_locks() {}
+#endif /* DBUG_OFF */
+#endif /* MDL_H */
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index de7018c53cb..6927b181d92 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -268,7 +268,8 @@ int str2my_decimal(uint mask, const char *from, size_t length,
integer part cannot be larger that 1e18 (otherwise it's an overflow).
fractional part is microseconds.
*/
-bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, ulong *microsec)
+bool my_decimal2seconds(const my_decimal *d, ulonglong *sec,
+ ulong *microsec, ulong *nanosec)
{
int pos;
@@ -286,6 +287,7 @@ bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, ulong *microsec)
}
*microsec= d->frac ? static_cast<longlong>(d->buf[pos+1]) / (DIG_BASE/1000000) : 0;
+ *nanosec= d->frac ? static_cast<longlong>(d->buf[pos+1]) % (DIG_BASE/1000000) : 0;
if (pos > 1)
{
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index b22c686cc90..c196d43e001 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -362,7 +362,8 @@ inline bool str_set_decimal(const my_decimal *val, String *str,
}
-bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, ulong *microsec);
+bool my_decimal2seconds(const my_decimal *d, ulonglong *sec,
+ ulong *microsec, ulong *nanosec);
my_decimal *seconds2my_decimal(bool sign, ulonglong sec, ulong microsec,
my_decimal *d);
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index fc8bce08276..718e49969e0 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -198,7 +198,7 @@ int main(int argc, char **argv)
die("database creation failed");
}
- printf("Creation of the database was successful");
+ printf("Creation of the database was successful\n");
return 0;
}
@@ -343,17 +343,19 @@ static int create_myini()
static const char update_root_passwd_part1[]=
- "UPDATE mysql.user SET Password = PASSWORD(";
+ "UPDATE mysql.global_priv SET priv=json_set(priv,"
+ "'$.plugin','mysql_native_password',"
+ "'$.authentication_string',PASSWORD(";
static const char update_root_passwd_part2[]=
- ") where User='root';\n";
+ ")) where User='root';\n";
static const char remove_default_user_cmd[]=
"DELETE FROM mysql.user where User='';\n";
static const char allow_remote_root_access_cmd[]=
- "CREATE TEMPORARY TABLE tmp_user LIKE user;\n"
- "INSERT INTO tmp_user SELECT * from user where user='root' "
+ "CREATE TEMPORARY TABLE tmp_user LIKE global_priv;\n"
+ "INSERT INTO tmp_user SELECT * from global_priv where user='root' "
" AND host='localhost';\n"
"UPDATE tmp_user SET host='%';\n"
- "INSERT INTO user SELECT * FROM tmp_user;\n"
+ "INSERT INTO global_priv SELECT * FROM tmp_user;\n"
"DROP TABLE tmp_user;\n";
static const char end_of_script[]="-- end.";
diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc
index 1a3df4f5536..58383df9c56 100644
--- a/sql/mysql_upgrade_service.cc
+++ b/sql/mysql_upgrade_service.cc
@@ -29,6 +29,9 @@
#include <winservice.h>
#include <windows.h>
+#include <string>
+
+extern int upgrade_config_file(const char *myini_path);
/* We're using version APIs */
#pragma comment(lib, "version")
@@ -47,6 +50,8 @@ static char mysqlupgrade_path[MAX_PATH];
static char defaults_file_param[MAX_PATH + 16]; /*--defaults-file=<path> */
static char logfile_path[MAX_PATH];
+char my_ini_bck[MAX_PATH];
+mysqld_service_properties service_properties;
static char *opt_service;
static SC_HANDLE service;
static SC_HANDLE scm;
@@ -59,7 +64,7 @@ HANDLE logfile_handle;
Maybe,they can be made parameters
*/
static unsigned int startup_timeout= 60;
-static unsigned int shutdown_timeout= 60;
+static unsigned int shutdown_timeout= 60*60;
static struct my_option my_long_options[]=
{
@@ -112,6 +117,7 @@ static void die(const char *fmt, ...)
fprintf(stderr, "FATAL ERROR: ");
vfprintf(stderr, fmt, args);
+ fputc('\n', stderr);
if (logfile_path[0])
{
fprintf(stderr, "Additional information can be found in the log file %s",
@@ -122,6 +128,11 @@ static void die(const char *fmt, ...)
fflush(stdout);
/* Cleanup */
+ if (my_ini_bck[0])
+ {
+ MoveFileEx(my_ini_bck, service_properties.inifile,MOVEFILE_REPLACE_EXISTING);
+ }
+
/*
Stop service that we started, if it was not initally running at
program start.
@@ -309,77 +320,76 @@ void initiate_mysqld_shutdown()
}
}
-
-/*
- Change service configuration (binPath) to point to mysqld from
- this installation.
-*/
-static void change_service_config()
+static void get_service_config()
{
-
- char defaults_file[MAX_PATH];
- char default_character_set[64];
- char buf[MAX_PATH];
- char commandline[3*MAX_PATH + 19];
- int i;
-
- scm= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
- if(!scm)
+ scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+ if (!scm)
die("OpenSCManager failed with %u", GetLastError());
- service= OpenService(scm, opt_service, SERVICE_ALL_ACCESS);
+ service = OpenService(scm, opt_service, SERVICE_ALL_ACCESS);
if (!service)
die("OpenService failed with %u", GetLastError());
- BYTE config_buffer[8*1024];
- LPQUERY_SERVICE_CONFIGW config= (LPQUERY_SERVICE_CONFIGW)config_buffer;
- DWORD size= sizeof(config_buffer);
+ BYTE config_buffer[8 * 1024];
+ LPQUERY_SERVICE_CONFIGW config = (LPQUERY_SERVICE_CONFIGW)config_buffer;
+ DWORD size = sizeof(config_buffer);
DWORD needed;
if (!QueryServiceConfigW(service, config, size, &needed))
die("QueryServiceConfig failed with %u", GetLastError());
- mysqld_service_properties props;
- if (get_mysql_service_properties(config->lpBinaryPathName, &props))
+ if (get_mysql_service_properties(config->lpBinaryPathName, &service_properties))
{
die("Not a valid MySQL service");
}
- int my_major= MYSQL_VERSION_ID/10000;
- int my_minor= (MYSQL_VERSION_ID %10000)/100;
- int my_patch= MYSQL_VERSION_ID%100;
+ int my_major = MYSQL_VERSION_ID / 10000;
+ int my_minor = (MYSQL_VERSION_ID % 10000) / 100;
+ int my_patch = MYSQL_VERSION_ID % 100;
- if(my_major < props.version_major ||
- (my_major == props.version_major && my_minor < props.version_minor))
+ if (my_major < service_properties.version_major ||
+ (my_major == service_properties.version_major && my_minor < service_properties.version_minor))
{
die("Can not downgrade, the service is currently running as version %d.%d.%d"
- ", my version is %d.%d.%d", props.version_major, props.version_minor,
- props.version_patch, my_major, my_minor, my_patch);
+ ", my version is %d.%d.%d", service_properties.version_major, service_properties.version_minor,
+ service_properties.version_patch, my_major, my_minor, my_patch);
}
-
- if(props.inifile[0] == 0)
+ if (service_properties.inifile[0] == 0)
{
/*
Weird case, no --defaults-file in service definition, need to create one.
*/
- sprintf_s(props.inifile, MAX_PATH, "%s\\my.ini", props.datadir);
+ sprintf_s(service_properties.inifile, MAX_PATH, "%s\\my.ini", service_properties.datadir);
}
+ sprintf(defaults_file_param, "--defaults-file=%s", service_properties.inifile);
+}
+/*
+ Change service configuration (binPath) to point to mysqld from
+ this installation.
+*/
+static void change_service_config()
+{
+ char defaults_file[MAX_PATH];
+ char default_character_set[64];
+ char buf[MAX_PATH];
+ char commandline[3 * MAX_PATH + 19];
+ int i;
/*
Write datadir to my.ini, after converting backslashes to
unix style slashes.
*/
- strcpy_s(buf, MAX_PATH, props.datadir);
+ strcpy_s(buf, MAX_PATH, service_properties.datadir);
for(i= 0; buf[i]; i++)
{
if (buf[i] == '\\')
buf[i]= '/';
}
- WritePrivateProfileString("mysqld", "datadir",buf, props.inifile);
+ WritePrivateProfileString("mysqld", "datadir",buf, service_properties.inifile);
/*
Remove basedir from defaults file, otherwise the service wont come up in
the new version, and will complain about mismatched message file.
*/
- WritePrivateProfileString("mysqld", "basedir",NULL, props.inifile);
+ WritePrivateProfileString("mysqld", "basedir",NULL, service_properties.inifile);
/*
Replace default-character-set with character-set-server, to avoid
@@ -397,7 +407,7 @@ static void change_service_config()
default_character_set, defaults_file);
}
- sprintf(defaults_file_param,"--defaults-file=%s", props.inifile);
+ sprintf(defaults_file_param,"--defaults-file=%s", service_properties.inifile);
sprintf_s(commandline, "\"%s\" \"%s\" \"%s\"", mysqld_path,
defaults_file_param, opt_service);
if (!ChangeServiceConfig(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
@@ -449,23 +459,97 @@ int main(int argc, char **argv)
reads them from pipe and uses as progress indicator.
*/
setvbuf(stdout, NULL, _IONBF, 0);
+ int phase = 0;
+ int max_phases=10;
+ get_service_config();
- log("Phase 1/8: Changing service configuration");
- change_service_config();
+ bool my_ini_exists;
+ bool old_mysqld_exe_exists;
- log("Phase 2/8: Stopping service");
+ log("Phase %d/%d: Stopping service", ++phase,max_phases);
stop_mysqld_service();
+ my_ini_exists = (GetFileAttributes(service_properties.inifile) != INVALID_FILE_ATTRIBUTES);
+ if (!my_ini_exists)
+ {
+ HANDLE h = CreateFile(service_properties.inifile, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
+ 0, CREATE_NEW, 0 ,0);
+ if (h != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(h);
+ }
+ else if (GetLastError() != ERROR_FILE_EXISTS)
+ {
+ die("Can't create ini file %s, last error %u", service_properties.inifile, GetLastError());
+ }
+ }
+
+ old_mysqld_exe_exists = (GetFileAttributes(service_properties.mysqld_exe) != INVALID_FILE_ATTRIBUTES);
+ log("Phase %d/%d: Fixing server config file%s", ++phase, max_phases, my_ini_exists ? "" : "(skipped)");
+
+ snprintf(my_ini_bck, sizeof(my_ini_bck), "%s.BCK", service_properties.inifile);
+ CopyFile(service_properties.inifile, my_ini_bck, FALSE);
+ upgrade_config_file(service_properties.inifile);
+
+ log("Phase %d/%d: Ensuring innodb slow shutdown%s", ++phase, max_phases,
+ old_mysqld_exe_exists?",this can take some time":"(skipped)");
+
+ char socket_param[FN_REFLEN];
+ sprintf_s(socket_param, "--socket=mysql_upgrade_service_%u",
+ GetCurrentProcessId());
+
+ DWORD start_duration_ms = 0;
+
+ if (old_mysqld_exe_exists)
+ {
+ /* Start/stop server with --loose-innodb-fast-shutdown=0 */
+ mysqld_process = (HANDLE)run_tool(P_NOWAIT, service_properties.mysqld_exe,
+ defaults_file_param, "--loose-innodb-fast-shutdown=0", "--skip-networking",
+ "--enable-named-pipe", socket_param, "--skip-slave-start", NULL);
+
+ if (mysqld_process == INVALID_HANDLE_VALUE)
+ {
+ die("Cannot start mysqld.exe process, last error =%u", GetLastError());
+ }
+ char pipe_name[64];
+ snprintf(pipe_name, sizeof(pipe_name), "\\\\.\\pipe\\mysql_upgrade_service_%u",
+ GetCurrentProcessId());
+ for (;;)
+ {
+ if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT)
+ die("mysqld.exe did not start");
+
+ if (WaitNamedPipe(pipe_name, 0))
+ {
+ // Server started, shut it down.
+ initiate_mysqld_shutdown();
+ if (WaitForSingleObject((HANDLE)mysqld_process, shutdown_timeout * 1000) != WAIT_OBJECT_0)
+ {
+ die("Could not shutdown server started with '--innodb-fast-shutdown=0'");
+ }
+ DWORD exit_code;
+ if (!GetExitCodeProcess((HANDLE)mysqld_process, &exit_code))
+ {
+ die("Could not get mysqld's exit code");
+ }
+ if (exit_code)
+ {
+ die("Could not get successfully shutdown mysqld");
+ }
+ CloseHandle(mysqld_process);
+ break;
+ }
+ Sleep(500);
+ start_duration_ms += 500;
+ }
+ }
/*
Start mysqld.exe as non-service skipping privileges (so we do not
care about the password). But disable networking and enable pipe
for communication, for security reasons.
*/
- char socket_param[FN_REFLEN];
- sprintf_s(socket_param,"--socket=mysql_upgrade_service_%d",
- GetCurrentProcessId());
- log("Phase 3/8: Starting mysqld for upgrade");
+ log("Phase %d/%d: Starting mysqld for upgrade",++phase,max_phases);
mysqld_process= (HANDLE)run_tool(P_NOWAIT, mysqld_path,
defaults_file_param, "--skip-networking", "--skip-grant-tables",
"--enable-named-pipe", socket_param,"--skip-slave-start", NULL);
@@ -475,8 +559,8 @@ int main(int argc, char **argv)
die("Cannot start mysqld.exe process, errno=%d", errno);
}
- log("Phase 4/8: Waiting for startup to complete");
- DWORD start_duration_ms= 0;
+ log("Phase %d/%d: Waiting for startup to complete",++phase,max_phases);
+ start_duration_ms= 0;
for(;;)
{
if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT)
@@ -493,7 +577,7 @@ int main(int argc, char **argv)
start_duration_ms+= 500;
}
- log("Phase 5/8: Running mysql_upgrade");
+ log("Phase %d/%d: Running mysql_upgrade",++phase,max_phases);
int upgrade_err= (int) run_tool(P_WAIT, mysqlupgrade_path,
"--protocol=pipe", "--force", socket_param,
NULL);
@@ -501,10 +585,13 @@ int main(int argc, char **argv)
if (upgrade_err)
die("mysql_upgrade failed with error code %d\n", upgrade_err);
- log("Phase 6/8: Initiating server shutdown");
+ log("Phase %d/%d: Changing service configuration", ++phase, max_phases);
+ change_service_config();
+
+ log("Phase %d/%d: Initiating server shutdown",++phase, max_phases);
initiate_mysqld_shutdown();
- log("Phase 7/8: Waiting for shutdown to complete");
+ log("Phase %d/%d: Waiting for shutdown to complete",++phase, max_phases);
if (WaitForSingleObject(mysqld_process, shutdown_timeout*1000)
!= WAIT_OBJECT_0)
{
@@ -514,7 +601,7 @@ int main(int argc, char **argv)
CloseHandle(mysqld_process);
mysqld_process= NULL;
- log("Phase 8/8: Starting service%s",
+ log("Phase %d/%d: Starting service%s",++phase,max_phases,
(initial_service_state == SERVICE_RUNNING)?"":" (skipped)");
if (initial_service_state == SERVICE_RUNNING)
{
@@ -527,6 +614,10 @@ int main(int argc, char **argv)
CloseServiceHandle(scm);
if (logfile_handle)
CloseHandle(logfile_handle);
+ if(my_ini_bck[0])
+ {
+ DeleteFile(my_ini_bck);
+ }
my_end(0);
exit(0);
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 9ff47dc1ff1..3d44d6078df 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -72,8 +72,10 @@
#include "debug_sync.h"
#include "wsrep_mysqld.h"
#include "wsrep_var.h"
+#ifdef WITH_WSREP
#include "wsrep_thd.h"
#include "wsrep_sst.h"
+#endif /* WITH_WSREP */
#include "proxy_protocol.h"
#include "sql_callback.h"
@@ -127,7 +129,7 @@
/* We have HAVE_valgrind below as this speeds up the shutdown of MySQL */
-#if defined(SIGNALS_DONT_BREAK_READ) || defined(HAVE_valgrind) && defined(__linux__)
+#if defined(HAVE_valgrind) && defined(__linux__)
#define HAVE_CLOSE_SERVER_SOCK 1
#endif
@@ -343,7 +345,6 @@ PSI_statement_info stmt_info_rpl;
static bool lower_case_table_names_used= 0;
static bool max_long_data_size_used= false;
static bool volatile select_thread_in_use, signal_thread_in_use;
-static volatile bool ready_to_exit;
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
static my_bool opt_short_log_format= 0, opt_silent_startup= 0;
bool my_disable_leak_check= false;
@@ -393,25 +394,10 @@ bool opt_endinfo, using_udf_functions;
my_bool locked_in_memory;
bool opt_using_transactions;
bool volatile abort_loop;
-bool volatile shutdown_in_progress;
uint volatile global_disable_checkpoint;
#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
ulong slow_start_timeout;
#endif
-/*
- True if the bootstrap thread is running. Protected by LOCK_start_thread.
- Used in bootstrap() function to determine if the bootstrap thread
- has completed. Note, that we can't use 'thread_count' instead,
- since in 5.1, in presence of the Event Scheduler, there may be
- event threads running in parallel, so it's impossible to know
- what value of 'thread_count' is a sign of completion of the
- bootstrap thread.
-
- At the same time, we can't start the event scheduler after
- bootstrap either, since we want to be able to process event-related
- SQL commands in the init file and in --bootstrap mode.
-*/
-bool volatile in_bootstrap= FALSE;
/**
@brief 'grant_option' is used to indicate if privileges needs
to be checked, in which case the lock, LOCK_grant, is used
@@ -479,7 +465,7 @@ ulong delay_key_write_options;
uint protocol_version;
uint lower_case_table_names;
ulong tc_heuristic_recover= 0;
-int32 thread_count, service_thread_count;
+Atomic_counter<uint32_t> thread_count;
int32 slave_open_temp_tables;
ulong thread_created;
ulong back_log, connect_timeout, concurrency, server_id;
@@ -513,6 +499,7 @@ ulong specialflag=0;
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
ulong max_connections, max_connect_errors;
+uint max_password_errors;
ulong extra_max_connections;
uint max_digest_length= 0;
ulong slave_retried_transactions;
@@ -568,6 +555,7 @@ ulong opt_binlog_commit_wait_count= 0;
ulong opt_binlog_commit_wait_usec= 0;
ulong opt_slave_parallel_max_queued= 131072;
my_bool opt_gtid_ignore_duplicates= FALSE;
+uint opt_gtid_cleanup_batch_size= 64;
const double log_10[] = {
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009,
@@ -659,29 +647,13 @@ Lt_creator lt_creator;
Ge_creator ge_creator;
Le_creator le_creator;
-MYSQL_FILE *bootstrap_file;
int bootstrap_error;
-I_List<THD> threads;
+THD_list server_threads;
Rpl_filter* cur_rpl_filter;
Rpl_filter* global_rpl_filter;
Rpl_filter* binlog_filter;
-THD *first_global_thread()
-{
- if (threads.is_empty())
- return NULL;
- return threads.head();
-}
-
-THD *next_global_thread(THD *thd)
-{
- if (threads.is_last(thd))
- return NULL;
- struct ilink *next= thd->next;
- return static_cast<THD*>(next);
-}
-
struct system_variables global_system_variables;
/**
Following is just for options parsing, used with a difference against
@@ -711,20 +683,13 @@ SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_profiling;
SHOW_COMP_OPTION have_openssl;
+static std::atomic<char*> shutdown_user;
+
/* Thread specific variables */
pthread_key(THD*, THR_THD);
-/*
- LOCK_thread_count protects the following variables:
- thread_count Number of threads with THD that servers queries.
- threads Linked list of active THD's.
- The effect of this is that one can't unlink and
- delete a THD as long as one has locked
- LOCK_thread_count.
- ready_to_exit
- delayed_insert_threads
-*/
+/** To be removed */
mysql_mutex_t LOCK_thread_count;
/*
@@ -732,7 +697,6 @@ mysql_mutex_t LOCK_thread_count;
other threads.
It also protects these variables:
- in_bootstrap
select_thread_in_use
slave_init_thread_running
check_temp_dir() call
@@ -741,13 +705,12 @@ mysql_mutex_t LOCK_start_thread;
mysql_mutex_t LOCK_thread_cache;
mysql_mutex_t
- LOCK_status, LOCK_show_status, LOCK_error_log, LOCK_short_uuid_generator,
+ LOCK_status, LOCK_error_log, LOCK_short_uuid_generator,
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
LOCK_crypt,
LOCK_global_system_variables,
LOCK_user_conn, LOCK_slave_list,
LOCK_connection_count, LOCK_error_messages, LOCK_slave_background;
-
mysql_mutex_t LOCK_stats, LOCK_global_user_client_stats,
LOCK_global_table_stats, LOCK_global_index_stats;
@@ -769,6 +732,8 @@ mysql_mutex_t LOCK_prepared_stmt_count;
mysql_mutex_t LOCK_des_key_file;
#endif
mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
+mysql_rwlock_t LOCK_ssl_refresh;
+mysql_rwlock_t LOCK_all_status_vars;
mysql_prlock_t LOCK_system_variables_hash;
mysql_cond_t COND_thread_count, COND_start_thread;
pthread_t signal_thread;
@@ -790,7 +755,6 @@ char *opt_binlog_index_name=0;
/* Static variables */
-static volatile sig_atomic_t kill_in_progress;
my_bool opt_stack_trace;
my_bool opt_expect_abort= 0, opt_bootstrap= 0;
static my_bool opt_myisam_log;
@@ -910,7 +874,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_LOCK_manager,
key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started,
- key_LOCK_status, key_LOCK_show_status,
+ key_LOCK_status,
key_LOCK_system_variables_hash, key_LOCK_thd_data, key_LOCK_thd_kill,
key_LOCK_user_conn, key_LOCK_uuid_short_generator, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
@@ -919,7 +883,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_rpl_group_info_sleep_lock,
key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
- key_LOCK_error_messages, key_LOG_INFO_lock,
+ key_LOCK_error_messages,
key_LOCK_start_thread,
key_LOCK_thread_count, key_LOCK_thread_cache,
key_PARTITION_LOCK_auto_inc;
@@ -982,7 +946,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_rpl_status, "LOCK_rpl_status", PSI_FLAG_GLOBAL},
{ &key_LOCK_server_started, "LOCK_server_started", PSI_FLAG_GLOBAL},
{ &key_LOCK_status, "LOCK_status", PSI_FLAG_GLOBAL},
- { &key_LOCK_show_status, "LOCK_show_status", PSI_FLAG_GLOBAL},
{ &key_LOCK_system_variables_hash, "LOCK_system_variables_hash", PSI_FLAG_GLOBAL},
{ &key_LOCK_stats, "LOCK_stats", PSI_FLAG_GLOBAL},
{ &key_LOCK_global_user_client_stats, "LOCK_global_user_client_stats", PSI_FLAG_GLOBAL},
@@ -1014,7 +977,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_after_binlog_sync, "LOCK_after_binlog_sync", PSI_FLAG_GLOBAL},
{ &key_LOCK_commit_ordered, "LOCK_commit_ordered", PSI_FLAG_GLOBAL},
{ &key_LOCK_slave_background, "LOCK_slave_background", PSI_FLAG_GLOBAL},
- { &key_LOG_INFO_lock, "LOG_INFO::lock", 0},
{ &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL},
{ &key_PARTITION_LOCK_auto_inc, "HA_DATA_PARTITION::LOCK_auto_inc", 0},
@@ -1032,7 +994,10 @@ PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave,
key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock,
key_LOCK_SEQUENCE,
- key_rwlock_LOCK_vers_stats, key_rwlock_LOCK_stat_serial;
+ key_rwlock_LOCK_vers_stats, key_rwlock_LOCK_stat_serial,
+ key_rwlock_LOCK_ssl_refresh,
+ key_rwlock_THD_list,
+ key_rwlock_LOCK_all_status_vars;
static PSI_rwlock_info all_server_rwlocks[]=
{
@@ -1047,7 +1012,10 @@ static PSI_rwlock_info all_server_rwlocks[]=
{ &key_rwlock_LOCK_system_variables_hash, "LOCK_system_variables_hash", PSI_FLAG_GLOBAL},
{ &key_rwlock_query_cache_query_lock, "Query_cache_query::lock", 0},
{ &key_rwlock_LOCK_vers_stats, "Vers_field_stats::lock", 0},
- { &key_rwlock_LOCK_stat_serial, "TABLE_SHARE::LOCK_stat_serial", 0}
+ { &key_rwlock_LOCK_stat_serial, "TABLE_SHARE::LOCK_stat_serial", 0},
+ { &key_rwlock_LOCK_ssl_refresh, "LOCK_ssl_refresh", PSI_FLAG_GLOBAL },
+ { &key_rwlock_THD_list, "THD_list::lock", PSI_FLAG_GLOBAL },
+ { &key_rwlock_LOCK_all_status_vars, "LOCK_all_status_vars", PSI_FLAG_GLOBAL }
};
#ifdef HAVE_MMAP
@@ -1298,10 +1266,10 @@ void Buffered_log::print()
switch(m_level)
{
case ERROR_LEVEL:
- sql_print_error("Buffered error: %s\n", m_message.c_ptr_safe());
+ sql_print_error("Buffered error: %s", m_message.c_ptr_safe());
break;
case WARNING_LEVEL:
- sql_print_warning("Buffered warning: %s\n", m_message.c_ptr_safe());
+ sql_print_warning("Buffered warning: %s", m_message.c_ptr_safe());
break;
case INFORMATION_LEVEL:
/*
@@ -1534,8 +1502,6 @@ static int fix_paths(void);
void handle_connections_sockets();
#endif
-pthread_handler_t kill_server_thread(void *arg);
-static void bootstrap(MYSQL_FILE *file);
static bool read_init_file(char *file_name);
pthread_handler_t handle_slave(void *arg);
static void clean_up(bool print_message);
@@ -1560,20 +1526,129 @@ static void end_ssl();
** Code to end mysqld
****************************************************************************/
-static void close_connections(void)
+static my_bool kill_all_threads(THD *thd, void *)
+{
+ DBUG_PRINT("quit", ("Informing thread %ld that it's time to die",
+ (ulong) thd->thread_id));
+ /* We skip slave threads on this first loop through. */
+ if (thd->slave_thread)
+ return 0;
+
+ if (DBUG_EVALUATE_IF("only_kill_system_threads", !thd->system_thread, 0))
+ return 0;
+
+#ifdef WITH_WSREP
+ /* skip wsrep system threads as well */
+ if (WSREP(thd) && (wsrep_thd_is_applying(thd) || thd->wsrep_applier))
+ return 0;
+#endif
+ thd->set_killed(KILL_SERVER_HARD);
+ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (thd));
+ if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
+ mysql_mutex_lock(&thd->LOCK_thd_kill);
+ if (thd->mysys_var)
+ {
+ thd->mysys_var->abort= 1;
+ mysql_mutex_lock(&thd->mysys_var->mutex);
+ if (thd->mysys_var->current_cond)
+ {
+ for (uint i= 0; i < 2; i++)
+ {
+ int ret= mysql_mutex_trylock(thd->mysys_var->current_mutex);
+ mysql_cond_broadcast(thd->mysys_var->current_cond);
+ if (!ret)
+ {
+ /* Thread has surely got the signal, unlock and abort */
+ mysql_mutex_unlock(thd->mysys_var->current_mutex);
+ break;
+ }
+ sleep(1);
+ }
+ }
+ mysql_mutex_unlock(&thd->mysys_var->mutex);
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_kill);
+ if (WSREP(thd)) mysql_mutex_unlock(&thd->LOCK_thd_data);
+ return 0;
+}
+
+
+static my_bool kill_all_threads_once_again(THD *thd, void *)
+{
+#ifndef __bsdi__ // Bug in BSDI kernel
+ if (thd->vio_ok())
+ {
+ if (global_system_variables.log_warnings)
+ sql_print_warning(ER_DEFAULT(ER_FORCING_CLOSE), my_progname,
+ (ulong) thd->thread_id,
+ (thd->main_security_ctx.user ?
+ thd->main_security_ctx.user : ""));
+ /*
+ close_connection() might need a valid current_thd
+ for memory allocation tracking.
+ */
+ THD *save_thd= current_thd;
+ set_current_thd(thd);
+ close_connection(thd, ER_SERVER_SHUTDOWN);
+ set_current_thd(save_thd);
+ }
+#endif
+
+#ifdef WITH_WSREP
+ /*
+ * WSREP_TODO:
+ * this code block may turn out redundant. wsrep->disconnect()
+ * should terminate slave threads gracefully, and we don't need
+ * to signal them here.
+ * The code here makes sure mysqld will not hang during shutdown
+ * even if wsrep provider has problems in shutting down.
+ */
+ if (WSREP(thd) && wsrep_thd_is_applying(thd))
+ {
+ sql_print_information("closing wsrep system thread");
+ thd->set_killed(KILL_CONNECTION);
+ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (thd));
+ if (thd->mysys_var)
+ {
+ thd->mysys_var->abort=1;
+ mysql_mutex_lock(&thd->mysys_var->mutex);
+ if (thd->mysys_var->current_cond)
+ {
+ mysql_mutex_lock(thd->mysys_var->current_mutex);
+ mysql_cond_broadcast(thd->mysys_var->current_cond);
+ mysql_mutex_unlock(thd->mysys_var->current_mutex);
+ }
+ mysql_mutex_unlock(&thd->mysys_var->mutex);
+ }
+ }
+#endif
+ return 0;
+}
+
+
+/**
+ Kills main thread.
+
+ @note this function is responsible for setting abort_loop and breaking
+ poll() in main thread. Shutdown as such is supposed to be performed by main
+ thread itself.
+*/
+
+static void break_connect_loop()
{
#ifdef EXTRA_DEBUG
int count=0;
#endif
- DBUG_ENTER("close_connections");
-
- /* Clear thread cache */
- kill_cached_threads++;
- flush_thread_cache();
+ abort_loop= 1;
- /* kill connection thread */
-#if !defined(__WIN__)
+#if defined(__WIN__)
+ if (!SetEvent(hEventShutdown))
+ DBUG_PRINT("error", ("Got error: %ld from SetEvent", GetLastError()));
+#else
+ /* Avoid waiting for ourselves when thread-handling=no-threads. */
+ if (pthread_equal(pthread_self(), select_thread))
+ return;
DBUG_PRINT("quit", ("waiting for select thread: %lu",
(ulong)select_thread));
@@ -1594,7 +1669,7 @@ static void close_connections(void)
error= mysql_cond_timedwait(&COND_start_thread, &LOCK_start_thread,
&abstime);
if (error != EINTR)
- break;
+ break;
}
#ifdef EXTRA_DEBUG
if (error != 0 && error != ETIMEDOUT && !count++)
@@ -1604,7 +1679,43 @@ static void close_connections(void)
}
mysql_mutex_unlock(&LOCK_start_thread);
#endif /* __WIN__ */
+}
+
+
+/**
+ A wrapper around kill_main_thrad().
+
+ Sets shutdown user. This function may be called by multiple threads
+ concurrently, thus it performs safe update of shutdown_user
+ (first thread wins).
+*/
+void kill_mysql(THD *thd)
+{
+ char user_host_buff[MAX_USER_HOST_SIZE + 1];
+ char *user, *expected_shutdown_user= 0;
+
+ make_user_name(thd, user_host_buff);
+
+ if ((user= my_strdup(user_host_buff, MYF(0))) &&
+ !shutdown_user.compare_exchange_strong(expected_shutdown_user,
+ user,
+ std::memory_order_relaxed,
+ std::memory_order_relaxed))
+ {
+ my_free(user);
+ }
+ break_connect_loop();
+}
+
+
+static void close_connections(void)
+{
+ DBUG_ENTER("close_connections");
+
+ /* Clear thread cache */
+ kill_cached_threads++;
+ flush_thread_cache();
/* Abort listening to new connections */
DBUG_PRINT("quit",("Closing sockets"));
@@ -1637,56 +1748,7 @@ static void close_connections(void)
This will give the threads some time to gracefully abort their
statements and inform their clients that the server is about to die.
*/
-
- THD *tmp;
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
-
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- {
- DBUG_PRINT("quit",("Informing thread %ld that it's time to die",
- (ulong) tmp->thread_id));
- /* We skip slave threads on this first loop through. */
- if (tmp->slave_thread)
- continue;
-
- /* cannot use 'continue' inside DBUG_EXECUTE_IF()... */
- if (DBUG_EVALUATE_IF("only_kill_system_threads", !tmp->system_thread, 0))
- continue;
-
-#ifdef WITH_WSREP
- /* skip wsrep system threads as well */
- if (WSREP(tmp) && (tmp->wsrep_exec_mode==REPL_RECV || tmp->wsrep_applier))
- continue;
-#endif
- tmp->set_killed(KILL_SERVER_HARD);
- MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp));
- mysql_mutex_lock(&tmp->LOCK_thd_kill);
- if (tmp->mysys_var)
- {
- tmp->mysys_var->abort=1;
- mysql_mutex_lock(&tmp->mysys_var->mutex);
- if (tmp->mysys_var->current_cond)
- {
- uint i;
- for (i=0; i < 2; i++)
- {
- int ret= mysql_mutex_trylock(tmp->mysys_var->current_mutex);
- mysql_cond_broadcast(tmp->mysys_var->current_cond);
- if (!ret)
- {
- /* Thread has surely got the signal, unlock and abort */
- mysql_mutex_unlock(tmp->mysys_var->current_mutex);
- break;
- }
- sleep(1);
- }
- }
- mysql_mutex_unlock(&tmp->mysys_var->mutex);
- }
- mysql_mutex_unlock(&tmp->LOCK_thd_kill);
- }
- mysql_mutex_unlock(&LOCK_thread_count); // For unlink from list
+ server_threads.iterate(kill_all_threads);
Events::deinit();
slave_prepare_for_shutdown();
@@ -1707,9 +1769,9 @@ static void close_connections(void)
much smaller than even 2 seconds, this is only a safety fallback against
stuck threads so server shutdown is not held up forever.
*/
- DBUG_PRINT("info", ("thread_count: %d", thread_count));
+ DBUG_PRINT("info", ("thread_count: %u", uint32_t(thread_count)));
- for (int i= 0; *(volatile int32*) &thread_count && i < 1000; i++)
+ for (int i= 0; thread_count && i < 1000; i++)
my_sleep(20000);
/*
@@ -1717,75 +1779,21 @@ static void close_connections(void)
This will ensure that threads that are waiting for a command from the
client on a blocking read call are aborted.
*/
+ server_threads.iterate(kill_all_threads_once_again);
- for (;;)
- {
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
- if (!(tmp=threads.get()))
- {
- mysql_mutex_unlock(&LOCK_thread_count);
- break;
- }
-#ifndef __bsdi__ // Bug in BSDI kernel
- if (tmp->vio_ok())
- {
- if (global_system_variables.log_warnings)
- sql_print_warning(ER_DEFAULT(ER_FORCING_CLOSE),my_progname,
- (ulong) tmp->thread_id,
- (tmp->main_security_ctx.user ?
- tmp->main_security_ctx.user : ""));
- /*
- close_connection() might need a valid current_thd
- for memory allocation tracking.
- */
- THD* save_thd= current_thd;
- set_current_thd(tmp);
- close_connection(tmp,ER_SERVER_SHUTDOWN);
- set_current_thd(save_thd);
- }
-#endif
-
-#ifdef WITH_WSREP
- /*
- * WSREP_TODO:
- * this code block may turn out redundant. wsrep->disconnect()
- * should terminate slave threads gracefully, and we don't need
- * to signal them here.
- * The code here makes sure mysqld will not hang during shutdown
- * even if wsrep provider has problems in shutting down.
- */
- if (WSREP(tmp) && tmp->wsrep_exec_mode==REPL_RECV)
- {
- sql_print_information("closing wsrep system thread");
- tmp->set_killed(KILL_CONNECTION);
- MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp));
- if (tmp->mysys_var)
- {
- tmp->mysys_var->abort=1;
- mysql_mutex_lock(&tmp->mysys_var->mutex);
- if (tmp->mysys_var->current_cond)
- {
- mysql_mutex_lock(tmp->mysys_var->current_mutex);
- mysql_cond_broadcast(tmp->mysys_var->current_cond);
- mysql_mutex_unlock(tmp->mysys_var->current_mutex);
- }
- mysql_mutex_unlock(&tmp->mysys_var->mutex);
- }
- }
-#endif
- DBUG_PRINT("quit",("Unlocking LOCK_thread_count"));
- mysql_mutex_unlock(&LOCK_thread_count);
- }
end_slave();
- /* All threads has now been aborted */
- DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count));
- mysql_mutex_lock(&LOCK_thread_count);
- while (thread_count || service_thread_count)
+#ifdef WITH_WSREP
+ if (wsrep_inited == 1)
{
- mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
- DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
+ wsrep_deinit(true);
}
- mysql_mutex_unlock(&LOCK_thread_count);
+#endif
+ /* All threads has now been aborted */
+ DBUG_PRINT("quit", ("Waiting for threads to die (count=%u)",
+ uint32_t(thread_count)));
+
+ while (thread_count)
+ my_sleep(1000);
DBUG_PRINT("quit",("close_connections thread"));
DBUG_VOID_RETURN;
@@ -1827,145 +1835,6 @@ static void close_server_sock()
#endif /*EMBEDDED_LIBRARY*/
-/**
- Set shutdown user
-
- @note this function may be called by multiple threads concurrently, thus
- it performs safe update of shutdown_user (first thread wins).
-*/
-
-static volatile char *shutdown_user;
-static void set_shutdown_user(THD *thd)
-{
- char user_host_buff[MAX_USER_HOST_SIZE + 1];
- char *user, *expected_shutdown_user= 0;
-
- make_user_name(thd, user_host_buff);
-
- if ((user= my_strdup(user_host_buff, MYF(0))) &&
- !my_atomic_casptr((void **) &shutdown_user,
- (void **) &expected_shutdown_user, user))
- my_free(user);
-}
-
-
-void kill_mysql(THD *thd)
-{
- DBUG_ENTER("kill_mysql");
-
- if (thd)
- set_shutdown_user(thd);
-
-#if defined(SIGNALS_DONT_BREAK_READ) && !defined(EMBEDDED_LIBRARY)
- abort_loop=1; // Break connection loops
- close_server_sock(); // Force accept to wake up
-#endif
-
-#if defined(__WIN__)
-#if !defined(EMBEDDED_LIBRARY)
- {
- if (!SetEvent(hEventShutdown))
- {
- DBUG_PRINT("error",("Got error: %ld from SetEvent",GetLastError()));
- }
- }
-#endif
-#elif defined(HAVE_PTHREAD_KILL)
- if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL))
- {
- DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */
- }
-#elif !defined(SIGNALS_DONT_BREAK_READ)
- kill(current_pid, MYSQL_KILL_SIGNAL);
-#endif
- DBUG_PRINT("quit",("After pthread_kill"));
- shutdown_in_progress=1; // Safety if kill didn't work
-#ifdef SIGNALS_DONT_BREAK_READ
- if (!kill_in_progress)
- {
- pthread_t tmp;
- int error;
- abort_loop=1;
- if (unlikely((error= mysql_thread_create(0, /* Not instrumented */
- &tmp, &connection_attrib,
- kill_server_thread, (void*) 0))))
- sql_print_error("Can't create thread to kill server (errno= %d).",
- error);
- }
-#endif
- DBUG_VOID_RETURN;
-}
-
-/**
- Force server down. Kill all connections and threads and exit.
-
- @param sig Signal number that caused kill_server to be called.
-
- @note
- A signal number of 0 mean that the function was not called
- from a signal handler and there is thus no signal to block
- or stop, we just want to kill the server.
-*/
-
-static void kill_server(int sig)
-{
- DBUG_ENTER("kill_server");
-#ifndef EMBEDDED_LIBRARY
- // if there is a signal during the kill in progress, ignore the other
- if (kill_in_progress) // Safety
- {
- DBUG_VOID_RETURN;
- }
- kill_in_progress=TRUE;
- abort_loop=1; // This should be set
- if (sig != 0) // 0 is not a valid signal number
- my_sigset(sig, SIG_IGN); /* purify inspected */
- if (sig == MYSQL_KILL_SIGNAL || sig == 0)
- {
- char *user= (char *) my_atomic_loadptr((void**) &shutdown_user);
- sql_print_information(ER_DEFAULT(ER_NORMAL_SHUTDOWN), my_progname,
- user ? user : "unknown");
- if (user)
- my_free(user);
- }
- else
- sql_print_error(ER_DEFAULT(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */
-
- /* Stop wsrep threads in case they are running. */
- if (wsrep_running_threads > 0)
- {
- wsrep_stop_replication(NULL);
- }
-
- close_connections();
-
- if (wsrep_inited == 1)
- wsrep_deinit(true);
-
- if (sig != MYSQL_KILL_SIGNAL &&
- sig != 0)
- unireg_abort(1); /* purecov: inspected */
- else
- unireg_end();
-
-#endif /* EMBEDDED_LIBRARY*/
-
- DBUG_VOID_RETURN;
-}
-
-
-#if defined(USE_ONE_SIGNAL_HAND)
-pthread_handler_t kill_server_thread(void *arg __attribute__((unused)))
-{
- my_thread_init(); // Initialize new thread
- kill_server(0);
- my_thread_end();
- pthread_exit(0);
- return 0;
-}
-#endif
-
-
extern "C" sig_handler print_signal_warning(int sig)
{
if (global_system_variables.log_warnings)
@@ -1981,36 +1850,6 @@ extern "C" sig_handler print_signal_warning(int sig)
}
#ifndef EMBEDDED_LIBRARY
-
-static void init_error_log_mutex()
-{
- mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST);
-}
-
-
-static void clean_up_error_log_mutex()
-{
- mysql_mutex_destroy(&LOCK_error_log);
-}
-
-
-/**
- cleanup all memory and end program nicely.
-
- If SIGNALS_DONT_BREAK_READ is defined, this function is called
- by the main thread. To get MySQL to shut down nicely in this case
- (Mac OS X) we have to call exit() instead if pthread_exit().
-
- @note
- This function never returns.
-*/
-void unireg_end(void)
-{
- clean_up(1);
- sd_notify(0, "STATUS=MariaDB server is down");
-}
-
-
extern "C" void unireg_abort(int exit_code)
{
DBUG_ENTER("unireg_abort");
@@ -2018,29 +1857,32 @@ extern "C" void unireg_abort(int exit_code)
if (opt_help)
usage();
if (exit_code)
- sql_print_error("Aborting\n");
+ sql_print_error("Aborting");
/* Don't write more notes to the log to not hide error message */
disable_log_notes= 1;
#ifdef WITH_WSREP
- /* Check if wsrep class is used. If yes, then cleanup wsrep */
- if (wsrep)
+ if (WSREP_ON &&
+ Wsrep_server_state::instance().state() != wsrep::server_state::s_disconnected)
{
/*
This is an abort situation, we cannot expect to gracefully close all
wsrep threads here, we can only diconnect from service
*/
wsrep_close_client_connections(FALSE);
- shutdown_in_progress= 1;
- wsrep->disconnect(wsrep);
+ Wsrep_server_state::instance().disconnect();
WSREP_INFO("Service disconnected.");
wsrep_close_threads(NULL); /* this won't close all threads */
sleep(1); /* so give some time to exit for those which can */
WSREP_INFO("Some threads may fail to exit.");
-
+ }
+ if (WSREP_ON)
+ {
/* In bootstrap mode we deinitialize wsrep here. */
- if (opt_bootstrap && wsrep_inited)
- wsrep_deinit(true);
+ if (opt_bootstrap || wsrep_recovery)
+ {
+ if (wsrep_inited) wsrep_deinit(true);
+ }
}
#endif // WITH_WSREP
@@ -2068,9 +1910,11 @@ static void mysqld_exit(int exit_code)
rpl_deinit_gtid_waiting();
rpl_deinit_gtid_slave_state();
wait_for_signal_thread_to_end();
+#ifdef WITH_WSREP
+ wsrep_deinit_server();
+#endif /* WITH_WSREP */
mysql_audit_finalize();
clean_up_mutexes();
- clean_up_error_log_mutex();
my_end((opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0));
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
shutdown_performance_schema(); // we do it as late as possible
@@ -2095,7 +1939,7 @@ static void mysqld_exit(int exit_code)
#endif /* !EMBEDDED_LIBRARY */
-void clean_up(bool print_message)
+static void clean_up(bool print_message)
{
DBUG_PRINT("exit",("clean_up"));
if (cleanup_done++)
@@ -2194,16 +2038,6 @@ void clean_up(bool print_message)
sys_var_end();
free_charsets();
- /*
- Signal mysqld_main() that it can exit
- do the broadcast inside the lock to ensure that my_end() is not called
- during broadcast()
- */
- mysql_mutex_lock(&LOCK_thread_count);
- ready_to_exit=1;
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
-
my_free(const_cast<char*>(log_bin_basename));
my_free(const_cast<char*>(log_bin_index));
#ifndef EMBEDDED_LIBRARY
@@ -2246,12 +2080,13 @@ static void wait_for_signal_thread_to_end()
static void clean_up_mutexes()
{
DBUG_ENTER("clean_up_mutexes");
+ server_threads.destroy();
mysql_rwlock_destroy(&LOCK_grant);
mysql_mutex_destroy(&LOCK_thread_count);
mysql_mutex_destroy(&LOCK_thread_cache);
mysql_mutex_destroy(&LOCK_start_thread);
mysql_mutex_destroy(&LOCK_status);
- mysql_mutex_destroy(&LOCK_show_status);
+ mysql_rwlock_destroy(&LOCK_all_status_vars);
mysql_mutex_destroy(&LOCK_delayed_insert);
mysql_mutex_destroy(&LOCK_delayed_status);
mysql_mutex_destroy(&LOCK_delayed_create);
@@ -2275,6 +2110,7 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_rpl_status);
#endif /* HAVE_REPLICATION */
mysql_mutex_destroy(&LOCK_active_mi);
+ mysql_rwlock_destroy(&LOCK_ssl_refresh);
mysql_rwlock_destroy(&LOCK_sys_init_connect);
mysql_rwlock_destroy(&LOCK_sys_init_slave);
mysql_mutex_destroy(&LOCK_global_system_variables);
@@ -2294,6 +2130,9 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_commit_ordered);
mysql_mutex_destroy(&LOCK_slave_background);
mysql_cond_destroy(&COND_slave_background);
+#ifndef EMBEDDED_LIBRARY
+ mysql_mutex_destroy(&LOCK_error_log);
+#endif
DBUG_VOID_RETURN;
}
@@ -2303,9 +2142,6 @@ static void clean_up_mutexes()
****************************************************************************/
#ifdef EMBEDDED_LIBRARY
-static void set_ports()
-{
-}
void close_connection(THD *thd, uint sql_errno)
{
}
@@ -2729,7 +2565,6 @@ void close_connection(THD *thd, uint sql_errno)
mysql_audit_notify_connection_disconnect(thd, sql_errno);
DBUG_VOID_RETURN;
}
-#endif /* EMBEDDED_LIBRARY */
/** Called when mysqld is aborted with ^C */
@@ -2737,11 +2572,12 @@ void close_connection(THD *thd, uint sql_errno)
extern "C" sig_handler end_mysqld_signal(int sig __attribute__((unused)))
{
DBUG_ENTER("end_mysqld_signal");
- /* Don't call kill_mysql() if signal thread is not running */
+ /* Don't kill if signal thread is not running */
if (signal_thread_in_use)
- kill_mysql(); // Take down mysqld nicely
+ break_connect_loop(); // Take down mysqld nicely
DBUG_VOID_RETURN; /* purecov: deadcode */
}
+#endif /* EMBEDDED_LIBRARY */
/*
Decrease number of connections
@@ -2759,30 +2595,6 @@ void dec_connection_count(scheduler_functions *scheduler)
/*
- Send a signal to unblock close_conneciton() if there is no more
- threads running with a THD attached
-
- It's safe to check for thread_count and service_thread_count outside
- of a mutex as we are only interested to see if they where decremented
- to 0 by a previous unlink_thd() call.
-
- We should only signal COND_thread_count if both variables are 0,
- false positives are ok.
-*/
-
-void signal_thd_deleted()
-{
- if (!thread_count && !service_thread_count)
- {
- /* Signal close_connections() that all THD's are freed */
- mysql_mutex_lock(&LOCK_thread_count);
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
- }
-}
-
-
-/*
Unlink thd from global list of available connections
SYNOPSIS
@@ -2797,14 +2609,16 @@ void unlink_thd(THD *thd)
thd->cleanup();
thd->add_status_to_global();
- unlink_not_visible_thd(thd);
+ server_threads.erase(thd);
+#ifdef WITH_WSREP
/*
Do not decrement when its wsrep system thread. wsrep_applier is set for
applier as well as rollbacker threads.
*/
- if (IF_WSREP(!thd->wsrep_applier, 1))
- dec_connection_count(thd->scheduler);
+ if (!thd->wsrep_applier)
+#endif /* WITH_WSREP */
+ dec_connection_count(thd->scheduler);
thd->free_connection();
@@ -2907,7 +2721,7 @@ static bool cache_thread(THD *thd)
thd->thr_create_utime= microsecond_interval_timer();
thd->start_utime= thd->thr_create_utime;
- add_to_active_threads(thd);
+ server_threads.insert(thd);
DBUG_RETURN(1);
}
}
@@ -3009,7 +2823,7 @@ static BOOL WINAPI console_event_handler( DWORD type )
*/
#ifndef EMBEDDED_LIBRARY
if(hEventShutdown)
- kill_mysql();
+ break_connect_loop();
else
#endif
sql_print_warning("CTRL-C ignored during startup");
@@ -3348,6 +3162,18 @@ static void start_signal_handler(void)
}
+#if defined(USE_ONE_SIGNAL_HAND)
+pthread_handler_t kill_server_thread(void *arg __attribute__((unused)))
+{
+ my_thread_init(); // Initialize new thread
+ break_connect_loop();
+ my_thread_end();
+ pthread_exit(0);
+ return 0;
+}
+#endif
+
+
/** This threads handles all signals and alarms. */
/* ARGSUSED */
pthread_handler_t signal_hand(void *arg __attribute__((unused)))
@@ -3401,14 +3227,10 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
(void) pthread_sigmask(SIG_BLOCK,&set,NULL);
for (;;)
{
- int error; // Used when debugging
- if (shutdown_in_progress && !abort_loop)
- {
- sig= SIGTERM;
- error=0;
- }
- else
- while ((error=my_sigwait(&set,&sig)) == EINTR) ;
+ int error;
+ int origin;
+
+ while ((error= my_sigwait(&set, &sig, &origin)) == EINTR) /* no-op */;
if (cleanup_done)
{
DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
@@ -3431,7 +3253,6 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop));
if (!abort_loop)
{
- abort_loop=1; // mark abort for threads
/* Delete the instrumentation for the signal thread */
PSI_CALL_delete_current_thread();
#ifdef USE_ONE_SIGNAL_HAND
@@ -3443,12 +3264,13 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
sql_print_error("Can't create thread to kill server (errno= %d)",
error);
#else
- kill_server(sig); // MIT THREAD has a alarm thread
+ my_sigset(sig, SIG_IGN);
+ break_connect_loop(); // MIT THREAD has a alarm thread
#endif
}
break;
case SIGHUP:
- if (!abort_loop)
+ if (!abort_loop && origin != SI_KERNEL)
{
int not_used;
mysql_print_status(); // Print some debug info
@@ -3457,21 +3279,14 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
REFRESH_GRANT |
REFRESH_THREADS | REFRESH_HOSTS),
(TABLE_LIST*) 0, &not_used); // Flush logs
- }
- /* reenable logs after the options were reloaded */
- if (log_output_options & LOG_NONE)
- {
- logger.set_handlers(LOG_FILE,
- global_system_variables.sql_log_slow ?
- LOG_TABLE : LOG_NONE,
- opt_log ? LOG_TABLE : LOG_NONE);
- }
- else
- {
- logger.set_handlers(LOG_FILE,
- global_system_variables.sql_log_slow ?
- log_output_options : LOG_NONE,
- opt_log ? log_output_options : LOG_NONE);
+
+ /* reenable logs after the options were reloaded */
+ ulonglong fixed_log_output_options=
+ log_output_options & LOG_NONE ? LOG_TABLE : log_output_options;
+
+ logger.set_handlers(LOG_FILE, global_system_variables.sql_log_slow
+ ? fixed_log_output_options : LOG_NONE,
+ opt_log ? fixed_log_output_options : LOG_NONE);
}
break;
#ifdef USE_ONE_SIGNAL_HAND
@@ -3666,6 +3481,8 @@ SHOW_VAR com_status_vars[]= {
{"alter_user", STMT_STATUS(SQLCOM_ALTER_USER)},
{"analyze", STMT_STATUS(SQLCOM_ANALYZE)},
{"assign_to_keycache", STMT_STATUS(SQLCOM_ASSIGN_TO_KEYCACHE)},
+ {"backup", STMT_STATUS(SQLCOM_BACKUP)},
+ {"backup_lock", STMT_STATUS(SQLCOM_BACKUP_LOCK)},
{"begin", STMT_STATUS(SQLCOM_BEGIN)},
{"binlog", STMT_STATUS(SQLCOM_BINLOG_BASE64_EVENT)},
{"call_procedure", STMT_STATUS(SQLCOM_CALL)},
@@ -3961,9 +3778,28 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
else
update_global_memory_status(size);
}
+
+int json_escape_string(const char *str,const char *str_end,
+ char *json, char *json_end)
+{
+ return json_escape(system_charset_info,
+ (const uchar *) str, (const uchar *) str_end,
+ &my_charset_utf8mb4_bin,
+ (uchar *) json, (uchar *) json_end);
}
+int json_unescape_json(const char *json_str, const char *json_end,
+ char *res, char *res_end)
+{
+ return json_unescape(&my_charset_utf8mb4_bin,
+ (const uchar *) json_str, (const uchar *) json_end,
+ system_charset_info, (uchar *) res, (uchar *) res_end);
+}
+
+} /*extern "C"*/
+
+
/**
Create a replication file name or base for file names.
@@ -4609,11 +4445,11 @@ static int init_common_variables()
static int init_thread_environment()
{
DBUG_ENTER("init_thread_environment");
+ server_threads.init();
mysql_mutex_init(key_LOCK_thread_count, &LOCK_thread_count, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_thread_cache, &LOCK_thread_cache, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_start_thread, &LOCK_start_thread, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_status, &LOCK_status, MY_MUTEX_INIT_FAST);
- mysql_mutex_init(key_LOCK_show_status, &LOCK_show_status, MY_MUTEX_INIT_SLOW);
mysql_mutex_init(key_LOCK_delayed_insert,
&LOCK_delayed_insert, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_delayed_status,
@@ -4626,7 +4462,6 @@ static int init_thread_environment()
mysql_mutex_init(key_LOCK_global_system_variables,
&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
mysql_mutex_record_order(&LOCK_active_mi, &LOCK_global_system_variables);
- mysql_mutex_record_order(&LOCK_status, &LOCK_thread_count);
mysql_prlock_init(key_rwlock_LOCK_system_variables_hash,
&LOCK_system_variables_hash);
mysql_mutex_init(key_LOCK_prepared_stmt_count,
@@ -4673,8 +4508,10 @@ static int init_thread_environment()
#endif /* HAVE_OPENSSL */
mysql_rwlock_init(key_rwlock_LOCK_sys_init_connect, &LOCK_sys_init_connect);
mysql_rwlock_init(key_rwlock_LOCK_sys_init_slave, &LOCK_sys_init_slave);
+ mysql_rwlock_init(key_rwlock_LOCK_ssl_refresh, &LOCK_ssl_refresh);
mysql_rwlock_init(key_rwlock_LOCK_grant, &LOCK_grant);
mysql_cond_init(key_COND_thread_count, &COND_thread_count, NULL);
+ mysql_rwlock_init(key_rwlock_LOCK_all_status_vars, &LOCK_all_status_vars);
mysql_cond_init(key_COND_thread_cache, &COND_thread_cache, NULL);
mysql_cond_init(key_COND_start_thread, &COND_start_thread, NULL);
mysql_cond_init(key_COND_flush_thread_cache, &COND_flush_thread_cache, NULL);
@@ -4766,6 +4603,60 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
}
#endif /* HAVE_OPENSSL10 */
+
+struct SSL_ACCEPTOR_STATS
+{
+ long accept;
+ long accept_good;
+ long cache_size;
+ long verify_mode;
+ long verify_depth;
+ long zero;
+ const char *session_cache_mode;
+
+ SSL_ACCEPTOR_STATS():
+ accept(),accept_good(),cache_size(),verify_mode(),verify_depth(),zero(),
+ session_cache_mode("NONE")
+ {
+ }
+
+ void init()
+ {
+ DBUG_ASSERT(ssl_acceptor_fd !=0 && ssl_acceptor_fd->ssl_context != 0);
+ SSL_CTX *ctx= ssl_acceptor_fd->ssl_context;
+ accept= 0;
+ accept_good= 0;
+ verify_mode= SSL_CTX_get_verify_mode(ctx);
+ verify_depth= SSL_CTX_get_verify_depth(ctx);
+ cache_size= SSL_CTX_sess_get_cache_size(ctx);
+ switch (SSL_CTX_get_session_cache_mode(ctx))
+ {
+ case SSL_SESS_CACHE_OFF:
+ session_cache_mode= "OFF"; break;
+ case SSL_SESS_CACHE_CLIENT:
+ session_cache_mode= "CLIENT"; break;
+ case SSL_SESS_CACHE_SERVER:
+ session_cache_mode= "SERVER"; break;
+ case SSL_SESS_CACHE_BOTH:
+ session_cache_mode= "BOTH"; break;
+ case SSL_SESS_CACHE_NO_AUTO_CLEAR:
+ session_cache_mode= "NO_AUTO_CLEAR"; break;
+ case SSL_SESS_CACHE_NO_INTERNAL_LOOKUP:
+ session_cache_mode= "NO_INTERNAL_LOOKUP"; break;
+ default:
+ session_cache_mode= "Unknown"; break;
+ }
+ }
+};
+
+static SSL_ACCEPTOR_STATS ssl_acceptor_stats;
+void ssl_acceptor_stats_update(int sslaccept_ret)
+{
+ statistic_increment(ssl_acceptor_stats.accept, &LOCK_status);
+ if (!sslaccept_ret)
+ statistic_increment(ssl_acceptor_stats.accept_good,&LOCK_status);
+}
+
static void init_ssl()
{
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
@@ -4786,6 +4677,9 @@ static void init_ssl()
opt_use_ssl = 0;
have_ssl= SHOW_OPTION_DISABLED;
}
+ else
+ ssl_acceptor_stats.init();
+
if (global_system_variables.log_warnings > 0)
{
ulong err;
@@ -4804,6 +4698,34 @@ static void init_ssl()
#endif /* HAVE_OPENSSL && ! EMBEDDED_LIBRARY */
}
+/* Reinitialize SSL (FLUSH SSL) */
+int reinit_ssl()
+{
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+ if (!opt_use_ssl)
+ return 0;
+
+ enum enum_ssl_init_error error = SSL_INITERR_NOERROR;
+ st_VioSSLFd *new_fd = new_VioSSLAcceptorFd(opt_ssl_key, opt_ssl_cert,
+ opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher, &error, opt_ssl_crl, opt_ssl_crlpath);
+
+ if (!new_fd)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, "Failed to refresh SSL, error: %s", MYF(0),
+ sslGetErrString(error));
+#ifndef HAVE_YASSL
+ ERR_clear_error();
+#endif
+ return 1;
+ }
+ mysql_rwlock_wrlock(&LOCK_ssl_refresh);
+ free_vio_ssl_acceptor_fd(ssl_acceptor_fd);
+ ssl_acceptor_fd= new_fd;
+ ssl_acceptor_stats.init();
+ mysql_rwlock_unlock(&LOCK_ssl_refresh);
+#endif
+ return 0;
+}
static void end_ssl()
{
@@ -4934,6 +4856,7 @@ static int init_server_components()
my_rnd_init(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
setup_fpu();
init_thr_lock();
+ backup_init();
#ifndef EMBEDDED_LIBRARY
if (init_thr_timer(thread_scheduler->max_threads + extra_max_connections))
@@ -5131,7 +5054,9 @@ static int init_server_components()
wsrep_thr_init();
#endif
- if (WSREP_ON && !wsrep_recovery && !opt_abort) /* WSREP BEFORE SE */
+#ifdef WITH_WSREP
+ if (wsrep_init_server()) unireg_abort(1);
+ if (WSREP_ON && !wsrep_recovery && !opt_abort)
{
if (opt_bootstrap) // bootsrap option given - disable wsrep functionality
{
@@ -5164,6 +5089,7 @@ static int init_server_components()
}
}
}
+#endif /* WITH_WSREP */
if (opt_bin_log)
{
@@ -5372,7 +5298,8 @@ static int init_server_components()
initialized. This initialization was not possible before, as plugins
(and thus some global system variables) are initialized after wsrep
startup threads are created.
- Note: This only needs to be done for rsync, xtrabackup based SST methods.
+ Note: This only needs to be done for rsync and mariabackup based SST
+ methods.
*/
if (wsrep_before_SE())
wsrep_plugins_post_init();
@@ -5653,7 +5580,7 @@ int mysqld_main(int argc, char **argv)
}
#endif /* HAVE_PSI_INTERFACE */
- init_error_log_mutex();
+ mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST);
/* Initialize audit interface globals. Audit plugins are inited later. */
mysql_audit_initialize();
@@ -5740,8 +5667,7 @@ int mysqld_main(int argc, char **argv)
set_user(mysqld_user, user_info);
}
- if (WSREP_ON && wsrep_check_opts())
- global_system_variables.wsrep_on= 0;
+ if (WSREP_ON && wsrep_check_opts()) unireg_abort(1);
/*
The subsequent calls may take a long time : e.g. innodb log read.
@@ -5791,18 +5717,7 @@ int mysqld_main(int argc, char **argv)
if (mysql_rm_tmp_tables() || acl_init(opt_noacl) ||
my_tz_init((THD *)0, default_tz_name, opt_bootstrap))
- {
- abort_loop=1;
- select_thread_in_use=0;
-
- (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
-
- delete_pid_file(MYF(MY_WME));
-
- if (mysql_socket_getfd(unix_sock) != INVALID_SOCKET)
- unlink(mysqld_unix_port);
- exit(1);
- }
+ unireg_abort(1);
if (!opt_noacl)
(void) grant_init();
@@ -5841,24 +5756,11 @@ int mysqld_main(int argc, char **argv)
}
else
{
- wsrep_SE_initialized();
-
- if (wsrep_before_SE())
- {
- /*! in case of no SST wsrep waits in view handler callback */
- wsrep_SE_init_grab();
- wsrep_SE_init_done();
- /*! in case of SST wsrep waits for wsrep->sst_received */
- if (wsrep_sst_continue())
- {
- WSREP_ERROR("Failed to signal the wsrep provider to continue.");
- }
- }
- else
+ wsrep_init_globals();
+ if (!wsrep_before_SE())
{
wsrep_init_startup (false);
}
-
wsrep_create_appliers(wsrep_slave_threads - 1);
}
}
@@ -5867,7 +5769,7 @@ int mysqld_main(int argc, char **argv)
{
select_thread_in_use= 0; // Allow 'kill' to work
bootstrap(mysql_stdin);
- if (!kill_in_progress)
+ if (!abort_loop)
unireg_abort(bootstrap_error ? 1 : 0);
else
{
@@ -5947,34 +5849,45 @@ int mysqld_main(int argc, char **argv)
#ifdef _WIN32
handle_connections_win();
- kill_server(0);
#else
handle_connections_sockets();
+
+ mysql_mutex_lock(&LOCK_start_thread);
+ select_thread_in_use=0;
+ mysql_cond_broadcast(&COND_start_thread);
+ mysql_mutex_unlock(&LOCK_start_thread);
#endif /* _WIN32 */
+ /* Shutdown requested */
+ char *user= shutdown_user.load(std::memory_order_relaxed);
+ sql_print_information(ER_DEFAULT(ER_NORMAL_SHUTDOWN), my_progname,
+ user ? user : "unknown");
+ if (user)
+ my_free(user);
+
+#ifdef WITH_WSREP
+ /* Stop wsrep threads in case they are running. */
+ if (wsrep_running_threads > 0)
+ {
+ wsrep_shutdown_replication();
+ }
+#endif
+
+ close_connections();
+
+ clean_up(1);
+ sd_notify(0, "STATUS=MariaDB server is down");
+
/* (void) pthread_attr_destroy(&connection_attrib); */
DBUG_PRINT("quit",("Exiting main thread"));
-#ifndef __WIN__
- mysql_mutex_lock(&LOCK_start_thread);
- select_thread_in_use=0; // For close_connections
- mysql_cond_broadcast(&COND_start_thread);
- mysql_mutex_unlock(&LOCK_start_thread);
-#endif /* __WIN__ */
-
/*
Disable the main thread instrumentation,
to avoid recording events during the shutdown.
*/
PSI_CALL_delete_current_thread();
- /* Wait until cleanup is done */
- mysql_mutex_lock(&LOCK_thread_count);
- while (!ready_to_exit)
- mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
-
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
if (start_mode)
Service.Stop();
@@ -6207,54 +6120,6 @@ int mysqld_main(int argc, char **argv)
#endif
-/**
- Execute all commands from a file. Used by the mysql_install_db script to
- create MySQL privilege tables without having to start a full MySQL server
- and by read_init_file() if mysqld was started with the option --init-file.
-*/
-
-static void bootstrap(MYSQL_FILE *file)
-{
- DBUG_ENTER("bootstrap");
-
- THD *thd= new THD(next_thread_id());
-#ifdef WITH_WSREP
- thd->variables.wsrep_on= 0;
-#endif
- thd->bootstrap=1;
- my_net_init(&thd->net,(st_vio*) 0, thd, MYF(0));
- thd->max_client_packet_length= thd->net.max_packet;
- thd->security_ctx->master_access= ~(ulong)0;
- in_bootstrap= TRUE;
-
- bootstrap_file=file;
-#ifndef EMBEDDED_LIBRARY // TODO: Enable this
- int error;
- if ((error= mysql_thread_create(key_thread_bootstrap,
- &thd->real_id, &connection_attrib,
- handle_bootstrap,
- (void*) thd)))
- {
- sql_print_warning("Can't create thread to handle bootstrap (errno= %d)",
- error);
- bootstrap_error=-1;
- delete thd;
- DBUG_VOID_RETURN;
- }
- /* Wait for thread to die */
- mysql_mutex_lock(&LOCK_thread_count);
- while (in_bootstrap)
- mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
-#else
- thd->mysql= 0;
- do_handle_bootstrap(thd);
-#endif
-
- DBUG_VOID_RETURN;
-}
-
-
static bool read_init_file(char *file_name)
{
MYSQL_FILE *file;
@@ -6404,25 +6269,6 @@ void create_new_thread(CONNECT *connect)
#endif /* EMBEDDED_LIBRARY */
-#ifdef SIGNALS_DONT_BREAK_READ
-inline void kill_broken_server()
-{
- /* hack to get around signals ignored in syscalls for problem OS's */
- if (mysql_socket_getfd(unix_sock) == INVALID_SOCKET ||
- (!opt_disable_networking &&
- mysql_socket_getfd(base_ip_sock) == INVALID_SOCKET))
- {
- select_thread_in_use = 0;
- /* The following call will never return */
- DBUG_PRINT("general", ("killing server because socket is closed"));
- kill_server((void*) MYSQL_KILL_SIGNAL);
- }
-}
-#define MAYBE_BROKEN_SYSCALL kill_broken_server();
-#else
-#define MAYBE_BROKEN_SYSCALL
-#endif
-
/* Handle new connections and spawn new process to handle them */
#ifndef EMBEDDED_LIBRARY
@@ -6565,7 +6411,6 @@ void handle_connections_sockets()
"STATUS=Taking your SQL requests now...\n");
DBUG_PRINT("general",("Waiting for connections."));
- MAYBE_BROKEN_SYSCALL;
while (!abort_loop)
{
#ifdef HAVE_POLL
@@ -6588,15 +6433,11 @@ void handle_connections_sockets()
if (!select_errors++ && !abort_loop) /* purecov: inspected */
sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
}
- MAYBE_BROKEN_SYSCALL
continue;
}
if (abort_loop)
- {
- MAYBE_BROKEN_SYSCALL;
break;
- }
/* Is this a new connection request ? */
#ifdef HAVE_POLL
@@ -6647,7 +6488,6 @@ void handle_connections_sockets()
if (mysql_socket_getfd(new_sock) != INVALID_SOCKET ||
(socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
break;
- MAYBE_BROKEN_SYSCALL;
#if !defined(NO_FCNTL_NONBLOCK)
if (!(test_flags & TEST_BLOCKING))
{
@@ -6670,7 +6510,6 @@ void handle_connections_sockets()
statistic_increment(connection_errors_accept, &LOCK_status);
if ((error_count++ & 255) == 0) // This can happen often
sql_perror("Error in accept");
- MAYBE_BROKEN_SYSCALL;
if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
sleep(1); // Give other threads some time
continue;
@@ -7425,187 +7264,6 @@ static int show_flush_commands(THD *thd, SHOW_VAR *var, char *buff,
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
-/* Functions relying on CTX */
-static int show_ssl_ctx_sess_accept(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_accept(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_accept_good(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_accept_good(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_connect_good(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_connect_good(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_accept_renegotiate(THD *thd, SHOW_VAR *var,
- char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_accept_renegotiate(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_connect_renegotiate(THD *thd, SHOW_VAR *var,
- char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_connect_renegotiate(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_cb_hits(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_cb_hits(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_hits(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_hits(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_cache_full(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_cache_full(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_misses(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_misses(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_timeouts(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_timeouts(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_number(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_number(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_connect(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_connect(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_sess_get_cache_size(THD *thd, SHOW_VAR *var,
- char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_sess_get_cache_size(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_get_verify_mode(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- *((long *)buff)= (!ssl_acceptor_fd ? 0 :
- SSL_CTX_get_verify_depth(ssl_acceptor_fd->ssl_context));
- return 0;
-}
-
-static int show_ssl_ctx_get_session_cache_mode(THD *thd, SHOW_VAR *var,
- char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_CHAR;
- if (!ssl_acceptor_fd)
- var->value= const_cast<char*>("NONE");
- else
- switch (SSL_CTX_get_session_cache_mode(ssl_acceptor_fd->ssl_context))
- {
- case SSL_SESS_CACHE_OFF:
- var->value= const_cast<char*>("OFF"); break;
- case SSL_SESS_CACHE_CLIENT:
- var->value= const_cast<char*>("CLIENT"); break;
- case SSL_SESS_CACHE_SERVER:
- var->value= const_cast<char*>("SERVER"); break;
- case SSL_SESS_CACHE_BOTH:
- var->value= const_cast<char*>("BOTH"); break;
- case SSL_SESS_CACHE_NO_AUTO_CLEAR:
- var->value= const_cast<char*>("NO_AUTO_CLEAR"); break;
- case SSL_SESS_CACHE_NO_INTERNAL_LOOKUP:
- var->value= const_cast<char*>("NO_INTERNAL_LOOKUP"); break;
- default:
- var->value= const_cast<char*>("Unknown"); break;
- }
- return 0;
-}
/*
Functions relying on SSL
@@ -7626,18 +7284,6 @@ static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
-static int show_ssl_session_reused(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONG;
- var->value= buff;
- if( thd->vio_ok() && thd->net.vio->ssl_arg )
- *((long *)buff)= (long)SSL_session_reused((SSL*) thd->net.vio->ssl_arg);
- else
- *((long *)buff)= 0;
- return 0;
-}
-
static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
@@ -7655,10 +7301,14 @@ static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff,
{
var->type= SHOW_LONG;
var->value= buff;
+#ifndef HAVE_YASSL
if( thd->net.vio && thd->net.vio->ssl_arg )
*((long *)buff)= (long)SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg);
else
*((long *)buff)= 0;
+#else
+ *((long *)buff) = 0;
+#endif
return 0;
}
@@ -7667,10 +7317,15 @@ static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff,
{
var->type= SHOW_LONG;
var->value= buff;
+#ifndef HAVE_YASSL
if( thd->vio_ok() && thd->net.vio->ssl_arg )
*((long *)buff)= (long)SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg);
else
*((long *)buff)= 0;
+#else
+ *((long *)buff)= 0;
+#endif
+
return 0;
}
@@ -8110,28 +7765,28 @@ SHOW_VAR status_vars[]= {
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count_), SHOW_LONG_STATUS},
#ifdef HAVE_OPENSSL
#ifndef EMBEDDED_LIBRARY
- {"Ssl_accept_renegotiates", (char*) &show_ssl_ctx_sess_accept_renegotiate, SHOW_SIMPLE_FUNC},
- {"Ssl_accepts", (char*) &show_ssl_ctx_sess_accept, SHOW_SIMPLE_FUNC},
- {"Ssl_callback_cache_hits", (char*) &show_ssl_ctx_sess_cb_hits, SHOW_SIMPLE_FUNC},
+ {"Ssl_accept_renegotiates", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_accepts", (char*) &ssl_acceptor_stats.accept, SHOW_LONG},
+ {"Ssl_callback_cache_hits", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
{"Ssl_cipher", (char*) &show_ssl_get_cipher, SHOW_SIMPLE_FUNC},
{"Ssl_cipher_list", (char*) &show_ssl_get_cipher_list, SHOW_SIMPLE_FUNC},
- {"Ssl_client_connects", (char*) &show_ssl_ctx_sess_connect, SHOW_SIMPLE_FUNC},
- {"Ssl_connect_renegotiates", (char*) &show_ssl_ctx_sess_connect_renegotiate, SHOW_SIMPLE_FUNC},
- {"Ssl_ctx_verify_depth", (char*) &show_ssl_ctx_get_verify_depth, SHOW_SIMPLE_FUNC},
- {"Ssl_ctx_verify_mode", (char*) &show_ssl_ctx_get_verify_mode, SHOW_SIMPLE_FUNC},
+ {"Ssl_client_connects", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_connect_renegotiates", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_ctx_verify_depth", (char*) &ssl_acceptor_stats.verify_depth, SHOW_LONG},
+ {"Ssl_ctx_verify_mode", (char*) &ssl_acceptor_stats.verify_mode, SHOW_LONG},
{"Ssl_default_timeout", (char*) &show_ssl_get_default_timeout, SHOW_SIMPLE_FUNC},
- {"Ssl_finished_accepts", (char*) &show_ssl_ctx_sess_accept_good, SHOW_SIMPLE_FUNC},
- {"Ssl_finished_connects", (char*) &show_ssl_ctx_sess_connect_good, SHOW_SIMPLE_FUNC},
+ {"Ssl_finished_accepts", (char*) &ssl_acceptor_stats.accept_good, SHOW_LONG},
+ {"Ssl_finished_connects", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
{"Ssl_server_not_after", (char*) &show_ssl_get_server_not_after, SHOW_SIMPLE_FUNC},
{"Ssl_server_not_before", (char*) &show_ssl_get_server_not_before, SHOW_SIMPLE_FUNC},
- {"Ssl_session_cache_hits", (char*) &show_ssl_ctx_sess_hits, SHOW_SIMPLE_FUNC},
- {"Ssl_session_cache_misses", (char*) &show_ssl_ctx_sess_misses, SHOW_SIMPLE_FUNC},
- {"Ssl_session_cache_mode", (char*) &show_ssl_ctx_get_session_cache_mode, SHOW_SIMPLE_FUNC},
- {"Ssl_session_cache_overflows", (char*) &show_ssl_ctx_sess_cache_full, SHOW_SIMPLE_FUNC},
- {"Ssl_session_cache_size", (char*) &show_ssl_ctx_sess_get_cache_size, SHOW_SIMPLE_FUNC},
- {"Ssl_session_cache_timeouts", (char*) &show_ssl_ctx_sess_timeouts, SHOW_SIMPLE_FUNC},
- {"Ssl_sessions_reused", (char*) &show_ssl_session_reused, SHOW_SIMPLE_FUNC},
- {"Ssl_used_session_cache_entries",(char*) &show_ssl_ctx_sess_number, SHOW_SIMPLE_FUNC},
+ {"Ssl_session_cache_hits", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_session_cache_misses", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_session_cache_mode", (char*) &ssl_acceptor_stats.session_cache_mode, SHOW_CHAR_PTR},
+ {"Ssl_session_cache_overflows", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_session_cache_size", (char*) &ssl_acceptor_stats.cache_size, SHOW_LONG},
+ {"Ssl_session_cache_timeouts", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_sessions_reused", (char*) &ssl_acceptor_stats.zero, SHOW_LONG},
+ {"Ssl_used_session_cache_entries",(char*) &ssl_acceptor_stats.zero, SHOW_LONG},
{"Ssl_verify_depth", (char*) &show_ssl_get_verify_depth, SHOW_SIMPLE_FUNC},
{"Ssl_verify_mode", (char*) &show_ssl_get_verify_mode, SHOW_SIMPLE_FUNC},
{"Ssl_version", (char*) &show_ssl_get_version, SHOW_SIMPLE_FUNC},
@@ -8172,6 +7827,20 @@ SHOW_VAR status_vars[]= {
{"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_SIMPLE_FUNC},
#endif
#ifdef WITH_WSREP
+ {"wsrep_connected", (char*) &wsrep_connected, SHOW_BOOL},
+ {"wsrep_ready", (char*) &wsrep_show_ready, SHOW_FUNC},
+ {"wsrep_cluster_state_uuid",(char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR},
+ {"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG},
+ {"wsrep_cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR},
+ {"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH},
+ {"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH},
+ {"wsrep_local_bf_aborts", (char*) &wsrep_show_bf_aborts, SHOW_FUNC},
+ {"wsrep_provider_name", (char*) &wsrep_provider_name, SHOW_CHAR_PTR},
+ {"wsrep_provider_version", (char*) &wsrep_provider_version, SHOW_CHAR_PTR},
+ {"wsrep_provider_vendor", (char*) &wsrep_provider_vendor, SHOW_CHAR_PTR},
+ {"wsrep_provider_capabilities", (char*) &wsrep_provider_capabilities, SHOW_CHAR_PTR},
+ {"wsrep_thread_count", (char*) &wsrep_running_threads, SHOW_LONG_NOFLUSH},
+ {"wsrep_cluster_capabilities", (char*) &wsrep_cluster_capabilities, SHOW_CHAR_PTR},
{"wsrep", (char*) &wsrep_show_status, SHOW_FUNC},
#endif
{NullS, NullS, SHOW_LONG}
@@ -8336,17 +8005,15 @@ static int mysql_init_variables(void)
opt_bootstrap= opt_myisam_log= 0;
disable_log_notes= 0;
mqh_used= 0;
- kill_in_progress= 0;
cleanup_done= 0;
test_flags= select_errors= dropping_tables= ha_open_options=0;
thread_count= kill_cached_threads= wake_thread= 0;
- service_thread_count= 0;
slave_open_temp_tables= 0;
cached_thread_count= 0;
opt_endinfo= using_udf_functions= 0;
opt_using_transactions= 0;
abort_loop= select_thread_in_use= signal_thread_in_use= 0;
- ready_to_exit= shutdown_in_progress= grant_option= 0;
+ grant_option= 0;
aborted_threads= aborted_connects= 0;
subquery_cache_miss= subquery_cache_hit= 0;
delayed_insert_threads= delayed_insert_writes= delayed_rows_in_use= 0;
@@ -8388,7 +8055,6 @@ static int mysql_init_variables(void)
global_query_id= 1;
global_thread_id= 0;
strnmov(server_version, MYSQL_SERVER_VERSION, sizeof(server_version)-1);
- threads.empty();
thread_cache.empty();
key_caches.empty();
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
@@ -8702,7 +8368,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
if (!(p= strstr(argument, "->")))
{
- sql_print_error("Bad syntax in replicate-rewrite-db - missing '->'!\n");
+ sql_print_error("Bad syntax in replicate-rewrite-db - missing '->'!");
return 1;
}
val= p--;
@@ -8710,7 +8376,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
*p-- = 0;
if (p == argument)
{
- sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db!\n");
+ sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db!");
return 1;
}
*val= 0;
@@ -8719,7 +8385,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
val++;
if (!*val)
{
- sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!\n");
+ sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!");
return 1;
}
@@ -8748,7 +8414,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
{
if (cur_rpl_filter->add_do_table(argument))
{
- sql_print_error("Could not add do table rule '%s'!\n", argument);
+ sql_print_error("Could not add do table rule '%s'!", argument);
return 1;
}
break;
@@ -8757,7 +8423,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
{
if (cur_rpl_filter->add_wild_do_table(argument))
{
- sql_print_error("Could not add do table rule '%s'!\n", argument);
+ sql_print_error("Could not add do table rule '%s'!", argument);
return 1;
}
break;
@@ -8766,7 +8432,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
{
if (cur_rpl_filter->add_wild_ignore_table(argument))
{
- sql_print_error("Could not add ignore table rule '%s'!\n", argument);
+ sql_print_error("Could not add ignore table rule '%s'!", argument);
return 1;
}
break;
@@ -8775,7 +8441,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
{
if (cur_rpl_filter->add_ignore_table(argument))
{
- sql_print_error("Could not add ignore table rule '%s'!\n", argument);
+ sql_print_error("Could not add ignore table rule '%s'!", argument);
return 1;
}
break;
@@ -9132,7 +8798,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
if (ft_boolean_check_syntax_string((uchar*) ft_boolean_syntax))
{
- sql_print_error("Invalid ft-boolean-syntax string: %s\n",
+ sql_print_error("Invalid ft-boolean-syntax string: %s",
ft_boolean_syntax);
return 1;
}
@@ -9634,7 +9300,9 @@ void refresh_status(THD *thd)
reset_status_vars();
#ifdef WITH_WSREP
if (WSREP_ON)
- wsrep->stats_reset(wsrep);
+ {
+ Wsrep_server_state::instance().provider().reset_status();
+ }
#endif /* WITH_WSREP */
/* Reset the counters of all key caches (default and named). */
@@ -10094,6 +9762,14 @@ static my_thread_id thread_id_max= UINT_MAX32;
@param[out] low - lower bound for the range
@param[out] high - upper bound for the range
*/
+
+static my_bool recalculate_callback(THD *thd, std::vector<my_thread_id> *ids)
+{
+ ids->push_back(thd->thread_id);
+ return 0;
+}
+
+
static void recalculate_thread_id_range(my_thread_id *low, my_thread_id *high)
{
std::vector<my_thread_id> ids;
@@ -10101,15 +9777,7 @@ static void recalculate_thread_id_range(my_thread_id *low, my_thread_id *high)
// Add sentinels
ids.push_back(0);
ids.push_back(UINT_MAX32);
-
- mysql_mutex_lock(&LOCK_thread_count);
-
- I_List_iterator<THD> it(threads);
- THD *thd;
- while ((thd=it++))
- ids.push_back(thd->thread_id);
-
- mysql_mutex_unlock(&LOCK_thread_count);
+ server_threads.iterate(recalculate_callback, &ids);
std::sort(ids.begin(), ids.end());
my_thread_id max_gap= 0;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 75f35a6df24..3d056fb95c7 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -23,6 +23,7 @@
#include "my_decimal.h" /* my_decimal */
#include "mysql_com.h" /* SERVER_VERSION_LENGTH */
#include "my_atomic.h"
+#include "my_counter.h"
#include "mysql/psi/mysql_file.h" /* MYSQL_FILE */
#include "mysql/psi/mysql_socket.h" /* MYSQL_SOCKET */
#include "sql_list.h" /* I_List */
@@ -81,11 +82,10 @@ enum enum_slave_parallel_mode {
};
/* Function prototypes */
-void kill_mysql(THD *thd= 0);
+void kill_mysql(THD *thd);
void close_connection(THD *thd, uint sql_errno= 0);
void handle_connection_in_main_thread(CONNECT *thd);
void create_thread_to_handle_connection(CONNECT *connect);
-void signal_thd_deleted();
void unlink_thd(THD *thd);
bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
void flush_thread_cache();
@@ -96,6 +96,9 @@ extern void init_net_server_extension(THD *thd);
extern void handle_accepted_socket(MYSQL_SOCKET new_sock, MYSQL_SOCKET sock);
extern void create_new_thread(CONNECT *connect);
+extern void ssl_acceptor_stats_update(int sslaccept_ret);
+extern int reinit_ssl();
+
extern "C" MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *files_charset_info ;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *national_charset_info;
@@ -124,7 +127,6 @@ extern bool opt_ignore_builtin_innodb;
extern my_bool opt_character_set_client_handshake;
extern my_bool debug_assert_on_not_freed_memory;
extern bool volatile abort_loop;
-extern bool volatile in_bootstrap;
extern uint connection_count;
extern my_bool opt_safe_user_create;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
@@ -237,6 +239,7 @@ extern ulong slow_launch_threads, slow_launch_time;
extern MYSQL_PLUGIN_IMPORT ulong max_connections;
extern uint max_digest_length;
extern ulong max_connect_errors, connect_timeout;
+extern uint max_password_errors;
extern my_bool slave_allow_batching;
extern my_bool allow_slave_start;
extern LEX_CSTRING reason_slave_blocked;
@@ -262,6 +265,7 @@ extern ulong opt_slave_parallel_mode;
extern ulong opt_binlog_commit_wait_count;
extern ulong opt_binlog_commit_wait_usec;
extern my_bool opt_gtid_ignore_duplicates;
+extern uint opt_gtid_cleanup_batch_size;
extern ulong back_log;
extern ulong executed_events;
extern char language[FN_REFLEN];
@@ -291,11 +295,9 @@ extern int mysqld_server_started, mysqld_server_initialized;
extern "C" MYSQL_PLUGIN_IMPORT int orig_argc;
extern "C" MYSQL_PLUGIN_IMPORT char **orig_argv;
extern pthread_attr_t connection_attrib;
-extern MYSQL_FILE *bootstrap_file;
extern my_bool old_mode;
extern LEX_STRING opt_init_connect, opt_init_slave;
extern int bootstrap_error;
-extern I_List<THD> threads;
extern char err_shared_dir[];
extern ulong connection_errors_select;
extern ulong connection_errors_accept;
@@ -332,7 +334,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_LOCK_logger, key_LOCK_manager,
key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started,
- key_LOCK_status, key_LOCK_show_status,
+ key_LOCK_status,
key_LOCK_thd_data, key_LOCK_thd_kill,
key_LOCK_user_conn, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
@@ -342,7 +344,8 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_rpl_group_info_sleep_lock,
key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
key_LOCK_start_thread,
- key_LOCK_error_messages, key_LOCK_thread_count, key_PARTITION_LOCK_auto_inc;
+ key_LOCK_error_messages,
+ key_PARTITION_LOCK_auto_inc;
extern PSI_mutex_key key_RELAYLOG_LOCK_index;
extern PSI_mutex_key key_LOCK_relaylog_end_pos;
extern PSI_mutex_key key_LOCK_slave_state, key_LOCK_binlog_state,
@@ -358,7 +361,8 @@ extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave,
key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock,
key_LOCK_SEQUENCE,
- key_rwlock_LOCK_vers_stats, key_rwlock_LOCK_stat_serial;
+ key_rwlock_LOCK_vers_stats, key_rwlock_LOCK_stat_serial,
+ key_rwlock_THD_list;
#ifdef HAVE_MMAP
extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
@@ -616,7 +620,7 @@ extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded
Server mutex locks and condition variables.
*/
extern mysql_mutex_t
- LOCK_item_func_sleep, LOCK_status, LOCK_show_status,
+ LOCK_item_func_sleep, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager,
@@ -624,6 +628,7 @@ extern mysql_mutex_t
LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count,
LOCK_slave_background;
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
+extern mysql_rwlock_t LOCK_all_status_vars;
extern mysql_mutex_t LOCK_start_thread;
#ifdef HAVE_OPENSSL
extern char* des_key_file;
@@ -632,11 +637,12 @@ extern mysql_mutex_t LOCK_des_key_file;
extern mysql_mutex_t LOCK_server_started;
extern mysql_cond_t COND_server_started;
extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
+extern mysql_rwlock_t LOCK_ssl_refresh;
extern mysql_prlock_t LOCK_system_variables_hash;
extern mysql_cond_t COND_thread_count, COND_start_thread;
extern mysql_cond_t COND_manager;
extern mysql_cond_t COND_slave_background;
-extern int32 thread_count, service_thread_count;
+extern Atomic_counter<uint32_t> thread_count;
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
*opt_ssl_key, *opt_ssl_crl, *opt_ssl_crlpath;
@@ -764,8 +770,6 @@ enum enum_query_type
/* query_id */
extern query_id_t global_query_id;
-void unireg_end(void);
-
/* increment query_id and return it. */
inline __attribute__((warn_unused_result)) query_id_t next_query_id()
{
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ba2705bab40..c9dc56d50b8 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1561,6 +1561,7 @@ failure:
head->column_bitmaps_set(save_read_set, save_write_set);
delete file;
file= save_file;
+ free_file= false;
DBUG_RETURN(1);
}
@@ -2846,10 +2847,9 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
- Column_statistics* col_stats= (*field_ptr)->read_stats;
- if (bitmap_is_set(used_fields, (*field_ptr)->field_index)
- && col_stats && !col_stats->no_stat_values_provided()
- && !((*field_ptr)->type() == MYSQL_TYPE_GEOMETRY))
+ Field *field= *field_ptr;
+ if (bitmap_is_set(used_fields, field->field_index) &&
+ is_eits_usable(field))
parts++;
}
@@ -2867,10 +2867,10 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
uint max_key_len= 0;
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
- if (bitmap_is_set(used_fields, (*field_ptr)->field_index))
+ Field *field= *field_ptr;
+ if (bitmap_is_set(used_fields, field->field_index))
{
- Field *field= *field_ptr;
- if (field->type() == MYSQL_TYPE_GEOMETRY)
+ if (!is_eits_usable(field))
continue;
uint16 store_length;
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index f09bde6a965..0ac4014a669 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1516,12 +1516,12 @@ bool partition_info::check_partition_field_length()
for (i= 0; i < num_part_fields; i++)
store_length+= get_partition_field_store_length(part_field_array[i]);
- if (store_length > MAX_KEY_LENGTH)
+ if (store_length > MAX_DATA_LENGTH_FOR_KEY)
DBUG_RETURN(TRUE);
store_length= 0;
for (i= 0; i < num_subpart_fields; i++)
store_length+= get_partition_field_store_length(subpart_field_array[i]);
- if (store_length > MAX_KEY_LENGTH)
+ if (store_length > MAX_DATA_LENGTH_FOR_KEY)
DBUG_RETURN(TRUE);
DBUG_RETURN(FALSE);
}
@@ -2626,6 +2626,23 @@ void partition_info::print_debug(const char *str, uint *value)
DBUG_PRINT("info", ("parser: %s", str));
DBUG_VOID_RETURN;
}
+
+bool partition_info::field_in_partition_expr(Field *field) const
+{
+ uint i;
+ for (i= 0; i < num_part_fields; i++)
+ {
+ if (field->eq(part_field_array[i]))
+ return TRUE;
+ }
+ for (i= 0; i < num_subpart_fields; i++)
+ {
+ if (field->eq(subpart_field_array[i]))
+ return TRUE;
+ }
+ return FALSE;
+}
+
#else /* WITH_PARTITION_STORAGE_ENGINE */
/*
For builds without partitioning we need to define these functions
diff --git a/sql/partition_info.h b/sql/partition_info.h
index a0cde570d03..c7d8e16dfeb 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -392,6 +392,7 @@ private:
public:
bool set_read_partitions(List<char> *partition_names);
bool has_unique_name(partition_element *element);
+ bool field_in_partition_expr(Field *field) const;
bool vers_init_info(THD *thd);
bool vers_set_interval(THD *thd, Item *item,
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 7eee9283989..38eb8ac99f7 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -551,8 +551,26 @@ static uchar *net_store_length_fast(uchar *packet, size_t length)
void Protocol::end_statement()
{
- /* sanity check*/
- DBUG_ASSERT_IF_WSREP(!(WSREP(thd) && thd->wsrep_conflict_state == REPLAYING));
+#ifdef WITH_WSREP
+ /*
+ Commented out: This sanity check does not hold in general.
+ Thd->LOCK_thd_data() must be unlocked before sending response
+ to client, so BF abort may sneak in here.
+ DBUG_ASSERT(!WSREP(thd) || thd->wsrep_conflict_state() == NO_CONFLICT);
+ */
+
+ /*
+ sanity check, don't send end statement while replaying
+ */
+ DBUG_ASSERT(thd->wsrep_trx().state() != wsrep::transaction::s_replaying);
+ if (WSREP(thd) && thd->wsrep_trx().state() ==
+ wsrep::transaction::s_replaying)
+ {
+ WSREP_ERROR("attempting net_end_statement while replaying");
+ return;
+ }
+#endif /* WITH_WSREP */
+
DBUG_ENTER("Protocol::end_statement");
DBUG_ASSERT(! thd->get_stmt_da()->is_sent());
bool error= FALSE;
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 322b84130f2..17f474c2acf 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -79,7 +79,7 @@ rpl_slave_state::record_and_update_gtid(THD *thd, rpl_group_info *rgi)
rgi->gtid_pending= false;
if (rgi->gtid_ignore_duplicate_state!=rpl_group_info::GTID_DUPLICATE_IGNORE)
{
- if (record_gtid(thd, &rgi->current_gtid, sub_id, NULL, false, &hton))
+ if (record_gtid(thd, &rgi->current_gtid, sub_id, false, false, &hton))
DBUG_RETURN(1);
update_state_hash(sub_id, &rgi->current_gtid, hton, rgi);
}
@@ -244,7 +244,7 @@ rpl_slave_state_free_element(void *arg)
rpl_slave_state::rpl_slave_state()
- : last_sub_id(0), gtid_pos_tables(0), loaded(false)
+ : pending_gtid_count(0), last_sub_id(0), gtid_pos_tables(0), loaded(false)
{
mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state,
MY_MUTEX_INIT_SLOW);
@@ -331,14 +331,11 @@ rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id,
}
}
rgi->gtid_ignore_duplicate_state= rpl_group_info::GTID_DUPLICATE_NULL;
-
-#ifdef HAVE_REPLICATION
- rgi->pending_gtid_deletes_clear();
-#endif
}
if (!(list_elem= (list_element *)my_malloc(sizeof(*list_elem), MYF(MY_WME))))
return 1;
+ list_elem->domain_id= domain_id;
list_elem->server_id= server_id;
list_elem->sub_id= sub_id;
list_elem->seq_no= seq_no;
@@ -348,6 +345,15 @@ rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id,
if (last_sub_id < sub_id)
last_sub_id= sub_id;
+#ifdef HAVE_REPLICATION
+ ++pending_gtid_count;
+ if (pending_gtid_count >= opt_gtid_cleanup_batch_size)
+ {
+ pending_gtid_count = 0;
+ slave_background_gtid_pending_delete_request();
+ }
+#endif
+
return 0;
}
@@ -382,20 +388,22 @@ rpl_slave_state::get_element(uint32 domain_id)
int
-rpl_slave_state::put_back_list(uint32 domain_id, list_element *list)
+rpl_slave_state::put_back_list(list_element *list)
{
- element *e;
+ element *e= NULL;
int err= 0;
mysql_mutex_lock(&LOCK_slave_state);
- if (!(e= (element *)my_hash_search(&hash, (const uchar *)&domain_id, 0)))
- {
- err= 1;
- goto end;
- }
while (list)
{
list_element *next= list->next;
+
+ if ((!e || e->domain_id != list->domain_id) &&
+ !(e= (element *)my_hash_search(&hash, (const uchar *)&list->domain_id, 0)))
+ {
+ err= 1;
+ goto end;
+ }
e->add(list);
list= next;
}
@@ -572,12 +580,12 @@ rpl_slave_state::select_gtid_pos_table(THD *thd, LEX_CSTRING *out_tablename)
/*
Write a gtid to the replication slave state table.
+ Do it as part of the transaction, to get slave crash safety, or as a separate
+ transaction if !in_transaction (eg. MyISAM or DDL).
+
gtid The global transaction id for this event group.
sub_id Value allocated within the sub_id when the event group was
read (sub_id must be consistent with commit order in master binlog).
- rgi rpl_group_info context, if we are recording the gtid transactionally
- as part of replicating a transactional event. NULL if called from
- outside of a replicated transaction.
Note that caller must later ensure that the new gtid and sub_id is inserted
into the appropriate HASH element with rpl_slave_state.add(), so that it can
@@ -585,16 +593,13 @@ rpl_slave_state::select_gtid_pos_table(THD *thd, LEX_CSTRING *out_tablename)
*/
int
rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
- rpl_group_info *rgi, bool in_statement,
+ bool in_transaction, bool in_statement,
void **out_hton)
{
TABLE_LIST tlist;
int err= 0, not_sql_thread;
bool table_opened= false;
TABLE *table;
- list_element *delete_list= 0, *next, *cur, **next_ptr_ptr, **best_ptr_ptr;
- uint64 best_sub_id;
- element *elem;
ulonglong thd_saved_option= thd->variables.option_bits;
Query_tables_list lex_backup;
wait_for_commit* suspended_wfc;
@@ -684,7 +689,7 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
thd->wsrep_ignore_table= true;
#endif
- if (!rgi)
+ if (!in_transaction)
{
DBUG_PRINT("info", ("resetting OPTION_BEGIN"));
thd->variables.option_bits&=
@@ -716,168 +721,280 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
my_error(ER_OUT_OF_RESOURCES, MYF(0));
goto end;
}
+end:
- mysql_mutex_lock(&LOCK_slave_state);
- if ((elem= get_element(gtid->domain_id)) == NULL)
+#ifdef WITH_WSREP
+ thd->wsrep_ignore_table= false;
+#endif
+
+ if (table_opened)
{
- mysql_mutex_unlock(&LOCK_slave_state);
- my_error(ER_OUT_OF_RESOURCES, MYF(0));
- err= 1;
- goto end;
+ if (err || (err= ha_commit_trans(thd, FALSE)))
+ ha_rollback_trans(thd, FALSE);
+
+ close_thread_tables(thd);
+ if (in_transaction)
+ thd->mdl_context.release_statement_locks();
+ else
+ thd->mdl_context.release_transactional_locks();
}
+ thd->lex->restore_backup_query_tables_list(&lex_backup);
+ thd->variables.option_bits= thd_saved_option;
+ thd->resume_subsequent_commits(suspended_wfc);
+ DBUG_EXECUTE_IF("inject_record_gtid_serverid_100_sleep",
+ {
+ if (gtid->server_id == 100)
+ my_sleep(500000);
+ });
+ DBUG_RETURN(err);
+}
- /* Now pull out all GTIDs that were recorded in this engine. */
- delete_list = NULL;
- next_ptr_ptr= &elem->list;
- cur= elem->list;
- best_sub_id= 0;
- best_ptr_ptr= NULL;
- while (cur)
+
+/*
+ Return a list of all old GTIDs in any mysql.gtid_slave_pos* table that are
+ no longer needed and can be deleted from the table.
+
+ Within each domain, we need to keep around the latest GTID (the one with the
+ highest sub_id), but any others in that domain can be deleted.
+*/
+rpl_slave_state::list_element *
+rpl_slave_state::gtid_grab_pending_delete_list()
+{
+ uint32 i;
+ list_element *full_list;
+
+ mysql_mutex_lock(&LOCK_slave_state);
+ full_list= NULL;
+ for (i= 0; i < hash.records; ++i)
{
- list_element *next= cur->next;
- if (cur->hton == hton)
- {
- /* Belongs to same engine, so move it to the delete list. */
- cur->next= delete_list;
- delete_list= cur;
- if (cur->sub_id > best_sub_id)
+ element *elem= (element *)my_hash_element(&hash, i);
+ list_element *elist= elem->list;
+ list_element *last_elem, **best_ptr_ptr, *cur, *next;
+ uint64 best_sub_id;
+
+ if (!elist)
+ continue; /* Nothing here */
+
+ /* Delete any old stuff, but keep around the most recent one. */
+ cur= elist;
+ best_sub_id= cur->sub_id;
+ best_ptr_ptr= &elist;
+ last_elem= cur;
+ while ((next= cur->next)) {
+ last_elem= next;
+ if (next->sub_id > best_sub_id)
{
- best_sub_id= cur->sub_id;
- best_ptr_ptr= &delete_list;
- }
- else if (best_ptr_ptr == &delete_list)
+ best_sub_id= next->sub_id;
best_ptr_ptr= &cur->next;
- }
- else
- {
- /* Another engine, leave it in the list. */
- if (cur->sub_id > best_sub_id)
- {
- best_sub_id= cur->sub_id;
- /* Current best is not on the delete list. */
- best_ptr_ptr= NULL;
}
- *next_ptr_ptr= cur;
- next_ptr_ptr= &cur->next;
+ cur= next;
}
- cur= next;
- }
- *next_ptr_ptr= NULL;
- /*
- If the highest sub_id element is on the delete list, put it back on the
- original list, to preserve the highest sub_id element in the table for
- GTID position recovery.
- */
- if (best_ptr_ptr)
- {
+ /*
+ Append the new elements to the full list. Note the order is important;
+ we do it here so that we do not break the list if best_sub_id is the
+ last of the new elements.
+ */
+ last_elem->next= full_list;
+ /*
+ Delete the highest sub_id element from the old list, and put it back as
+ the single-element new list.
+ */
cur= *best_ptr_ptr;
*best_ptr_ptr= cur->next;
- cur->next= elem->list;
+ cur->next= NULL;
elem->list= cur;
+
+ /*
+ Collect the full list so far here. Note that elist may have moved if we
+ deleted the first element, so order is again important.
+ */
+ full_list= elist;
}
mysql_mutex_unlock(&LOCK_slave_state);
- if (!delete_list)
- goto end;
+ return full_list;
+}
+
- /* Now delete any already committed GTIDs. */
- bitmap_set_bit(table->read_set, table->field[0]->field_index);
- bitmap_set_bit(table->read_set, table->field[1]->field_index);
+/* Find the mysql.gtid_slave_posXXX table associated with a given hton. */
+LEX_CSTRING *
+rpl_slave_state::select_gtid_pos_table(void *hton)
+{
+ struct gtid_pos_table *table_entry;
- if ((err= table->file->ha_index_init(0, 0)))
+ /*
+ See comments on rpl_slave_state::gtid_pos_tables for rules around proper
+ access to the list.
+ */
+ table_entry= (struct gtid_pos_table *)
+ my_atomic_loadptr_explicit(&gtid_pos_tables, MY_MEMORY_ORDER_ACQUIRE);
+
+ while (table_entry)
{
- table->file->print_error(err, MYF(0));
- goto end;
+ if (table_entry->table_hton == hton)
+ {
+ if (likely(table_entry->state == GTID_POS_AVAILABLE))
+ return &table_entry->table_name;
+ }
+ table_entry= table_entry->next;
}
- cur = delete_list;
- while (cur)
- {
- uchar key_buffer[4+8];
- DBUG_EXECUTE_IF("gtid_slave_pos_simulate_failed_delete",
- { err= ENOENT;
- table->file->print_error(err, MYF(0));
- /* `break' does not work inside DBUG_EXECUTE_IF */
- goto dbug_break; });
+ table_entry= (struct gtid_pos_table *)
+ my_atomic_loadptr_explicit(&default_gtid_pos_table, MY_MEMORY_ORDER_ACQUIRE);
+ return &table_entry->table_name;
+}
- next= cur->next;
- table->field[1]->store(cur->sub_id, true);
- /* domain_id is already set in table->record[0] from write_row() above. */
- key_copy(key_buffer, table->record[0], &table->key_info[0], 0, false);
- if (table->file->ha_index_read_map(table->record[1], key_buffer,
- HA_WHOLE_KEY, HA_READ_KEY_EXACT))
- /* We cannot find the row, assume it is already deleted. */
- ;
- else if ((err= table->file->ha_delete_row(table->record[1])))
- table->file->print_error(err, MYF(0));
- /*
- In case of error, we still discard the element from the list. We do
- not want to endlessly error on the same element in case of table
- corruption or such.
- */
- cur= next;
- if (err)
- break;
- }
-IF_DBUG(dbug_break:, )
- table->file->ha_index_end();
+void
+rpl_slave_state::gtid_delete_pending(THD *thd,
+ rpl_slave_state::list_element **list_ptr)
+{
+ int err= 0;
+ ulonglong thd_saved_option;
-end:
+ if (unlikely(!loaded))
+ return;
#ifdef WITH_WSREP
- thd->wsrep_ignore_table= false;
+ /*
+ Updates in slave state table should not be appended to galera transaction
+ writeset.
+ */
+ thd->wsrep_ignore_table= true;
#endif
- if (table_opened)
+ thd_saved_option= thd->variables.option_bits;
+ thd->variables.option_bits&=
+ ~(ulonglong)(OPTION_NOT_AUTOCOMMIT |OPTION_BEGIN |OPTION_BIN_LOG |
+ OPTION_GTID_BEGIN);
+
+ while (*list_ptr)
{
- if (err || (err= ha_commit_trans(thd, FALSE)))
- {
- /*
- If error, we need to put any remaining delete_list back into the HASH
- so we can do another delete attempt later.
- */
- if (delete_list)
- {
- put_back_list(gtid->domain_id, delete_list);
- delete_list = 0;
- }
+ LEX_CSTRING *gtid_pos_table_name, *tmp_table_name;
+ Query_tables_list lex_backup;
+ TABLE_LIST tlist;
+ TABLE *table;
+ handler::Table_flags direct_pos;
+ list_element *cur, **cur_ptr_ptr;
+ bool table_opened= false;
+ void *hton= (*list_ptr)->hton;
- ha_rollback_trans(thd, FALSE);
+ thd->reset_for_next_command();
+
+ /*
+ Only the SQL thread can call select_gtid_pos_table without a mutex
+ Other threads needs to use a mutex and take into account that the
+ result may change during execution, so we have to make a copy.
+ */
+ mysql_mutex_lock(&LOCK_slave_state);
+ tmp_table_name= select_gtid_pos_table(hton);
+ gtid_pos_table_name= thd->make_clex_string(tmp_table_name->str,
+ tmp_table_name->length);
+ mysql_mutex_unlock(&LOCK_slave_state);
+ if (!gtid_pos_table_name)
+ {
+ /* Out of memory - we can try again later. */
+ break;
}
- close_thread_tables(thd);
- if (rgi)
+
+ thd->lex->reset_n_backup_query_tables_list(&lex_backup);
+ tlist.init_one_table(&MYSQL_SCHEMA_NAME, gtid_pos_table_name, NULL, TL_WRITE);
+ if ((err= open_and_lock_tables(thd, &tlist, FALSE, 0)))
+ goto end;
+ table_opened= true;
+ table= tlist.table;
+
+ if ((err= gtid_check_rpl_slave_state_table(table)))
+ goto end;
+
+ direct_pos= table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION;
+ bitmap_set_all(table->write_set);
+ table->rpl_write_set= table->write_set;
+
+ /* Now delete any already committed GTIDs. */
+ bitmap_set_bit(table->read_set, table->field[0]->field_index);
+ bitmap_set_bit(table->read_set, table->field[1]->field_index);
+
+ if (!direct_pos && (err= table->file->ha_index_init(0, 0)))
{
- thd->mdl_context.release_statement_locks();
- /*
- Save the list of old gtid entries we deleted. If this transaction
- fails later for some reason and is rolled back, the deletion of those
- entries will be rolled back as well, and we will need to put them back
- on the to-be-deleted list so we can re-do the deletion. Otherwise
- redundant rows in mysql.gtid_slave_pos may accumulate if transactions
- are rolled back and retried after record_gtid().
- */
-#ifdef HAVE_REPLICATION
- rgi->pending_gtid_deletes_save(gtid->domain_id, delete_list);
-#endif
+ table->file->print_error(err, MYF(0));
+ goto end;
}
- else
+
+ cur = *list_ptr;
+ cur_ptr_ptr = list_ptr;
+ do
{
- thd->mdl_context.release_transactional_locks();
-#ifdef HAVE_REPLICATION
- rpl_group_info::pending_gtid_deletes_free(delete_list);
-#endif
+ uchar key_buffer[4+8];
+ list_element *next= cur->next;
+
+ if (cur->hton == hton)
+ {
+ int res;
+
+ table->field[0]->store((ulonglong)cur->domain_id, true);
+ table->field[1]->store(cur->sub_id, true);
+ if (direct_pos)
+ {
+ res= table->file->ha_rnd_pos_by_record(table->record[0]);
+ }
+ else
+ {
+ key_copy(key_buffer, table->record[0], &table->key_info[0], 0, false);
+ res= table->file->ha_index_read_map(table->record[0], key_buffer,
+ HA_WHOLE_KEY, HA_READ_KEY_EXACT);
+ }
+ DBUG_EXECUTE_IF("gtid_slave_pos_simulate_failed_delete",
+ { res= 1;
+ err= ENOENT;
+ sql_print_error("<DEBUG> Error deleting old GTID row");
+ });
+ if (res)
+ /* We cannot find the row, assume it is already deleted. */
+ ;
+ else if ((err= table->file->ha_delete_row(table->record[0])))
+ {
+ sql_print_error("Error deleting old GTID row: %s",
+ thd->get_stmt_da()->message());
+ /*
+ In case of error, we still discard the element from the list. We do
+ not want to endlessly error on the same element in case of table
+ corruption or such.
+ */
+ }
+ *cur_ptr_ptr= next;
+ my_free(cur);
+ }
+ else
+ {
+ /* Leave this one in the list until we get to the table for its hton. */
+ cur_ptr_ptr= &cur->next;
+ }
+ cur= next;
+ if (err)
+ break;
+ } while (cur);
+end:
+ if (table_opened)
+ {
+ if (!direct_pos)
+ table->file->ha_index_end();
+
+ if (err || (err= ha_commit_trans(thd, FALSE)))
+ ha_rollback_trans(thd, FALSE);
}
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+ thd->lex->restore_backup_query_tables_list(&lex_backup);
+
+ if (err)
+ break;
}
- thd->lex->restore_backup_query_tables_list(&lex_backup);
thd->variables.option_bits= thd_saved_option;
- thd->resume_subsequent_commits(suspended_wfc);
- DBUG_EXECUTE_IF("inject_record_gtid_serverid_100_sleep",
- {
- if (gtid->server_id == 100)
- my_sleep(500000);
- });
- DBUG_RETURN(err);
+
+#ifdef WITH_WSREP
+ thd->wsrep_ignore_table= false;
+#endif
}
@@ -1251,7 +1368,7 @@ rpl_slave_state::load(THD *thd, const char *state_from_master, size_t len,
if (gtid_parser_helper(&state_from_master, end, &gtid) ||
!(sub_id= next_sub_id(gtid.domain_id)) ||
- record_gtid(thd, &gtid, sub_id, NULL, in_statement, &hton) ||
+ record_gtid(thd, &gtid, sub_id, false, in_statement, &hton) ||
update(gtid.domain_id, gtid.server_id, sub_id, gtid.seq_no, hton, NULL))
return 1;
if (state_from_master == end)
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h
index 0fc92d5e33c..60d822f7b0d 100644
--- a/sql/rpl_gtid.h
+++ b/sql/rpl_gtid.h
@@ -118,8 +118,9 @@ struct rpl_slave_state
{
struct list_element *next;
uint64 sub_id;
- uint64 seq_no;
+ uint32 domain_id;
uint32 server_id;
+ uint64 seq_no;
/*
hton of mysql.gtid_slave_pos* table used to record this GTID.
Can be NULL if the gtid table failed to load (eg. missing
@@ -191,6 +192,8 @@ struct rpl_slave_state
/* Mapping from domain_id to its element. */
HASH hash;
+ /* GTIDs added since last purge of old mysql.gtid_slave_pos rows. */
+ uint32 pending_gtid_count;
/* Mutex protecting access to the state. */
mysql_mutex_t LOCK_slave_state;
/* Auxiliary buffer to sort gtid list. */
@@ -233,7 +236,10 @@ struct rpl_slave_state
int truncate_state_table(THD *thd);
void select_gtid_pos_table(THD *thd, LEX_CSTRING *out_tablename);
int record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
- rpl_group_info *rgi, bool in_statement, void **out_hton);
+ bool in_transaction, bool in_statement, void **out_hton);
+ list_element *gtid_grab_pending_delete_list();
+ LEX_CSTRING *select_gtid_pos_table(void *hton);
+ void gtid_delete_pending(THD *thd, rpl_slave_state::list_element **list_ptr);
uint64 next_sub_id(uint32 domain_id);
int iterate(int (*cb)(rpl_gtid *, void *), void *data,
rpl_gtid *extra_gtids, uint32 num_extra,
@@ -245,7 +251,7 @@ struct rpl_slave_state
bool is_empty();
element *get_element(uint32 domain_id);
- int put_back_list(uint32 domain_id, list_element *list);
+ int put_back_list(list_element *list);
void update_state_hash(uint64 sub_id, rpl_gtid *gtid, void *hton,
rpl_group_info *rgi);
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 897d4394525..8d3e146f4c5 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -1436,7 +1436,7 @@ bool Master_info_index::add_master_info(Master_info *mi, bool write_to_file)
We have to protect against shutdown to ensure we are not calling
my_hash_insert() while my_hash_free() is in progress
*/
- if (unlikely(shutdown_in_progress) ||
+ if (unlikely(abort_loop) ||
!my_hash_insert(&master_info_hash, (uchar*) mi))
{
if (global_system_variables.log_warnings > 1)
@@ -1579,7 +1579,7 @@ uint any_slave_sql_running(bool already_locked)
if (!already_locked)
mysql_mutex_lock(&LOCK_active_mi);
- if (unlikely(shutdown_in_progress || !master_info_index))
+ if (unlikely(abort_loop || !master_info_index))
count= 1;
else
{
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 54d6b5be592..5de73254ed9 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -329,13 +329,13 @@ class Master_info : public Slave_reporting_capability
/* No of DDL event group */
- volatile uint64 total_ddl_groups;
+ Atomic_counter<uint64> total_ddl_groups;
/* No of non-transactional event group*/
- volatile uint64 total_non_trans_groups;
+ Atomic_counter<uint64> total_non_trans_groups;
/* No of transactional event group*/
- volatile uint64 total_trans_groups;
+ Atomic_counter<uint64> total_trans_groups;
/* domain-id based filter */
Domain_id_filter domain_id_filter;
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 144b12a9fdf..dc5e3ff1fbf 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -1023,7 +1023,7 @@ handle_rpl_parallel_thread(void *arg)
my_thread_init();
thd = new THD(next_thread_id());
thd->thread_stack = (char*)&thd;
- add_to_active_threads(thd);
+ server_threads.insert(thd);
set_current_thd(thd);
pthread_detach_this_thread();
thd->init_for_queries();
@@ -1432,7 +1432,7 @@ handle_rpl_parallel_thread(void *arg)
thd->temporary_tables= 0;
THD_CHECK_SENTRY(thd);
- unlink_not_visible_thd(thd);
+ server_threads.erase(thd);
delete thd;
mysql_mutex_lock(&rpt->LOCK_rpl_thread);
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index 94c1f08e4e3..84661fa513d 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -329,6 +329,7 @@ unpack_row(rpl_group_info *rgi,
(int) (pack_ptr - old_pack_ptr)));
if (!pack_ptr)
{
+#ifdef WITH_WSREP
if (WSREP_ON)
{
/*
@@ -344,7 +345,7 @@ unpack_row(rpl_group_info *rgi,
(table_found) ? "found" : "not found", row_end
);
}
-
+#endif /* WITH_WSREP */
rgi->rli->report(ERROR_LEVEL, ER_SLAVE_CORRUPT_EVENT,
rgi->gtid_info(),
"Could not read field '%s' of table '%s.%s'",
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index b275ad884bd..2d91620c898 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1820,6 +1820,7 @@ rpl_load_gtid_slave_state(THD *thd)
int err= 0;
uint32 i;
load_gtid_state_cb_data cb_data;
+ rpl_slave_state::list_element *old_gtids_list;
DBUG_ENTER("rpl_load_gtid_slave_state");
mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state);
@@ -1905,6 +1906,13 @@ rpl_load_gtid_slave_state(THD *thd)
rpl_global_gtid_slave_state->loaded= true;
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
+ /* Clear out no longer needed elements now. */
+ old_gtids_list=
+ rpl_global_gtid_slave_state->gtid_grab_pending_delete_list();
+ rpl_global_gtid_slave_state->gtid_delete_pending(thd, &old_gtids_list);
+ if (old_gtids_list)
+ rpl_global_gtid_slave_state->put_back_list(old_gtids_list);
+
end:
if (array_inited)
delete_dynamic(&array);
@@ -2086,7 +2094,6 @@ rpl_group_info::reinit(Relay_log_info *rli)
long_find_row_note_printed= false;
did_mark_start_commit= false;
gtid_ev_flags2= 0;
- pending_gtid_delete_list= NULL;
last_master_timestamp = 0;
gtid_ignore_duplicate_state= GTID_DUPLICATE_NULL;
speculation= SPECULATE_NO;
@@ -2217,12 +2224,6 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
erroneously update the GTID position.
*/
gtid_pending= false;
-
- /*
- Rollback will have undone any deletions of old rows we might have made
- in mysql.gtid_slave_pos. Put those rows back on the list to be deleted.
- */
- pending_gtid_deletes_put_back();
}
m_table_map.clear_tables();
slave_close_thread_tables(thd);
@@ -2448,78 +2449,6 @@ rpl_group_info::unmark_start_commit()
}
-/*
- When record_gtid() has deleted any old rows from the table
- mysql.gtid_slave_pos as part of a replicated transaction, save the list of
- rows deleted here.
-
- If later the transaction fails (eg. optimistic parallel replication), the
- deletes will be undone when the transaction is rolled back. Then we can
- put back the list of rows into the rpl_global_gtid_slave_state, so that
- we can re-do the deletes and avoid accumulating old rows in the table.
-*/
-void
-rpl_group_info::pending_gtid_deletes_save(uint32 domain_id,
- rpl_slave_state::list_element *list)
-{
- /*
- We should never get to a state where we try to save a new pending list of
- gtid deletes while we still have an old one. But make sure we handle it
- anyway just in case, so we avoid leaving stray entries in the
- mysql.gtid_slave_pos table.
- */
- DBUG_ASSERT(!pending_gtid_delete_list);
- if (unlikely(pending_gtid_delete_list))
- pending_gtid_deletes_put_back();
-
- pending_gtid_delete_list= list;
- pending_gtid_delete_list_domain= domain_id;
-}
-
-
-/*
- Take the list recorded by pending_gtid_deletes_save() and put it back into
- rpl_global_gtid_slave_state. This is needed if deletion of the rows was
- rolled back due to transaction failure.
-*/
-void
-rpl_group_info::pending_gtid_deletes_put_back()
-{
- if (pending_gtid_delete_list)
- {
- rpl_global_gtid_slave_state->put_back_list(pending_gtid_delete_list_domain,
- pending_gtid_delete_list);
- pending_gtid_delete_list= NULL;
- }
-}
-
-
-/*
- Free the list recorded by pending_gtid_deletes_save(). Done when the deletes
- in the list have been permanently committed.
-*/
-void
-rpl_group_info::pending_gtid_deletes_clear()
-{
- pending_gtid_deletes_free(pending_gtid_delete_list);
- pending_gtid_delete_list= NULL;
-}
-
-
-void
-rpl_group_info::pending_gtid_deletes_free(rpl_slave_state::list_element *list)
-{
- rpl_slave_state::list_element *next;
-
- while (list)
- {
- next= list->next;
- my_free(list);
- list= next;
- }
-}
-
-
rpl_sql_thread_info::rpl_sql_thread_info(Rpl_filter *filter)
: rpl_filter(filter)
{
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index d9f0e0e5d3b..b8b153c34be 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -757,11 +757,6 @@ struct rpl_group_info
/* Needs room for "Gtid D-S-N\x00". */
char gtid_info_buf[5+10+1+10+1+20+1];
- /* List of not yet committed deletions in mysql.gtid_slave_pos. */
- rpl_slave_state::list_element *pending_gtid_delete_list;
- /* Domain associated with pending_gtid_delete_list. */
- uint32 pending_gtid_delete_list_domain;
-
/*
The timestamp, from the master, of the commit event.
Used to do delayed update of rli->last_master_timestamp, for getting
@@ -903,12 +898,6 @@ struct rpl_group_info
char *gtid_info();
void unmark_start_commit();
- static void pending_gtid_deletes_free(rpl_slave_state::list_element *list);
- void pending_gtid_deletes_save(uint32 domain_id,
- rpl_slave_state::list_element *list);
- void pending_gtid_deletes_put_back();
- void pending_gtid_deletes_clear();
-
longlong get_row_stmt_start_timestamp()
{
return row_stmt_start_timestamp;
diff --git a/sql/semisync_master_ack_receiver.cc b/sql/semisync_master_ack_receiver.cc
index fc36ee35d5d..0ef0b5229ca 100644
--- a/sql/semisync_master_ack_receiver.cc
+++ b/sql/semisync_master_ack_receiver.cc
@@ -173,25 +173,6 @@ inline void Ack_receiver::wait_for_slave_connection()
mysql_cond_wait(&m_cond, &m_mutex);
}
-my_socket Ack_receiver::get_slave_sockets(fd_set *fds, uint *count)
-{
- my_socket max_fd= INVALID_SOCKET;
- Slave *slave;
- I_List_iterator<Slave> it(m_slaves);
-
- *count= 0;
- FD_ZERO(fds);
- while ((slave= it++))
- {
- (*count)++;
- my_socket fd= slave->sock_fd();
- max_fd= (fd > max_fd ? fd : max_fd);
- FD_SET(fd, fds);
- }
-
- return max_fd;
-}
-
/* Auxilary function to initialize a NET object with given net buffer. */
static void init_net(NET *net, unsigned char *buff, unsigned int buff_len)
{
@@ -208,20 +189,22 @@ void Ack_receiver::run()
THD *thd= new THD(next_thread_id(), false, true);
NET net;
unsigned char net_buff[REPLY_MESSAGE_MAX_LENGTH];
- fd_set read_fds;
- my_socket max_fd= INVALID_SOCKET;
- Slave *slave;
my_thread_init();
DBUG_ENTER("Ack_receiver::run");
+#ifdef HAVE_POLL
+ Poll_socket_listener listener(m_slaves);
+#else
+ Select_socket_listener listener(m_slaves);
+#endif //HAVE_POLL
+
sql_print_information("Starting ack receiver thread");
thd->system_thread= SYSTEM_THREAD_SEMISYNC_MASTER_BACKGROUND;
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->security_ctx->skip_grants();
- thread_safe_increment32(&service_thread_count);
thd->set_command(COM_DAEMON);
init_net(&net, net_buff, REPLY_MESSAGE_MAX_LENGTH);
@@ -231,9 +214,9 @@ void Ack_receiver::run()
while (1)
{
- fd_set fds;
int ret;
- uint slave_count;
+ uint slave_count __attribute__((unused))= 0;
+ Slave *slave;
mysql_mutex_lock(&m_mutex);
if (unlikely(m_status == ST_STOPPING))
@@ -249,23 +232,26 @@ void Ack_receiver::run()
continue;
}
- max_fd= get_slave_sockets(&read_fds, &slave_count);
+ if ((slave_count= listener.init_slave_sockets()) == 0)
+ goto end;
m_slaves_changed= false;
- DBUG_PRINT("info", ("fd count %u, max_fd %d", slave_count,(int) max_fd));
+#ifdef HAVE_POLL
+ DBUG_PRINT("info", ("fd count %u", slave_count));
+#else
+ DBUG_PRINT("info", ("fd count %u, max_fd %d", slave_count,
+ (int) listener.get_max_fd()));
+#endif
}
- struct timeval tv= {1, 0};
- fds= read_fds;
- /* select requires max fd + 1 for the first argument */
- ret= select((int)(max_fd+1), &fds, NULL, NULL, &tv);
+ ret= listener.listen_on_sockets();
if (ret <= 0)
{
mysql_mutex_unlock(&m_mutex);
ret= DBUG_EVALUATE_IF("rpl_semisync_simulate_select_error", -1, ret);
- if (ret == -1)
- sql_print_information("Failed to select() on semi-sync dump sockets, "
+ if (ret == -1 && errno != EINTR)
+ sql_print_information("Failed to wait on semi-sync sockets, "
"error: errno=%d", socket_errno);
/* Sleep 1us, so other threads can catch the m_mutex easily. */
my_sleep(1);
@@ -273,11 +259,10 @@ void Ack_receiver::run()
}
set_stage_info(stage_reading_semi_sync_ack);
- I_List_iterator<Slave> it(m_slaves);
-
+ Slave_ilist_iterator it(m_slaves);
while ((slave= it++))
{
- if (FD_ISSET(slave->sock_fd(), &fds))
+ if (listener.is_socket_active(slave))
{
ulong len;
@@ -289,7 +274,7 @@ void Ack_receiver::run()
repl_semisync_master.report_reply_packet(slave->server_id(),
net.read_pos, len);
else if (net.last_errno == ER_NET_READ_ERROR)
- FD_CLR(slave->sock_fd(), &read_fds);
+ listener.clear_socket_info(slave);
}
}
mysql_mutex_unlock(&m_mutex);
@@ -298,8 +283,6 @@ end:
sql_print_information("Stopping ack receiver thread");
m_status= ST_DOWN;
delete thd;
- thread_safe_decrement32(&service_thread_count);
- signal_thd_deleted();
mysql_cond_broadcast(&m_cond);
mysql_mutex_unlock(&m_mutex);
DBUG_VOID_RETURN;
diff --git a/sql/semisync_master_ack_receiver.h b/sql/semisync_master_ack_receiver.h
index 619748a2159..feb3a51ccea 100644
--- a/sql/semisync_master_ack_receiver.h
+++ b/sql/semisync_master_ack_receiver.h
@@ -20,6 +20,22 @@
#include "my_pthread.h"
#include "sql_class.h"
#include "semisync.h"
+#include <vector>
+
+struct Slave :public ilink
+{
+ THD *thd;
+ Vio vio;
+#ifdef HAVE_POLL
+ uint m_fds_index;
+#endif
+ my_socket sock_fd() const { return vio.mysql_socket.fd; }
+ uint server_id() const { return thd->variables.server_id; }
+};
+
+typedef I_List<Slave> Slave_ilist;
+typedef I_List_iterator<Slave> Slave_ilist_iterator;
+
/**
Ack_receiver is responsible to control ack receive thread and maintain
slave information used by ack receive thread.
@@ -92,18 +108,7 @@ private:
/* If slave list is updated(add or remove). */
bool m_slaves_changed;
- class Slave :public ilink
- {
-public:
- THD *thd;
- Vio vio;
-
- my_socket sock_fd() { return vio.mysql_socket.fd; }
- uint server_id() { return thd->variables.server_id; }
- };
-
- I_List<Slave> m_slaves;
-
+ Slave_ilist m_slaves;
pthread_t m_pid;
/* Declare them private, so no one can copy the object. */
@@ -112,8 +117,124 @@ public:
void set_stage_info(const PSI_stage_info &stage);
void wait_for_slave_connection();
- my_socket get_slave_sockets(fd_set *fds, uint *count);
};
+
+#ifdef HAVE_POLL
+#include <sys/poll.h>
+#include <vector>
+
+class Poll_socket_listener
+{
+public:
+ Poll_socket_listener(const Slave_ilist &slaves)
+ :m_slaves(slaves)
+ {
+ }
+
+ bool listen_on_sockets()
+ {
+ return poll(m_fds.data(), m_fds.size(), 1000 /*1 Second timeout*/);
+ }
+
+ bool is_socket_active(const Slave *slave)
+ {
+ return m_fds[slave->m_fds_index].revents & POLLIN;
+ }
+
+ void clear_socket_info(const Slave *slave)
+ {
+ m_fds[slave->m_fds_index].fd= -1;
+ m_fds[slave->m_fds_index].events= 0;
+ }
+
+ uint init_slave_sockets()
+ {
+ Slave_ilist_iterator it(const_cast<Slave_ilist&>(m_slaves));
+ Slave *slave;
+ uint fds_index= 0;
+
+ m_fds.clear();
+ while ((slave= it++))
+ {
+ pollfd poll_fd;
+ poll_fd.fd= slave->sock_fd();
+ poll_fd.events= POLLIN;
+ m_fds.push_back(poll_fd);
+ slave->m_fds_index= fds_index++;
+ }
+ return fds_index;
+ }
+
+private:
+ const Slave_ilist &m_slaves;
+ std::vector<pollfd> m_fds;
+};
+
+#else //NO POLL
+
+class Select_socket_listener
+{
+public:
+ Select_socket_listener(const Slave_ilist &slaves)
+ :m_slaves(slaves), m_max_fd(INVALID_SOCKET)
+ {
+ }
+
+ bool listen_on_sockets()
+ {
+ /* Reinitialze the fds with active fds before calling select */
+ m_fds= m_init_fds;
+ struct timeval tv= {1,0};
+ /* select requires max fd + 1 for the first argument */
+ return select((int) m_max_fd+1, &m_fds, NULL, NULL, &tv);
+ }
+
+ bool is_socket_active(const Slave *slave)
+ {
+ return FD_ISSET(slave->sock_fd(), &m_fds);
+ }
+
+ void clear_socket_info(const Slave *slave)
+ {
+ FD_CLR(slave->sock_fd(), &m_init_fds);
+ }
+
+ uint init_slave_sockets()
+ {
+ Slave_ilist_iterator it(const_cast<Slave_ilist&>(m_slaves));
+ Slave *slave;
+ uint fds_index= 0;
+
+ FD_ZERO(&m_init_fds);
+ while ((slave= it++))
+ {
+ my_socket socket_id= slave->sock_fd();
+ m_max_fd= (socket_id > m_max_fd ? socket_id : m_max_fd);
+#ifndef WINDOWS
+ if (socket_id > FD_SETSIZE)
+ {
+ sql_print_error("Semisync slave socket fd is %u. "
+ "select() cannot handle if the socket fd is "
+ "greater than %u (FD_SETSIZE).", socket_id, FD_SETSIZE);
+ return 0;
+ }
+#endif //WINDOWS
+ FD_SET(socket_id, &m_init_fds);
+ fds_index++;
+ }
+ return fds_index;
+ }
+ my_socket get_max_fd() { return m_max_fd; }
+
+private:
+ const Slave_ilist &m_slaves;
+ my_socket m_max_fd;
+ fd_set m_init_fds;
+ fd_set m_fds;
+};
+
+#endif //HAVE_POLL
+
extern Ack_receiver ack_receiver;
#endif
diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc
new file mode 100644
index 00000000000..f4cf49b9b84
--- /dev/null
+++ b/sql/service_wsrep.cc
@@ -0,0 +1,255 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include "mariadb.h"
+
+#include "mysql/service_wsrep.h"
+#include "wsrep/key.hpp"
+#include "wsrep_thd.h"
+#include "wsrep_trans_observer.h"
+#include "sql_class.h"
+#include "debug_sync.h"
+
+extern "C" my_bool wsrep_on(const THD *thd)
+{
+ return my_bool(WSREP(thd));
+}
+
+extern "C" void wsrep_thd_LOCK(const THD *thd)
+{
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+}
+
+extern "C" void wsrep_thd_UNLOCK(const THD *thd)
+{
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+}
+
+extern "C" const char* wsrep_thd_client_state_str(const THD *thd)
+{
+ return wsrep::to_c_string(thd->wsrep_cs().state());
+}
+
+extern "C" const char* wsrep_thd_client_mode_str(const THD *thd)
+{
+ return wsrep::to_c_string(thd->wsrep_cs().mode());
+}
+
+extern "C" const char* wsrep_thd_transaction_state_str(const THD *thd)
+{
+ return wsrep::to_c_string(thd->wsrep_cs().transaction().state());
+}
+
+
+extern "C" const char *wsrep_thd_query(const THD *thd)
+{
+ return thd ? thd->query() : NULL;
+}
+
+extern "C" query_id_t wsrep_thd_transaction_id(const THD *thd)
+{
+ return thd->wsrep_cs().transaction().id().get();
+}
+
+extern "C" long long wsrep_thd_trx_seqno(const THD *thd)
+{
+ const wsrep::client_state& cs= thd->wsrep_cs();
+ if (cs.mode() == wsrep::client_state::m_toi)
+ {
+ return cs.toi_meta().seqno().get();
+ }
+ else
+ {
+ return cs.transaction().ws_meta().seqno().get();
+ }
+}
+
+extern "C" void wsrep_thd_self_abort(THD *thd)
+{
+ thd->wsrep_cs().bf_abort(wsrep::seqno(0));
+}
+
+extern "C" const char* wsrep_get_sr_table_name()
+{
+ return wsrep_sr_table_name_full;
+}
+
+extern "C" my_bool wsrep_get_debug()
+{
+ return wsrep_debug;
+}
+
+extern "C" my_bool wsrep_thd_is_local(const THD *thd)
+{
+ return thd->wsrep_cs().mode() == wsrep::client_state::m_local;
+}
+
+extern "C" my_bool wsrep_thd_is_applying(const THD *thd)
+{
+ return thd->wsrep_cs().mode() == wsrep::client_state::m_high_priority;
+}
+
+extern "C" my_bool wsrep_thd_is_toi(const THD *thd)
+{
+ return thd->wsrep_cs().mode() == wsrep::client_state::m_toi;
+}
+
+extern "C" my_bool wsrep_thd_is_local_toi(const THD *thd)
+{
+ return thd->wsrep_cs().mode() == wsrep::client_state::m_toi &&
+ thd->wsrep_cs().toi_mode() == wsrep::client_state::m_local;
+
+}
+
+extern "C" my_bool wsrep_thd_is_in_rsu(const THD *thd)
+{
+ return thd->wsrep_cs().mode() == wsrep::client_state::m_rsu;
+}
+
+extern "C" my_bool wsrep_thd_is_BF(const THD *thd, my_bool sync)
+{
+ my_bool status = FALSE;
+ if (thd && WSREP(thd))
+ {
+ if (sync) mysql_mutex_lock(&thd->LOCK_thd_data);
+ status = (wsrep_thd_is_applying(thd) || wsrep_thd_is_toi(thd));
+ if (sync) mysql_mutex_unlock(&thd->LOCK_thd_data);
+ }
+ return status;
+}
+
+extern "C" my_bool wsrep_thd_is_SR(const THD *thd)
+{
+ return thd && thd->wsrep_cs().transaction().is_streaming();
+}
+
+extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
+ THD *victim_thd)
+{
+ DBUG_ASSERT(victim_thd);
+ if (!victim_thd || !wsrep_on(bf_thd)) return;
+
+ WSREP_DEBUG("handle rollback, for deadlock: thd %llu trx_id %lu frags %lu conf %s",
+ victim_thd->thread_id,
+ victim_thd->wsrep_trx_id(),
+ victim_thd->wsrep_sr().fragments_certified(),
+ wsrep_thd_transaction_state_str(victim_thd));
+ if (bf_thd) victim_thd->store_globals();
+ if (!bf_thd)
+ {
+ DEBUG_SYNC(victim_thd, "wsrep_before_SR_rollback");
+ }
+ if (bf_thd)
+ {
+ wsrep_bf_abort(bf_thd, victim_thd);
+ }
+ else
+ {
+ wsrep_thd_self_abort(victim_thd);
+ }
+ if (bf_thd) bf_thd->store_globals();
+}
+
+extern "C" my_bool wsrep_thd_bf_abort(const THD *bf_thd, THD *victim_thd,
+ my_bool signal)
+{
+ if (WSREP(victim_thd) && !victim_thd->wsrep_trx().active())
+ {
+ WSREP_DEBUG("BF abort for non active transaction");
+ wsrep_start_transaction(victim_thd, victim_thd->wsrep_next_trx_id());
+ }
+ my_bool ret= wsrep_bf_abort(bf_thd, victim_thd);
+ /*
+ Send awake signal if victim was BF aborted or does not
+ have wsrep on. Note that this should never interrupt RSU
+ as RSU has paused the provider.
+ */
+ if ((ret || !wsrep_on(victim_thd)) && signal)
+ victim_thd->awake(KILL_QUERY);
+ return ret;
+}
+
+extern "C" my_bool wsrep_thd_skip_locking(const THD *thd)
+{
+ return thd && thd->wsrep_skip_locking;
+}
+
+extern "C" my_bool wsrep_thd_order_before(const THD *left, const THD *right)
+{
+ if (wsrep_thd_trx_seqno(left) < wsrep_thd_trx_seqno(right)) {
+ WSREP_DEBUG("BF conflict, order: %lld %lld\n",
+ (long long)wsrep_thd_trx_seqno(left),
+ (long long)wsrep_thd_trx_seqno(right));
+ return TRUE;
+ }
+ WSREP_DEBUG("waiting for BF, trx order: %lld %lld\n",
+ (long long)wsrep_thd_trx_seqno(left),
+ (long long)wsrep_thd_trx_seqno(right));
+ return FALSE;
+}
+
+extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd)
+{
+ mysql_mutex_assert_owner(&thd->LOCK_thd_data);
+ if (thd != 0)
+ {
+ const wsrep::client_state& cs(thd->wsrep_cs());
+ const enum wsrep::transaction::state tx_state(cs.transaction().state());
+ switch (tx_state)
+ {
+ case wsrep::transaction::s_must_abort:
+ return (cs.state() == wsrep::client_state::s_exec ||
+ cs.state() == wsrep::client_state::s_result);
+ case wsrep::transaction::s_aborting:
+ case wsrep::transaction::s_aborted:
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+}
+
+static inline enum wsrep::key::type
+map_key_type(enum Wsrep_service_key_type type)
+{
+ switch (type)
+ {
+ case WSREP_SERVICE_KEY_SHARED: return wsrep::key::shared;
+ case WSREP_SERVICE_KEY_REFERENCE: return wsrep::key::reference;
+ case WSREP_SERVICE_KEY_UPDATE: return wsrep::key::update;
+ case WSREP_SERVICE_KEY_EXCLUSIVE: return wsrep::key::exclusive;
+ }
+ return wsrep::key::exclusive;
+}
+
+extern "C" int wsrep_thd_append_key(THD *thd,
+ const struct wsrep_key* key,
+ int n_keys,
+ enum Wsrep_service_key_type key_type)
+{
+ Wsrep_client_state& client_state(thd->wsrep_cs());
+ DBUG_ASSERT(client_state.transaction().active());
+ int ret= 0;
+ for (int i= 0; i < n_keys && ret == 0; ++i)
+ {
+ wsrep::key wsrep_key(map_key_type(key_type));
+ for (size_t kp= 0; kp < key[i].key_parts_num; ++kp)
+ {
+ wsrep_key.append_key_part(key[i].key_parts[kp].ptr, key[i].key_parts[kp].len);
+ }
+ ret= client_state.append_key(wsrep_key);
+ }
+ return ret;
+}
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index e73666cfb58..e09afebe074 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -5449,8 +5449,8 @@ ER_DIVISION_BY_ZERO 22012
ger "Division durch 0"
hindi "0 से विभाजन"
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 22007
- eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu"
- ger "Falscher %-.32s-Wert: '%-.128s' für Feld '%.192s' in Zeile %lu"
+ eng "Incorrect %-.32s value: '%-.128s' for column `%.192s`.`%.192s`.`%.192s` at row %lu"
+ ger "Falscher %-.32s-Wert: '%-.128s' für Feld '`%.192s`.`%.192s`.`%.192s` in Zeile %lu"
ER_ILLEGAL_VALUE_FOR_TYPE 22007
eng "Illegal %s '%-.192s' value found during parsing"
ger "Nicht zulässiger %s-Wert '%-.192s' beim Parsen gefunden"
@@ -7921,3 +7921,15 @@ ER_KEY_DOESNT_SUPPORT
eng "%s index %`s does not support this operation"
ER_ALTER_OPERATION_TABLE_OPTIONS_NEED_REBUILD
eng "Changing table options requires the table to be rebuilt"
+ER_BACKUP_LOCK_IS_ACTIVE
+ eng "Can't execute the command as you have a BACKUP STAGE active"
+ER_BACKUP_NOT_RUNNING
+ eng "You must start backup with \"BACKUP STAGE START\""
+ER_BACKUP_WRONG_STAGE
+ eng "Backup stage '%s' is same or before current backup stage '%s'"
+ER_BACKUP_STAGE_FAILED
+ eng "Backup stage '%s' failed"
+ER_BACKUP_UNKNOWN_STAGE
+ eng "Unknown backup stage: '%s'. Stage should be one of START, FLUSH, BLOCK_DDL, BLOCK_COMMIT or END"
+ER_USER_IS_BLOCKED
+ eng "User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'"
diff --git a/sql/slave.cc b/sql/slave.cc
index 16fa890d86c..17a63e94661 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -53,6 +53,9 @@
// Create_file_log_event,
// Format_description_log_event
#include "wsrep_mysqld.h"
+#ifdef WITH_WSREP
+#include "wsrep_trans_observer.h"
+#endif
#ifdef HAVE_REPLICATION
@@ -465,6 +468,8 @@ static struct slave_background_gtid_pos_create_t {
void *hton;
} *slave_background_gtid_pos_create_list;
+static volatile bool slave_background_gtid_pending_delete_flag;
+
pthread_handler_t
handle_slave_background(void *arg __attribute__((unused)))
@@ -477,7 +482,6 @@ handle_slave_background(void *arg __attribute__((unused)))
thd= new THD(next_thread_id());
thd->thread_stack= (char*) &thd; /* Set approximate stack start */
thd->system_thread = SYSTEM_THREAD_SLAVE_BACKGROUND;
- thread_safe_increment32(&service_thread_count);
thd->store_globals();
thd->security_ctx->skip_grants();
thd->set_command(COM_DAEMON);
@@ -499,6 +503,7 @@ handle_slave_background(void *arg __attribute__((unused)))
{
slave_background_kill_t *kill_list;
slave_background_gtid_pos_create_t *create_list;
+ bool pending_deletes;
thd->ENTER_COND(&COND_slave_background, &LOCK_slave_background,
&stage_slave_background_wait_request,
@@ -508,13 +513,15 @@ handle_slave_background(void *arg __attribute__((unused)))
stop= abort_loop || thd->killed || slave_background_thread_stop;
kill_list= slave_background_kill_list;
create_list= slave_background_gtid_pos_create_list;
- if (stop || kill_list || create_list)
+ pending_deletes= slave_background_gtid_pending_delete_flag;
+ if (stop || kill_list || create_list || pending_deletes)
break;
mysql_cond_wait(&COND_slave_background, &LOCK_slave_background);
}
slave_background_kill_list= NULL;
slave_background_gtid_pos_create_list= NULL;
+ slave_background_gtid_pending_delete_flag= false;
thd->EXIT_COND(&old_stage);
while (kill_list)
@@ -541,6 +548,17 @@ handle_slave_background(void *arg __attribute__((unused)))
create_list= next;
}
+ if (pending_deletes)
+ {
+ rpl_slave_state::list_element *list;
+
+ slave_background_gtid_pending_delete_flag= false;
+ list= rpl_global_gtid_slave_state->gtid_grab_pending_delete_list();
+ rpl_global_gtid_slave_state->gtid_delete_pending(thd, &list);
+ if (list)
+ rpl_global_gtid_slave_state->put_back_list(list);
+ }
+
mysql_mutex_lock(&LOCK_slave_background);
} while (!stop);
@@ -549,8 +567,6 @@ handle_slave_background(void *arg __attribute__((unused)))
mysql_mutex_unlock(&LOCK_slave_background);
delete thd;
- thread_safe_decrement32(&service_thread_count);
- signal_thd_deleted();
my_thread_end();
return 0;
@@ -615,6 +631,23 @@ slave_background_gtid_pos_create_request(
/*
+ Request the slave background thread to delete no longer used rows from the
+ mysql.gtid_slave_pos* tables.
+
+ This is called from time-critical rpl_slave_state::update(), so we avoid
+ taking any locks here. This means we may race with the background thread
+ to occasionally lose a signal. This is not a problem; any pending rows to
+ be deleted will just be deleted a bit later as part of the next batch.
+*/
+void
+slave_background_gtid_pending_delete_request(void)
+{
+ slave_background_gtid_pending_delete_flag= true;
+ mysql_cond_signal(&COND_slave_background);
+}
+
+
+/*
Start the slave background thread.
This thread is currently used for two purposes:
@@ -1168,6 +1201,11 @@ terminate_slave_thread(THD *thd,
int error __attribute__((unused));
DBUG_PRINT("loop", ("killing slave thread"));
+#ifdef WITH_WSREP
+ /* awake_no_mutex() requires LOCK_thd_data to be locked if wsrep
+ is enabled */
+ if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
+#endif /* WITH_WSREP */
mysql_mutex_lock(&thd->LOCK_thd_kill);
#ifndef DONT_USE_THR_ALARM
/*
@@ -1181,6 +1219,9 @@ terminate_slave_thread(THD *thd,
thd->awake_no_mutex(NOT_KILLED);
mysql_mutex_unlock(&thd->LOCK_thd_kill);
+#ifdef WITH_WSREP
+ if (WSREP(thd)) mysql_mutex_unlock(&thd->LOCK_thd_data);
+#endif /* WITH_WSREP */
/*
There is a small chance that slave thread might miss the first
@@ -3374,16 +3415,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
// Slave_SQL_Running_State
protocol->store(slave_sql_running_state, &my_charset_bin);
- uint64 events;
- events= (uint64)my_atomic_load64_explicit((volatile int64 *)
- &mi->total_ddl_groups, MY_MEMORY_ORDER_RELAXED);
- protocol->store(events);
- events= (uint64)my_atomic_load64_explicit((volatile int64 *)
- &mi->total_non_trans_groups, MY_MEMORY_ORDER_RELAXED);
- protocol->store(events);
- events= (uint64)my_atomic_load64_explicit((volatile int64 *)
- &mi->total_trans_groups, MY_MEMORY_ORDER_RELAXED);
- protocol->store(events);
+ protocol->store(mi->total_ddl_groups);
+ protocol->store(mi->total_non_trans_groups);
+ protocol->store(mi->total_trans_groups);
if (full)
{
@@ -3541,7 +3575,6 @@ static int init_slave_thread(THD* thd, Master_info *mi,
thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
- thread_safe_increment32(&service_thread_count);
/* We must call store_globals() before doing my_net_init() */
if (init_thr_lock() || thd->store_globals() ||
@@ -3917,14 +3950,20 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi,
exec_res= ev->apply_event(rgi);
#ifdef WITH_WSREP
- if (exec_res && thd->wsrep_conflict_state != NO_CONFLICT)
+ if (WSREP_ON)
+ {
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (exec_res &&
+ thd->wsrep_trx().state() != wsrep::transaction::s_executing)
{
- WSREP_DEBUG("SQL apply failed, res %d conflict state: %d",
- exec_res, thd->wsrep_conflict_state);
+ WSREP_DEBUG("SQL apply failed, res %d conflict state: %s",
+ exec_res, wsrep_thd_transaction_state_str(thd));
rli->abort_slave= 1;
rli->report(ERROR_LEVEL, ER_UNKNOWN_COM_ERROR, rgi->gtid_info(),
"Node has dropped from cluster");
}
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ }
#endif
#ifndef DBUG_OFF
@@ -4217,6 +4256,13 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
}
if (ev)
{
+#ifdef WITH_WSREP
+ if (wsrep_before_statement(thd))
+ {
+ WSREP_INFO("Wsrep before statement error");
+ DBUG_RETURN(1);
+ }
+#endif /* WITH_WSREP */
int exec_res;
Log_event_type typ= ev->get_type_code();
@@ -4248,9 +4294,9 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) &&
(ev->server_id != global_system_variables.server_id ||
rli->replicate_same_server_id) &&
- rli->is_until_satisfied((rli->get_flag(Relay_log_info::IN_TRANSACTION) || !ev->log_pos)
- ? rli->group_master_log_pos
- : ev->log_pos - ev->data_written))
+ rli->is_until_satisfied((rli->get_flag(Relay_log_info::IN_TRANSACTION) || !ev->log_pos)
+ ? rli->group_master_log_pos
+ : ev->log_pos - ev->data_written))
{
sql_print_information("Slave SQL thread stopped because it reached its"
" UNTIL position %llu", rli->until_pos());
@@ -4261,6 +4307,9 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
rli->abort_slave= 1;
rli->stop_for_until= true;
mysql_mutex_unlock(&rli->data_lock);
+#ifdef WITH_WSREP
+ wsrep_after_statement(thd);
+#endif /* WITH_WSREP */
delete ev;
DBUG_RETURN(1);
}
@@ -4298,7 +4347,12 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
if (res == 0)
rli->event_relay_log_pos= rli->future_event_relay_log_pos;
if (res >= 0)
+ {
+#ifdef WITH_WSREP
+ wsrep_after_statement(thd);
+#endif /* WITH_WSREP */
DBUG_RETURN(res);
+ }
/*
Else we proceed to execute the event non-parallel.
This is the case for pre-10.0 events without GTID, and for handling
@@ -4333,6 +4387,9 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
"aborted because of out-of-memory error");
mysql_mutex_unlock(&rli->data_lock);
delete ev;
+#ifdef WITH_WSREP
+ wsrep_after_statement(thd);
+#endif /* WITH_WSREP */
DBUG_RETURN(1);
}
@@ -4347,6 +4404,9 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
"thread aborted because of out-of-memory error");
mysql_mutex_unlock(&rli->data_lock);
delete ev;
+#ifdef WITH_WSREP
+ wsrep_after_statement(thd);
+#endif /* WITH_WSREP */
DBUG_RETURN(1);
}
/*
@@ -4375,13 +4435,17 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
retry.
*/
if (unlikely(exec_res == 2))
+ {
+#ifdef WITH_WSREP
+ wsrep_after_statement(thd);
+#endif /* WITH_WSREP */
DBUG_RETURN(1);
-
+ }
#ifdef WITH_WSREP
mysql_mutex_lock(&thd->LOCK_thd_data);
- if (thd->wsrep_conflict_state == NO_CONFLICT)
- {
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ enum wsrep::client_error wsrep_error= thd->wsrep_cs().current_error();
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ if (wsrep_error == wsrep::e_success)
#endif /* WITH_WSREP */
if (slave_trans_retries)
{
@@ -4394,8 +4458,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
We were in a transaction which has been rolled back because of a
temporary error;
let's seek back to BEGIN log event and retry it all again.
- Note, if lock wait timeout (innodb_lock_wait_timeout exceeded)
- there is no rollback since 5.0.13 (ref: manual).
+ Note, if lock wait timeout (innodb_lock_wait_timeout exceeded)
+ there is no rollback since 5.0.13 (ref: manual).
We have to not only seek but also
a) init_master_info(), to seek back to hot relay log's start
@@ -4456,13 +4520,11 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
serial_rgi->trans_retries));
}
}
-#ifdef WITH_WSREP
- }
- else
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-#endif /* WITH_WSREP */
thread_safe_increment64(&rli->executed_entries);
+#ifdef WITH_WSREP
+ wsrep_after_statement(thd);
+#endif /* WITH_WSREP */
DBUG_RETURN(exec_res);
}
mysql_mutex_unlock(&rli->data_lock);
@@ -4632,7 +4694,7 @@ pthread_handler_t handle_slave_io(void *arg)
goto err_during_init;
}
thd->system_thread_info.rpl_io_info= &io_info;
- add_to_active_threads(thd);
+ server_threads.insert(thd);
mi->slave_running = MYSQL_SLAVE_RUN_NOT_CONNECT;
mi->abort_slave = 0;
mysql_mutex_unlock(&mi->run_lock);
@@ -5014,7 +5076,7 @@ err:
flush_master_info(mi, TRUE, TRUE);
THD_STAGE_INFO(thd, stage_waiting_for_slave_mutex_on_exit);
thd->add_status_to_global();
- unlink_not_visible_thd(thd);
+ server_threads.erase(thd);
mysql_mutex_lock(&mi->run_lock);
err_during_init:
@@ -5026,8 +5088,6 @@ err_during_init:
thd->assert_not_linked();
delete thd;
- thread_safe_decrement32(&service_thread_count);
- signal_thd_deleted();
mi->abort_slave= 0;
mi->slave_running= MYSQL_SLAVE_NOT_RUN;
@@ -5302,7 +5362,7 @@ pthread_handler_t handle_slave_sql(void *arg)
/* Ensure that slave can exeute any alter table it gets from master */
thd->variables.alter_algorithm= (ulong) Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT;
- add_to_active_threads(thd);
+ server_threads.insert(thd);
/*
We are going to set slave_running to 1. Assuming slave I/O thread is
alive and connected, this is going to make Seconds_Behind_Master be 0
@@ -5389,12 +5449,6 @@ pthread_handler_t handle_slave_sql(void *arg)
}
#endif
-#ifdef WITH_WSREP
- thd->wsrep_exec_mode= LOCAL_STATE;
- /* synchronize with wsrep replication */
- if (WSREP_ON)
- wsrep_ready_wait();
-#endif
DBUG_PRINT("master_info",("log_file_name: %s position: %llu",
rli->group_master_log_name,
rli->group_master_log_pos));
@@ -5491,7 +5545,14 @@ pthread_handler_t handle_slave_sql(void *arg)
goto err;
}
mysql_mutex_unlock(&rli->data_lock);
-
+#ifdef WITH_WSREP
+ wsrep_open(thd);
+ if (wsrep_before_command(thd))
+ {
+ WSREP_WARN("Slave SQL wsrep_before_command() failed");
+ goto err;
+ }
+#endif /* WITH_WSREP */
/* Read queries from the IO/THREAD until this thread is killed */
thd->set_command(COM_SLAVE_SQL);
@@ -5528,10 +5589,16 @@ pthread_handler_t handle_slave_sql(void *arg)
if (exec_relay_log_event(thd, rli, serial_rgi))
{
#ifdef WITH_WSREP
- if (thd->wsrep_conflict_state != NO_CONFLICT)
+ if (WSREP_ON)
{
- wsrep_node_dropped= TRUE;
- rli->abort_slave= TRUE;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+
+ if (thd->wsrep_cs().current_error())
+ {
+ wsrep_node_dropped = TRUE;
+ rli->abort_slave = TRUE;
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
}
#endif /* WITH_WSREP */
@@ -5564,6 +5631,10 @@ pthread_handler_t handle_slave_sql(void *arg)
"log '%s' at position %llu%s", RPL_LOG_NAME,
rli->group_master_log_pos, tmp.c_ptr_safe());
}
+#ifdef WITH_WSREP
+ wsrep_after_command_before_result(thd);
+ wsrep_after_command_after_result(thd);
+#endif /* WITH_WSREP */
err_before_start:
@@ -5637,7 +5708,7 @@ pthread_handler_t handle_slave_sql(void *arg)
}
THD_STAGE_INFO(thd, stage_waiting_for_slave_mutex_on_exit);
thd->add_status_to_global();
- unlink_not_visible_thd(thd);
+ server_threads.erase(thd);
mysql_mutex_lock(&rli->run_lock);
err_during_init:
@@ -5682,17 +5753,17 @@ err_during_init:
"SQL slave will continue");
wsrep_node_dropped= FALSE;
mysql_mutex_unlock(&rli->run_lock);
- WSREP_DEBUG("wsrep_conflict_state now: %d", thd->wsrep_conflict_state);
- WSREP_INFO("slave restart: %d", thd->wsrep_conflict_state);
- thd->wsrep_conflict_state= NO_CONFLICT;
goto wsrep_restart_point;
- } else {
+ }
+ else
+ {
WSREP_INFO("Slave error due to node going non-primary");
WSREP_INFO("wsrep_restart_slave was set and therefore slave will be "
- "automatically restarted when node joins back to cluster.");
+ "automatically restarted when node joins back to cluster");
wsrep_restart_slave_activated= TRUE;
}
}
+ wsrep_close(thd);
#endif /* WITH_WSREP */
/*
@@ -5709,8 +5780,6 @@ err_during_init:
delete serial_rgi;
delete thd;
- thread_safe_decrement32(&service_thread_count);
- signal_thd_deleted();
DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
@@ -7910,8 +7979,8 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
{
struct st_version_range_for_one_bug {
uint bug_id;
- const uchar introduced_in[3]; // first version with bug
- const uchar fixed_in[3]; // first version with fix
+ Version introduced_in; // first version with bug
+ Version fixed_in; // first version with fix
};
static struct st_version_range_for_one_bug versions_for_all_bugs[]=
{
@@ -7921,19 +7990,17 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
{33029, { 5, 1, 0 }, { 5, 1, 12 } },
{37426, { 5, 1, 0 }, { 5, 1, 26 } },
};
- const uchar *master_ver=
- rli->relay_log.description_event_for_exec->server_version_split.ver;
-
- DBUG_ASSERT(sizeof(rli->relay_log.description_event_for_exec->server_version_split.ver) == 3);
+ const Version &master_ver=
+ rli->relay_log.description_event_for_exec->server_version_split;
for (uint i= 0;
i < sizeof(versions_for_all_bugs)/sizeof(*versions_for_all_bugs);i++)
{
- const uchar *introduced_in= versions_for_all_bugs[i].introduced_in,
- *fixed_in= versions_for_all_bugs[i].fixed_in;
+ const Version &introduced_in= versions_for_all_bugs[i].introduced_in;
+ const Version &fixed_in= versions_for_all_bugs[i].fixed_in;
if ((versions_for_all_bugs[i].bug_id == bug_id) &&
- (memcmp(introduced_in, master_ver, 3) <= 0) &&
- (memcmp(fixed_in, master_ver, 3) > 0) &&
+ introduced_in <= master_ver &&
+ fixed_in > master_ver &&
(pred == NULL || (*pred)(param)))
{
if (!report)
diff --git a/sql/slave.h b/sql/slave.h
index 649d55b45b9..12d569b0333 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -276,6 +276,7 @@ bool net_request_file(NET* net, const char* fname);
void slave_background_kill_request(THD *to_kill);
void slave_background_gtid_pos_create_request
(rpl_slave_state::gtid_pos_table *table_entry);
+void slave_background_gtid_pending_delete_request(void);
extern bool volatile abort_loop;
extern Master_info *active_mi; /* active_mi for multi-master */
diff --git a/sql/sp.cc b/sql/sp.cc
index 723f30ec85d..6b38a0ddeb5 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -200,7 +200,8 @@ TABLE_FIELD_TYPE proc_table_fields[MYSQL_PROC_FIELD_COUNT] =
"'STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES',"
"'ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER',"
"'HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH',"
- "'EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT')") },
+ "'EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT',"
+ "'TIME_ROUND_FRACTIONAL')") },
{ NULL, 0 }
},
{
@@ -1793,8 +1794,8 @@ bool lock_db_routines(THD *thd, const char *db)
close_system_tables(thd, &open_tables_state_backup);
/* We should already hold a global IX lock and a schema X lock. */
- DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE) &&
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
+ MDL_BACKUP_DDL) &&
thd->mdl_context.is_lock_owner(MDL_key::SCHEMA, db, "",
MDL_EXCLUSIVE));
DBUG_RETURN(thd->mdl_context.acquire_locks(&mdl_requests,
diff --git a/sql/sp.h b/sql/sp.h
index 380dd69d3a1..a72d5b78262 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -522,12 +522,11 @@ inline const Sp_handler *Sp_handler::handler(MDL_key::enum_mdl_namespace type)
return &sp_handler_procedure;
case MDL_key::PACKAGE_BODY:
return &sp_handler_package_body;
- case MDL_key::GLOBAL:
+ case MDL_key::BACKUP:
case MDL_key::SCHEMA:
case MDL_key::TABLE:
case MDL_key::TRIGGER:
case MDL_key::EVENT:
- case MDL_key::COMMIT:
case MDL_key::USER_LOCK:
case MDL_key::NAMESPACE_END:
break;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index c86edc47bf9..8345a9efe61 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -44,6 +44,9 @@
#include "transaction.h" // trans_commit_stmt
#include "sql_audit.h"
#include "debug_sync.h"
+#ifdef WITH_WSREP
+#include "wsrep_trans_observer.h"
+#endif /* WITH_WSREP */
/*
Sufficient max length of printed destinations and frame offsets (all uints).
@@ -1324,6 +1327,13 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
sql_digest_state *parent_digest= thd->m_digest;
thd->m_digest= NULL;
+#ifdef WITH_WSREP
+ if (WSREP(thd) && thd->wsrep_next_trx_id() == WSREP_UNDEFINED_TRX_ID)
+ {
+ thd->set_wsrep_next_trx_id(thd->query_id);
+ WSREP_DEBUG("assigned new next trx ID for SP, trx id: %lu", thd->wsrep_next_trx_id());
+ }
+#endif /* WITH_WSREP */
err_status= i->execute(thd, &ip);
thd->m_digest= parent_digest;
@@ -3566,6 +3576,24 @@ sp_instr_stmt::exec_core(THD *thd, uint *nextp)
(char *)thd->security_ctx->host_or_ip,
3);
int res= mysql_execute_command(thd);
+#ifdef WITH_WSREP
+ if ((thd->is_fatal_error || thd->killed_errno()) &&
+ (thd->wsrep_trx().state() == wsrep::transaction::s_executing))
+ {
+ /*
+ SP was killed, and it is not due to a wsrep conflict.
+ We skip after_command hook at this point because
+ otherwise it clears the error, and cleans up the
+ whole transaction. For now we just return and finish
+ our handling once we are back to mysql_parse.
+ */
+ WSREP_DEBUG("Skipping after_command hook for killed SP");
+ }
+ else
+ {
+ (void) wsrep_after_statement(thd);
+ }
+#endif /* WITH_WSREP */
MYSQL_QUERY_EXEC_DONE(res);
*nextp= m_ip+1;
return res;
@@ -4444,24 +4472,26 @@ sp_instr_cursor_copy_struct::exec_core(THD *thd, uint *nextp)
*/
if (!row->arguments())
{
- sp_cursor tmp(thd, &m_lex_keeper);
+ sp_cursor tmp(thd, &m_lex_keeper, true);
// Open the cursor without copying data
- if (!(ret= tmp.open_view_structure_only(thd)))
+ if (!(ret= tmp.open(thd)))
{
Row_definition_list defs;
+ /*
+ Create row elements on the caller arena.
+ It's the same arena that was used during sp_rcontext::create().
+ This puts cursor%ROWTYPE elements on the same mem_root
+ where explicit ROW elements and table%ROWTYPE reside:
+ - tmp.export_structure() allocates new Spvar_definition instances
+ and their components (such as TYPELIBs).
+ - row->row_create_items() creates new Item_field instances.
+ They all are created on the same mem_root.
+ */
+ Query_arena current_arena;
+ thd->set_n_backup_active_arena(thd->spcont->callers_arena, &current_arena);
if (!(ret= tmp.export_structure(thd, &defs)))
- {
- /*
- Create row elements on the caller arena.
- It's the same arena that was used during sp_rcontext::create().
- This puts cursor%ROWTYPE elements on the same mem_root
- where explicit ROW elements and table%ROWTYPE reside.
- */
- Query_arena current_arena;
- thd->set_n_backup_active_arena(thd->spcont->callers_arena, &current_arena);
row->row_create_items(thd, &defs);
- thd->restore_active_arena(thd->spcont->callers_arena, &current_arena);
- }
+ thd->restore_active_arena(thd->spcont->callers_arena, &current_arena);
tmp.close(thd);
}
}
@@ -4501,8 +4531,8 @@ int
sp_instr_error::execute(THD *thd, uint *nextp)
{
DBUG_ENTER("sp_instr_error::execute");
-
my_message(m_errcode, ER_THD(thd, m_errcode), MYF(0));
+ WSREP_DEBUG("sp_instr_error: %s %d", ER_THD(thd, m_errcode), thd->is_error());
*nextp= m_ip+1;
DBUG_RETURN(-1);
}
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index 83d674e7500..b0fee18ef05 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -409,6 +409,19 @@ sp_condition_value *sp_pcontext::find_condition(const LEX_CSTRING *name,
NULL;
}
+sp_condition_value *
+sp_pcontext::find_declared_or_predefined_condition(THD *thd,
+ const LEX_CSTRING *name)
+ const
+{
+ sp_condition_value *p= find_condition(name, false);
+ if (p)
+ return p;
+ if (thd->variables.sql_mode & MODE_ORACLE)
+ return find_predefined_condition(name);
+ return NULL;
+}
+
static sp_condition_value
// Warnings
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index e30af3fcde5..e607315cdaf 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -592,13 +592,7 @@ public:
bool current_scope_only) const;
sp_condition_value *
- find_declared_or_predefined_condition(const LEX_CSTRING *name) const
- {
- sp_condition_value *p= find_condition(name, false);
- if (p)
- return p;
- return find_predefined_condition(name);
- }
+ find_declared_or_predefined_condition(THD *thd, const LEX_CSTRING *name) const;
bool declare_condition(THD *thd, const LEX_CSTRING *name,
sp_condition_value *val)
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index a31631e33ef..e71a529bc07 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -750,33 +750,6 @@ int sp_cursor::open(THD *thd)
}
-/**
- Open the cursor, but do not copy data.
- This method is used to fetch the cursor structure
- to cursor%ROWTYPE routine variables.
- Data copying is suppressed by setting thd->lex->limit_rows_examined to 0.
-*/
-int sp_cursor::open_view_structure_only(THD *thd)
-{
- int res;
- int thd_no_errors_save= thd->no_errors;
- Item *limit_rows_examined= thd->lex->limit_rows_examined; // No data copying
- if (!(thd->lex->limit_rows_examined= new (thd->mem_root) Item_uint(thd, 0)))
- return -1;
- thd->no_errors= true; // Suppress ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT
- DBUG_ASSERT(!thd->killed);
- res= open(thd);
- /*
- The query possibly exited on LIMIT ROWS EXAMINED and set thd->killed.
- Reset it now.
- */
- thd->reset_killed();
- thd->no_errors= thd_no_errors_save;
- thd->lex->limit_rows_examined= limit_rows_examined;
- return res;
-}
-
-
int sp_cursor::close(THD *thd)
{
if (! server_side_cursor)
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 052c5ada3a2..01b560cd59b 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -60,6 +60,7 @@
#define MAX_SCRAMBLE_LENGTH 1024
bool mysql_user_table_is_in_short_password_format= false;
+bool using_global_priv_table= true;
static LEX_CSTRING native_password_plugin_name= {
STRING_WITH_LEN("mysql_native_password")
@@ -146,6 +147,7 @@ public:
size_t hostname_length;
USER_RESOURCES user_resource;
enum SSL_type ssl_type;
+ uint password_errors;
const char *ssl_cipher, *x509_issuer, *x509_subject;
LEX_CSTRING plugin;
LEX_CSTRING auth_string;
@@ -187,6 +189,8 @@ public:
bool eq(const char *user2, const char *host2) { return !cmp(user2, host2); }
+ const char *get_username(){ return user.str; }
+
bool wild_eq(const char *user2, const char *host2, const char *ip2)
{
if (strcmp(user.str, user2))
@@ -228,6 +232,8 @@ public:
acl_host_and_ip host;
const char *user,*db;
ulong initial_access; /* access bits present in the table */
+
+ const char *get_username() { return user; }
};
#ifndef DBUG_OFF
@@ -592,7 +598,9 @@ bool ROLE_GRANT_PAIR::init(MEM_ROOT *mem, const char *username,
/* Flag to mark that on_node was already called for this role */
#define ROLE_OPENED (1L << 3)
-static DYNAMIC_ARRAY acl_hosts, acl_users, acl_dbs, acl_proxy_users;
+static DYNAMIC_ARRAY acl_hosts, acl_users, acl_proxy_users;
+static Dynamic_array<ACL_DB> acl_dbs(0U,50U);
+typedef Dynamic_array<ACL_DB>::CMP_FUNC acl_dbs_cmp;
static HASH acl_roles;
/*
An hash containing mappings user <--> role
@@ -610,7 +618,11 @@ static DYNAMIC_ARRAY acl_wild_hosts;
static Hash_filo<acl_entry> *acl_cache;
static uint grant_version=0; /* Version of priv tables. incremented by acl_load */
static ulong get_access(TABLE *form,uint fieldnr, uint *next_field=0);
-static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b);
+static int acl_compare(const ACL_ACCESS *a, const ACL_ACCESS *b);
+static int acl_user_compare(const ACL_USER *a, const ACL_USER *b);
+static void rebuild_acl_users();
+static int acl_db_compare(const ACL_DB *a, const ACL_DB *b);
+static void rebuild_acl_dbs();
static ulong get_sort(uint count,...);
static void init_check_host(void);
static void rebuild_check_host(void);
@@ -666,7 +678,6 @@ HASH *Sp_handler_package_body::get_priv_hash() const
*/
enum enum_acl_tables
{
- USER_TABLE,
DB_TABLE,
TABLES_PRIV_TABLE,
COLUMNS_PRIV_TABLE,
@@ -675,7 +686,7 @@ enum enum_acl_tables
PROCS_PRIV_TABLE,
PROXIES_PRIV_TABLE,
ROLES_MAPPING_TABLE,
- TABLES_MAX // <== always the last
+ USER_TABLE // <== always the last
};
// bits for open_grant_tables
static const int Table_user= 1 << USER_TABLE;
@@ -687,6 +698,31 @@ static const int Table_procs_priv= 1 << PROCS_PRIV_TABLE;
static const int Table_proxies_priv= 1 << PROXIES_PRIV_TABLE;
static const int Table_roles_mapping= 1 << ROLES_MAPPING_TABLE;
+static LEX_CSTRING MYSQL_TABLE_NAME[USER_TABLE+1]= {
+ {STRING_WITH_LEN("db")},
+ {STRING_WITH_LEN("tables_priv")},
+ {STRING_WITH_LEN("columns_priv")},
+ {STRING_WITH_LEN("host")},
+ {STRING_WITH_LEN("procs_priv")},
+ {STRING_WITH_LEN("proxies_priv")},
+ {STRING_WITH_LEN("roles_mapping")},
+ {STRING_WITH_LEN("global_priv")}
+};
+static LEX_CSTRING MYSQL_TABLE_NAME_USER={STRING_WITH_LEN("user")};
+
+/**
+ Choose from either native or old password plugins when assigning a password
+*/
+
+static LEX_CSTRING &guess_auth_plugin(THD *thd, size_t password_len)
+{
+ if (thd->variables.old_passwords == 1 ||
+ password_len == SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
+ return old_password_plugin_name;
+ else
+ return native_password_plugin_name;
+}
+
/**
Base class representing a generic grant table from the mysql database.
@@ -701,105 +737,43 @@ class Grant_table_base
{
public:
/* Number of fields for this Grant Table. */
- uint num_fields() const { return tl.table->s->fields; }
+ uint num_fields() const { return m_table->s->fields; }
/* Check if the table exists after an attempt to open it was made.
Some tables, such as the host table in MySQL 5.6.7+ are missing. */
- bool table_exists() const { return tl.table; };
+ bool table_exists() const { return m_table; };
/* Initializes the READ_RECORD structure provided as a parameter
to read through the whole table, with all columns available. Cleaning up
is the caller's job. */
- bool init_read_record(READ_RECORD* info, THD* thd) const
+ bool init_read_record(READ_RECORD* info) const
{
- DBUG_ASSERT(tl.table);
- bool result= ::init_read_record(info, thd, tl.table, NULL, NULL, 1,
- true, false);
+ DBUG_ASSERT(m_table);
+ bool result= ::init_read_record(info, m_table->in_use, m_table,
+ NULL, NULL, 1, true, false);
if (!result)
- tl.table->use_all_columns();
+ m_table->use_all_columns();
return result;
}
- /* Return the number of privilege columns for this table. */
- uint num_privileges() const { return num_privilege_cols; }
- /* Return a privilege column by index. */
- Field* priv_field(uint privilege_idx) const
- {
- DBUG_ASSERT(privilege_idx < num_privileges());
- return tl.table->field[start_privilege_column + privilege_idx];
- }
-
- /* Fetch the privileges from the table as a set of bits. The first column
- is represented by the first bit in the result, the second column by the
- second bit, etc. */
- ulong get_access() const
- {
- return get_access(start_privilege_column,
- start_privilege_column + num_privileges() - 1);
- }
-
/* Return the underlying TABLE handle. */
- TABLE* table() const
- {
- return tl.table;
- }
-
- /** Check if the table was opened, issue an error otherwise. */
- int no_such_table() const
- {
- if (table_exists())
- return 0;
-
- my_error(ER_NO_SUCH_TABLE, MYF(0), tl.db.str, tl.alias.str);
- return 1;
- }
-
-
- protected:
- friend class Grant_tables;
-
- Grant_table_base() : start_privilege_column(0), num_privilege_cols(0)
- {
- bzero(&tl, sizeof(tl));
- };
-
- /* Initialization sequence common for all grant tables. This should be called
- after all table-specific initialization is performed. */
- void init(enum thr_lock_type lock_type, bool is_optional)
- {
- tl.open_type= OT_BASE_ONLY;
- if (lock_type >= TL_WRITE_ALLOW_WRITE)
- tl.updating= 1;
- if (is_optional)
- tl.open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
- }
-
- /*
- Get all access bits from table between start_field and end_field indices.
-
- IMPLEMENTATION
- The record should be already read in table->record[0]. All privileges
- are specified as an ENUM(Y,N).
+ TABLE* table() const { return m_table; }
- SYNOPSIS
- get_access()
- start_field_idx The field index at which the first privilege
- specification begins.
- end_field_idx The field index at which the last privilege
- specification is located.
-
- RETURN VALUE
- privilege mask
- */
- ulong get_access(uint start_field_idx, uint end_field_idx) const
+ ulong get_access() const
{
ulong access_bits= 0, bit= 1;
- for (uint i = start_field_idx; i <= end_field_idx; i++, bit<<=1)
+ for (uint i = start_priv_columns; i < end_priv_columns; i++, bit<<=1)
{
- if (get_YN_as_bool(tl.table->field[i]))
+ if (get_YN_as_bool(m_table->field[i]))
access_bits|= bit;
}
return access_bits;
}
+ protected:
+ friend class Grant_tables;
+
+ Grant_table_base() : start_priv_columns(0), end_priv_columns(0), m_table(0)
+ { }
+
/* Compute how many privilege columns this table has. This method
can only be called after the table has been opened.
@@ -807,115 +781,332 @@ class Grant_table_base
A privilege column is of type enum('Y', 'N'). Privilege columns are
expected to be one after another.
*/
- void compute_num_privilege_cols()
+ void set_table(TABLE *table)
{
- if (!table_exists()) // Table does not exist or not opened.
+ if (!(m_table= table)) // Table does not exist or not opened.
return;
- num_privilege_cols= 0;
- for (uint i= 0; i < num_fields(); i++)
+ for (end_priv_columns= 0; end_priv_columns < num_fields(); end_priv_columns++)
{
- Field *field= tl.table->field[i];
- if (num_privilege_cols > 0 && field->real_type() != MYSQL_TYPE_ENUM)
- return;
+ Field *field= m_table->field[end_priv_columns];
if (field->real_type() == MYSQL_TYPE_ENUM &&
static_cast<Field_enum*>(field)->typelib->count == 2)
{
- num_privilege_cols++;
- if (num_privilege_cols == 1)
- start_privilege_column= i;
+ if (!start_priv_columns)
+ start_priv_columns= end_priv_columns;
}
+ else if (start_priv_columns)
+ break;
}
}
/* The index at which privilege columns start. */
- uint start_privilege_column;
- /* The number of privilege columns in the table. */
- uint num_privilege_cols;
+ uint start_priv_columns;
+ /* The index after the last privilege column */
+ uint end_priv_columns;
- TABLE_LIST tl;
+ TABLE *m_table;
};
class User_table: public Grant_table_base
{
public:
- /* Field getters return NULL if the column is not present in the table.
- This is consistent only if the table is in a supported version. We do
- not guard against corrupt tables. (yet) */
- Field* host() const
- { return get_field(0); }
- Field* user() const
- { return get_field(1); }
- Field* password() const
- { return have_password() ? NULL : tl.table->field[2]; }
- /* Columns after privilege columns. */
- Field* ssl_type() const
- { return get_field(start_privilege_column + num_privileges()); }
- Field* ssl_cipher() const
- { return get_field(start_privilege_column + num_privileges() + 1); }
- Field* x509_issuer() const
- { return get_field(start_privilege_column + num_privileges() + 2); }
- Field* x509_subject() const
- { return get_field(start_privilege_column + num_privileges() + 3); }
- Field* max_questions() const
- { return get_field(start_privilege_column + num_privileges() + 4); }
- Field* max_updates() const
- { return get_field(start_privilege_column + num_privileges() + 5); }
- Field* max_connections() const
- { return get_field(start_privilege_column + num_privileges() + 6); }
- Field* max_user_connections() const
- { return get_field(start_privilege_column + num_privileges() + 7); }
- Field* plugin() const
- { return get_field(start_privilege_column + num_privileges() + 8); }
- Field* authentication_string() const
- { return get_field(start_privilege_column + num_privileges() + 9); }
- Field* password_expired() const
- { return get_field(start_privilege_column + num_privileges() + 10); }
- Field* is_role() const
- { return get_field(start_privilege_column + num_privileges() + 11); }
- Field* default_role() const
- { return get_field(start_privilege_column + num_privileges() + 12); }
- Field* max_statement_time() const
- { return get_field(start_privilege_column + num_privileges() + 13); }
+ bool init_read_record(READ_RECORD* info) const
+ {
+ return Grant_table_base::init_read_record(info) || setup_sysvars();
+ }
+
+ virtual LEX_CSTRING& name() const = 0;
+ virtual int get_auth(THD *, MEM_ROOT *, const char **, const char **) const= 0;
+ virtual void set_auth(const char *, size_t, const char *, size_t) const = 0;
+ virtual ulong get_access() const = 0;
+ virtual void set_access(ulong rights, bool revoke) const = 0;
+
+ char *get_host(MEM_ROOT *root) const
+ { return ::get_field(root, m_table->field[0]); }
+ int set_host(const char *s, size_t l) const
+ { return m_table->field[0]->store(s, l, system_charset_info); };
+ char *get_user(MEM_ROOT *root) const
+ { return ::get_field(root, m_table->field[1]); }
+ int set_user(const char *s, size_t l) const
+ { return m_table->field[1]->store(s, l, system_charset_info); };
+
+ virtual SSL_type get_ssl_type () const = 0;
+ virtual int set_ssl_type (SSL_type x) const = 0;
+ virtual const char* get_ssl_cipher (MEM_ROOT *root) const = 0;
+ virtual int set_ssl_cipher (const char *s, size_t l) const = 0;
+ virtual const char* get_x509_issuer (MEM_ROOT *root) const = 0;
+ virtual int set_x509_issuer (const char *s, size_t l) const = 0;
+ virtual const char* get_x509_subject (MEM_ROOT *root) const = 0;
+ virtual int set_x509_subject (const char *s, size_t l) const = 0;
+ virtual longlong get_max_questions () const = 0;
+ virtual int set_max_questions (longlong x) const = 0;
+ virtual longlong get_max_updates () const = 0;
+ virtual int set_max_updates (longlong x) const = 0;
+ virtual longlong get_max_connections () const = 0;
+ virtual int set_max_connections (longlong x) const = 0;
+ virtual longlong get_max_user_connections () const = 0;
+ virtual int set_max_user_connections (longlong x) const = 0;
+ virtual double get_max_statement_time () const = 0;
+ virtual int set_max_statement_time (double x) const = 0;
+ virtual bool get_is_role () const = 0;
+ virtual int set_is_role (bool x) const = 0;
+ virtual const char* get_default_role (MEM_ROOT *root) const = 0;
+ virtual int set_default_role (const char *s, size_t l) const = 0;
+
+ virtual ~User_table() {}
+ private:
+ friend class Grant_tables;
+ virtual int setup_sysvars() const = 0;
+};
- /*
- Check if a user entry in the user table is marked as being a role entry
+/* MySQL-3.23 to MariaDB 10.3 `user` table */
+class User_table_tabular: public User_table
+{
+ public:
- IMPLEMENTATION
- Access the coresponding column and check the coresponding ENUM of the form
- ENUM('N', 'Y')
+ LEX_CSTRING& name() const { return MYSQL_TABLE_NAME_USER; }
- SYNOPSIS
- check_is_role()
- form an open table to read the entry from.
- The record should be already read in table->record[0]
+ int get_auth(THD *thd, MEM_ROOT *root, const char **plugin, const char **authstr) const
+ {
+ if (have_password())
+ {
+ *authstr= safe_str(::get_field(&acl_memroot, password()));
+ *plugin= guess_auth_plugin(thd, strlen(*authstr)).str;
+ }
+ else
+ {
+ *plugin= native_password_plugin_name.str;
+ *authstr= "";
+ }
+ if (this->plugin() && this->authstr())
+ {
+ char *tmpstr= ::get_field(&acl_memroot, this->plugin());
+ if (tmpstr)
+ {
+ const char *passw= *authstr;
+ *plugin= tmpstr;
+ *authstr= safe_str(::get_field(&acl_memroot, this->authstr()));
- RETURN VALUE
- TRUE if the user is marked as a role
- FALSE otherwise
- */
- bool check_is_role() const
+ if (*passw)
+ {
+ if (**authstr && strcmp(*authstr, passw))
+ {
+ sql_print_warning("'user' entry '%s@%s' has both a password and an "
+ "authentication plugin specified. The password will be ignored.",
+ safe_str(get_user(thd->mem_root)), safe_str(get_host(thd->mem_root)));
+ }
+ else
+ *authstr= passw;
+ }
+ }
+ }
+ return 0;
+ }
+
+ void set_auth(const char *p, size_t pl, const char *as, size_t asl) const
{
- /* Table version does not support roles */
- if (!is_role())
- return false;
+ if (plugin())
+ {
+ if (have_password())
+ password()->reset();
+ plugin()->store(p, pl, system_charset_info);
+ authstr()->store(as, asl, system_charset_info);
+ }
+ else
+ password()->store(as, asl, system_charset_info);
+ }
- return get_YN_as_bool(is_role());
+ ulong get_access() const
+ {
+ ulong access= Grant_table_base::get_access();
+ if ((num_fields() <= 13) && (access & CREATE_ACL))
+ access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
+
+ if (num_fields() <= 18)
+ {
+ access|= LOCK_TABLES_ACL | CREATE_TMP_ACL | SHOW_DB_ACL;
+ if (access & FILE_ACL)
+ access|= REPL_CLIENT_ACL | REPL_SLAVE_ACL;
+ if (access & PROCESS_ACL)
+ access|= SUPER_ACL | EXECUTE_ACL;
+ }
+
+ if (num_fields() <= 31 && (access & CREATE_ACL))
+ access|= (CREATE_VIEW_ACL | SHOW_VIEW_ACL);
+
+ if (num_fields() <= 33)
+ {
+ if (access & CREATE_ACL)
+ access|= CREATE_PROC_ACL;
+ if (access & ALTER_ACL)
+ access|= ALTER_PROC_ACL;
+ }
+
+ if (num_fields() <= 36 && (access & GRANT_ACL))
+ access|= CREATE_USER_ACL;
+
+ if (num_fields() <= 37 && (access & SUPER_ACL))
+ access|= EVENT_ACL;
+
+ if (num_fields() <= 38 && (access & SUPER_ACL))
+ access|= TRIGGER_ACL;
+
+ if (num_fields() <= 46 && (access & DELETE_ACL))
+ access|= DELETE_HISTORY_ACL;
+
+ return access & GLOBAL_ACLS;
}
+ void set_access(ulong rights, bool revoke) const
+ {
+ ulong priv= SELECT_ACL;
+ for (uint i= start_priv_columns; i < end_priv_columns; i++, priv <<= 1)
+ {
+ if (priv & rights)
+ m_table->field[i]->store(1 + !revoke, 0);
+ }
+ }
+ SSL_type get_ssl_type () const
+ {
+ Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM);
+ return (SSL_type)(f ? f->val_int()-1 : 0);
+ }
+ int set_ssl_type (SSL_type x) const
+ {
+ if (Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM))
+ return f->store(x+1, 0);
+ else
+ return 1;
+ }
+ const char* get_ssl_cipher (MEM_ROOT *root) const
+ {
+ Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB);
+ return f ? ::get_field(root,f) : 0;
+ }
+ int set_ssl_cipher (const char *s, size_t l) const
+ {
+ if (Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB))
+ return f->store(s, l, &my_charset_latin1);
+ else
+ return 1;
+ }
+ const char* get_x509_issuer (MEM_ROOT *root) const
+ {
+ Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB);
+ return f ? ::get_field(root,f) : 0;
+ }
+ int set_x509_issuer (const char *s, size_t l) const
+ {
+ if (Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB))
+ return f->store(s, l, &my_charset_latin1);
+ else
+ return 1;
+ }
+ const char* get_x509_subject (MEM_ROOT *root) const
+ {
+ Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB);
+ return f ? ::get_field(root,f) : 0;
+ }
+ int set_x509_subject (const char *s, size_t l) const
+ {
+ if (Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB))
+ return f->store(s, l, &my_charset_latin1);
+ else
+ return 1;
+ }
+ longlong get_max_questions () const
+ {
+ Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG);
+ return f ? f->val_int() : 0;
+ }
+ int set_max_questions (longlong x) const
+ {
+ if (Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG))
+ return f->store(x, 0);
+ else
+ return 1;
+ }
+ longlong get_max_updates () const
+ {
+ Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG);
+ return f ? f->val_int() : 0;
+ }
+ int set_max_updates (longlong x) const
+ {
+ if (Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG))
+ return f->store(x, 0);
+ else
+ return 1;
+ }
+ longlong get_max_connections () const
+ {
+ Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG);
+ return f ? f->val_int() : 0;
+ }
+ int set_max_connections (longlong x) const
+ {
+ if (Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG))
+ return f->store(x, 0);
+ else
+ return 1;
+ }
+ longlong get_max_user_connections () const
+ {
+ Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG);
+ return f ? f->val_int() : 0;
+ }
+ int set_max_user_connections (longlong x) const
+ {
+ if (Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG))
+ return f->store(x, 0);
+ else
+ return 1;
+ }
+ double get_max_statement_time () const
+ {
+ Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL);
+ return f ? f->val_real() : 0;
+ }
+ int set_max_statement_time (double x) const
+ {
+ if (Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL))
+ return f->store(x);
+ else
+ return 1;
+ }
+ bool get_is_role () const
+ {
+ Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM);
+ return f ? f->val_int()-1 : 0;
+ }
+ int set_is_role (bool x) const
+ {
+ if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM))
+ return f->store(x+1, 0);
+ else
+ return 1;
+ }
+ const char* get_default_role (MEM_ROOT *root) const
+ {
+ Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING);
+ return f ? ::get_field(root,f) : 0;
+ }
+ int set_default_role (const char *s, size_t l) const
+ {
+ if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING))
+ return f->store(s, l, system_charset_info);
+ else
+ return 1;
+ };
+
+ virtual ~User_table_tabular() {}
private:
friend class Grant_tables;
/* Only Grant_tables can instantiate this class. */
- User_table() {};
-
- void init(enum thr_lock_type lock_type)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_USER_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, false);
- }
+ User_table_tabular() {}
/* The user table is a bit different compared to the other Grant tables.
Usually, we only add columns to the grant tables when adding functionality.
@@ -927,183 +1118,406 @@ class User_table: public Grant_table_base
doesn't exist. This simplifies checking of table "version", as we don't
have to make use of num_fields() any more.
*/
- inline Field* get_field(uint field_num) const
+ inline Field* get_field(uint field_num, enum enum_field_types type) const
{
if (field_num >= num_fields())
return NULL;
+ Field *f= m_table->field[field_num];
+ return f->real_type() == type ? f : NULL;
+ }
- return tl.table->field[field_num];
+ int setup_sysvars() const
+ {
+ username_char_length= MY_MIN(m_table->field[1]->char_length(),
+ USERNAME_CHAR_LENGTH);
+ using_global_priv_table= false;
+
+ if (have_password()) // Password column might be missing. (MySQL 5.7.6+)
+ {
+ int password_length= password()->field_length /
+ password()->charset()->mbmaxlen;
+ if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
+ {
+ sql_print_error("Fatal error: mysql.user table is damaged or in "
+ "unsupported 3.20 format.");
+ return 1;
+ }
+
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH)
+ {
+ if (opt_secure_auth)
+ {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ sql_print_error("Fatal error: mysql.user table is in old format, "
+ "but server started with --secure-auth option.");
+ return 1;
+ }
+ mysql_user_table_is_in_short_password_format= true;
+ if (global_system_variables.old_passwords)
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ else
+ {
+ extern sys_var *Sys_old_passwords_ptr;
+ Sys_old_passwords_ptr->value_origin= sys_var::AUTO;
+ global_system_variables.old_passwords= 1;
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ sql_print_warning("mysql.user table is not updated to new password format; "
+ "Disabling new password usage until "
+ "mysql_fix_privilege_tables is run");
+ }
+ m_table->in_use->variables.old_passwords= 1;
+ }
+ else
+ {
+ mysql_user_table_is_in_short_password_format= false;
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ }
+ }
+ return 0;
}
/* Normally password column is the third column in the table. If privileges
start on the third column instead, we are missing the password column.
This means we are using a MySQL 5.7.6+ data directory. */
- bool have_password() const { return start_privilege_column == 2; }
+ bool have_password() const { return start_priv_columns == 3; }
+ Field* password() const { return m_table->field[2]; }
+ Field* plugin() const { return get_field(end_priv_columns + 8, MYSQL_TYPE_STRING); }
+ Field* authstr() const { return get_field(end_priv_columns + 9, MYSQL_TYPE_BLOB); }
+};
+
+/*
+ MariaDB 10.4 and up `global_priv` table
+
+ TODO possible optimizations:
+ * update json in-place if the new value can fit
+ * don't repeat get_value for every key, but use a streaming parser
+ to convert json into in-memory object (ACL_USER?) in one json scan.
+ - this makes sense for acl_load(), but hardly for GRANT
+ * similarly, pack ACL_USER (?) into json in one go.
+ - doesn't make sense? GRANT rarely updates more than one field.
+*/
+class User_table_json: public User_table
+{
+ LEX_CSTRING& name() const { return MYSQL_TABLE_NAME[USER_TABLE]; }
+
+ int get_auth(THD *thd, MEM_ROOT *root, const char **plugin, const char **authstr) const
+ {
+ *plugin= get_str_value(root, "plugin");
+ if (!**plugin)
+ *plugin= native_password_plugin_name.str;
+ *authstr= get_str_value(root, "authentication_string");
+ return *plugin == NULL || *authstr == NULL;
+ }
+ void set_auth(const char *p, size_t pl, const char *as, size_t asl) const
+ {
+ set_str_value("plugin", p, pl);
+ set_str_value("authentication_string", as, asl);
+ }
+ ulong get_access() const
+ {
+ /*
+ when new privileges will be added, we'll start storing GLOBAL_ACLS
+ (or, for example, my_count_bits(GLOBAL_ACLS))
+ in the json too, and it'll allow us to do privilege upgrades
+ */
+ return get_int_value("access") & GLOBAL_ACLS;
+ }
+ void set_access(ulong rights, bool revoke) const
+ {
+ ulong access= get_access();
+ if (revoke)
+ access&= ~rights;
+ else
+ access|= rights;
+ set_int_value("access", access & GLOBAL_ACLS);
+ }
+ const char *unsafe_str(const char *s) const
+ { return s[0] ? s : NULL; }
+
+ SSL_type get_ssl_type () const
+ { return (SSL_type)get_int_value("ssl_type"); }
+ int set_ssl_type (SSL_type x) const
+ { return set_int_value("ssl_type", x); }
+ const char* get_ssl_cipher (MEM_ROOT *root) const
+ { return unsafe_str(get_str_value(root, "ssl_cipher")); }
+ int set_ssl_cipher (const char *s, size_t l) const
+ { return set_str_value("ssl_cipher", s, l); }
+ const char* get_x509_issuer (MEM_ROOT *root) const
+ { return unsafe_str(get_str_value(root, "x509_issuer")); }
+ int set_x509_issuer (const char *s, size_t l) const
+ { return set_str_value("x509_issuer", s, l); }
+ const char* get_x509_subject (MEM_ROOT *root) const
+ { return unsafe_str(get_str_value(root, "x509_subject")); }
+ int set_x509_subject (const char *s, size_t l) const
+ { return set_str_value("x509_subject", s, l); }
+ longlong get_max_questions () const
+ { return get_int_value("max_questions"); }
+ int set_max_questions (longlong x) const
+ { return set_int_value("max_questions", x); }
+ longlong get_max_updates () const
+ { return get_int_value("max_updates"); }
+ int set_max_updates (longlong x) const
+ { return set_int_value("max_updates", x); }
+ longlong get_max_connections () const
+ { return get_int_value("max_connections"); }
+ int set_max_connections (longlong x) const
+ { return set_int_value("max_connections", x); }
+ longlong get_max_user_connections () const
+ { return get_int_value("max_user_connections"); }
+ int set_max_user_connections (longlong x) const
+ { return set_int_value("max_user_connections", x); }
+ double get_max_statement_time () const
+ { return get_double_value("max_statement_time"); }
+ int set_max_statement_time (double x) const
+ { return set_double_value("max_statement_time", x); }
+ bool get_is_role () const
+ { return get_bool_value("is_role"); }
+ int set_is_role (bool x) const
+ { return set_bool_value("is_role", x); }
+ const char* get_default_role (MEM_ROOT *root) const
+ { return get_str_value(root, "default_role"); }
+ int set_default_role (const char *s, size_t l) const
+ { return set_str_value("default_role", s, l); }
+
+ ~User_table_json() {}
+ private:
+ friend class Grant_tables;
+ static const uint JSON_SIZE=1024;
+ int setup_sysvars() const
+ {
+ using_global_priv_table= true;
+ username_char_length= MY_MIN(m_table->field[1]->char_length(),
+ USERNAME_CHAR_LENGTH);
+ return 0;
+ }
+ bool get_value(const char *key,
+ enum json_types vt, const char **v, size_t *vl) const
+ {
+ enum json_types value_type;
+ int int_vl;
+ String str, *res= m_table->field[2]->val_str(&str);
+ if (!res ||
+ (value_type= json_get_object_key(res->ptr(), res->end(), key,
+ v, &int_vl)) == JSV_BAD_JSON)
+ return 1; // invalid
+ *vl= int_vl;
+ return value_type != vt;
+ }
+ const char *get_str_value(MEM_ROOT *root, const char *key) const
+ {
+ size_t value_len;
+ const char *value_start;
+ if (get_value(key, JSV_STRING, &value_start, &value_len))
+ return "";
+ char *ptr= (char*)alloca(value_len);
+ int len= json_unescape(m_table->field[2]->charset(),
+ (const uchar*)value_start,
+ (const uchar*)value_start + value_len,
+ system_charset_info,
+ (uchar*)ptr, (uchar*)ptr + value_len);
+ if (len < 0)
+ return NULL;
+ return strmake_root(root, ptr, len);
+ }
+ longlong get_int_value(const char *key) const
+ {
+ int err;
+ size_t value_len;
+ const char *value_start;
+ if (get_value(key, JSV_NUMBER, &value_start, &value_len))
+ return 0;
+ const char *value_end= value_start + value_len;
+ return my_strtoll10(value_start, (char**)&value_end, &err);
+ }
+ double get_double_value(const char *key) const
+ {
+ int err;
+ size_t value_len;
+ const char *value_start;
+ if (get_value(key, JSV_NUMBER, &value_start, &value_len))
+ return 0;
+ const char *value_end= value_start + value_len;
+ return my_strtod(value_start, (char**)&value_end, &err);
+ }
+ bool get_bool_value(const char *key) const
+ {
+ size_t value_len;
+ const char *value_start;
+ if (get_value(key, JSV_TRUE, &value_start, &value_len))
+ return false;
+ return true;
+ }
+ bool set_value(const char *key,
+ const char *val, size_t vlen, bool string) const
+ {
+ int value_len;
+ const char *value_start;
+ enum json_types value_type;
+ String str, *res= m_table->field[2]->val_str(&str);
+ if (!res || !res->length())
+ (res= &str)->set(STRING_WITH_LEN("{}"), m_table->field[2]->charset());
+ value_type= json_get_object_key(res->ptr(), res->end(), key,
+ &value_start, &value_len);
+ if (value_type == JSV_BAD_JSON)
+ return 1; // invalid
+ StringBuffer<JSON_SIZE> json(res->charset());
+ json.copy(res->ptr(), value_start - res->ptr(), res->charset());
+ if (value_type == JSV_NOTHING)
+ {
+ if (value_len)
+ json.append(',');
+ json.append('"');
+ json.append(key);
+ json.append(STRING_WITH_LEN("\":"));
+ if (string)
+ json.append('"');
+ }
+ else
+ value_start+= value_len;
+ json.append(val, vlen);
+ if (!value_type && string)
+ json.append('"');
+ json.append(value_start, res->end() - value_start);
+ DBUG_ASSERT(json_valid(json.ptr(), json.length(), json.charset()));
+ m_table->field[2]->store(json.ptr(), json.length(), json.charset());
+ return 0;
+ }
+ bool set_str_value(const char *key, const char *val, size_t vlen) const
+ {
+ char buf[JSON_SIZE];
+ int blen= json_escape(system_charset_info,
+ (const uchar*)val, (const uchar*)val + vlen,
+ m_table->field[2]->charset(),
+ (uchar*)buf, (uchar*)buf+sizeof(buf));
+ if (blen < 0)
+ return 1;
+ return set_value(key, buf, blen, true);
+ }
+ bool set_int_value(const char *key, longlong val) const
+ {
+ char v[MY_INT64_NUM_DECIMAL_DIGITS+1];
+ size_t vlen= longlong10_to_str(val, v, -10) - v;
+ return set_value(key, v, vlen, false);
+ }
+ bool set_double_value(const char *key, double val) const
+ {
+ char v[FLOATING_POINT_BUFFER+1];
+ size_t vlen= my_fcvt(val, TIME_SECOND_PART_DIGITS, v, NULL);
+ return set_value(key, v, vlen, false);
+ }
+ bool set_bool_value(const char *key, bool val) const
+ { return set_value(key, val ? "true" : "false", val ? 4 : 5, false); }
};
class Db_table: public Grant_table_base
{
public:
- Field* host() const { return tl.table->field[0]; }
- Field* db() const { return tl.table->field[1]; }
- Field* user() const { return tl.table->field[2]; }
+ Field* host() const { return m_table->field[0]; }
+ Field* db() const { return m_table->field[1]; }
+ Field* user() const { return m_table->field[2]; }
private:
friend class Grant_tables;
- Db_table() {};
-
- void init(enum thr_lock_type lock_type)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_DB_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, false);
- }
+ Db_table() {}
};
class Tables_priv_table: public Grant_table_base
{
public:
- Field* host() const { return tl.table->field[0]; }
- Field* db() const { return tl.table->field[1]; }
- Field* user() const { return tl.table->field[2]; }
- Field* table_name() const { return tl.table->field[3]; }
- Field* grantor() const { return tl.table->field[4]; }
- Field* timestamp() const { return tl.table->field[5]; }
- Field* table_priv() const { return tl.table->field[6]; }
- Field* column_priv() const { return tl.table->field[7]; }
+ Field* host() const { return m_table->field[0]; }
+ Field* db() const { return m_table->field[1]; }
+ Field* user() const { return m_table->field[2]; }
+ Field* table_name() const { return m_table->field[3]; }
+ Field* grantor() const { return m_table->field[4]; }
+ Field* timestamp() const { return m_table->field[5]; }
+ Field* table_priv() const { return m_table->field[6]; }
+ Field* column_priv() const { return m_table->field[7]; }
private:
friend class Grant_tables;
- Tables_priv_table() {};
-
- void init(enum thr_lock_type lock_type, Grant_table_base *next_table= NULL)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- LEX_CSTRING MYSQL_TABLES_PRIV_NAME={STRING_WITH_LEN("tables_priv") };
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLES_PRIV_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, false);
- }
+ Tables_priv_table() {}
};
class Columns_priv_table: public Grant_table_base
{
public:
- Field* host() const { return tl.table->field[0]; }
- Field* db() const { return tl.table->field[1]; }
- Field* user() const { return tl.table->field[2]; }
- Field* table_name() const { return tl.table->field[3]; }
- Field* column_name() const { return tl.table->field[4]; }
- Field* timestamp() const { return tl.table->field[5]; }
- Field* column_priv() const { return tl.table->field[6]; }
+ Field* host() const { return m_table->field[0]; }
+ Field* db() const { return m_table->field[1]; }
+ Field* user() const { return m_table->field[2]; }
+ Field* table_name() const { return m_table->field[3]; }
+ Field* column_name() const { return m_table->field[4]; }
+ Field* timestamp() const { return m_table->field[5]; }
+ Field* column_priv() const { return m_table->field[6]; }
private:
friend class Grant_tables;
- Columns_priv_table() {};
-
- void init(enum thr_lock_type lock_type)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- LEX_CSTRING MYSQL_COLUMNS_PRIV_NAME={ STRING_WITH_LEN("columns_priv") };
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_COLUMNS_PRIV_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, false);
- }
+ Columns_priv_table() {}
};
class Host_table: public Grant_table_base
{
public:
- Field* host() const { return tl.table->field[0]; }
- Field* db() const { return tl.table->field[1]; }
+ Field* host() const { return m_table->field[0]; }
+ Field* db() const { return m_table->field[1]; }
private:
friend class Grant_tables;
Host_table() {}
-
- void init(enum thr_lock_type lock_type)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- LEX_CSTRING MYSQL_HOST_NAME={STRING_WITH_LEN("host") };
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_HOST_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, true);
- }
};
class Procs_priv_table: public Grant_table_base
{
public:
- Field* host() const { return tl.table->field[0]; }
- Field* db() const { return tl.table->field[1]; }
- Field* user() const { return tl.table->field[2]; }
- Field* routine_name() const { return tl.table->field[3]; }
- Field* routine_type() const { return tl.table->field[4]; }
- Field* grantor() const { return tl.table->field[5]; }
- Field* proc_priv() const { return tl.table->field[6]; }
- Field* timestamp() const { return tl.table->field[7]; }
+ Field* host() const { return m_table->field[0]; }
+ Field* db() const { return m_table->field[1]; }
+ Field* user() const { return m_table->field[2]; }
+ Field* routine_name() const { return m_table->field[3]; }
+ Field* routine_type() const { return m_table->field[4]; }
+ Field* grantor() const { return m_table->field[5]; }
+ Field* proc_priv() const { return m_table->field[6]; }
+ Field* timestamp() const { return m_table->field[7]; }
private:
friend class Grant_tables;
Procs_priv_table() {}
-
- void init(enum thr_lock_type lock_type)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- LEX_CSTRING MYSQL_PROCS_PRIV_NAME={STRING_WITH_LEN("procs_priv") };
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_PROCS_PRIV_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, true);
- }
};
class Proxies_priv_table: public Grant_table_base
{
public:
- Field* host() const { return tl.table->field[0]; }
- Field* user() const { return tl.table->field[1]; }
- Field* proxied_host() const { return tl.table->field[2]; }
- Field* proxied_user() const { return tl.table->field[3]; }
- Field* with_grant() const { return tl.table->field[4]; }
- Field* grantor() const { return tl.table->field[5]; }
- Field* timestamp() const { return tl.table->field[6]; }
+ Field* host() const { return m_table->field[0]; }
+ Field* user() const { return m_table->field[1]; }
+ Field* proxied_host() const { return m_table->field[2]; }
+ Field* proxied_user() const { return m_table->field[3]; }
+ Field* with_grant() const { return m_table->field[4]; }
+ Field* grantor() const { return m_table->field[5]; }
+ Field* timestamp() const { return m_table->field[6]; }
private:
friend class Grant_tables;
Proxies_priv_table() {}
-
- void init(enum thr_lock_type lock_type)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- LEX_CSTRING MYSQL_PROXIES_PRIV_NAME={STRING_WITH_LEN("proxies_priv") };
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_PROXIES_PRIV_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, true);
- }
};
class Roles_mapping_table: public Grant_table_base
{
public:
- Field* host() const { return tl.table->field[0]; }
- Field* user() const { return tl.table->field[1]; }
- Field* role() const { return tl.table->field[2]; }
- Field* admin_option() const { return tl.table->field[3]; }
+ Field* host() const { return m_table->field[0]; }
+ Field* user() const { return m_table->field[1]; }
+ Field* role() const { return m_table->field[2]; }
+ Field* admin_option() const { return m_table->field[3]; }
private:
friend class Grant_tables;
Roles_mapping_table() {}
-
- void init(enum thr_lock_type lock_type)
- {
- /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
- LEX_CSTRING MYSQL_ROLES_MAPPING_NAME={STRING_WITH_LEN("roles_mapping") };
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_ROLES_MAPPING_NAME, NULL, lock_type);
- Grant_table_base::init(lock_type, true);
- }
};
/**
@@ -1112,170 +1526,130 @@ class Roles_mapping_table: public Grant_table_base
class Grant_tables
{
public:
- /* When constructing the Grant_tables object, we initialize only
- the tables which are going to be opened.
- @param which_tables Bitmap of which tables to open.
- @param lock_type Lock type to use when opening tables.
- */
- Grant_tables(int which_tables, enum thr_lock_type lock_type)
- {
- DBUG_ENTER("Grant_tables::Grant_tables");
- DBUG_PRINT("info", ("which_tables: %x, lock_type: %u",
- which_tables, lock_type));
- DBUG_ASSERT(which_tables); /* At least one table must be opened. */
- Grant_table_base* prev= NULL;
- /* We start from the last table, Table_roles_mapping, such that
- the first one in the linked list is Table_user. */
- if (which_tables & Table_roles_mapping)
- {
- m_roles_mapping_table.init(lock_type);
- prev= &m_roles_mapping_table;
- }
- if (which_tables & Table_proxies_priv)
- {
- m_proxies_priv_table.init(lock_type);
- link_tables(&m_proxies_priv_table, prev);
- prev= &m_proxies_priv_table;
- }
- if (which_tables & Table_procs_priv)
- {
- m_procs_priv_table.init(lock_type);
- link_tables(&m_procs_priv_table, prev);
- prev= &m_procs_priv_table;
- }
- if (which_tables & Table_host)
- {
- m_host_table.init(lock_type);
- link_tables(&m_host_table, prev);
- prev= &m_host_table;
- }
- if (which_tables & Table_columns_priv)
- {
- m_columns_priv_table.init(lock_type);
- link_tables(&m_columns_priv_table, prev);
- prev= &m_columns_priv_table;
- }
- if (which_tables & Table_tables_priv)
- {
- m_tables_priv_table.init(lock_type);
- link_tables(&m_tables_priv_table, prev);
- prev= &m_tables_priv_table;
- }
- if (which_tables & Table_db)
- {
- m_db_table.init(lock_type);
- link_tables(&m_db_table, prev);
- prev= &m_db_table;
- }
- if (which_tables & Table_user)
- {
- m_user_table.init(lock_type);
- link_tables(&m_user_table, prev);
- prev= &m_user_table;
- }
+ Grant_tables() : p_user_table(&m_user_table_json) { }
- first_table_in_list= prev;
- DBUG_VOID_RETURN;
- }
-
- /* Before any operation is possible on grant tables, they must be opened.
- This opens the tables according to the lock type specified during
- construction.
-
- @retval 1 replication filters matched. Abort the operation,
- but return OK (!)
- @retval 0 tables were opened successfully
- @retval -1 error, tables could not be opened
- */
- int open_and_lock(THD *thd)
+ int open_and_lock(THD *thd, int which_tables, enum thr_lock_type lock_type)
{
DBUG_ENTER("Grant_tables::open_and_lock");
- DBUG_ASSERT(first_table_in_list);
-#ifdef HAVE_REPLICATION
- if (first_table_in_list->tl.lock_type >= TL_WRITE_ALLOW_WRITE &&
- thd->slave_thread && !thd->spcont)
- {
- /*
- GRANT and REVOKE are applied the slave in/exclusion rules as they are
- some kind of updates to the mysql.% tables.
- */
- Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter;
- if (rpl_filter->is_on() &&
- !rpl_filter->tables_ok(0, &first_table_in_list->tl))
- DBUG_RETURN(1);
- }
-#endif
- if (open_and_lock_tables(thd, &first_table_in_list->tl, FALSE,
- MYSQL_LOCK_IGNORE_TIMEOUT))
- DBUG_RETURN(-1);
+ TABLE_LIST tables[USER_TABLE+1], *first= NULL;
+ DBUG_ASSERT(which_tables); /* At least one table must be opened. */
/*
We can read privilege tables even when !initialized.
This can be acl_load() - server startup or FLUSH PRIVILEGES
*/
- if (first_table_in_list->tl.lock_type >= TL_WRITE_ALLOW_WRITE &&
- !initialized)
+ if (lock_type >= TL_WRITE_ALLOW_WRITE && !initialized)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(-1);
}
- /* The privilge columns vary based on MariaDB version. Figure out
- how many we have after we've opened the table. */
- m_user_table.compute_num_privilege_cols();
- m_db_table.compute_num_privilege_cols();
- m_tables_priv_table.compute_num_privilege_cols();
- m_columns_priv_table.compute_num_privilege_cols();
- m_host_table.compute_num_privilege_cols();
- m_procs_priv_table.compute_num_privilege_cols();
- m_proxies_priv_table.compute_num_privilege_cols();
- m_roles_mapping_table.compute_num_privilege_cols();
+ for (int i=USER_TABLE; i >=0; i--)
+ {
+ TABLE_LIST *tl= tables + i;
+ if (which_tables & (1 << i))
+ {
+ tl->init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLE_NAME[i],
+ NULL, lock_type);
+ tl->updating= lock_type >= TL_WRITE_ALLOW_WRITE;
+ if (i >= FIRST_OPTIONAL_TABLE)
+ tl->open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
+ tl->next_global= tl->next_local= first;
+ first= tl;
+ }
+ else
+ tl->table= NULL;
+ }
+
+ uint counter;
+ int res= really_open(thd, first, &counter);
+
+ /* if User_table_json wasn't found, let's try User_table_tabular */
+ if (!res && (which_tables & Table_user) && !(tables[USER_TABLE].table))
+ {
+ uint unused;
+ TABLE_LIST *tl= tables + USER_TABLE;
+ tl->init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLE_NAME_USER,
+ NULL, lock_type);
+ tl->updating= lock_type >= TL_WRITE_ALLOW_WRITE;
+ p_user_table= &m_user_table_tabular;
+ counter++;
+ res= really_open(thd, tl, &unused);
+ }
+ if (res)
+ DBUG_RETURN(res);
+
+ if (lock_tables(thd, first, counter, MYSQL_LOCK_IGNORE_TIMEOUT))
+ DBUG_RETURN(-1);
+
+ p_user_table->set_table(tables[USER_TABLE].table);
+ m_db_table.set_table(tables[DB_TABLE].table);
+ m_tables_priv_table.set_table(tables[TABLES_PRIV_TABLE].table);
+ m_columns_priv_table.set_table(tables[COLUMNS_PRIV_TABLE].table);
+ m_host_table.set_table(tables[HOST_TABLE].table);
+ m_procs_priv_table.set_table(tables[PROCS_PRIV_TABLE].table);
+ m_proxies_priv_table.set_table(tables[PROXIES_PRIV_TABLE].table);
+ m_roles_mapping_table.set_table(tables[ROLES_MAPPING_TABLE].table);
DBUG_RETURN(0);
}
inline const User_table& user_table() const
- {
- return m_user_table;
- }
+ { return *p_user_table; }
inline const Db_table& db_table() const
- {
- return m_db_table;
- }
-
+ { return m_db_table; }
inline const Tables_priv_table& tables_priv_table() const
- {
- return m_tables_priv_table;
- }
+ { return m_tables_priv_table; }
inline const Columns_priv_table& columns_priv_table() const
- {
- return m_columns_priv_table;
- }
+ { return m_columns_priv_table; }
inline const Host_table& host_table() const
- {
- return m_host_table;
- }
+ { return m_host_table; }
inline const Procs_priv_table& procs_priv_table() const
- {
- return m_procs_priv_table;
- }
+ { return m_procs_priv_table; }
inline const Proxies_priv_table& proxies_priv_table() const
- {
- return m_proxies_priv_table;
- }
+ { return m_proxies_priv_table; }
inline const Roles_mapping_table& roles_mapping_table() const
+ { return m_roles_mapping_table; }
+
+ private:
+
+ /* Before any operation is possible on grant tables, they must be opened.
+
+ @retval 1 replication filters matched. Abort the operation,
+ but return OK (!)
+ @retval 0 tables were opened successfully
+ @retval -1 error, tables could not be opened
+ */
+ int really_open(THD *thd, TABLE_LIST* tables, uint *counter)
{
- return m_roles_mapping_table;
+ DBUG_ENTER("Grant_tables::really_open:");
+#ifdef HAVE_REPLICATION
+ if (tables->lock_type >= TL_WRITE_ALLOW_WRITE &&
+ thd->slave_thread && !thd->spcont)
+ {
+ /*
+ GRANT and REVOKE are applied the slave in/exclusion rules as they are
+ some kind of updates to the mysql.% tables.
+ */
+ Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter;
+ if (rpl_filter->is_on() && !rpl_filter->tables_ok(0, tables))
+ DBUG_RETURN(1);
+ }
+#endif
+ if (open_tables(thd, &tables, counter, MYSQL_LOCK_IGNORE_TIMEOUT))
+ DBUG_RETURN(-1);
+ DBUG_RETURN(0);
}
- private:
- User_table m_user_table;
+ User_table *p_user_table;
+ User_table_json m_user_table_json;
+ User_table_tabular m_user_table_tabular;
Db_table m_db_table;
Tables_priv_table m_tables_priv_table;
Columns_priv_table m_columns_priv_table;
@@ -1283,20 +1657,6 @@ class Grant_tables
Procs_priv_table m_procs_priv_table;
Proxies_priv_table m_proxies_priv_table;
Roles_mapping_table m_roles_mapping_table;
-
- /* The grant tables are set-up in a linked list. We keep the head of it. */
- Grant_table_base *first_table_in_list;
- /**
- Chain two grant tables' TABLE_LIST members.
- */
- static void link_tables(Grant_table_base *from, Grant_table_base *to)
- {
- DBUG_ASSERT(from);
- if (to)
- from->tl.next_local= from->tl.next_global= &to->tl;
- else
- from->tl.next_local= from->tl.next_global= NULL;
- }
};
@@ -1311,7 +1671,6 @@ void ACL_PROXY_USER::init(const Proxies_priv_table& proxies_priv_table,
}
-
/*
Enumeration of various ACL's and Hashes used in handle_grant_struct()
*/
@@ -1602,20 +1961,6 @@ bool acl_init(bool dont_read_acl_tables)
DBUG_RETURN(return_val);
}
-/**
- Choose from either native or old password plugins when assigning a password
-*/
-
-static LEX_CSTRING &guess_auth_plugin(THD *thd, size_t password_len)
-{
- if (thd->variables.old_passwords == 1 ||
- password_len == SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
- return old_password_plugin_name;
- else
- return native_password_plugin_name;
-}
-
-
static void push_new_user(const ACL_USER &user)
{
push_dynamic(&acl_users, &user);
@@ -1657,7 +2002,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
init_sql_alloc(&acl_memroot, "ACL", ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
if (host_table.table_exists()) // "host" table may not exist (e.g. in MySQL 5.6.7+)
{
- if (host_table.init_read_record(&read_record_info, thd))
+ if (host_table.init_read_record(&read_record_info))
DBUG_RETURN(true);
while (!(read_record_info.read_record()))
{
@@ -1711,275 +2056,93 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
freeze_size(&acl_hosts);
const User_table& user_table= tables.user_table();
- if (user_table.init_read_record(&read_record_info, thd))
+ if (user_table.init_read_record(&read_record_info))
DBUG_RETURN(true);
- username_char_length= MY_MIN(user_table.user()->char_length(),
- USERNAME_CHAR_LENGTH);
- if (user_table.password()) // Password column might be missing. (MySQL 5.7.6+)
- {
- int password_length= user_table.password()->field_length /
- user_table.password()->charset()->mbmaxlen;
- if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
- {
- sql_print_error("Fatal error: mysql.user table is damaged or in "
- "unsupported 3.20 format.");
- DBUG_RETURN(TRUE);
- }
-
- DBUG_PRINT("info",("user table fields: %d, password length: %d",
- user_table.num_fields(), password_length));
-
- mysql_mutex_lock(&LOCK_global_system_variables);
- if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH)
- {
- if (opt_secure_auth)
- {
- mysql_mutex_unlock(&LOCK_global_system_variables);
- sql_print_error("Fatal error: mysql.user table is in old format, "
- "but server started with --secure-auth option.");
- DBUG_RETURN(TRUE);
- }
- mysql_user_table_is_in_short_password_format= true;
- if (global_system_variables.old_passwords)
- mysql_mutex_unlock(&LOCK_global_system_variables);
- else
- {
- extern sys_var *Sys_old_passwords_ptr;
- Sys_old_passwords_ptr->value_origin= sys_var::AUTO;
- global_system_variables.old_passwords= 1;
- mysql_mutex_unlock(&LOCK_global_system_variables);
- sql_print_warning("mysql.user table is not updated to new password format; "
- "Disabling new password usage until "
- "mysql_fix_privilege_tables is run");
- }
- thd->variables.old_passwords= 1;
- }
- else
- {
- mysql_user_table_is_in_short_password_format= false;
- mysql_mutex_unlock(&LOCK_global_system_variables);
- }
- }
-
allow_all_hosts=0;
while (!(read_record_info.read_record()))
{
ACL_USER user;
bool is_role= FALSE;
bzero(&user, sizeof(user));
- update_hostname(&user.host, get_field(&acl_memroot, user_table.host()));
- char *username= safe_str(get_field(&acl_memroot, user_table.user()));
+ update_hostname(&user.host, user_table.get_host(&acl_memroot));
+ char *username= safe_str(user_table.get_user(&acl_memroot));
user.user.str= username;
user.user.length= strlen(username);
- /*
- If the user entry is a role, skip password and hostname checks
- A user can not log in with a role so some checks are not necessary
- */
- is_role= user_table.check_is_role();
-
- if (is_role && is_invalid_role_name(username))
- {
- thd->clear_error(); // the warning is still issued
- continue;
- }
-
- if (!is_role && check_no_resolve &&
- hostname_requires_resolving(user.host.hostname))
- {
- sql_print_warning("'user' entry '%s@%s' "
- "ignored in --skip-name-resolve mode.", user.user.str,
- safe_str(user.host.hostname));
- continue;
- }
-
- if (user_table.password())
- {
- const char *p= safe_str(get_field(&acl_memroot, user_table.password()));
- user.auth_string.str= p;
- user.auth_string.length= strlen(p);
- }
- else
- user.auth_string= empty_clex_str;
-
- user.plugin= guess_auth_plugin(thd, user.auth_string.length);
+ is_role= user_table.get_is_role();
- user.access= user_table.get_access() & GLOBAL_ACLS;
- /*
- if it is pre 5.0.1 privilege table then map CREATE privilege on
- CREATE VIEW & SHOW VIEW privileges
- */
- if (user_table.num_fields() <= 31 && (user.access & CREATE_ACL))
- user.access|= (CREATE_VIEW_ACL | SHOW_VIEW_ACL);
-
- /*
- if it is pre 5.0.2 privilege table then map CREATE/ALTER privilege on
- CREATE PROCEDURE & ALTER PROCEDURE privileges
- */
- if (user_table.num_fields() <= 33 && (user.access & CREATE_ACL))
- user.access|= CREATE_PROC_ACL;
- if (user_table.num_fields() <= 33 && (user.access & ALTER_ACL))
- user.access|= ALTER_PROC_ACL;
-
- /*
- pre 5.0.3 did not have CREATE_USER_ACL
- */
- if (user_table.num_fields() <= 36 && (user.access & GRANT_ACL))
- user.access|= CREATE_USER_ACL;
-
-
- /*
- if it is pre 5.1.6 privilege table then map CREATE privilege on
- CREATE|ALTER|DROP|EXECUTE EVENT
- */
- if (user_table.num_fields() <= 37 && (user.access & SUPER_ACL))
- user.access|= EVENT_ACL;
-
- /*
- if it is pre 5.1.6 privilege then map TRIGGER privilege on CREATE.
- */
- if (user_table.num_fields() <= 38 && (user.access & SUPER_ACL))
- user.access|= TRIGGER_ACL;
-
- if (user_table.num_fields() <= 46 && (user.access & DELETE_ACL))
- user.access|= DELETE_HISTORY_ACL;
+ user.access= user_table.get_access();
user.sort= get_sort(2, user.host.hostname, user.user.str);
user.hostname_length= safe_strlen(user.host.hostname);
- user.user_resource.user_conn= 0;
- user.user_resource.max_statement_time= 0.0;
-
- /* Starting from 4.0.2 we have more fields */
- if (user_table.ssl_type())
- {
- char *ssl_type=get_field(thd->mem_root, user_table.ssl_type());
- if (!ssl_type)
- user.ssl_type=SSL_TYPE_NONE;
- else if (!strcmp(ssl_type, "ANY"))
- user.ssl_type=SSL_TYPE_ANY;
- else if (!strcmp(ssl_type, "X509"))
- user.ssl_type=SSL_TYPE_X509;
- else /* !strcmp(ssl_type, "SPECIFIED") */
- user.ssl_type=SSL_TYPE_SPECIFIED;
-
- user.ssl_cipher= get_field(&acl_memroot, user_table.ssl_cipher());
- user.x509_issuer= get_field(&acl_memroot, user_table.x509_issuer());
- user.x509_subject= get_field(&acl_memroot, user_table.x509_subject());
-
- char *ptr = get_field(thd->mem_root, user_table.max_questions());
- user.user_resource.questions=ptr ? atoi(ptr) : 0;
- ptr = get_field(thd->mem_root, user_table.max_updates());
- user.user_resource.updates=ptr ? atoi(ptr) : 0;
- ptr = get_field(thd->mem_root, user_table.max_connections());
- user.user_resource.conn_per_hour= ptr ? atoi(ptr) : 0;
- if (user.user_resource.questions || user.user_resource.updates ||
- user.user_resource.conn_per_hour)
- mqh_used=1;
- if (user_table.max_user_connections())
- {
- /* Starting from 5.0.3 we have max_user_connections field */
- ptr= get_field(thd->mem_root, user_table.max_user_connections());
- user.user_resource.user_conn= ptr ? atoi(ptr) : 0;
- }
+ my_init_dynamic_array(&user.role_grants, sizeof(ACL_ROLE *), 0, 8, MYF(0));
- if (!is_role && user_table.plugin())
+ if (is_role)
+ {
+ if (is_invalid_role_name(username))
{
- /* We may have plugin & auth_string fields */
- char *tmpstr= get_field(&acl_memroot, user_table.plugin());
- if (tmpstr)
- {
- LEX_CSTRING password= user.auth_string;
- user.plugin.str= tmpstr;
- user.plugin.length= strlen(user.plugin.str);
- user.auth_string.str=
- safe_str(get_field(&acl_memroot,
- user_table.authentication_string()));
- user.auth_string.length= strlen(user.auth_string.str);
-
- if (password.length)
- {
- if (user.auth_string.length &&
- (user.auth_string.length != password.length ||
- memcmp(user.auth_string.str, password.str, password.length)))
- {
- sql_print_warning("'user' entry '%s@%s' has both a password "
- "and an authentication plugin specified. The "
- "password will be ignored.",
- user.user.str, safe_str(user.host.hostname));
- }
- else
- user.auth_string= password;
- }
-
- fix_user_plugin_ptr(&user);
- }
+ thd->clear_error(); // the warning is still issued
+ continue;
}
- if (user_table.max_statement_time())
- {
- /* Starting from 10.1.1 we can have max_statement_time */
- ptr= get_field(thd->mem_root,
- user_table.max_statement_time());
- user.user_resource.max_statement_time= ptr ? atof(ptr) : 0.0;
- }
+ ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user, &acl_memroot);
+ entry->role_grants = user.role_grants;
+ my_init_dynamic_array(&entry->parent_grantee,
+ sizeof(ACL_USER_BASE *), 0, 8, MYF(0));
+ my_hash_insert(&acl_roles, (uchar *)entry);
+
+ continue;
}
else
{
- user.ssl_type=SSL_TYPE_NONE;
-#ifndef TO_BE_REMOVED
- if (user_table.num_fields() <= 13)
- { // Without grant
- if (user.access & CREATE_ACL)
- user.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
+ if (check_no_resolve && hostname_requires_resolving(user.host.hostname))
+ {
+ sql_print_warning("'user' entry '%s@%s' "
+ "ignored in --skip-name-resolve mode.", user.user.str,
+ safe_str(user.host.hostname));
+ continue;
}
- /* Convert old privileges */
- user.access|= LOCK_TABLES_ACL | CREATE_TMP_ACL | SHOW_DB_ACL;
- if (user.access & FILE_ACL)
- user.access|= REPL_CLIENT_ACL | REPL_SLAVE_ACL;
- if (user.access & PROCESS_ACL)
- user.access|= SUPER_ACL | EXECUTE_ACL;
-#endif
- }
- my_init_dynamic_array(&user.role_grants, sizeof(ACL_ROLE *), 0, 8, MYF(0));
-
- /* check default role, if any */
- if (!is_role && user_table.default_role())
- {
- user.default_rolename.str=
- get_field(&acl_memroot, user_table.default_role());
- user.default_rolename.length= safe_strlen(user.default_rolename.str);
- }
+ if (user_table.get_auth(thd, &acl_memroot,
+ &user.plugin.str, &user.auth_string.str))
+ continue;
+ user.plugin.length= strlen(user.plugin.str);
+ user.auth_string.length= strlen(user.auth_string.str);
+ fix_user_plugin_ptr(&user);
+
+ user.ssl_type= user_table.get_ssl_type();
+ user.ssl_cipher= user_table.get_ssl_cipher(&acl_memroot);
+ user.x509_issuer= safe_str(user_table.get_x509_issuer(&acl_memroot));
+ user.x509_subject= safe_str(user_table.get_x509_subject(&acl_memroot));
+ user.user_resource.questions= (uint)user_table.get_max_questions();
+ user.user_resource.updates= (uint)user_table.get_max_updates();
+ user.user_resource.conn_per_hour= (uint)user_table.get_max_connections();
+ if (user.user_resource.questions || user.user_resource.updates ||
+ user.user_resource.conn_per_hour)
+ mqh_used=1;
- if (set_user_auth(thd, &user, NULL))
- {
- thd->clear_error(); // the warning is still issued
- continue;
- }
+ user.user_resource.user_conn= (int)user_table.get_max_user_connections();
+ user.user_resource.max_statement_time= user_table.get_max_statement_time();
- if (is_role)
- {
- DBUG_PRINT("info", ("Found role %s", user.user.str));
- ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user, &acl_memroot);
- entry->role_grants = user.role_grants;
- my_init_dynamic_array(&entry->parent_grantee,
- sizeof(ACL_USER_BASE *), 0, 8, MYF(0));
- my_hash_insert(&acl_roles, (uchar *)entry);
+ user.default_rolename.str= user_table.get_default_role(&acl_memroot);
+ user.default_rolename.length= safe_strlen(user.default_rolename.str);
- continue;
+ if (set_user_auth(thd, &user, NULL))
+ {
+ thd->clear_error(); // the warning is still issued
+ continue;
+ }
}
- DBUG_PRINT("info", ("Found user %s", user.user.str));
push_new_user(user);
}
- my_qsort((uchar*) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
- sizeof(ACL_USER),(qsort_cmp) acl_compare);
+ rebuild_acl_users();
end_read_record(&read_record_info);
freeze_size(&acl_users);
const Db_table& db_table= tables.db_table();
- if (db_table.init_read_record(&read_record_info, thd))
+ if (db_table.init_read_record(&read_record_info))
DBUG_RETURN(TRUE);
while (!(read_record_info.read_record()))
{
@@ -2036,17 +2199,16 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
db.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
}
#endif
- (void) push_dynamic(&acl_dbs,(uchar*) &db);
+ acl_dbs.push(db);
}
- my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
- sizeof(ACL_DB),(qsort_cmp) acl_compare);
end_read_record(&read_record_info);
- freeze_size(&acl_dbs);
+ rebuild_acl_dbs();
+ acl_dbs.freeze();
const Proxies_priv_table& proxies_priv_table= tables.proxies_priv_table();
if (proxies_priv_table.table_exists())
{
- if (proxies_priv_table.init_read_record(&read_record_info, thd))
+ if (proxies_priv_table.init_read_record(&read_record_info))
DBUG_RETURN(TRUE);
while (!(read_record_info.read_record()))
{
@@ -2072,7 +2234,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
const Roles_mapping_table& roles_mapping_table= tables.roles_mapping_table();
if (roles_mapping_table.table_exists())
{
- if (roles_mapping_table.init_read_record(&read_record_info, thd))
+ if (roles_mapping_table.init_read_record(&read_record_info))
DBUG_RETURN(TRUE);
MEM_ROOT temp_root;
@@ -2120,7 +2282,7 @@ void acl_free(bool end)
free_root(&acl_memroot,MYF(0));
delete_dynamic(&acl_hosts);
delete_dynamic_with_callback(&acl_users, (FREE_FUNC) free_acl_user);
- delete_dynamic(&acl_dbs);
+ acl_dbs.free_memory();
delete_dynamic(&acl_wild_hosts);
delete_dynamic(&acl_proxy_users);
my_hash_free(&acl_check_hosts);
@@ -2158,19 +2320,21 @@ void acl_free(bool end)
bool acl_reload(THD *thd)
{
- DYNAMIC_ARRAY old_acl_hosts, old_acl_users, old_acl_dbs, old_acl_proxy_users;
+ DYNAMIC_ARRAY old_acl_hosts, old_acl_users, old_acl_proxy_users;
+ Dynamic_array<ACL_DB> old_acl_dbs(0U,0U);
HASH old_acl_roles, old_acl_roles_mappings;
MEM_ROOT old_mem;
int result;
DBUG_ENTER("acl_reload");
- Grant_tables tables(Table_host | Table_user | Table_db | Table_proxies_priv |
- Table_roles_mapping, TL_READ);
+ Grant_tables tables;
/*
To avoid deadlocks we should obtain table locks before
obtaining acl_cache->lock mutex.
*/
- if (unlikely((result= tables.open_and_lock(thd))))
+ const uint tables_to_open= Table_host | Table_user | Table_db |
+ Table_proxies_priv | Table_roles_mapping;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_READ)))
{
DBUG_ASSERT(result <= 0);
/*
@@ -2194,7 +2358,7 @@ bool acl_reload(THD *thd)
old_acl_dbs= acl_dbs;
my_init_dynamic_array(&acl_hosts, sizeof(ACL_HOST), 20, 50, MYF(0));
my_init_dynamic_array(&acl_users, sizeof(ACL_USER), 50, 100, MYF(0));
- my_init_dynamic_array(&acl_dbs, sizeof(ACL_DB), 50, 100, MYF(0));
+ acl_dbs.init(50, 100);
my_init_dynamic_array(&acl_proxy_users, sizeof(ACL_PROXY_USER), 50, 100, MYF(0));
my_hash_init2(&acl_roles,50, &my_charset_utf8_bin,
0, 0, 0, (my_hash_get_key) acl_role_get_key, 0,
@@ -2215,6 +2379,7 @@ bool acl_reload(THD *thd)
acl_roles_mappings= old_acl_roles_mappings;
acl_proxy_users= old_acl_proxy_users;
acl_dbs= old_acl_dbs;
+ old_acl_dbs.init(0,0);
acl_memroot= old_mem;
init_check_host();
}
@@ -2225,7 +2390,6 @@ bool acl_reload(THD *thd)
delete_dynamic(&old_acl_hosts);
delete_dynamic_with_callback(&old_acl_users, (FREE_FUNC) free_acl_user);
delete_dynamic(&old_acl_proxy_users);
- delete_dynamic(&old_acl_dbs);
my_hash_free(&old_acl_roles_mappings);
}
mysql_mutex_unlock(&acl_cache->lock);
@@ -2317,7 +2481,7 @@ static ulong get_sort(uint count,...)
}
-static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b)
+static int acl_compare(const ACL_ACCESS *a, const ACL_ACCESS *b)
{
if (a->sort > b->sort)
return -1;
@@ -2326,6 +2490,154 @@ static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b)
return 0;
}
+static int acl_user_compare(const ACL_USER *a, const ACL_USER *b)
+{
+ int res= strcmp(a->user.str, b->user.str);
+ if (res)
+ return res;
+
+ res= acl_compare(a, b);
+ if (res)
+ return res;
+
+ /*
+ For more deterministic results, resolve ambiguity between
+ "localhost" and "127.0.0.1"/"::1" by sorting "localhost" before
+ loopback addresses.
+ Test suite (on Windows) expects "root@localhost", even if
+ root@::1 would also match.
+ */
+ return -strcmp(a->host.hostname, b->host.hostname);
+}
+
+static int acl_db_compare(const ACL_DB *a, const ACL_DB *b)
+{
+ int res= strcmp(a->user, b->user);
+ if (res)
+ return res;
+
+ return acl_compare(a, b);
+}
+
+static void rebuild_acl_users()
+{
+ my_qsort((uchar*)dynamic_element(&acl_users, 0, ACL_USER*), acl_users.elements,
+ sizeof(ACL_USER), (qsort_cmp)acl_user_compare);
+}
+
+static void rebuild_acl_dbs()
+{
+ acl_dbs.sort(acl_db_compare);
+}
+
+
+/*
+ Return index of the first entry with given user in the array,
+ or SIZE_T_MAX if not found.
+
+ Assumes the array is sorted by get_username
+*/
+template<typename T> size_t find_first_user(T* arr, size_t len, const char *user)
+{
+ size_t low= 0;
+ size_t high= len;
+ size_t mid;
+
+ bool found= false;
+ if(!len)
+ return SIZE_T_MAX;
+
+#ifndef DBUG_OFF
+ for (uint i = 0; i < len - 1; i++)
+ DBUG_ASSERT(strcmp(arr[i].get_username(), arr[i + 1].get_username()) <= 0);
+#endif
+ while (low < high)
+ {
+ mid= low + (high - low) / 2;
+ int cmp= strcmp(arr[mid].get_username(),user);
+ if (cmp == 0)
+ found= true;
+
+ if (cmp >= 0 )
+ high= mid;
+ else
+ low= mid + 1;
+ }
+ return (!found || low == len || strcmp(arr[low].get_username(), user)!=0 )?SIZE_T_MAX:low;
+}
+
+static size_t acl_find_user_by_name(const char *user)
+{
+ return find_first_user<ACL_USER>((ACL_USER *)acl_users.buffer,acl_users.elements,user);
+}
+
+static size_t acl_find_db_by_username(const char *user)
+{
+ return find_first_user<ACL_DB>(acl_dbs.front(), acl_dbs.elements(), user);
+}
+
+static bool match_db(ACL_DB *acl_db, const char *db, my_bool db_is_pattern)
+{
+ return !acl_db->db || (db && !wild_compare(db, acl_db->db, db_is_pattern));
+}
+
+
+/*
+ Lookup in the acl_users or acl_dbs for the best matching entry corresponding to
+ given user, host and ip parameters (also db, in case of ACL_DB)
+
+ Historical note:
+
+ In the past, both arrays were sorted just by ACL_ENTRY::sort field and were
+ searched linearly, until the first match of (username,host) pair was found.
+
+ This function uses optimizations (binary search by username), yet preserves the
+ historical behavior, i.e the returns a match with highest ACL_ENTRY::sort.
+*/
+template <typename T> T* find_by_username_or_anon(T* arr, size_t len, const char *user,
+ const char *host, const char *ip,
+ const char *db, my_bool db_is_pattern, bool (*match_db_func)(T*,const char *,my_bool))
+{
+ size_t i;
+ T *ret = NULL;
+
+ // Check entries matching user name.
+ size_t start = find_first_user(arr, len, user);
+ for (i= start; i < len; i++)
+ {
+ T *entry= &arr[i];
+ if (i > start && strcmp(user, entry->get_username()))
+ break;
+
+ if (compare_hostname(&entry->host, host, ip) && (!match_db_func || match_db_func(entry, db, db_is_pattern)))
+ {
+ ret= entry;
+ break;
+ }
+ }
+
+ // Look also for anonymous user (username is empty string)
+ // Due to sort by name, entries for anonymous user start at the start of array.
+ for (i= 0; i < len; i++)
+ {
+ T *entry = &arr[i];
+ if (*entry->get_username() || (ret && acl_compare(entry, ret) >= 0))
+ break;
+ if (compare_hostname(&entry->host, host, ip) && (!match_db_func || match_db_func(entry, db, db_is_pattern)))
+ {
+ ret= entry;
+ break;
+ }
+ }
+ return ret;
+}
+
+static ACL_DB *acl_db_find(const char *db, const char *user, const char *host, const char *ip, my_bool db_is_pattern)
+{
+ return find_by_username_or_anon(acl_dbs.front(), acl_dbs.elements(),
+ user, host, ip, db, db_is_pattern, match_db);
+}
+
/*
Gets user credentials without authentication and resource limit checks.
@@ -2347,7 +2659,6 @@ bool acl_getroot(Security_context *sctx, const char *user, const char *host,
const char *ip, const char *db)
{
int res= 1;
- uint i;
ACL_USER *acl_user= 0;
DBUG_ENTER("acl_getroot");
@@ -2380,21 +2691,9 @@ bool acl_getroot(Security_context *sctx, const char *user, const char *host,
if (acl_user)
{
res= 0;
- for (i=0 ; i < acl_dbs.elements ; i++)
- {
- ACL_DB *acl_db= dynamic_element(&acl_dbs, i, ACL_DB*);
- if (!*acl_db->user || !strcmp(user, acl_db->user))
- {
- if (compare_hostname(&acl_db->host, host, ip))
- {
- if (!acl_db->db || (db && !wild_compare(db, acl_db->db, 0)))
- {
- sctx->db_access= acl_db->access;
- break;
- }
- }
- }
- }
+ if (ACL_DB *acl_db= acl_db_find(db, user, host, ip, FALSE))
+ sctx->db_access= acl_db->access;
+
sctx->master_access= acl_user->access;
strmake_buf(sctx->priv_user, user);
@@ -2409,21 +2708,9 @@ bool acl_getroot(Security_context *sctx, const char *user, const char *host,
if (acl_role)
{
res= 0;
- for (i=0 ; i < acl_dbs.elements ; i++)
- {
- ACL_DB *acl_db= dynamic_element(&acl_dbs, i, ACL_DB*);
- if (!*acl_db->user || !strcmp(user, acl_db->user))
- {
- if (compare_hostname(&acl_db->host, "", ""))
- {
- if (!acl_db->db || (db && !wild_compare(db, acl_db->db, 0)))
- {
- sctx->db_access= acl_db->access;
- break;
- }
- }
- }
- }
+ if (ACL_DB *acl_db= acl_db_find(db, user, "", "", FALSE))
+ sctx->db_access = acl_db->access;
+
sctx->master_access= acl_role->access;
strmake_buf(sctx->priv_role, user);
@@ -2594,8 +2881,8 @@ static int acl_user_update(THD *thd, ACL_USER *acl_user, const ACL_USER *from,
{
acl_user->ssl_type= ssl_type;
acl_user->ssl_cipher= safe_strdup_root(&acl_memroot, ssl_cipher);
- acl_user->x509_issuer= safe_strdup_root(&acl_memroot,x509_issuer);
- acl_user->x509_subject= safe_strdup_root(&acl_memroot,x509_subject);
+ acl_user->x509_issuer= safe_strdup_root(&acl_memroot, safe_str(x509_issuer));
+ acl_user->x509_subject= safe_strdup_root(&acl_memroot, safe_str(x509_subject));
}
return 0;
}
@@ -2622,10 +2909,10 @@ static bool acl_update_db(const char *user, const char *host, const char *db,
bool updated= false;
- for (uint i=0 ; i < acl_dbs.elements ; i++)
+ for (size_t i= acl_find_db_by_username(user); i < acl_dbs.elements(); i++)
{
- ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
- if (!strcmp(user, acl_db->user))
+ ACL_DB *acl_db= &acl_dbs.at(i);
+ if (!strcmp(user,acl_db->user))
{
if ((!acl_db->host.hostname && !host[0]) ||
(acl_db->host.hostname && !strcmp(host, acl_db->host.hostname)))
@@ -2640,11 +2927,13 @@ static bool acl_update_db(const char *user, const char *host, const char *db,
acl_db->initial_access= acl_db->access;
}
else
- delete_dynamic_element(&acl_dbs,i);
+ acl_dbs.del(i);
updated= true;
}
}
}
+ else
+ break;
}
return updated;
@@ -2675,9 +2964,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
acl_db.db=strdup_root(&acl_memroot,db);
acl_db.initial_access= acl_db.access= privileges;
acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user);
- (void) push_dynamic(&acl_dbs,(uchar*) &acl_db);
- my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
- sizeof(ACL_DB),(qsort_cmp) acl_compare);
+ acl_dbs.push(acl_db);
+ rebuild_acl_dbs();
}
@@ -2723,26 +3011,16 @@ ulong acl_get(const char *host, const char *ip,
/*
Check if there are some access rights for database and user
*/
- for (i=0 ; i < acl_dbs.elements ; i++)
+ if (ACL_DB *acl_db= acl_db_find(db,user, host, ip, db_is_pattern))
{
- ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
- if (!*acl_db->user || !strcmp(user, acl_db->user))
- {
- if (compare_hostname(&acl_db->host,host,ip))
- {
- if (!acl_db->db || !wild_compare(db,acl_db->db,db_is_pattern))
- {
- db_access=acl_db->access;
- if (acl_db->host.hostname)
- goto exit; // Fully specified. Take it
- /* the host table is not used for roles */
- if ((!host || !host[0]) && !acl_db->host.hostname && find_acl_role(user))
- goto exit;
- break; /* purecov: tested */
- }
- }
- }
+ db_access= acl_db->access;
+ if (acl_db->host.hostname)
+ goto exit; // Fully specified. Take it
+ /* the host table is not used for roles */
+ if ((!host || !host[0]) && !acl_db->host.hostname && find_acl_role(user))
+ goto exit;
}
+
if (!db_access)
goto exit; // Can't be better
@@ -3040,7 +3318,7 @@ static int check_alter_user(THD *thd, const char *host, const char *user)
if (IF_WSREP((!WSREP(thd) || !thd->wsrep_applier), 1) &&
!thd->slave_thread && !thd->security_ctx->priv_user[0] &&
- !in_bootstrap)
+ !thd->bootstrap)
{
my_message(ER_PASSWORD_ANONYMOUS_USER,
ER_THD(thd, ER_PASSWORD_ANONYMOUS_USER),
@@ -3104,7 +3382,7 @@ bool check_change_password(THD *thd, LEX_USER *user)
*/
bool change_password(THD *thd, LEX_USER *user)
{
- Grant_tables tables(Table_user, TL_WRITE);
+ Grant_tables tables;
/* Buffer should be extended when password length is extended. */
char buff[512];
ulong query_length= 0;
@@ -3126,9 +3404,9 @@ bool change_password(THD *thd, LEX_USER *user)
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0))
- WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
- if ((result= tables.open_and_lock(thd)))
+ if ((result= tables.open_and_lock(thd, Table_user, TL_WRITE)))
DBUG_RETURN(result != 1);
result= 1;
@@ -3185,7 +3463,6 @@ wsrep_error_label:
WSREP_TO_ISOLATION_END;
thd->set_query(query_save);
- thd->wsrep_exec_mode = LOCAL_STATE;
}
#endif /* WITH_WSREP */
thd->restore_stmt_binlog_format(save_binlog_format);
@@ -3201,7 +3478,7 @@ int acl_check_set_default_role(THD *thd, const char *host, const char *user)
int acl_set_default_role(THD *thd, const char *host, const char *user,
const char *rolename)
{
- Grant_tables tables(Table_user, TL_WRITE);
+ Grant_tables tables;
char user_key[MAX_KEY_LENGTH];
int result= 1;
int error;
@@ -3249,7 +3526,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
{
thd->set_query(buff, query_length, system_charset_info);
// Attention!!! here is implicit goto error;
- WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
}
/*
@@ -3257,7 +3534,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
TODO(cvicentiu) Should move this block out in a new function.
*/
{
- if ((result= tables.open_and_lock(thd)))
+ if ((result= tables.open_and_lock(thd, Table_user, TL_WRITE)))
DBUG_RETURN(result != 1);
const User_table& user_table= tables.user_table();
@@ -3290,17 +3567,8 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
/* update the mysql.user table with the new default role */
tables.user_table().table()->use_all_columns();
- if (!tables.user_table().default_role())
- {
- my_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE, MYF(0),
- table->alias.c_ptr(), DEFAULT_ROLE_COLUMN_IDX + 1,
- tables.user_table().num_fields(),
- static_cast<int>(table->s->mysql_version), MYSQL_VERSION_ID);
- mysql_mutex_unlock(&acl_cache->lock);
- goto end;
- }
- user_table.host()->store(host,(uint) strlen(host), system_charset_info);
- user_table.user()->store(user,(uint) strlen(user), system_charset_info);
+ user_table.set_host(host, strlen(host));
+ user_table.set_user(user, strlen(user));
key_copy((uchar *) user_key, table->record[0], table->key_info,
table->key_info->key_length);
@@ -3314,9 +3582,8 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
goto end;
}
store_record(table, record[1]);
- user_table.default_role()->store(acl_user->default_rolename.str,
- acl_user->default_rolename.length,
- system_charset_info);
+ user_table.set_default_role(acl_user->default_rolename.str,
+ acl_user->default_rolename.length);
if (unlikely(error= table->file->ha_update_row(table->record[1],
table->record[0])) &&
error != HA_ERR_RECORD_IS_THE_SAME)
@@ -3347,7 +3614,6 @@ wsrep_error_label:
WSREP_TO_ISOLATION_END;
thd->set_query(query_save);
- thd->wsrep_exec_mode = LOCAL_STATE;
}
#endif /* WITH_WSREP */
@@ -3397,20 +3663,9 @@ bool is_acl_user(const char *host, const char *user)
*/
static ACL_USER *find_user_or_anon(const char *host, const char *user, const char *ip)
{
- ACL_USER *result= NULL;
- mysql_mutex_assert_owner(&acl_cache->lock);
- for (uint i=0; i < acl_users.elements; i++)
- {
- ACL_USER *acl_user_tmp= dynamic_element(&acl_users, i, ACL_USER*);
- if ((!acl_user_tmp->user.length ||
- !strcmp(user, acl_user_tmp->user.str)) &&
- compare_hostname(&acl_user_tmp->host, host, ip))
- {
- result= acl_user_tmp;
- break;
- }
- }
- return result;
+ return find_by_username_or_anon<ACL_USER>
+ (reinterpret_cast<ACL_USER*>(acl_users.buffer), acl_users.elements,
+ user, host, ip, NULL, FALSE, NULL);
}
@@ -3420,11 +3675,15 @@ static ACL_USER *find_user_or_anon(const char *host, const char *user, const cha
static ACL_USER *find_user_exact(const char *host, const char *user)
{
mysql_mutex_assert_owner(&acl_cache->lock);
+ size_t start= acl_find_user_by_name(user);
- for (uint i=0 ; i < acl_users.elements ; i++)
+ for (size_t i= start; i < acl_users.elements; i++)
{
- ACL_USER *acl_user=dynamic_element(&acl_users, i, ACL_USER*);
- if (acl_user->eq(user, host))
+ ACL_USER *acl_user= dynamic_element(&acl_users, i, ACL_USER*);
+ if (i > start && strcmp(acl_user->user.str, user))
+ return 0;
+
+ if (!my_strcasecmp(system_charset_info, acl_user->host.hostname, host))
return acl_user;
}
return 0;
@@ -3437,10 +3696,14 @@ static ACL_USER * find_user_wild(const char *host, const char *user, const char
{
mysql_mutex_assert_owner(&acl_cache->lock);
- for (uint i=0 ; i < acl_users.elements ; i++)
+ size_t start = acl_find_user_by_name(user);
+
+ for (size_t i= start; i < acl_users.elements; i++)
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
- if (acl_user->wild_eq(user, host, ip))
+ if (i > start && strcmp(acl_user->user.str, user))
+ break;
+ if (compare_hostname(&acl_user->host, host, ip ? ip : host))
return acl_user;
}
return 0;
@@ -3619,15 +3882,14 @@ bool hostname_requires_resolving(const char *hostname)
static bool update_user_table_password(THD *thd, const User_table& user_table,
const ACL_USER &user)
{
- CHARSET_INFO *cs= system_charset_info;
char user_key[MAX_KEY_LENGTH];
int error;
DBUG_ENTER("update_user_table_password");
TABLE *table= user_table.table();
table->use_all_columns();
- user_table.host()->store(user.host.hostname, user.hostname_length, cs);
- user_table.user()->store(user.user.str, user.user.length, cs);
+ user_table.set_host(user.host.hostname, user.hostname_length);
+ user_table.set_user(user.user.str, user.user.length);
key_copy((uchar *) user_key, table->record[0], table->key_info,
table->key_info->key_length);
@@ -3641,15 +3903,8 @@ static bool update_user_table_password(THD *thd, const User_table& user_table,
}
store_record(table,record[1]);
- if (user_table.plugin())
- {
- if (user_table.password())
- user_table.password()->reset();
- user_table.plugin()->store(user.plugin.str, user.plugin.length, cs);
- user_table.authentication_string()->store(user.auth_string.str, user.auth_string.length, cs);
- }
- else
- user_table.password()->store(user.auth_string.str, user.auth_string.length, cs);
+ user_table.set_auth(user.plugin.str, user.plugin.length,
+ user.auth_string.str, user.auth_string.length);
if (unlikely(error= table->file->ha_update_row(table->record[1],
table->record[0])) &&
@@ -3679,7 +3934,8 @@ static bool test_if_create_new_users(THD *thd)
{
TABLE_LIST tl;
ulong db_access;
- tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_USER_NAME, NULL, TL_WRITE);
+ tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLE_NAME[USER_TABLE],
+ NULL, TL_WRITE);
create_new_users= 1;
db_access=acl_get(sctx->host, sctx->ip,
@@ -3717,20 +3973,9 @@ static int replace_user_table(THD *thd, const User_table &user_table,
mysql_mutex_assert_owner(&acl_cache->lock);
- /* if the user table is not up to date, we can't handle role updates */
- if (!user_table.is_role() && handle_as_role)
- {
- my_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE, MYF(0),
- "user", ROLE_ASSIGN_COLUMN_IDX + 1, user_table.num_fields(),
- static_cast<int>(table->s->mysql_version), MYSQL_VERSION_ID);
- DBUG_RETURN(-1);
- }
-
table->use_all_columns();
- user_table.host()->store(combo->host.str,combo->host.length,
- system_charset_info);
- user_table.user()->store(combo->user.str,combo->user.length,
- system_charset_info);
+ user_table.set_host(combo->host.str,combo->host.length);
+ user_table.set_user(combo->user.str,combo->user.length);
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
@@ -3783,10 +4028,8 @@ static int replace_user_table(THD *thd, const User_table &user_table,
old_row_exists = 0;
restore_record(table,s->default_values);
- user_table.host()->store(combo->host.str,combo->host.length,
- system_charset_info);
- user_table.user()->store(combo->user.str,combo->user.length,
- system_charset_info);
+ user_table.set_host(combo->host.str,combo->host.length);
+ user_table.set_user(combo->user.str,combo->user.length);
}
else
{
@@ -3801,23 +4044,23 @@ static int replace_user_table(THD *thd, const User_table &user_table,
/* Update table columns with new privileges */
- ulong priv;
- priv = SELECT_ACL;
- for (uint i= 0; i < user_table.num_privileges(); i++, priv <<= 1)
- {
- if (priv & rights)
- user_table.priv_field(i)->store(&what, 1, &my_charset_latin1);
- }
-
+ user_table.set_access(rights, revoke_grant);
rights= user_table.get_access();
if (handle_as_role)
{
- if (old_row_exists && !user_table.check_is_role())
+ if (old_row_exists && !user_table.get_is_role())
{
goto end;
}
- user_table.is_role()->store("Y", 1, system_charset_info);
+ if (user_table.set_is_role(true))
+ {
+ my_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE, MYF(0),
+ user_table.name().str,
+ ROLE_ASSIGN_COLUMN_IDX + 1, user_table.num_fields(),
+ static_cast<int>(table->s->mysql_version), MYSQL_VERSION_ID);
+ goto end;
+ }
}
else
{
@@ -3834,90 +4077,51 @@ static int replace_user_table(THD *thd, const User_table &user_table,
rights))
goto end;
- DBUG_PRINT("info",("table fields: %d", user_table.num_fields()));
- /* We either have the password column, the plugin column, or both. Otherwise
- we have a corrupt user table. */
- DBUG_ASSERT(user_table.password() || user_table.plugin());
- if (user_table.ssl_type()) /* From 4.0.0 we have more fields */
- {
- /* We write down SSL related ACL stuff */
- switch (lex->ssl_type) {
- case SSL_TYPE_ANY:
- user_table.ssl_type()->store(STRING_WITH_LEN("ANY"),
- &my_charset_latin1);
- user_table.ssl_cipher()->store("", 0, &my_charset_latin1);
- user_table.x509_issuer()->store("", 0, &my_charset_latin1);
- user_table.x509_subject()->store("", 0, &my_charset_latin1);
- break;
- case SSL_TYPE_X509:
- user_table.ssl_type()->store(STRING_WITH_LEN("X509"),
- &my_charset_latin1);
- user_table.ssl_cipher()->store("", 0, &my_charset_latin1);
- user_table.x509_issuer()->store("", 0, &my_charset_latin1);
- user_table.x509_subject()->store("", 0, &my_charset_latin1);
- break;
- case SSL_TYPE_SPECIFIED:
- user_table.ssl_type()->store(STRING_WITH_LEN("SPECIFIED"),
- &my_charset_latin1);
- user_table.ssl_cipher()->store("", 0, &my_charset_latin1);
- user_table.x509_issuer()->store("", 0, &my_charset_latin1);
- user_table.x509_subject()->store("", 0, &my_charset_latin1);
- if (lex->ssl_cipher)
- user_table.ssl_cipher()->store(lex->ssl_cipher,
- strlen(lex->ssl_cipher),
- system_charset_info);
- if (lex->x509_issuer)
- user_table.x509_issuer()->store(lex->x509_issuer,
- strlen(lex->x509_issuer),
- system_charset_info);
- if (lex->x509_subject)
- user_table.x509_subject()->store(lex->x509_subject,
- strlen(lex->x509_subject),
- system_charset_info);
- break;
- case SSL_TYPE_NOT_SPECIFIED:
- break;
- case SSL_TYPE_NONE:
- user_table.ssl_type()->store("", 0, &my_charset_latin1);
- user_table.ssl_cipher()->store("", 0, &my_charset_latin1);
- user_table.x509_issuer()->store("", 0, &my_charset_latin1);
- user_table.x509_subject()->store("", 0, &my_charset_latin1);
- break;
- }
-
- USER_RESOURCES mqh= lex->mqh;
- if (mqh.specified_limits & USER_RESOURCES::QUERIES_PER_HOUR)
- user_table.max_questions()->store((longlong) mqh.questions, TRUE);
- if (mqh.specified_limits & USER_RESOURCES::UPDATES_PER_HOUR)
- user_table.max_updates()->store((longlong) mqh.updates, TRUE);
- if (mqh.specified_limits & USER_RESOURCES::CONNECTIONS_PER_HOUR)
- user_table.max_connections()->store((longlong) mqh.conn_per_hour, TRUE);
- if (user_table.max_user_connections() &&
- (mqh.specified_limits & USER_RESOURCES::USER_CONNECTIONS))
- user_table.max_user_connections()->store((longlong) mqh.user_conn, FALSE);
- if (user_table.plugin())
- {
- user_table.plugin()->set_notnull();
- user_table.authentication_string()->set_notnull();
- if (new_acl_user.plugin.length)
- {
- if (user_table.password())
- user_table.password()->reset();
- user_table.plugin()->store(new_acl_user.plugin.str,
- new_acl_user.plugin.length, system_charset_info);
- user_table.authentication_string()->store(new_acl_user.auth_string.str,
- new_acl_user.auth_string.length, system_charset_info);
- }
+ user_table.set_auth(new_acl_user.plugin.str, new_acl_user.plugin.length,
+ new_acl_user.auth_string.str, new_acl_user.auth_string.length);
- if (user_table.max_statement_time())
- {
- if (mqh.specified_limits & USER_RESOURCES::MAX_STATEMENT_TIME)
- user_table.max_statement_time()->store(mqh.max_statement_time);
- }
- }
- mqh_used= (mqh_used || mqh.questions || mqh.updates || mqh.conn_per_hour ||
- mqh.user_conn || mqh.max_statement_time != 0.0);
+ switch (lex->ssl_type) {
+ case SSL_TYPE_NOT_SPECIFIED:
+ break;
+ case SSL_TYPE_NONE:
+ case SSL_TYPE_ANY:
+ case SSL_TYPE_X509:
+ user_table.set_ssl_type(lex->ssl_type);
+ user_table.set_ssl_cipher("", 0);
+ user_table.set_x509_issuer("", 0);
+ user_table.set_x509_subject("", 0);
+ break;
+ case SSL_TYPE_SPECIFIED:
+ user_table.set_ssl_type(lex->ssl_type);
+ if (lex->ssl_cipher)
+ user_table.set_ssl_cipher(lex->ssl_cipher, strlen(lex->ssl_cipher));
+ else
+ user_table.set_ssl_cipher("", 0);
+ if (lex->x509_issuer)
+ user_table.set_x509_issuer(lex->x509_issuer, strlen(lex->x509_issuer));
+ else
+ user_table.set_x509_issuer("", 0);
+ if (lex->x509_subject)
+ user_table.set_x509_subject(lex->x509_subject, strlen(lex->x509_subject));
+ else
+ user_table.set_x509_subject("", 0);
+ break;
}
+
+ if (lex->mqh.specified_limits & USER_RESOURCES::QUERIES_PER_HOUR)
+ user_table.set_max_questions(lex->mqh.questions);
+ if (lex->mqh.specified_limits & USER_RESOURCES::UPDATES_PER_HOUR)
+ user_table.set_max_updates(lex->mqh.updates);
+ if (lex->mqh.specified_limits & USER_RESOURCES::CONNECTIONS_PER_HOUR)
+ user_table.set_max_connections(lex->mqh.conn_per_hour);
+ if (lex->mqh.specified_limits & USER_RESOURCES::USER_CONNECTIONS)
+ user_table.set_max_user_connections(lex->mqh.user_conn);
+ if (lex->mqh.specified_limits & USER_RESOURCES::MAX_STATEMENT_TIME)
+ user_table.set_max_statement_time(lex->mqh.max_statement_time);
+
+ mqh_used= (mqh_used || lex->mqh.questions || lex->mqh.updates ||
+ lex->mqh.conn_per_hour || lex->mqh.user_conn ||
+ lex->mqh.max_statement_time != 0.0);
}
if (old_row_exists)
@@ -3970,8 +4174,7 @@ end:
else
{
push_new_user(new_acl_user);
- my_qsort(dynamic_element(&acl_users, 0, ACL_USER*), acl_users.elements,
- sizeof(ACL_USER),(qsort_cmp) acl_compare);
+ rebuild_acl_users();
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host();
@@ -4289,6 +4492,13 @@ replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
DBUG_ENTER("replace_proxies_priv_table");
+ if (!table)
+ {
+ my_error(ER_NO_SUCH_TABLE, MYF(0), MYSQL_SCHEMA_NAME.str,
+ MYSQL_TABLE_NAME[PROXIES_PRIV_TABLE].str);
+ DBUG_RETURN(-1);
+ }
+
/* Check if there is such a user in user table in memory? */
if (!find_user_wild(user->host.str,user->user.str))
{
@@ -5086,6 +5296,13 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
HASH *hash= sph->get_priv_hash();
DBUG_ENTER("replace_routine_table");
+ if (!table)
+ {
+ my_error(ER_NO_SUCH_TABLE, MYF(0), MYSQL_SCHEMA_NAME.str,
+ MYSQL_TABLE_NAME[PROCS_PRIV_TABLE].str);
+ DBUG_RETURN(-1);
+ }
+
if (revoke_grant && !grant_name->init_privs) // only inherited role privs
{
my_hash_delete(hash, (uchar*) grant_name);
@@ -5554,15 +5771,15 @@ static bool merge_role_global_privileges(ACL_ROLE *grantee)
return old != grantee->access;
}
-static int db_name_sort(ACL_DB * const *db1, ACL_DB * const *db2)
+static int db_name_sort(const int *db1, const int *db2)
{
- return strcmp((*db1)->db, (*db2)->db);
+ return strcmp(acl_dbs.at(*db1).db, acl_dbs.at(*db2).db);
}
/**
update ACL_DB for given database and a given role with merged privileges
- @param merged ACL_DB of the role in question (or NULL if it wasn't found)
+ @param merged ACL_DB of the role in question (or -1 if it wasn't found)
@param first first ACL_DB in an array for the database in question
@param access new privileges for the given role on the gived database
@param role the name of the given role
@@ -5572,15 +5789,15 @@ static int db_name_sort(ACL_DB * const *db1, ACL_DB * const *db2)
2 - ACL_DB was added
4 - ACL_DB was deleted
*/
-static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
+static int update_role_db(int merged, int first, ulong access,
const char *role)
{
- if (!first)
+ if (first < 0)
return 0;
DBUG_EXECUTE_IF("role_merge_stats", role_db_merges++;);
- if (merged == NULL)
+ if (merged < 0)
{
/*
there's no ACL_DB for this role (all db grants come from granted roles)
@@ -5595,11 +5812,11 @@ static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
acl_db.user= role;
acl_db.host.hostname= const_cast<char*>("");
acl_db.host.ip= acl_db.host.ip_mask= 0;
- acl_db.db= first[0]->db;
+ acl_db.db= acl_dbs.at(first).db;
acl_db.access= access;
acl_db.initial_access= 0;
acl_db.sort=get_sort(3, "", acl_db.db, role);
- push_dynamic(&acl_dbs,(uchar*) &acl_db);
+ acl_dbs.push(acl_db);
return 2;
}
else if (access == 0)
@@ -5615,13 +5832,13 @@ static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
2. it's O(N) operation, and we may need many of them
so we only mark elements deleted and will delete later.
*/
- merged->sort= 0; // lower than any valid ACL_DB sort value, will be sorted last
+ acl_dbs.at(merged).sort= 0; // lower than any valid ACL_DB sort value, will be sorted last
return 4;
}
- else if (merged->access != access)
+ else if (acl_dbs.at(merged).access != access)
{
/* this is easy */
- merged->access= access;
+ acl_dbs.at(merged).access= access;
return 1;
}
return 0;
@@ -5636,7 +5853,7 @@ static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
role_hash_t *rhash)
{
- Dynamic_array<ACL_DB *> dbs;
+ Dynamic_array<int> dbs;
/*
Supposedly acl_dbs can be huge, but only a handful of db grants
@@ -5644,9 +5861,9 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
Collect these applicable db grants.
*/
- for (uint i=0 ; i < acl_dbs.elements ; i++)
+ for (uint i=0 ; i < acl_dbs.elements() ; i++)
{
- ACL_DB *db= dynamic_element(&acl_dbs,i,ACL_DB*);
+ ACL_DB *db= &acl_dbs.at(i);
if (db->host.hostname[0])
continue;
if (dbname && strcmp(db->db, dbname))
@@ -5654,7 +5871,7 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
ACL_ROLE *r= rhash->find(db->user, strlen(db->user));
if (!r)
continue;
- dbs.append(db);
+ dbs.append(i);
}
dbs.sort(db_name_sort);
@@ -5663,42 +5880,47 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
(that should be merged) are sorted together. The grantee's ACL_DB element
is not necessarily the first and may be not present at all.
*/
- ACL_DB **first= NULL, *merged= NULL;
+ int first= -1, merged= -1;
ulong access= 0, update_flags= 0;
- for (ACL_DB **cur= dbs.front(); cur <= dbs.back(); cur++)
+ for (int *p= dbs.front(); p <= dbs.back(); p++)
{
- if (!first || (!dbname && strcmp(cur[0]->db, cur[-1]->db)))
+ if (first<0 || (!dbname && strcmp(acl_dbs.at(*p).db, acl_dbs.at(*p-1).db)))
{ // new db name series
update_flags|= update_role_db(merged, first, access, grantee->user.str);
- merged= NULL;
+ merged= -1;
access= 0;
- first= cur;
+ first= *p;
}
- if (strcmp(cur[0]->user, grantee->user.str) == 0)
- access|= (merged= cur[0])->initial_access;
+ if (strcmp(acl_dbs.at(*p).user, grantee->user.str) == 0)
+ access|= acl_dbs.at(merged= *p).initial_access;
else
- access|= cur[0]->access;
+ access|= acl_dbs.at(*p).access;
}
update_flags|= update_role_db(merged, first, access, grantee->user.str);
- /*
- to make this code a bit simpler, we sort on deletes, to move
- deleted elements to the end of the array. strictly speaking it's
- unnecessary, it'd be faster to remove them in one O(N) array scan.
-
- on the other hand, qsort on almost sorted array is pretty fast anyway...
- */
- if (update_flags & (2|4))
- { // inserted or deleted, need to sort
- my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
- sizeof(ACL_DB),(qsort_cmp) acl_compare);
- }
if (update_flags & 4)
- { // deleted, trim the end
- while (acl_dbs.elements &&
- dynamic_element(&acl_dbs, acl_dbs.elements-1, ACL_DB*)->sort == 0)
- acl_dbs.elements--;
+ {
+ // Remove elements marked for deletion.
+ uint count= 0;
+ for(uint i= 0; i < acl_dbs.elements(); i++)
+ {
+ ACL_DB *acl_db= &acl_dbs.at(i);
+ if (acl_db->sort)
+ {
+ if (i > count)
+ acl_dbs.set(count, *acl_db);
+ count++;
+ }
+ }
+ acl_dbs.elements(count);
+ }
+
+
+ if (update_flags & 2)
+ { // inserted, need to sort
+ rebuild_acl_dbs();
}
+
return update_flags;
}
@@ -6217,10 +6439,10 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
Open the mysql.user and mysql.tables_priv tables.
Don't open column table if we don't need it !
*/
- int maybe_columns_priv= 0;
+ int tables_to_open= Table_user | Table_tables_priv;
if (column_priv ||
(revoke_grant && ((rights & COL_ACLS) || columns.elements)))
- maybe_columns_priv= Table_columns_priv;
+ tables_to_open|= Table_columns_priv;
/*
The lock api is depending on the thd->lex variable which needs to be
@@ -6235,9 +6457,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
*/
thd->lex->sql_command= backup.sql_command;
- Grant_tables tables(Table_user | Table_tables_priv | maybe_columns_priv,
- TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
{
thd->lex->restore_backup_query_tables_list(&backup);
DBUG_RETURN(result != 1);
@@ -6398,7 +6619,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list,
{
List_iterator <LEX_USER> str_list (user_list);
LEX_USER *Str, *tmp_Str;
- bool create_new_users= 0, result;
+ bool create_new_users= 0;
+ int result;
const char *db_name, *table_name;
DBUG_ENTER("mysql_routine_grant");
@@ -6416,8 +6638,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN(TRUE);
}
- Grant_tables tables(Table_user | Table_procs_priv, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ if ((result= tables.open_and_lock(thd, Table_user | Table_procs_priv, TL_WRITE)))
DBUG_RETURN(result != 1);
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -6474,12 +6696,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list,
}
}
- /* TODO(cvicentiu) refactor replace_routine_table to use Tables_procs_priv
- instead of TABLE directly. */
- if (tables.procs_priv_table().no_such_table() ||
- replace_routine_table(thd, grant_name, tables.procs_priv_table().table(),
- *Str, db_name, table_name, sph, rights,
- revoke_grant) != 0)
+ if (replace_routine_table(thd, grant_name, tables.procs_priv_table().table(),
+ *Str, db_name, table_name, sph, rights, revoke_grant) != 0)
{
result= TRUE;
continue;
@@ -6617,8 +6835,8 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke)
no_auto_create_user= MY_TEST(thd->variables.sql_mode &
MODE_NO_AUTO_CREATE_USER);
- Grant_tables tables(Table_user | Table_roles_mapping, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ if ((result= tables.open_and_lock(thd, Table_user | Table_roles_mapping, TL_WRITE)))
DBUG_RETURN(result != 1);
mysql_rwlock_wrlock(&LOCK_grant);
@@ -6835,7 +7053,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
List_iterator <LEX_USER> str_list (list);
LEX_USER *Str, *tmp_Str, *proxied_user= NULL;
char tmp_db[SAFE_NAME_LEN+1];
- bool create_new_users=0, result;
+ bool create_new_users=0;
+ int result;
DBUG_ENTER("mysql_grant");
if (lower_case_table_names && db)
@@ -6856,9 +7075,9 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
proxied_user= str_list++;
}
- Grant_tables tables(Table_user | (is_proxy ? Table_proxies_priv : Table_db),
- TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ const uint tables_to_open= Table_user | (is_proxy ? Table_proxies_priv : Table_db);
+ Grant_tables tables;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
DBUG_RETURN(result != 1);
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -6909,13 +7128,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
else if (is_proxy)
{
- /* TODO(cvicentiu) refactor replace_proxies_priv_table to use
- Proxies_priv_table instead of TABLE directly. */
- if (tables.proxies_priv_table().no_such_table() ||
- replace_proxies_priv_table (thd, tables.proxies_priv_table().table(),
- Str, proxied_user,
- rights & GRANT_ACL ? TRUE : FALSE,
- revoke_grant))
+ if (replace_proxies_priv_table(thd, tables.proxies_priv_table().table(),
+ Str, proxied_user, rights & GRANT_ACL ? TRUE : FALSE, revoke_grant))
result= true;
}
if (Str->is_role())
@@ -7177,9 +7391,9 @@ bool grant_reload(THD *thd)
obtaining LOCK_grant rwlock.
*/
- Grant_tables tables(Table_tables_priv | Table_columns_priv| Table_procs_priv,
- TL_READ);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ const uint tables_to_open= Table_tables_priv | Table_columns_priv| Table_procs_priv;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_READ)))
DBUG_RETURN(result != 1);
mysql_rwlock_wrlock(&LOCK_grant);
@@ -8161,14 +8375,14 @@ static void add_user_parameters(String *result, ACL_USER* acl_user,
{
int ssl_options = 0;
result->append(STRING_WITH_LEN(" REQUIRE "));
- if (acl_user->x509_issuer)
+ if (acl_user->x509_issuer[0])
{
ssl_options++;
result->append(STRING_WITH_LEN("ISSUER \'"));
result->append(acl_user->x509_issuer,strlen(acl_user->x509_issuer));
result->append('\'');
}
- if (acl_user->x509_subject)
+ if (acl_user->x509_subject[0])
{
if (ssl_options++)
result->append(' ');
@@ -8645,16 +8859,14 @@ static bool show_database_privileges(THD *thd, const char *username,
const char *hostname,
char *buff, size_t buffsize)
{
- ACL_DB *acl_db;
ulong want_access;
- uint counter;
Protocol *protocol= thd->protocol;
- for (counter=0 ; counter < acl_dbs.elements ; counter++)
+ for (uint i=0 ; i < acl_dbs.elements() ; i++)
{
const char *user, *host;
- acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
+ ACL_DB *acl_db= &acl_dbs.at(i);
user= acl_db->user;
host=acl_db->host.hostname;
@@ -9231,7 +9443,7 @@ static int handle_grant_table(THD *thd, const Grant_table_base& grant_table,
if (!unlikely(error) && !*host_str)
{
// verify that we got a role or a user, as needed
- if (static_cast<const User_table&>(grant_table).check_is_role() !=
+ if (static_cast<const User_table&>(grant_table).get_is_role() !=
user_from->is_role())
error= HA_ERR_KEY_NOT_FOUND;
}
@@ -9409,7 +9621,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
elements= acl_users.elements;
break;
case DB_ACL:
- elements= acl_dbs.elements;
+ elements= int(acl_dbs.elements());
break;
case COLUMN_PRIVILEGES_HASH:
grant_name_hash= &column_priv_hash;
@@ -9461,7 +9673,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
break;
case DB_ACL:
- acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
+ acl_db= &acl_dbs.at(idx);
user= acl_db->user;
host= acl_db->host.hostname;
break;
@@ -9545,7 +9757,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
break;
case DB_ACL:
- delete_dynamic_element(&acl_dbs, idx);
+ acl_dbs.del(idx);
break;
case COLUMN_PRIVILEGES_HASH:
@@ -9931,11 +10143,11 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
DBUG_RETURN(TRUE);
/* CREATE USER may be skipped on replication client. */
- Grant_tables tables(Table_user | Table_db |
- Table_tables_priv | Table_columns_priv |
- Table_procs_priv | Table_proxies_priv |
- Table_roles_mapping, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ const uint tables_to_open= Table_user | Table_db | Table_tables_priv |
+ Table_columns_priv | Table_procs_priv |
+ Table_proxies_priv | Table_roles_mapping;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
DBUG_RETURN(result != 1);
mysql_rwlock_wrlock(&LOCK_grant);
@@ -10090,11 +10302,11 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
DBUG_PRINT("entry", ("Handle as %s", handle_as_role ? "role" : "user"));
/* DROP USER may be skipped on replication client. */
- Grant_tables tables(Table_user | Table_db |
- Table_tables_priv | Table_columns_priv |
- Table_procs_priv | Table_proxies_priv |
- Table_roles_mapping, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ const uint tables_to_open= Table_user | Table_db | Table_tables_priv |
+ Table_columns_priv | Table_procs_priv |
+ Table_proxies_priv | Table_roles_mapping;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
DBUG_RETURN(result != 1);
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
@@ -10200,11 +10412,11 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
DBUG_ENTER("mysql_rename_user");
/* RENAME USER may be skipped on replication client. */
- Grant_tables tables(Table_user | Table_db |
- Table_tables_priv | Table_columns_priv |
- Table_procs_priv | Table_proxies_priv |
- Table_roles_mapping, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ const uint tables_to_open= Table_user | Table_db | Table_tables_priv |
+ Table_columns_priv | Table_procs_priv |
+ Table_proxies_priv | Table_roles_mapping;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
DBUG_RETURN(result != 1);
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -10243,8 +10455,12 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
continue;
}
some_users_renamed= TRUE;
+ rebuild_acl_users();
}
+ /* Rebuild 'acl_dbs' since 'acl_users' has been modified */
+ rebuild_acl_dbs();
+
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host();
@@ -10283,10 +10499,11 @@ int mysql_alter_user(THD* thd, List<LEX_USER> &users_list)
DBUG_ENTER("mysql_alter_user");
int result= 0;
String wrong_users;
+ bool some_users_altered= false;
/* The only table we're altering is the user table. */
- Grant_tables tables(Table_user, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ if ((result= tables.open_and_lock(thd, Table_user, TL_WRITE)))
DBUG_RETURN(result != 1);
/* Lock ACL data structures until we finish altering all users. */
@@ -10306,6 +10523,7 @@ int mysql_alter_user(THD* thd, List<LEX_USER> &users_list)
result= TRUE;
continue;
}
+ some_users_altered= true;
}
/* Unlock ACL data structures. */
@@ -10330,14 +10548,16 @@ int mysql_alter_user(THD* thd, List<LEX_USER> &users_list)
wrong_users.c_ptr_safe());
}
}
+
+ if (some_users_altered)
+ result|= write_bin_log(thd, FALSE, thd->query(),
+ thd->query_length());
DBUG_RETURN(result);
}
static bool
-mysql_revoke_sp_privs(THD *thd,
- Grant_tables *tables,
- const Sp_handler *sph,
+mysql_revoke_sp_privs(THD *thd, Grant_tables *tables, const Sp_handler *sph,
const LEX_USER *lex_user)
{
bool rc= false;
@@ -10393,11 +10613,11 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
ACL_DB *acl_db;
DBUG_ENTER("mysql_revoke_all");
- Grant_tables tables(Table_user | Table_db |
- Table_tables_priv | Table_columns_priv |
- Table_procs_priv | Table_proxies_priv |
- Table_roles_mapping, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ const uint tables_to_open= Table_user | Table_db | Table_tables_priv |
+ Table_columns_priv | Table_procs_priv |
+ Table_proxies_priv | Table_roles_mapping;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
DBUG_RETURN(result != 1);
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -10438,11 +10658,11 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
*/
do
{
- for (counter= 0, revoked= 0 ; counter < acl_dbs.elements ; )
+ for (counter= 0, revoked= 0 ; counter < acl_dbs.elements() ; )
{
- const char *user,*host;
+ const char *user, *host;
- acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
+ acl_db= &acl_dbs.at(counter);
user= acl_db->user;
host= safe_str(acl_db->host.hostname);
@@ -10681,11 +10901,11 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
Silence_routine_definer_errors error_handler;
DBUG_ENTER("sp_revoke_privileges");
- Grant_tables tables(Table_user | Table_db |
- Table_tables_priv | Table_columns_priv |
- Table_procs_priv | Table_proxies_priv |
- Table_roles_mapping, TL_WRITE);
- if ((result= tables.open_and_lock(thd)))
+ Grant_tables tables;
+ const uint tables_to_open= Table_user | Table_db | Table_tables_priv |
+ Table_columns_priv | Table_procs_priv |
+ Table_proxies_priv | Table_roles_mapping;
+ if ((result= tables.open_and_lock(thd, tables_to_open, TL_WRITE)))
DBUG_RETURN(result != 1);
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -11045,6 +11265,14 @@ static int show_column_grants(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
+static int show_database_grants(THD *thd, SHOW_VAR *var, char *buff,
+ enum enum_var_type scope)
+{
+ var->type= SHOW_UINT;
+ var->value= buff;
+ *(uint *)buff= uint(acl_dbs.elements());
+ return 0;
+}
#else
bool check_grant(THD *, ulong, TABLE_LIST *, bool, uint, bool)
@@ -11056,7 +11284,7 @@ bool check_grant(THD *, ulong, TABLE_LIST *, bool, uint, bool)
SHOW_VAR acl_statistics[] = {
#ifndef NO_EMBEDDED_ACCESS_CHECKS
{"column_grants", (char*)show_column_grants, SHOW_SIMPLE_FUNC},
- {"database_grants", (char*)&acl_dbs.elements, SHOW_UINT},
+ {"database_grants", (char*)show_database_grants, SHOW_SIMPLE_FUNC},
{"function_grants", (char*)&func_priv_hash.records, SHOW_ULONG},
{"procedure_grants", (char*)&proc_priv_hash.records, SHOW_ULONG},
{"package_spec_grants", (char*)&package_spec_priv_hash.records, SHOW_ULONG},
@@ -11329,11 +11557,11 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(0);
mysql_mutex_lock(&acl_cache->lock);
- for (counter=0 ; counter < acl_dbs.elements ; counter++)
+ for (counter=0 ; counter < acl_dbs.elements() ; counter++)
{
const char *user, *host, *is_grantable="YES";
- acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
+ acl_db=&acl_dbs.at(counter);
user= acl_db->user;
host= safe_str(acl_db->host.hostname);
@@ -12108,6 +12336,23 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
+
+/**
+ Safeguard to avoid blocking the root, when max_password_errors
+ limit is reached.
+
+ Currently, we allow password errors for superuser on localhost.
+
+ @return true, if password errors should be ignored, and user should not be locked.
+*/
+static bool ignore_max_password_errors(const ACL_USER *acl_user)
+{
+ const char *host= acl_user->host.hostname;
+ return (acl_user->access & SUPER_ACL)
+ && (!strcasecmp(host, "localhost") ||
+ !strcmp(host, "127.0.0.1") ||
+ !strcmp(host, "::1"));
+}
/**
Finds acl entry in user database for authentication purposes.
@@ -12126,6 +12371,16 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
mysql_mutex_lock(&acl_cache->lock);
ACL_USER *user= find_user_or_anon(sctx->host, sctx->user, sctx->ip);
+
+ if (user && user->password_errors >= max_password_errors && !ignore_max_password_errors(user))
+ {
+ mysql_mutex_unlock(&acl_cache->lock);
+ my_error(ER_USER_IS_BLOCKED, MYF(0));
+ general_log_print(mpvio->auth_info.thd, COM_CONNECT,
+ ER_THD(mpvio->auth_info.thd, ER_USER_IS_BLOCKED));
+ DBUG_RETURN(1);
+ }
+
if (user)
mpvio->acl_user= user->copy(mpvio->auth_info.thd->mem_root);
@@ -12426,7 +12681,12 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
return packet_error;
DBUG_PRINT("info", ("IO layer change in progress..."));
- if (sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout, &errptr))
+ mysql_rwlock_rdlock(&LOCK_ssl_refresh);
+ int ssl_ret = sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout, &errptr);
+ mysql_rwlock_unlock(&LOCK_ssl_refresh);
+ ssl_acceptor_stats_update(ssl_ret);
+
+ if(ssl_ret)
{
DBUG_PRINT("error", ("Failed to accept new SSL connection"));
return packet_error;
@@ -12845,24 +13105,25 @@ static bool acl_check_ssl(THD *thd, const ACL_USER *acl_user)
return 1;
if (acl_user->ssl_cipher)
{
+ const char *ssl_cipher= SSL_get_cipher(ssl);
DBUG_PRINT("info", ("comparing ciphers: '%s' and '%s'",
- acl_user->ssl_cipher, SSL_get_cipher(ssl)));
- if (strcmp(acl_user->ssl_cipher, SSL_get_cipher(ssl)))
+ acl_user->ssl_cipher, ssl_cipher));
+ if (strcmp(acl_user->ssl_cipher, ssl_cipher))
{
if (global_system_variables.log_warnings)
sql_print_information("X509 ciphers mismatch: should be '%s' but is '%s'",
- acl_user->ssl_cipher, SSL_get_cipher(ssl));
+ acl_user->ssl_cipher, ssl_cipher);
return 1;
}
}
- if (!acl_user->x509_issuer && !acl_user->x509_subject)
+ if (!acl_user->x509_issuer[0] && !acl_user->x509_subject[0])
return 0; // all done
/* Prepare certificate (if exists) */
if (!(cert= SSL_get_peer_certificate(ssl)))
return 1;
/* If X509 issuer is specified, we check it... */
- if (acl_user->x509_issuer)
+ if (acl_user->x509_issuer[0])
{
char *ptr= X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
DBUG_PRINT("info", ("comparing issuers: '%s' and '%s'",
@@ -12879,7 +13140,7 @@ static bool acl_check_ssl(THD *thd, const ACL_USER *acl_user)
free(ptr);
}
/* X509 subject is specified, we check it .. */
- if (acl_user->x509_subject)
+ if (acl_user->x509_subject[0])
{
char *ptr= X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
DBUG_PRINT("info", ("comparing subjects: '%s' and '%s'",
@@ -12965,6 +13226,38 @@ static int do_auth_once(THD *thd, const LEX_CSTRING *auth_plugin_name,
return res;
}
+enum PASSWD_ERROR_ACTION
+{
+ PASSWD_ERROR_CLEAR,
+ PASSWD_ERROR_INCREMENT
+};
+
+/* Increment, or clear password errors for a user. */
+static void handle_password_errors(const char *user, const char *hostname, PASSWD_ERROR_ACTION action)
+{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ mysql_mutex_assert_not_owner(&acl_cache->lock);
+ mysql_mutex_lock(&acl_cache->lock);
+ ACL_USER *u = find_user_exact(hostname, user);
+ if (u)
+ {
+ switch(action)
+ {
+ case PASSWD_ERROR_INCREMENT:
+ u->password_errors++;
+ break;
+ case PASSWD_ERROR_CLEAR:
+ u->password_errors= 0;
+ break;
+ default:
+ DBUG_ASSERT(0);
+ break;
+ }
+ }
+ mysql_mutex_unlock(&acl_cache->lock);
+#endif
+}
+
/**
Perform the handshake, authorize the client and update thd sctx variables.
@@ -13084,6 +13377,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
break;
case CR_AUTH_USER_CREDENTIALS:
errors.m_authentication= 1;
+ if (thd->password && !mpvio.make_it_fail)
+ handle_password_errors(acl_user->user.str, acl_user->host.hostname, PASSWD_ERROR_INCREMENT);
break;
case CR_ERROR:
default:
@@ -13098,6 +13393,11 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
}
sctx->proxy_user[0]= 0;
+ if (thd->password && acl_user->password_errors)
+ {
+ /* Login succeeded, clear password errors.*/
+ handle_password_errors(acl_user->user.str, acl_user->host.hostname, PASSWD_ERROR_CLEAR);
+ }
if (initialized) // if not --skip-grant-tables
{
@@ -13449,7 +13749,7 @@ static int old_password_authenticate(MYSQL_PLUGIN_VIO *vio,
pkt_len= (int)strnlen((char*)pkt, pkt_len);
if (pkt_len == 0) /* no password */
- return info->auth_string[0] ? CR_AUTH_USER_CREDENTIALS : CR_OK;
+ return info->auth_string_length ? CR_AUTH_USER_CREDENTIALS : CR_OK;
if (secure_auth(thd))
return CR_AUTH_HANDSHAKE;
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index d0d959de8f9..b39103e382a 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -767,7 +767,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
collect_eis=
(table->table->s->table_category == TABLE_CATEGORY_USER &&
- (get_use_stat_tables_mode(thd) > NEVER ||
+ (check_eits_collection_allowed(thd) ||
lex->with_persistent_for_clause));
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index 05a71d7785d..4e5ac6e9381 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -476,6 +476,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
thd->work_part_info= 0;
#endif
+#ifdef WITH_WSREP
if (WSREP(thd) &&
(!thd->is_current_stmt_binlog_format_row() ||
!thd->find_temporary_table(first_table)))
@@ -487,6 +488,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
thd->variables.auto_increment_offset = 1;
thd->variables.auto_increment_increment = 1;
}
+#endif
result= mysql_alter_table(thd, &select_lex->db, &lex->name,
&create_info,
diff --git a/sql/sql_array.h b/sql/sql_array.h
index 4a49ade5576..30fbb140748 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -123,8 +123,7 @@ public:
void init(uint prealloc=16, uint increment=16)
{
- my_init_dynamic_array(&array, sizeof(Elem), prealloc, increment,
- MYF(0));
+ init_dynamic_array2(&array, sizeof(Elem), 0, prealloc, increment, MYF(0));
}
/**
@@ -231,6 +230,11 @@ public:
set_dynamic(&array, &el, idx);
}
+ void freeze()
+ {
+ freeze_size(&array);
+ }
+
bool resize(size_t new_size, Elem default_val)
{
size_t old_size= elements();
@@ -265,7 +269,7 @@ public:
my_qsort(array.buffer, array.elements, sizeof(Elem), (qsort_cmp)cmp_func);
}
- typedef int (*CMP_FUNC2)(const Elem *el1, const Elem *el2, void *);
+ typedef int (*CMP_FUNC2)(void *, const Elem *el1, const Elem *el2);
void sort(CMP_FUNC2 cmp_func, void *data)
{
my_qsort2(array.buffer, array.elements, sizeof(Elem), (qsort2_cmp)cmp_func, data);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index fc8a20404a3..ad7ff34190a 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -62,7 +62,11 @@
#include <io.h>
#endif
#include "wsrep_mysqld.h"
+#ifdef WITH_WSREP
#include "wsrep_thd.h"
+#include "wsrep_trans_observer.h"
+#endif /* WITH_WSREP */
+
bool
No_such_table_error_handler::handle_condition(THD *,
@@ -306,97 +310,65 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
}
-/*
- Close all tables which aren't in use by any thread
-
- @param thd Thread context
- @param tables List of tables to remove from the cache
- @param wait_for_refresh Wait for a impending flush
- @param timeout Timeout for waiting for flush to be completed.
-
- @note THD can be NULL, but then wait_for_refresh must be FALSE
- and tables must be NULL.
-
- @note When called as part of FLUSH TABLES WITH READ LOCK this function
- ignores metadata locks held by other threads. In order to avoid
- situation when FLUSH TABLES WITH READ LOCK sneaks in at the moment
- when some write-locked table is being reopened (by FLUSH TABLES or
- ALTER TABLE) we have to rely on additional global shared metadata
- lock taken by thread trying to obtain global read lock.
-*/
+/**
+ Close all tables that are not in use in table definition cache
+ @param purge_flag Argument for tc_purge. true if we should force all
+ shares to be deleted. false if it's enough to just
+ evict those that are not in use.
+*/
-struct close_cached_tables_arg
+void purge_tables(bool purge_flag)
{
- tdc_version_t refresh_version;
- TDC_element *element;
-};
-
+ /*
+ Force close of all open tables.
-static my_bool close_cached_tables_callback(TDC_element *element,
- close_cached_tables_arg *arg)
-{
- mysql_mutex_lock(&element->LOCK_table_share);
- if (element->share && element->flushed &&
- element->version < arg->refresh_version)
- {
- /* wait_for_old_version() will unlock mutex and free share */
- arg->element= element;
- return TRUE;
- }
- mysql_mutex_unlock(&element->LOCK_table_share);
- return FALSE;
+ Note that code in TABLE_SHARE::wait_for_old_version() assumes that
+ incrementing of refresh_version is followed by purge of unused table
+ shares.
+ */
+ kill_delayed_threads();
+ /*
+ Get rid of all unused TABLE and TABLE_SHARE instances. By doing
+ this we automatically close all tables which were marked as "old".
+ */
+ tc_purge(purge_flag);
+ /* Free table shares which were not freed implicitly by loop above. */
+ tdc_purge(true);
}
+/**
+ close_cached_tables
+
+ This function has two separate usages:
+ 1) Close not used tables in the table cache to free memory
+ 2) Close a list of tables and wait until they are not used anymore. This
+ is used mainly when preparing a table for export.
+
+ If there are locked tables, they are closed and reopened before
+ function returns. This is done to ensure that table files will be closed
+ by all threads and thus external copyable when FLUSH TABLES returns.
+*/
+
bool close_cached_tables(THD *thd, TABLE_LIST *tables,
bool wait_for_refresh, ulong timeout)
{
- bool result= FALSE;
- struct timespec abstime;
- tdc_version_t refresh_version;
DBUG_ENTER("close_cached_tables");
DBUG_ASSERT(thd || (!wait_for_refresh && !tables));
-
- refresh_version= tdc_increment_refresh_version();
+ DBUG_ASSERT(wait_for_refresh || !tables);
if (!tables)
{
- /*
- Force close of all open tables.
-
- Note that code in TABLE_SHARE::wait_for_old_version() assumes that
- incrementing of refresh_version is followed by purge of unused table
- shares.
- */
- kill_delayed_threads();
- /*
- Get rid of all unused TABLE and TABLE_SHARE instances. By doing
- this we automatically close all tables which were marked as "old".
- */
- tc_purge(true);
- /* Free table shares which were not freed implicitly by loop above. */
- tdc_purge(true);
- }
- else
- {
- bool found=0;
- for (TABLE_LIST *table= tables; table; table= table->next_local)
- {
- /* tdc_remove_table() also sets TABLE_SHARE::version to 0. */
- found|= tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table->db.str,
- table->table_name.str, TRUE);
- }
- if (!found)
- wait_for_refresh=0; // Nothing to wait for
+ /* Free tables that are not used */
+ purge_tables(false);
+ if (!wait_for_refresh)
+ DBUG_RETURN(false);
}
DBUG_PRINT("info", ("open table definitions: %d",
(int) tdc_records()));
- if (!wait_for_refresh)
- DBUG_RETURN(result);
-
if (thd->locked_tables_mode)
{
/*
@@ -407,8 +379,9 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
*/
TABLE_LIST *tables_to_reopen= (tables ? tables :
thd->locked_tables_list.locked_tables());
+ bool result= false;
- /* Close open HANDLER instances to avoid self-deadlock. */
+ /* close open HANDLER for this thread to allow table to be closed */
mysql_ha_flush_tables(thd, tables_to_reopen);
for (TABLE_LIST *table_list= tables_to_reopen; table_list;
@@ -423,63 +396,15 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
if (! table)
continue;
- if (wait_while_table_is_used(thd, table,
- HA_EXTRA_PREPARE_FOR_FORCED_CLOSE))
+ if (thd->mdl_context.upgrade_shared_lock(table->mdl_ticket, MDL_EXCLUSIVE,
+ timeout))
{
- result= TRUE;
- goto err_with_reopen;
- }
- close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL);
- }
- }
-
- /* Wait until all threads have closed all the tables we are flushing. */
- DBUG_PRINT("info", ("Waiting for other threads to close their open tables"));
-
- /*
- To a self-deadlock or deadlocks with other FLUSH threads
- waiting on our open HANDLERs, we have to flush them.
- */
- mysql_ha_flush(thd);
- DEBUG_SYNC(thd, "after_flush_unlock");
-
- if (!tables)
- {
- int r= 0;
- close_cached_tables_arg argument;
- argument.refresh_version= refresh_version;
- set_timespec(abstime, timeout);
-
- while (!thd->killed &&
- (r= tdc_iterate(thd,
- (my_hash_walk_action) close_cached_tables_callback,
- &argument)) == 1 &&
- !argument.element->share->wait_for_old_version(thd, &abstime,
- MDL_wait_for_subgraph::DEADLOCK_WEIGHT_DDL))
- /* no-op */;
-
- if (r)
- result= TRUE;
- }
- else
- {
- for (TABLE_LIST *table= tables; table; table= table->next_local)
- {
- if (thd->killed)
- break;
- if (tdc_wait_for_old_version(thd, table->db.str, table->table_name.str, timeout,
- MDL_wait_for_subgraph::DEADLOCK_WEIGHT_DDL,
- refresh_version))
- {
- result= TRUE;
+ result= true;
break;
}
+ table->file->extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE);
+ close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL);
}
- }
-
-err_with_reopen:
- if (thd->locked_tables_mode)
- {
/*
No other thread has the locked tables open; reopen them and get the
old locks. This should always succeed (unless some external process
@@ -487,6 +412,7 @@ err_with_reopen:
*/
if (thd->locked_tables_list.reopen_tables(thd, false))
result= true;
+
/*
Since downgrade_lock() won't do anything with shared
metadata lock it is much simpler to go through all open tables rather
@@ -494,7 +420,181 @@ err_with_reopen:
*/
for (TABLE *tab= thd->open_tables; tab; tab= tab->next)
tab->mdl_ticket->downgrade_lock(MDL_SHARED_NO_READ_WRITE);
+
+ DBUG_RETURN(result);
}
+ else if (tables)
+ {
+ /*
+ Get an explicit MDL lock for all requested tables to ensure they are
+ not used by any other thread
+ */
+ MDL_request_list mdl_requests;
+
+ DBUG_PRINT("info", ("Waiting for other threads to close their open tables"));
+ DEBUG_SYNC(thd, "after_flush_unlock");
+
+ /* close open HANDLER for this thread to allow table to be closed */
+ mysql_ha_flush_tables(thd, tables);
+
+ for (TABLE_LIST *table= tables; table; table= table->next_local)
+ {
+ MDL_request *mdl_request= new (thd->mem_root) MDL_request;
+ if (mdl_request == NULL)
+ DBUG_RETURN(true);
+ mdl_request->init(&table->mdl_request.key, MDL_EXCLUSIVE, MDL_STATEMENT);
+ mdl_requests.push_front(mdl_request);
+ }
+
+ if (thd->mdl_context.acquire_locks(&mdl_requests, timeout))
+ DBUG_RETURN(true);
+
+ for (TABLE_LIST *table= tables; table; table= table->next_local)
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db.str,
+ table->table_name.str, false);
+ }
+ DBUG_RETURN(false);
+}
+
+
+/**
+ Collect all shares that has open tables
+*/
+
+struct tc_collect_arg
+{
+ DYNAMIC_ARRAY shares;
+ flush_tables_type flush_type;
+};
+
+static my_bool tc_collect_used_shares(TDC_element *element,
+ tc_collect_arg *arg)
+{
+ my_bool result= FALSE;
+
+ DYNAMIC_ARRAY *shares= &arg->shares;
+ mysql_mutex_lock(&element->LOCK_table_share);
+ if (element->ref_count > 0 && !element->share->is_view)
+ {
+ DBUG_ASSERT(element->share);
+ bool do_flush= 0;
+ switch (arg->flush_type) {
+ case FLUSH_ALL:
+ do_flush= 1;
+ break;
+ case FLUSH_NON_TRANS_TABLES:
+ if (!element->share->online_backup &&
+ element->share->table_category == TABLE_CATEGORY_USER)
+ do_flush= 1;
+ break;
+ case FLUSH_SYS_TABLES:
+ if (!element->share->online_backup &&
+ element->share->table_category != TABLE_CATEGORY_USER)
+ do_flush= 1;
+ }
+ if (do_flush)
+ {
+ element->ref_count++; // Protect against delete
+ if (push_dynamic(shares, (uchar*) &element->share))
+ result= TRUE;
+ }
+ }
+ mysql_mutex_unlock(&element->LOCK_table_share);
+ return result;
+}
+
+
+/**
+ Flush cached table as part of global read lock
+
+ @param thd
+ @param flag What type of tables should be flushed
+
+ @return 0 ok
+ @return 1 error
+
+ After we get the list of table shares, we will call flush on all
+ possible tables, even if some flush fails.
+*/
+
+bool flush_tables(THD *thd, flush_tables_type flag)
+{
+ bool result= TRUE;
+ uint open_errors= 0;
+ tc_collect_arg collect_arg;
+ TABLE *tmp_table;
+ DBUG_ENTER("flush_tables");
+
+ purge_tables(false); /* Flush unused tables and shares */
+
+ /*
+ Loop over all shares and collect shares that have open tables
+ TODO:
+ Optimize this to only collect shares that have been used for
+ write after last time all tables was closed.
+ */
+
+ if (!(tmp_table= (TABLE*) my_malloc(sizeof(*tmp_table),
+ MYF(MY_WME | MY_THREAD_SPECIFIC))))
+ DBUG_RETURN(1);
+
+ my_init_dynamic_array(&collect_arg.shares, sizeof(TABLE_SHARE*), 100, 100,
+ MYF(0));
+ collect_arg.flush_type= flag;
+ if (tdc_iterate(thd, (my_hash_walk_action) tc_collect_used_shares,
+ &collect_arg, true))
+ {
+ /* Release already collected shares */
+ for (uint i= 0 ; i < collect_arg.shares.elements ; i++)
+ {
+ TABLE_SHARE *share= *dynamic_element(&collect_arg.shares, i,
+ TABLE_SHARE**);
+ tdc_release_share(share);
+ }
+ goto err;
+ }
+
+ /* Call HA_EXTRA_FLUSH on all found shares */
+ for (uint i= 0 ; i < collect_arg.shares.elements ; i++)
+ {
+ TABLE_SHARE *share= *dynamic_element(&collect_arg.shares, i,
+ TABLE_SHARE**);
+ TABLE *table= tc_acquire_table(thd, share->tdc);
+ if (table)
+ {
+ (void) table->file->extra(HA_EXTRA_FLUSH);
+ tc_release_table(table);
+ }
+ else
+ {
+ /*
+ HA_OPEN_FOR_ALTER is used to allow us to open the table even if
+ TABLE_SHARE::incompatible_version is set.
+ */
+ if (!open_table_from_share(thd, share, &empty_clex_str,
+ HA_OPEN_KEYFILE, 0,
+ HA_OPEN_FOR_ALTER,
+ tmp_table, FALSE,
+ NULL))
+ {
+ (void) tmp_table->file->extra(HA_EXTRA_FLUSH);
+ /*
+ We don't put the table into the TDC as the table was not fully
+ opened (we didn't open triggers)
+ */
+ closefrm(tmp_table);
+ }
+ else
+ open_errors++;
+ }
+ tdc_release_share(share);
+ }
+
+ result= open_errors ? TRUE : FALSE;
+ DBUG_PRINT("note", ("open_errors: %u", open_errors));
+err:
+ my_free(tmp_table);
+ delete_dynamic(&collect_arg.shares);
DBUG_RETURN(result);
}
@@ -552,8 +652,17 @@ end:
}
+/**
+ Close cached connections
+
+ @return false ok
+ @return true If there was an error from closed_cached_connection_tables or
+ if there was any open connections that we had to force closed
+*/
+
bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connection)
{
+ bool res= false;
close_cached_connection_tables_arg argument;
DBUG_ENTER("close_cached_connections");
DBUG_ASSERT(thd);
@@ -567,9 +676,13 @@ bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connection)
&argument))
DBUG_RETURN(true);
- DBUG_RETURN(argument.tables ?
- close_cached_tables(thd, argument.tables, FALSE, LONG_TIMEOUT) :
- false);
+ for (TABLE_LIST *table= argument.tables; table; table= table->next_local)
+ res|= tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table->db.str,
+ table->table_name.str, TRUE);
+
+ /* Return true if we found any open connections */
+ DBUG_RETURN(res);
}
@@ -632,7 +745,7 @@ static void mark_used_tables_as_free_for_reuse(THD *thd, TABLE *table)
- The table is marked as closed in the
locked_table_list but kept there so one can call
locked_table_list->reopen_tables() to put it back.
-
+
In case of drop/rename the documented behavior is to
implicitly remove the table from LOCK TABLES
list.
@@ -1740,59 +1853,6 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
if (! (flags & MYSQL_OPEN_HAS_MDL_LOCK))
{
- /*
- We are not under LOCK TABLES and going to acquire write-lock/
- modify the base table. We need to acquire protection against
- global read lock until end of this statement in order to have
- this statement blocked by active FLUSH TABLES WITH READ LOCK.
-
- We don't need to acquire this protection under LOCK TABLES as
- such protection already acquired at LOCK TABLES time and
- not released until UNLOCK TABLES.
-
- We don't block statements which modify only temporary tables
- as these tables are not preserved by any form of
- backup which uses FLUSH TABLES WITH READ LOCK.
-
- TODO: The fact that we sometimes acquire protection against
- GRL only when we encounter table to be write-locked
- slightly increases probability of deadlock.
- This problem will be solved once Alik pushes his
- temporary table refactoring patch and we can start
- pre-acquiring metadata locks at the beggining of
- open_tables() call.
- */
- if (table_list->mdl_request.is_write_lock_request() &&
- ! (flags & (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
- MYSQL_OPEN_FORCE_SHARED_MDL |
- MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
- MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)) &&
- ! ot_ctx->has_protection_against_grl())
- {
- MDL_request protection_request;
- MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
-
- if (thd->global_read_lock.can_acquire_protection())
- DBUG_RETURN(TRUE);
-
- protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
- MDL_STATEMENT);
-
- /*
- Install error handler which if possible will convert deadlock error
- into request to back-off and restart process of opening tables.
- */
- thd->push_internal_handler(&mdl_deadlock_handler);
- bool result= thd->mdl_context.acquire_lock(&protection_request,
- ot_ctx->get_timeout());
- thd->pop_internal_handler();
-
- if (result)
- DBUG_RETURN(TRUE);
-
- ot_ctx->set_has_protection_against_grl();
- }
-
if (open_table_get_mdl_lock(thd, ot_ctx, &table_list->mdl_request,
flags, &mdl_ticket) ||
mdl_ticket == NULL)
@@ -1891,7 +1951,6 @@ retry_share:
if (mysql_make_view(thd, share, table_list, false))
goto err_lock;
-
/* TODO: Don't free this */
tdc_release_share(share);
@@ -1965,7 +2024,6 @@ retry_share:
else
{
enum open_frm_error error;
-
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
goto err_lock;
@@ -2004,6 +2062,78 @@ retry_share:
tc_add_table(thd, table);
}
+ if (!(flags & MYSQL_OPEN_HAS_MDL_LOCK) &&
+ table->s->table_category < TABLE_CATEGORY_INFORMATION)
+ {
+ /*
+ We are not under LOCK TABLES and going to acquire write-lock/
+ modify the base table. We need to acquire protection against
+ global read lock until end of this statement in order to have
+ this statement blocked by active FLUSH TABLES WITH READ LOCK.
+
+ We don't need to acquire this protection under LOCK TABLES as
+ such protection already acquired at LOCK TABLES time and
+ not released until UNLOCK TABLES.
+
+ We don't block statements which modify only temporary tables
+ as these tables are not preserved by any form of
+ backup which uses FLUSH TABLES WITH READ LOCK.
+
+ TODO: The fact that we sometimes acquire protection against
+ GRL only when we encounter table to be write-locked
+ slightly increases probability of deadlock.
+ This problem will be solved once Alik pushes his
+ temporary table refactoring patch and we can start
+ pre-acquiring metadata locks at the beggining of
+ open_tables() call.
+ */
+ enum enum_mdl_type mdl_type= MDL_BACKUP_DML;
+
+ if (table->s->table_category != TABLE_CATEGORY_USER)
+ mdl_type= MDL_BACKUP_SYS_DML;
+ else if (table->s->online_backup)
+ mdl_type= MDL_BACKUP_TRANS_DML;
+
+ if (table_list->mdl_request.is_write_lock_request() &&
+ ! (flags & (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
+ MYSQL_OPEN_FORCE_SHARED_MDL |
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
+ MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)) &&
+ ! ot_ctx->has_protection_against_grl(mdl_type))
+ {
+ MDL_request protection_request;
+ MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
+
+ if (thd->has_read_only_protection())
+ {
+ MYSQL_UNBIND_TABLE(table->file);
+ tc_release_table(table);
+ DBUG_RETURN(TRUE);
+ }
+
+ protection_request.init(MDL_key::BACKUP, "", "", mdl_type,
+ MDL_STATEMENT);
+
+ /*
+ Install error handler which if possible will convert deadlock error
+ into request to back-off and restart process of opening tables.
+ */
+ thd->push_internal_handler(&mdl_deadlock_handler);
+ bool result= thd->mdl_context.acquire_lock(&protection_request,
+ ot_ctx->get_timeout());
+ thd->pop_internal_handler();
+
+ if (result)
+ {
+ MYSQL_UNBIND_TABLE(table->file);
+ tc_release_table(table);
+ DBUG_RETURN(TRUE);
+ }
+
+ ot_ctx->set_has_protection_against_grl(mdl_type);
+ }
+ }
+
table->mdl_ticket= mdl_ticket;
table->next= thd->open_tables; /* Link into simple list */
@@ -2120,8 +2250,8 @@ TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db,
cases don't take a global IX lock in order to be compatible with
global read lock.
*/
- if (unlikely(!thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE)))
+ if (unlikely(!thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
+ MDL_BACKUP_DDL)))
{
error= ER_TABLE_NOT_LOCKED_FOR_WRITE;
goto err_exit;
@@ -2878,7 +3008,7 @@ Open_table_context::Open_table_context(THD *thd, uint flags)
m_flags(flags),
m_action(OT_NO_ACTION),
m_has_locks(thd->mdl_context.has_locks()),
- m_has_protection_against_grl(FALSE)
+ m_has_protection_against_grl(0)
{}
@@ -3094,7 +3224,7 @@ Open_table_context::recover_from_failed_open()
against GRL. It is no longer valid as the corresponding lock was
released by close_tables_for_reopen().
*/
- m_has_protection_against_grl= FALSE;
+ m_has_protection_against_grl= 0;
/* Prepare for possible another back-off. */
m_action= OT_NO_ACTION;
return result;
@@ -3757,6 +3887,40 @@ end:
}
+static bool upgrade_lock_if_not_exists(THD *thd,
+ const DDL_options_st &create_info,
+ TABLE_LIST *create_table,
+ ulong lock_wait_timeout)
+{
+ DBUG_ENTER("upgrade_lock_if_not_exists");
+
+ if (thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
+ thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE)
+ {
+ DEBUG_SYNC(thd,"create_table_before_check_if_exists");
+ if (!create_info.or_replace() &&
+ ha_table_exists(thd, &create_table->db, &create_table->table_name))
+ {
+ if (create_info.if_not_exists())
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR,
+ ER_THD(thd, ER_TABLE_EXISTS_ERROR),
+ create_table->table_name.str);
+ }
+ else
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->table_name.str);
+ DBUG_RETURN(true);
+ }
+ DBUG_RETURN(thd->mdl_context.upgrade_shared_lock(
+ create_table->mdl_request.ticket,
+ MDL_EXCLUSIVE,
+ lock_wait_timeout));
+ }
+ DBUG_RETURN(false);
+}
+
+
/**
Acquire upgradable (SNW, SNRW) metadata locks on tables used by
LOCK TABLES or by a DDL statement. Under LOCK TABLES, we can't take
@@ -3794,10 +3958,7 @@ lock_table_names(THD *thd, const DDL_options_st &options,
MDL_request_list mdl_requests;
TABLE_LIST *table;
MDL_request global_request;
- ulong org_lock_wait_timeout= lock_wait_timeout;
- /* Check if we are using CREATE TABLE ... IF NOT EXISTS */
- bool create_table;
- Dummy_error_handler error_handler;
+ MDL_savepoint mdl_savepoint;
DBUG_ENTER("lock_table_names");
DBUG_ASSERT(!thd->locked_tables_mode);
@@ -3805,6 +3966,8 @@ lock_table_names(THD *thd, const DDL_options_st &options,
for (table= tables_start; table && table != tables_end;
table= table->next_global)
{
+ DBUG_PRINT("info", ("mdl_request.type: %d open_type: %d",
+ table->mdl_request.type, table->open_type));
if (table->mdl_request.type < MDL_SHARED_UPGRADABLE ||
table->mdl_request.type == MDL_SHARED_READ_ONLY ||
table->open_type == OT_TEMPORARY_ONLY ||
@@ -3838,73 +4001,48 @@ lock_table_names(THD *thd, const DDL_options_st &options,
if (mdl_requests.is_empty())
DBUG_RETURN(FALSE);
- /* Check if CREATE TABLE without REPLACE was used */
- create_table= ((thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
- thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE) &&
- !options.or_replace());
-
- if (!(flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK))
+ if (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)
{
- /*
- Protect this statement against concurrent global read lock
- by acquiring global intention exclusive lock with statement
- duration.
- */
- if (thd->global_read_lock.can_acquire_protection())
- DBUG_RETURN(TRUE);
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
- MDL_STATEMENT);
- mdl_requests.push_front(&global_request);
-
- if (create_table)
-#ifdef WITH_WSREP
- if (thd->lex->sql_command != SQLCOM_CREATE_TABLE &&
- thd->wsrep_exec_mode != REPL_RECV)
-#endif
- lock_wait_timeout= 0; // Don't wait for timeout
+ DBUG_RETURN(thd->mdl_context.acquire_locks(&mdl_requests,
+ lock_wait_timeout) ||
+ upgrade_lock_if_not_exists(thd, options, tables_start,
+ lock_wait_timeout));
}
- for (;;)
- {
- if (create_table)
- thd->push_internal_handler(&error_handler); // Avoid warnings & errors
- bool res= thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout);
- if (create_table)
- thd->pop_internal_handler();
- if (!res)
- DBUG_RETURN(FALSE); // Got locks
+ /* Protect this statement against concurrent BACKUP STAGE or FTWRL. */
+ if (thd->has_read_only_protection())
+ DBUG_RETURN(true);
- if (!create_table)
- DBUG_RETURN(TRUE); // Return original error
+ global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT);
+ mdl_savepoint= thd->mdl_context.mdl_savepoint();
- /*
- We come here in the case of lock timeout when executing CREATE TABLE.
- Verify that table does exist (it usually does, as we got a lock conflict)
- */
- if (ha_table_exists(thd, &tables_start->db, &tables_start->table_name))
+ while (!thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout) &&
+ !upgrade_lock_if_not_exists(thd, options, tables_start,
+ lock_wait_timeout) &&
+ !thd->mdl_context.try_acquire_lock(&global_request))
+ {
+ if (global_request.ticket)
{
- if (options.if_not_exists())
- {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_TABLE_EXISTS_ERROR,
- ER_THD(thd, ER_TABLE_EXISTS_ERROR),
- tables_start->table_name.str);
- }
- else
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), tables_start->table_name.str);
- DBUG_RETURN(TRUE);
+ thd->mdl_backup_ticket= global_request.ticket;
+ DBUG_RETURN(false);
}
+
/*
- We got error from acquire_locks, but the table didn't exists.
- This could happen if another connection runs a statement
- involving this non-existent table, and this statement took the mdl,
- but didn't error out with ER_NO_SUCH_TABLE yet (yes, a race condition).
- We play safe and restart the original acquire_locks with the
- original timeout.
+ There is ongoing or pending BACKUP STAGE or FTWRL.
+ Wait until it finishes and re-try.
*/
- create_table= 0;
- lock_wait_timeout= org_lock_wait_timeout;
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+ if (thd->mdl_context.acquire_lock(&global_request, lock_wait_timeout))
+ break;
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+
+ /* Reset tickets for all acquired locks */
+ global_request.ticket= 0;
+ MDL_request_list::Iterator it(mdl_requests);
+ while (auto mdl_request= it++)
+ mdl_request->ticket= 0;
}
+ DBUG_RETURN(true);
}
@@ -4276,13 +4414,14 @@ restart:
}
}
+#ifdef WITH_WSREP
if (WSREP_ON &&
wsrep_replicate_myisam &&
(*start) &&
(*start)->table &&
(*start)->table->file->ht == myisam_hton &&
- wsrep_thd_exec_mode(thd) == LOCAL_STATE &&
- !is_stat_table(&(*start)->db, &(*start)->alias) &&
+ wsrep_thd_is_local(thd) &&
+ !is_stat_table(&(*start)->db, &(*start)->alias) &&
thd->get_command() != COM_STMT_PREPARE &&
((thd->lex->sql_command == SQLCOM_INSERT ||
thd->lex->sql_command == SQLCOM_INSERT_SELECT ||
@@ -4293,8 +4432,12 @@ restart:
thd->lex->sql_command == SQLCOM_LOAD ||
thd->lex->sql_command == SQLCOM_DELETE)))
{
- WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start));
+ wsrep_before_rollback(thd, true);
+ wsrep_after_rollback(thd, true);
+ wsrep_after_statement(thd);
+ WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start));
}
+#endif /* WITH_WSREP */
error:
#ifdef WITH_WSREP
@@ -5221,8 +5364,7 @@ err:
@retval TRUE A lock wait timeout, deadlock or out of memory.
*/
-bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
- uint flags)
+bool lock_tables(THD *thd, TABLE_LIST *tables, uint count, uint flags)
{
TABLE_LIST *table;
DBUG_ENTER("lock_tables");
@@ -8784,7 +8926,6 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
{
Query_tables_list query_tables_list_backup;
LEX *lex= thd->lex;
-
DBUG_ENTER("open_system_tables_for_read");
/*
@@ -8798,9 +8939,15 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
thd->reset_n_backup_open_tables_state(backup);
thd->lex->sql_command= SQLCOM_SELECT;
+ /*
+ Only use MYSQL_LOCK_IGNORE_TIMEOUT for tables opened for read.
+ This is to ensure that lock_wait_timeout is honored when trying
+ to update stats tables.
+ */
if (open_and_lock_tables(thd, table_list, FALSE,
- MYSQL_OPEN_IGNORE_FLUSH |
- MYSQL_LOCK_IGNORE_TIMEOUT))
+ (MYSQL_OPEN_IGNORE_FLUSH |
+ (table_list->lock_type < TL_WRITE_ALLOW_WRITE ?
+ MYSQL_LOCK_IGNORE_TIMEOUT : 0))))
{
lex->restore_backup_query_tables_list(&query_tables_list_backup);
thd->restore_backup_open_tables_state(backup);
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 0ebed4159ab..2b245217bce 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -57,6 +57,13 @@ enum enum_resolution_type {
RESOLVED_AGAINST_ALIAS
};
+/* Argument to flush_tables() of what to flush */
+enum flush_tables_type {
+ FLUSH_ALL,
+ FLUSH_NON_TRANS_TABLES,
+ FLUSH_SYS_TABLES
+};
+
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
IGNORE_EXCEPT_NON_UNIQUE};
@@ -288,12 +295,10 @@ TABLE *open_system_table_for_update(THD *thd, TABLE_LIST *one_table);
TABLE *open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup);
void close_log_table(THD *thd, Open_tables_backup *backup);
-TABLE *open_performance_schema_table(THD *thd, TABLE_LIST *one_table,
- Open_tables_state *backup);
-void close_performance_schema_table(THD *thd, Open_tables_state *backup);
-
bool close_cached_tables(THD *thd, TABLE_LIST *tables,
bool wait_for_refresh, ulong timeout);
+void purge_tables(bool purge_flag);
+bool flush_tables(THD *thd, flush_tables_type flag);
bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connect_string);
void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
ha_extra_function extra,
@@ -554,14 +559,14 @@ public:
Set flag indicating that we have already acquired metadata lock
protecting this statement against GRL while opening tables.
*/
- void set_has_protection_against_grl()
+ void set_has_protection_against_grl(enum_mdl_type mdl_type)
{
- m_has_protection_against_grl= TRUE;
+ m_has_protection_against_grl|= MDL_BIT(mdl_type);
}
- bool has_protection_against_grl() const
+ bool has_protection_against_grl(enum_mdl_type mdl_type) const
{
- return m_has_protection_against_grl;
+ return (bool) (m_has_protection_against_grl & MDL_BIT(mdl_type));
}
private:
@@ -593,7 +598,7 @@ private:
Indicates that in the process of opening tables we have acquired
protection against global read lock.
*/
- bool m_has_protection_against_grl;
+ mdl_bitmap_t m_has_protection_against_grl;
};
diff --git a/sql/sql_basic_types.h b/sql/sql_basic_types.h
index 362ab0f1259..a790b68fc0c 100644
--- a/sql/sql_basic_types.h
+++ b/sql/sql_basic_types.h
@@ -26,26 +26,50 @@ typedef int64 query_id_t;
/*
"fuzzydate" with strict data type control.
+ Represents a mixture of *only* data type conversion flags, without rounding.
Please keep "explicit" in constructors and conversion methods.
*/
-class date_mode_t
+class date_conv_mode_t
{
public:
enum value_t
{
- FUZZY_DATES= 1U, // C_TIME_FUZZY_DATES
- TIME_ONLY= 4U, // C_TIME_TIME_ONLY
- NO_ZERO_IN_DATE= (1UL << 23), // MODE_NO_ZERO_IN_DATE
- NO_ZERO_DATE= (1UL << 24), // MODE_NO_ZERO_DATE
- INVALID_DATES= (1UL << 25) // MODE_INVALID_DATES
+ CONV_NONE= 0U,
+ /*
+ FUZZY_DATES is used for the result will only be used for comparison
+ purposes. Conversion is as relaxed as possible.
+ */
+ FUZZY_DATES= 1U,
+ TIME_ONLY= 4U,
+ INTERVAL_hhmmssff= 8U,
+ INTERVAL_DAY= 16U,
+ RANGE0_LAST= INTERVAL_DAY,
+ NO_ZERO_IN_DATE= (1UL << 23), // MODE_NO_ZERO_IN_DATE
+ NO_ZERO_DATE= (1UL << 24), // MODE_NO_ZERO_DATE
+ INVALID_DATES= (1UL << 25) // MODE_INVALID_DATES
};
+ /*
+ BIT-OR for all known values. Let's have a separate enum for it.
+ - We don't put this value "value_t", to avoid handling it in switch().
+ - We don't put this value as a static const inside the class,
+ because "gdb" would display it every time when we do "print"
+ for a time_round_mode_t value.
+ - We can't put into into a function returning this value, because
+ it's not allowed to use functions in static_assert.
+ */
+ enum known_values_t
+ {
+ KNOWN_MODES= FUZZY_DATES |
+ TIME_ONLY | INTERVAL_hhmmssff | INTERVAL_DAY |
+ NO_ZERO_IN_DATE | NO_ZERO_DATE | INVALID_DATES
+ };
private:
value_t m_mode;
public:
// Constructors
- explicit date_mode_t(ulonglong fuzzydate)
+ explicit date_conv_mode_t(ulonglong fuzzydate)
:m_mode((value_t) fuzzydate)
{ }
@@ -60,9 +84,148 @@ public:
}
// Unary operators
- date_mode_t operator~() const
+ ulonglong operator~() const
{
- return date_mode_t(~m_mode);
+ return ~m_mode;
+ }
+
+ // Dyadic bitwise operators
+ date_conv_mode_t operator&(const date_conv_mode_t &other) const
+ {
+ return date_conv_mode_t(m_mode & other.m_mode);
+ }
+ date_conv_mode_t operator&(const ulonglong other) const
+ {
+ return date_conv_mode_t(m_mode & other);
+ }
+
+ date_conv_mode_t operator|(const date_conv_mode_t &other) const
+ {
+ return date_conv_mode_t(m_mode | other.m_mode);
+ }
+
+ // Dyadic bitwise assignment operators
+ date_conv_mode_t &operator&=(const date_conv_mode_t &other)
+ {
+ m_mode= value_t(m_mode & other.m_mode);
+ return *this;
+ }
+
+ date_conv_mode_t &operator|=(const date_conv_mode_t &other)
+ {
+ m_mode= value_t(m_mode | other.m_mode);
+ return *this;
+ }
+};
+
+
+/*
+ Fractional rounding mode for temporal data types.
+*/
+class time_round_mode_t
+{
+public:
+ enum value_t
+ {
+ /*
+ Use FRAC_NONE when the value needs no rounding nor truncation,
+ because it is already known not to haveany fractional digits outside
+ of the requested precision.
+ */
+ FRAC_NONE= 0,
+ FRAC_TRUNCATE= date_conv_mode_t::RANGE0_LAST << 1, // 32
+ FRAC_ROUND= date_conv_mode_t::RANGE0_LAST << 2 // 64
+ };
+ // BIT-OR for all known values. See comments in time_conv_mode_t.
+ enum known_values_t
+ {
+ KNOWN_MODES= FRAC_TRUNCATE | FRAC_ROUND
+ };
+private:
+ value_t m_mode;
+public:
+ // Constructors
+ explicit time_round_mode_t(ulonglong mode)
+ :m_mode((value_t) mode)
+ {
+ DBUG_ASSERT(mode == FRAC_NONE ||
+ mode == FRAC_TRUNCATE ||
+ mode == FRAC_ROUND);
+ }
+ // Conversion operators
+ explicit operator ulonglong() const
+ {
+ return m_mode;
+ }
+ value_t mode() const
+ {
+ return m_mode;
+ }
+ // Comparison operators
+ bool operator==(const time_round_mode_t &other)
+ {
+ return m_mode == other.m_mode;
+ }
+};
+
+
+/*
+ "fuzzydate" with strict data type control.
+ Used as a parameter to get_date() and represents a mixture of:
+ - data type conversion flags
+ - fractional second rounding flags
+ Please keep "explicit" in constructors and conversion methods.
+*/
+class date_mode_t
+{
+public:
+ enum value_t
+ {
+ CONV_NONE= date_conv_mode_t::CONV_NONE, // 0
+ FUZZY_DATES= date_conv_mode_t::FUZZY_DATES, // 1
+ TIME_ONLY= date_conv_mode_t::TIME_ONLY, // 4
+ INTERVAL_hhmmssff= date_conv_mode_t::INTERVAL_hhmmssff, // 8
+ INTERVAL_DAY= date_conv_mode_t::INTERVAL_DAY, // 16
+ FRAC_TRUNCATE= time_round_mode_t::FRAC_TRUNCATE, // 32
+ FRAC_ROUND= time_round_mode_t::FRAC_ROUND, // 64
+ NO_ZERO_IN_DATE= date_conv_mode_t::NO_ZERO_IN_DATE, // (1UL << 23)
+ NO_ZERO_DATE= date_conv_mode_t::NO_ZERO_DATE, // (1UL << 24)
+ INVALID_DATES= date_conv_mode_t::INVALID_DATES, // (1UL << 25)
+ };
+protected:
+ value_t m_mode;
+public:
+
+ // Constructors
+ explicit date_mode_t(ulonglong fuzzydate)
+ :m_mode((value_t) fuzzydate)
+ { }
+
+ // Conversion operators
+ explicit operator ulonglong() const
+ {
+ return m_mode;
+ }
+ explicit operator bool() const
+ {
+ return m_mode != 0;
+ }
+ explicit operator date_conv_mode_t() const
+ {
+ return date_conv_mode_t(ulonglong(m_mode) & date_conv_mode_t::KNOWN_MODES);
+ }
+ explicit operator time_round_mode_t() const
+ {
+ return time_round_mode_t(ulonglong(m_mode) & time_round_mode_t::KNOWN_MODES);
+ }
+ // Unary operators
+ ulonglong operator~() const
+ {
+ return ~m_mode;
+ }
+ bool operator!() const
+ {
+ return !m_mode;
}
// Dyadic bitwise operators
@@ -70,6 +233,10 @@ public:
{
return date_mode_t(m_mode & other.m_mode);
}
+ date_mode_t operator&(ulonglong other) const
+ {
+ return date_mode_t(m_mode & other);
+ }
date_mode_t operator|(const date_mode_t &other) const
{
@@ -88,21 +255,81 @@ public:
m_mode= value_t(m_mode | other.m_mode);
return *this;
}
+
+ date_mode_t &operator|=(const date_conv_mode_t &other)
+ {
+ m_mode= value_t(m_mode | ulonglong(other));
+ return *this;
+ }
};
-const date_mode_t
- TIME_FUZZY_DATES (date_mode_t::value_t::FUZZY_DATES),
- TIME_TIME_ONLY (date_mode_t::value_t::TIME_ONLY),
- TIME_NO_ZERO_IN_DATE (date_mode_t::value_t::NO_ZERO_IN_DATE),
- TIME_NO_ZERO_DATE (date_mode_t::value_t::NO_ZERO_DATE),
- TIME_INVALID_DATES (date_mode_t::value_t::INVALID_DATES);
+// Bitwise OR out-of-class operators for data type mixtures
+static inline date_mode_t operator|(const date_mode_t &a,
+ const date_conv_mode_t &b)
+{
+ return date_mode_t(ulonglong(a) | ulonglong(b));
+}
+
+static inline date_mode_t operator|(const date_conv_mode_t &a,
+ const time_round_mode_t &b)
+{
+ return date_mode_t(ulonglong(a) | ulonglong(b));
+}
+
+
+static inline date_mode_t operator|(const date_conv_mode_t &a,
+ const date_mode_t &b)
+{
+ return date_mode_t(ulonglong(a) | ulonglong(b));
+}
+
+
+// Bitwise AND out-of-class operators for data type mixtures
+static inline date_conv_mode_t operator&(const date_mode_t &a,
+ const date_conv_mode_t &b)
+{
+ return date_conv_mode_t(ulonglong(a) & ulonglong(b));
+}
+
+static inline date_conv_mode_t operator&(const date_conv_mode_t &a,
+ const date_mode_t &b)
+{
+ return date_conv_mode_t(ulonglong(a) & ulonglong(b));
+}
+
+static inline date_conv_mode_t operator&(sql_mode_t &a,
+ const date_conv_mode_t &b)
+{
+ return date_conv_mode_t(a & ulonglong(b));
+}
+
+
+static const date_conv_mode_t
+ TIME_CONV_NONE (date_conv_mode_t::CONV_NONE),
+ TIME_FUZZY_DATES (date_conv_mode_t::FUZZY_DATES),
+ TIME_TIME_ONLY (date_conv_mode_t::TIME_ONLY),
+ TIME_INTERVAL_hhmmssff (date_conv_mode_t::INTERVAL_hhmmssff),
+ TIME_INTERVAL_DAY (date_conv_mode_t::INTERVAL_DAY),
+ TIME_NO_ZERO_IN_DATE (date_conv_mode_t::NO_ZERO_IN_DATE),
+ TIME_NO_ZERO_DATE (date_conv_mode_t::NO_ZERO_DATE),
+ TIME_INVALID_DATES (date_conv_mode_t::INVALID_DATES);
-// Flags understood by str_to_datetime, str_to_time, number_to_time, check_date
-static const date_mode_t
+// An often used combination
+static const date_conv_mode_t
+ TIME_NO_ZEROS (date_conv_mode_t::NO_ZERO_DATE|
+ date_conv_mode_t::NO_ZERO_IN_DATE);
+
+// Flags understood by str_to_xxx, number_to_xxx, check_date
+static const date_conv_mode_t
TIME_MODE_FOR_XXX_TO_DATE (date_mode_t::NO_ZERO_IN_DATE |
date_mode_t::NO_ZERO_DATE |
- date_mode_t::INVALID_DATES |
- date_mode_t::TIME_ONLY);
+ date_mode_t::INVALID_DATES);
+
+static const time_round_mode_t
+ TIME_FRAC_NONE (time_round_mode_t::FRAC_NONE),
+ TIME_FRAC_TRUNCATE (time_round_mode_t::FRAC_TRUNCATE),
+ TIME_FRAC_ROUND (time_round_mode_t::FRAC_ROUND);
+
#endif
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 44211fca506..73bb4d7b7f7 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -276,8 +276,8 @@ functions:
- Called before parsing and used to match a statement with the stored
queries hash.
If a match is found the cached result set is sent through repeated
- calls to net_real_write. (note: calling thread doesn't have a regis-
- tered result set writer: thd->net.query_cache_query=0)
+ calls to net_real_write. (note: calling thread does not have a
+ registered result set writer: thd->net.query_cache_query=0)
2. Query_cache::store_query
- Called just before handle_select() and is used to register a result
set writer to the statement currently being processed
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index eae7d988772..e6453415475 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB Corporation.
+ Copyright (c) 2008, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -66,9 +66,11 @@
#include "sql_callback.h"
#include "lock.h"
#include "wsrep_mysqld.h"
-#include "wsrep_thd.h"
#include "sql_connect.h"
-#include "my_atomic.h"
+#ifdef WITH_WSREP
+#include "wsrep_thd.h"
+#include "wsrep_trans_observer.h"
+#endif /* WITH_WSREP */
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
@@ -640,16 +642,42 @@ THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
xid_hash_pins(0),
m_tmp_tables_locked(false)
#ifdef WITH_WSREP
- ,
+ ,
wsrep_applier(is_wsrep_applier),
wsrep_applier_closing(false),
wsrep_client_thread(false),
- wsrep_apply_toi(false),
+ wsrep_retry_counter(0),
+ wsrep_PA_safe(true),
+ wsrep_retry_query(NULL),
+ wsrep_retry_query_len(0),
+ wsrep_retry_command(COM_CONNECT),
+ wsrep_consistency_check(NO_CONSISTENCY_CHECK),
+ wsrep_mysql_replicated(0),
+ wsrep_TOI_pre_query(NULL),
+ wsrep_TOI_pre_query_len(0),
wsrep_po_handle(WSREP_PO_INITIALIZER),
wsrep_po_cnt(0),
wsrep_apply_format(0),
- wsrep_ignore_table(false)
-#endif
+ wsrep_apply_toi(false),
+ wsrep_rbr_buf(NULL),
+ wsrep_sync_wait_gtid(WSREP_GTID_UNDEFINED),
+ wsrep_affected_rows(0),
+ wsrep_has_ignored_error(false),
+ wsrep_replicate_GTID(false),
+ wsrep_ignore_table(false),
+
+/* wsrep-lib */
+ m_wsrep_next_trx_id(WSREP_UNDEFINED_TRX_ID),
+ m_wsrep_mutex(LOCK_thd_data),
+ m_wsrep_cond(COND_wsrep_thd),
+ m_wsrep_client_service(this, m_wsrep_client_state),
+ m_wsrep_client_state(this,
+ m_wsrep_mutex,
+ m_wsrep_cond,
+ Wsrep_server_state::instance(),
+ m_wsrep_client_service,
+ wsrep::client_id(thread_id))
+#endif /*WITH_WSREP */
{
ulong tmp;
bzero(&variables, sizeof(variables));
@@ -668,6 +696,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
main_da.init();
mdl_context.init(this);
+ mdl_backup_lock= 0;
/*
Pass nominal parameters to init_alloc_root only to ensure that
@@ -757,11 +786,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
mysql_mutex_init(key_LOCK_wakeup_ready, &LOCK_wakeup_ready, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_thd_kill, &LOCK_thd_kill, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_wakeup_ready, &COND_wakeup_ready, 0);
- /*
- LOCK_thread_count goes before LOCK_thd_data - the former is called around
- 'delete thd', the latter - in THD::~THD
- */
- mysql_mutex_record_order(&LOCK_thread_count, &LOCK_thd_data);
/* Variables with default values */
proc_info="login";
@@ -771,22 +795,8 @@ THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
*scramble= '\0';
#ifdef WITH_WSREP
- wsrep_ws_handle.trx_id = WSREP_UNDEFINED_TRX_ID;
- wsrep_ws_handle.opaque = NULL;
- wsrep_retry_counter = 0;
- wsrep_PA_safe = true;
- wsrep_retry_query = NULL;
- wsrep_retry_query_len = 0;
- wsrep_retry_command = COM_CONNECT;
- wsrep_consistency_check = NO_CONSISTENCY_CHECK;
- wsrep_mysql_replicated = 0;
- wsrep_TOI_pre_query = NULL;
- wsrep_TOI_pre_query_len = 0;
+ mysql_cond_init(key_COND_wsrep_thd, &COND_wsrep_thd, NULL);
wsrep_info[sizeof(wsrep_info) - 1] = '\0'; /* make sure it is 0-terminated */
- wsrep_sync_wait_gtid = WSREP_GTID_UNDEFINED;
- wsrep_affected_rows = 0;
- wsrep_replicate_GTID = false;
- wsrep_skip_wsrep_GTID = false;
#endif
/* Call to init() below requires fully initialized Open_tables_state. */
reset_open_tables_state(this);
@@ -849,7 +859,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
save_prep_leaf_list= FALSE;
/* Restore THR_THD */
set_current_thd(old_THR_THD);
- inc_thread_count();
}
@@ -1049,10 +1058,25 @@ Sql_condition* THD::raise_condition(uint sql_errno,
is_slave_error= 1; // needed to catch query errors during replication
- if (!da->is_error())
+#ifdef WITH_WSREP
+ /*
+ With wsrep we allow converting BF abort error to warning if
+ errors are ignored.
+ */
+ if (!is_fatal_error &&
+ no_errors &&
+ (wsrep_trx().bf_aborted() || wsrep_retry_counter))
{
- set_row_count_func(-1);
- da->set_error_status(sql_errno, msg, sqlstate, ucid, cond);
+ WSREP_DEBUG("BF abort error converted to warning");
+ }
+ else
+#endif /* WITH_WSREP */
+ {
+ if (!da->is_error())
+ {
+ set_row_count_func(-1);
+ da->set_error_status(sql_errno, msg, sqlstate, ucid, cond);
+ }
}
}
@@ -1113,6 +1137,13 @@ void *thd_memdup(MYSQL_THD thd, const void* str, size_t size)
extern "C"
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid)
{
+#ifdef WITH_WSREP
+ if (!thd->wsrep_xid.is_null())
+ {
+ *xid = *(MYSQL_XID *) &thd->wsrep_xid;
+ }
+ else
+#endif /* WITH_WSREP */
*xid = *(MYSQL_XID *) &thd->transaction.xid_state.xid;
}
@@ -1219,13 +1250,11 @@ void THD::init(bool skip_lock)
first_successful_insert_id_in_prev_stmt= 0;
first_successful_insert_id_in_prev_stmt_for_binlog= 0;
first_successful_insert_id_in_cur_stmt= 0;
+ current_backup_stage= BACKUP_FINISHED;
#ifdef WITH_WSREP
- wsrep_exec_mode= wsrep_applier ? REPL_RECV : LOCAL_STATE;
- wsrep_conflict_state= NO_CONFLICT;
- wsrep_query_state= QUERY_IDLE;
wsrep_last_query_id= 0;
- wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
- wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
+ wsrep_xid.null();
+ wsrep_skip_locking= FALSE;
wsrep_converted_lock_session= false;
wsrep_retry_counter= 0;
wsrep_rgi= NULL;
@@ -1234,10 +1263,10 @@ void THD::init(bool skip_lock)
wsrep_mysql_replicated = 0;
wsrep_TOI_pre_query = NULL;
wsrep_TOI_pre_query_len = 0;
- wsrep_sync_wait_gtid = WSREP_GTID_UNDEFINED;
+ wsrep_rbr_buf = NULL;
wsrep_affected_rows = 0;
+ m_wsrep_next_trx_id = WSREP_UNDEFINED_TRX_ID;
wsrep_replicate_GTID = false;
- wsrep_skip_wsrep_GTID = false;
#endif /* WITH_WSREP */
if (variables.sql_log_bin)
@@ -1466,6 +1495,13 @@ void THD::cleanup(void)
#error xid_state in the cache should be replaced by the allocated value
}
#endif
+#ifdef WITH_WSREP
+ if (wsrep_cs().state() != wsrep::client_state::s_none)
+ {
+ wsrep_cs().cleanup();
+ }
+ wsrep_client_thread= false;
+#endif /* WITH_WSREP */
mysql_ha_cleanup(this);
locked_tables_list.unlock_locked_tables(this);
@@ -1487,6 +1523,9 @@ void THD::cleanup(void)
*/
mdl_context.release_transactional_locks();
+ backup_end(this);
+ backup_unlock(this);
+
/* Release the global read lock, if acquired. */
if (global_read_lock.is_acquired())
global_read_lock.unlock_global_read_lock(this);
@@ -1513,6 +1552,7 @@ void THD::cleanup(void)
auto_inc_intervals_in_cur_stmt_for_binlog.empty();
mysql_ull_cleanup(this);
+ stmt_map.reset();
/* All metadata locks must have been released by now. */
DBUG_ASSERT(!mdl_context.has_locks());
@@ -1582,6 +1622,9 @@ void THD::reset_for_reuse()
#ifdef SIGNAL_WITH_VIO_CLOSE
active_vio = 0;
#endif
+#ifdef WITH_WSREP
+ wsrep_free_status(this);
+#endif /* WITH_WSREP */
}
@@ -1590,10 +1633,8 @@ THD::~THD()
THD *orig_thd= current_thd;
THD_CHECK_SENTRY(this);
DBUG_ENTER("~THD()");
- /* Check that we have already called thd->unlink() */
- DBUG_ASSERT(prev == 0 && next == 0);
- /* This takes a long time so we should not do this under LOCK_thread_count */
- mysql_mutex_assert_not_owner(&LOCK_thread_count);
+ /* Make sure threads are not available via server_threads. */
+ assert_not_linked();
/*
In error cases, thd may not be current thd. We have to fix this so
@@ -1608,15 +1649,21 @@ THD::~THD()
THD is not deleted while they access it. The following mutex_lock
ensures that no one else is using this THD and it's now safe to delete
*/
+ if (WSREP(this)) mysql_mutex_lock(&LOCK_thd_data);
mysql_mutex_lock(&LOCK_thd_kill);
mysql_mutex_unlock(&LOCK_thd_kill);
+ if (WSREP(this)) mysql_mutex_unlock(&LOCK_thd_data);
-#ifdef WITH_WSREP
- delete wsrep_rgi;
-#endif
if (!free_connection_done)
free_connection();
+#ifdef WITH_WSREP
+ if (wsrep_rgi != NULL) {
+ delete wsrep_rgi;
+ wsrep_rgi = NULL;
+ }
+ mysql_cond_destroy(&COND_wsrep_thd);
+#endif
mdl_context.destroy();
free_root(&transaction.mem_root,MYF(0));
@@ -1668,7 +1715,6 @@ THD::~THD()
}
update_global_memory_status(status_var.global_memory_used);
set_current_thd(orig_thd == this ? 0 : orig_thd);
- dec_thread_count();
DBUG_VOID_RETURN;
}
@@ -1798,6 +1844,7 @@ void THD::awake_no_mutex(killed_state state_to_set)
DBUG_PRINT("enter", ("this: %p current_thd: %p state: %d",
this, current_thd, (int) state_to_set));
THD_CHECK_SENTRY(this);
+ if (WSREP(this)) mysql_mutex_assert_owner(&LOCK_thd_data);
mysql_mutex_assert_owner(&LOCK_thd_kill);
print_aborted_warning(3, "KILLED");
@@ -1830,7 +1877,8 @@ void THD::awake_no_mutex(killed_state state_to_set)
}
/* Interrupt target waiting inside a storage engine. */
- if (state_to_set != NOT_KILLED)
+ if (IF_WSREP(state_to_set != NOT_KILLED && !wsrep_is_bf_aborted(this),
+ state_to_set != NOT_KILLED))
ha_kill_query(this, thd_kill_level(this));
/* Broadcast a condition to kick the target if it is waiting on it. */
@@ -1983,12 +2031,6 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
if (!thd_table->needs_reopen())
{
signalled|= mysql_lock_abort_for_thread(this, thd_table);
- if (WSREP(this) && wsrep_thd_is_BF(this, FALSE))
- {
- WSREP_DEBUG("remove_table_from_cache: %llu",
- (unsigned long long) this->real_id);
- wsrep_abort_thd((void *)this, (void *)in_use, FALSE);
- }
}
}
}
@@ -2220,12 +2262,6 @@ void THD::cleanup_after_query()
/* reset table map for multi-table update */
table_map_for_update= 0;
m_binlog_invoker= INVOKER_NONE;
-#ifdef WITH_WSREP
- if (TOTAL_ORDER == wsrep_exec_mode)
- {
- wsrep_exec_mode = LOCAL_STATE;
- }
-#endif /* WITH_WSREP */
#ifndef EMBEDDED_LIBRARY
if (rgi_slave)
@@ -2233,7 +2269,6 @@ void THD::cleanup_after_query()
#endif
#ifdef WITH_WSREP
- wsrep_sync_wait_gtid= WSREP_GTID_UNDEFINED;
if (!in_active_multi_stmt_transaction())
wsrep_affected_rows= 0;
#endif /* WITH_WSREP */
@@ -2494,6 +2529,16 @@ void THD::update_charset()
&not_used);
}
+void THD::give_protection_error()
+{
+ if (current_backup_stage != BACKUP_FINISHED)
+ my_error(ER_BACKUP_LOCK_IS_ACTIVE, MYF(0));
+ else
+ {
+ DBUG_ASSERT(global_read_lock.is_acquired());
+ my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
+ }
+}
/* routings to adding tables to list of changed in transaction tables */
@@ -3238,6 +3283,10 @@ int select_export::send_data(List<Item> &items)
error_pos= copier.most_important_error_pos();
if (unlikely(error_pos))
{
+ /*
+ TODO:
+ add new error message that will show user this printable_buff
+
char printable_buff[32];
convert_to_printable(printable_buff, sizeof(printable_buff),
error_pos, res->ptr() + res->length() - error_pos,
@@ -3247,6 +3296,11 @@ int select_export::send_data(List<Item> &items)
ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", printable_buff,
item->name.str, static_cast<long>(row_count));
+ */
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
+ ER_THD(thd, WARN_DATA_TRUNCATED),
+ item->name.str, static_cast<long>(row_count));
}
else if (copier.source_end_pos() < res->ptr() + res->length())
{
@@ -3971,11 +4025,13 @@ void Statement_map::erase(Statement *statement)
void Statement_map::reset()
{
/* Must be first, hash_free will reset st_hash.records */
- mysql_mutex_lock(&LOCK_prepared_stmt_count);
- DBUG_ASSERT(prepared_stmt_count >= st_hash.records);
- prepared_stmt_count-= st_hash.records;
- mysql_mutex_unlock(&LOCK_prepared_stmt_count);
-
+ if (st_hash.records)
+ {
+ mysql_mutex_lock(&LOCK_prepared_stmt_count);
+ DBUG_ASSERT(prepared_stmt_count >= st_hash.records);
+ prepared_stmt_count-= st_hash.records;
+ mysql_mutex_unlock(&LOCK_prepared_stmt_count);
+ }
my_hash_reset(&names_hash);
my_hash_reset(&st_hash);
last_found_statement= 0;
@@ -3984,12 +4040,8 @@ void Statement_map::reset()
Statement_map::~Statement_map()
{
- /* Must go first, hash_free will reset st_hash.records */
- mysql_mutex_lock(&LOCK_prepared_stmt_count);
- DBUG_ASSERT(prepared_stmt_count >= st_hash.records);
- prepared_stmt_count-= st_hash.records;
- mysql_mutex_unlock(&LOCK_prepared_stmt_count);
-
+ /* Statement_map::reset() should be called prior to destructor. */
+ DBUG_ASSERT(!st_hash.records);
my_hash_free(&names_hash);
my_hash_free(&st_hash);
}
@@ -4711,14 +4763,14 @@ MYSQL_THD create_thd()
thd->set_command(COM_DAEMON);
thd->system_thread= SYSTEM_THREAD_GENERIC;
thd->security_ctx->host_or_ip="";
- add_to_active_threads(thd);
+ server_threads.insert(thd);
return thd;
}
void destroy_thd(MYSQL_THD thd)
{
thd->add_status_to_global();
- unlink_not_visible_thd(thd);
+ server_threads.erase(thd);
delete thd;
}
@@ -4789,7 +4841,8 @@ extern "C" int thd_slave_thread(const MYSQL_THD thd)
extern "C" int thd_rpl_stmt_based(const MYSQL_THD thd)
{
- return !thd->is_current_stmt_binlog_format_row() &&
+ return thd &&
+ !thd->is_current_stmt_binlog_format_row() &&
!thd->is_current_stmt_binlog_disabled();
}
@@ -4984,8 +5037,9 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd)
if (WSREP(thd))
{
/* for wsrep binlog format is meaningful also when binlogging is off */
- return (int) thd->wsrep_binlog_format();
+ return (int) WSREP_BINLOG_FORMAT(thd->variables.binlog_format);
}
+
if (mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG))
return (int) thd->variables.binlog_format;
return BINLOG_FORMAT_UNSPEC;
@@ -5468,6 +5522,10 @@ void THD::set_query_and_id(char *query_arg, uint32 query_length_arg,
set_query_inner(query_arg, query_length_arg, cs);
mysql_mutex_unlock(&LOCK_thd_data);
query_id= new_query_id;
+#ifdef WITH_WSREP
+ set_wsrep_next_trx_id(query_id);
+ WSREP_DEBUG("assigned new next query and trx id: %lu", wsrep_next_trx_id());
+#endif /* WITH_WSREP */
}
/** Assign a new value to thd->mysys_var. */
@@ -5578,34 +5636,34 @@ class XID_cache_element
ACQUIRED and RECOVERED flags are cleared before element is deleted from
hash in a spin loop, after last reference is released.
*/
- int32 m_state;
+ std::atomic<int32_t> m_state;
public:
static const int32 ACQUIRED= 1 << 30;
static const int32 RECOVERED= 1 << 29;
XID_STATE *m_xid_state;
- bool is_set(int32 flag)
- { return my_atomic_load32_explicit(&m_state, MY_MEMORY_ORDER_RELAXED) & flag; }
- void set(int32 flag)
+ bool is_set(int32_t flag)
+ { return m_state.load(std::memory_order_relaxed) & flag; }
+ void set(int32_t flag)
{
DBUG_ASSERT(!is_set(ACQUIRED | RECOVERED));
- my_atomic_add32_explicit(&m_state, flag, MY_MEMORY_ORDER_RELAXED);
+ m_state.fetch_add(flag, std::memory_order_relaxed);
}
bool lock()
{
- int32 old= my_atomic_add32_explicit(&m_state, 1, MY_MEMORY_ORDER_ACQUIRE);
+ int32_t old= m_state.fetch_add(1, std::memory_order_acquire);
if (old & (ACQUIRED | RECOVERED))
return true;
unlock();
return false;
}
void unlock()
- { my_atomic_add32_explicit(&m_state, -1, MY_MEMORY_ORDER_RELEASE); }
+ { m_state.fetch_sub(1, std::memory_order_release); }
void mark_uninitialized()
{
- int32 old= ACQUIRED;
- while (!my_atomic_cas32_weak_explicit(&m_state, &old, 0,
- MY_MEMORY_ORDER_RELAXED,
- MY_MEMORY_ORDER_RELAXED))
+ int32_t old= ACQUIRED;
+ while (!m_state.compare_exchange_weak(old, 0,
+ std::memory_order_relaxed,
+ std::memory_order_relaxed))
{
old&= ACQUIRED | RECOVERED;
(void) LF_BACKOFF();
@@ -5613,10 +5671,10 @@ public:
}
bool acquire_recovered()
{
- int32 old= RECOVERED;
- while (!my_atomic_cas32_weak_explicit(&m_state, &old, ACQUIRED | RECOVERED,
- MY_MEMORY_ORDER_RELAXED,
- MY_MEMORY_ORDER_RELAXED))
+ int32_t old= RECOVERED;
+ while (!m_state.compare_exchange_weak(old, ACQUIRED | RECOVERED,
+ std::memory_order_relaxed,
+ std::memory_order_relaxed))
{
if (!(old & RECOVERED) || (old & ACQUIRED))
return false;
@@ -5913,9 +5971,27 @@ int THD::decide_logging_format(TABLE_LIST *tables)
binlogging is off, or if the statement is filtered out from the
binlog by filtering rules.
*/
+#ifdef WITH_WSREP
+ if (WSREP_CLIENT_NNULL(this) && variables.wsrep_trx_fragment_size > 0)
+ {
+ if (!is_current_stmt_binlog_format_row())
+ {
+ my_message(ER_NOT_SUPPORTED_YET,
+ "Streaming replication not supported with "
+ "binlog_format=STATEMENT", MYF(0));
+ DBUG_RETURN(-1);
+ }
+ }
+
+ if ((WSREP_EMULATE_BINLOG_NNULL(this) ||
+ (mysql_bin_log.is_open() && (variables.option_bits & OPTION_BIN_LOG))) &&
+ !(wsrep_binlog_format() == BINLOG_FORMAT_STMT &&
+ !binlog_filter->db_ok(db.str)))
+#else
if (mysql_bin_log.is_open() && (variables.option_bits & OPTION_BIN_LOG) &&
!(wsrep_binlog_format() == BINLOG_FORMAT_STMT &&
!binlog_filter->db_ok(db.str)))
+#endif /* WITH_WSREP */
{
if (is_bulk_op())
@@ -6237,7 +6313,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
5. Error: Cannot modify table that uses a storage engine
limited to row-logging when binlog_format = STATEMENT
*/
- if (IF_WSREP((!WSREP(this) || wsrep_exec_mode == LOCAL_STATE),1))
+ if (IF_WSREP((!WSREP(this) ||
+ wsrep_cs().mode() == wsrep::client_state::m_local),1))
{
my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), "");
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index d9ff1743fd6..5309953ccc2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -38,15 +38,14 @@
#include "thr_timer.h"
#include "thr_malloc.h"
#include "log_slow.h" /* LOG_SLOW_DISABLE_... */
-
#include "sql_digest_stream.h" // sql_digest_state
-
#include <mysql/psi/mysql_stage.h>
#include <mysql/psi/mysql_statement.h>
#include <mysql/psi/mysql_idle.h>
#include <mysql/psi/mysql_table.h>
#include <mysql_com_server.h>
#include "session_tracker.h"
+#include "backup.h"
extern "C"
void set_thd_stage_info(void *thd,
@@ -61,8 +60,18 @@ void set_thd_stage_info(void *thd,
#include "my_apc.h"
#include "rpl_gtid.h"
+
#include "wsrep_mysqld.h"
+#ifdef WITH_WSREP
+/* wsrep-lib */
+#include "wsrep_client_service.h"
+#include "wsrep_client_state.h"
+#include "wsrep_mutex.h"
+#include "wsrep_condition_variable.h"
+
+class Wsrep_applier_service;
+#endif /* WITH_WSREP */
class Reprepare_observer;
class Relay_log_info;
struct rpl_group_info;
@@ -156,8 +165,15 @@ enum enum_binlog_row_image {
#define MODE_HIGH_NOT_PRECEDENCE (1ULL << 29)
#define MODE_NO_ENGINE_SUBSTITUTION (1ULL << 30)
#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31)
+/* SQL mode bits defined above are common for MariaDB and MySQL */
+#define MODE_MASK_MYSQL_COMPATIBLE 0xFFFFFFFFULL
+/* The following modes are specific to MariaDB */
#define MODE_EMPTY_STRING_IS_NULL (1ULL << 32)
#define MODE_SIMULTANEOUS_ASSIGNMENT (1ULL << 33)
+#define MODE_TIME_ROUND_FRACTIONAL (1ULL << 34)
+/* The following modes are specific to MySQL */
+#define MODE_MYSQL80_TIME_TRUNCATE_FRACTIONAL (1ULL << 32)
+
/* Bits for different old style modes */
#define OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE (1 << 0)
@@ -168,8 +184,6 @@ extern char internal_table_name[2];
extern char empty_c_string[1];
extern MYSQL_PLUGIN_IMPORT const char **errmesg;
-extern bool volatile shutdown_in_progress;
-
extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd);
extern "C" size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen);
@@ -706,10 +720,12 @@ typedef struct system_variables
my_bool wsrep_on;
my_bool wsrep_causal_reads;
+ uint wsrep_sync_wait;
+ ulong wsrep_retry_autocommit;
+ ulonglong wsrep_trx_fragment_size;
+ ulong wsrep_trx_fragment_unit;
+ ulong wsrep_OSU_method;
my_bool wsrep_dirty_reads;
- uint wsrep_sync_wait;
- ulong wsrep_retry_autocommit;
- ulong wsrep_OSU_method;
double long_query_time_double, max_statement_time_double;
my_bool pseudo_slave_mode;
@@ -1947,42 +1963,22 @@ public:
Global_read_lock()
: m_state(GRL_NONE),
- m_mdl_global_shared_lock(NULL),
- m_mdl_blocks_commits_lock(NULL)
+ m_mdl_global_read_lock(NULL)
{}
bool lock_global_read_lock(THD *thd);
void unlock_global_read_lock(THD *thd);
- /**
- Check if this connection can acquire protection against GRL and
- emit error if otherwise.
- */
- bool can_acquire_protection() const
- {
- if (m_state)
- {
- my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
- return TRUE;
- }
- return FALSE;
- }
bool make_global_read_lock_block_commit(THD *thd);
bool is_acquired() const { return m_state != GRL_NONE; }
void set_explicit_lock_duration(THD *thd);
private:
enum_grl_state m_state;
/**
- In order to acquire the global read lock, the connection must
- acquire shared metadata lock in GLOBAL namespace, to prohibit
- all DDL.
+ Global read lock is acquired in two steps:
+ 1. acquire MDL_BACKUP_FTWRL1 in BACKUP namespace to prohibit DDL and DML
+ 2. upgrade to MDL_BACKUP_FTWRL2 to prohibit commits
*/
- MDL_ticket *m_mdl_global_shared_lock;
- /**
- Also in order to acquire the global read lock, the connection
- must acquire a shared metadata lock in COMMIT namespace, to
- prohibit commits.
- */
- MDL_ticket *m_mdl_blocks_commits_lock;
+ MDL_ticket *m_mdl_global_read_lock;
};
@@ -2137,13 +2133,43 @@ struct wait_for_commit
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
+
+/**
+ A wrapper around thread_count.
+
+ It must be specified as a first base class of THD, so that increment is
+ done before any other THD constructors and decrement - after any other THD
+ destructors.
+*/
+struct THD_count
+{
+ THD_count() { thread_count++; }
+
+
+ /**
+ Decrements thread_count.
+
+ Unblocks close_conneciton() if there are no more THD's left.
+ */
+ ~THD_count()
+ {
+#ifndef DBUG_OFF
+ uint32_t t=
+#endif
+ thread_count--;
+ DBUG_ASSERT(t > 0);
+ }
+};
+
+
/**
@class THD
For each client connection we create a separate thread with THD serving as
a thread/connection descriptor
*/
-class THD :public Statement,
+class THD: public THD_count, /* this must be first */
+ public Statement,
/*
This is to track items changed during execution of a prepared
statement/stored procedure. It's created by
@@ -2168,19 +2194,6 @@ private:
inline bool is_conventional() const
{ DBUG_ASSERT(0); return Statement::is_conventional(); }
- void dec_thread_count(void)
- {
- DBUG_ASSERT(thread_count > 0);
- thread_safe_decrement32(&thread_count);
- signal_thd_deleted();
- }
-
-
- void inc_thread_count(void)
- {
- thread_safe_increment32(&thread_count);
- }
-
public:
MDL_context mdl_context;
@@ -2194,6 +2207,7 @@ public:
rpl_io_thread_info *rpl_io_info;
rpl_sql_thread_info *rpl_sql_info;
} system_thread_info;
+ MDL_ticket *mdl_backup_ticket, *mdl_backup_lock;
void reset_for_next_command(bool do_clear_errors= 1);
/*
@@ -2249,7 +2263,7 @@ public:
- thd->db (used in SHOW PROCESSLIST)
Is locked when THD is deleted.
*/
- mysql_mutex_t LOCK_thd_data;
+ mutable mysql_mutex_t LOCK_thd_data;
/*
Protects:
- kill information
@@ -2979,6 +2993,7 @@ public:
uint tmp_table, global_disable_checkpoint;
uint server_status,open_options;
enum enum_thread_type system_thread;
+ enum backup_stages current_backup_stage;
/*
Current or next transaction isolation level.
When a connection is established, the value is taken from
@@ -3209,7 +3224,6 @@ public:
mysql_bin_log.start_union_events() call.
*/
bool unioned_events_trans;
-
/*
'queries' (actually SP statements) that run under inside this binlog
union have thd->query_id >= first_query_id.
@@ -3217,7 +3231,6 @@ public:
query_id_t first_query_id;
} binlog_evt_union;
- mysql_cond_t COND_wsrep_thd;
/**
Internal parser state.
Note that since the parser is not re-entrant, we keep only one parser
@@ -3300,9 +3313,18 @@ public:
void awake_no_mutex(killed_state state_to_set);
void awake(killed_state state_to_set)
{
+ bool wsrep_on_local= WSREP_ON;
+ /*
+ mutex locking order (LOCK_thd_data - LOCK_thd_kill)) requires
+ to grab LOCK_thd_data here
+ */
+ if (wsrep_on_local)
+ mysql_mutex_lock(&LOCK_thd_data);
mysql_mutex_lock(&LOCK_thd_kill);
awake_no_mutex(state_to_set);
mysql_mutex_unlock(&LOCK_thd_kill);
+ if (wsrep_on_local)
+ mysql_mutex_unlock(&LOCK_thd_data);
}
/** Disconnect the associated communication endpoint. */
@@ -3416,6 +3438,15 @@ public:
inline ulong query_start_sec_part()
{ query_start_sec_part_used=1; return start_time_sec_part; }
MYSQL_TIME query_start_TIME();
+ Timeval query_start_timeval()
+ {
+ return Timeval(query_start(), query_start_sec_part());
+ }
+ time_round_mode_t temporal_round_mode() const
+ {
+ return variables.sql_mode & MODE_TIME_ROUND_FRACTIONAL ?
+ TIME_FRAC_ROUND : TIME_FRAC_TRUNCATE;
+ }
private:
struct {
@@ -3607,6 +3638,15 @@ public:
{
return server_status & SERVER_STATUS_IN_TRANS;
}
+ void give_protection_error();
+ inline bool has_read_only_protection()
+ {
+ if (current_backup_stage == BACKUP_FINISHED &&
+ !global_read_lock.is_acquired())
+ return FALSE;
+ give_protection_error();
+ return TRUE;
+ }
inline bool fill_derived_tables()
{
return !stmt_arena->is_stmt_prepare() && !lex->only_view_structure();
@@ -4414,14 +4454,23 @@ public:
}
void push_warning_truncated_value_for_field(Sql_condition::enum_warning_level
level, const char *type_str,
- const char *val, const char *name)
+ const char *val,
+ const TABLE_SHARE *s,
+ const char *name)
{
DBUG_ASSERT(name);
char buff[MYSQL_ERRMSG_SIZE];
CHARSET_INFO *cs= &my_charset_latin1;
+ const char *db_name= s ? s->db.str : NULL;
+ const char *table_name= s ? s->error_table_name() : NULL;
+
+ if (!db_name)
+ db_name= "";
+ if (!table_name)
+ table_name= "";
cs->cset->snprintf(cs, buff, sizeof(buff),
ER_THD(this, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- type_str, val, name,
+ type_str, val, db_name, table_name, name,
(ulong) get_stmt_da()->current_row_for_warning());
push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff);
@@ -4430,10 +4479,12 @@ public:
bool totally_useless_value,
const char *type_str,
const char *val,
+ const TABLE_SHARE *s,
const char *field_name)
{
if (field_name)
- push_warning_truncated_value_for_field(level, type_str, val, field_name);
+ push_warning_truncated_value_for_field(level, type_str, val,
+ s, field_name);
else if (totally_useless_value)
push_warning_wrong_value(level, type_str, val);
else
@@ -4481,6 +4532,13 @@ public:
void set_query_id(query_id_t new_query_id)
{
query_id= new_query_id;
+#ifdef WITH_WSREP
+ if (WSREP(this))
+ {
+ set_wsrep_next_trx_id(query_id);
+ WSREP_DEBUG("assigned new next trx id: %lu", wsrep_next_trx_id());
+ }
+#endif /* WITH_WSREP */
}
void set_open_tables(TABLE *open_tables_arg)
{
@@ -4736,52 +4794,114 @@ private:
public:
inline ulong wsrep_binlog_format() const
{
- return WSREP_FORMAT(variables.binlog_format);
+ return WSREP_BINLOG_FORMAT(variables.binlog_format);
}
#ifdef WITH_WSREP
- const bool wsrep_applier; /* dedicated slave applier thread */
+ bool wsrep_applier; /* dedicated slave applier thread */
bool wsrep_applier_closing; /* applier marked to close */
bool wsrep_client_thread; /* to identify client threads*/
- bool wsrep_PA_safe;
- bool wsrep_converted_lock_session;
- bool wsrep_apply_toi; /* applier processing in TOI */
- enum wsrep_exec_mode wsrep_exec_mode;
query_id_t wsrep_last_query_id;
- enum wsrep_query_state wsrep_query_state;
- enum wsrep_conflict_state wsrep_conflict_state;
- wsrep_trx_meta_t wsrep_trx_meta;
+ XID wsrep_xid;
+
+ /** This flag denotes that record locking should be skipped during INSERT
+ and gap locking during SELECT. Only used by the streaming replication thread
+ that only modifies the wsrep_schema.SR table. */
+ my_bool wsrep_skip_locking;
+
+ mysql_cond_t COND_wsrep_thd;
+
+ // changed from wsrep_seqno_t to wsrep_trx_meta_t in wsrep API rev 75
uint32 wsrep_rand;
- Relay_log_info *wsrep_rli;
rpl_group_info *wsrep_rgi;
- wsrep_ws_handle_t wsrep_ws_handle;
+ bool wsrep_converted_lock_session;
+ char wsrep_info[128]; /* string for dynamic proc info */
ulong wsrep_retry_counter; // of autocommit
- char *wsrep_retry_query;
+ bool wsrep_PA_safe;
+ char* wsrep_retry_query;
size_t wsrep_retry_query_len;
enum enum_server_command wsrep_retry_command;
- enum wsrep_consistency_check_mode
+ enum wsrep_consistency_check_mode
wsrep_consistency_check;
+ std::vector<wsrep::provider::status_variable> wsrep_status_vars;
int wsrep_mysql_replicated;
- const char *wsrep_TOI_pre_query; /* a query to apply before
- the actual TOI query */
+ const char* wsrep_TOI_pre_query; /* a query to apply before
+ the actual TOI query */
size_t wsrep_TOI_pre_query_len;
wsrep_po_handle_t wsrep_po_handle;
size_t wsrep_po_cnt;
#ifdef GTID_SUPPORT
+ my_bool wsrep_po_in_trans;
rpl_sid wsrep_po_sid;
-#endif /* GTID_SUPPORT */
+#endif /* GTID_SUPPORT */
void *wsrep_apply_format;
- char wsrep_info[128]; /* string for dynamic proc info */
+ bool wsrep_apply_toi; /* applier processing in TOI */
+ uchar* wsrep_rbr_buf;
+ wsrep_gtid_t wsrep_sync_wait_gtid;
+ // wsrep_gtid_t wsrep_last_written_gtid;
+ ulong wsrep_affected_rows;
+ bool wsrep_has_ignored_error;
+ bool wsrep_replicate_GTID;
+
/*
When enabled, do not replicate/binlog updates from the current table that's
being processed. At the moment, it is used to keep mysql.gtid_slave_pos
table updates from being replicated to other nodes via galera replication.
*/
bool wsrep_ignore_table;
- wsrep_gtid_t wsrep_sync_wait_gtid;
- ulong wsrep_affected_rows;
- bool wsrep_replicate_GTID;
- bool wsrep_skip_wsrep_GTID;
+
+
+ /*
+ Transaction id:
+ * m_wsrep_next_trx_id is assigned on the first query after
+ wsrep_next_trx_id() return WSREP_UNDEFINED_TRX_ID
+ * Each storage engine must assign value of wsrep_next_trx_id()
+ when the transaction starts.
+ * Effective transaction id is returned via wsrep_trx_id()
+ */
+ /*
+ Return effective transaction id
+ */
+ wsrep_trx_id_t wsrep_trx_id() const
+ {
+ return m_wsrep_client_state.transaction().id().get();
+ }
+
+
+ /*
+ Set next trx id
+ */
+ void set_wsrep_next_trx_id(query_id_t query_id)
+ {
+ m_wsrep_next_trx_id = (wsrep_trx_id_t) query_id;
+ }
+ /*
+ Return next trx id
+ */
+ wsrep_trx_id_t wsrep_next_trx_id() const
+ {
+ return m_wsrep_next_trx_id;
+ }
+
+private:
+ wsrep_trx_id_t m_wsrep_next_trx_id; /* cast from query_id_t */
+ /* wsrep-lib */
+ Wsrep_mutex m_wsrep_mutex;
+ Wsrep_condition_variable m_wsrep_cond;
+ Wsrep_client_service m_wsrep_client_service;
+ Wsrep_client_state m_wsrep_client_state;
+
+public:
+ Wsrep_client_state& wsrep_cs() { return m_wsrep_client_state; }
+ const Wsrep_client_state& wsrep_cs() const { return m_wsrep_client_state; }
+ const wsrep::transaction& wsrep_trx() const
+ { return m_wsrep_client_state.transaction(); }
+ const wsrep::streaming_context& wsrep_sr() const
+ { return m_wsrep_client_state.transaction().streaming_context(); }
+ /* Pointer to applier service for streaming THDs. This is needed to
+ be able to delete applier service object in case of background
+ rollback. */
+ Wsrep_applier_service* wsrep_applier_service;
#endif /* WITH_WSREP */
/* Handling of timeouts for commands */
@@ -4830,15 +4950,15 @@ public:
}
/*
Reset current_linfo
- Setting current_linfo to 0 needs to be done with LOCK_thread_count to
+ Setting current_linfo to 0 needs to be done with LOCK_thd_data to
ensure that adjust_linfo_offsets doesn't use a structure that may
be deleted.
*/
inline void reset_current_linfo()
{
- mysql_mutex_lock(&LOCK_thread_count);
+ mysql_mutex_lock(&LOCK_thd_data);
current_linfo= 0;
- mysql_mutex_unlock(&LOCK_thread_count);
+ mysql_mutex_unlock(&LOCK_thd_data);
}
@@ -4900,27 +5020,6 @@ public:
}
};
-inline void add_to_active_threads(THD *thd)
-{
- mysql_mutex_lock(&LOCK_thread_count);
- threads.append(thd);
- mysql_mutex_unlock(&LOCK_thread_count);
-}
-
-/*
- This should be called when you want to delete a thd that was not
- running any queries.
- This function will assert that the THD is linked.
-*/
-
-inline void unlink_not_visible_thd(THD *thd)
-{
- thd->assert_linked();
- mysql_mutex_lock(&LOCK_thread_count);
- thd->unlink();
- mysql_mutex_unlock(&LOCK_thread_count);
-}
-
/** A short cut for thd->get_stmt_da()->set_ok_status(). */
inline void
@@ -4954,16 +5053,17 @@ my_eof(THD *thd)
(A)->variables.sql_log_bin_off= 0;}
-inline date_mode_t sql_mode_for_dates(THD *thd)
+inline date_conv_mode_t sql_mode_for_dates(THD *thd)
{
- static_assert(C_TIME_FUZZY_DATES == date_mode_t::FUZZY_DATES &&
- C_TIME_TIME_ONLY == date_mode_t::TIME_ONLY,
- "sql_mode_t and pure C library date flags must be equal");
+ static_assert((date_conv_mode_t::KNOWN_MODES &
+ time_round_mode_t::KNOWN_MODES) == 0,
+ "date_conv_mode_t and time_round_mode_t must use different "
+ "bit values");
static_assert(MODE_NO_ZERO_DATE == date_mode_t::NO_ZERO_DATE &&
MODE_NO_ZERO_IN_DATE == date_mode_t::NO_ZERO_IN_DATE &&
MODE_INVALID_DATES == date_mode_t::INVALID_DATES,
"sql_mode_t and date_mode_t values must be equal");
- return date_mode_t(thd->variables.sql_mode &
+ return date_conv_mode_t(thd->variables.sql_mode &
(MODE_NO_ZERO_DATE | MODE_NO_ZERO_IN_DATE | MODE_INVALID_DATES));
}
@@ -5112,6 +5212,14 @@ public:
Currently all intercepting classes derive from select_result_interceptor.
*/
virtual bool is_result_interceptor()=0;
+
+ /*
+ This method is used to distinguish an normal SELECT from the cursor
+ structure discovery for cursor%ROWTYPE routine variables.
+ If this method returns "true", then a SELECT execution performs only
+ all preparation stages, but does not fetch any rows.
+ */
+ virtual bool view_structure_only() const { return false; }
};
@@ -5231,9 +5339,13 @@ private:
{
List<sp_variable> *spvar_list;
uint field_count;
+ bool m_view_structure_only;
bool send_data_to_variable_list(List<sp_variable> &vars, List<Item> &items);
public:
- Select_fetch_into_spvars(THD *thd_arg): select_result_interceptor(thd_arg) {}
+ Select_fetch_into_spvars(THD *thd_arg, bool view_structure_only)
+ :select_result_interceptor(thd_arg),
+ m_view_structure_only(view_structure_only)
+ {}
void reset(THD *thd_arg)
{
select_result_interceptor::reset(thd_arg);
@@ -5246,16 +5358,17 @@ private:
virtual bool send_eof() { return FALSE; }
virtual int send_data(List<Item> &items);
virtual int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
+ virtual bool view_structure_only() const { return m_view_structure_only; }
};
public:
sp_cursor()
- :result(NULL),
+ :result(NULL, false),
m_lex_keeper(NULL),
server_side_cursor(NULL)
{ }
- sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper)
- :result(thd_arg),
+ sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper, bool view_structure_only)
+ :result(thd_arg, view_structure_only),
m_lex_keeper(lex_keeper),
server_side_cursor(NULL)
{}
@@ -5267,8 +5380,6 @@ public:
int open(THD *thd);
- int open_view_structure_only(THD *thd);
-
int close(THD *thd);
my_bool is_open()
@@ -6093,6 +6204,10 @@ class multi_delete :public select_result_interceptor
bool error_handled;
public:
+ // Methods used by ColumnStore
+ uint get_num_of_tables() const { return num_of_tables; }
+ TABLE_LIST* get_tables() const { return delete_tables; }
+public:
multi_delete(THD *thd_arg, TABLE_LIST *dt, uint num_of_tables);
~multi_delete();
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
@@ -6272,7 +6387,7 @@ public:
be rolled back or that do not expect any previously metadata
locked tables.
*/
-#define CF_IMPLICT_COMMIT_BEGIN (1U << 6)
+#define CF_IMPLICIT_COMMIT_BEGIN (1U << 6)
/**
Implicitly commit after the SQL statement.
@@ -6290,7 +6405,7 @@ public:
before and after every DDL statement and any statement that
modifies our currently non-transactional system tables.
*/
-#define CF_AUTO_COMMIT_TRANS (CF_IMPLICT_COMMIT_BEGIN | CF_IMPLICIT_COMMIT_END)
+#define CF_AUTO_COMMIT_TRANS (CF_IMPLICIT_COMMIT_BEGIN | CF_IMPLICIT_COMMIT_END)
/**
Diagnostic statement.
@@ -6366,6 +6481,14 @@ public:
*/
#define CF_DB_CHANGE (1U << 22)
+#ifdef WITH_WSREP
+/**
+ DDL statement that may be subject to error filtering.
+*/
+#define CF_WSREP_MAY_IGNORE_ERRORS (1U << 23)
+#endif /* WITH_WSREP */
+
+
/* Bits in server_command_flags */
/**
@@ -6807,5 +6930,85 @@ private:
THD *thd;
};
+
+/** THD registry */
+class THD_list
+{
+ I_List<THD> threads;
+ mutable mysql_rwlock_t lock;
+
+public:
+ /**
+ Constructor replacement.
+
+ Unfortunately we can't use fair constructor to initialize mutex
+ for two reasons: PFS and embedded. The former can probably be fixed,
+ the latter can probably be dropped.
+ */
+ void init()
+ {
+ mysql_rwlock_init(key_rwlock_THD_list, &lock);
+ }
+
+ /** Destructor replacement. */
+ void destroy()
+ {
+ mysql_rwlock_destroy(&lock);
+ }
+
+ /**
+ Inserts thread to registry.
+
+ @param thd thread
+
+ Thread becomes accessible via server_threads.
+ */
+ void insert(THD *thd)
+ {
+ mysql_rwlock_wrlock(&lock);
+ threads.append(thd);
+ mysql_rwlock_unlock(&lock);
+ }
+
+ /**
+ Removes thread from registry.
+
+ @param thd thread
+
+ Thread becomes not accessible via server_threads.
+ */
+ void erase(THD *thd)
+ {
+ thd->assert_linked();
+ mysql_rwlock_wrlock(&lock);
+ thd->unlink();
+ mysql_rwlock_unlock(&lock);
+ }
+
+ /**
+ Iterates registered threads.
+
+ @param action called for every element
+ @param argument opque argument passed to action
+
+ @return
+ @retval 0 iteration completed successfully
+ @retval 1 iteration was interrupted (action returned 1)
+ */
+ template <typename T> int iterate(my_bool (*action)(THD *thd, T *arg), T *arg= 0)
+ {
+ int res= 0;
+ mysql_rwlock_rdlock(&lock);
+ I_List_iterator<THD> it(threads);
+ while (auto tmp= it++)
+ if ((res= action(tmp, arg)))
+ break;
+ mysql_rwlock_unlock(&lock);
+ return res;
+ }
+};
+
+extern THD_list server_threads;
+
#endif /* MYSQL_SERVER */
#endif /* SQL_CLASS_INCLUDED */
diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h
index 1c4c89eb132..973e159c0cb 100644
--- a/sql/sql_cmd.h
+++ b/sql/sql_cmd.h
@@ -108,6 +108,7 @@ enum enum_sql_command {
SQLCOM_SHOW_STATUS_PACKAGE,
SQLCOM_SHOW_STATUS_PACKAGE_BODY,
SQLCOM_SHOW_PACKAGE_BODY_CODE,
+ SQLCOM_BACKUP, SQLCOM_BACKUP_LOCK,
/*
When a command is added here, be sure it's also added in mysqld.cc
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index b48070b9c8f..ac2503d29ff 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -37,7 +37,11 @@
// reset_host_errors
#include "sql_acl.h" // acl_getroot, NO_ACCESS, SUPER_ACL
#include "sql_callback.h"
+
+#ifdef WITH_WSREP
+#include "wsrep_trans_observer.h" /* wsrep open/close */
#include "wsrep_mysqld.h"
+#endif /* WITH_WSREP */
#include "proxy_protocol.h"
HASH global_user_stats, global_client_stats, global_table_stats;
@@ -1177,17 +1181,6 @@ exit:
void end_connection(THD *thd)
{
NET *net= &thd->net;
-#ifdef WITH_WSREP
- if (WSREP(thd))
- {
- wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id);
- if (rcode) {
- WSREP_WARN("wsrep failed to free connection context: %lld code: %d",
- (longlong) thd->thread_id, rcode);
- }
- }
- thd->wsrep_client_thread= 0;
-#endif
plugin_thdvar_cleanup(thd);
if (thd->user_connect)
@@ -1322,7 +1315,7 @@ bool thd_prepare_connection(THD *thd)
prepare_new_connection_state(thd);
#ifdef WITH_WSREP
- thd->wsrep_client_thread= 1;
+ thd->wsrep_client_thread= true;
#endif /* WITH_WSREP */
return FALSE;
}
@@ -1367,7 +1360,7 @@ void do_handle_one_connection(CONNECT *connect)
delete connect;
/* Make THD visible in show processlist */
- add_to_active_threads(thd);
+ server_threads.insert(thd);
thd->thr_create_utime= thr_create_utime;
/* We need to set this because of time_out_user_resource_limits */
@@ -1395,6 +1388,9 @@ void do_handle_one_connection(CONNECT *connect)
create_user= FALSE;
goto end_thread;
}
+#ifdef WITH_WSREP
+ wsrep_open(thd);
+#endif /* WITH_WSREP */
while (thd_is_connection_alive(thd))
{
@@ -1405,13 +1401,9 @@ void do_handle_one_connection(CONNECT *connect)
end_connection(thd);
#ifdef WITH_WSREP
- if (WSREP(thd))
- {
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_EXITING;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-#endif
+ wsrep_close(thd);
+#endif /* WITH_WSREP */
+
end_thread:
close_connection(thd);
diff --git a/sql/sql_const.h b/sql/sql_const.h
index e6dcc3420cf..d4e40cd551e 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -33,7 +33,17 @@
#define MAX_SYS_VAR_LENGTH 32
#define MAX_KEY MAX_INDEXES /* Max used keys */
#define MAX_REF_PARTS 32 /* Max parts used as ref */
-#define MAX_KEY_LENGTH 3072 /* max possible key */
+
+/*
+ Maximum length of the data part of an index lookup key.
+
+ The "data part" is defined as the value itself, not including the
+ NULL-indicator bytes or varchar length bytes ("the Extras"). We need this
+ value because there was a bug where length of the Extras were not counted.
+
+ You probably need MAX_KEY_LENGTH, not this constant.
+*/
+#define MAX_DATA_LENGTH_FOR_KEY 3072
#if SIZEOF_OFF_T > 4
#define MAX_REFLENGTH 8 /* Max length for record ref */
#else
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index 2a200d279b5..4f3b15c3254 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -92,6 +92,11 @@ public:
if (materialized_cursor)
materialized_cursor->on_table_fill_finished();
}
+
+ bool view_structure_only() const
+ {
+ return result->view_structure_only();
+ }
};
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 5f826e37a76..fbb62bd384a 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -764,8 +764,7 @@ exit:
}
-int mysql_create_db(THD *thd, const LEX_CSTRING *db,
- const DDL_options_st &options,
+int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options,
const Schema_specification_st *create_info)
{
/*
@@ -773,6 +772,9 @@ int mysql_create_db(THD *thd, const LEX_CSTRING *db,
to it, we need to use a copy to make execution prepared statement- safe.
*/
Schema_specification_st tmp(*create_info);
+ if (thd->slave_thread &&
+ slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
+ options.add(DDL_options::OPT_IF_NOT_EXISTS);
return mysql_create_db_internal(thd, db, options, &tmp, false);
}
@@ -880,7 +882,7 @@ mysql_rm_db_internal(THD *thd, const LEX_CSTRING *db, bool if_exists, bool silen
lock_db_routines(thd, dbnorm))
goto exit;
- if (!in_bootstrap && !rm_mysql_schema)
+ if (!thd->bootstrap && !rm_mysql_schema)
{
for (table= tables; table; table= table->next_local)
{
@@ -1047,6 +1049,9 @@ exit:
bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists)
{
+ if (thd->slave_thread &&
+ slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
+ if_exists= true;
return mysql_rm_db_internal(thd, db, if_exists, false);
}
diff --git a/sql/sql_db.h b/sql/sql_db.h
index 7de6c2a9c99..c0646bd65f0 100644
--- a/sql/sql_db.h
+++ b/sql/sql_db.h
@@ -20,8 +20,7 @@
class THD;
-int mysql_create_db(THD *thd, const LEX_CSTRING *db,
- const DDL_options_st &options,
+int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options,
const Schema_specification_st *create);
bool mysql_alter_db(THD *thd, const LEX_CSTRING *db,
const Schema_specification_st *create);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 148c2371a6b..1630d335559 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -319,9 +319,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(true);
}
- TABLE *table= table_list->table;
- DBUG_ASSERT(table);
-
+ DBUG_ASSERT(table_list->table);
DBUG_ASSERT(!conds || thd->stmt_arena->is_stmt_execute());
// conds could be cached from previous SP call
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 72df8367dc7..73b6f637a98 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -668,7 +668,7 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
(HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE)) == 0))
{
my_error(ER_KEY_DOESNT_SUPPORT, MYF(0),
- table->file->index_type(handler->keyno), keyinfo->name);
+ table->file->index_type(handler->keyno), keyinfo->name.str);
return 1;
}
@@ -1196,10 +1196,10 @@ void mysql_ha_flush(THD *thd)
@note Broadcasts refresh if it closed a table with old version.
*/
-void mysql_ha_cleanup(THD *thd)
+void mysql_ha_cleanup_no_free(THD *thd)
{
SQL_HANDLER *hash_tables;
- DBUG_ENTER("mysql_ha_cleanup");
+ DBUG_ENTER("mysql_ha_cleanup_no_free");
for (uint i= 0; i < thd->handler_tables_hash.records; i++)
{
@@ -1207,9 +1207,15 @@ void mysql_ha_cleanup(THD *thd)
if (hash_tables->table)
mysql_ha_close_table(hash_tables);
}
+ DBUG_VOID_RETURN;
+}
- my_hash_free(&thd->handler_tables_hash);
+void mysql_ha_cleanup(THD *thd)
+{
+ DBUG_ENTER("mysql_ha_cleanup");
+ mysql_ha_cleanup_no_free(thd);
+ my_hash_free(&thd->handler_tables_hash);
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_handler.h b/sql/sql_handler.h
index 4c16f7e5c57..16063bb1f35 100644
--- a/sql/sql_handler.h
+++ b/sql/sql_handler.h
@@ -73,6 +73,7 @@ bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes, const char *,
void mysql_ha_flush(THD *thd);
void mysql_ha_flush_tables(THD *thd, TABLE_LIST *all_tables);
void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables);
+void mysql_ha_cleanup_no_free(THD *thd);
void mysql_ha_cleanup(THD *thd);
void mysql_ha_set_explicit_lock_duration(THD *thd);
void mysql_ha_rm_temporary_tables(THD *thd);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 127b4b10eb4..a8f074e1783 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -82,6 +82,10 @@
#include "debug_sync.h"
+#ifdef WITH_WSREP
+#include "wsrep_trans_observer.h" /* wsrep_start_transction() */
+#endif /* WITH_WSREP */
+
#ifndef EMBEDDED_LIBRARY
static bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
TABLE_LIST *table_list);
@@ -547,10 +551,10 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
If this goes ok, the tickets are cloned and added to the list of granted
locks held by the handler thread.
*/
- if (thd->global_read_lock.can_acquire_protection())
+ if (thd->has_read_only_protection())
DBUG_RETURN(TRUE);
- protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
+ protection_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DML,
MDL_STATEMENT);
if (thd->mdl_context.acquire_lock(&protection_request,
@@ -640,7 +644,7 @@ create_insert_stmt_from_insert_delayed(THD *thd, String *buf)
if (buf->append(thd->query()) ||
buf->replace(thd->lex->keyword_delayed_begin_offset,
thd->lex->keyword_delayed_end_offset -
- thd->lex->keyword_delayed_begin_offset, 0))
+ thd->lex->keyword_delayed_begin_offset, NULL, 0))
return 1;
return 0;
}
@@ -2184,11 +2188,11 @@ public:
mysql_mutex_init(key_delayed_insert_mutex, &mutex, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_delayed_insert_cond, &cond, NULL);
mysql_cond_init(key_delayed_insert_cond_client, &cond_client, NULL);
- mysql_mutex_lock(&LOCK_thread_count);
+ mysql_mutex_lock(&LOCK_delayed_insert);
delayed_insert_threads++;
+ mysql_mutex_unlock(&LOCK_delayed_insert);
delayed_lock= global_system_variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY : TL_WRITE;
- mysql_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN;
}
~Delayed_insert()
@@ -2206,15 +2210,9 @@ public:
mysql_cond_destroy(&cond);
mysql_cond_destroy(&cond_client);
- /*
- We could use unlink_not_visible_threads() here, but as
- delayed_insert_threads also needs to be protected by
- the LOCK_thread_count mutex, we open code this.
- */
- mysql_mutex_lock(&LOCK_thread_count);
- thd.unlink(); // Must be unlinked under lock
+ server_threads.erase(&thd);
+ mysql_mutex_assert_owner(&LOCK_delayed_insert);
delayed_insert_threads--;
- mysql_mutex_unlock(&LOCK_thread_count);
my_free(thd.query());
thd.security_ctx->user= 0;
@@ -2374,9 +2372,12 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
di->table_list.alias.str= di->table_list.table_name.str= di->thd.query();
di->table_list.alias.length= di->table_list.table_name.length= di->thd.query_length();
di->table_list.db= di->thd.db;
- /* We need the tickets so that they can be cloned in handle_delayed_insert */
- di->grl_protection.init(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE, MDL_STATEMENT);
+ /*
+ We need the tickets so that they can be cloned in
+ handle_delayed_insert
+ */
+ di->grl_protection.init(MDL_key::BACKUP, "", "",
+ MDL_BACKUP_DML, MDL_STATEMENT);
di->grl_protection.ticket= grl_protection_request->ticket;
init_mdl_requests(&di->table_list);
di->table_list.mdl_request.ticket= table_list->mdl_request.ticket;
@@ -2451,10 +2452,12 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
}
/* Unlock the delayed insert object after its last access. */
di->unlock();
- DBUG_RETURN((table_list->table == NULL));
+ DBUG_PRINT("exit", ("table_list->table: %p", table_list->table));
+ DBUG_RETURN(thd->is_error());
end_create:
mysql_mutex_unlock(&LOCK_delayed_create);
+ DBUG_PRINT("exit", ("is_error: %d", thd->is_error()));
DBUG_RETURN(thd->is_error());
}
@@ -2509,24 +2512,27 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
if (thd.killed)
{
/*
- Copy the error message. Note that we don't treat fatal
- errors in the delayed thread as fatal errors in the
- main thread. If delayed thread was killed, we don't
- want to send "Server shutdown in progress" in the
- INSERT THREAD.
-
- The thread could be killed with an error message if
- di->handle_inserts() or di->open_and_lock_table() fails.
- The thread could be killed without an error message if
- killed using THD::notify_shared_lock() or
- kill_delayed_threads_for_table().
+ Check how the insert thread was killed. If it was killed
+ by FLUSH TABLES which calls kill_delayed_threads_for_table(),
+ then is_error is not set.
+ In this case, return without setting an error,
+ which means that the insert will be converted to a normal insert.
*/
- if (!thd.is_error())
- my_message(ER_QUERY_INTERRUPTED, ER_THD(&thd, ER_QUERY_INTERRUPTED),
- MYF(0));
- else
+ if (thd.is_error())
+ {
+ /*
+ Copy the error message. Note that we don't treat fatal
+ errors in the delayed thread as fatal errors in the
+ main thread. If delayed thread was killed, we don't
+ want to send "Server shutdown in progress" in the
+ INSERT THREAD.
+
+ The thread could be killed with an error message if
+ di->handle_inserts() or di->open_and_lock_table() fails.
+ */
my_message(thd.get_stmt_da()->sql_errno(),
thd.get_stmt_da()->message(), MYF(0));
+ }
goto error;
}
}
@@ -2928,7 +2934,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
pthread_detach_this_thread();
/* Add thread to THD list so that's it's visible in 'show processlist' */
thd->set_start_time();
- add_to_active_threads(thd);
+ server_threads.insert(thd);
if (abort_loop)
thd->set_killed(KILL_CONNECTION);
else
@@ -3086,11 +3092,30 @@ pthread_handler_t handle_delayed_insert(void *arg)
mysql_mutex_unlock(&di->thd.mysys_var->mutex);
mysql_mutex_lock(&di->mutex);
}
+
+ /*
+ The code depends on that the following ASSERT always hold.
+ I don't want to accidently introduce and bugs in the following code
+ in this commit, so I leave the small cleaning up of the code to
+ a future commit
+ */
+ DBUG_ASSERT(thd->lock || di->stacked_inserts == 0);
+
DBUG_PRINT("delayed",
- ("thd->killed: %d di->tables_in_use: %d thd->lock: %d",
- thd->killed, di->tables_in_use, thd->lock != 0));
+ ("thd->killed: %d di->status: %d di->stacked_insert: %d di->tables_in_use: %d thd->lock: %d",
+ thd->killed, di->status, di->stacked_inserts, di->tables_in_use, thd->lock != 0));
- if (di->tables_in_use && ! thd->lock && !thd->killed)
+ /*
+ This is used to test see what happens if killed is sent before
+ we have time to handle the insert requests.
+ */
+ DBUG_EXECUTE_IF("write_delay_wakeup",
+ if (!thd->killed && di->stacked_inserts)
+ my_sleep(500000);
+ );
+
+ if (di->tables_in_use && ! thd->lock &&
+ (!thd->killed || di->stacked_inserts))
{
/*
Request for new delayed insert.
@@ -3648,20 +3673,24 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
&map);
lex->first_select_lex()->no_wrap_view_item= FALSE;
/*
- When we are not using GROUP BY and there are no ungrouped aggregate functions
- we can refer to other tables in the ON DUPLICATE KEY part.
- We use next_name_resolution_table descructively, so check it first (views?)
+ When we are not using GROUP BY and there are no ungrouped
+ aggregate functions we can refer to other tables in the ON
+ DUPLICATE KEY part. We use next_name_resolution_table
+ descructively, so check it first (views?)
*/
DBUG_ASSERT (!table_list->next_name_resolution_table);
if (lex->first_select_lex()->group_list.elements == 0 &&
!lex->first_select_lex()->with_sum_func)
+ {
/*
- We must make a single context out of the two separate name resolution contexts :
- the INSERT table and the tables in the SELECT part of INSERT ... SELECT.
- To do that we must concatenate the two lists
+ We must make a single context out of the two separate name
+ resolution contexts : the INSERT table and the tables in the
+ SELECT part of INSERT ... SELECT. To do that we must
+ concatenate the two lists
*/
table_list->next_name_resolution_table=
ctx_state.get_first_name_resolution_table();
+ }
res= res || setup_fields(thd, Ref_ptr_array(), *info.update_values,
MARK_COLUMNS_READ, 0, NULL, 0);
@@ -3762,9 +3791,9 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
void
DESCRIPTION
- If the result table is the same as one of the source tables (INSERT SELECT),
- the result table is not finally prepared at the join prepair phase.
- Do the final preparation now.
+ If the result table is the same as one of the source tables
+ (INSERT SELECT), the result table is not finally prepared at the
+ join prepair phase. Do the final preparation now.
RETURN
0 OK
@@ -3903,10 +3932,13 @@ bool select_insert::prepare_eof()
DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'",
trans_table, table->file->table_type()));
- error= (IF_WSREP((thd->wsrep_conflict_state == MUST_ABORT ||
- thd->wsrep_conflict_state == CERT_FAILURE) ? -1 :, )
- (thd->locked_tables_mode <= LTM_LOCK_TABLES ?
- table->file->ha_end_bulk_insert() : 0));
+#ifdef WITH_WSREP
+ error= (thd->wsrep_cs().current_error()) ? -1 :
+ (thd->locked_tables_mode <= LTM_LOCK_TABLES) ?
+#else
+ error= (thd->locked_tables_mode <= LTM_LOCK_TABLES) ?
+#endif /* WITH_WSREP */
+ table->file->ha_end_bulk_insert() : 0;
if (likely(!error) && unlikely(thd->is_error()))
error= thd->get_stmt_da()->sql_errno();
@@ -4389,8 +4421,6 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u)
thd->binlog_start_trans_and_stmt();
}
- DEBUG_SYNC(thd,"create_table_select_before_check_if_exists");
-
if (!(table= create_table_from_items(thd, &values, &extra_lock, hook_ptr)))
/* abort() deletes table */
DBUG_RETURN(-1);
@@ -4505,9 +4535,16 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
/* suppress_use */ FALSE,
errcode);
}
-
- ha_fake_trx_id(thd);
-
+#ifdef WITH_WSREP
+ if (thd->wsrep_trx().active())
+ {
+ WSREP_DEBUG("transaction already started for CTAS");
+ }
+ else
+ {
+ wsrep_start_transaction(thd, thd->wsrep_next_trx_id());
+ }
+#endif
return result;
}
@@ -4565,10 +4602,18 @@ bool select_create::send_eof()
if (!table->s->tmp_table)
{
#ifdef WITH_WSREP
- if (WSREP_ON)
+ if (WSREP(thd))
{
+ if (thd->wsrep_trx_id() == WSREP_UNDEFINED_TRX_ID)
+ {
+ wsrep_start_transaction(thd, thd->wsrep_next_trx_id());
+ }
+ DBUG_ASSERT(thd->wsrep_trx_id() != WSREP_UNDEFINED_TRX_ID);
+ WSREP_DEBUG("CTAS key append for trx: %lu thd %llu query %lld ",
+ thd->wsrep_trx_id(), thd->thread_id, thd->query_id);
+
/*
- append table level exclusive key for CTAS
+ append table level exclusive key for CTAS
*/
wsrep_key_arr_t key_arr= {0, 0};
wsrep_prepare_keys_for_isolation(thd,
@@ -4576,38 +4621,34 @@ bool select_create::send_eof()
create_table->table_name.str,
table_list,
&key_arr);
- int rcode = wsrep->append_key(
- wsrep,
- &thd->wsrep_ws_handle,
- key_arr.keys, //&wkey,
- key_arr.keys_len,
- WSREP_KEY_EXCLUSIVE,
- false);
+ int rcode= wsrep_thd_append_key(thd, key_arr.keys, key_arr.keys_len,
+ WSREP_SERVICE_KEY_EXCLUSIVE);
wsrep_keys_free(&key_arr);
- if (rcode) {
+ if (rcode)
+ {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
WSREP_ERROR("Appending table key for CTAS failed: %s, %d",
(wsrep_thd_query(thd)) ?
wsrep_thd_query(thd) : "void", rcode);
- return true;
+ DBUG_RETURN(true);
}
/* If commit fails, we should be able to reset the OK status. */
- thd->get_stmt_da()->set_overwrite_status(TRUE);
+ thd->get_stmt_da()->set_overwrite_status(true);
}
#endif /* WITH_WSREP */
trans_commit_stmt(thd);
if (!(thd->variables.option_bits & OPTION_GTID_BEGIN))
trans_commit_implicit(thd);
#ifdef WITH_WSREP
- if (WSREP_ON)
+ if (WSREP(thd))
{
thd->get_stmt_da()->set_overwrite_status(FALSE);
mysql_mutex_lock(&thd->LOCK_thd_data);
- if (thd->wsrep_conflict_state != NO_CONFLICT)
+ if (wsrep_current_error(thd))
{
- WSREP_DEBUG("select_create commit failed, thd: %lld err: %d %s",
- (longlong) thd->thread_id, thd->wsrep_conflict_state,
- thd->query());
+ WSREP_DEBUG("select_create commit failed, thd: %llu err: %s %s",
+ thd->thread_id,
+ wsrep_thd_transaction_state_str(thd), WSREP_QUERY(thd));
mysql_mutex_unlock(&thd->LOCK_thd_data);
abort_result_set();
DBUG_RETURN(true);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 2f5a845d18c..8e31f479d68 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -856,6 +856,32 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
DBUG_ASSERT(tok >= get_buf());
DBUG_ASSERT(tok < get_end_of_query());
+ if (m_thd->variables.sql_mode & MODE_ORACLE)
+ {
+ switch (symbol->tok) {
+ case BEGIN_MARIADB_SYM: return BEGIN_ORACLE_SYM;
+ case BLOB_MARIADB_SYM: return BLOB_ORACLE_SYM;
+ case BODY_MARIADB_SYM: return BODY_ORACLE_SYM;
+ case CLOB_MARIADB_SYM: return CLOB_ORACLE_SYM;
+ case CONTINUE_MARIADB_SYM: return CONTINUE_ORACLE_SYM;
+ case DECLARE_MARIADB_SYM: return DECLARE_ORACLE_SYM;
+ case DECODE_MARIADB_SYM: return DECODE_ORACLE_SYM;
+ case ELSEIF_MARIADB_SYM: return ELSEIF_ORACLE_SYM;
+ case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM;
+ case EXCEPTION_MARIADB_SYM: return EXCEPTION_ORACLE_SYM;
+ case EXIT_MARIADB_SYM: return EXIT_ORACLE_SYM;
+ case GOTO_MARIADB_SYM: return GOTO_ORACLE_SYM;
+ case NUMBER_MARIADB_SYM: return NUMBER_ORACLE_SYM;
+ case OTHERS_MARIADB_SYM: return OTHERS_ORACLE_SYM;
+ case PACKAGE_MARIADB_SYM: return PACKAGE_ORACLE_SYM;
+ case RAISE_MARIADB_SYM: return RAISE_ORACLE_SYM;
+ case RAW_MARIADB_SYM: return RAW_ORACLE_SYM;
+ case RETURN_MARIADB_SYM: return RETURN_ORACLE_SYM;
+ case ROWTYPE_MARIADB_SYM: return ROWTYPE_ORACLE_SYM;
+ case VARCHAR2_MARIADB_SYM: return VARCHAR2_ORACLE_SYM;
+ }
+ }
+
if ((symbol->tok == NOT_SYM) &&
(m_thd->variables.sql_mode & MODE_HIGH_NOT_PRECEDENCE))
return NOT2_SYM;
@@ -1470,6 +1496,12 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
}
/* Fall through */
case MY_LEX_CHAR: // Unknown or single char token
+ if (c == '%' && (m_thd->variables.sql_mode & MODE_ORACLE))
+ {
+ next_state= MY_LEX_START;
+ return PERCENT_ORACLE_SYM;
+ }
+ /* Fall through */
case MY_LEX_SKIP: // This should not happen
if (c != ')')
next_state= MY_LEX_START; // Allow signed numbers
@@ -1828,7 +1860,7 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
else
{
#ifdef WITH_WSREP
- if (WSREP(thd) && version == 99997 && thd->wsrep_exec_mode == LOCAL_STATE)
+ if (WSREP(thd) && version == 99997 && wsrep_thd_is_local(thd))
{
WSREP_DEBUG("consistency check: %s", thd->query());
thd->wsrep_consistency_check= CONSISTENCY_CHECK_DECLARED;
@@ -1908,8 +1940,13 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
case MY_LEX_SET_VAR: // Check if ':='
if (yyPeek() != '=')
{
- state= MY_LEX_CHAR; // Return ':'
- break;
+ next_state= MY_LEX_START;
+ if (m_thd->variables.sql_mode & MODE_ORACLE)
+ {
+ yylval->kwd.set_keyword(m_tok_start, 1);
+ return COLON_ORACLE_SYM;
+ }
+ return (int) ':';
}
yySkip();
return (SET_VAR);
@@ -3507,12 +3544,8 @@ void LEX::set_trg_event_type_for_tables()
On a LOCK TABLE, all triggers must be pre-loaded for this TABLE_LIST
when opening an associated TABLE.
*/
- new_trg_event_map= static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_INSERT)) |
- static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_UPDATE)) |
- static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_DELETE));
+ new_trg_event_map= trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_UPDATE) |
+ trg2bit(TRG_EVENT_DELETE);
break;
/*
Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE
@@ -3543,20 +3576,17 @@ void LEX::set_trg_event_type_for_tables()
*/
case SQLCOM_CREATE_TABLE:
case SQLCOM_CREATE_SEQUENCE:
- new_trg_event_map|= static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_INSERT));
+ new_trg_event_map|= trg2bit(TRG_EVENT_INSERT);
break;
/* Basic update and multi-update */
case SQLCOM_UPDATE: /* fall through */
case SQLCOM_UPDATE_MULTI:
- new_trg_event_map|= static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_UPDATE));
+ new_trg_event_map|= trg2bit(TRG_EVENT_UPDATE);
break;
/* Basic delete and multi-delete */
case SQLCOM_DELETE: /* fall through */
case SQLCOM_DELETE_MULTI:
- new_trg_event_map|= static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_DELETE));
+ new_trg_event_map|= trg2bit(TRG_EVENT_DELETE);
break;
default:
break;
@@ -3564,12 +3594,10 @@ void LEX::set_trg_event_type_for_tables()
switch (duplicates) {
case DUP_UPDATE:
- new_trg_event_map|= static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_UPDATE));
+ new_trg_event_map|= trg2bit(TRG_EVENT_UPDATE);
break;
case DUP_REPLACE:
- new_trg_event_map|= static_cast<uint8>
- (1 << static_cast<int>(TRG_EVENT_DELETE));
+ new_trg_event_map|= trg2bit(TRG_EVENT_DELETE);
break;
case DUP_ERROR:
default:
@@ -4101,6 +4129,7 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
inner_join->select_options|= SELECT_DESCRIBE;
}
res= inner_join->optimize();
+ sl->update_used_tables();
sl->update_correlated_cache();
is_correlated_unit|= sl->is_correlated;
inner_join->select_options= save_options;
@@ -5926,7 +5955,7 @@ bool LEX::sp_for_loop_implicit_cursor_statement(THD *thd,
return true;
DBUG_ASSERT(thd->lex == this);
bounds->m_direction= 1;
- bounds->m_upper_bound= NULL;
+ bounds->m_target_bound= NULL;
bounds->m_implicit_cursor= true;
return false;
}
@@ -5970,7 +5999,7 @@ bool LEX::sp_for_loop_condition(THD *thd, const Lex_for_loop_st &loop)
Item_splocal *args[2];
for (uint i= 0 ; i < 2; i++)
{
- sp_variable *src= i == 0 ? loop.m_index : loop.m_upper_bound;
+ sp_variable *src= i == 0 ? loop.m_index : loop.m_target_bound;
args[i]= new (thd->mem_root)
Item_splocal(thd, &sp_rcontext_handler_local,
&src->name, src->offset, src->type_handler());
@@ -6033,7 +6062,7 @@ bool LEX::sp_for_loop_intrange_declarations(THD *thd, Lex_for_loop_st *loop,
my_error(ER_SP_UNDECLARED_VAR, MYF(0), item->full_name());
return true;
}
- if ((item= bounds.m_upper_bound->get_item())->type() == Item::FIELD_ITEM)
+ if ((item= bounds.m_target_bound->get_item())->type() == Item::FIELD_ITEM)
{
// We're here is the upper bound is unknown identifier
my_error(ER_SP_UNDECLARED_VAR, MYF(0), item->full_name());
@@ -6043,11 +6072,11 @@ bool LEX::sp_for_loop_intrange_declarations(THD *thd, Lex_for_loop_st *loop,
bounds.m_index->sp_add_for_loop_variable(thd, index,
bounds.m_index->get_item())))
return true;
- if (unlikely(!(loop->m_upper_bound=
- bounds.m_upper_bound->
- sp_add_for_loop_upper_bound(thd,
- bounds.
- m_upper_bound->get_item()))))
+ if (unlikely(!(loop->m_target_bound=
+ bounds.m_target_bound->
+ sp_add_for_loop_target_bound(thd,
+ bounds.
+ m_target_bound->get_item()))))
return true;
loop->m_direction= bounds.m_direction;
loop->m_implicit_cursor= 0;
@@ -6110,7 +6139,7 @@ bool LEX::sp_for_loop_cursor_declarations(THD *thd,
bounds.m_index,
item_func_sp)))
return true;
- loop->m_upper_bound= NULL;
+ loop->m_target_bound= NULL;
loop->m_direction= bounds.m_direction;
loop->m_cursor_offset= coffs;
loop->m_implicit_cursor= bounds.m_implicit_cursor;
@@ -6916,6 +6945,30 @@ Item *LEX::make_item_colon_ident_ident(THD *thd,
}
+Item *LEX::make_item_plsql_cursor_attr(THD *thd, const LEX_CSTRING *name,
+ plsql_cursor_attr_t attr)
+{
+ uint offset;
+ if (unlikely(!spcont || !spcont->find_cursor(name, &offset, false)))
+ {
+ my_error(ER_SP_CURSOR_MISMATCH, MYF(0), name->str);
+ return NULL;
+ }
+ switch (attr) {
+ case PLSQL_CURSOR_ATTR_ISOPEN:
+ return new (thd->mem_root) Item_func_cursor_isopen(thd, name, offset);
+ case PLSQL_CURSOR_ATTR_FOUND:
+ return new (thd->mem_root) Item_func_cursor_found(thd, name, offset);
+ case PLSQL_CURSOR_ATTR_NOTFOUND:
+ return new (thd->mem_root) Item_func_cursor_notfound(thd, name, offset);
+ case PLSQL_CURSOR_ATTR_ROWCOUNT:
+ return new (thd->mem_root) Item_func_cursor_rowcount(thd, name, offset);
+ }
+ DBUG_ASSERT(0);
+ return NULL;
+}
+
+
Item *LEX::make_item_sysvar(THD *thd,
enum_var_type type,
const LEX_CSTRING *name,
@@ -9281,7 +9334,7 @@ bool LEX::parsed_insert_select(SELECT_LEX *first_select)
return true;
// fix "main" select
- SELECT_LEX *blt= pop_select();
+ SELECT_LEX *blt __attribute__((unused))= pop_select();
DBUG_ASSERT(blt == &builtin_select);
push_select(first_select);
return false;
@@ -9470,3 +9523,59 @@ bool SELECT_LEX::make_unique_derived_name(THD *thd, LEX_CSTRING *alias)
alias->str= thd->strmake(buff, alias->length);
return !alias->str;
}
+
+
+/*
+ Make a new sp_instr_stmt and set its m_query to a concatenation
+ of two strings.
+*/
+bool LEX::new_sp_instr_stmt(THD *thd,
+ const LEX_CSTRING &prefix,
+ const LEX_CSTRING &suffix)
+{
+ LEX_STRING qbuff;
+ sp_instr_stmt *i;
+
+ if (!(i= new (thd->mem_root) sp_instr_stmt(sphead->instructions(),
+ spcont, this)))
+ return true;
+
+ qbuff.length= prefix.length + suffix.length;
+ if (!(qbuff.str= (char*) alloc_root(thd->mem_root, qbuff.length + 1)))
+ return true;
+ memcpy(qbuff.str, prefix.str, prefix.length);
+ strmake(qbuff.str + prefix.length, suffix.str, suffix.length);
+ i->m_query= qbuff;
+ return sphead->add_instr(i);
+}
+
+
+bool LEX::sp_proc_stmt_statement_finalize_buf(THD *thd, const LEX_CSTRING &qbuf)
+{
+ sphead->m_flags|= sp_get_flags_for_command(this);
+ /* "USE db" doesn't work in a procedure */
+ if (unlikely(sql_command == SQLCOM_CHANGE_DB))
+ {
+ my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
+ return true;
+ }
+ /*
+ Don't add an instruction for SET statements, since all
+ instructions for them were already added during processing
+ of "set" rule.
+ */
+ DBUG_ASSERT(sql_command != SQLCOM_SET_OPTION || var_list.is_empty());
+ if (sql_command != SQLCOM_SET_OPTION)
+ return new_sp_instr_stmt(thd, empty_clex_str, qbuf);
+ return false;
+}
+
+
+bool LEX::sp_proc_stmt_statement_finalize(THD *thd, bool no_lookahead)
+{
+ // Extract the query statement from the tokenizer
+ Lex_input_stream *lip= &thd->m_parser_state->m_lip;
+ Lex_cstring qbuf(sphead->m_tmp_query, no_lookahead ? lip->get_ptr() :
+ lip->get_tok_start());
+ return LEX::sp_proc_stmt_statement_finalize_buf(thd, qbuf);
+}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 8dab2a06973..c22f95978a0 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -207,6 +207,16 @@ enum enum_view_suid
VIEW_SUID_DEFAULT= 2
};
+
+enum plsql_cursor_attr_t
+{
+ PLSQL_CURSOR_ATTR_ISOPEN,
+ PLSQL_CURSOR_ATTR_FOUND,
+ PLSQL_CURSOR_ATTR_NOTFOUND,
+ PLSQL_CURSOR_ATTR_ROWCOUNT
+};
+
+
/* These may not be declared yet */
class Table_ident;
class sql_exchange;
@@ -3129,6 +3139,7 @@ public:
uint profile_query_id;
uint profile_options;
uint grant, grant_tot_col, which_columns;
+ enum backup_stages backup_stage;
enum Foreign_key::fk_match_opt fk_match_option;
enum_fk_option fk_update_opt;
enum_fk_option fk_delete_opt;
@@ -3427,12 +3438,17 @@ public:
void pop_context()
{
DBUG_ENTER("LEX::pop_context");
- Name_resolution_context *context= context_stack.pop();
+#ifndef DBUG_OFF
+ Name_resolution_context *context=
+#endif
+ context_stack.pop();
+
DBUG_PRINT("info", ("Pop context %p Select: %p (%d)",
context, context->select_lex,
(context->select_lex ?
context->select_lex->select_number:
0)));
+
DBUG_VOID_RETURN;
}
@@ -3558,6 +3574,11 @@ public:
bool last_field_generated_always_as_row_end();
bool set_bincmp(CHARSET_INFO *cs, bool bin);
+ bool new_sp_instr_stmt(THD *, const LEX_CSTRING &prefix,
+ const LEX_CSTRING &suffix);
+ bool sp_proc_stmt_statement_finalize_buf(THD *, const LEX_CSTRING &qbuf);
+ bool sp_proc_stmt_statement_finalize(THD *, bool no_lookahead);
+
bool get_dynamic_sql_string(LEX_CSTRING *dst, String *buffer);
bool prepared_stmt_params_fix_fields(THD *thd)
{
@@ -3873,6 +3894,10 @@ public:
Item *make_item_colon_ident_ident(THD *thd,
const Lex_ident_cli_st *a,
const Lex_ident_cli_st *b);
+ // PLSQL: cursor%ISOPEN etc
+ Item *make_item_plsql_cursor_attr(THD *thd, const LEX_CSTRING *name,
+ plsql_cursor_attr_t attr);
+
// For "SELECT @@var", "SELECT @@var.field"
Item *make_item_sysvar(THD *thd,
enum_var_type type,
@@ -3953,9 +3978,9 @@ public:
/* Integer range FOR LOOP methods */
sp_variable *sp_add_for_loop_variable(THD *thd, const LEX_CSTRING *name,
Item *value);
- sp_variable *sp_add_for_loop_upper_bound(THD *thd, Item *value)
+ sp_variable *sp_add_for_loop_target_bound(THD *thd, Item *value)
{
- LEX_CSTRING name= { STRING_WITH_LEN("[upper_bound]") };
+ LEX_CSTRING name= { STRING_WITH_LEN("[target_bound]") };
return sp_add_for_loop_variable(thd, &name, value);
}
bool sp_for_loop_intrange_declarations(THD *thd, Lex_for_loop_st *loop,
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index dd6e723c953..c95ef72a308 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -42,6 +42,8 @@
#include "sql_derived.h"
#include "sql_show.h"
+#include "wsrep_mysqld.h"
+
extern "C" int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t Count);
class XML_TAG {
@@ -106,7 +108,7 @@ static bool wsrep_load_data_split(THD *thd, const TABLE *table,
{
DBUG_ENTER("wsrep_load_data_split");
- if (!wsrep_load_data_splitting || !wsrep_on(thd)
+ if (!wsrep_load_data_splitting || !WSREP(thd)
|| !info.records || (info.records % 10000)
|| !thd->transaction.stmt.ha_list
|| thd->transaction.stmt.ha_list->ht() != binlog_hton
@@ -116,13 +118,10 @@ static bool wsrep_load_data_split(THD *thd, const TABLE *table,
if (handlerton* hton= thd->transaction.stmt.ha_list->next()->ht())
{
- if (hton->db_type != DB_TYPE_INNODB)
+ if (!(hton->flags & HTON_WSREP_REPLICATION))
DBUG_RETURN(false);
WSREP_DEBUG("intermediate transaction commit in LOAD DATA");
- if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true);
- if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true);
- wsrep_post_commit(thd, true);
- hton->commit(hton, thd, true);
+ wsrep_tc_log_commit(thd);
table->file->extra(HA_EXTRA_FAKE_START_STMT);
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 1f9cd305847..7360ecb62da 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -111,13 +111,16 @@
#include "wsrep.h"
#include "wsrep_mysqld.h"
+#ifdef WITH_WSREP
#include "wsrep_thd.h"
+#include "wsrep_trans_observer.h" /* wsrep transaction hooks */
-static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
+static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state,
bool is_com_multi,
bool is_next_command);
+#endif /* WITH_WSREP */
/**
@defgroup Runtime_Environment Runtime Environment
@{
@@ -566,7 +569,7 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_CREATE_PACKAGE_BODY]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_DROP_PACKAGE_BODY]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_ALTER_DB_UPGRADE]= CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_DB_CHANGE;
sql_command_flags[SQLCOM_RENAME_TABLE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_DROP_INDEX]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_REPORT_PROGRESS;
sql_command_flags[SQLCOM_CREATE_VIEW]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
@@ -603,7 +606,8 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_DELETE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
- CF_CAN_BE_EXPLAINED;
+ CF_CAN_BE_EXPLAINED |
+ CF_SP_BULK_SAFE;
sql_command_flags[SQLCOM_DELETE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
@@ -770,6 +774,8 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_CREATE_SERVER]= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_ALTER_SERVER]= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_DROP_SERVER]= CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_BACKUP]= CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_BACKUP_LOCK]= 0;
/*
The following statements can deal with temporary tables,
@@ -881,6 +887,16 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_REVOKE_ALL]|= CF_DISALLOW_IN_RO_TRANS;
sql_command_flags[SQLCOM_INSTALL_PLUGIN]|= CF_DISALLOW_IN_RO_TRANS;
sql_command_flags[SQLCOM_UNINSTALL_PLUGIN]|= CF_DISALLOW_IN_RO_TRANS;
+#ifdef WITH_WSREP
+ /*
+ Statements for which some errors are ignored when
+ wsrep_ignore_apply_errors = WSREP_IGNORE_ERRORS_ON_RECONCILING_DDL
+ */
+ sql_command_flags[SQLCOM_DROP_DB]|= CF_WSREP_MAY_IGNORE_ERRORS;
+ sql_command_flags[SQLCOM_DROP_TABLE]|= CF_WSREP_MAY_IGNORE_ERRORS;
+ sql_command_flags[SQLCOM_DROP_INDEX]|= CF_WSREP_MAY_IGNORE_ERRORS;
+ sql_command_flags[SQLCOM_ALTER_TABLE]|= CF_WSREP_MAY_IGNORE_ERRORS;
+#endif /* WITH_WSREP */
}
bool sqlcom_can_generate_row_events(const THD *thd)
@@ -963,15 +979,28 @@ static char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error
}
-static void handle_bootstrap_impl(THD *thd)
+void bootstrap(MYSQL_FILE *file)
{
- MYSQL_FILE *file= bootstrap_file;
- DBUG_ENTER("handle_bootstrap_impl");
+ DBUG_ENTER("handle_bootstrap");
+
+ THD *thd= new THD(next_thread_id());
+#ifdef WITH_WSREP
+ thd->variables.wsrep_on= 0;
+#endif
+ thd->bootstrap=1;
+ my_net_init(&thd->net,(st_vio*) 0, thd, MYF(0));
+ thd->max_client_packet_length= thd->net.max_packet;
+ thd->security_ctx->master_access= ~(ulong)0;
#ifndef EMBEDDED_LIBRARY
- pthread_detach_this_thread();
+ mysql_thread_set_psi_id(thd->thread_id);
+#else
+ thd->mysql= 0;
+#endif
+
+ /* The following must be called before DBUG_ENTER */
thd->thread_stack= (char*) &thd;
-#endif /* EMBEDDED_LIBRARY */
+ thd->store_globals();
thd->security_ctx->user= (char*) my_strdup("boot", MYF(MY_WME));
thd->security_ctx->priv_user[0]= thd->security_ctx->priv_host[0]=
@@ -1048,10 +1077,6 @@ static void handle_bootstrap_impl(THD *thd)
thd->profiling.set_query_source(thd->query(), length);
#endif
- /*
- We don't need to obtain LOCK_thread_count here because in bootstrap
- mode we have only one thread.
- */
thd->set_time();
Parser_state parser_state;
if (parser_state.init(thd, thd->query(), length))
@@ -1079,56 +1104,8 @@ static void handle_bootstrap_impl(THD *thd)
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
thd->lex->restore_set_statement_var();
}
-
- DBUG_VOID_RETURN;
-}
-
-
-/**
- Execute commands from bootstrap_file.
-
- Used when creating the initial grant tables.
-*/
-
-pthread_handler_t handle_bootstrap(void *arg)
-{
- THD *thd=(THD*) arg;
-
- mysql_thread_set_psi_id(thd->thread_id);
-
- do_handle_bootstrap(thd);
- return 0;
-}
-
-void do_handle_bootstrap(THD *thd)
-{
- /* The following must be called before DBUG_ENTER */
- thd->thread_stack= (char*) &thd;
- if (my_thread_init() || thd->store_globals())
- {
-#ifndef EMBEDDED_LIBRARY
- close_connection(thd, ER_OUT_OF_RESOURCES);
-#endif
- thd->fatal_error();
- goto end;
- }
-
- handle_bootstrap_impl(thd);
-
-end:
delete thd;
-
- mysql_mutex_lock(&LOCK_thread_count);
- in_bootstrap = FALSE;
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
-
-#ifndef EMBEDDED_LIBRARY
- my_thread_end();
- pthread_exit(0);
-#endif
-
- return;
+ DBUG_VOID_RETURN;
}
@@ -1180,10 +1157,8 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
{
for (const TABLE_LIST *table= tables; table; table= table->next_global)
{
- TABLE_CATEGORY c;
LEX_CSTRING db= table->db, tn= table->table_name;
- c= get_table_category(&db, &tn);
- if (c != TABLE_CATEGORY_INFORMATION && c != TABLE_CATEGORY_PERFORMANCE)
+ if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION)
return false;
}
return true;
@@ -1207,28 +1182,11 @@ bool do_command(THD *thd)
{
bool return_value;
char *packet= 0;
-#ifdef WITH_WSREP
- ulong packet_length= 0; // just to avoid (false positive) compiler warning
-#else
ulong packet_length;
-#endif /* WITH_WSREP */
NET *net= &thd->net;
enum enum_server_command command;
DBUG_ENTER("do_command");
-#ifdef WITH_WSREP
- if (WSREP(thd))
- {
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_IDLE;
- if (thd->wsrep_conflict_state==MUST_ABORT)
- {
- wsrep_client_rollback(thd);
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-#endif /* WITH_WSREP */
-
/*
indicator of uninitialized lex => normal flow of errors handling
(see my_message_sql)
@@ -1269,29 +1227,6 @@ bool do_command(THD *thd)
DEBUG_SYNC(thd, "before_do_command_net_read");
packet_length= my_net_read_packet(net, 1);
-#ifdef WITH_WSREP
- if (WSREP(thd)) {
- mysql_mutex_lock(&thd->LOCK_thd_data);
-
- /* these THD's are aborted or are aborting during being idle */
- if (thd->wsrep_conflict_state == ABORTING)
- {
- while (thd->wsrep_conflict_state == ABORTING) {
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- my_sleep(1000);
- mysql_mutex_lock(&thd->LOCK_thd_data);
- }
- thd->store_globals();
- }
- else if (thd->wsrep_conflict_state == ABORTED)
- {
- thd->store_globals();
- }
-
- thd->wsrep_query_state= QUERY_EXEC;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-#endif /* WITH_WSREP */
if (unlikely(packet_length == packet_error))
{
@@ -1299,20 +1234,6 @@ bool do_command(THD *thd)
net->error,
vio_description(net->vio)));
-#ifdef WITH_WSREP
- if (WSREP(thd))
- {
- mysql_mutex_lock(&thd->LOCK_thd_data);
- if (thd->wsrep_conflict_state == MUST_ABORT)
- {
- DBUG_PRINT("wsrep",("aborted for wsrep rollback: %lu",
- (ulong) thd->real_id));
- wsrep_client_rollback(thd);
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-#endif /* WITH_WSREP */
-
/* Instrument this broken statement as "statement/com/error" */
thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
com_statement_info[COM_END].
@@ -1363,13 +1284,52 @@ bool do_command(THD *thd)
command= fetch_command(thd, packet);
#ifdef WITH_WSREP
+ /*
+ Aborted by background rollbacker thread.
+ Handle error here and jump straight to out
+ */
+ if (wsrep_before_command(thd))
+ {
+ thd->store_globals();
+ WSREP_LOG_THD(thd, "enter found BF aborted");
+ DBUG_ASSERT(!thd->mdl_context.has_locks());
+ DBUG_ASSERT(!thd->get_stmt_da()->is_set());
+ /* We let COM_QUIT and COM_STMT_CLOSE to execute even if wsrep aborted. */
+ if (command != COM_STMT_CLOSE &&
+ command != COM_QUIT)
+ {
+ my_error(ER_LOCK_DEADLOCK, MYF(0));
+ WSREP_DEBUG("Deadlock error for: %s", thd->query());
+ thd->reset_killed();
+ thd->mysys_var->abort = 0;
+ thd->wsrep_retry_counter = 0;
+
+ /* Instrument this broken statement as "statement/com/error" */
+ thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
+ com_statement_info[COM_END].
+ m_key);
+
+ thd->protocol->end_statement();
+
+ /* Mark the statement completed. */
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
+ return_value= FALSE;
+
+ wsrep_after_command_before_result(thd);
+ goto out;
+ }
+ }
+
if (WSREP(thd))
{
/*
- Bail out if DB snapshot has not been installed.
- */
- if (!thd->wsrep_applier &&
- (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) &&
+ * bail out if DB snapshot has not been installed. We however,
+ * allow queries "SET" and "SHOW", they are trapped later in execute_command
+ */
+ if (!(thd->wsrep_applier) &&
+ (!wsrep_ready_get() || wsrep_reject_queries != WSREP_REJECT_NONE) &&
(server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0)
{
my_message(ER_UNKNOWN_COM_ERROR,
@@ -1382,11 +1342,11 @@ bool do_command(THD *thd)
thd->m_digest= NULL;
return_value= FALSE;
+ wsrep_after_command_before_result(thd);
goto out;
}
}
-#endif
-
+#endif /* WITH_WSREP */
/* Restore read timeout value */
my_net_set_read_timeout(net, thd->variables.net_read_timeout);
@@ -1394,37 +1354,6 @@ bool do_command(THD *thd)
DBUG_ASSERT(!thd->apc_target.is_enabled());
return_value= dispatch_command(command, thd, packet+1,
(uint) (packet_length-1), FALSE, FALSE);
-#ifdef WITH_WSREP
- if (WSREP(thd))
- {
- while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
- {
- WSREP_DEBUG("Retry autocommit for: %s\n", thd->wsrep_retry_query);
- CHARSET_INFO *current_charset = thd->variables.character_set_client;
- if (!is_supported_parser_charset(current_charset))
- {
- /* Do not use non-supported parser character sets */
- WSREP_WARN("Current client character set is non-supported parser "
- "character set: %s", current_charset->csname);
- thd->variables.character_set_client = &my_charset_latin1;
- WSREP_WARN("For retry temporally setting character set to : %s",
- my_charset_latin1.csname);
- }
- thd->clear_error();
- return_value= dispatch_command(command, thd, thd->wsrep_retry_query,
- thd->wsrep_retry_query_len, FALSE, FALSE);
- thd->variables.character_set_client = current_charset;
- }
-
- if (thd->wsrep_retry_query && thd->wsrep_conflict_state != REPLAYING)
- {
- my_free(thd->wsrep_retry_query);
- thd->wsrep_retry_query = NULL;
- thd->wsrep_retry_query_len = 0;
- thd->wsrep_retry_command = COM_CONNECT;
- }
- }
-#endif /* WITH_WSREP */
DBUG_ASSERT(!thd->apc_target.is_enabled());
out:
@@ -1432,6 +1361,13 @@ out:
/* The statement instrumentation must be closed in all cases. */
DBUG_ASSERT(thd->m_digest == NULL);
DBUG_ASSERT(thd->m_statement_psi == NULL);
+#ifdef WITH_WSREP
+ if (packet_length != packet_error)
+ {
+ /* there was a command to process, and before_command() has been called */
+ wsrep_after_command_after_result(thd);
+ }
+#endif /* WITH_WSREP */
DBUG_RETURN(return_value);
}
#endif /* EMBEDDED_LIBRARY */
@@ -1486,7 +1422,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
if (lex->sql_command == SQLCOM_DROP_TABLE && lex->tmp_table())
DBUG_RETURN(FALSE);
- /* Check if we created or dropped databases */
+ /* Check if we created, dropped, or renamed a database */
if ((sql_command_flags[lex->sql_command] & CF_DB_CHANGE))
DBUG_RETURN(TRUE);
@@ -1497,6 +1433,36 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
DBUG_RETURN(FALSE);
}
+#ifdef WITH_WSREP
+static my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables)
+{
+ int opt_readonly_saved = opt_readonly;
+ ulong flag_saved = (ulong)(thd->security_ctx->master_access & SUPER_ACL);
+
+ opt_readonly = 0;
+ thd->security_ctx->master_access &= ~SUPER_ACL;
+
+ my_bool ret = !deny_updates_if_read_only_option(thd, all_tables);
+
+ opt_readonly = opt_readonly_saved;
+ thd->security_ctx->master_access |= flag_saved;
+
+ return ret;
+}
+
+static void wsrep_copy_query(THD *thd)
+{
+ thd->wsrep_retry_command = thd->get_command();
+ thd->wsrep_retry_query_len = thd->query_length();
+ if (thd->wsrep_retry_query) {
+ my_free(thd->wsrep_retry_query);
+ }
+ thd->wsrep_retry_query = (char *)my_malloc(
+ thd->wsrep_retry_query_len + 1, MYF(0));
+ strncpy(thd->wsrep_retry_query, thd->query(), thd->wsrep_retry_query_len);
+ thd->wsrep_retry_query[thd->wsrep_retry_query_len] = '\0';
+}
+#endif /* WITH_WSREP */
/**
check COM_MULTI packet
@@ -1579,41 +1545,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* keep it withing 1 byte */
compile_time_assert(COM_END == 255);
-#ifdef WITH_WSREP
- if (WSREP(thd))
- {
- if (!thd->in_multi_stmt_transaction_mode())
- {
- thd->wsrep_PA_safe= true;
- }
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_EXEC;
- if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
- {
- thd->wsrep_conflict_state= NO_CONFLICT;
- }
- if (thd->wsrep_conflict_state== MUST_ABORT)
- {
- wsrep_client_rollback(thd);
- }
- /* We let COM_QUIT and COM_STMT_CLOSE to execute even if wsrep aborted. */
- if (thd->wsrep_conflict_state == ABORTED &&
- command != COM_STMT_CLOSE && command != COM_QUIT)
- {
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- my_message(ER_LOCK_DEADLOCK, "Deadlock: wsrep aborted transaction",
- MYF(0));
- WSREP_DEBUG("Deadlock error for: %s", thd->query());
- thd->reset_killed();
- thd->mysys_var->abort = 0;
- thd->wsrep_conflict_state = NO_CONFLICT;
- thd->wsrep_retry_counter = 0;
- goto dispatch_end;
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-#endif /* WITH_WSREP */
#if defined(ENABLED_PROFILING)
thd->profiling.start_new_query();
#endif
@@ -1660,6 +1591,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
thd->set_query_id(get_query_id());
}
+#ifdef WITH_WSREP
+ if (WSREP(thd) && thd->wsrep_next_trx_id() == WSREP_UNDEFINED_TRX_ID)
+ {
+ thd->set_wsrep_next_trx_id(thd->query_id);
+ WSREP_DEBUG("assigned new next trx id: %lu", thd->wsrep_next_trx_id());
+ }
+#endif /* WITH_WSREP */
if (!(server_command_flags[command] & CF_SKIP_QUESTIONS))
statistic_increment(thd->status_var.questions, &LOCK_status);
@@ -1843,10 +1781,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (unlikely(parser_state.init(thd, thd->query(), thd->query_length())))
break;
+#ifdef WITH_WSREP
if (WSREP_ON)
- wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
- is_com_multi, is_next_command);
+ {
+ if (wsrep_mysql_parse(thd, thd->query(), thd->query_length(),
+ &parser_state,
+ is_com_multi, is_next_command))
+ {
+ WSREP_DEBUG("Deadlock error for: %s", thd->query());
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ thd->killed = NOT_KILLED;
+ thd->mysys_var->abort = 0;
+ thd->wsrep_retry_counter = 0;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ goto dispatch_end;
+ }
+ }
else
+#endif /* WITH_WSREP */
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
is_com_multi, is_next_command);
@@ -1928,17 +1880,32 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
statistic_increment(thd->status_var.questions, &LOCK_status);
- if(!WSREP(thd))
- thd->set_time(); /* Reset the query start time. */
+ if (!WSREP(thd))
+ thd->set_time(); /* Reset the query start time. */
parser_state.reset(beginning_of_next_stmt, length);
+#ifdef WITH_WSREP
if (WSREP_ON)
- wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state,
- is_com_multi, is_next_command);
+ {
+ if (wsrep_mysql_parse(thd, beginning_of_next_stmt,
+ length, &parser_state,
+ is_com_multi, is_next_command))
+ {
+ WSREP_DEBUG("Deadlock error for: %s", thd->query());
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ thd->killed = NOT_KILLED;
+ thd->mysys_var->abort = 0;
+ thd->wsrep_retry_counter = 0;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+
+ goto dispatch_end;
+ }
+ }
else
- mysql_parse(thd, beginning_of_next_stmt, length, &parser_state,
- is_com_multi, is_next_command);
+#endif /* WITH_WSREP */
+ mysql_parse(thd, beginning_of_next_stmt, length, &parser_state,
+ is_com_multi, is_next_command);
}
@@ -2131,6 +2098,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_EXECUTE_IF("simulate_detached_thread_refresh", debug_simulate= TRUE;);
if (debug_simulate)
{
+ /* This code doesn't work under FTWRL */
+ DBUG_ASSERT(! (options & REFRESH_READ_LOCK));
/*
Simulate a reload without a attached thread session.
Provides a environment similar to that of when the
@@ -2373,7 +2342,26 @@ com_multi_end:
#ifdef WITH_WSREP
dispatch_end:
-
+ /*
+ BF aborted before sending response back to client
+ */
+ if (thd->killed == KILL_QUERY)
+ {
+ WSREP_DEBUG("THD is killed at dispatch_end");
+ }
+ wsrep_after_command_before_result(thd);
+ if (wsrep_current_error(thd) &&
+ !(command == COM_STMT_PREPARE ||
+ command == COM_STMT_FETCH ||
+ command == COM_STMT_SEND_LONG_DATA ||
+ command == COM_STMT_CLOSE
+ ))
+ {
+ /* todo: Pass wsrep client state current error to override */
+ wsrep_override_error(thd, wsrep_current_error(thd),
+ wsrep_current_error_status(thd));
+ WSREP_LOG_THD(thd, "leave");
+ }
if (WSREP(thd))
{
/*
@@ -2384,8 +2372,10 @@ com_multi_end:
|| thd->get_stmt_da()->is_disabled());
/* wsrep BF abort in query exec phase */
mysql_mutex_lock(&thd->LOCK_thd_data);
- do_end_of_statement= thd->wsrep_conflict_state != REPLAYING &&
- thd->wsrep_conflict_state != RETRY_AUTOCOMMIT;
+ do_end_of_statement=
+ thd->wsrep_trx().state() != wsrep::transaction::s_replaying
+ && !thd->killed;
+
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
else
@@ -3419,7 +3409,7 @@ mysql_execute_command(THD *thd)
} /* endif unlikely slave */
#endif
#ifdef WITH_WSREP
- if (wsrep && WSREP(thd))
+ if (WSREP(thd))
{
/*
change LOCK TABLE WRITE to transaction
@@ -3449,8 +3439,8 @@ mysql_execute_command(THD *thd)
* allow SET and SHOW queries and reads from information schema
* and dirty reads (if configured)
*/
- if (!thd->wsrep_applier &&
- !(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) &&
+ if (!(thd->wsrep_applier) &&
+ !(wsrep_ready_get() && wsrep_reject_queries == WSREP_REJECT_NONE) &&
!(thd->variables.wsrep_dirty_reads &&
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
!wsrep_tables_accessible_when_detached(all_tables) &&
@@ -3615,7 +3605,7 @@ mysql_execute_command(THD *thd)
not run in it's own transaction it may simply never appear on
the slave in case the outside transaction rolls back.
*/
- if (stmt_causes_implicit_commit(thd, CF_IMPLICT_COMMIT_BEGIN))
+ if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_BEGIN))
{
/*
Note that this should never happen inside of stored functions
@@ -3638,6 +3628,13 @@ mysql_execute_command(THD *thd)
}
}
thd->transaction.stmt.mark_trans_did_ddl();
+#ifdef WITH_WSREP
+ /* Clean up the previous transaction on implicit commit */
+ if (wsrep_thd_is_local(thd) && wsrep_after_statement(thd))
+ {
+ goto error;
+ }
+#endif /* WITH_WSREP */
}
#ifndef DBUG_OFF
@@ -3686,6 +3683,33 @@ mysql_execute_command(THD *thd)
/* Start timeouts */
thd->set_query_timer();
+#ifdef WITH_WSREP
+ /*
+ Always start a new transaction for a wsrep THD unless the
+ current command is DDL or explicit BEGIN. This will guarantee that
+ the THD is BF abortable even if it does not generate any
+ changes and takes only read locks. If the statement does not
+ start a multi STMT transaction, the wsrep_transaction is
+ committed as empty at the end of this function.
+
+ Transaction is started for BEGIN in trans_begin(), for DDL the
+ implicit commit took care of committing previous transaction
+ above and a new transaction should not be started.
+
+ Do not start transaction for stored procedures, it will be handled
+ internally in SP processing.
+ */
+ if (WSREP(thd) &&
+ wsrep_thd_is_local(thd) &&
+ lex->sql_command != SQLCOM_BEGIN &&
+ lex->sql_command != SQLCOM_CALL &&
+ lex->sql_command != SQLCOM_EXECUTE &&
+ !(sql_command_flags[lex->sql_command] & CF_AUTO_COMMIT_TRANS))
+ {
+ wsrep_start_trx_if_not_started(thd);
+ }
+#endif /* WITH_WSREP */
+
switch (lex->sql_command) {
case SQLCOM_SHOW_EVENTS:
@@ -3745,12 +3769,16 @@ mysql_execute_command(THD *thd)
case SQLCOM_SHOW_STORAGE_ENGINES:
case SQLCOM_SHOW_PROFILE:
case SQLCOM_SELECT:
- {
+ {
#ifdef WITH_WSREP
- if (lex->sql_command == SQLCOM_SELECT)
- WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_READ)
- else
- WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW)
+ if (lex->sql_command == SQLCOM_SELECT)
+ {
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_READ);
+ }
+ else
+ {
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW);
+ }
#endif /* WITH_WSREP */
thd->status_var.last_query_cost= 0.0;
@@ -4185,11 +4213,7 @@ mysql_execute_command(THD *thd)
goto end_with_restore_list;
}
- /* Copy temporarily the statement flags to thd for lock_table_names() */
- uint save_thd_create_info_options= thd->lex->create_info.options;
- thd->lex->create_info.options|= create_info.options;
res= open_and_lock_tables(thd, create_info, lex->query_tables, TRUE, 0);
- thd->lex->create_info.options= save_thd_create_info_options;
if (unlikely(res))
{
/* Got error or warning. Set res to 1 if error */
@@ -4555,9 +4579,7 @@ end_with_restore_list:
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE);
ha_rows found= 0, updated= 0;
DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (WSREP_CLIENT(thd) &&
- wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE))
- goto error;
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE);
if (update_precheck(thd, all_tables))
break;
@@ -4706,9 +4728,7 @@ end_with_restore_list:
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE);
DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (WSREP_CLIENT(thd) &&
- wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE))
- goto error;
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE);
/*
Since INSERT DELAYED doesn't support temporary tables, we could
@@ -4766,9 +4786,7 @@ end_with_restore_list:
select_insert *sel_result;
bool explain= MY_TEST(lex->describe);
DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (WSREP_CLIENT(thd) &&
- wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE))
- goto error;
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE);
if ((res= insert_precheck(thd, all_tables)))
break;
@@ -4888,9 +4906,7 @@ end_with_restore_list:
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE);
select_result *sel_result=lex->result;
DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (WSREP_CLIENT(thd) &&
- wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE))
- goto error;
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE);
if ((res= delete_precheck(thd, all_tables)))
break;
@@ -4950,9 +4966,7 @@ end_with_restore_list:
DBUG_ASSERT(first_table == all_tables && first_table != 0);
TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
multi_delete *result;
- if (WSREP_CLIENT(thd) &&
- wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE))
- goto error;
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE);
if ((res= multi_delete_precheck(thd, all_tables)))
break;
@@ -5173,7 +5187,8 @@ end_with_restore_list:
thd->mdl_context.release_transactional_locks();
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
}
- if (thd->global_read_lock.is_acquired())
+ if (thd->global_read_lock.is_acquired() &&
+ thd->current_backup_stage == BACKUP_FINISHED)
thd->global_read_lock.unlock_global_read_lock(thd);
if (res)
goto error;
@@ -5188,6 +5203,13 @@ end_with_restore_list:
if (res)
goto error;
+ /* We can't have any kind of table locks while backup is active */
+ if (thd->current_backup_stage != BACKUP_FINISHED)
+ {
+ my_error(ER_BACKUP_LOCK_IS_ACTIVE, MYF(0));
+ goto error;
+ }
+
/*
Here we have to pre-open temporary tables for LOCK TABLES.
@@ -5220,6 +5242,23 @@ end_with_restore_list:
my_ok(thd);
}
break;
+ case SQLCOM_BACKUP:
+ if (check_global_access(thd, RELOAD_ACL))
+ goto error;
+ if (!(res= run_backup_stage(thd, lex->backup_stage)))
+ my_ok(thd);
+ break;
+ case SQLCOM_BACKUP_LOCK:
+ if (check_global_access(thd, RELOAD_ACL))
+ goto error;
+ /* first table is set for lock. For unlock the list is empty */
+ if (first_table)
+ res= backup_lock(thd, first_table);
+ else
+ backup_unlock(thd);
+ if (!res)
+ my_ok(thd);
+ break;
case SQLCOM_CREATE_DB:
{
if (prepare_db_action(thd, lex->create_info.or_replace() ?
@@ -5768,6 +5807,7 @@ end_with_restore_list:
thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("BEGIN failed, MDL released: %lld",
(longlong) thd->thread_id);
+ WSREP_DEBUG("stmt_da, sql_errno: %d", (thd->get_stmt_da()->is_error()) ? thd->get_stmt_da()->sql_errno() : 0);
goto error;
}
my_ok(thd);
@@ -5807,20 +5847,7 @@ end_with_restore_list:
thd->set_killed(KILL_CONNECTION);
thd->print_aborted_warning(3, "RELEASE");
}
-#ifdef WITH_WSREP
- if (WSREP(thd)) {
-
- if (thd->wsrep_conflict_state == NO_CONFLICT ||
- thd->wsrep_conflict_state == REPLAYING)
- {
- my_ok(thd);
- }
- } else {
-#endif /* WITH_WSREP */
- my_ok(thd);
-#ifdef WITH_WSREP
- }
-#endif /* WITH_WSREP */
+ my_ok(thd);
break;
}
case SQLCOM_ROLLBACK:
@@ -5856,17 +5883,7 @@ end_with_restore_list:
/* Disconnect the current client connection. */
if (tx_release)
thd->set_killed(KILL_CONNECTION);
-#ifdef WITH_WSREP
- if (WSREP(thd)) {
- if (thd->wsrep_conflict_state == NO_CONFLICT) {
- my_ok(thd);
- }
- } else {
-#endif /* WITH_WSREP */
- my_ok(thd);
-#ifdef WITH_WSREP
- }
-#endif /* WITH_WSREP */
+ my_ok(thd);
break;
}
case SQLCOM_RELEASE_SAVEPOINT:
@@ -6313,7 +6330,6 @@ finish:
DBUG_ASSERT(!thd->in_active_multi_stmt_transaction() ||
thd->in_multi_stmt_transaction_mode());
-
lex->unit.cleanup();
/* close/reopen tables that were marked to need reopen under LOCK TABLES */
@@ -6339,25 +6355,6 @@ finish:
THD_STAGE_INFO(thd, stage_rollback);
trans_rollback_stmt(thd);
}
-#ifdef WITH_WSREP
- if (thd->spcont &&
- (thd->wsrep_conflict_state == MUST_ABORT ||
- thd->wsrep_conflict_state == ABORTED ||
- thd->wsrep_conflict_state == CERT_FAILURE))
- {
- /*
- The error was cleared, but THD was aborted by wsrep and
- wsrep_conflict_state is still set accordingly. This
- situation is expected if we are running a stored procedure
- that declares a handler that catches ER_LOCK_DEADLOCK error.
- In which case the error may have been cleared in method
- sp_rcontext::handle_sql_condition().
- */
- trans_rollback_stmt(thd);
- thd->wsrep_conflict_state= NO_CONFLICT;
- thd->killed= NOT_KILLED;
- }
-#endif /* WITH_WSREP */
else
{
/* If commit fails, we should be able to reset the OK status. */
@@ -6373,9 +6370,6 @@ finish:
/* Free tables. Set stage 'closing tables' */
close_thread_tables(thd);
-#ifdef WITH_WSREP
- thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
-#endif /* WITH_WSREP */
#ifndef DBUG_OFF
@@ -6437,9 +6431,10 @@ finish:
TRANSACT_TRACKER(add_trx_state_from_thd(thd));
- WSREP_TO_ISOLATION_END;
-
#ifdef WITH_WSREP
+ thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
+
+ WSREP_TO_ISOLATION_END;
/*
Force release of transactional locks if not in active MST and wsrep is on.
*/
@@ -6452,11 +6447,26 @@ finish:
(longlong) thd->thread_id);
thd->mdl_context.release_transactional_locks();
}
+
+ /*
+ Current command did not start multi STMT transaction and the command
+ did not cause commit to happen (e.g. read only). Commit the wsrep
+ transaction as empty.
+ */
+ if (!thd->in_active_multi_stmt_transaction() &&
+ !thd->in_sub_stmt &&
+ thd->wsrep_trx().active() &&
+ thd->wsrep_trx().state() == wsrep::transaction::s_executing)
+ {
+ wsrep_commit_empty(thd, true);
+ }
+
+ /* assume PA safety for next transaction */
+ thd->wsrep_PA_safe= true;
#endif /* WITH_WSREP */
DBUG_RETURN(res || thd->is_error());
-}
-
+ }
static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
{
@@ -6582,6 +6592,7 @@ static bool execute_show_status(THD *thd, TABLE_LIST *all_tables)
bool res;
system_status_var old_status_var= thd->status_var;
thd->initial_status_var= &old_status_var;
+ WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW);
if (!(res= check_table_access(thd, SELECT_ACL, all_tables, FALSE,
UINT_MAX, FALSE)))
res= execute_sqlcom_select(thd, all_tables);
@@ -6600,6 +6611,10 @@ static bool execute_show_status(THD *thd, TABLE_LIST *all_tables)
offsetof(STATUS_VAR, last_cleared_system_status_var));
mysql_mutex_unlock(&LOCK_status);
return res;
+#ifdef WITH_WSREP
+wsrep_error_label: /* see WSREP_SYNC_WAIT() macro above */
+ return true;
+#endif /* WITH_WSREP */
}
@@ -7629,7 +7644,7 @@ void THD::reset_for_next_command(bool do_clear_error)
use autoinc values passed in binlog events, not the values forced by
the cluster.
*/
- if (WSREP(this) && wsrep_exec_mode == LOCAL_STATE &&
+ if (WSREP(this) && wsrep_thd_is_local(this) &&
!slave_thread && wsrep_auto_increment_control)
{
variables.auto_increment_offset=
@@ -7847,144 +7862,155 @@ void mysql_init_multi_delete(LEX *lex)
lex->query_tables_last= &lex->query_tables;
}
-static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
+#ifdef WITH_WSREP
+static void wsrep_prepare_for_autocommit_retry(THD* thd,
+ char* rawbuf,
+ uint length,
+ Parser_state* parser_state)
+{
+ thd->clear_error();
+ close_thread_tables(thd);
+ thd->wsrep_retry_counter++; // grow
+ wsrep_copy_query(thd);
+ thd->set_time();
+ parser_state->reset(rawbuf, length);
+
+ /* PSI end */
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
+
+ /* DTRACE end */
+ if (MYSQL_QUERY_DONE_ENABLED())
+ {
+ MYSQL_QUERY_DONE(thd->is_error());
+ }
+
+ /* SHOW PROFILE end */
+#if defined(ENABLED_PROFILING)
+ thd->profiling.finish_current_query();
+#endif
+
+ /* SHOW PROFILE begin */
+#if defined(ENABLED_PROFILING)
+ thd->profiling.start_new_query("continuing");
+ thd->profiling.set_query_source(rawbuf, length);
+#endif
+
+ /* DTRACE begin */
+ MYSQL_QUERY_START(rawbuf, thd->thread_id,
+ thd->get_db(),
+ &thd->security_ctx->priv_user[0],
+ (char *) thd->security_ctx->host_or_ip);
+
+ /* Performance Schema Interface instrumentation, begin */
+ thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
+ com_statement_info[thd->get_command()].m_key);
+ MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(),
+ thd->query_length());
+
+ DBUG_ASSERT(thd->wsrep_trx().active() == false);
+ thd->wsrep_cs().reset_error();
+ thd->set_query_id(next_query_id());
+}
+
+static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state,
bool is_com_multi,
bool is_next_command)
{
-#ifdef WITH_WSREP
bool is_autocommit=
!thd->in_multi_stmt_transaction_mode() &&
- thd->wsrep_conflict_state == NO_CONFLICT &&
- !thd->wsrep_applier;
-
+ wsrep_read_only_option(thd, thd->lex->query_tables);
+ bool retry_autocommit;
do
{
- if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
- {
- thd->wsrep_conflict_state= NO_CONFLICT;
- /* Performance Schema Interface instrumentation, begin */
- thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
- com_statement_info[thd->get_command()].m_key);
- MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(),
- thd->query_length());
-
- DBUG_EXECUTE_IF("sync.wsrep_retry_autocommit",
- {
- const char act[]=
- "now "
- "SIGNAL wsrep_retry_autocommit_reached "
- "WAIT_FOR wsrep_retry_autocommit_continue";
- DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
- });
- WSREP_DEBUG("Retry autocommit query: %s", thd->query());
- }
-
- mysql_parse(thd, rawbuf, length, parser_state, is_com_multi,
- is_next_command);
-
- if (WSREP(thd)) {
- /* wsrep BF abort in query exec phase */
- mysql_mutex_lock(&thd->LOCK_thd_data);
- if (thd->wsrep_conflict_state == MUST_ABORT) {
- wsrep_client_rollback(thd);
-
- WSREP_DEBUG("abort in exec query state, avoiding autocommit");
- }
+ retry_autocommit= false;
+ mysql_parse(thd, rawbuf, length, parser_state, is_com_multi, is_next_command);
- if (thd->wsrep_conflict_state == MUST_REPLAY)
- {
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- if (thd->lex->explain)
- delete_explain_query(thd->lex);
- mysql_mutex_lock(&thd->LOCK_thd_data);
+ /*
+ Convert all ER_QUERY_INTERRUPTED errors to ER_LOCK_DEADLOCK
+ if the transaction was BF aborted. This can happen when the
+ transaction is being BF aborted via thd->awake() while it is
+ still executing.
- wsrep_replay_transaction(thd);
- }
+ Note that this must be done before wsrep_after_statement() call
+ since it clears the transaction for autocommit queries.
+ */
+ if (((thd->get_stmt_da()->is_error() &&
+ thd->get_stmt_da()->sql_errno() == ER_QUERY_INTERRUPTED) ||
+ !thd->get_stmt_da()->is_set()) &&
+ thd->wsrep_trx().bf_aborted())
+ {
+ WSREP_DEBUG("overriding error: %d with DEADLOCK",
+ (thd->get_stmt_da()->is_error()) ?
+ thd->get_stmt_da()->sql_errno() : 0);
- /* setting error code for BF aborted trxs */
- if (thd->wsrep_conflict_state == ABORTED ||
- thd->wsrep_conflict_state == CERT_FAILURE)
- {
- thd->reset_for_next_command();
- if (is_autocommit &&
- thd->lex->sql_command != SQLCOM_SELECT &&
- (thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit))
- {
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- WSREP_DEBUG("wsrep retrying AC query: %s",
- (thd->query()) ? thd->query() : "void");
-
- /* Performance Schema Interface instrumentation, end */
- MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
- thd->m_statement_psi= NULL;
- thd->m_digest= NULL;
- // Released thd->LOCK_thd_data above as below could end up
- // close_thread_tables()/close_open_tables()/close_thread_table()/mysql_mutex_lock(&thd->LOCK_thd_data)
- close_thread_tables(thd);
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_conflict_state= RETRY_AUTOCOMMIT;
- thd->wsrep_retry_counter++; // grow
- wsrep_copy_query(thd);
- thd->set_time();
- parser_state->reset(rawbuf, length);
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
- else
- {
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- // This does dirty read to wsrep variables but it is only a debug code
- WSREP_DEBUG("%s, thd: %lld is_AC: %d, retry: %lu - %lu SQL: %s",
- (thd->wsrep_conflict_state == ABORTED) ?
- "BF Aborted" : "cert failure",
- (longlong) thd->thread_id, is_autocommit,
- thd->wsrep_retry_counter,
- thd->variables.wsrep_retry_autocommit, thd->query());
- my_message(ER_LOCK_DEADLOCK, "Deadlock: wsrep aborted transaction",
- MYF(0));
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_conflict_state= NO_CONFLICT;
- if (thd->wsrep_conflict_state != REPLAYING)
- thd->wsrep_retry_counter= 0; // reset
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
+ thd->killed = NOT_KILLED;
+ wsrep_override_error(thd, ER_LOCK_DEADLOCK);
+ }
- thd->reset_killed();
+ if (wsrep_after_statement(thd) && is_autocommit)
+ {
+ thd->reset_for_next_command();
+ thd->killed= NOT_KILLED;
+ if (is_autocommit &&
+ thd->lex->sql_command != SQLCOM_SELECT &&
+ thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit)
+ {
+ DBUG_EXECUTE_IF("sync.wsrep_retry_autocommit",
+ {
+ const char act[]=
+ "now "
+ "SIGNAL wsrep_retry_autocommit_reached "
+ "WAIT_FOR wsrep_retry_autocommit_continue";
+ DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
+ });
+ WSREP_DEBUG("wsrep retrying AC query: %lu %s",
+ thd->wsrep_retry_counter, WSREP_QUERY(thd));
+ wsrep_prepare_for_autocommit_retry(thd, rawbuf, length, parser_state);
+ if (thd->lex->explain)
+ delete_explain_query(thd->lex);
+ retry_autocommit= true;
}
else
{
- set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ WSREP_DEBUG("%s, thd: %llu is_AC: %d, retry: %lu - %lu SQL: %s",
+ wsrep_thd_transaction_state_str(thd),
+ thd->thread_id,
+ is_autocommit,
+ thd->wsrep_retry_counter,
+ thd->variables.wsrep_retry_autocommit,
+ WSREP_QUERY(thd));
+ my_error(ER_LOCK_DEADLOCK, MYF(0));
+ thd->killed= NOT_KILLED;
+ thd->wsrep_retry_counter= 0; // reset
}
}
-
- /* If retry is requested clean up explain structure */
- if ((thd->wsrep_conflict_state == RETRY_AUTOCOMMIT ||
- thd->wsrep_conflict_state == MUST_REPLAY )
- && thd->lex->explain)
+ else
{
- delete_explain_query(thd->lex);
+ set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok
}
-
- } while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT);
+ } while (retry_autocommit);
if (thd->wsrep_retry_query)
{
- WSREP_DEBUG("releasing retry_query: conf %d sent %d kill %d errno %d SQL %s",
- thd->wsrep_conflict_state,
- thd->get_stmt_da()->is_sent(),
+ WSREP_DEBUG("releasing retry_query: "
+ "conf %s sent %d kill %d errno %d SQL %s",
+ wsrep_thd_transaction_state_str(thd),
+ thd->get_stmt_da()->is_sent(),
thd->killed,
- thd->get_stmt_da()->is_error() ? thd->get_stmt_da()->sql_errno() : 0,
+ thd->get_stmt_da()->is_error() ?
+ thd->get_stmt_da()->sql_errno() : 0,
thd->wsrep_retry_query);
my_free(thd->wsrep_retry_query);
thd->wsrep_retry_query = NULL;
thd->wsrep_retry_query_len = 0;
thd->wsrep_retry_command = COM_CONNECT;
}
-#endif /* WITH_WSREP */
+ return false;
}
+#endif /* WITH_WSREP */
/*
@@ -8925,23 +8951,35 @@ void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
pointer - thread found, and its LOCK_thd_kill is locked.
*/
-THD *find_thread_by_id(longlong id, bool query_id)
+struct find_thread_callback_arg
{
- THD *tmp;
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
+ find_thread_callback_arg(longlong id_arg, bool query_id_arg):
+ thd(0), id(id_arg), query_id(query_id_arg) {}
+ THD *thd;
+ longlong id;
+ bool query_id;
+};
+
+
+my_bool find_thread_callback(THD *thd, find_thread_callback_arg *arg)
+{
+ if (thd->get_command() != COM_DAEMON &&
+ arg->id == (arg->query_id ? thd->query_id : (longlong) thd->thread_id))
{
- if (tmp->get_command() == COM_DAEMON)
- continue;
- if (id == (query_id ? tmp->query_id : (longlong) tmp->thread_id))
- {
- mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
- break;
- }
+ if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
+ mysql_mutex_lock(&thd->LOCK_thd_kill); // Lock from delete
+ arg->thd= thd;
+ return 1;
}
- mysql_mutex_unlock(&LOCK_thread_count);
- return tmp;
+ return 0;
+}
+
+
+THD *find_thread_by_id(longlong id, bool query_id)
+{
+ find_thread_callback_arg arg(id, query_id);
+ server_threads.iterate(find_thread_callback, &arg);
+ return arg.thd;
}
@@ -8952,9 +8990,6 @@ THD *find_thread_by_id(longlong id, bool query_id)
@param id Thread id or query id
@param kill_signal Should it kill the query or the connection
@param type Type of id: thread id or query id
-
- @note
- This is written such that we have a short lock on LOCK_thread_count
*/
uint
@@ -8964,7 +8999,7 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
uint error= (type == KILL_TYPE_QUERY ? ER_NO_SUCH_QUERY : ER_NO_SUCH_THREAD);
DBUG_ENTER("kill_one_thread");
DBUG_PRINT("enter", ("id: %lld signal: %u", id, (uint) kill_signal));
-
+ WSREP_DEBUG("kill_one_thread %llu", thd->thread_id);
if (id && (tmp= find_thread_by_id(id, type == KILL_TYPE_QUERY)))
{
/*
@@ -8988,9 +9023,14 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
faster and do a harder kill than KILL_SYSTEM_THREAD;
*/
+#ifdef WITH_WSREP
if (((thd->security_ctx->master_access & SUPER_ACL) ||
thd->security_ctx->user_matches(tmp->security_ctx)) &&
- !wsrep_thd_is_BF(tmp, false))
+ !wsrep_thd_is_BF(tmp, false) && !tmp->wsrep_applier)
+#else
+ if ((thd->security_ctx->master_access & SUPER_ACL) ||
+ thd->security_ctx->user_matches(tmp->security_ctx))
+#endif /* WITH_WSREP */
{
tmp->awake_no_mutex(kill_signal);
error=0;
@@ -8999,6 +9039,7 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
ER_KILL_DENIED_ERROR);
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
+ if (WSREP(tmp)) mysql_mutex_unlock(&tmp->LOCK_thd_data);
}
DBUG_PRINT("exit", ("%d", error));
DBUG_RETURN(error);
@@ -9013,56 +9054,67 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
@param only_kill_query Should it kill the query or the connection
@note
- This is written such that we have a short lock on LOCK_thread_count
-
If we can't kill all threads because of security issues, no threads
are killed.
*/
-static uint kill_threads_for_user(THD *thd, LEX_USER *user,
- killed_state kill_signal, ha_rows *rows)
+struct kill_threads_callback_arg
{
- THD *tmp;
+ kill_threads_callback_arg(THD *thd_arg, LEX_USER *user_arg):
+ thd(thd_arg), user(user_arg) {}
+ THD *thd;
+ LEX_USER *user;
List<THD> threads_to_kill;
- DBUG_ENTER("kill_threads_for_user");
-
- *rows= 0;
-
- if (unlikely(thd->is_fatal_error)) // If we run out of memory
- DBUG_RETURN(ER_OUT_OF_RESOURCES);
+};
- DBUG_PRINT("enter", ("user: %s signal: %u", user->user.str,
- (uint) kill_signal));
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
+static my_bool kill_threads_callback(THD *thd, kill_threads_callback_arg *arg)
+{
+ if (thd->security_ctx->user)
{
- if (!tmp->security_ctx->user)
- continue;
/*
Check that hostname (if given) and user name matches.
host.str[0] == '%' means that host name was not given. See sql_yacc.yy
*/
- if (((user->host.str[0] == '%' && !user->host.str[1]) ||
- !strcmp(tmp->security_ctx->host_or_ip, user->host.str)) &&
- !strcmp(tmp->security_ctx->user, user->user.str))
+ if (((arg->user->host.str[0] == '%' && !arg->user->host.str[1]) ||
+ !strcmp(thd->security_ctx->host_or_ip, arg->user->host.str)) &&
+ !strcmp(thd->security_ctx->user, arg->user->user.str))
{
- if (!(thd->security_ctx->master_access & SUPER_ACL) &&
- !thd->security_ctx->user_matches(tmp->security_ctx))
+ if (!(arg->thd->security_ctx->master_access & SUPER_ACL) &&
+ !arg->thd->security_ctx->user_matches(thd->security_ctx))
+ return 1;
+ if (!arg->threads_to_kill.push_back(thd, arg->thd->mem_root))
{
- mysql_mutex_unlock(&LOCK_thread_count);
- DBUG_RETURN(ER_KILL_DENIED_ERROR);
+ if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
+ mysql_mutex_lock(&thd->LOCK_thd_kill); // Lock from delete
}
- if (!threads_to_kill.push_back(tmp, thd->mem_root))
- mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
}
}
- mysql_mutex_unlock(&LOCK_thread_count);
- if (!threads_to_kill.is_empty())
+ return 0;
+}
+
+
+static uint kill_threads_for_user(THD *thd, LEX_USER *user,
+ killed_state kill_signal, ha_rows *rows)
+{
+ kill_threads_callback_arg arg(thd, user);
+ DBUG_ENTER("kill_threads_for_user");
+
+ *rows= 0;
+
+ if (unlikely(thd->is_fatal_error)) // If we run out of memory
+ DBUG_RETURN(ER_OUT_OF_RESOURCES);
+
+ DBUG_PRINT("enter", ("user: %s signal: %u", user->user.str,
+ (uint) kill_signal));
+
+ if (server_threads.iterate(kill_threads_callback, &arg))
+ DBUG_RETURN(ER_KILL_DENIED_ERROR);
+
+ if (!arg.threads_to_kill.is_empty())
{
- List_iterator_fast<THD> it2(threads_to_kill);
+ List_iterator_fast<THD> it2(arg.threads_to_kill);
THD *next_ptr;
THD *ptr= it2++;
do
@@ -9078,6 +9130,7 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
*/
next_ptr= it2++;
mysql_mutex_unlock(&ptr->LOCK_thd_kill);
+ if (WSREP(ptr)) mysql_mutex_unlock(&ptr->LOCK_thd_data);
(*rows)++;
} while ((ptr= next_ptr));
}
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 1027872898a..f458c4279dd 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -99,10 +99,9 @@ void create_table_set_open_action_and_adjust_tables(LEX *lex);
void mysql_init_multi_delete(LEX *lex);
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
void create_table_set_open_action_and_adjust_tables(LEX *lex);
-pthread_handler_t handle_bootstrap(void *arg);
+void bootstrap(MYSQL_FILE *file);
int mysql_execute_command(THD *thd);
bool do_command(THD *thd);
-void do_handle_bootstrap(THD *thd);
bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length,
bool is_com_multi, bool is_next_command);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 96e07b19dd8..6b530a95efb 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -8217,6 +8217,7 @@ static int get_part_iter_for_interval_via_mapping(partition_info *part_info,
field->type() == MYSQL_TYPE_DATETIME))
{
/* Monotonic, but return NULL for dates with zeros in month/day. */
+ DBUG_ASSERT(field->cmp_type() == TIME_RESULT); // No rounding/truncation
zero_in_start_date= field->get_date(&start_date, date_mode_t(0));
DBUG_PRINT("info", ("zero start %u %04d-%02d-%02d",
zero_in_start_date, start_date.year,
@@ -8241,6 +8242,7 @@ static int get_part_iter_for_interval_via_mapping(partition_info *part_info,
!part_info->part_expr->null_value)
{
MYSQL_TIME end_date;
+ DBUG_ASSERT(field->cmp_type() == TIME_RESULT); // No rounding/truncation
bool zero_in_end_date= field->get_date(&end_date, date_mode_t(0));
/*
This is an optimization for TO_DAYS()/TO_SECONDS() to avoid scanning
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index d448b7b9e02..21767b4de96 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -4354,25 +4354,23 @@ void wsrep_plugins_pre_init()
members of wsrep startup threads with correct values, as these value
were not available at the time these threads were created.
*/
-void wsrep_plugins_post_init()
-{
- THD *thd;
- I_List_iterator<THD> it(threads);
- while ((thd= it++))
+my_bool post_init_callback(THD *thd, void *)
+{
+ if (thd->wsrep_applier)
{
- if (IF_WSREP(thd->wsrep_applier,1))
- {
- // Save options_bits as it will get overwritten in plugin_thdvar_init()
- ulonglong option_bits_saved= thd->variables.option_bits;
-
- plugin_thdvar_init(thd);
-
- // Restore option_bits
- thd->variables.option_bits= option_bits_saved;
- }
+ // Save options_bits as it will get overwritten in plugin_thdvar_init()
+ ulonglong option_bits_saved= thd->variables.option_bits;
+ plugin_thdvar_init(thd);
+ // Restore option_bits
+ thd->variables.option_bits= option_bits_saved;
}
+ return 0;
+}
- return;
+
+void wsrep_plugins_post_init()
+{
+ server_threads.iterate(post_init_callback);
}
#endif /* WITH_WSREP */
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index 8de53aa2161..8893ea361e3 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -142,47 +142,35 @@ static struct thd_error_context_service_st thd_error_context_handler= {
};
static struct wsrep_service_st wsrep_handler = {
- get_wsrep,
- get_wsrep_certify_nonPK,
- get_wsrep_debug,
- get_wsrep_drupal_282555_workaround,
get_wsrep_recovery,
- get_wsrep_load_data_splitting,
- get_wsrep_log_conflicts,
- get_wsrep_protocol_version,
- wsrep_aborting_thd_contains,
- wsrep_aborting_thd_enqueue,
wsrep_consistency_check,
wsrep_is_wsrep_xid,
wsrep_xid_seqno,
wsrep_xid_uuid,
- wsrep_lock_rollback,
wsrep_on,
- wsrep_post_commit,
- wsrep_prepare_key,
- wsrep_run_wsrep_commit,
+ wsrep_prepare_key_for_innodb,
wsrep_thd_LOCK,
wsrep_thd_UNLOCK,
- wsrep_thd_awake,
- wsrep_thd_conflict_state,
- wsrep_thd_conflict_state_str,
- wsrep_thd_exec_mode,
- wsrep_thd_exec_mode_str,
- wsrep_thd_get_conflict_state,
- wsrep_thd_is_BF,
- wsrep_thd_is_wsrep,
wsrep_thd_query,
- wsrep_thd_query_state,
- wsrep_thd_query_state_str,
wsrep_thd_retry_counter,
- wsrep_thd_set_conflict_state,
wsrep_thd_ignore_table,
wsrep_thd_trx_seqno,
- wsrep_thd_ws_handle,
- wsrep_trx_is_aborting,
- wsrep_trx_order_before,
- wsrep_unlock_rollback,
- wsrep_set_data_home_dir
+ wsrep_thd_is_aborting,
+ wsrep_set_data_home_dir,
+ wsrep_thd_is_BF,
+ wsrep_thd_is_local,
+ wsrep_thd_self_abort,
+ wsrep_thd_append_key,
+ wsrep_thd_client_state_str,
+ wsrep_thd_client_mode_str,
+ wsrep_thd_transaction_state_str,
+ wsrep_thd_transaction_id,
+ wsrep_thd_bf_abort,
+ wsrep_thd_order_before,
+ wsrep_handle_SR_rollback,
+ wsrep_thd_skip_locking,
+ wsrep_get_sr_table_name,
+ wsrep_get_debug
};
static struct thd_specifics_service_st thd_specifics_handler=
@@ -217,6 +205,16 @@ static struct my_print_error_service_st my_print_error_handler=
my_printv_error
};
+struct json_service_st json_handler=
+{
+ json_type,
+ json_get_array_item,
+ json_get_object_key,
+ json_get_object_nkey,
+ json_escape_string,
+ json_unescape_json
+};
+
static struct st_service_ref list_of_services[]=
{
{ "base64_service", VERSION_base64, &base64_handler },
@@ -239,6 +237,7 @@ static struct st_service_ref list_of_services[]=
{ "thd_specifics_service", VERSION_thd_specifics, &thd_specifics_handler },
{ "thd_timezone_service", VERSION_thd_timezone, &thd_timezone_handler },
{ "thd_wait_service", VERSION_thd_wait, &thd_wait_handler },
- { "wsrep_service", VERSION_wsrep, &wsrep_handler }
+ { "wsrep_service", VERSION_wsrep, &wsrep_handler },
+ { "json_service", VERSION_json, &json_handler }
};
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 6def798b1c7..c8cc64dba7e 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2915,6 +2915,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
{
SELECT_LEX *sl= lex->all_selects_list;
DBUG_ENTER("reinit_stmt_before_use");
+ Window_spec *win_spec;
/*
We have to update "thd" pointer in LEX, all its units and in LEX::result,
@@ -2983,6 +2984,17 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
/* Fix ORDER list */
for (order= sl->order_list.first; order; order= order->next)
order->item= &order->item_ptr;
+ /* Fix window functions too */
+ List_iterator<Window_spec> it(sl->window_specs);
+
+ while ((win_spec= it++))
+ {
+ for (order= win_spec->partition_list->first; order; order= order->next)
+ order->item= &order->item_ptr;
+ for (order= win_spec->order_list->first; order; order= order->next)
+ order->item= &order->item_ptr;
+ }
+
{
#ifdef DBUG_ASSERT_EXISTS
bool res=
@@ -4206,30 +4218,6 @@ reexecute:
error= execute(expanded_query, open_cursor) || thd->is_error();
thd->m_reprepare_observer= NULL;
-#ifdef WITH_WSREP
-
- if (WSREP_ON)
- {
- mysql_mutex_lock(&thd->LOCK_thd_data);
- switch (thd->wsrep_conflict_state)
- {
- case CERT_FAILURE:
- WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %lld err: %d",
- (longlong) thd->thread_id,
- thd->get_stmt_da()->sql_errno() );
- thd->wsrep_conflict_state = NO_CONFLICT;
- break;
-
- case MUST_REPLAY:
- (void) wsrep_replay_transaction(thd);
- break;
-
- default:
- break;
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-#endif /* WITH_WSREP */
if (unlikely(error) &&
(sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) &&
@@ -4402,30 +4390,6 @@ reexecute:
error= execute(expanded_query, open_cursor) || thd->is_error();
thd->m_reprepare_observer= NULL;
-#ifdef WITH_WSREP
-
- if (WSREP_ON)
- {
- mysql_mutex_lock(&thd->LOCK_thd_data);
- switch (thd->wsrep_conflict_state)
- {
- case CERT_FAILURE:
- WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %lld err: %d",
- (longlong) thd->thread_id,
- thd->get_stmt_da()->sql_errno() );
- thd->wsrep_conflict_state = NO_CONFLICT;
- break;
-
- case MUST_REPLAY:
- (void) wsrep_replay_transaction(thd);
- break;
-
- default:
- break;
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-#endif /* WITH_WSREP */
if (unlikely(error) &&
(sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) &&
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index abdf9d76d15..7a5cabc8880 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -221,7 +221,9 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
!thd->mdl_context.has_locks() ||
thd->handler_tables_hash.records ||
thd->ull_hash.records ||
- thd->global_read_lock.is_acquired());
+ thd->global_read_lock.is_acquired() ||
+ thd->current_backup_stage != BACKUP_FINISHED
+ );
/*
Note that if REFRESH_READ_LOCK bit is set then REFRESH_TABLES is set too
@@ -231,6 +233,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
{
if ((options & REFRESH_READ_LOCK) && thd)
{
+ DBUG_ASSERT(!(options & REFRESH_FAST) && !tables);
/*
On the first hand we need write lock on the tables to be flushed,
on the other hand we must not try to aspire a global read lock
@@ -242,6 +245,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
return 1;
}
+
/*
Writing to the binlog could cause deadlocks, as we don't log
UNLOCK TABLES
@@ -249,9 +253,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
tmp_write_to_binlog= 0;
if (thd->global_read_lock.lock_global_read_lock(thd))
return 1; // Killed
- if (close_cached_tables(thd, tables,
- ((options & REFRESH_FAST) ? FALSE : TRUE),
- thd->variables.lock_wait_timeout))
+ if (flush_tables(thd, FLUSH_ALL))
{
/*
NOTE: my_error() has been already called by reopen_tables() within
@@ -274,11 +276,9 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
make_global_read_lock_block_commit(thd) above since they could have
modified the tables too.
*/
- if (WSREP(thd) &&
- close_cached_tables(thd, tables, (options & REFRESH_FAST) ?
- FALSE : TRUE, TRUE))
- result= 1;
- }
+ if (WSREP(thd) && flush_tables(thd, FLUSH_ALL))
+ result= 1;
+ }
else
{
if (thd && thd->locked_tables_mode)
@@ -311,8 +311,8 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
with global read lock.
*/
if (thd->open_tables &&
- !thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE))
+ !thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
+ MDL_BACKUP_DDL))
{
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),
thd->open_tables->s->table_name.str);
@@ -332,25 +332,21 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
}
#ifdef WITH_WSREP
- if (thd && thd->wsrep_applier)
- {
- /*
- In case of applier thread, do not wait for table share(s) to be
- removed from table definition cache.
- */
- options|= REFRESH_FAST;
- }
-#endif
- if (close_cached_tables(thd, tables,
- ((options & REFRESH_FAST) ? FALSE : TRUE),
- (thd ? thd->variables.lock_wait_timeout :
- LONG_TIMEOUT)))
+ /* In case of applier thread, do not call flush tables */
+ if (!thd || !thd->wsrep_applier)
+#endif /* WITH_WSREP */
{
- /*
- NOTE: my_error() has been already called by reopen_tables() within
- close_cached_tables().
- */
- result= 1;
+ if (close_cached_tables(thd, tables,
+ ((options & REFRESH_FAST) ? FALSE : TRUE),
+ (thd ? thd->variables.lock_wait_timeout :
+ LONG_TIMEOUT)))
+ {
+ /*
+ NOTE: my_error() has been already called by reopen_tables() within
+ close_cached_tables().
+ */
+ result= 1;
+ }
}
}
my_dbopt_cleanup();
@@ -420,6 +416,11 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
#endif
if (options & REFRESH_USER_RESOURCES)
reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */
+ if (options & REFRESH_SSL)
+ {
+ if (reinit_ssl())
+ result= 1;
+ }
if (options & REFRESH_GENERIC)
{
List_iterator_fast<LEX_CSTRING> li(thd->lex->view_list);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 2ee175293de..fc08399bb88 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -527,61 +527,48 @@ static enum enum_binlog_checksum_alg get_binlog_checksum_value_at_connect(THD *
Now they sync is done for next read.
*/
-void adjust_linfo_offsets(my_off_t purge_offset)
+static my_bool adjust_callback(THD *thd, my_off_t *purge_offset)
{
- THD *tmp;
-
- mysql_mutex_lock(&LOCK_thread_count);
- I_List_iterator<THD> it(threads);
-
- while ((tmp=it++))
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (auto linfo= thd->current_linfo)
{
- LOG_INFO* linfo;
- if ((linfo = tmp->current_linfo))
- {
- mysql_mutex_lock(&linfo->lock);
- /*
- Index file offset can be less that purge offset only if
- we just started reading the index file. In that case
- we have nothing to adjust
- */
- if (linfo->index_file_offset < purge_offset)
- linfo->fatal = (linfo->index_file_offset != 0);
- else
- linfo->index_file_offset -= purge_offset;
- mysql_mutex_unlock(&linfo->lock);
- }
+ /*
+ Index file offset can be less that purge offset only if
+ we just started reading the index file. In that case
+ we have nothing to adjust
+ */
+ if (linfo->index_file_offset < *purge_offset)
+ linfo->fatal= (linfo->index_file_offset != 0);
+ else
+ linfo->index_file_offset-= *purge_offset;
}
- mysql_mutex_unlock(&LOCK_thread_count);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ return 0;
}
-bool log_in_use(const char* log_name)
+void adjust_linfo_offsets(my_off_t purge_offset)
{
- size_t log_name_len = strlen(log_name) + 1;
- THD *tmp;
- bool result = 0;
+ server_threads.iterate(adjust_callback, &purge_offset);
+}
- mysql_mutex_lock(&LOCK_thread_count);
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- {
- LOG_INFO* linfo;
- if ((linfo = tmp->current_linfo))
- {
- mysql_mutex_lock(&linfo->lock);
- result = !memcmp(log_name, linfo->log_file_name, log_name_len);
- mysql_mutex_unlock(&linfo->lock);
- if (result)
- break;
- }
- }
-
- mysql_mutex_unlock(&LOCK_thread_count);
+static my_bool log_in_use_callback(THD *thd, const char *log_name)
+{
+ my_bool result= 0;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (auto linfo= thd->current_linfo)
+ result= !memcmp(log_name, linfo->log_file_name, strlen(log_name) + 1);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
return result;
}
+
+bool log_in_use(const char* log_name)
+{
+ return server_threads.iterate(log_in_use_callback, log_name);
+}
+
bool purge_error_message(THD* thd, int res)
{
uint errcode;
@@ -3369,31 +3356,40 @@ err:
slave_server_id the slave's server id
*/
-void kill_zombie_dump_threads(uint32 slave_server_id)
+struct kill_callback_arg
{
- mysql_mutex_lock(&LOCK_thread_count);
- I_List_iterator<THD> it(threads);
- THD *tmp;
+ kill_callback_arg(uint32 id): slave_server_id(id), thd(0) {}
+ uint32 slave_server_id;
+ THD *thd;
+};
- while ((tmp=it++))
+static my_bool kill_callback(THD *thd, kill_callback_arg *arg)
+{
+ if (thd->get_command() == COM_BINLOG_DUMP &&
+ thd->variables.server_id == arg->slave_server_id)
{
- if (tmp->get_command() == COM_BINLOG_DUMP &&
- tmp->variables.server_id == slave_server_id)
- {
- mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
- break;
- }
+ arg->thd= thd;
+ mysql_mutex_lock(&thd->LOCK_thd_kill); // Lock from delete
+ return 1;
}
- mysql_mutex_unlock(&LOCK_thread_count);
- if (tmp)
+ return 0;
+}
+
+
+void kill_zombie_dump_threads(uint32 slave_server_id)
+{
+ kill_callback_arg arg(slave_server_id);
+ server_threads.iterate(kill_callback, &arg);
+
+ if (arg.thd)
{
/*
Here we do not call kill_one_thread() as
it will be slow because it will iterate through the list
again. We just to do kill the thread ourselves.
*/
- tmp->awake_no_mutex(KILL_SLAVE_SAME_ID);
- mysql_mutex_unlock(&tmp->LOCK_thd_kill);
+ arg.thd->awake_no_mutex(KILL_SLAVE_SAME_ID);
+ mysql_mutex_unlock(&arg.thd->LOCK_thd_kill);
}
}
@@ -3845,6 +3841,17 @@ int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len,
return 1;
}
+#ifdef WITH_WSREP
+ if (WSREP_ON)
+ {
+ /* RESET MASTER will initialize GTID sequence, and that would happen locally
+ in this node, so better reject it
+ */
+ my_message(ER_NOT_ALLOWED_COMMAND,
+ "RESET MASTER not allowed when node is in cluster", MYF(0));
+ return 1;
+ }
+#endif /* WITH_WSREP */
bool ret= 0;
/* Temporarily disable master semisync before reseting master. */
repl_semisync_master.before_reset_master();
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b5b77c2c43b..a17682bd9c8 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2618,7 +2618,7 @@ int JOIN::optimize_stage2()
{
JOIN_TAB *tab= &join_tab[const_tables];
- if (order)
+ if (order && !need_tmp)
{
/*
Force using of tmp table if sorting by a SP or UDF function due to
@@ -2775,6 +2775,18 @@ setup_subq_exit:
if (!tables_list || !table_count)
{
choose_tableless_subquery_plan();
+
+ /* The output has atmost one row */
+ if (group_list)
+ {
+ group_list= NULL;
+ group_optimized_away= 1;
+ rollup.state= ROLLUP::STATE_NONE;
+ }
+ order= NULL;
+ simple_order= TRUE;
+ select_distinct= FALSE;
+
if (select_lex->have_window_funcs())
{
if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB))))
@@ -3314,7 +3326,7 @@ bool JOIN::make_aggr_tables_info()
or end_write_group()) if JOIN::group is set to false.
*/
// the temporary table was explicitly requested
- DBUG_ASSERT(MY_TEST(select_options & OPTION_BUFFER_RESULT));
+ DBUG_ASSERT(select_options & OPTION_BUFFER_RESULT);
// the temporary table does not have a grouping expression
DBUG_ASSERT(!curr_tab->table->group);
}
@@ -4199,7 +4211,7 @@ void JOIN::exec_inner()
procedure ? procedure_fields_list : *fields,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
- error= do_select(this, procedure);
+ error= result->view_structure_only() ? false : do_select(this, procedure);
/* Accumulate the counts from all join iterations of all join parts. */
thd->inc_examined_row_count(join_examined_rows);
DBUG_PRINT("counts", ("thd->examined_row_count: %lu",
@@ -13378,7 +13390,23 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
tab++)
tab->cached_eq_ref_table= FALSE;
- *simple_order= *join->join_tab[join->const_tables].on_expr_ref ? 0 : 1;
+ JOIN_TAB *head= join->join_tab + join->const_tables;
+ *simple_order= head->on_expr_ref[0] == NULL;
+ if (*simple_order && head->table->file->ha_table_flags() & HA_SLOW_RND_POS)
+ {
+ uint u1, u2, u3;
+ /*
+ normally the condition is (see filesort_use_addons())
+
+ length + sortlength <= max_length_for_sort_data
+
+ but for HA_SLOW_RND_POS tables we relax it a bit, as the alternative
+ is to use a temporary table, which is rather expensive.
+
+ TODO proper cost estimations
+ */
+ *simple_order= filesort_use_addons(head->table, 0, &u1, &u2, &u3);
+ }
}
else
{
@@ -20448,6 +20476,10 @@ test_if_quick_select(JOIN_TAB *tab)
delete tab->select->quick;
tab->select->quick=0;
+
+ if (tab->table->file->inited != handler::NONE)
+ tab->table->file->ha_index_or_rnd_end();
+
int res= tab->select->test_quick_select(tab->join->thd, tab->keys,
(table_map) 0, HA_POS_ERROR, 0,
FALSE, /*remove where parts*/FALSE);
@@ -22954,9 +22986,11 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
}
file->extra(HA_EXTRA_NO_CACHE);
+ (void) file->ha_rnd_end();
DBUG_RETURN(0);
err:
file->extra(HA_EXTRA_NO_CACHE);
+ (void) file->ha_rnd_end();
if (error)
file->print_error(error,MYF(0));
DBUG_RETURN(1);
@@ -24090,7 +24124,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
on how the value is to be used: In some cases this may be an
argument in a group function, like: IF(ISNULL(col),0,COUNT(*))
*/
- if (!(pos=new (thd->mem_root) Item_copy_string(thd, pos)))
+ if (!(pos= pos->type_handler()->create_item_copy(thd, pos)))
goto err;
if (i < border) // HAVING, ORDER and GROUP BY
{
@@ -25936,13 +25970,13 @@ int JOIN::save_explain_data_intern(Explain_query *output,
(1) they are not parts of ON clauses that were eliminated by table
elimination.
(2) they are not merged derived tables
- (3) they are not unreferenced CTE
+ (3) they are not hanging CTEs (they are needed for execution)
*/
if (!(tmp_unit->item && tmp_unit->item->eliminated) && // (1)
(!tmp_unit->derived ||
tmp_unit->derived->is_materialized_derived()) && // (2)
- !(tmp_unit->with_element &&
- !tmp_unit->with_element->is_referenced())) // (3)
+ !(tmp_unit->with_element &&
+ (!tmp_unit->derived || !tmp_unit->derived->derived_result))) // (3)
{
explain->add_child(tmp_unit->first_select()->select_number);
}
@@ -26003,11 +26037,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
Save plans for child subqueries, when
(1) they are not parts of eliminated WHERE/ON clauses.
(2) they are not VIEWs that were "merged for INSERT".
- (3) they are not unreferenced CTE.
+ (3) they are not hanging CTEs (they are needed for execution)
*/
if (!(unit->item && unit->item->eliminated) && // (1)
!(unit->derived && unit->derived->merged_for_insert) && // (2)
- !(unit->with_element && !unit->with_element->is_referenced())) // (3)
+ !(unit->with_element &&
+ (!unit->derived || !unit->derived->derived_result))) // (3)
{
if (mysql_explain_union(thd, unit, result))
DBUG_VOID_RETURN;
@@ -26877,16 +26912,22 @@ void JOIN::cache_const_exprs()
/*
- Get a cost of reading rows_limit rows through index keynr.
+ Get the cost of using index keynr to read #LIMIT matching rows
@detail
- If there is a quick select, we try to use it.
- if there is a ref(const) access, we try to use it, too.
- quick and ref(const) use different cost formulas, so if both are possible
we should make a cost-based choice.
-
+
+ rows_limit is the number of rows we would need to read when using a full
+ index scan. This is generally higher than the N from "LIMIT N" clause,
+ because there's a WHERE condition (a part of which is used to construct a
+ range access we are considering using here)
+
@param tab JOIN_TAB with table access (is NULL for single-table
UPDATE/DELETE)
+ @param rows_limit See explanation above
@param read_time OUT Cost of reading using quick or ref(const) access.
@@ -26899,6 +26940,7 @@ void JOIN::cache_const_exprs()
static bool get_range_limit_read_cost(const JOIN_TAB *tab,
const TABLE *table,
+ ha_rows table_records,
uint keynr,
ha_rows rows_limit,
double *read_time)
@@ -26965,8 +27007,32 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
}
}
}
+
+ /*
+ Consider an example:
+
+ SELECT *
+ FROM t1
+ WHERE key1 BETWEEN 10 AND 20 AND col2='foo'
+ ORDER BY key1 LIMIT 10
+
+ If we were using a full index scan on key1, we would need to read this
+ many rows to get 10 matches:
+
+ 10 / selectivity(key1 BETWEEN 10 AND 20 AND col2='foo')
+
+ This is the number we get in rows_limit.
+ But we intend to use range access on key1. The rows returned by quick
+ select will satisfy the range part of the condition,
+ "key1 BETWEEN 10 and 20". We will still need to filter them with
+ the remainder condition, (col2='foo').
+
+ The selectivity of the range access is (best_rows/table_records). We need
+ to discount it from the rows_limit:
+ */
+ double rows_limit_for_quick= rows_limit * (best_rows / table_records);
- if (best_rows > rows_limit)
+ if (best_rows > rows_limit_for_quick)
{
/*
LIMIT clause specifies that we will need to read fewer records than
@@ -26975,7 +27041,7 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
only need 1/3rd of records, it will cost us 1/3rd of quick select's
read time)
*/
- best_cost *= rows_limit / best_rows;
+ best_cost *= rows_limit_for_quick / best_rows;
}
*read_time= best_cost;
res= true;
@@ -27076,7 +27142,11 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
uint tablenr= (uint)(tab - join->join_tab);
read_time= join->best_positions[tablenr].read_time;
for (uint i= tablenr+1; i < join->table_count; i++)
+ {
fanout*= join->best_positions[i].records_read; // fanout is always >= 1
+ // But selectivity is =< 1 :
+ fanout*= join->best_positions[i].cond_selectivity;
+ }
}
else
read_time= table->file->scan_time();
@@ -27214,6 +27284,24 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
*/
select_limit= (ha_rows) (select_limit < fanout ?
1 : select_limit/fanout);
+
+ /*
+ refkey_rows_estimate is E(#rows) produced by the table access
+ strategy that was picked without regard to ORDER BY ... LIMIT.
+
+ It will be used as the source of selectivity data.
+ Use table->cond_selectivity as a better estimate which includes
+ condition selectivity too.
+ */
+ {
+ // we use MIN(...), because "Using LooseScan" queries have
+ // cond_selectivity=1 while refkey_rows_estimate has a better
+ // estimate.
+ refkey_rows_estimate= MY_MIN(refkey_rows_estimate,
+ ha_rows(table_records *
+ table->cond_selectivity));
+ }
+
/*
We assume that each of the tested indexes is not correlated
with ref_key. Thus, to select first N records we have to scan
@@ -27224,6 +27312,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
N/(refkey_rows_estimate/table_records) > table_records
<=> N > refkey_rows_estimate.
*/
+
if (select_limit > refkey_rows_estimate)
select_limit= table_records;
else
@@ -27246,8 +27335,8 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
index_scan_time= select_limit/rec_per_key *
MY_MIN(rec_per_key, table->file->scan_time());
double range_scan_time;
- if (get_range_limit_read_cost(tab, table, nr, select_limit,
- &range_scan_time))
+ if (get_range_limit_read_cost(tab, table, table_records, nr,
+ select_limit, &range_scan_time))
{
if (range_scan_time < index_scan_time)
index_scan_time= range_scan_time;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b98f8aabdc1..3d2723081a3 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2734,13 +2734,111 @@ static const char *thread_state_info(THD *tmp)
}
+struct list_callback_arg
+{
+ list_callback_arg(const char *u, THD *t, ulong m):
+ user(u), thd(t), max_query_length(m) {}
+ I_List<thread_info> thread_infos;
+ const char *user;
+ THD *thd;
+ ulong max_query_length;
+};
+
+
+static my_bool list_callback(THD *tmp, list_callback_arg *arg)
+{
+
+ Security_context *tmp_sctx= tmp->security_ctx;
+ bool got_thd_data;
+ if ((tmp->vio_ok() || tmp->system_thread) &&
+ (!arg->user || (!tmp->system_thread &&
+ tmp_sctx->user && !strcmp(tmp_sctx->user, arg->user))))
+ {
+ thread_info *thd_info= new (arg->thd->mem_root) thread_info;
+
+ thd_info->thread_id=tmp->thread_id;
+ thd_info->os_thread_id=tmp->os_thread_id;
+ thd_info->user= arg->thd->strdup(tmp_sctx->user ? tmp_sctx->user :
+ (tmp->system_thread ?
+ "system user" : "unauthenticated user"));
+ if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
+ arg->thd->security_ctx->host_or_ip[0])
+ {
+ if ((thd_info->host= (char*) arg->thd->alloc(LIST_PROCESS_HOST_LEN+1)))
+ my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN,
+ "%s:%u", tmp_sctx->host_or_ip, tmp->peer_port);
+ }
+ else
+ thd_info->host= arg->thd->strdup(tmp_sctx->host_or_ip[0] ?
+ tmp_sctx->host_or_ip :
+ tmp_sctx->host ? tmp_sctx->host : "");
+ thd_info->command=(int) tmp->get_command();
+
+ if ((got_thd_data= !trylock_short(&tmp->LOCK_thd_data)))
+ {
+ /* This is an approximation */
+ thd_info->proc_info= (char*) (tmp->killed >= KILL_QUERY ?
+ "Killed" : 0);
+
+ /* The following variables are only safe to access under a lock */
+ thd_info->db= 0;
+ if (tmp->db.str)
+ thd_info->db= arg->thd->strmake(tmp->db.str, tmp->db.length);
+
+ if (tmp->query())
+ {
+ uint length= MY_MIN(arg->max_query_length, tmp->query_length());
+ char *q= arg->thd->strmake(tmp->query(),length);
+ /* Safety: in case strmake failed, we set length to 0. */
+ thd_info->query_string=
+ CSET_STRING(q, q ? length : 0, tmp->query_charset());
+ }
+
+ /*
+ Progress report. We need to do this under a lock to ensure that all
+ is from the same stage.
+ */
+ if (tmp->progress.max_counter)
+ {
+ uint max_stage= MY_MAX(tmp->progress.max_stage, 1);
+ thd_info->progress= (((tmp->progress.stage / (double) max_stage) +
+ ((tmp->progress.counter /
+ (double) tmp->progress.max_counter) /
+ (double) max_stage)) *
+ 100.0);
+ set_if_smaller(thd_info->progress, 100);
+ }
+ else
+ thd_info->progress= 0.0;
+ }
+ else
+ {
+ thd_info->proc_info= "Busy";
+ thd_info->progress= 0.0;
+ thd_info->db= "";
+ }
+
+ thd_info->state_info= thread_state_info(tmp);
+ thd_info->start_time= tmp->start_utime;
+ ulonglong utime_after_query_snapshot= tmp->utime_after_query;
+ if (thd_info->start_time < utime_after_query_snapshot)
+ thd_info->start_time= utime_after_query_snapshot; // COM_SLEEP
+
+ if (got_thd_data)
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
+ arg->thread_infos.append(thd_info);
+ }
+ return 0;
+}
+
+
void mysqld_list_processes(THD *thd,const char *user, bool verbose)
{
Item *field;
List<Item> field_list;
- I_List<thread_info> thread_infos;
- ulong max_query_length= (verbose ? thd->variables.max_allowed_packet :
- PROCESS_LIST_WIDTH);
+ list_callback_arg arg(user, thd,
+ verbose ? thd->variables.max_allowed_packet :
+ PROCESS_LIST_WIDTH);
Protocol *protocol= thd->protocol;
MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_list_processes");
@@ -2771,7 +2869,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
mem_root);
field->maybe_null=1;
field_list.push_back(field=new (mem_root)
- Item_empty_string(thd, "Info", max_query_length),
+ Item_empty_string(thd, "Info", arg.max_query_length),
mem_root);
field->maybe_null=1;
if (!thd->variables.old_mode &&
@@ -2790,102 +2888,13 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if (thd->killed)
DBUG_VOID_RETURN;
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
- I_List_iterator<THD> it(threads);
- THD *tmp;
- while ((tmp=it++))
- {
- Security_context *tmp_sctx= tmp->security_ctx;
- bool got_thd_data;
- if ((tmp->vio_ok() || tmp->system_thread) &&
- (!user || (!tmp->system_thread &&
- tmp_sctx->user && !strcmp(tmp_sctx->user, user))))
- {
- thread_info *thd_info= new (thd->mem_root) thread_info;
-
- thd_info->thread_id=tmp->thread_id;
- thd_info->os_thread_id=tmp->os_thread_id;
- thd_info->user= thd->strdup(tmp_sctx->user ? tmp_sctx->user :
- (tmp->system_thread ?
- "system user" : "unauthenticated user"));
- if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
- thd->security_ctx->host_or_ip[0])
- {
- if ((thd_info->host= (char*) thd->alloc(LIST_PROCESS_HOST_LEN+1)))
- my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN,
- "%s:%u", tmp_sctx->host_or_ip, tmp->peer_port);
- }
- else
- thd_info->host= thd->strdup(tmp_sctx->host_or_ip[0] ?
- tmp_sctx->host_or_ip :
- tmp_sctx->host ? tmp_sctx->host : "");
- thd_info->command=(int) tmp->get_command();
-
- if ((got_thd_data= !trylock_short(&tmp->LOCK_thd_data)))
- {
- /* This is an approximation */
- thd_info->proc_info= (char*) (tmp->killed >= KILL_QUERY ?
- "Killed" : 0);
- /*
- The following variables are only safe to access under a lock
- */
-
- thd_info->db= 0;
- if (tmp->db.str)
- thd_info->db= thd->strmake(tmp->db.str, tmp->db.length);
-
- if (tmp->query())
- {
- uint length= MY_MIN(max_query_length, tmp->query_length());
- char *q= thd->strmake(tmp->query(),length);
- /* Safety: in case strmake failed, we set length to 0. */
- thd_info->query_string=
- CSET_STRING(q, q ? length : 0, tmp->query_charset());
- }
+ server_threads.iterate(list_callback, &arg);
- /*
- Progress report. We need to do this under a lock to ensure that all
- is from the same stage.
- */
- if (tmp->progress.max_counter)
- {
- uint max_stage= MY_MAX(tmp->progress.max_stage, 1);
- thd_info->progress= (((tmp->progress.stage / (double) max_stage) +
- ((tmp->progress.counter /
- (double) tmp->progress.max_counter) /
- (double) max_stage)) *
- 100.0);
- set_if_smaller(thd_info->progress, 100);
- }
- else
- thd_info->progress= 0.0;
- }
- else
- {
- thd_info->proc_info= "Busy";
- thd_info->progress= 0.0;
- thd_info->db= "";
- }
-
- thd_info->state_info= thread_state_info(tmp);
- thd_info->start_time= tmp->start_utime;
- ulonglong utime_after_query_snapshot= tmp->utime_after_query;
- if (thd_info->start_time < utime_after_query_snapshot)
- thd_info->start_time= utime_after_query_snapshot; // COM_SLEEP
-
- if (got_thd_data)
- mysql_mutex_unlock(&tmp->LOCK_thd_data);
- thread_infos.append(thd_info);
- }
- }
- mysql_mutex_unlock(&LOCK_thread_count);
-
- thread_info *thd_info;
ulonglong now= microsecond_interval_timer();
char buff[20]; // For progress
String store_buffer(buff, sizeof(buff), system_charset_info);
- while ((thd_info=thread_infos.get()))
+ while (auto thd_info= arg.thread_infos.get())
{
protocol->prepare_for_resend();
protocol->store(thd_info->thread_id);
@@ -3169,152 +3178,150 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
}
-int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
+struct processlist_callback_arg
{
- TABLE *table= tables->table;
- CHARSET_INFO *cs= system_charset_info;
- char *user;
- ulonglong unow= microsecond_interval_timer();
- DBUG_ENTER("fill_schema_processlist");
+ processlist_callback_arg(THD *thd_arg, TABLE *table_arg):
+ thd(thd_arg), table(table_arg), unow(microsecond_interval_timer()) {}
+ THD *thd;
+ TABLE *table;
+ ulonglong unow;
+};
- DEBUG_SYNC(thd,"fill_schema_processlist_after_unow");
- user= thd->security_ctx->master_access & PROCESS_ACL ?
- NullS : thd->security_ctx->priv_user;
+static my_bool processlist_callback(THD *tmp, processlist_callback_arg *arg)
+{
+ Security_context *tmp_sctx= tmp->security_ctx;
+ CHARSET_INFO *cs= system_charset_info;
+ const char *val;
+ ulonglong max_counter;
+ bool got_thd_data;
+ char *user= arg->thd->security_ctx->master_access & PROCESS_ACL ?
+ NullS : arg->thd->security_ctx->priv_user;
+
+ if ((!tmp->vio_ok() && !tmp->system_thread) ||
+ (user && (tmp->system_thread || !tmp_sctx->user ||
+ strcmp(tmp_sctx->user, user))))
+ return 0;
- mysql_mutex_lock(&LOCK_thread_count);
+ restore_record(arg->table, s->default_values);
+ /* ID */
+ arg->table->field[0]->store((longlong) tmp->thread_id, TRUE);
+ /* USER */
+ val= tmp_sctx->user ? tmp_sctx->user :
+ (tmp->system_thread ? "system user" : "unauthenticated user");
+ arg->table->field[1]->store(val, strlen(val), cs);
+ /* HOST */
+ if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
+ arg->thd->security_ctx->host_or_ip[0])
+ {
+ char host[LIST_PROCESS_HOST_LEN + 1];
+ my_snprintf(host, LIST_PROCESS_HOST_LEN, "%s:%u",
+ tmp_sctx->host_or_ip, tmp->peer_port);
+ arg->table->field[2]->store(host, strlen(host), cs);
+ }
+ else
+ arg->table->field[2]->store(tmp_sctx->host_or_ip,
+ strlen(tmp_sctx->host_or_ip), cs);
- if (!thd->killed)
+ if ((got_thd_data= !trylock_short(&tmp->LOCK_thd_data)))
{
- I_List_iterator<THD> it(threads);
- THD* tmp;
-
- while ((tmp= it++))
+ /* DB */
+ if (tmp->db.str)
{
- Security_context *tmp_sctx= tmp->security_ctx;
- const char *val;
- ulonglong max_counter;
- bool got_thd_data;
-
- if ((!tmp->vio_ok() && !tmp->system_thread) ||
- (user && (tmp->system_thread || !tmp_sctx->user ||
- strcmp(tmp_sctx->user, user))))
- continue;
-
- restore_record(table, s->default_values);
- /* ID */
- table->field[0]->store((longlong) tmp->thread_id, TRUE);
- /* USER */
- val= tmp_sctx->user ? tmp_sctx->user :
- (tmp->system_thread ? "system user" : "unauthenticated user");
- table->field[1]->store(val, strlen(val), cs);
- /* HOST */
- if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
- thd->security_ctx->host_or_ip[0])
- {
- char host[LIST_PROCESS_HOST_LEN + 1];
- my_snprintf(host, LIST_PROCESS_HOST_LEN, "%s:%u",
- tmp_sctx->host_or_ip, tmp->peer_port);
- table->field[2]->store(host, strlen(host), cs);
- }
- else
- table->field[2]->store(tmp_sctx->host_or_ip,
- strlen(tmp_sctx->host_or_ip), cs);
+ arg->table->field[3]->store(tmp->db.str, tmp->db.length, cs);
+ arg->table->field[3]->set_notnull();
+ }
+ }
- if ((got_thd_data= !trylock_short(&tmp->LOCK_thd_data)))
- {
- /* DB */
- if (tmp->db.str)
- {
- table->field[3]->store(tmp->db.str, tmp->db.length, cs);
- table->field[3]->set_notnull();
- }
- }
+ /* COMMAND */
+ if ((val= (char *) (!got_thd_data ? "Busy" :
+ (tmp->killed >= KILL_QUERY ?
+ "Killed" : 0))))
+ arg->table->field[4]->store(val, strlen(val), cs);
+ else
+ arg->table->field[4]->store(command_name[tmp->get_command()].str,
+ command_name[tmp->get_command()].length, cs);
- /* COMMAND */
- if ((val= (char *) (!got_thd_data ? "Busy" :
- (tmp->killed >= KILL_QUERY ?
- "Killed" : 0))))
- table->field[4]->store(val, strlen(val), cs);
- else
- table->field[4]->store(command_name[tmp->get_command()].str,
- command_name[tmp->get_command()].length, cs);
+ /* MYSQL_TIME */
+ ulonglong utime= tmp->start_utime;
+ ulonglong utime_after_query_snapshot= tmp->utime_after_query;
+ if (utime < utime_after_query_snapshot)
+ utime= utime_after_query_snapshot; // COM_SLEEP
+ utime= utime && utime < arg->unow ? arg->unow - utime : 0;
- /* MYSQL_TIME */
- ulonglong utime= tmp->start_utime;
- ulonglong utime_after_query_snapshot= tmp->utime_after_query;
- if (utime < utime_after_query_snapshot)
- utime= utime_after_query_snapshot; // COM_SLEEP
- utime= utime && utime < unow ? unow - utime : 0;
+ arg->table->field[5]->store(utime / HRTIME_RESOLUTION, TRUE);
- table->field[5]->store(utime / HRTIME_RESOLUTION, TRUE);
+ if (got_thd_data)
+ {
+ if (tmp->query())
+ {
+ arg->table->field[7]->store(tmp->query(),
+ MY_MIN(PROCESS_LIST_INFO_WIDTH,
+ tmp->query_length()), cs);
+ arg->table->field[7]->set_notnull();
- if (got_thd_data)
- {
- if (tmp->query())
- {
- table->field[7]->store(tmp->query(),
- MY_MIN(PROCESS_LIST_INFO_WIDTH,
- tmp->query_length()), cs);
- table->field[7]->set_notnull();
+ /* INFO_BINARY */
+ arg->table->field[16]->store(tmp->query(),
+ MY_MIN(PROCESS_LIST_INFO_WIDTH,
+ tmp->query_length()),
+ &my_charset_bin);
+ arg->table->field[16]->set_notnull();
+ }
- /* INFO_BINARY */
- table->field[16]->store(tmp->query(),
- MY_MIN(PROCESS_LIST_INFO_WIDTH,
- tmp->query_length()),
- &my_charset_bin);
- table->field[16]->set_notnull();
- }
+ /*
+ Progress report. We need to do this under a lock to ensure that all
+ is from the same stage.
+ */
+ if ((max_counter= tmp->progress.max_counter))
+ {
+ arg->table->field[9]->store((longlong) tmp->progress.stage + 1, 1);
+ arg->table->field[10]->store((longlong) tmp->progress.max_stage, 1);
+ arg->table->field[11]->store((double) tmp->progress.counter /
+ (double) max_counter*100.0);
+ }
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
+ }
- /*
- Progress report. We need to do this under a lock to ensure that all
- is from the same stage.
- */
- if ((max_counter= tmp->progress.max_counter))
- {
- table->field[9]->store((longlong) tmp->progress.stage + 1, 1);
- table->field[10]->store((longlong) tmp->progress.max_stage, 1);
- table->field[11]->store((double) tmp->progress.counter /
- (double) max_counter*100.0);
- }
- mysql_mutex_unlock(&tmp->LOCK_thd_data);
- }
+ /* STATE */
+ if ((val= thread_state_info(tmp)))
+ {
+ arg->table->field[6]->store(val, strlen(val), cs);
+ arg->table->field[6]->set_notnull();
+ }
- /* STATE */
- if ((val= thread_state_info(tmp)))
- {
- table->field[6]->store(val, strlen(val), cs);
- table->field[6]->set_notnull();
- }
+ /* TIME_MS */
+ arg->table->field[8]->store((double)(utime / (HRTIME_RESOLUTION / 1000.0)));
- /* TIME_MS */
- table->field[8]->store((double)(utime / (HRTIME_RESOLUTION / 1000.0)));
+ /*
+ This may become negative if we free a memory allocated by another
+ thread in this thread. However it's better that we notice it eventually
+ than hide it.
+ */
+ arg->table->field[12]->store((longlong) tmp->status_var.local_memory_used,
+ FALSE);
+ arg->table->field[13]->store((longlong) tmp->status_var.max_local_memory_used,
+ FALSE);
+ arg->table->field[14]->store((longlong) tmp->get_examined_row_count(), TRUE);
- /*
- This may become negative if we free a memory allocated by another
- thread in this thread. However it's better that we notice it eventually
- than hide it.
- */
- table->field[12]->store((longlong) tmp->status_var.local_memory_used,
- FALSE);
- table->field[13]->store((longlong) tmp->status_var.max_local_memory_used,
- FALSE);
- table->field[14]->store((longlong) tmp->get_examined_row_count(), TRUE);
+ /* QUERY_ID */
+ arg->table->field[15]->store(tmp->query_id, TRUE);
- /* QUERY_ID */
- table->field[15]->store(tmp->query_id, TRUE);
+ arg->table->field[17]->store(tmp->os_thread_id);
- table->field[17]->store(tmp->os_thread_id);
+ if (schema_table_store_record(arg->thd, arg->table))
+ return 1;
+ return 0;
+}
- if (schema_table_store_record(thd, table))
- {
- mysql_mutex_unlock(&LOCK_thread_count);
- DBUG_RETURN(1);
- }
- }
- }
- mysql_mutex_unlock(&LOCK_thread_count);
+int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
+{
+ processlist_callback_arg arg(thd, tables->table);
+ DBUG_ENTER("fill_schema_processlist");
+ DEBUG_SYNC(thd,"fill_schema_processlist_after_unow");
+ if (!thd->killed &&
+ server_threads.iterate(processlist_callback, &arg))
+ DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -3376,7 +3383,7 @@ int add_status_vars(SHOW_VAR *list)
{
int res= 0;
if (status_vars_inited)
- mysql_mutex_lock(&LOCK_show_status);
+ mysql_rwlock_wrlock(&LOCK_all_status_vars);
if (!all_status_vars.buffer && // array is not allocated yet - do it now
my_init_dynamic_array(&all_status_vars, sizeof(SHOW_VAR), 250, 50, MYF(0)))
{
@@ -3391,7 +3398,7 @@ int add_status_vars(SHOW_VAR *list)
sort_dynamic(&all_status_vars, show_var_cmp);
err:
if (status_vars_inited)
- mysql_mutex_unlock(&LOCK_show_status);
+ mysql_rwlock_unlock(&LOCK_all_status_vars);
return res;
}
@@ -3453,7 +3460,7 @@ void remove_status_vars(SHOW_VAR *list)
{
if (status_vars_inited)
{
- mysql_mutex_lock(&LOCK_show_status);
+ mysql_rwlock_wrlock(&LOCK_all_status_vars);
SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
for (; list->name; list++)
@@ -3474,7 +3481,7 @@ void remove_status_vars(SHOW_VAR *list)
}
}
shrink_var_array(&all_status_vars);
- mysql_mutex_unlock(&LOCK_show_status);
+ mysql_rwlock_unlock(&LOCK_all_status_vars);
}
else
{
@@ -3770,36 +3777,38 @@ end:
Return number of threads used
*/
-uint calc_sum_of_all_status(STATUS_VAR *to)
+struct calc_sum_callback_arg
{
- uint count= 0;
- DBUG_ENTER("calc_sum_of_all_status");
+ calc_sum_callback_arg(STATUS_VAR *to_arg): to(to_arg), count(0) {}
+ STATUS_VAR *to;
+ uint count;
+};
- /* Ensure that thread id not killed during loop */
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
- I_List_iterator<THD> it(threads);
- THD *tmp;
+static my_bool calc_sum_callback(THD *thd, calc_sum_callback_arg *arg)
+{
+ arg->count++;
+ if (!thd->status_in_global)
+ {
+ add_to_status(arg->to, &thd->status_var);
+ arg->to->local_memory_used+= thd->status_var.local_memory_used;
+ }
+ if (thd->get_command() != COM_SLEEP)
+ arg->to->threads_running++;
+ return 0;
+}
+
+
+uint calc_sum_of_all_status(STATUS_VAR *to)
+{
+ calc_sum_callback_arg arg(to);
+ DBUG_ENTER("calc_sum_of_all_status");
- /* Get global values as base */
*to= global_status_var;
to->local_memory_used= 0;
-
/* Add to this status from existing threads */
- while ((tmp= it++))
- {
- count++;
- if (!tmp->status_in_global)
- {
- add_to_status(to, &tmp->status_var);
- to->local_memory_used+= tmp->status_var.local_memory_used;
- }
- if (tmp->get_command() != COM_SLEEP)
- to->threads_running++;
- }
-
- mysql_mutex_unlock(&LOCK_thread_count);
- DBUG_RETURN(count);
+ server_threads.iterate(calc_sum_callback, &arg);
+ DBUG_RETURN(arg.count);
}
@@ -6332,7 +6341,6 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
const char *wild, bool full_access, const char *sp_user)
{
- MYSQL_TIME time;
LEX *lex= thd->lex;
CHARSET_INFO *cs= system_charset_info;
const Sp_handler *sph;
@@ -6420,14 +6428,11 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
copy_field_as_string(table->field[22],
proc_table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]);
- bzero((char *)&time, sizeof(time));
- ((Field_timestamp *) proc_table->field[MYSQL_PROC_FIELD_CREATED])->
- get_time(&time);
- table->field[23]->store_time(&time);
- bzero((char *)&time, sizeof(time));
- ((Field_timestamp *) proc_table->field[MYSQL_PROC_FIELD_MODIFIED])->
- get_time(&time);
- table->field[24]->store_time(&time);
+ proc_table->field[MYSQL_PROC_FIELD_CREATED]->
+ save_in_field(table->field[23]);
+ proc_table->field[MYSQL_PROC_FIELD_MODIFIED]->
+ save_in_field(table->field[24]);
+
copy_field_as_string(table->field[25],
proc_table->field[MYSQL_PROC_FIELD_SQL_MODE]);
copy_field_as_string(table->field[26],
@@ -7499,7 +7504,8 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables,
}
else if (part_info->vers_info->interval.is_set())
{
- table->field[11]->store_timestamp((my_time_t)part_elem->range_value, 0);
+ Timeval tv((my_time_t) part_elem->range_value, 0);
+ table->field[11]->store_timestamp_dec(tv, AUTO_SEC_PART_DIGITS);
table->field[11]->set_notnull();
}
}
@@ -7685,11 +7691,11 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
sch_table->field[ISE_ON_COMPLETION]->
store(STRING_WITH_LEN("PRESERVE"), scs);
- number_to_datetime(et.created, 0, &time, 0, &not_used);
+ number_to_datetime_or_date(et.created, 0, &time, 0, &not_used);
DBUG_ASSERT(not_used==0);
sch_table->field[ISE_CREATED]->store_time(&time);
- number_to_datetime(et.modified, 0, &time, 0, &not_used);
+ number_to_datetime_or_date(et.modified, 0, &time, 0, &not_used);
DBUG_ASSERT(not_used==0);
sch_table->field[ISE_LAST_ALTERED]->store_time(&time);
@@ -7830,18 +7836,15 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
if (scope == OPT_GLOBAL)
{
- /* We only hold LOCK_status for summary status vars */
- mysql_mutex_lock(&LOCK_status);
calc_sum_of_all_status(&tmp);
- mysql_mutex_unlock(&LOCK_status);
}
- mysql_mutex_lock(&LOCK_show_status);
+ mysql_rwlock_rdlock(&LOCK_all_status_vars);
res= show_status_array(thd, wild,
(SHOW_VAR *)all_status_vars.buffer,
scope, tmp1, "", tables->table,
upper_case_names, partial_cond);
- mysql_mutex_unlock(&LOCK_show_status);
+ mysql_rwlock_unlock(&LOCK_all_status_vars);
DBUG_RETURN(res);
}
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc
index 83abaebd4fd..359b5e45f01 100644
--- a/sql/sql_signal.cc
+++ b/sql/sql_signal.cc
@@ -343,13 +343,15 @@ bool Sql_cmd_common_signal::raise_condition(THD *thd, Sql_condition *cond)
if (eval_signal_informations(thd, cond))
DBUG_RETURN(result);
- /* SIGNAL should not signal WARN_LEVEL_NOTE */
- DBUG_ASSERT((cond->m_level == Sql_condition::WARN_LEVEL_WARN) ||
- (cond->m_level == Sql_condition::WARN_LEVEL_ERROR));
+ /* SIGNAL should not signal WARN_LEVEL_NOTE, but RESIGNAL can */
+ DBUG_ASSERT(cond->m_level == Sql_condition::WARN_LEVEL_ERROR ||
+ cond->m_level != Sql_condition::WARN_LEVEL_NOTE ||
+ sql_command_code() == SQLCOM_RESIGNAL);
(void) thd->raise_condition(cond);
- if (cond->m_level == Sql_condition::WARN_LEVEL_WARN)
+ if (cond->m_level == Sql_condition::WARN_LEVEL_WARN ||
+ cond->m_level == Sql_condition::WARN_LEVEL_NOTE)
{
my_ok(thd);
result= FALSE;
diff --git a/sql/sql_sort.h b/sql/sql_sort.h
index c29bf1440c9..231bc93ce75 100644
--- a/sql/sql_sort.h
+++ b/sql/sql_sort.h
@@ -92,7 +92,6 @@ public:
memset(this, 0, sizeof(*this));
}
void init_for_filesort(uint sortlen, TABLE *table,
- ulong max_length_for_sort_data,
ha_rows maxrows, bool sort_positions);
};
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 04806f07b3b..db214a1fe28 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -29,8 +29,8 @@
#include "sql_statistics.h"
#include "opt_range.h"
#include "uniques.h"
-#include "my_atomic.h"
#include "sql_show.h"
+#include "sql_partition.h"
/*
The system variable 'use_stat_tables' can take one of the
@@ -3253,7 +3253,7 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
{
TABLE_LIST stat_tables[STATISTICS_TABLES];
Open_tables_backup open_tables_backup;
-
+ bool has_error_active= thd->is_error();
DBUG_ENTER("read_statistics_for_tables_if_needed");
DEBUG_SYNC(thd, "statistics_read_start");
@@ -3263,7 +3263,8 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
if (open_stat_tables(thd, stat_tables, &open_tables_backup, FALSE))
{
- thd->clear_error();
+ if (!has_error_active)
+ thd->clear_error();
DBUG_RETURN(1);
}
@@ -3317,7 +3318,7 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
'db' from all statistical tables: table_stats, column_stats, index_stats.
@retval
- 0 If all deletions are successful
+ 0 If all deletions are successful or we couldn't open statistics table
@retval
1 Otherwise
@@ -3325,7 +3326,8 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
The function is called when executing the statement DROP TABLE 'tab'.
*/
-int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab)
+int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db,
+ const LEX_CSTRING *tab)
{
int err;
enum_binlog_format save_binlog_format;
@@ -3333,11 +3335,15 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, const LEX_CSTRI
TABLE_LIST tables[STATISTICS_TABLES];
Open_tables_backup open_tables_backup;
int rc= 0;
-
+ bool has_error_active= thd->is_error();
DBUG_ENTER("delete_statistics_for_table");
if (open_stat_tables(thd, tables, &open_tables_backup, TRUE))
- DBUG_RETURN(rc);
+ {
+ if (!has_error_active)
+ thd->clear_error();
+ DBUG_RETURN(0);
+ }
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
@@ -3402,7 +3408,7 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, const LEX_CSTRI
'tab' from the statistical table column_stats.
@retval
- 0 If the deletion is successful
+ 0 If all deletions are successful or we couldn't open statistics table
@retval
1 Otherwise
@@ -3419,14 +3425,15 @@ int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col)
TABLE_LIST tables;
Open_tables_backup open_tables_backup;
int rc= 0;
-
+ bool has_error_active= thd->is_error();
DBUG_ENTER("delete_statistics_for_column");
if (open_single_stat_table(thd, &tables, &stat_table_name[1],
&open_tables_backup, TRUE))
{
- thd->clear_error();
- DBUG_RETURN(rc);
+ if (!has_error_active)
+ thd->clear_error();
+ DBUG_RETURN(0);
}
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
@@ -3468,7 +3475,7 @@ int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col)
defined on the table 'tab' from the statistical table index_stats.
@retval
- 0 If the deletion is successful
+ 0 If all deletions are successful or we couldn't open statistics table
@retval
1 Otherwise
@@ -3486,14 +3493,15 @@ int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info,
TABLE_LIST tables;
Open_tables_backup open_tables_backup;
int rc= 0;
-
+ bool has_error_active= thd->is_error();
DBUG_ENTER("delete_statistics_for_index");
if (open_single_stat_table(thd, &tables, &stat_table_name[2],
&open_tables_backup, TRUE))
{
- thd->clear_error();
- DBUG_RETURN(rc);
+ if (!has_error_active)
+ thd->clear_error();
+ DBUG_RETURN(0);
}
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
@@ -3563,8 +3571,10 @@ int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info,
The function is called when executing any statement that renames a table
*/
-int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab,
- const LEX_CSTRING *new_db, const LEX_CSTRING *new_tab)
+int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db,
+ const LEX_CSTRING *tab,
+ const LEX_CSTRING *new_db,
+ const LEX_CSTRING *new_tab)
{
int err;
enum_binlog_format save_binlog_format;
@@ -3575,7 +3585,9 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, const LEX_CSTRI
DBUG_ENTER("rename_table_in_stat_tables");
if (open_stat_tables(thd, tables, &open_tables_backup, TRUE))
+ {
DBUG_RETURN(0); // not an error
+ }
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
@@ -3667,7 +3679,7 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
TABLE_LIST tables;
Open_tables_backup open_tables_backup;
int rc= 0;
-
+ bool has_error_active= thd->is_error();
DBUG_ENTER("rename_column_in_stat_tables");
if (tab->s->tmp_table != NO_TMP_TABLE)
@@ -3676,7 +3688,8 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
if (open_single_stat_table(thd, &tables, &stat_table_name[1],
&open_tables_backup, TRUE))
{
- thd->clear_error();
+ if (!has_error_active)
+ thd->clear_error();
DBUG_RETURN(rc);
}
@@ -3720,17 +3733,32 @@ void set_statistics_for_table(THD *thd, TABLE *table)
{
TABLE_STATISTICS_CB *stats_cb= &table->s->stats_cb;
Table_statistics *read_stats= stats_cb->table_stats;
- Use_stat_tables_mode use_stat_table_mode= get_use_stat_tables_mode(thd);
table->used_stat_records=
- (use_stat_table_mode <= COMPLEMENTARY ||
+ (!check_eits_preferred(thd) ||
!table->stats_is_read || read_stats->cardinality_is_null) ?
table->file->stats.records : read_stats->cardinality;
+
+ /*
+ For partitioned table, EITS statistics is based on data from all partitions.
+
+ On the other hand, Partition Pruning figures which partitions will be
+ accessed and then computes the estimate of rows in used_partitions.
+
+ Use the estimate from Partition Pruning as it is typically more precise.
+ Ideally, EITS should provide per-partition statistics but this is not
+ implemented currently.
+ */
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ if (table->part_info)
+ table->used_stat_records= table->file->stats.records;
+#endif
+
KEY *key_info, *key_info_end;
for (key_info= table->key_info, key_info_end= key_info+table->s->keys;
key_info < key_info_end; key_info++)
{
key_info->is_statistics_from_stat_tables=
- (use_stat_table_mode > COMPLEMENTARY &&
+ (check_eits_preferred(thd) &&
table->stats_is_read &&
key_info->read_stats->avg_frequency_is_inited() &&
key_info->read_stats->get_avg_frequency(0) > 0.5);
@@ -4043,3 +4071,29 @@ bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table)
}
return false;
}
+
+/*
+ Check wheter we can use EITS statistics for a field or not
+
+ TRUE : Use EITS for the columns
+ FALSE: Otherwise
+*/
+
+bool is_eits_usable(Field *field)
+{
+ /*
+ (1): checks if we have EITS statistics for a particular column
+ (2): Don't use EITS for GEOMETRY columns
+ (3): Disabling reading EITS statistics for columns involved in the
+ partition list of a table. We assume the selecticivity for
+ such columns would be handled during partition pruning.
+ */
+ Column_statistics* col_stats= field->read_stats;
+ return col_stats && !col_stats->no_stat_values_provided() && //(1)
+ field->type() != MYSQL_TYPE_GEOMETRY && //(2)
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ (!field->table->part_info ||
+ !field->table->part_info->field_in_partition_expr(field)) && //(3)
+#endif
+ true;
+}
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index 39cddf95188..3ed4006efd3 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -16,12 +16,26 @@
#ifndef SQL_STATISTICS_H
#define SQL_STATISTICS_H
+/*
+ For COMPLEMENTARY_FOR_QUERIES and PREFERABLY_FOR_QUERIES they are
+ similar to the COMPLEMENTARY and PREFERABLY respectively except that
+ with these values we would not be collecting EITS for queries like
+ ANALYZE TABLE t1;
+ To collect EITS with these values, we have to use PERSISITENT FOR
+ analyze table t1 persistent for
+ columns (col1,col2...) index (idx1, idx2...)
+ or
+ analyze table t1 persistent for all
+*/
+
typedef
enum enum_use_stat_tables_mode
{
NEVER,
COMPLEMENTARY,
PREFERABLY,
+ COMPLEMENTARY_FOR_QUERIES,
+ PREFERABLY_FOR_QUERIES
} Use_stat_tables_mode;
typedef
@@ -87,6 +101,19 @@ Use_stat_tables_mode get_use_stat_tables_mode(THD *thd)
{
return (Use_stat_tables_mode) (thd->variables.use_stat_tables);
}
+inline
+bool check_eits_collection_allowed(THD *thd)
+{
+ return (get_use_stat_tables_mode(thd) == COMPLEMENTARY ||
+ get_use_stat_tables_mode(thd) == PREFERABLY);
+}
+
+inline
+bool check_eits_preferred(THD *thd)
+{
+ return (get_use_stat_tables_mode(thd) == PREFERABLY ||
+ get_use_stat_tables_mode(thd) == PREFERABLY_FOR_QUERIES);
+}
int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables);
int collect_statistics_for_table(THD *thd, TABLE *table);
@@ -112,6 +139,7 @@ double get_column_range_cardinality(Field *field,
key_range *max_endp,
uint range_flag);
bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table);
+bool is_eits_usable(Field* field);
class Histogram
{
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 39d9438d5bf..45af08f8966 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -31,7 +31,7 @@
** String functions
*****************************************************************************/
-bool String::real_alloc(size_t length)
+bool Binary_string::real_alloc(size_t length)
{
size_t arg_length= ALIGN_SIZE(length + 1);
DBUG_ASSERT(arg_length > length);
@@ -81,7 +81,7 @@ bool String::real_alloc(size_t length)
@retval true An error occurred when attempting to allocate memory.
*/
-bool String::realloc_raw(size_t alloc_length)
+bool Binary_string::realloc_raw(size_t alloc_length)
{
if (Alloced_length <= alloc_length)
{
@@ -126,19 +126,18 @@ bool String::set_int(longlong num, bool unsigned_flag, CHARSET_INFO *cs)
if (alloc(l))
return TRUE;
str_length=(uint32) (cs->cset->longlong10_to_str)(cs,Ptr,l,base,num);
- str_charset=cs;
+ set_charset(cs);
return FALSE;
}
// Convert a number into its HEX representation
-bool String::set_hex(ulonglong num)
+bool Binary_string::set_hex(ulonglong num)
{
char *n_end;
if (alloc(65) || !(n_end= longlong2str(num, Ptr, 16)))
return true;
length((uint32) (n_end - Ptr));
- set_charset(&my_charset_latin1);
return false;
}
@@ -156,7 +155,7 @@ static inline void APPEND_HEX(char *&to, uchar value)
}
-void String::qs_append_hex(const char *str, uint32 len)
+void Static_binary_string::qs_append_hex(const char *str, uint32 len)
{
const char *str_end= str + len;
for (char *to= Ptr + str_length ; str < str_end; str++)
@@ -166,7 +165,7 @@ void String::qs_append_hex(const char *str, uint32 len)
// Convert a string to its HEX representation
-bool String::set_hex(const char *str, uint32 len)
+bool Binary_string::set_hex(const char *str, uint32 len)
{
/*
Safety: cut the source string if "len" is too large.
@@ -180,7 +179,6 @@ bool String::set_hex(const char *str, uint32 len)
return true;
length(0);
qs_append_hex(str, len);
- set_charset(&my_charset_latin1);
return false;
}
@@ -191,7 +189,7 @@ bool String::set_real(double num,uint decimals, CHARSET_INFO *cs)
uint dummy_errors;
size_t len;
- str_charset=cs;
+ set_charset(cs);
if (decimals >= FLOATING_POINT_DECIMALS)
{
len= my_gcvt(num, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL);
@@ -203,7 +201,7 @@ bool String::set_real(double num,uint decimals, CHARSET_INFO *cs)
}
-bool String::copy()
+bool Binary_string::copy()
{
if (!alloced)
{
@@ -224,18 +222,17 @@ bool String::copy()
@retval false Success.
@retval true Memory allocation failed.
*/
-bool String::copy(const String &str)
+bool Binary_string::copy(const Binary_string &str)
{
if (alloc(str.str_length))
return TRUE;
str_length=str.str_length;
bmove(Ptr,str.Ptr,str_length); // May be overlapping
Ptr[str_length]=0;
- str_charset=str.str_charset;
return FALSE;
}
-bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
+bool Binary_string::copy(const char *str, size_t arg_length)
{
DBUG_ASSERT(arg_length < UINT_MAX32);
if (alloc(arg_length))
@@ -252,7 +249,6 @@ bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
else if ((str_length=uint32(arg_length)))
memcpy(Ptr,str,arg_length);
Ptr[arg_length]=0;
- str_charset=cs;
return FALSE;
}
@@ -262,7 +258,7 @@ bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
from valgrind
*/
-bool String::copy_or_move(const char *str,size_t arg_length, CHARSET_INFO *cs)
+bool Binary_string::copy_or_move(const char *str, size_t arg_length)
{
DBUG_ASSERT(arg_length < UINT_MAX32);
if (alloc(arg_length))
@@ -270,7 +266,6 @@ bool String::copy_or_move(const char *str,size_t arg_length, CHARSET_INFO *cs)
if ((str_length=uint32(arg_length)))
memmove(Ptr,str,arg_length);
Ptr[arg_length]=0;
- str_charset=cs;
return FALSE;
}
@@ -396,7 +391,7 @@ bool String::copy_aligned(const char *str, size_t arg_length, size_t offset,
Ptr[aligned_length]=0;
/* str_length is always >= 0 as arg_length is != 0 */
str_length= (uint32)aligned_length;
- str_charset= cs;
+ set_charset(cs);
return FALSE;
}
@@ -449,7 +444,7 @@ bool String::copy(const char *str, size_t arg_length,
return TRUE;
str_length=copy_and_convert((char*) Ptr, new_length, to_cs,
str, arg_length, from_cs, errors);
- str_charset=to_cs;
+ set_charset(to_cs);
return FALSE;
}
@@ -475,19 +470,20 @@ bool String::copy(const char *str, size_t arg_length,
bool String::set_ascii(const char *str, size_t arg_length)
{
- if (str_charset->mbminlen == 1)
+ if (mbminlen() == 1)
{
- set(str, arg_length, str_charset);
+ set(str, arg_length, charset());
return 0;
}
uint dummy_errors;
- return copy(str, (uint32)arg_length, &my_charset_latin1, str_charset, &dummy_errors);
+ return copy(str, (uint32) arg_length, &my_charset_latin1,
+ charset(), &dummy_errors);
}
/* This is used by mysql.cc */
-bool String::fill(uint32 max_length,char fill_char)
+bool Binary_string::fill(uint32 max_length,char fill_char)
{
if (str_length > max_length)
Ptr[str_length=max_length]=0;
@@ -503,22 +499,10 @@ bool String::fill(uint32 max_length,char fill_char)
void String::strip_sp()
{
- while (str_length && my_isspace(str_charset,Ptr[str_length-1]))
+ while (str_length && my_isspace(charset(), Ptr[str_length-1]))
str_length--;
}
-bool String::append(const String &s)
-{
- if (s.length())
- {
- if (realloc_with_extra_if_needed(str_length+s.length()))
- return TRUE;
- memcpy(Ptr+str_length,s.ptr(),s.length());
- str_length+=s.length();
- }
- return FALSE;
-}
-
/*
Append an ASCII string to the a string of the current character set
@@ -534,13 +518,13 @@ bool String::append(const char *s,size_t size)
/*
For an ASCII incompatible string, e.g. UCS-2, we need to convert
*/
- if (str_charset->mbminlen > 1)
+ if (mbminlen() > 1)
{
- uint32 add_length=arg_length * str_charset->mbmaxlen;
+ uint32 add_length= arg_length * mbmaxlen();
uint dummy_errors;
if (realloc_with_extra_if_needed(str_length+ add_length))
return TRUE;
- str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset,
+ str_length+= copy_and_convert(Ptr + str_length, add_length, charset(),
s, arg_length, &my_charset_latin1,
&dummy_errors);
return FALSE;
@@ -549,24 +533,11 @@ bool String::append(const char *s,size_t size)
/*
For an ASCII compatinble string we can just append.
*/
- if (realloc_with_extra_if_needed(str_length+arg_length))
- return TRUE;
- memcpy(Ptr+str_length,s,arg_length);
- str_length+=arg_length;
- return FALSE;
+ return Binary_string::append(s, arg_length);
}
-/*
- Append a 0-terminated ASCII string
-*/
-
-bool String::append(const char *s)
-{
- return append(s, (uint) strlen(s));
-}
-
-bool String::append_longlong(longlong val)
+bool Binary_string::append_longlong(longlong val)
{
if (realloc(str_length+MAX_BIGINT_WIDTH+2))
return TRUE;
@@ -576,7 +547,7 @@ bool String::append_longlong(longlong val)
}
-bool String::append_ulonglong(ulonglong val)
+bool Binary_string::append_ulonglong(ulonglong val)
{
if (realloc(str_length+MAX_BIGINT_WIDTH+2))
return TRUE;
@@ -594,13 +565,13 @@ bool String::append(const char *s, size_t arg_length, CHARSET_INFO *cs)
{
uint32 offset;
- if (needs_conversion((uint32)arg_length, cs, str_charset, &offset))
+ if (needs_conversion((uint32)arg_length, cs, charset(), &offset))
{
size_t add_length;
if ((cs == &my_charset_bin) && offset)
{
- DBUG_ASSERT(str_charset->mbminlen > offset);
- offset= str_charset->mbminlen - offset; // How many characters to pad
+ DBUG_ASSERT(mbminlen() > offset);
+ offset= mbminlen() - offset; // How many characters to pad
add_length= arg_length + offset;
if (realloc(str_length + add_length))
return TRUE;
@@ -610,24 +581,19 @@ bool String::append(const char *s, size_t arg_length, CHARSET_INFO *cs)
return FALSE;
}
- add_length= arg_length / cs->mbminlen * str_charset->mbmaxlen;
+ add_length= arg_length / cs->mbminlen * mbmaxlen();
uint dummy_errors;
if (realloc_with_extra_if_needed(str_length + add_length))
return TRUE;
- str_length+= copy_and_convert(Ptr+str_length, (uint32)add_length, str_charset,
- s, (uint32)arg_length, cs, &dummy_errors);
+ str_length+= copy_and_convert(Ptr + str_length, (uint32)add_length, charset(),
+ s, (uint32)arg_length, cs, &dummy_errors);
+ return false;
}
- else
- {
- if (realloc_with_extra_if_needed(str_length + arg_length))
- return TRUE;
- memcpy(Ptr + str_length, s, arg_length);
- str_length+= (uint32)arg_length;
- }
- return FALSE;
+ return Binary_string::append(s, arg_length);
}
-bool String::append(IO_CACHE* file, uint32 arg_length)
+
+bool Binary_string::append(IO_CACHE* file, uint32 arg_length)
{
if (realloc_with_extra_if_needed(str_length+arg_length))
return TRUE;
@@ -675,19 +641,8 @@ bool String::append_with_prefill(const char *s,uint32 arg_length,
return FALSE;
}
-uint32 String::numchars() const
-{
- return (uint32) str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
-}
-
-int String::charpos(longlong i,uint32 offset)
-{
- if (i <= 0)
- return (int)i;
- return (int)str_charset->cset->charpos(str_charset,Ptr+offset,Ptr+str_length,(size_t)i);
-}
-int String::strstr(const String &s,uint32 offset)
+int Static_binary_string::strstr(const Static_binary_string &s, uint32 offset)
{
if (s.length()+offset <= str_length)
{
@@ -718,7 +673,7 @@ skip:
** Search string from end. Offset is offset to the end of string
*/
-int String::strrstr(const String &s,uint32 offset)
+int Static_binary_string::strrstr(const Static_binary_string &s, uint32 offset)
{
if (s.length() <= offset && offset <= str_length)
{
@@ -745,18 +700,9 @@ skip:
return -1;
}
-/*
- Replace substring with string
- If wrong parameter or not enough memory, do nothing
-*/
-
-bool String::replace(uint32 offset,uint32 arg_length,const String &to)
-{
- return replace(offset,arg_length,to.ptr(),to.length());
-}
-bool String::replace(uint32 offset,uint32 arg_length,
- const char *to, uint32 to_length)
+bool Binary_string::replace(uint32 offset, uint32 arg_length,
+ const char *to, uint32 to_length)
{
long diff = (long) to_length-(long) arg_length;
if (offset+arg_length <= str_length)
@@ -787,7 +733,7 @@ bool String::replace(uint32 offset,uint32 arg_length,
// added by Holyfoot for "geometry" needs
-int String::reserve(size_t space_needed, size_t grow_by)
+int Binary_string::reserve(size_t space_needed, size_t grow_by)
{
if (Alloced_length < str_length + space_needed)
{
@@ -797,34 +743,34 @@ int String::reserve(size_t space_needed, size_t grow_by)
return FALSE;
}
-void String::qs_append(const char *str, size_t len)
+void Static_binary_string::qs_append(const char *str, size_t len)
{
memcpy(Ptr + str_length, str, len + 1);
str_length += (uint32)len;
}
-void String::qs_append(double d)
+void Static_binary_string::qs_append(double d)
{
char *buff = Ptr + str_length;
str_length+= (uint32) my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
NULL);
}
-void String::qs_append(double *d)
+void Static_binary_string::qs_append(double *d)
{
double ld;
float8get(ld, (char*) d);
qs_append(ld);
}
-void String::qs_append(int i)
+void Static_binary_string::qs_append(int i)
{
char *buff= Ptr + str_length;
char *end= int10_to_str(i, buff, -10);
str_length+= (int) (end-buff);
}
-void String::qs_append(ulonglong i)
+void Static_binary_string::qs_append(ulonglong i)
{
char *buff= Ptr + str_length;
char *end= longlong10_to_str(i, buff, 10);
@@ -946,12 +892,12 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
of a constant string.
Not safe to reuse.
*/
- if (from->Alloced_length > 0) // "from" is #c or #d (not a constant)
+ if (from->alloced_length() > 0) // "from" is #c or #d (not a constant)
{
- if (from->Alloced_length >= from_length)
+ if (from->alloced_length() >= from_length)
return from; // #c or #d (large enough to store from_length bytes)
- if (from->alloced)
+ if (from->is_alloced())
{
(void) from->realloc(from_length);
return from; // #d (reallocated to fit from_length bytes)
@@ -990,16 +936,16 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
Note, as we can't distinguish between #a and #b for sure,
so we can't assert "not #a", but we can at least assert "not #e".
*/
- DBUG_ASSERT(!from->alloced || from->Alloced_length > 0); // Not #e
+ DBUG_ASSERT(!from->is_alloced() || from->alloced_length() > 0); // Not #e
(void) from->realloc(from_length);
return from;
}
- if (to->realloc(from_length))
+ if (to->alloc(from_length))
return from; // Actually an error
if ((to->str_length=MY_MIN(from->str_length,from_length)))
memcpy(to->Ptr,from->Ptr,to->str_length);
- to->str_charset=from->str_charset;
+ to->set_charset(*from);
return to; // "from" was of types #a, #b, #e, or small #c.
}
@@ -1159,26 +1105,6 @@ void String::print_with_conversion(String *print, CHARSET_INFO *cs) const
}
-/*
- Exchange state of this object and argument.
-
- SYNOPSIS
- String::swap()
-
- RETURN
- Target string will contain state of this object and vice versa.
-*/
-
-void String::swap(String &s)
-{
- swap_variables(char *, Ptr, s.Ptr);
- swap_variables(uint32, str_length, s.str_length);
- swap_variables(uint32, Alloced_length, s.Alloced_length);
- swap_variables(bool, alloced, s.alloced);
- swap_variables(CHARSET_INFO*, str_charset, s.str_charset);
-}
-
-
/**
Convert string to printable ASCII string
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 0ae68cb3796..a4574c2ef2d 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -126,56 +126,62 @@ uint convert_to_printable(char *to, size_t to_len,
const char *from, size_t from_len,
CHARSET_INFO *from_cs, size_t nbytes= 0);
-class String
+
+class Charset
{
- char *Ptr;
- uint32 str_length,Alloced_length, extra_alloc;
- bool alloced,thread_specific;
- CHARSET_INFO *str_charset;
+ CHARSET_INFO *m_charset;
public:
- String()
- {
- Ptr=0; str_length=Alloced_length=extra_alloc=0;
- alloced= thread_specific= 0;
- str_charset= &my_charset_bin;
+ Charset() :m_charset(&my_charset_bin) { }
+ Charset(CHARSET_INFO *cs) :m_charset(cs) { }
+
+ CHARSET_INFO *charset() const { return m_charset; }
+ uint mbminlen() const { return m_charset->mbminlen; }
+ uint mbmaxlen() const { return m_charset->mbmaxlen; }
+
+ size_t numchars(const char *str, const char *end) const
+ {
+ return m_charset->cset->numchars(m_charset, str, end);
}
- String(size_t length_arg)
- {
- alloced= thread_specific= 0;
- Alloced_length= extra_alloc= 0; (void) real_alloc(length_arg);
- str_charset= &my_charset_bin;
+ size_t charpos(const char *str, const char *end, size_t pos) const
+ {
+ return m_charset->cset->charpos(m_charset, str, end, pos);
}
- String(const char *str, CHARSET_INFO *cs)
- {
- Ptr=(char*) str; str_length= (uint32) strlen(str);
- Alloced_length= extra_alloc= 0;
- alloced= thread_specific= 0;
- str_charset=cs;
+ void set_charset(CHARSET_INFO *charset_arg)
+ {
+ m_charset= charset_arg;
}
- /*
- NOTE: If one intend to use the c_ptr() method, the following two
- contructors need the size of memory for STR to be at least LEN+1 (to make
- room for zero termination).
- */
- String(const char *str,size_t len, CHARSET_INFO *cs)
- {
- Ptr=(char*) str; str_length=(uint32)len; Alloced_length= extra_alloc=0;
- alloced= thread_specific= 0;
- str_charset=cs;
+ void set_charset(const Charset &other)
+ {
+ m_charset= other.m_charset;
}
- String(char *str,size_t len, CHARSET_INFO *cs)
- {
- Ptr=(char*) str; Alloced_length=str_length=(uint32)len; extra_alloc= 0;
- alloced= thread_specific= 0;
- str_charset=cs;
+ void swap(Charset &other)
+ {
+ swap_variables(CHARSET_INFO*, m_charset, other.m_charset);
}
- String(const String &str)
- {
- Ptr=str.Ptr ; str_length=str.str_length ;
- Alloced_length=str.Alloced_length; extra_alloc= 0;
- alloced= thread_specific= 0;
- str_charset=str.str_charset;
+};
+
+
+/*
+ A storage for String.
+ Should be eventually derived from LEX_STRING.
+*/
+class Static_binary_string
+{
+protected:
+ char *Ptr;
+ uint32 str_length;
+public:
+ Static_binary_string()
+ :Ptr(NULL),
+ str_length(0)
+ { }
+ Static_binary_string(char *str, size_t length_arg)
+ :Ptr(str),
+ str_length((uint32) length_arg)
+ {
+ DBUG_ASSERT(length_arg < UINT_MAX32);
}
+
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
{ return (void*) alloc_root(mem_root, size); }
static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
@@ -193,50 +199,13 @@ public:
static void operator delete[](void *, MEM_ROOT *)
{ /* never called */ }
- ~String() { free(); }
-
- /* Mark variable thread specific it it's not allocated already */
- inline void set_thread_specific()
- {
- if (!alloced)
- thread_specific= 1;
- }
- inline void set_charset(CHARSET_INFO *charset_arg)
- { str_charset= charset_arg; }
- inline CHARSET_INFO *charset() const { return str_charset; }
inline uint32 length() const { return str_length;}
- inline uint32 alloced_length() const { return Alloced_length;}
- inline uint32 extra_allocation() const { return extra_alloc;}
inline char& operator [] (size_t i) const { return Ptr[i]; }
inline void length(size_t len) { str_length=(uint32)len ; }
- inline void extra_allocation(size_t len) { extra_alloc= (uint32)len; }
inline bool is_empty() const { return (str_length == 0); }
- inline void mark_as_const() { Alloced_length= 0;}
inline const char *ptr() const { return Ptr; }
inline const char *end() const { return Ptr + str_length; }
- inline char *c_ptr()
- {
- DBUG_ASSERT(!alloced || !Ptr || !Alloced_length ||
- (Alloced_length >= (str_length + 1)));
- if (!Ptr || Ptr[str_length]) /* Should be safe */
- (void) realloc(str_length);
- return Ptr;
- }
- inline char *c_ptr_quick()
- {
- if (Ptr && str_length < Alloced_length)
- Ptr[str_length]=0;
- return Ptr;
- }
- inline char *c_ptr_safe()
- {
- if (Ptr && str_length < Alloced_length)
- Ptr[str_length]=0;
- else
- (void) realloc(str_length);
- return Ptr;
- }
LEX_STRING lex_string() const
{
LEX_STRING str = { (char*) ptr(), length() };
@@ -248,77 +217,32 @@ public:
return skr;
}
- void set(String &str,size_t offset,size_t arg_length)
- {
- DBUG_ASSERT(&str != this);
- free();
- Ptr=(char*) str.ptr()+offset; str_length=(uint32)arg_length;
- if (str.Alloced_length)
- Alloced_length=(uint32)(str.Alloced_length-offset);
- str_charset=str.str_charset;
- }
-
-
- /**
- Points the internal buffer to the supplied one. The old buffer is freed.
- @param str Pointer to the new buffer.
- @param arg_length Length of the new buffer in characters, excluding any
- null character.
- @param cs Character set to use for interpreting string data.
- @note The new buffer will not be null terminated.
- */
- inline void set(char *str,size_t arg_length, CHARSET_INFO *cs)
- {
- free();
- Ptr=(char*) str; str_length=Alloced_length=(uint32)arg_length;
- str_charset=cs;
- }
- inline void set(const char *str,size_t arg_length, CHARSET_INFO *cs)
+ bool has_8bit_bytes() const
{
- free();
- Ptr=(char*) str; str_length=(uint32)arg_length;
- str_charset=cs;
- }
- bool set_ascii(const char *str, size_t arg_length);
- inline void set_quick(char *str,size_t arg_length, CHARSET_INFO *cs)
- {
- if (!alloced)
+ for (const char *c= ptr(), *c_end= end(); c < c_end; c++)
{
- Ptr=(char*) str; str_length=Alloced_length=(uint32)arg_length;
+ if (!my_isascii(*c))
+ return true;
}
- str_charset=cs;
+ return false;
}
- bool set_int(longlong num, bool unsigned_flag, CHARSET_INFO *cs);
- bool set(int num, CHARSET_INFO *cs) { return set_int(num, false, cs); }
- bool set(uint num, CHARSET_INFO *cs) { return set_int(num, true, cs); }
- bool set(long num, CHARSET_INFO *cs) { return set_int(num, false, cs); }
- bool set(ulong num, CHARSET_INFO *cs) { return set_int(num, true, cs); }
- bool set(longlong num, CHARSET_INFO *cs) { return set_int(num, false, cs); }
- bool set(ulonglong num, CHARSET_INFO *cs) { return set_int((longlong)num, true, cs); }
- bool set_real(double num,uint decimals, CHARSET_INFO *cs);
- bool set_hex(ulonglong num);
- bool set_hex(const char *str, uint32 len);
+ bool bin_eq(const Static_binary_string *other) const
+ {
+ return length() == other->length() &&
+ !memcmp(ptr(), other->ptr(), length());
+ }
- /* Take over handling of buffer from some other object */
- void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg,
- CHARSET_INFO *cs)
- {
- free();
- Ptr= ptr_arg;
- str_length= (uint32)length_arg;
- Alloced_length= (uint32)alloced_length_arg;
- str_charset= cs;
- alloced= ptr_arg != 0;
+ void set(char *str, size_t len)
+ {
+ Ptr= str;
+ str_length= (uint32) len;
}
- /* Forget about the buffer, let some other object handle it */
- char *release()
+ void swap(Static_binary_string &s)
{
- char *old= Ptr;
- Ptr=0; str_length= Alloced_length= extra_alloc= 0;
- alloced= thread_specific= 0;
- return old;
+ swap_variables(char *, Ptr, s.Ptr);
+ swap_variables(uint32, str_length, s.str_length);
}
/*
@@ -330,8 +254,8 @@ public:
statement to be run on the remote server, and have a comma after each.
When the list is complete, I "chop" off the trailing comma
- ex.
- String stringobj;
+ ex.
+ String stringobj;
stringobj.append("VALUES ('foo', 'fi', 'fo',");
stringobj.chop();
stringobj.append(")");
@@ -341,7 +265,6 @@ public:
VALUES ('foo', 'fi', 'fo',
VALUES ('foo', 'fi', 'fo'
VALUES ('foo', 'fi', 'fo')
-
*/
inline void chop()
{
@@ -350,6 +273,329 @@ public:
DBUG_ASSERT(strlen(Ptr) == str_length);
}
+ // Returns offset to substring or -1
+ int strstr(const Static_binary_string &search, uint32 offset=0);
+ // Returns offset to substring or -1
+ int strrstr(const Static_binary_string &search, uint32 offset=0);
+
+ /*
+ The following append operations do NOT check alloced memory
+ q_*** methods writes values of parameters itself
+ qs_*** methods writes string representation of value
+ */
+ void q_append(const char c)
+ {
+ Ptr[str_length++] = c;
+ }
+ void q_append2b(const uint32 n)
+ {
+ int2store(Ptr + str_length, n);
+ str_length += 2;
+ }
+ void q_append(const uint32 n)
+ {
+ int4store(Ptr + str_length, n);
+ str_length += 4;
+ }
+ void q_append(double d)
+ {
+ float8store(Ptr + str_length, d);
+ str_length += 8;
+ }
+ void q_append(double *d)
+ {
+ float8store(Ptr + str_length, *d);
+ str_length += 8;
+ }
+ void q_append(const char *data, size_t data_len)
+ {
+ memcpy(Ptr + str_length, data, data_len);
+ DBUG_ASSERT(str_length <= UINT_MAX32 - data_len);
+ str_length += (uint)data_len;
+ }
+ void q_append(const LEX_CSTRING *ls)
+ {
+ DBUG_ASSERT(ls->length < UINT_MAX32 &&
+ ((ls->length == 0 && !ls->str) ||
+ ls->length == strlen(ls->str)));
+ q_append(ls->str, (uint32) ls->length);
+ }
+
+ void write_at_position(int position, uint32 value)
+ {
+ int4store(Ptr + position,value);
+ }
+
+ void qs_append(const char *str)
+ {
+ qs_append(str, (uint32)strlen(str));
+ }
+ void qs_append(const LEX_CSTRING *ls)
+ {
+ DBUG_ASSERT(ls->length < UINT_MAX32 &&
+ ((ls->length == 0 && !ls->str) ||
+ ls->length == strlen(ls->str)));
+ qs_append(ls->str, (uint32)ls->length);
+ }
+ void qs_append(const char *str, size_t len);
+ void qs_append_hex(const char *str, uint32 len);
+ void qs_append(double d);
+ void qs_append(double *d);
+ inline void qs_append(const char c)
+ {
+ Ptr[str_length]= c;
+ str_length++;
+ }
+ void qs_append(int i);
+ void qs_append(uint i)
+ {
+ qs_append((ulonglong)i);
+ }
+ void qs_append(ulong i)
+ {
+ qs_append((ulonglong)i);
+ }
+ void qs_append(ulonglong i);
+ void qs_append(longlong i, int radix)
+ {
+ char *buff= Ptr + str_length;
+ char *end= ll2str(i, buff, radix, 0);
+ str_length+= uint32(end-buff);
+ }
+};
+
+
+class Binary_string: public Static_binary_string
+{
+ uint32 Alloced_length, extra_alloc;
+ bool alloced, thread_specific;
+ void init_private_data()
+ {
+ Alloced_length= extra_alloc= 0;
+ alloced= thread_specific= false;
+ }
+public:
+ Binary_string()
+ {
+ init_private_data();
+ }
+ explicit Binary_string(size_t length_arg)
+ {
+ init_private_data();
+ (void) real_alloc(length_arg);
+ }
+ explicit Binary_string(const char *str)
+ :Binary_string(str, strlen(str))
+ { }
+ /*
+ NOTE: If one intend to use the c_ptr() method, the following two
+ contructors need the size of memory for STR to be at least LEN+1 (to make
+ room for zero termination).
+ */
+ Binary_string(const char *str, size_t len)
+ :Static_binary_string((char *) str, len)
+ {
+ init_private_data();
+ }
+ Binary_string(char *str, size_t len)
+ :Static_binary_string(str, len)
+ {
+ Alloced_length= (uint32) len;
+ extra_alloc= 0;
+ alloced= thread_specific= 0;
+ }
+ explicit Binary_string(const Binary_string &str)
+ :Static_binary_string(str)
+ {
+ Alloced_length= str.Alloced_length;
+ extra_alloc= 0;
+ alloced= thread_specific= 0;
+ }
+
+ ~Binary_string() { free(); }
+
+ /* Mark variable thread specific it it's not allocated already */
+ inline void set_thread_specific()
+ {
+ if (!alloced)
+ thread_specific= 1;
+ }
+ bool is_alloced() const { return alloced; }
+ inline uint32 alloced_length() const { return Alloced_length;}
+ inline uint32 extra_allocation() const { return extra_alloc;}
+ inline void extra_allocation(size_t len) { extra_alloc= (uint32)len; }
+ inline void mark_as_const() { Alloced_length= 0;}
+
+ inline bool uses_buffer_owned_by(const Binary_string *s) const
+ {
+ return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
+ }
+
+ /* Swap two string objects. Efficient way to exchange data without memcpy. */
+ void swap(Binary_string &s)
+ {
+ Static_binary_string::swap(s);
+ swap_variables(uint32, Alloced_length, s.Alloced_length);
+ swap_variables(bool, alloced, s.alloced);
+ }
+
+ /**
+ Points the internal buffer to the supplied one. The old buffer is freed.
+ @param str Pointer to the new buffer.
+ @param arg_length Length of the new buffer in characters, excluding any
+ null character.
+ @note The new buffer will not be null terminated.
+ */
+ void set_alloced(char *str, size_t length_arg, size_t alloced_length_arg)
+ {
+ free();
+ Static_binary_string::set(str, length_arg);
+ DBUG_ASSERT(alloced_length_arg < UINT_MAX32);
+ Alloced_length= (uint32) alloced_length_arg;
+ }
+ inline void set(char *str, size_t arg_length)
+ {
+ set_alloced(str, arg_length, arg_length);
+ }
+ inline void set(const char *str, size_t arg_length)
+ {
+ free();
+ Static_binary_string::set((char *) str, arg_length);
+ }
+
+ void set(Binary_string &str, size_t offset, size_t arg_length)
+ {
+ DBUG_ASSERT(&str != this);
+ free();
+ Static_binary_string::set((char*) str.ptr() + offset, arg_length);
+ if (str.Alloced_length)
+ Alloced_length= (uint32) (str.Alloced_length - offset);
+ }
+
+ /* Take over handling of buffer from some other object */
+ void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg)
+ {
+ set_alloced(ptr_arg, length_arg, alloced_length_arg);
+ alloced= ptr_arg != 0;
+ }
+
+ /* Forget about the buffer, let some other object handle it */
+ char *release()
+ {
+ char *old= Ptr;
+ Static_binary_string::set(NULL, 0);
+ init_private_data();
+ return old;
+ }
+
+ inline void set_quick(char *str, size_t arg_length)
+ {
+ if (!alloced)
+ {
+ Static_binary_string::set(str, arg_length);
+ Alloced_length= (uint32) arg_length;
+ }
+ }
+
+ inline Binary_string& operator=(const Binary_string &s)
+ {
+ if (&s != this)
+ {
+ /*
+ It is forbidden to do assignments like
+ some_string = substring_of_that_string
+ */
+ DBUG_ASSERT(!s.uses_buffer_owned_by(this));
+ set_alloced((char *) s.Ptr, s.str_length, s.Alloced_length);
+ }
+ return *this;
+ }
+
+ bool set_hex(ulonglong num);
+ bool set_hex(const char *str, uint32 len);
+
+ bool copy(); // Alloc string if not alloced
+ bool copy(const Binary_string &s); // Allocate new string
+ bool copy(const char *s, size_t arg_length); // Allocate new string
+ bool copy_or_move(const char *s,size_t arg_length);
+
+ bool append_ulonglong(ulonglong val);
+ bool append_longlong(longlong val);
+
+ bool append(const char *s, size_t size)
+ {
+ if (!size)
+ return false;
+ if (realloc_with_extra_if_needed(str_length + size))
+ return true;
+ q_append(s, size);
+ return false;
+ }
+ bool append(const Binary_string &s)
+ {
+ return append(s.ptr(), s.length());
+ }
+ bool append(IO_CACHE* file, uint32 arg_length);
+
+ inline bool append_char(char chr)
+ {
+ if (str_length < Alloced_length)
+ {
+ Ptr[str_length++]= chr;
+ }
+ else
+ {
+ if (unlikely(realloc_with_extra(str_length + 1)))
+ return true;
+ Ptr[str_length++]= chr;
+ }
+ return false;
+ }
+ bool append_hex(const char *src, uint32 srclen)
+ {
+ for (const char *src_end= src + srclen ; src != src_end ; src++)
+ {
+ if (unlikely(append_char(_dig_vec_lower[((uchar) *src) >> 4])) ||
+ unlikely(append_char(_dig_vec_lower[((uchar) *src) & 0x0F])))
+ return true;
+ }
+ return false;
+ }
+
+ bool append_with_step(const char *s, uint32 arg_length, uint32 step_alloc)
+ {
+ uint32 new_length= arg_length + str_length;
+ if (new_length > Alloced_length &&
+ unlikely(realloc(new_length + step_alloc)))
+ return true;
+ q_append(s, arg_length);
+ return false;
+ }
+
+ inline char *c_ptr()
+ {
+ DBUG_ASSERT(!alloced || !Ptr || !Alloced_length ||
+ (Alloced_length >= (str_length + 1)));
+
+ if (!Ptr || Ptr[str_length]) // Should be safe
+ (void) realloc(str_length);
+ return Ptr;
+ }
+ inline char *c_ptr_quick()
+ {
+ if (Ptr && str_length < Alloced_length)
+ Ptr[str_length]=0;
+ return Ptr;
+ }
+ inline char *c_ptr_safe()
+ {
+ if (Ptr && str_length < Alloced_length)
+ Ptr[str_length]=0;
+ else
+ (void) realloc(str_length);
+ return Ptr;
+ }
+
inline void free()
{
if (alloced)
@@ -358,8 +604,7 @@ public:
my_free(Ptr);
}
Alloced_length= extra_alloc= 0;
- Ptr=0;
- str_length=0; /* Safety */
+ Static_binary_string::set(NULL, 0); // Safety
}
inline bool alloc(size_t arg_length)
{
@@ -367,13 +612,13 @@ public:
return 0;
return real_alloc(arg_length);
}
- bool real_alloc(size_t arg_length); // Empties old string
+ bool real_alloc(size_t arg_length); // Empties old string
bool realloc_raw(size_t arg_length);
bool realloc(size_t arg_length)
{
if (realloc_raw(arg_length))
return TRUE;
- Ptr[arg_length]=0; // This make other funcs shorter
+ Ptr[arg_length]= 0; // This make other funcs shorter
return FALSE;
}
bool realloc_with_extra(size_t arg_length)
@@ -407,37 +652,179 @@ public:
arg_length,MYF((thread_specific ?
MY_THREAD_SPECIFIC : 0))))))
{
- Alloced_length = 0;
- real_alloc(arg_length);
+ Alloced_length= 0;
+ real_alloc(arg_length);
}
else
{
- Ptr=new_ptr;
- Alloced_length=(uint32)arg_length;
+ Ptr= new_ptr;
+ Alloced_length= (uint32) arg_length;
}
}
}
- bool is_alloced() const { return alloced; }
+ void move(Binary_string &s)
+ {
+ set_alloced(s.Ptr, s.str_length, s.Alloced_length);
+ extra_alloc= s.extra_alloc;
+ alloced= s.alloced;
+ thread_specific= s.thread_specific;
+ s.alloced= 0;
+ }
+ bool fill(uint32 max_length,char fill);
+ /*
+ Replace substring with string
+ If wrong parameter or not enough memory, do nothing
+ */
+ bool replace(uint32 offset,uint32 arg_length, const char *to, uint32 length);
+ bool replace(uint32 offset,uint32 arg_length, const Static_binary_string &to)
+ {
+ return replace(offset,arg_length,to.ptr(),to.length());
+ }
+
+ int reserve(size_t space_needed)
+ {
+ return realloc(str_length + space_needed);
+ }
+ int reserve(size_t space_needed, size_t grow_by);
+
+ inline char *prep_append(uint32 arg_length, uint32 step_alloc)
+ {
+ uint32 new_length= arg_length + str_length;
+ if (new_length > Alloced_length)
+ {
+ if (unlikely(realloc(new_length + step_alloc)))
+ return 0;
+ }
+ uint32 old_length= str_length;
+ str_length+= arg_length;
+ return Ptr + old_length; // Area to use
+ }
+
+
+ void q_net_store_length(ulonglong length)
+ {
+ DBUG_ASSERT(Alloced_length >= (str_length + net_length_size(length)));
+ char *pos= (char *) net_store_length((uchar *)(Ptr + str_length), length);
+ str_length= uint32(pos - Ptr);
+ }
+ void q_net_store_data(const uchar *from, size_t length)
+ {
+ DBUG_ASSERT(length < UINT_MAX32);
+ DBUG_ASSERT(Alloced_length >= (str_length + length +
+ net_length_size(length)));
+ q_net_store_length(length);
+ q_append((const char *)from, (uint32) length);
+ }
+};
+
+
+class String: public Charset, public Binary_string
+{
+public:
+ String() { }
+ String(size_t length_arg)
+ :Binary_string(length_arg)
+ { }
+ String(const char *str, CHARSET_INFO *cs)
+ :Charset(cs),
+ Binary_string(str)
+ { }
+ /*
+ NOTE: If one intend to use the c_ptr() method, the following two
+ contructors need the size of memory for STR to be at least LEN+1 (to make
+ room for zero termination).
+ */
+ String(const char *str, size_t len, CHARSET_INFO *cs)
+ :Charset(cs),
+ Binary_string((char *) str, len)
+ { }
+ String(char *str, size_t len, CHARSET_INFO *cs)
+ :Charset(cs),
+ Binary_string(str, len)
+ { }
+ String(const String &str)
+ :Charset(str),
+ Binary_string(str)
+ { }
+
+ void set(String &str,size_t offset,size_t arg_length)
+ {
+ Binary_string::set(str, offset, arg_length);
+ set_charset(str);
+ }
+ inline void set(char *str,size_t arg_length, CHARSET_INFO *cs)
+ {
+ Binary_string::set(str, arg_length);
+ set_charset(cs);
+ }
+ inline void set(const char *str,size_t arg_length, CHARSET_INFO *cs)
+ {
+ Binary_string::set(str, arg_length);
+ set_charset(cs);
+ }
+ bool set_ascii(const char *str, size_t arg_length);
+ inline void set_quick(char *str,size_t arg_length, CHARSET_INFO *cs)
+ {
+ Binary_string::set_quick(str, arg_length);
+ set_charset(cs);
+ }
+ bool set_int(longlong num, bool unsigned_flag, CHARSET_INFO *cs);
+ bool set(int num, CHARSET_INFO *cs) { return set_int(num, false, cs); }
+ bool set(uint num, CHARSET_INFO *cs) { return set_int(num, true, cs); }
+ bool set(long num, CHARSET_INFO *cs) { return set_int(num, false, cs); }
+ bool set(ulong num, CHARSET_INFO *cs) { return set_int(num, true, cs); }
+ bool set(longlong num, CHARSET_INFO *cs) { return set_int(num, false, cs); }
+ bool set(ulonglong num, CHARSET_INFO *cs) { return set_int((longlong)num, true, cs); }
+ bool set_real(double num,uint decimals, CHARSET_INFO *cs);
+
+ bool set_hex(ulonglong num)
+ {
+ set_charset(&my_charset_latin1);
+ return Binary_string::set_hex(num);
+ }
+ bool set_hex(const char *str, uint32 len)
+ {
+ set_charset(&my_charset_latin1);
+ return Binary_string::set_hex(str, len);
+ }
+
+ /* Take over handling of buffer from some other object */
+ void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg,
+ CHARSET_INFO *cs)
+ {
+ Binary_string::reset(ptr_arg, length_arg, alloced_length_arg);
+ set_charset(cs);
+ }
+
inline String& operator = (const String &s)
{
if (&s != this)
{
- /*
- It is forbidden to do assignments like
- some_string = substring_of_that_string
- */
- DBUG_ASSERT(!s.uses_buffer_owned_by(this));
- free();
- Ptr=s.Ptr ; str_length=s.str_length ; Alloced_length=s.Alloced_length;
- str_charset=s.str_charset;
+ set_charset(s);
+ Binary_string::operator=(s);
}
return *this;
}
- bool copy(); // Alloc string if not alloced
- bool copy(const String &s); // Allocate new string
- bool copy(const char *s,size_t arg_length, CHARSET_INFO *cs); // Allocate new string
- bool copy_or_move(const char *s,size_t arg_length, CHARSET_INFO *cs);
+ bool copy()
+ {
+ return Binary_string::copy();
+ }
+ bool copy(const String &s)
+ {
+ set_charset(s);
+ return Binary_string::copy(s);
+ }
+ bool copy(const char *s, size_t arg_length, CHARSET_INFO *cs)
+ {
+ set_charset(cs);
+ return Binary_string::copy(s, arg_length);
+ }
+ bool copy_or_move(const char *s, size_t arg_length, CHARSET_INFO *cs)
+ {
+ set_charset(cs);
+ return Binary_string::copy_or_move(s, arg_length);
+ }
static bool needs_conversion(size_t arg_length,
CHARSET_INFO *cs_from, CHARSET_INFO *cs_to,
uint32 *offset);
@@ -459,206 +846,84 @@ public:
{
if (unlikely(alloc(tocs->mbmaxlen * src_length)))
return true;
- str_length= copier->well_formed_copy(tocs, Ptr, Alloced_length,
+ str_length= copier->well_formed_copy(tocs, Ptr, alloced_length(),
fromcs, src, (uint)src_length, (uint)nchars);
- str_charset= tocs;
+ set_charset(tocs);
return false;
}
- void move(String &s)
- {
- free();
- Ptr=s.Ptr ; str_length=s.str_length ; Alloced_length=s.Alloced_length;
- extra_alloc= s.extra_alloc;
- alloced= s.alloced;
- thread_specific= s.thread_specific;
- s.alloced= 0;
- }
- bool append(const String &s);
- bool append(const char *s);
- bool append(const LEX_STRING *ls)
- {
- DBUG_ASSERT(ls->length < UINT_MAX32 &&
- ((ls->length == 0 && !ls->str) ||
- ls->length == strlen(ls->str)));
- return append(ls->str, (uint32) ls->length);
- }
- bool append(const LEX_CSTRING *ls)
- {
- DBUG_ASSERT(ls->length < UINT_MAX32 &&
- ((ls->length == 0 && !ls->str) ||
- ls->length == strlen(ls->str)));
- return append(ls->str, (uint32) ls->length);
- }
- bool append(const LEX_CSTRING &ls)
+ // Append without character set conversion
+ bool append(const String &s)
{
- return append(&ls);
+ return Binary_string::append(s);
}
- bool append(const char *s, size_t size);
- bool append(const char *s, size_t arg_length, CHARSET_INFO *cs);
- bool append_ulonglong(ulonglong val);
- bool append_longlong(longlong val);
- bool append(IO_CACHE* file, uint32 arg_length);
- bool append_with_prefill(const char *s, uint32 arg_length,
- uint32 full_length, char fill_char);
- bool append_parenthesized(long nr, int radix= 10);
- int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
- int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
- bool replace(uint32 offset,uint32 arg_length,const char *to,uint32 length);
- bool replace(uint32 offset,uint32 arg_length,const String &to);
inline bool append(char chr)
{
- if (str_length < Alloced_length)
- {
- Ptr[str_length++]=chr;
- }
- else
- {
- if (unlikely(realloc_with_extra(str_length + 1)))
- return 1;
- Ptr[str_length++]=chr;
- }
- return 0;
+ return Binary_string::append_char(chr);
}
bool append_hex(const char *src, uint32 srclen)
{
- for (const char *src_end= src + srclen ; src != src_end ; src++)
- {
- if (unlikely(append(_dig_vec_lower[((uchar) *src) >> 4])) ||
- unlikely(append(_dig_vec_lower[((uchar) *src) & 0x0F])))
- return true;
- }
- return false;
+ return Binary_string::append_hex(src, srclen);
}
bool append_hex(const uchar *src, uint32 srclen)
{
- return append_hex((const char*)src, srclen);
- }
- bool fill(uint32 max_length,char fill);
- void strip_sp();
- friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
- friend int stringcmp(const String *a,const String *b);
- friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
- friend class Field;
- uint32 numchars() const;
- int charpos(longlong i,uint32 offset=0);
-
- int reserve(size_t space_needed)
- {
- return realloc(str_length + space_needed);
- }
- int reserve(size_t space_needed, size_t grow_by);
-
- /*
- The following append operations do NOT check alloced memory
- q_*** methods writes values of parameters itself
- qs_*** methods writes string representation of value
- */
- void q_append(const char c)
- {
- Ptr[str_length++] = c;
+ return Binary_string::append_hex((const char*)src, srclen);
}
- void q_append2b(const uint32 n)
+ bool append(IO_CACHE* file, uint32 arg_length)
{
- int2store(Ptr + str_length, n);
- str_length += 2;
+ return Binary_string::append(file, arg_length);
}
- void q_append(const uint32 n)
- {
- int4store(Ptr + str_length, n);
- str_length += 4;
- }
- void q_append(double d)
+ inline bool append(const char *s, uint32 arg_length, uint32 step_alloc)
{
- float8store(Ptr + str_length, d);
- str_length += 8;
+ return append_with_step(s, arg_length, step_alloc);
}
- void q_append(double *d)
- {
- float8store(Ptr + str_length, *d);
- str_length += 8;
- }
- void q_append(const char *data, size_t data_len)
+
+ // Append with optional character set conversion from ASCII (e.g. to UCS2)
+ bool append(const char *s)
{
- memcpy(Ptr + str_length, data, data_len);
- DBUG_ASSERT(str_length <= UINT_MAX32 - data_len);
- str_length += (uint)data_len;
+ return append(s, strlen(s));
}
- void q_append(const LEX_CSTRING *ls)
+ bool append(const LEX_STRING *ls)
{
DBUG_ASSERT(ls->length < UINT_MAX32 &&
((ls->length == 0 && !ls->str) ||
ls->length == strlen(ls->str)));
- q_append(ls->str, (uint32) ls->length);
- }
-
- void write_at_position(int position, uint32 value)
- {
- int4store(Ptr + position,value);
- }
-
- void qs_append(const char *str)
- {
- qs_append(str, (uint32)strlen(str));
+ return append(ls->str, (uint32) ls->length);
}
- void qs_append(const LEX_CSTRING *ls)
+ bool append(const LEX_CSTRING *ls)
{
DBUG_ASSERT(ls->length < UINT_MAX32 &&
((ls->length == 0 && !ls->str) ||
ls->length == strlen(ls->str)));
- qs_append(ls->str, (uint32)ls->length);
- }
- void qs_append(const char *str, size_t len);
- void qs_append_hex(const char *str, uint32 len);
- void qs_append(double d);
- void qs_append(double *d);
- inline void qs_append(const char c)
- {
- Ptr[str_length]= c;
- str_length++;
- }
- void qs_append(int i);
- void qs_append(uint i)
- {
- qs_append((ulonglong)i);
- }
- void qs_append(ulong i)
- {
- qs_append((ulonglong)i);
+ return append(ls->str, (uint32) ls->length);
}
- void qs_append(ulonglong i);
- void qs_append(longlong i, int radix)
+ bool append(const LEX_CSTRING &ls)
{
- char *buff= Ptr + str_length;
- char *end= ll2str(i, buff, radix, 0);
- str_length+= uint32(end-buff);
+ return append(&ls);
}
+ bool append(const char *s, size_t size);
+ bool append_with_prefill(const char *s, uint32 arg_length,
+ uint32 full_length, char fill_char);
+ bool append_parenthesized(long nr, int radix= 10);
- /* Inline (general) functions used by the protocol functions */
+ // Append with optional character set conversion from cs to charset()
+ bool append(const char *s, size_t arg_length, CHARSET_INFO *cs);
- inline char *prep_append(uint32 arg_length, uint32 step_alloc)
+ void strip_sp();
+ friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
+ friend int stringcmp(const String *a,const String *b);
+ friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
+ friend class Field;
+ uint32 numchars() const
{
- uint32 new_length= arg_length + str_length;
- if (new_length > Alloced_length)
- {
- if (unlikely(realloc(new_length + step_alloc)))
- return 0;
- }
- uint32 old_length= str_length;
- str_length+= arg_length;
- return Ptr+ old_length; /* Area to use */
+ return (uint32) Charset::numchars(ptr(), end());
}
-
-
- inline bool append(const char *s, uint32 arg_length, uint32 step_alloc)
+ int charpos(longlong i, uint32 offset=0)
{
- uint32 new_length= arg_length + str_length;
- if (new_length > Alloced_length &&
- unlikely(realloc(new_length + step_alloc)))
- return TRUE;
- memcpy(Ptr+str_length, s, arg_length);
- str_length+= arg_length;
- return FALSE;
+ if (i <= 0)
+ return (int) i;
+ return (int) Charset::charpos(ptr() + offset, end(), (size_t) i);
}
+
void print(String *to) const;
void print_with_conversion(String *to, CHARSET_INFO *cs) const;
void print(String *to, CHARSET_INFO *cs) const
@@ -681,13 +946,12 @@ public:
return append_for_single_quote(st, (uint32) len);
}
- /* Swap two string objects. Efficient way to exchange data without memcpy. */
- void swap(String &s);
-
- inline bool uses_buffer_owned_by(const String *s) const
+ void swap(String &s)
{
- return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
+ Charset::swap(s);
+ Binary_string::swap(s);
}
+
uint well_formed_length() const
{
return (uint) Well_formed_prefix(charset(), ptr(), length()).length();
@@ -698,36 +962,12 @@ public:
return TRUE;
if (charset()->mbminlen > 1)
return FALSE;
- for (const char *c= ptr(), *c_end= c + length(); c < c_end; c++)
- {
- if (!my_isascii(*c))
- return FALSE;
- }
- return TRUE;
- }
- bool bin_eq(const String *other) const
- {
- return length() == other->length() &&
- !memcmp(ptr(), other->ptr(), length());
+ return !has_8bit_bytes();
}
bool eq(const String *other, CHARSET_INFO *cs) const
{
return !sortcmp(this, other, cs);
}
- void q_net_store_length(ulonglong length)
- {
- DBUG_ASSERT(Alloced_length >= (str_length + net_length_size(length)));
- char *pos= (char *) net_store_length((uchar *)(Ptr + str_length), length);
- str_length= uint32(pos - Ptr);
- }
- void q_net_store_data(const uchar *from, size_t length)
- {
- DBUG_ASSERT(length < UINT_MAX32);
- DBUG_ASSERT(Alloced_length >= (str_length + length +
- net_length_size(length)));
- q_net_store_length(length);
- q_append((const char *)from, (uint32) length);
- }
};
@@ -774,7 +1014,7 @@ public:
static inline bool check_if_only_end_space(CHARSET_INFO *cs,
- const char *str,
+ const char *str,
const char *end)
{
return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3e204c4945b..b9dd9c16d23 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -33,7 +33,6 @@
// partition_info
// NOT_A_PARTITION_ID
#include "sql_db.h" // load_db_opt_by_name
-#include "sql_time.h" // make_truncated_value_warning
#include "records.h" // init_read_record, end_read_record
#include "filesort.h" // filesort_free_buffers
#include "sql_select.h" // setup_order
@@ -2041,18 +2040,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
if (!drop_temporary)
{
- if (!in_bootstrap)
- {
- for (table= tables; table; table= table->next_local)
- {
- LEX_CSTRING db_name= table->db;
- LEX_CSTRING table_name= table->table_name;
- if (table->open_type == OT_BASE_ONLY ||
- !thd->find_temporary_table(table))
- (void) delete_statistics_for_table(thd, &db_name, &table_name);
- }
- }
-
if (!thd->locked_tables_mode)
{
if (drop_sequence)
@@ -2116,6 +2103,18 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
}
}
}
+ /* We remove statistics for table last, after we have the DDL lock */
+ if (!thd->bootstrap)
+ {
+ for (table= tables; table; table= table->next_local)
+ {
+ LEX_CSTRING db_name= table->db;
+ LEX_CSTRING table_name= table->table_name;
+ if (table->open_type == OT_BASE_ONLY ||
+ !thd->find_temporary_table(table))
+ (void) delete_statistics_for_table(thd, &db_name, &table_name);
+ }
+ }
}
/* mark for close and remove all cached entries */
@@ -2128,7 +2127,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
DBUG_RETURN(TRUE);
my_ok(thd);
DBUG_RETURN(FALSE);
-
}
@@ -2613,9 +2611,6 @@ err:
/* Chop of the last comma */
built_non_trans_tmp_query.chop();
built_non_trans_tmp_query.append(" /* generated by server */");
-#ifdef WITH_WSREP
- thd->wsrep_skip_wsrep_GTID = true;
-#endif /* WITH_WSREP */
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
built_non_trans_tmp_query.ptr(),
built_non_trans_tmp_query.length(),
@@ -2628,9 +2623,6 @@ err:
/* Chop of the last comma */
built_trans_tmp_query.chop();
built_trans_tmp_query.append(" /* generated by server */");
-#ifdef WITH_WSREP
- thd->wsrep_skip_wsrep_GTID = true;
-#endif /* WITH_WSREP */
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
built_trans_tmp_query.ptr(),
built_trans_tmp_query.length(),
@@ -2645,9 +2637,6 @@ err:
built_query.append(" /* generated by server */");
int error_code = non_tmp_error ? thd->get_stmt_da()->sql_errno()
: 0;
-#ifdef WITH_WSREP
- thd->wsrep_skip_wsrep_GTID = false;
-#endif /* WITH_WSREP */
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
built_query.ptr(),
built_query.length(),
@@ -2696,9 +2685,6 @@ err:
}
end:
-#ifdef WITH_WSREP
- thd->wsrep_skip_wsrep_GTID = false;
-#endif /* WITH_WSREP */
DBUG_RETURN(error);
}
@@ -4133,10 +4119,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
key_info++;
}
- if (!unique_key && !primary_key &&
- ((file->ha_table_flags() & HA_REQUIRE_PRIMARY_KEY) ||
- ((file->ha_table_flags() & HA_WANTS_PRIMARY_KEY) &&
- !create_info->sequence)))
+ if (!unique_key && !primary_key && !create_info->sequence &&
+ (file->ha_table_flags() & HA_REQUIRE_PRIMARY_KEY))
{
my_message(ER_REQUIRES_PRIMARY_KEY, ER_THD(thd, ER_REQUIRES_PRIMARY_KEY),
MYF(0));
@@ -5546,12 +5530,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
properly isolated from all concurrent operations which matter.
*/
- /* Copy temporarily the statement flags to thd for lock_table_names() */
- // QQ: is this really needed???
- uint save_thd_create_info_options= thd->lex->create_info.options;
- thd->lex->create_info.options|= create_info->options;
- res= open_tables(thd, &thd->lex->query_tables, &not_used, 0);
- thd->lex->create_info.options= save_thd_create_info_options;
+ res= open_tables(thd, *create_info, &thd->lex->query_tables, &not_used, 0);
if (res)
{
@@ -6799,6 +6778,12 @@ static bool fill_alter_inplace_info(THD *thd,
KEY *new_key;
KEY *new_key_end=
ha_alter_info->key_info_buffer + ha_alter_info->key_count;
+ /*
+ Primary key index for the new table
+ */
+ const KEY* const new_pk= (ha_alter_info->key_count > 0 &&
+ is_candidate_key(ha_alter_info->key_info_buffer)) ?
+ ha_alter_info->key_info_buffer : NULL;
DBUG_PRINT("info", ("index count old: %d new: %d",
table->s->keys, ha_alter_info->key_count));
@@ -6875,6 +6860,16 @@ static bool fill_alter_inplace_info(THD *thd,
goto index_changed;
}
+ /*
+ Rebuild the index if following condition get satisfied:
+
+ (i) Old table doesn't have primary key, new table has it and vice-versa
+ (ii) Primary key changed to another existing index
+ */
+ if ((new_key == new_pk) !=
+ ((uint) (table_key - table->key_info) == table->s->primary_key))
+ goto index_changed;
+
/* Check that key comment is not changed. */
if (table_key->comment.length != new_key->comment.length ||
(table_key->comment.length &&
@@ -7399,13 +7394,11 @@ static bool mysql_inplace_alter_table(THD *thd,
bool reopen_tables= false;
bool res;
- /*
- Set the truncated column values of thd as warning
- for alter table.
- */
- thd->count_cuted_fields = CHECK_FIELD_WARN;
DBUG_ENTER("mysql_inplace_alter_table");
+ /* Downgrade DDL lock while we are waiting for exclusive lock below */
+ backup_set_alter_copy_lock(thd, table);
+
/*
Upgrade to EXCLUSIVE lock if:
- This is requested by the storage engine
@@ -7478,9 +7471,7 @@ static bool mysql_inplace_alter_table(THD *thd,
thd->mdl_context.upgrade_shared_lock(table->mdl_ticket,
MDL_SHARED_NO_WRITE,
thd->variables.lock_wait_timeout))
- {
goto cleanup;
- }
// It's now safe to take the table level lock.
if (lock_tables(thd, table_list, alter_ctx->tables_opened, 0))
@@ -7517,9 +7508,7 @@ static bool mysql_inplace_alter_table(THD *thd,
if (table->file->ha_prepare_inplace_alter_table(altered_table,
ha_alter_info))
- {
goto rollback;
- }
/*
Downgrade the lock if storage engine has told us that exclusive lock was
@@ -7561,6 +7550,10 @@ static bool mysql_inplace_alter_table(THD *thd,
if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME))
goto rollback;
+ /* Set MDL_BACKUP_DDL */
+ if (backup_reset_alter_copy_lock(thd))
+ goto rollback;
+
/*
If we are killed after this point, we should ignore and continue.
We have mostly completed the operation at this point, there should
@@ -7620,7 +7613,7 @@ static bool mysql_inplace_alter_table(THD *thd,
Rename to the new name (if needed) will be handled separately below.
TODO: remove this check of thd->is_error() (now it intercept
- errors in some val_*() methoids and bring some single place to
+ errors in some val_*() methods and bring some single place to
such error interception).
*/
if (mysql_rename_table(db_type, &alter_ctx->new_db, &alter_ctx->tmp_name,
@@ -9092,6 +9085,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
uint tables_opened;
thd->open_options|= HA_OPEN_FOR_ALTER;
+ thd->mdl_backup_ticket= 0;
bool error= open_tables(thd, &table_list, &tables_opened, 0,
&alter_prelocking_strategy);
thd->open_options&= ~HA_OPEN_FOR_ALTER;
@@ -9199,12 +9193,12 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
}
/*
- Global intention exclusive lock must have been already acquired when
- table to be altered was open, so there is no need to do it here.
+ Protection against global read lock must have been acquired when table
+ to be altered was being opened.
*/
- DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::GLOBAL,
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::BACKUP,
"", "",
- MDL_INTENTION_EXCLUSIVE));
+ MDL_BACKUP_DDL));
if (thd->mdl_context.acquire_locks(&mdl_requests,
thd->variables.lock_wait_timeout))
@@ -9592,7 +9586,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
key_info, key_count,
IF_PARTITIONING(thd->work_part_info, NULL),
ignore);
- TABLE *altered_table= NULL;
+ TABLE *altered_table;
bool use_inplace= true;
/* Fill the Alter_inplace_info structure. */
@@ -9689,9 +9683,16 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
if (use_inplace)
{
table->s->frm_image= &frm;
+ enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
+ /*
+ Set the truncated column values of thd as warning
+ for alter table.
+ */
+ thd->count_cuted_fields = CHECK_FIELD_WARN;
int res= mysql_inplace_alter_table(thd, table_list, table, altered_table,
&ha_alter_info, inplace_supported,
&target_mdl_request, &alter_ctx);
+ thd->count_cuted_fields= save_count_cuted_fields;
my_free(const_cast<uchar*>(frm.str));
if (res)
@@ -9753,53 +9754,23 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
/* Mark that we have created table in storage engine. */
no_ha_table= false;
- if (create_info->tmp_table())
- {
- TABLE *tmp_table=
- thd->create_and_open_tmp_table(new_db_type, &frm,
- alter_ctx.get_tmp_path(),
- alter_ctx.new_db.str,
- alter_ctx.tmp_name.str,
- true, true);
- if (!tmp_table)
- {
- goto err_new_table_cleanup;
- }
- /* in case of alter temp table send the tracker in OK packet */
- SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
- }
-
-
/* Open the table since we need to copy the data. */
+ new_table= thd->create_and_open_tmp_table(new_db_type, &frm,
+ alter_ctx.get_tmp_path(),
+ alter_ctx.new_db.str,
+ alter_ctx.tmp_name.str,
+ true, true);
+ if (!new_table)
+ goto err_new_table_cleanup;
+
if (table->s->tmp_table != NO_TMP_TABLE)
{
- TABLE_LIST tbl;
- tbl.init_one_table(&alter_ctx.new_db, &alter_ctx.tmp_name, 0, TL_READ_NO_INSERT);
- /*
- Table can be found in the list of open tables in THD::all_temp_tables
- list.
- */
- if ((tbl.table= thd->find_temporary_table(&tbl)) == NULL)
- goto err_new_table_cleanup;
- new_table= tbl.table;
- DBUG_ASSERT(new_table);
+ /* in case of alter temp table send the tracker in OK packet */
+ SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
}
else
{
/*
- table is a normal table: Create temporary table in same directory.
- Open our intermediate table.
- */
- new_table=
- thd->create_and_open_tmp_table(new_db_type, &frm,
- alter_ctx.get_tmp_path(),
- alter_ctx.new_db.str,
- alter_ctx.tmp_name.str,
- true, true);
- if (!new_table)
- goto err_new_table_cleanup;
-
- /*
Normally, an attempt to modify an FK parent table will cause
FK children to be prelocked, so the table-being-altered cannot
be modified by a cascade FK action, because ALTER holds a lock
@@ -10078,16 +10049,6 @@ end_temporary:
err_new_table_cleanup:
my_free(const_cast<uchar*>(frm.str));
- if (new_table)
- {
- thd->drop_temporary_table(new_table, NULL, true);
- }
- else
- (void) quick_rm_table(thd, new_db_type,
- &alter_ctx.new_db, &alter_ctx.tmp_name,
- (FN_IS_TMP | (no_ha_table ? NO_HA_TABLE : 0)),
- alter_ctx.get_tmp_path());
-
/*
No default value was provided for a DATE/DATETIME field, the
current sql_mode doesn't allow the '0000-00-00' value and
@@ -10117,11 +10078,22 @@ err_new_table_cleanup:
thd->abort_on_warning= true;
thd->push_warning_truncated_value_for_field(Sql_condition::WARN_LEVEL_WARN,
f_type, f_val,
+ new_table->s,
alter_ctx.datetime_field->
field_name.str);
thd->abort_on_warning= save_abort_on_warning;
}
+ if (new_table)
+ {
+ thd->drop_temporary_table(new_table, NULL, true);
+ }
+ else
+ (void) quick_rm_table(thd, new_db_type,
+ &alter_ctx.new_db, &alter_ctx.tmp_name,
+ (FN_IS_TMP | (no_ha_table ? NO_HA_TABLE : 0)),
+ alter_ctx.get_tmp_path());
+
DBUG_RETURN(true);
err_with_mdl_after_alter:
@@ -10245,6 +10217,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
DBUG_RETURN(-1);
}
+ backup_set_alter_copy_lock(thd, from);
+
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
from->default_column_bitmaps();
@@ -10398,14 +10372,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
error= 1;
break;
}
- if (to->next_number_field)
- {
- if (auto_increment_field_copied)
- to->auto_increment_field_not_null= TRUE;
- else
- to->next_number_field->reset();
- }
-
+
for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++)
{
copy_ptr->do_copy(copy_ptr);
@@ -10443,6 +10410,13 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
if (keep_versioned && to->versioned(VERS_TRX_ID))
to->vers_write= false;
+ if (to->next_number_field)
+ {
+ if (auto_increment_field_copied)
+ to->auto_increment_field_not_null= TRUE;
+ else
+ to->next_number_field->reset();
+ }
error= to->file->ha_write_row(to->record[0]);
to->auto_increment_field_not_null= FALSE;
if (unlikely(error))
@@ -10526,6 +10500,9 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
cleanup_done= 1;
to->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
+ if (backup_reset_alter_copy_lock(thd))
+ error= 1;
+
if (unlikely(mysql_trans_commit_alter_copy_data(thd)))
error= 1;
@@ -10544,7 +10521,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
if (!cleanup_done)
{
- /* This happens if we get an error during initialzation of data */
+ /* This happens if we get an error during initialization of data */
DBUG_ASSERT(error);
to->file->ha_end_bulk_insert();
ha_enable_transaction(thd, TRUE);
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 9562394f11e..fea23020d7e 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -289,15 +289,15 @@ ulong convert_month_to_period(ulong month)
bool
-check_date_with_warn(THD *thd, const MYSQL_TIME *ltime, date_mode_t fuzzydate,
- timestamp_type ts_type)
+check_date_with_warn(THD *thd, const MYSQL_TIME *ltime,
+ date_conv_mode_t fuzzydate, timestamp_type ts_type)
{
int unused;
if (check_date(ltime, fuzzydate, &unused))
{
ErrConvTime str(ltime);
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- &str, ts_type, 0);
+ &str, ts_type, 0, 0);
return true;
}
return false;
@@ -371,31 +371,38 @@ public:
};
-/* Character set-aware version of str_to_time() */
-bool Temporal::str_to_time(MYSQL_TIME_STATUS *status,
- const char *str, size_t length, CHARSET_INFO *cs,
- date_mode_t fuzzydate)
+/* Character set-aware version of ascii_to_datetime_or_date_or_time() */
+bool Temporal::str_to_datetime_or_date_or_time(THD *thd, MYSQL_TIME_STATUS *st,
+ const char *str, size_t length,
+ CHARSET_INFO *cs,
+ date_mode_t fuzzydate)
{
TemporalAsciiBuffer tmp(str, length, cs);
- bool rc= ::str_to_time(tmp.str, tmp.length, this,
- ulonglong(fuzzydate & TIME_MODE_FOR_XXX_TO_DATE),
- status);
- DBUG_ASSERT(status->warnings || !rc);
- return rc;
+ return ascii_to_datetime_or_date_or_time(st, tmp.str, tmp.length, fuzzydate)||
+ add_nanoseconds(thd, &st->warnings, fuzzydate, st->nanoseconds);
}
-/* Character set-aware version of str_to_datetime() */
-bool Temporal::str_to_datetime(MYSQL_TIME_STATUS *status,
+/* Character set-aware version of str_to_datetime_or_date() */
+bool Temporal::str_to_datetime_or_date(THD *thd, MYSQL_TIME_STATUS *status,
+ const char *str, size_t length,
+ CHARSET_INFO *cs,
+ date_mode_t flags)
+{
+ TemporalAsciiBuffer tmp(str, length, cs);
+ return ascii_to_datetime_or_date(status, tmp.str, tmp.length, flags) ||
+ add_nanoseconds(thd, &status->warnings, flags, status->nanoseconds);
+}
+
+
+/* Character set-aware version of ascii_to_temporal() */
+bool Temporal::str_to_temporal(THD *thd, MYSQL_TIME_STATUS *status,
const char *str, size_t length, CHARSET_INFO *cs,
date_mode_t flags)
{
TemporalAsciiBuffer tmp(str, length, cs);
- bool rc= ::str_to_datetime(tmp.str, tmp.length, this,
- ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE),
- status);
- DBUG_ASSERT(status->warnings || !rc);
- return rc;
+ return ascii_to_temporal(status, tmp.str, tmp.length, flags) ||
+ add_nanoseconds(thd, &status->warnings, flags, status->nanoseconds);
}
@@ -416,7 +423,7 @@ bool Interval_DDhhmmssff::str_to_DDhhmmssff(MYSQL_TIME_STATUS *status,
if string was truncated during conversion.
NOTE
- See description of str_to_datetime() for more information.
+ See description of str_to_datetime_xxx() for more information.
*/
bool
@@ -424,16 +431,17 @@ str_to_datetime_with_warn(THD *thd, CHARSET_INFO *cs,
const char *str, size_t length, MYSQL_TIME *to,
date_mode_t mode)
{
- Temporal::Warn_push warn(thd, NullS, to, mode);
+ Temporal::Warn_push warn(thd, NULL, NullS, to, mode);
Temporal_hybrid *t= new(to) Temporal_hybrid(thd, &warn, str, length, cs, mode);
return !t->is_valid_temporal();
}
bool double_to_datetime_with_warn(THD *thd, double value, MYSQL_TIME *ltime,
- date_mode_t fuzzydate, const char *field_name)
+ date_mode_t fuzzydate,
+ const TABLE_SHARE *s, const char *field_name)
{
- Temporal::Warn_push warn(thd, field_name, ltime, fuzzydate);
+ Temporal::Warn_push warn(thd, s, field_name, ltime, fuzzydate);
Temporal_hybrid *t= new (ltime) Temporal_hybrid(thd, &warn, value, fuzzydate);
return !t->is_valid_temporal();
}
@@ -441,9 +449,10 @@ bool double_to_datetime_with_warn(THD *thd, double value, MYSQL_TIME *ltime,
bool decimal_to_datetime_with_warn(THD *thd, const my_decimal *value,
MYSQL_TIME *ltime,
- date_mode_t fuzzydate, const char *field_name)
+ date_mode_t fuzzydate,
+ const TABLE_SHARE *s, const char *field_name)
{
- Temporal::Warn_push warn(thd, field_name, ltime, fuzzydate);
+ Temporal::Warn_push warn(thd, s, field_name, ltime, fuzzydate);
Temporal_hybrid *t= new (ltime) Temporal_hybrid(thd, &warn, value, fuzzydate);
return !t->is_valid_temporal();
}
@@ -451,13 +460,14 @@ bool decimal_to_datetime_with_warn(THD *thd, const my_decimal *value,
bool int_to_datetime_with_warn(THD *thd, const Longlong_hybrid &nr,
MYSQL_TIME *ltime,
- date_mode_t fuzzydate, const char *field_name)
+ date_mode_t fuzzydate,
+ const TABLE_SHARE *s, const char *field_name)
{
/*
Note: conversion from an integer to TIME can overflow to '838:59:59.999999',
so the conversion result can have fractional digits.
*/
- Temporal::Warn_push warn(thd, field_name, ltime, fuzzydate);
+ Temporal::Warn_push warn(thd, s, field_name, ltime, fuzzydate);
Temporal_hybrid *t= new (ltime) Temporal_hybrid(thd, &warn, nr, fuzzydate);
return !t->is_valid_temporal();
}
@@ -887,12 +897,12 @@ void make_truncated_value_warning(THD *thd,
Sql_condition::enum_warning_level level,
const ErrConv *sval,
timestamp_type time_type,
- const char *field_name)
+ const TABLE_SHARE *s, const char *field_name)
{
const char *type_str= Temporal::type_name_by_timestamp_type(time_type);
- return thd->push_warning_wrong_or_truncated_value(level,
- time_type <= MYSQL_TIMESTAMP_ERROR,
- type_str, sval->ptr(), field_name);
+ return thd->push_warning_wrong_or_truncated_value
+ (level, time_type <= MYSQL_TIMESTAMP_ERROR, type_str, sval->ptr(),
+ s, field_name);
}
@@ -1303,7 +1313,7 @@ time_to_datetime(THD *thd, const MYSQL_TIME *from, MYSQL_TIME *to)
bool
time_to_datetime_with_warn(THD *thd,
const MYSQL_TIME *from, MYSQL_TIME *to,
- date_mode_t fuzzydate)
+ date_conv_mode_t fuzzydate)
{
int warn= 0;
DBUG_ASSERT(from->time_type == MYSQL_TIMESTAMP_TIME);
diff --git a/sql/sql_time.h b/sql/sql_time.h
index 433374e2e9a..161d08c80b8 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -44,20 +44,20 @@ bool str_to_datetime_with_warn(THD *thd,
date_mode_t flags);
bool double_to_datetime_with_warn(THD *thd, double value, MYSQL_TIME *ltime,
date_mode_t fuzzydate,
- const char *name);
+ const TABLE_SHARE *s, const char *name);
bool decimal_to_datetime_with_warn(THD *thd,
const my_decimal *value, MYSQL_TIME *ltime,
date_mode_t fuzzydate,
- const char *name);
+ const TABLE_SHARE *s, const char *name);
bool int_to_datetime_with_warn(THD *thd, const Longlong_hybrid &nr,
MYSQL_TIME *ltime,
date_mode_t fuzzydate,
- const char *name);
+ const TABLE_SHARE *s, const char *name);
bool time_to_datetime(THD *thd, const MYSQL_TIME *tm, MYSQL_TIME *dt);
bool time_to_datetime_with_warn(THD *thd,
const MYSQL_TIME *tm, MYSQL_TIME *dt,
- date_mode_t fuzzydate);
+ date_conv_mode_t fuzzydate);
inline void datetime_to_date(MYSQL_TIME *ltime)
{
@@ -78,6 +78,7 @@ void make_truncated_value_warning(THD *thd,
Sql_condition::enum_warning_level level,
const ErrConv *str_val,
timestamp_type time_type,
+ const TABLE_SHARE *s,
const char *field_name);
extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,
@@ -166,13 +167,20 @@ non_zero_date(const MYSQL_TIME *ltime)
non_zero_hhmmssuu(ltime));
}
static inline bool
-check_date(const MYSQL_TIME *ltime, date_mode_t flags, int *was_cut)
+check_date(const MYSQL_TIME *ltime, date_conv_mode_t flags, int *was_cut)
{
return check_date(ltime, non_zero_date(ltime),
ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), was_cut);
}
-bool check_date_with_warn(THD *thd, const MYSQL_TIME *ltime, date_mode_t fuzzy_date,
- timestamp_type ts_type);
+bool check_date_with_warn(THD *thd, const MYSQL_TIME *ltime,
+ date_conv_mode_t fuzzy_date, timestamp_type ts_type);
+static inline bool
+check_date_with_warn(THD *thd, const MYSQL_TIME *ltime,
+ date_mode_t fuzzydate, timestamp_type ts_type)
+{
+ return check_date_with_warn(thd, ltime, date_conv_mode_t(fuzzydate), ts_type);
+}
+
bool adjust_time_range_with_warn(THD *thd, MYSQL_TIME *ltime, uint dec);
longlong pack_time(const MYSQL_TIME *my_time);
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index b79c1a1adb1..61660a964ff 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -507,8 +507,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
}
#ifdef WITH_WSREP
- if (thd->wsrep_exec_mode == LOCAL_STATE)
- WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
#endif
/* We should have only one table in table list. */
@@ -2183,8 +2182,7 @@ bool Table_triggers_list::process_triggers(THD *thd,
This trigger must have been processed by the pre-locking
algorithm.
*/
- DBUG_ASSERT(trigger_table->pos_in_table_list->trg_event_map &
- static_cast<uint>(1 << static_cast<int>(event)));
+ DBUG_ASSERT(trigger_table->pos_in_table_list->trg_event_map & trg2bit(event));
thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER);
@@ -2236,8 +2234,7 @@ add_tables_and_routines_for_triggers(THD *thd,
for (int i= 0; i < (int)TRG_EVENT_MAX; i++)
{
- if (table_list->trg_event_map &
- static_cast<uint8>(1 << static_cast<int>(i)))
+ if (table_list->trg_event_map & trg2bit(static_cast<trg_event_type>(i)))
{
for (int j= 0; j < (int)TRG_ACTION_MAX; j++)
{
diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h
index 0fddb94fde1..9cd6c61891a 100644
--- a/sql/sql_trigger.h
+++ b/sql/sql_trigger.h
@@ -38,6 +38,9 @@ enum trg_event_type
TRG_EVENT_MAX
};
+static inline uint8 trg2bit(enum trg_event_type trg)
+{ return static_cast<uint8>(1 << static_cast<int>(trg)); }
+
#include "table.h" /* GRANT_INFO */
/*
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 798e929170c..389276d0bcf 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -416,9 +416,11 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
{
bool hton_can_recreate;
+#ifdef WITH_WSREP
if (WSREP(thd) &&
wsrep_to_isolation_begin(thd, table_ref->db.str, table_ref->table_name.str, 0))
DBUG_RETURN(TRUE);
+#endif /* WITH_WSREP */
if (lock_table(thd, table_ref, &hton_can_recreate))
DBUG_RETURN(TRUE);
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index a432f37b580..96a73a85267 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -68,6 +68,8 @@ Type_handler_long_blob type_handler_long_blob;
Type_handler_blob type_handler_blob;
static Type_handler_blob_compressed type_handler_blob_compressed;
+Type_handler_interval_DDhhmmssff type_handler_interval_DDhhmmssff;
+
#ifdef HAVE_SPATIAL
Type_handler_geometry type_handler_geometry;
#endif
@@ -132,6 +134,15 @@ bool Type_handler_data::init()
Type_handler_data *type_handler_data= NULL;
+String_ptr::String_ptr(Item *item, String *buffer)
+ :m_string_ptr(item->val_str(buffer))
+{ }
+
+
+Ascii_ptr::Ascii_ptr(Item *item, String *buffer)
+ :String_ptr(item->val_str_ascii(buffer))
+{ }
+
void VDec::set(Item *item)
{
@@ -154,12 +165,24 @@ VDec_op::VDec_op(Item_func_hybrid_field_type *item)
}
-date_mode_t Temporal::sql_mode_for_dates(THD *thd)
+date_conv_mode_t Temporal::sql_mode_for_dates(THD *thd)
{
return ::sql_mode_for_dates(thd);
}
+time_round_mode_t Temporal::default_round_mode(THD *thd)
+{
+ return thd->temporal_round_mode();
+}
+
+
+time_round_mode_t Timestamp::default_round_mode(THD *thd)
+{
+ return thd->temporal_round_mode();
+}
+
+
my_decimal *Temporal::to_decimal(my_decimal *to) const
{
return date2my_decimal(this, to);
@@ -180,8 +203,9 @@ void Temporal::make_from_str(THD *thd, Warn *warn,
DBUG_EXECUTE_IF("str_to_datetime_warn",
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_YES, ErrConvString(str, length,cs).ptr()););
- if (str_to_datetime(warn, str, length, cs, fuzzydate))
- make_fuzzy_date(&warn->warnings, fuzzydate);
+
+ if (str_to_temporal(thd, warn, str, length, cs, fuzzydate))
+ make_fuzzy_date(&warn->warnings, date_conv_mode_t(fuzzydate));
if (warn->warnings)
warn->set_str(str, length, &my_charset_bin);
}
@@ -194,14 +218,112 @@ Temporal_hybrid::Temporal_hybrid(THD *thd, Item *item, date_mode_t fuzzydate)
}
-void Sec6::make_from_decimal(const my_decimal *d)
+uint Timestamp::binary_length_to_precision(uint length)
+{
+ switch (length) {
+ case 4: return 0;
+ case 5: return 2;
+ case 6: return 4;
+ case 7: return 6;
+ }
+ DBUG_ASSERT(0);
+ return 0;
+}
+
+
+Timestamp::Timestamp(const Native &native)
+{
+ DBUG_ASSERT(native.length() >= 4 && native.length() <= 7);
+ uint dec= binary_length_to_precision(native.length());
+ my_timestamp_from_binary(this, (const uchar *) native.ptr(), dec);
+}
+
+
+bool Timestamp::to_native(Native *to, uint decimals) const
+{
+ uint len= my_timestamp_binary_length(decimals);
+ if (to->reserve(len))
+ return true;
+ my_timestamp_to_binary(this, (uchar *) to->ptr(), decimals);
+ to->length(len);
+ return false;
+}
+
+
+bool Timestamp::to_TIME(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) const
+{
+ return thd->timestamp_to_TIME(to, tv_sec, tv_usec, fuzzydate);
+}
+
+
+Timestamp::Timestamp(THD *thd, const MYSQL_TIME *ltime, uint *error_code)
+ :Timeval(TIME_to_timestamp(thd, ltime, error_code), ltime->second_part)
+{ }
+
+
+Timestamp_or_zero_datetime::Timestamp_or_zero_datetime(THD *thd,
+ const MYSQL_TIME *ltime,
+ uint *error_code)
+ :Timestamp(thd, ltime, error_code),
+ m_is_zero_datetime(*error_code == ER_WARN_DATA_OUT_OF_RANGE)
+{
+ if (m_is_zero_datetime)
+ {
+ if (!non_zero_date(ltime))
+ *error_code= 0; // ltime was '0000-00-00 00:00:00'
+ }
+ else if (*error_code == ER_WARN_INVALID_TIMESTAMP)
+ *error_code= 0; // ltime fell into spring time gap, adjusted.
+}
+
+
+bool Timestamp_or_zero_datetime::to_TIME(THD *thd, MYSQL_TIME *to,
+ date_mode_t fuzzydate) const
+{
+ if (m_is_zero_datetime)
+ {
+ set_zero_time(to, MYSQL_TIMESTAMP_DATETIME);
+ return false;
+ }
+ return Timestamp::to_TIME(thd, to, fuzzydate);
+}
+
+
+bool Timestamp_or_zero_datetime::to_native(Native *to, uint decimals) const
+{
+ if (m_is_zero_datetime)
+ {
+ to->length(0);
+ return false;
+ }
+ return Timestamp::to_native(to, decimals);
+}
+
+
+int Timestamp_or_zero_datetime_native::save_in_field(Field *field,
+ uint decimals) const
+{
+ field->set_notnull();
+ if (field->type_handler()->type_handler_for_native_format() ==
+ &type_handler_timestamp2)
+ return field->store_native(*this);
+ if (is_zero_datetime())
+ {
+ static Datetime zero(Datetime::zero());
+ return field->store_time_dec(zero.get_mysql_time(), decimals);
+ }
+ return field->store_timestamp_dec(Timestamp(*this).tv(), decimals);
+}
+
+
+void Sec6::make_from_decimal(const my_decimal *d, ulong *nanoseconds)
{
- m_neg= my_decimal2seconds(d, &m_sec, &m_usec);
+ m_neg= my_decimal2seconds(d, &m_sec, &m_usec, nanoseconds);
m_truncated= (m_sec >= LONGLONG_MAX);
}
-void Sec6::make_from_double(double nr)
+void Sec6::make_from_double(double nr, ulong *nanoseconds)
{
if ((m_neg= nr < 0))
nr= -nr;
@@ -209,11 +331,14 @@ void Sec6::make_from_double(double nr)
{
m_sec= LONGLONG_MAX;
m_usec= 0;
+ *nanoseconds= 0;
}
else
{
m_sec= (ulonglong) nr;
- m_usec= (ulong) ((nr - floor(nr)) * 1000000);
+ m_usec= (ulong) ((nr - floor(nr)) * 1000000000);
+ *nanoseconds= m_usec % 1000;
+ m_usec/= 1000;
}
}
@@ -229,8 +354,11 @@ void Sec6::make_truncated_warning(THD *thd, const char *type_str) const
bool Sec6::convert_to_mysql_time(THD *thd, int *warn, MYSQL_TIME *ltime,
date_mode_t fuzzydate) const
{
- bool is_time= bool(fuzzydate & TIME_TIME_ONLY);
- bool rc= is_time ? to_time(ltime, warn) : to_datetime(ltime, fuzzydate, warn);
+ bool rc= fuzzydate & (TIME_INTERVAL_hhmmssff | TIME_INTERVAL_DAY) ?
+ to_datetime_or_to_interval_hhmmssff(ltime, warn) :
+ fuzzydate & TIME_TIME_ONLY ?
+ to_datetime_or_time(ltime, warn, date_conv_mode_t(fuzzydate)) :
+ to_datetime_or_date(ltime, warn, date_conv_mode_t(fuzzydate));
DBUG_ASSERT(*warn || !rc);
if (truncated())
*warn|= MYSQL_TIME_WARN_TRUNCATED;
@@ -238,22 +366,25 @@ bool Sec6::convert_to_mysql_time(THD *thd, int *warn, MYSQL_TIME *ltime,
}
-void Temporal::push_conversion_warnings(THD *thd, bool totally_useless_value, int warn,
+void Temporal::push_conversion_warnings(THD *thd, bool totally_useless_value,
+ int warn,
const char *typestr,
+ const TABLE_SHARE *s,
const char *field_name,
const char *value)
{
if (MYSQL_TIME_WARN_HAVE_WARNINGS(warn))
thd->push_warning_wrong_or_truncated_value(Sql_condition::WARN_LEVEL_WARN,
totally_useless_value,
- typestr, value, field_name);
+ typestr, value, s, field_name);
else if (MYSQL_TIME_WARN_HAVE_NOTES(warn))
thd->push_warning_wrong_or_truncated_value(Sql_condition::WARN_LEVEL_NOTE,
- false, typestr, value, field_name);
+ false, typestr, value, s,
+ field_name);
}
-VSec6::VSec6(THD *thd, Item *item, const char *type_str, ulonglong limit)
+VSec9::VSec9(THD *thd, Item *item, const char *type_str, ulonglong limit)
{
if (item->decimals == 0)
{ // optimize for an important special case
@@ -271,7 +402,7 @@ VSec6::VSec6(THD *thd, Item *item, const char *type_str, ulonglong limit)
else if (item->cmp_type() == REAL_RESULT)
{
double nr= item->val_real();
- make_from_double(nr);
+ make_from_double(nr, &m_nsec);
m_is_null= item->null_value;
if (!m_is_null && m_sec > limit)
{
@@ -287,7 +418,7 @@ VSec6::VSec6(THD *thd, Item *item, const char *type_str, ulonglong limit)
else
{
VDec tmp(item);
- (m_is_null= tmp.is_null()) ? reset() : make_from_decimal(tmp.ptr());
+ (m_is_null= tmp.is_null()) ? reset() : make_from_decimal(tmp.ptr(), &m_nsec);
if (!m_is_null && m_sec > limit)
{
m_sec= limit;
@@ -346,7 +477,8 @@ const LEX_CSTRING Interval_DDhhmmssff::m_type_name=
Interval_DDhhmmssff::Interval_DDhhmmssff(THD *thd, Status *st,
bool push_warnings,
- Item *item, ulong max_hour)
+ Item *item, ulong max_hour,
+ time_round_mode_t mode, uint dec)
{
switch (item->cmp_type()) {
case ROW_RESULT:
@@ -355,7 +487,8 @@ Interval_DDhhmmssff::Interval_DDhhmmssff(THD *thd, Status *st,
break;
case TIME_RESULT:
{
- if (item->get_date(thd, this, TIME_TIME_ONLY))
+ // Rounding mode is not important here
+ if (item->get_date(thd, this, Options(TIME_TIME_ONLY, TIME_FRAC_NONE)))
time_type= MYSQL_TIMESTAMP_NONE;
else if (time_type != MYSQL_TIMESTAMP_TIME)
{
@@ -386,6 +519,8 @@ Interval_DDhhmmssff::Interval_DDhhmmssff(THD *thd, Status *st,
}
else
{
+ if (mode == TIME_FRAC_ROUND)
+ time_round_or_set_max(dec, &st->warnings, max_hour, st->nanoseconds);
if (hour > max_hour)
{
st->warnings|= MYSQL_TIME_WARN_OUT_OF_RANGE;
@@ -444,7 +579,8 @@ uint Interval_DDhhmmssff::fsp(THD *thd, Item *item)
if (!item->const_item() || item->is_expensive())
return TIME_SECOND_PART_DIGITS;
Status st;
- Interval_DDhhmmssff it(thd, &st, false/*no warnings*/, item, UINT_MAX32);
+ Interval_DDhhmmssff it(thd, &st, false/*no warnings*/, item, UINT_MAX32,
+ TIME_FRAC_TRUNCATE, TIME_SECOND_PART_DIGITS);
return it.is_valid_interval_DDhhmmssff() ? st.precision :
TIME_SECOND_PART_DIGITS;
}
@@ -453,13 +589,101 @@ uint Interval_DDhhmmssff::fsp(THD *thd, Item *item)
void Time::make_from_item(THD *thd, int *warn, Item *item, const Options opt)
{
*warn= 0;
- if (item->get_date(thd, this, opt.get_date_flags()))
+ if (item->get_date(thd, this, opt))
time_type= MYSQL_TIMESTAMP_NONE;
else
valid_MYSQL_TIME_to_valid_value(thd, warn, opt);
}
+static uint msec_round_add[7]=
+{
+ 500000000,
+ 50000000,
+ 5000000,
+ 500000,
+ 50000,
+ 5000,
+ 0
+};
+
+
+Sec9 & Sec9::round(uint dec)
+{
+ DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
+ if (Sec6::add_nanoseconds(m_nsec + msec_round_add[dec]))
+ m_sec++;
+ m_nsec= 0;
+ Sec6::trunc(dec);
+ return *this;
+}
+
+
+void Timestamp::round_or_set_max(uint dec, int *warn)
+{
+ DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
+ if (add_nanoseconds_usec(msec_round_add[dec]) &&
+ tv_sec++ >= TIMESTAMP_MAX_VALUE)
+ {
+ tv_sec= TIMESTAMP_MAX_VALUE;
+ tv_usec= TIME_MAX_SECOND_PART;
+ *warn|= MYSQL_TIME_WARN_OUT_OF_RANGE;
+ }
+ my_timeval_trunc(this, dec);
+}
+
+
+bool Temporal::add_nanoseconds_with_round(THD *thd, int *warn,
+ date_conv_mode_t mode,
+ ulong nsec)
+{
+ switch (time_type) {
+ case MYSQL_TIMESTAMP_TIME:
+ {
+ ulong max_hour= (mode & (TIME_INTERVAL_DAY | TIME_INTERVAL_hhmmssff)) ?
+ TIME_MAX_INTERVAL_HOUR : TIME_MAX_HOUR;
+ time_round_or_set_max(6, warn, max_hour, nsec);
+ return false;
+ }
+ case MYSQL_TIMESTAMP_DATETIME:
+ return datetime_round_or_invalidate(thd, 6, warn, nsec);
+ case MYSQL_TIMESTAMP_DATE:
+ return false;
+ case MYSQL_TIMESTAMP_NONE:
+ return false;
+ case MYSQL_TIMESTAMP_ERROR:
+ break;
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+void Temporal::time_round_or_set_max(uint dec, int *warn,
+ ulong max_hour, ulong nsec)
+{
+ DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
+ if (add_nanoseconds_mmssff(nsec) && ++hour > max_hour)
+ {
+ time_hhmmssff_set_max(max_hour);
+ *warn|= MYSQL_TIME_WARN_OUT_OF_RANGE;
+ }
+ my_time_trunc(this, dec);
+}
+
+
+void Time::round_or_set_max(uint dec, int *warn, ulong nsec)
+{
+ Temporal::time_round_or_set_max(dec, warn, TIME_MAX_HOUR, nsec);
+ DBUG_ASSERT(is_valid_time_slow());
+}
+
+
+void Time::round_or_set_max(uint dec, int *warn)
+{
+ round_or_set_max(dec, warn, msec_round_add[dec]);
+}
+
/**
Create from a DATETIME by subtracting a given number of days,
implementing an optimized version of calc_time_diff().
@@ -565,9 +789,25 @@ Time::Time(int *warn, const MYSQL_TIME *from, long curdays)
}
-void Temporal_with_date::make_from_item(THD *thd, Item *item, date_mode_t flags)
+Time::Time(int *warn, bool neg, ulonglong hour, uint minute, const Sec6 &second)
{
- flags&= ~TIME_TIME_ONLY;
+ DBUG_ASSERT(second.sec() <= 59);
+ *warn= 0;
+ set_zero_time(this, MYSQL_TIMESTAMP_TIME);
+ MYSQL_TIME::neg= neg;
+ MYSQL_TIME::hour= hour > TIME_MAX_HOUR ? (uint) (TIME_MAX_HOUR + 1) :
+ (uint) hour;
+ MYSQL_TIME::minute= minute;
+ MYSQL_TIME::second= (uint) second.sec();
+ MYSQL_TIME::second_part= second.usec();
+ adjust_time_range_or_invalidate(warn);
+}
+
+
+void Temporal_with_date::make_from_item(THD *thd, Item *item,
+ date_mode_t fuzzydate)
+{
+ date_conv_mode_t flags= date_conv_mode_t(fuzzydate) & ~TIME_TIME_ONLY;
/*
Some TIME type items return error when trying to do get_date()
without TIME_TIME_ONLY set (e.g. Item_field for Field_time).
@@ -575,10 +815,11 @@ void Temporal_with_date::make_from_item(THD *thd, Item *item, date_mode_t flags)
In the legacy time->datetime conversion mode we do not add TIME_TIME_ONLY
and leave it to get_date() to check date.
*/
- date_mode_t time_flag= (item->field_type() == MYSQL_TYPE_TIME &&
+ date_conv_mode_t time_flag= (item->field_type() == MYSQL_TYPE_TIME &&
!(thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST)) ?
- TIME_TIME_ONLY : date_mode_t(0);
- if (item->get_date(thd, this, flags | time_flag))
+ TIME_TIME_ONLY : TIME_CONV_NONE;
+ Options opt(flags | time_flag, time_round_mode_t(fuzzydate));
+ if (item->get_date(thd, this, opt))
time_type= MYSQL_TIMESTAMP_NONE;
else if (time_type == MYSQL_TIMESTAMP_TIME)
{
@@ -591,22 +832,17 @@ void Temporal_with_date::make_from_item(THD *thd, Item *item, date_mode_t flags)
}
-void Temporal_with_date::make_from_item(THD *thd, Item *item)
-{
- return make_from_item(thd, item, sql_mode_for_dates(thd));
-}
-
-
-void Temporal_with_date::check_date_or_invalidate(int *warn, date_mode_t flags)
+void Temporal_with_date::check_date_or_invalidate(int *warn,
+ date_conv_mode_t flags)
{
- if (check_date(this, pack_time(this) != 0,
- ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), warn))
+ if (::check_date(this, pack_time(this) != 0,
+ ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), warn))
time_type= MYSQL_TIMESTAMP_NONE;
}
void Datetime::make_from_time(THD *thd, int *warn, const MYSQL_TIME *from,
- date_mode_t flags)
+ date_conv_mode_t flags)
{
DBUG_ASSERT(from->time_type == MYSQL_TIMESTAMP_TIME);
if (time_to_datetime(thd, from, this))
@@ -620,7 +856,7 @@ void Datetime::make_from_time(THD *thd, int *warn, const MYSQL_TIME *from,
void Datetime::make_from_datetime(THD *thd, int *warn, const MYSQL_TIME *from,
- date_mode_t flags)
+ date_conv_mode_t flags)
{
DBUG_ASSERT(from->time_type == MYSQL_TIMESTAMP_DATE ||
from->time_type == MYSQL_TIMESTAMP_DATETIME);
@@ -636,8 +872,17 @@ void Datetime::make_from_datetime(THD *thd, int *warn, const MYSQL_TIME *from,
}
+Datetime::Datetime(THD *thd, const timeval &tv)
+{
+ thd->variables.time_zone->gmt_sec_to_TIME(this, tv.tv_sec);
+ second_part= tv.tv_usec;
+ thd->time_zone_used= 1;
+ DBUG_ASSERT(is_valid_value_slow());
+}
+
+
Datetime::Datetime(THD *thd, int *warn, const MYSQL_TIME *from,
- date_mode_t flags)
+ date_conv_mode_t flags)
{
DBUG_ASSERT(bool(flags & TIME_TIME_ONLY) == false);
switch (from->time_type) {
@@ -657,6 +902,84 @@ Datetime::Datetime(THD *thd, int *warn, const MYSQL_TIME *from,
}
+bool Temporal::datetime_add_nanoseconds_or_invalidate(THD *thd, int *warn, ulong nsec)
+{
+ if (!add_nanoseconds_mmssff(nsec))
+ return false;
+ /*
+ Overflow happened on minutes. Now we need to add 1 hour to the value.
+ Catch a special case for the maximum possible date and hour==23, to
+ truncate '9999-12-31 23:59:59.9999999' (with 7 fractional digits)
+ to '9999-12-31 23:59:59.999999' (with 6 fractional digits),
+ with a warning, instead of returning an error, so this statement:
+ INSERT INTO (datetime_column) VALUES ('9999-12-31 23:59:59.9999999');
+ inserts a value truncated to 6 fractional digits, instead of zero
+ date '0000-00-00 00:00:00.000000'.
+ */
+ if (year == 9999 && month == 12 && day == 31 && hour == 23)
+ {
+ minute= 59;
+ second= 59;
+ second_part= 999999;
+ *warn= MYSQL_TIME_WARN_OUT_OF_RANGE;
+ return false;
+ }
+ INTERVAL interval;
+ memset(&interval, 0, sizeof(interval));
+ interval.hour= 1;
+ /* date_add_interval cannot handle bad dates */
+ if (check_date(TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE, warn) ||
+ date_add_interval(thd, this, INTERVAL_HOUR, interval))
+ {
+ make_from_out_of_range(warn);
+ return true;
+ }
+ return false;
+}
+
+
+bool Temporal::datetime_round_or_invalidate(THD *thd, uint dec, int *warn, ulong nsec)
+{
+ DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
+ if (datetime_add_nanoseconds_or_invalidate(thd, warn, nsec))
+ return true;
+ my_time_trunc(this, dec);
+ return false;
+
+}
+
+
+bool Datetime::round_or_invalidate(THD *thd, uint dec, int *warn)
+{
+ return round_or_invalidate(thd, dec, warn, msec_round_add[dec]);
+}
+
+
+Datetime_from_temporal::Datetime_from_temporal(THD *thd, Item *temporal,
+ date_conv_mode_t fuzzydate)
+ :Datetime(thd, temporal, Options(fuzzydate, TIME_FRAC_NONE))
+{
+ // Exact rounding mode does not matter
+ DBUG_ASSERT(temporal->cmp_type() == TIME_RESULT);
+}
+
+
+Datetime_truncation_not_needed::Datetime_truncation_not_needed(THD *thd, Item *item,
+ date_conv_mode_t mode)
+ :Datetime(thd, item, Options(mode, TIME_FRAC_NONE))
+{
+ /*
+ The called Datetime() constructor only would truncate nanoseconds if they
+ existed (but we know there were no nanoseconds). Here we assert that there
+ are also no microsecond digits outside of the scale specified in "dec".
+ */
+ DBUG_ASSERT(!is_valid_datetime() ||
+ fraction_remainder(MY_MIN(item->decimals,
+ TIME_SECOND_PART_DIGITS)) == 0);
+}
+
+/********************************************************************/
+
uint Type_std_attributes::count_max_decimals(Item **item, uint nitems)
{
uint res= 0;
@@ -1060,7 +1383,7 @@ const Type_handler *Type_handler_datetime_common::type_handler_for_comparison()
const Type_handler *Type_handler_timestamp_common::type_handler_for_comparison() const
{
- return &type_handler_datetime;
+ return &type_handler_timestamp;
}
@@ -1071,6 +1394,15 @@ const Type_handler *Type_handler_row::type_handler_for_comparison() const
/***************************************************************************/
+const Type_handler *
+Type_handler_timestamp_common::type_handler_for_native_format() const
+{
+ return &type_handler_timestamp2;
+}
+
+
+/***************************************************************************/
+
const Type_handler *Type_handler_typelib::type_handler_for_item_field() const
{
return &type_handler_string;
@@ -1245,6 +1577,16 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h)
*/
if (b == TIME_RESULT)
m_type_handler= h; // Temporal types bit non-temporal types
+ /*
+ Compare TIMESTAMP to a non-temporal type as DATETIME.
+ This is needed to make queries with fuzzy dates work:
+ SELECT * FROM t1
+ WHERE
+ ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00';
+ */
+ if (m_type_handler->type_handler_for_native_format() ==
+ &type_handler_timestamp2)
+ m_type_handler= &type_handler_datetime;
}
else
{
@@ -1328,7 +1670,19 @@ Type_handler_hybrid_field_type::aggregate_for_min_max(const Type_handler *h)
}
else if (a == TIME_RESULT || b == TIME_RESULT)
{
- if ((a == TIME_RESULT) + (b == TIME_RESULT) == 1)
+ if ((m_type_handler->type_handler_for_native_format() ==
+ &type_handler_timestamp2) +
+ (h->type_handler_for_native_format() ==
+ &type_handler_timestamp2) == 1)
+ {
+ /*
+ Handle LEAST(TIMESTAMP, non-TIMESTAMP) as DATETIME,
+ to make sure fuzzy dates work in this context:
+ LEAST('2001-00-00', timestamp_field)
+ */
+ m_type_handler= &type_handler_datetime2;
+ }
+ else if ((a == TIME_RESULT) + (b == TIME_RESULT) == 1)
{
/*
We're here if there's only one temporal data type:
@@ -3121,14 +3475,16 @@ void Type_handler_row::Item_update_null_value(Item *item) const
void Type_handler_time_common::Item_update_null_value(Item *item) const
{
MYSQL_TIME ltime;
- (void) item->get_date(current_thd, &ltime, TIME_TIME_ONLY);
+ THD *thd= current_thd;
+ (void) item->get_date(thd, &ltime, Time::Options(TIME_TIME_ONLY, thd));
}
void Type_handler_temporal_with_date::Item_update_null_value(Item *item) const
{
MYSQL_TIME ltime;
- (void) item->get_date(current_thd, &ltime, sql_mode_for_dates(current_thd));
+ THD *thd= current_thd;
+ (void) item->get_date(thd, &ltime, Datetime::Options(thd));
}
@@ -3181,6 +3537,18 @@ int Type_handler_temporal_with_date::Item_save_in_field(Item *item,
}
+int Type_handler_timestamp_common::Item_save_in_field(Item *item,
+ Field *field,
+ bool no_conversions)
+ const
+{
+ Timestamp_or_zero_datetime_native_null tmp(field->table->in_use, item, true);
+ if (tmp.is_null())
+ return set_field_to_null_with_conversions(field, no_conversions);
+ return tmp.save_in_field(field, item->decimals);
+}
+
+
int Type_handler_string_result::Item_save_in_field(Item *item, Field *field,
bool no_conversions) const
{
@@ -3247,6 +3615,12 @@ Type_handler_temporal_with_date::set_comparator_func(Arg_comparator *cmp) const
return cmp->set_cmp_func_datetime();
}
+bool
+Type_handler_timestamp_common::set_comparator_func(Arg_comparator *cmp) const
+{
+ return cmp->set_cmp_func_native();
+}
+
/*************************************************************************/
@@ -3382,7 +3756,7 @@ Type_handler_string_result::Item_get_cache(THD *thd, const Item *item) const
Item_cache *
Type_handler_timestamp_common::Item_get_cache(THD *thd, const Item *item) const
{
- return new (thd->mem_root) Item_cache_datetime(thd);
+ return new (thd->mem_root) Item_cache_timestamp(thd);
}
Item_cache *
@@ -3403,6 +3777,22 @@ Type_handler_date_common::Item_get_cache(THD *thd, const Item *item) const
return new (thd->mem_root) Item_cache_date(thd);
}
+
+/*************************************************************************/
+
+Item_copy *
+Type_handler::create_item_copy(THD *thd, Item *item) const
+{
+ return new (thd->mem_root) Item_copy_string(thd, item);
+}
+
+
+Item_copy *
+Type_handler_timestamp_common::create_item_copy(THD *thd, Item *item) const
+{
+ return new (thd->mem_root) Item_copy_timestamp(thd, item);
+}
+
/*************************************************************************/
bool Type_handler_int_result::
@@ -4003,7 +4393,8 @@ bool Type_handler::Item_get_date_with_warn(THD *thd, Item *item,
MYSQL_TIME *ltime,
date_mode_t fuzzydate) const
{
- Temporal::Warn_push warn(thd, item->field_name_or_null(), ltime, fuzzydate);
+ Temporal::Warn_push warn(thd, item->field_table_or_null(),
+ item->field_name_or_null(), ltime, fuzzydate);
Item_get_date(thd, item, &warn, ltime, fuzzydate);
return ltime->time_type < 0;
}
@@ -4014,7 +4405,8 @@ bool Type_handler::Item_func_hybrid_field_type_get_date_with_warn(THD *thd,
MYSQL_TIME *ltime,
date_mode_t mode) const
{
- Temporal::Warn_push warn(thd, item->field_name_or_null(), ltime, mode);
+ Temporal::Warn_push warn(thd, item->field_table_or_null(),
+ item->field_name_or_null(), ltime, mode);
Item_func_hybrid_field_type_get_date(thd, item, &warn, ltime, mode);
return ltime->time_type < 0;
}
@@ -4549,6 +4941,12 @@ longlong Type_handler_time_common::
return func->val_int_cmp_time();
}
+longlong Type_handler_timestamp_common::
+ Item_func_between_val_int(Item_func_between *func) const
+{
+ return func->val_int_cmp_native();
+}
+
longlong Type_handler_int_result::
Item_func_between_val_int(Item_func_between *func) const
{
@@ -4612,6 +5010,12 @@ cmp_item *Type_handler_temporal_with_date::make_cmp_item(THD *thd,
return new (thd->mem_root) cmp_item_datetime;
}
+cmp_item *Type_handler_timestamp_common::make_cmp_item(THD *thd,
+ CHARSET_INFO *cs) const
+{
+ return new (thd->mem_root) cmp_item_timestamp;
+}
+
/***************************************************************************/
static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
@@ -4672,6 +5076,15 @@ Type_handler_temporal_with_date::make_in_vector(THD *thd,
}
+in_vector *
+Type_handler_timestamp_common::make_in_vector(THD *thd,
+ const Item_func_in *func,
+ uint nargs) const
+{
+ return new (thd->mem_root) in_timestamp(thd, nargs);
+}
+
+
in_vector *Type_handler_row::make_in_vector(THD *thd,
const Item_func_in *func,
uint nargs) const
@@ -4790,7 +5203,9 @@ String *Type_handler_datetime_common::
String *Type_handler_timestamp_common::
Item_func_min_max_val_str(Item_func_min_max *func, String *str) const
{
- return Datetime(func).to_string(str, func->decimals);
+ THD *thd= current_thd;
+ return Timestamp_or_zero_datetime_native_null(thd, func).
+ to_datetime(thd).to_string(str, func->decimals);
}
@@ -4842,10 +5257,13 @@ double Type_handler_datetime_common::
return Datetime(current_thd, func).to_double();
}
+
double Type_handler_timestamp_common::
Item_func_min_max_val_real(Item_func_min_max *func) const
{
- return Datetime(current_thd, func).to_double();
+ THD *thd= current_thd;
+ return Timestamp_or_zero_datetime_native_null(thd, func).
+ to_datetime(thd).to_double();
}
@@ -4887,7 +5305,9 @@ longlong Type_handler_datetime_common::
longlong Type_handler_timestamp_common::
Item_func_min_max_val_int(Item_func_min_max *func) const
{
- return Datetime(current_thd, func).to_longlong();
+ THD *thd= current_thd;
+ return Timestamp_or_zero_datetime_native_null(thd, func).
+ to_datetime(thd).to_longlong();
}
@@ -4942,7 +5362,9 @@ my_decimal *Type_handler_timestamp_common::
Item_func_min_max_val_decimal(Item_func_min_max *func,
my_decimal *dec) const
{
- return Datetime(current_thd, func).to_decimal(dec);
+ THD *thd= current_thd;
+ return Timestamp_or_zero_datetime_native_null(thd, func).
+ to_datetime(thd).to_decimal(dec);
}
@@ -4983,7 +5405,7 @@ bool Type_handler_temporal_result::
*/
return func->get_date_native(thd, ltime,
fuzzydate & TIME_TIME_ONLY ?
- sql_mode_for_dates(thd) :
+ Datetime::Options(thd) :
fuzzydate);
}
@@ -4994,6 +5416,15 @@ bool Type_handler_time_common::
return func->get_time_native(thd, ltime);
}
+
+bool Type_handler_timestamp_common::
+ Item_func_min_max_get_date(THD *thd, Item_func_min_max *func,
+ MYSQL_TIME *ltime, date_mode_t fuzzydate) const
+{
+ return Timestamp_or_zero_datetime_native_null(thd, func).
+ to_datetime(thd).copy_to_mysql_time(ltime);
+}
+
/***************************************************************************/
/**
@@ -5817,14 +6248,15 @@ uint Type_handler_string_result::Item_temporal_precision(THD *thd, Item *item,
String *tmp;
MYSQL_TIME_STATUS status;
DBUG_ASSERT(item->is_fixed());
+ // Nanosecond rounding is not needed here, for performance purposes
if ((tmp= item->val_str(&buf)) &&
(is_time ?
Time(thd, &status, tmp->ptr(), tmp->length(), tmp->charset(),
- Time::Options(TIME_TIME_ONLY,
+ Time::Options(TIME_TIME_ONLY, TIME_FRAC_TRUNCATE,
Time::DATETIME_TO_TIME_YYYYMMDD_TRUNCATE)).
is_valid_time() :
- Datetime(&status, tmp->ptr(), tmp->length(), tmp->charset(),
- TIME_FUZZY_DATES).
+ Datetime(thd, &status, tmp->ptr(), tmp->length(), tmp->charset(),
+ Datetime::Options(TIME_FUZZY_DATES, TIME_FRAC_TRUNCATE)).
is_valid_datetime()))
return MY_MIN(status.precision, TIME_SECOND_PART_DIGITS);
return MY_MIN(item->decimals, TIME_SECOND_PART_DIGITS);
@@ -6074,7 +6506,8 @@ bool Type_handler_temporal_with_date::
Item_save_in_value(THD *thd, Item *item, st_value *value) const
{
value->m_type= DYN_COL_DATETIME;
- item->get_date(thd, &value->value.m_time, sql_mode_for_dates(thd));
+ item->get_date(thd, &value->value.m_time,
+ Datetime::Options(thd, TIME_FRAC_NONE));
return check_null(item, value);
}
@@ -6264,11 +6697,23 @@ bool Type_handler::
}
+bool Type_handler::Item_send_timestamp(Item *item,
+ Protocol *protocol,
+ st_value *buf) const
+{
+ Timestamp_or_zero_datetime_native_null native(protocol->thd, item);
+ if (native.is_null())
+ return protocol->store_null();
+ native.to_TIME(protocol->thd, &buf->value.m_time);
+ return protocol->store(&buf->value.m_time, item->decimals);
+}
+
+
bool Type_handler::
Item_send_datetime(Item *item, Protocol *protocol, st_value *buf) const
{
item->get_date(protocol->thd, &buf->value.m_time,
- sql_mode_for_dates(protocol->thd));
+ Datetime::Options(protocol->thd));
if (!item->null_value)
return protocol->store(&buf->value.m_time, item->decimals);
return protocol->store_null();
@@ -6279,7 +6724,7 @@ bool Type_handler::
Item_send_date(Item *item, Protocol *protocol, st_value *buf) const
{
item->get_date(protocol->thd, &buf->value.m_time,
- sql_mode_for_dates(protocol->thd));
+ Date::Options(protocol->thd));
if (!item->null_value)
return protocol->store_date(&buf->value.m_time);
return protocol->store_null();
@@ -6564,6 +7009,21 @@ Item *Type_handler_long_blob::
return new (thd->mem_root) Item_char_typecast(thd, item, len, real_cs);
}
+Item *Type_handler_interval_DDhhmmssff::
+ create_typecast_item(THD *thd, Item *item,
+ const Type_cast_attributes &attr) const
+{
+ if (attr.decimals() > MAX_DATETIME_PRECISION)
+ {
+ wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
+ MAX_DATETIME_PRECISION);
+ return 0;
+ }
+ return new (thd->mem_root) Item_interval_DDhhmmssff_typecast(thd, item,
+ (uint)
+ attr.decimals());
+}
+
/***************************************************************************/
void Type_handler_string_result::Item_param_setup_conversion(THD *thd,
@@ -7397,6 +7857,16 @@ bool Type_handler_temporal_with_date::Item_eq_value(THD *thd,
}
+bool Type_handler_timestamp_common::Item_eq_value(THD *thd,
+ const Type_cmp_attributes *attr,
+ Item *a, Item *b) const
+{
+ Timestamp_or_zero_datetime_native_null na(thd, a, true);
+ Timestamp_or_zero_datetime_native_null nb(thd, b, true);
+ return !na.is_null() && !nb.is_null() && !cmp_native(na, nb);
+}
+
+
bool Type_handler_string_result::Item_eq_value(THD *thd,
const Type_cmp_attributes *attr,
Item *a, Item *b) const
@@ -7457,8 +7927,8 @@ int Type_handler_temporal_with_date::stored_field_cmp_to_item(THD *thd,
Item *item) const
{
MYSQL_TIME field_time, item_time, item_time2, *item_time_cmp= &item_time;
- field->get_date(&field_time, TIME_INVALID_DATES);
- item->get_date(thd, &item_time, TIME_INVALID_DATES);
+ field->get_date(&field_time, Datetime::Options(TIME_INVALID_DATES, thd));
+ item->get_date(thd, &item_time, Datetime::Options(TIME_INVALID_DATES, thd));
if (item_time.time_type == MYSQL_TIMESTAMP_TIME &&
time_to_datetime(thd, &item_time, item_time_cmp= &item_time2))
return 1;
@@ -7471,8 +7941,8 @@ int Type_handler_time_common::stored_field_cmp_to_item(THD *thd,
Item *item) const
{
MYSQL_TIME field_time, item_time;
- field->get_time(&field_time);
- item->get_time(thd, &item_time);
+ field->get_date(&field_time, Time::Options(thd));
+ item->get_date(thd, &item_time, Time::Options(thd));
return my_time_compare(&field_time, &item_time);
}
@@ -7536,7 +8006,6 @@ static bool have_important_literal_warnings(const MYSQL_TIME_STATUS *status)
static void literal_warn(THD *thd, const Item *item,
const char *str, size_t length, CHARSET_INFO *cs,
- timestamp_type time_type,
const MYSQL_TIME_STATUS *st,
const char *typestr, bool send_error)
{
@@ -7545,9 +8014,9 @@ static void literal_warn(THD *thd, const Item *item,
if (st->warnings) // e.g. a note on nanosecond truncation
{
ErrConvString err(str, length, cs);
- make_truncated_value_warning(thd,
+ thd->push_warning_wrong_or_truncated_value(
Sql_condition::time_warn_level(st->warnings),
- &err, time_type, 0);
+ false, typestr, err.ptr(), NULL, NullS);
}
}
else if (send_error)
@@ -7567,13 +8036,12 @@ Type_handler_date_common::create_literal_item(THD *thd,
{
Temporal::Warn st;
Item_literal *item= NULL;
- Temporal_hybrid tmp(thd, &st, str, length, cs, sql_mode_for_dates(thd));
+ Temporal_hybrid tmp(thd, &st, str, length, cs, Temporal_hybrid::Options(thd));
if (tmp.is_valid_temporal() &&
tmp.get_mysql_time()->time_type == MYSQL_TIMESTAMP_DATE &&
!have_important_literal_warnings(&st))
item= new (thd->mem_root) Item_date_literal(thd, tmp.get_mysql_time());
- literal_warn(thd, item, str, length, cs, MYSQL_TIMESTAMP_DATE,
- &st, "DATE", send_error);
+ literal_warn(thd, item, str, length, cs, &st, "DATE", send_error);
return item;
}
@@ -7587,14 +8055,13 @@ Type_handler_temporal_with_date::create_literal_item(THD *thd,
{
Temporal::Warn st;
Item_literal *item= NULL;
- Temporal_hybrid tmp(thd, &st, str, length, cs, sql_mode_for_dates(thd));
+ Temporal_hybrid tmp(thd, &st, str, length, cs, Temporal_hybrid::Options(thd));
if (tmp.is_valid_temporal() &&
tmp.get_mysql_time()->time_type == MYSQL_TIMESTAMP_DATETIME &&
!have_important_literal_warnings(&st))
item= new (thd->mem_root) Item_datetime_literal(thd, tmp.get_mysql_time(),
st.precision);
- literal_warn(thd, item, str, length, cs, MYSQL_TIMESTAMP_DATETIME,
- &st, "DATETIME", send_error);
+ literal_warn(thd, item, str, length, cs, &st, "DATETIME", send_error);
return item;
}
@@ -7608,13 +8075,122 @@ Type_handler_time_common::create_literal_item(THD *thd,
{
MYSQL_TIME_STATUS st;
Item_literal *item= NULL;
- Time::Options opt(TIME_TIME_ONLY, Time::DATETIME_TO_TIME_DISALLOW);
+ Time::Options opt(TIME_TIME_ONLY, thd, Time::DATETIME_TO_TIME_DISALLOW);
Time tmp(thd, &st, str, length, cs, opt);
if (tmp.is_valid_time() &&
!have_important_literal_warnings(&st))
item= new (thd->mem_root) Item_time_literal(thd, tmp.get_mysql_time(),
st.precision);
- literal_warn(thd, item, str, length, cs, MYSQL_TIMESTAMP_TIME,
- &st, "TIME", send_error);
+ literal_warn(thd, item, str, length, cs, &st, "TIME", send_error);
return item;
}
+
+
+bool Type_handler_timestamp_common::TIME_to_native(THD *thd,
+ const MYSQL_TIME *ltime,
+ Native *to,
+ uint decimals) const
+{
+ uint error_code;
+ Timestamp_or_zero_datetime tm(thd, ltime, &error_code);
+ if (error_code)
+ return true;
+ tm.trunc(decimals);
+ return tm.to_native(to, decimals);
+}
+
+
+bool
+Type_handler_timestamp_common::Item_val_native_with_conversion(THD *thd,
+ Item *item,
+ Native *to) const
+{
+ MYSQL_TIME ltime;
+ if (item->type_handler()->type_handler_for_native_format() ==
+ &type_handler_timestamp2)
+ return item->val_native(thd, to);
+ return
+ item->get_date(thd, &ltime, Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)) ||
+ TIME_to_native(thd, &ltime, to, item->datetime_precision(thd));
+}
+
+
+bool
+Type_handler_timestamp_common::Item_val_native_with_conversion_result(THD *thd,
+ Item *item,
+ Native *to)
+ const
+{
+ MYSQL_TIME ltime;
+ if (item->type_handler()->type_handler_for_native_format() ==
+ &type_handler_timestamp2)
+ return item->val_native_result(thd, to);
+ return
+ item->get_date_result(thd, &ltime,
+ Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)) ||
+ TIME_to_native(thd, &ltime, to, item->datetime_precision(thd));
+}
+
+
+int Type_handler_timestamp_common::cmp_native(const Native &a,
+ const Native &b) const
+{
+ /*
+ Optimize a simple case:
+ Either both timeatamp values have the same fractional precision,
+ or both values are zero datetime '0000-00-00 00:00:00.000000',
+ */
+ if (a.length() == b.length())
+ return memcmp(a.ptr(), b.ptr(), a.length());
+ return Timestamp_or_zero_datetime(a).cmp(Timestamp_or_zero_datetime(b));
+}
+
+
+Timestamp_or_zero_datetime_native_null::
+ Timestamp_or_zero_datetime_native_null(THD *thd, Item *item, bool conv)
+ :Null_flag(false)
+{
+ DBUG_ASSERT(item->type_handler()->type_handler_for_native_format() ==
+ &type_handler_timestamp2 || conv);
+ if (conv ?
+ type_handler_timestamp2.Item_val_native_with_conversion(thd, item, this) :
+ item->val_native(thd, this))
+ Null_flag::operator=(true);
+ // If no conversion, then is_null() should be equal to item->null_value
+ DBUG_ASSERT(is_null() == item->null_value || conv);
+ /*
+ is_null() can be true together with item->null_value==false, which means
+ a non-NULL item was evaluated, but then the conversion to TIMESTAMP failed.
+ But is_null() can never be false if item->null_value==true.
+ */
+ DBUG_ASSERT(is_null() >= item->null_value);
+}
+
+
+bool
+Type_handler::Item_param_val_native(THD *thd,
+ Item_param *item,
+ Native *to) const
+{
+ DBUG_ASSERT(0); // TODO-TYPE: MDEV-14271
+ return item->null_value= true;
+}
+
+
+bool
+Type_handler_timestamp_common::Item_param_val_native(THD *thd,
+ Item_param *item,
+ Native *to) const
+{
+ /*
+ The below code may not run well in corner cases.
+ This will be fixed under terms of MDEV-14271.
+ Item_param should:
+ - either remember @@time_zone at bind time
+ - or store TIMESTAMP in my_time_t format, rather than in MYSQL_TIME format.
+ */
+ MYSQL_TIME ltime;
+ return
+ item->get_date(thd, &ltime, Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)) ||
+ TIME_to_native(thd, &ltime, to, item->datetime_precision(thd));
+}
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 5de4c8e431a..5f53c5f4aae 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -25,6 +25,7 @@
#include "sql_array.h"
#include "sql_const.h"
#include "sql_time.h"
+#include "compat56.h"
class Field;
class Column_definition;
@@ -34,6 +35,7 @@ class Item_const;
class Item_literal;
class Item_param;
class Item_cache;
+class Item_copy;
class Item_func_or_sum;
class Item_sum_hybrid;
class Item_sum_sum;
@@ -90,6 +92,71 @@ enum scalar_comparison_op
};
+class Native: public Binary_string
+{
+public:
+ Native(char *str, size_t len)
+ :Binary_string(str, len)
+ { }
+};
+
+
+template<size_t buff_sz>
+class NativeBuffer: public Native
+{
+ char buff[buff_sz];
+public:
+ NativeBuffer() : Native(buff, buff_sz) { length(0); }
+};
+
+
+class String_ptr
+{
+protected:
+ String *m_string_ptr;
+public:
+ String_ptr(String *str)
+ :m_string_ptr(str)
+ { }
+ String_ptr(Item *item, String *buffer);
+ const String *string() const
+ {
+ DBUG_ASSERT(m_string_ptr);
+ return m_string_ptr;
+ }
+ bool is_null() const { return m_string_ptr == NULL; }
+};
+
+
+class Ascii_ptr: public String_ptr
+{
+public:
+ Ascii_ptr(Item *item, String *buffer);
+};
+
+
+template<size_t buff_sz>
+class String_ptr_and_buffer: public StringBuffer<buff_sz>,
+ public String_ptr
+{
+public:
+ String_ptr_and_buffer(Item *item)
+ :String_ptr(item, this)
+ { }
+};
+
+
+template<size_t buff_sz>
+class Ascii_ptr_and_buffer: public StringBuffer<buff_sz>,
+ public Ascii_ptr
+{
+public:
+ Ascii_ptr_and_buffer(Item *item)
+ :Ascii_ptr(item, this)
+ { }
+};
+
+
class Dec_ptr
{
protected:
@@ -216,8 +283,8 @@ protected:
ulong m_usec; // The fractional part, between 0 and 999999
bool m_neg; // false if positive, true of negative
bool m_truncated; // Indicates if the constructor truncated the value
- void make_from_decimal(const my_decimal *d);
- void make_from_double(double d);
+ void make_from_decimal(const my_decimal *d, ulong *nanoseconds);
+ void make_from_double(double d, ulong *nanoseconds);
void make_from_int(const Longlong_hybrid &nr)
{
m_neg= nr.neg();
@@ -230,14 +297,27 @@ protected:
m_sec= m_usec= m_neg= m_truncated= 0;
}
Sec6() { }
+ bool add_nanoseconds(uint nanoseconds)
+ {
+ DBUG_ASSERT(nanoseconds <= 1000000000);
+ if (nanoseconds < 500)
+ return false;
+ m_usec+= (nanoseconds + 500) / 1000;
+ if (m_usec < 1000000)
+ return false;
+ m_usec%= 1000000;
+ return true;
+ }
public:
explicit Sec6(double nr)
{
- make_from_double(nr);
+ ulong nanoseconds;
+ make_from_double(nr, &nanoseconds);
}
explicit Sec6(const my_decimal *d)
{
- make_from_decimal(d);
+ ulong nanoseconds;
+ make_from_decimal(d, &nanoseconds);
}
explicit Sec6(const Longlong_hybrid &nr)
{
@@ -264,25 +344,68 @@ public:
MYSQL_TIME *ltime,
date_mode_t fuzzydate) const;
- // Convert a number in format hhhmmss.ff to TIME'hhh:mm:ss.ff'
- bool to_time(MYSQL_TIME *to, int *warn) const
+protected:
+
+ bool to_interval_hhmmssff_only(MYSQL_TIME *to, int *warn) const
+ {
+ return number_to_time_only(m_neg, m_sec, m_usec,
+ TIME_MAX_INTERVAL_HOUR, to, warn);
+ }
+ bool to_datetime_or_to_interval_hhmmssff(MYSQL_TIME *to, int *warn) const
{
- bool rc= number_to_time(m_neg, m_sec, m_usec, to, warn);
+ /*
+ Convert a number to a time interval.
+ The following formats are understood:
+ - 0 <= x <= 999999995959 - parse as hhhhmmss
+ - 999999995959 < x <= 99991231235959 - parse as YYYYMMDDhhmmss
+ (YYMMDDhhmmss) (YYYYMMDDhhmmss)
+
+ Note, these formats are NOT understood:
+ - YYMMDD - overlaps with INTERVAL range
+ - YYYYMMDD - overlaps with INTERVAL range
+ - YYMMDDhhmmss - overlaps with INTERVAL range, partially
+ (see TIME_MAX_INTERVAL_HOUR)
+
+ If we ever need wider intervals, this code switching between
+ full datetime and interval-only should be rewised.
+ */
+ DBUG_ASSERT(TIME_MAX_INTERVAL_HOUR <= 999999995959);
+ /* (YYMMDDhhmmss) */
+ if (m_sec > 999999995959ULL &&
+ m_sec <= 99991231235959ULL && m_neg == 0)
+ return to_datetime_or_date(to, warn, TIME_INVALID_DATES);
+ if (m_sec / 10000 > TIME_MAX_INTERVAL_HOUR)
+ {
+ *warn= MYSQL_TIME_WARN_OUT_OF_RANGE;
+ return true;
+ }
+ return to_interval_hhmmssff_only(to, warn);
+ }
+public:
+ // [-][DD]hhhmmss.ff, YYMMDDhhmmss.ff, YYYYMMDDhhmmss.ff
+ bool to_datetime_or_time(MYSQL_TIME *to, int *warn,
+ date_conv_mode_t mode) const
+ {
+ bool rc= m_sec > 9999999 && m_sec <= 99991231235959ULL && !m_neg ?
+ ::number_to_datetime_or_date(m_sec, m_usec, to,
+ ulonglong(mode & TIME_MODE_FOR_XXX_TO_DATE), warn) < 0 :
+ ::number_to_time_only(m_neg, m_sec, m_usec, TIME_MAX_HOUR, to, warn);
DBUG_ASSERT(*warn || !rc);
return rc;
}
/*
- Convert a number in format YYYYMMDDhhmmss.ff to
+ Convert a number in formats YYYYMMDDhhmmss.ff or YYMMDDhhmmss.ff to
TIMESTAMP'YYYY-MM-DD hh:mm:ss.ff'
*/
- bool to_datetime(MYSQL_TIME *to, date_mode_t flags, int *warn) const
+ bool to_datetime_or_date(MYSQL_TIME *to, int *warn,
+ date_conv_mode_t flags) const
{
if (m_neg)
{
*warn= MYSQL_TIME_WARN_OUT_OF_RANGE;
return true;
}
- bool rc= number_to_datetime(m_sec, m_usec, to,
+ bool rc= number_to_datetime_or_date(m_sec, m_usec, to,
ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE),
warn) == -1;
DBUG_ASSERT(*warn || !rc);
@@ -308,6 +431,11 @@ public:
ltime->second_part= m_usec;
return false;
}
+ Sec6 &trunc(uint dec)
+ {
+ m_usec-= my_time_fraction_remainder(m_usec, dec);
+ return *this;
+ }
size_t to_string(char *to, size_t nbytes) const
{
return m_usec ?
@@ -319,11 +447,45 @@ public:
};
-class VSec6: public Sec6
+class Sec9: public Sec6
+{
+protected:
+ ulong m_nsec; // Nanoseconds 0..999
+ void make_from_int(const Longlong_hybrid &nr)
+ {
+ Sec6::make_from_int(nr);
+ m_nsec= 0;
+ }
+ Sec9() { }
+public:
+ Sec9(const my_decimal *d)
+ {
+ Sec6::make_from_decimal(d, &m_nsec);
+ }
+ Sec9(double d)
+ {
+ Sec6::make_from_double(d, &m_nsec);
+ }
+ ulong nsec() const { return m_nsec; }
+ Sec9 &trunc(uint dec)
+ {
+ m_nsec= 0;
+ Sec6::trunc(dec);
+ return *this;
+ }
+ Sec9 &round(uint dec);
+ Sec9 &round(uint dec, time_round_mode_t mode)
+ {
+ return mode == TIME_FRAC_TRUNCATE ? trunc(dec) : round(dec);
+ }
+};
+
+
+class VSec9: public Sec9
{
bool m_is_null;
public:
- VSec6(THD *thd, Item *item, const char *type_str, ulonglong limit);
+ VSec9(THD *thd, Item *item, const char *type_str, ulonglong limit);
bool is_null() const { return m_is_null; }
};
@@ -451,37 +613,58 @@ public:
public Status
{
public:
- void push_conversion_warnings(THD *thd, bool totally_useless_value, date_mode_t mode,
- timestamp_type tstype, const char *name)
+ void push_conversion_warnings(THD *thd, bool totally_useless_value,
+ date_mode_t mode, timestamp_type tstype,
+ const TABLE_SHARE* s, const char *name)
{
const char *typestr= tstype >= 0 ? type_name_by_timestamp_type(tstype) :
+ mode & (TIME_INTERVAL_hhmmssff | TIME_INTERVAL_DAY) ?
+ "interval" :
mode & TIME_TIME_ONLY ? "time" : "datetime";
- Temporal::push_conversion_warnings(thd, totally_useless_value, warnings, typestr,
- name, ptr());
+ Temporal::push_conversion_warnings(thd, totally_useless_value, warnings,
+ typestr, s, name, ptr());
}
};
class Warn_push: public Warn
{
THD *m_thd;
+ const TABLE_SHARE *m_s;
const char *m_name;
const MYSQL_TIME *m_ltime;
date_mode_t m_mode;
public:
- Warn_push(THD *thd, const char *name,
+ Warn_push(THD *thd, const TABLE_SHARE *s, const char *name,
const MYSQL_TIME *ltime, date_mode_t mode)
- :m_thd(thd), m_name(name), m_ltime(ltime), m_mode(mode)
+ :m_thd(thd), m_s(s), m_name(name), m_ltime(ltime), m_mode(mode)
{ }
~Warn_push()
{
if (warnings)
push_conversion_warnings(m_thd, m_ltime->time_type < 0,
- m_mode, m_ltime->time_type, m_name);
+ m_mode, m_ltime->time_type, m_s, m_name);
}
};
public:
- static date_mode_t sql_mode_for_dates(THD *thd);
+ static date_conv_mode_t sql_mode_for_dates(THD *thd);
+ static time_round_mode_t default_round_mode(THD *thd);
+ class Options: public date_mode_t
+ {
+ public:
+ explicit Options(date_mode_t flags)
+ :date_mode_t(flags)
+ { }
+ Options(date_conv_mode_t flags, time_round_mode_t round_mode)
+ :date_mode_t(flags | round_mode)
+ {
+ DBUG_ASSERT(ulonglong(flags) <= UINT_MAX32);
+ }
+ Options(date_conv_mode_t flags, THD *thd)
+ :Options(flags, default_round_mode(thd))
+ { }
+ };
+
bool is_valid_temporal() const
{
DBUG_ASSERT(time_type != MYSQL_TIMESTAMP_ERROR);
@@ -500,6 +683,7 @@ public:
}
static void push_conversion_warnings(THD *thd, bool totally_useless_value, int warn,
const char *type_name,
+ const TABLE_SHARE *s,
const char *field_name,
const char *value);
/*
@@ -507,7 +691,7 @@ public:
TIME/DATE/DATETIME failed. We return a zero date if allowed,
otherwise - null.
*/
- void make_fuzzy_date(int *warn, date_mode_t fuzzydate)
+ void make_fuzzy_date(int *warn, date_conv_mode_t fuzzydate)
{
/*
In the following scenario:
@@ -547,14 +731,21 @@ protected:
const Sec6 &nr, date_mode_t mode)
{
if (nr.convert_to_mysql_time(thd, &st->warnings, this, mode))
- make_fuzzy_date(&st->warnings, mode);
+ make_fuzzy_date(&st->warnings, date_conv_mode_t(mode));
+ }
+ void make_from_sec9(THD *thd, MYSQL_TIME_STATUS *st,
+ const Sec9 &nr, date_mode_t mode)
+ {
+ if (nr.convert_to_mysql_time(thd, &st->warnings, this, mode) ||
+ add_nanoseconds(thd, &st->warnings, mode, nr.nsec()))
+ make_fuzzy_date(&st->warnings, date_conv_mode_t(mode));
}
void make_from_str(THD *thd, Warn *warn,
const char *str, size_t length, CHARSET_INFO *cs,
date_mode_t fuzzydate);
void make_from_double(THD *thd, Warn *warn, double nr, date_mode_t mode)
{
- make_from_sec6(thd, warn, Sec6(nr), mode);
+ make_from_sec9(thd, warn, Sec9(nr), mode);
if (warn->warnings)
warn->set_double(nr);
}
@@ -572,14 +763,71 @@ protected:
void make_from_decimal(THD *thd, Warn *warn,
const my_decimal *nr, date_mode_t mode)
{
- make_from_sec6(thd, warn, Sec6(nr), mode);
+ make_from_sec9(thd, warn, Sec9(nr), mode);
if (warn->warnings)
warn->set_decimal(nr);
}
- bool str_to_time(MYSQL_TIME_STATUS *st, const char *str, size_t length,
- CHARSET_INFO *cs, date_mode_t fuzzydate);
- bool str_to_datetime(MYSQL_TIME_STATUS *st, const char *str, size_t length,
+ bool ascii_to_temporal(MYSQL_TIME_STATUS *st,
+ const char *str, size_t length,
+ date_mode_t mode)
+ {
+ if (mode & (TIME_INTERVAL_hhmmssff | TIME_INTERVAL_DAY))
+ return ascii_to_datetime_or_date_or_interval_DDhhmmssff(st, str, length,
+ mode);
+ if (mode & TIME_TIME_ONLY)
+ return ascii_to_datetime_or_date_or_time(st, str, length, mode);
+ return ascii_to_datetime_or_date(st, str, length, mode);
+ }
+ bool ascii_to_datetime_or_date_or_interval_DDhhmmssff(MYSQL_TIME_STATUS *st,
+ const char *str,
+ size_t length,
+ date_mode_t mode)
+ {
+ longlong cflags= ulonglong(mode & TIME_MODE_FOR_XXX_TO_DATE);
+ bool rc= mode & TIME_INTERVAL_DAY ?
+ ::str_to_datetime_or_date_or_interval_day(str, length, this, cflags, st,
+ TIME_MAX_INTERVAL_HOUR,
+ TIME_MAX_INTERVAL_HOUR) :
+ ::str_to_datetime_or_date_or_interval_hhmmssff(str, length, this,
+ cflags, st,
+ TIME_MAX_INTERVAL_HOUR,
+ TIME_MAX_INTERVAL_HOUR);
+ DBUG_ASSERT(!rc || st->warnings);
+ return rc;
+ }
+ bool ascii_to_datetime_or_date_or_time(MYSQL_TIME_STATUS *status,
+ const char *str, size_t length,
+ date_mode_t fuzzydate)
+ {
+ ulonglong cflags= ulonglong(fuzzydate & TIME_MODE_FOR_XXX_TO_DATE);
+ bool rc= ::str_to_datetime_or_date_or_time(str, length, this,
+ cflags, status,
+ TIME_MAX_HOUR, UINT_MAX32);
+ DBUG_ASSERT(!rc || status->warnings);
+ return rc;
+ }
+ bool ascii_to_datetime_or_date(MYSQL_TIME_STATUS *status,
+ const char *str, size_t length,
+ date_mode_t fuzzydate)
+ {
+ DBUG_ASSERT(bool(fuzzydate & TIME_TIME_ONLY) == false);
+ bool rc= ::str_to_datetime_or_date(str, length, this,
+ ulonglong(fuzzydate & TIME_MODE_FOR_XXX_TO_DATE),
+ status);
+ DBUG_ASSERT(!rc || status->warnings);
+ return rc;
+ }
+ // Character set aware versions for string conversion routines
+ bool str_to_temporal(THD *thd, MYSQL_TIME_STATUS *st,
+ const char *str, size_t length,
CHARSET_INFO *cs, date_mode_t fuzzydate);
+ bool str_to_datetime_or_date_or_time(THD *thd, MYSQL_TIME_STATUS *st,
+ const char *str, size_t length,
+ CHARSET_INFO *cs, date_mode_t mode);
+ bool str_to_datetime_or_date(THD *thd, MYSQL_TIME_STATUS *st,
+ const char *str, size_t length,
+ CHARSET_INFO *cs, date_mode_t mode);
+
bool has_valid_mmssff() const
{
return minute <= TIME_MAX_MINUTE &&
@@ -594,6 +842,67 @@ protected:
{
return year == 0 && month == 0 && day == 0;
}
+ bool check_date(date_conv_mode_t flags, int *warn) const
+ {
+ return ::check_date(this, flags, warn);
+ }
+ void time_hhmmssff_set_max(ulong max_hour)
+ {
+ hour= max_hour;
+ minute= TIME_MAX_MINUTE;
+ second= TIME_MAX_SECOND;
+ second_part= TIME_MAX_SECOND_PART;
+ }
+ /*
+ Add nanoseconds to ssff
+ retval true if seconds overflowed (the caller should increment minutes)
+ false if no overflow happened
+ */
+ bool add_nanoseconds_ssff(uint nanoseconds)
+ {
+ DBUG_ASSERT(nanoseconds <= 1000000000);
+ if (nanoseconds < 500)
+ return false;
+ second_part+= (nanoseconds + 500) / 1000;
+ if (second_part < 1000000)
+ return false;
+ second_part%= 1000000;
+ if (second < 59)
+ {
+ second++;
+ return false;
+ }
+ second= 0;
+ return true;
+ }
+ /*
+ Add nanoseconds to mmssff
+ retval true if hours overflowed (the caller should increment hours)
+ false if no overflow happened
+ */
+ bool add_nanoseconds_mmssff(uint nanoseconds)
+ {
+ if (!add_nanoseconds_ssff(nanoseconds))
+ return false;
+ if (minute < 59)
+ {
+ minute++;
+ return false;
+ }
+ minute= 0;
+ return true;
+ }
+ void time_round_or_set_max(uint dec, int *warn, ulong max_hour, ulong nsec);
+ bool datetime_add_nanoseconds_or_invalidate(THD *thd, int *warn, ulong nsec);
+ bool datetime_round_or_invalidate(THD *thd, uint dec, int *warn, ulong nsec);
+ bool add_nanoseconds_with_round(THD *thd, int *warn,
+ date_conv_mode_t mode, ulong nsec);
+ bool add_nanoseconds(THD *thd, int *warn, date_mode_t mode, ulong nsec)
+ {
+ date_conv_mode_t cmode= date_conv_mode_t(mode);
+ return time_round_mode_t(mode) == TIME_FRAC_ROUND ?
+ add_nanoseconds_with_round(thd, warn, cmode, nsec) : false;
+ }
public:
static void *operator new(size_t size, MYSQL_TIME *ltime) throw()
{
@@ -617,10 +926,28 @@ public:
class Temporal_hybrid: public Temporal
{
public:
+ class Options: public Temporal::Options
+ {
+ public:
+ Options(THD *thd)
+ :Temporal::Options(sql_mode_for_dates(thd), default_round_mode(thd))
+ { }
+ Options(date_conv_mode_t flags, time_round_mode_t round_mode)
+ :Temporal::Options(flags, round_mode)
+ { }
+ explicit Options(const Temporal::Options &opt)
+ :Temporal::Options(opt)
+ { }
+ explicit Options(date_mode_t fuzzydate)
+ :Temporal::Options(fuzzydate)
+ { }
+ };
+
+public:
// Contructors for Item
Temporal_hybrid(THD *thd, Item *item, date_mode_t fuzzydate);
Temporal_hybrid(THD *thd, Item *item)
- :Temporal_hybrid(thd, item, sql_mode_for_dates(thd))
+ :Temporal_hybrid(thd, item, Options(thd))
{ }
Temporal_hybrid(Item *item)
:Temporal_hybrid(current_thd, item)
@@ -852,16 +1179,32 @@ public:
*/
static uint max_useful_hour()
{
- return 87649415;
+ return TIME_MAX_INTERVAL_HOUR;
+ }
+ static uint max_int_part_char_length()
+ {
+ // e.g. '+3652058 23:59:59'
+ return 1/*sign*/ + TIME_MAX_INTERVAL_DAY_CHAR_LENGTH + 1 + 8/*hh:mm:ss*/;
+ }
+ static uint max_char_length(uint fsp)
+ {
+ DBUG_ASSERT(fsp <= TIME_SECOND_PART_DIGITS);
+ return max_int_part_char_length() + (fsp ? 1 : 0) + fsp;
}
+
public:
Interval_DDhhmmssff(THD *thd, Status *st, bool push_warnings,
- Item *item, ulong max_hour);
- Interval_DDhhmmssff(THD *thd, Item *item)
+ Item *item, ulong max_hour,
+ time_round_mode_t mode, uint dec);
+ Interval_DDhhmmssff(THD *thd, Item *item, uint dec)
{
Status st;
- new(this) Interval_DDhhmmssff(thd, &st, true, item, max_useful_hour());
+ new(this) Interval_DDhhmmssff(thd, &st, true, item, max_useful_hour(),
+ default_round_mode(thd), dec);
}
+ Interval_DDhhmmssff(THD *thd, Item *item)
+ :Interval_DDhhmmssff(thd, item, TIME_SECOND_PART_DIGITS)
+ { }
const MYSQL_TIME *get_mysql_time() const
{
DBUG_ASSERT(is_valid_interval_DDhhmmssff_slow());
@@ -875,6 +1218,17 @@ public:
{
return time_type == MYSQL_TIMESTAMP_NONE || is_valid_interval_DDhhmmssff();
}
+ String *to_string(String *str, uint dec) const
+ {
+ if (!is_valid_interval_DDhhmmssff())
+ return NULL;
+ str->set_charset(&my_charset_numeric);
+ if (!str->alloc(MAX_DATE_STRING_REP_LENGTH))
+ str->length(my_interval_DDhhmmssff_to_str(this,
+ const_cast<char*>(str->ptr()),
+ dec));
+ return str;
+ }
};
@@ -907,27 +1261,35 @@ public:
DATETIME_TO_TIME_YYYYMMDD_00000000_ONLY,
DATETIME_TO_TIME_MINUS_CURRENT_DATE
};
- class Options
+ class Options: public Temporal::Options
{
- date_mode_t m_get_date_flags;
datetime_to_time_mode_t m_datetime_to_time_mode;
public:
- Options()
- :m_get_date_flags(flags_for_get_date()),
- m_datetime_to_time_mode(DATETIME_TO_TIME_YYYYMMDD_000000DD_MIX_TO_HOURS)
+ Options(THD *thd)
+ :Temporal::Options(default_flags_for_get_date(), default_round_mode(thd)),
+ m_datetime_to_time_mode(default_datetime_to_time_mode())
{ }
- Options(date_mode_t flags)
- :m_get_date_flags(flags),
- m_datetime_to_time_mode(DATETIME_TO_TIME_YYYYMMDD_000000DD_MIX_TO_HOURS)
+ Options(date_conv_mode_t flags, THD *thd)
+ :Temporal::Options(flags, default_round_mode(thd)),
+ m_datetime_to_time_mode(default_datetime_to_time_mode())
{ }
- Options(date_mode_t flags, datetime_to_time_mode_t dtmode)
- :m_get_date_flags(flags),
+ Options(date_conv_mode_t flags, THD *thd, datetime_to_time_mode_t dtmode)
+ :Temporal::Options(flags, default_round_mode(thd)),
m_datetime_to_time_mode(dtmode)
{ }
- date_mode_t get_date_flags() const
- { return m_get_date_flags; }
+ Options(date_conv_mode_t fuzzydate, time_round_mode_t round_mode,
+ datetime_to_time_mode_t datetime_to_time_mode)
+ :Temporal::Options(fuzzydate, round_mode),
+ m_datetime_to_time_mode(datetime_to_time_mode)
+ { }
+
datetime_to_time_mode_t datetime_to_time_mode() const
{ return m_datetime_to_time_mode; }
+
+ static datetime_to_time_mode_t default_datetime_to_time_mode()
+ {
+ return DATETIME_TO_TIME_YYYYMMDD_000000DD_MIX_TO_HOURS;
+ }
};
/*
CAST(AS TIME) historically does not mix days to hours.
@@ -937,14 +1299,28 @@ public:
class Options_for_cast: public Options
{
public:
- Options_for_cast()
- :Options(flags_for_get_date(), DATETIME_TO_TIME_YYYYMMDD_TRUNCATE)
+ Options_for_cast(THD *thd)
+ :Options(default_flags_for_get_date(), default_round_mode(thd),
+ DATETIME_TO_TIME_YYYYMMDD_TRUNCATE)
{ }
- Options_for_cast(date_mode_t mode)
- :Options(flags_for_get_date() | (mode & TIME_FUZZY_DATES),
+ Options_for_cast(date_mode_t mode, THD *thd)
+ :Options(default_flags_for_get_date() | (mode & TIME_FUZZY_DATES),
+ default_round_mode(thd),
DATETIME_TO_TIME_YYYYMMDD_TRUNCATE)
{ }
};
+
+ class Options_cmp: public Options
+ {
+ public:
+ Options_cmp(THD *thd)
+ :Options(comparison_flags_for_get_date(), thd)
+ { }
+ Options_cmp(THD *thd, datetime_to_time_mode_t dtmode)
+ :Options(comparison_flags_for_get_date(),
+ default_round_mode(thd), dtmode)
+ { }
+ };
private:
bool is_valid_value_slow() const
{
@@ -990,7 +1366,7 @@ private:
/*
Convert a valid DATE or DATETIME to TIME.
Before this call, "this" must be a valid DATE or DATETIME value,
- e.g. returned from Item::get_date(), str_to_time(), number_to_time().
+ e.g. returned from Item::get_date(), str_to_xxx(), number_to_xxx().
After this call, "this" is a valid TIME value.
*/
void valid_datetime_to_valid_time(THD *thd, int *warn, const Options opt)
@@ -999,7 +1375,7 @@ private:
time_type == MYSQL_TIMESTAMP_DATETIME);
/*
We're dealing with a DATE or DATETIME returned from
- str_to_time(), number_to_time() or unpack_time().
+ str_to_xxx(), number_to_xxx() or unpack_time().
Do some asserts to make sure the result hour value
after mixing days to hours does not go out of the valid TIME range.
The maximum hour value after mixing days will be 31*24+23=767,
@@ -1025,7 +1401,7 @@ private:
/**
Convert valid DATE/DATETIME to valid TIME if needed.
This method is called after Item::get_date(),
- str_to_time(), number_to_time().
+ str_to_xxx(), number_to_xxx().
which can return only valid TIME/DATE/DATETIME values.
Before this call, "this" is:
- either a valid TIME/DATE/DATETIME value
@@ -1061,14 +1437,14 @@ private:
}
/*
- This method is called after number_to_time() and str_to_time(),
+ This method is called after number_to_xxx() and str_to_xxx(),
which can return DATE or DATETIME values. Convert to TIME if needed.
We trust that xxx_to_time() returns a valid TIME/DATE/DATETIME value,
so here we need to do only simple validation.
*/
void xxx_to_time_result_to_valid_value(THD *thd, int *warn, const Options opt)
{
- // str_to_time(), number_to_time() never return MYSQL_TIMESTAMP_ERROR
+ // str_to_xxx(), number_to_xxx() never return MYSQL_TIMESTAMP_ERROR
DBUG_ASSERT(time_type != MYSQL_TIMESTAMP_ERROR);
valid_MYSQL_TIME_to_valid_value(thd, warn, opt);
}
@@ -1078,6 +1454,15 @@ private:
time_type= MYSQL_TIMESTAMP_NONE;
DBUG_ASSERT(is_valid_value_slow());
}
+public:
+ void round_or_set_max(uint dec, int *warn, ulong nsec);
+private:
+ void round_or_set_max(uint dec, int *warn);
+
+ /*
+ All make_from_xxx() methods initialize *warn.
+ The old value gets lost.
+ */
void make_from_datetime_move_day_to_hour(int *warn, const MYSQL_TIME *from);
void make_from_datetime_with_days_diff(int *warn, const MYSQL_TIME *from,
long curdays);
@@ -1089,9 +1474,10 @@ public:
All constructors that accept an "int *warn" parameter initialize *warn.
The old value gets lost.
*/
+ Time(int *warn, bool neg, ulonglong hour, uint minute, const Sec6 &second);
Time() { time_type= MYSQL_TIMESTAMP_NONE; }
Time(Item *item)
- :Time(current_thd, item, Options())
+ :Time(current_thd, item)
{ }
Time(THD *thd, Item *item, const Options opt)
{
@@ -1099,54 +1485,97 @@ public:
make_from_item(thd, &warn, item, opt);
}
Time(THD *thd, Item *item)
- :Time(thd, item, Options())
+ :Time(thd, item, Options(thd))
{ }
Time(int *warn, const MYSQL_TIME *from, long curdays);
Time(THD *thd, MYSQL_TIME_STATUS *status,
const char *str, size_t len, CHARSET_INFO *cs,
const Options opt)
{
- if (str_to_time(status, str, len, cs, opt.get_date_flags()))
+ if (str_to_datetime_or_date_or_time(thd, status, str, len, cs, opt))
time_type= MYSQL_TIMESTAMP_NONE;
// The below call will optionally add notes to already collected warnings:
- xxx_to_time_result_to_valid_value(thd, &status->warnings, opt);
+ else
+ xxx_to_time_result_to_valid_value(thd, &status->warnings, opt);
}
+
+protected:
Time(THD *thd, int *warn, const Sec6 &nr, const Options opt)
{
- if (nr.to_time(this, warn))
+ if (nr.to_datetime_or_time(this, warn, TIME_INVALID_DATES))
time_type= MYSQL_TIMESTAMP_NONE;
xxx_to_time_result_to_valid_value(thd, warn, opt);
}
- Time(THD *thd, int *warn, const Sec6 &nr)
- :Time(thd, warn, nr, Options())
+ Time(THD *thd, int *warn, const Sec9 &nr, const Options &opt)
+ :Time(thd, warn, static_cast<Sec6>(nr), opt)
+ {
+ if (is_valid_time() && time_round_mode_t(opt) == TIME_FRAC_ROUND)
+ round_or_set_max(6, warn, nr.nsec());
+ }
+
+public:
+ Time(THD *thd, int *warn, const Longlong_hybrid &nr, const Options &opt)
+ :Time(thd, warn, Sec6(nr), opt)
+ { }
+ Time(THD *thd, int *warn, double nr, const Options &opt)
+ :Time(thd, warn, Sec9(nr), opt)
+ { }
+ Time(THD *thd, int *warn, const my_decimal *d, const Options &opt)
+ :Time(thd, warn, Sec9(d), opt)
{ }
Time(THD *thd, Item *item, const Options opt, uint dec)
:Time(thd, item, opt)
{
- trunc(dec);
+ round(dec, time_round_mode_t(opt));
}
- Time(int *warn, const MYSQL_TIME *from, long curdays, uint dec)
+ Time(int *warn, const MYSQL_TIME *from, long curdays,
+ const Time::Options &opt, uint dec)
:Time(warn, from, curdays)
{
- trunc(dec);
+ round(dec, time_round_mode_t(opt), warn);
+ }
+ Time(int *warn, bool neg, ulonglong hour, uint minute, const Sec9 &second,
+ time_round_mode_t mode, uint dec)
+ :Time(warn, neg, hour, minute, second)
+ {
+ DBUG_ASSERT(is_valid_time());
+ if ((ulonglong) mode == (ulonglong) TIME_FRAC_ROUND)
+ round_or_set_max(6, warn, second.nsec());
+ round(dec, mode, warn);
}
Time(THD *thd, MYSQL_TIME_STATUS *status,
const char *str, size_t len, CHARSET_INFO *cs,
const Options &opt, uint dec)
:Time(thd, status, str, len, cs, opt)
{
- trunc(dec);
+ round(dec, time_round_mode_t(opt), &status->warnings);
}
- Time(THD *thd, int *warn, const Sec6 &nr, uint dec)
- :Time(thd, warn, nr)
+ Time(THD *thd, int *warn, const Longlong_hybrid &nr,
+ const Options &opt, uint dec)
+ :Time(thd, warn, nr, opt)
{
+ /*
+ Decimal digit truncation is needed here in case if nr was out
+ of the supported TIME range, so "this" was set to '838:59:59.999999'.
+ We always do truncation (not rounding) here, independently from "opt".
+ */
trunc(dec);
}
+ Time(THD *thd, int *warn, double nr, const Options &opt, uint dec)
+ :Time(thd, warn, nr, opt)
+ {
+ round(dec, time_round_mode_t(opt), warn);
+ }
+ Time(THD *thd, int *warn, const my_decimal *d, const Options &opt, uint dec)
+ :Time(thd, warn, d, opt)
+ {
+ round(dec, time_round_mode_t(opt), warn);
+ }
- static date_mode_t flags_for_get_date()
+ static date_conv_mode_t default_flags_for_get_date()
{ return TIME_TIME_ONLY | TIME_INVALID_DATES; }
- static date_mode_t comparison_flags_for_get_date()
+ static date_conv_mode_t comparison_flags_for_get_date()
{ return TIME_TIME_ONLY | TIME_INVALID_DATES | TIME_FUZZY_DATES; }
bool is_valid_time() const
{
@@ -1219,6 +1648,12 @@ public:
{
return is_valid_time() ? Temporal::to_packed() : 0;
}
+ long fraction_remainder(uint dec) const
+ {
+ DBUG_ASSERT(is_valid_time());
+ return Temporal::fraction_remainder(dec);
+ }
+
Time &trunc(uint dec)
{
if (is_valid_time())
@@ -1226,6 +1661,32 @@ public:
DBUG_ASSERT(is_valid_value_slow());
return *this;
}
+ Time &round(uint dec, int *warn)
+ {
+ if (is_valid_time())
+ round_or_set_max(dec, warn);
+ DBUG_ASSERT(is_valid_value_slow());
+ return *this;
+ }
+ Time &round(uint dec, time_round_mode_t mode, int *warn)
+ {
+ switch (mode.mode()) {
+ case time_round_mode_t::FRAC_NONE:
+ DBUG_ASSERT(fraction_remainder(dec) == 0);
+ return trunc(dec);
+ case time_round_mode_t::FRAC_TRUNCATE:
+ return trunc(dec);
+ case time_round_mode_t::FRAC_ROUND:
+ return round(dec, warn);
+ }
+ return *this;
+ }
+ Time &round(uint dec, time_round_mode_t mode)
+ {
+ int warn= 0;
+ return round(dec, mode, &warn);
+ }
+
};
@@ -1254,10 +1715,23 @@ public:
class Temporal_with_date: public Temporal
{
+public:
+ class Options: public Temporal::Options
+ {
+ public:
+ Options(date_conv_mode_t fuzzydate, time_round_mode_t mode):
+ Temporal::Options(fuzzydate, mode)
+ {}
+ explicit Options(const Temporal::Options &opt)
+ :Temporal::Options(opt)
+ { }
+ explicit Options(date_mode_t mode)
+ :Temporal::Options(mode)
+ { }
+ };
protected:
- void check_date_or_invalidate(int *warn, date_mode_t flags);
+ void check_date_or_invalidate(int *warn, date_conv_mode_t flags);
void make_from_item(THD *thd, Item *item, date_mode_t flags);
- void make_from_item(THD *thd, Item *item);
ulong daynr() const
{
@@ -1282,39 +1756,35 @@ protected:
uint week= calc_week(this, week_behaviour, &year);
return week + year * 100;
}
-
+public:
Temporal_with_date()
{
time_type= MYSQL_TIMESTAMP_NONE;
}
- Temporal_with_date(THD *thd, Item *item, date_mode_t flags)
+ Temporal_with_date(THD *thd, Item *item, date_mode_t fuzzydate)
{
- make_from_item(thd, item, flags);
- }
- Temporal_with_date(THD *thd, Item *item)
- {
- make_from_item(thd, item);
+ make_from_item(thd, item, fuzzydate);
}
Temporal_with_date(int *warn, const Sec6 &nr, date_mode_t flags)
{
DBUG_ASSERT(bool(flags & TIME_TIME_ONLY) == false);
- if (nr.to_datetime(this, flags, warn))
+ if (nr.to_datetime_or_date(this, warn, date_conv_mode_t(flags)))
time_type= MYSQL_TIMESTAMP_NONE;
}
- Temporal_with_date(MYSQL_TIME_STATUS *status,
+ Temporal_with_date(THD *thd, MYSQL_TIME_STATUS *status,
const char *str, size_t len, CHARSET_INFO *cs,
date_mode_t flags)
{
DBUG_ASSERT(bool(flags & TIME_TIME_ONLY) == false);
- if (str_to_datetime(status, str, len, cs, flags))
+ if (str_to_datetime_or_date(thd, status, str, len, cs, flags))
time_type= MYSQL_TIMESTAMP_NONE;
}
public:
- bool check_date_with_warn(THD *thd, date_mode_t flags)
+ bool check_date_with_warn(THD *thd, date_conv_mode_t flags)
{
return ::check_date_with_warn(thd, this, flags, MYSQL_TIMESTAMP_ERROR);
}
- static date_mode_t comparison_flags_for_get_date()
+ static date_conv_mode_t comparison_flags_for_get_date()
{ return TIME_INVALID_DATES | TIME_FUZZY_DATES; }
};
@@ -1340,22 +1810,41 @@ class Date: public Temporal_with_date
return !check_datetime_range(this);
}
public:
- Date(THD *thd, Item *item, date_mode_t flags)
- :Temporal_with_date(thd, item, flags)
+ class Options: public Temporal_with_date::Options
{
- if (time_type == MYSQL_TIMESTAMP_DATETIME)
- datetime_to_date(this);
- DBUG_ASSERT(is_valid_value_slow());
- }
- Date(THD *thd, Item *item)
- :Temporal_with_date(thd, item)
+ public:
+ explicit Options(date_conv_mode_t fuzzydate)
+ :Temporal_with_date::Options(fuzzydate, TIME_FRAC_TRUNCATE)
+ { }
+ Options(THD *thd, time_round_mode_t mode)
+ :Temporal_with_date::Options(sql_mode_for_dates(thd), mode)
+ { }
+ explicit Options(THD *thd)
+ :Temporal_with_date::Options(sql_mode_for_dates(thd), TIME_FRAC_TRUNCATE)
+ { }
+ explicit Options(date_mode_t fuzzydate)
+ :Temporal_with_date::Options(fuzzydate)
+ { }
+ };
+public:
+ Date(Item *item, date_mode_t fuzzydate)
+ :Date(current_thd, item, fuzzydate)
+ { }
+ Date(THD *thd, Item *item, date_mode_t fuzzydate)
+ :Temporal_with_date(thd, item, fuzzydate)
{
if (time_type == MYSQL_TIMESTAMP_DATETIME)
datetime_to_date(this);
DBUG_ASSERT(is_valid_value_slow());
}
+ Date(THD *thd, Item *item, date_conv_mode_t fuzzydate)
+ :Date(thd, item, Options(fuzzydate))
+ { }
+ Date(THD *thd, Item *item)
+ :Temporal_with_date(Date(thd, item, Options(thd, TIME_FRAC_TRUNCATE)))
+ { }
Date(Item *item)
- :Date(current_thd, item)
+ :Temporal_with_date(Date(current_thd, item))
{ }
Date(const Temporal_with_date *d)
:Temporal_with_date(*d)
@@ -1455,73 +1944,146 @@ class Datetime: public Temporal_with_date
DBUG_ASSERT(time_type == MYSQL_TIMESTAMP_DATETIME);
return !check_datetime_range(this);
}
+ bool add_nanoseconds_or_invalidate(THD *thd, int *warn, ulong nsec)
+ {
+ DBUG_ASSERT(is_valid_datetime_slow());
+ bool rc= Temporal::datetime_add_nanoseconds_or_invalidate(thd, warn, nsec);
+ DBUG_ASSERT(is_valid_value_slow());
+ return rc;
+ }
void date_to_datetime_if_needed()
{
if (time_type == MYSQL_TIMESTAMP_DATE)
date_to_datetime(this);
}
void make_from_time(THD *thd, int *warn, const MYSQL_TIME *from,
- date_mode_t flags);
+ date_conv_mode_t flags);
void make_from_datetime(THD *thd, int *warn, const MYSQL_TIME *from,
- date_mode_t flags);
-public:
- Datetime(THD *thd, Item *item, date_mode_t flags)
- :Temporal_with_date(thd, item, flags)
+ date_conv_mode_t flags);
+ bool round_or_invalidate(THD *thd, uint dec, int *warn);
+ bool round_or_invalidate(THD *thd, uint dec, int *warn, ulong nsec)
{
- date_to_datetime_if_needed();
+ DBUG_ASSERT(is_valid_datetime_slow());
+ bool rc= Temporal::datetime_round_or_invalidate(thd, dec, warn, nsec);
DBUG_ASSERT(is_valid_value_slow());
+ return rc;
}
- Datetime(THD *thd, Item *item)
- :Temporal_with_date(thd, item)
+public:
+
+ class Options: public Temporal_with_date::Options
+ {
+ public:
+ Options(date_conv_mode_t fuzzydate, time_round_mode_t nanosecond_rounding)
+ :Temporal_with_date::Options(fuzzydate, nanosecond_rounding)
+ { }
+ Options(THD *thd)
+ :Temporal_with_date::Options(sql_mode_for_dates(thd), default_round_mode(thd))
+ { }
+ Options(THD *thd, time_round_mode_t rounding_mode)
+ :Temporal_with_date::Options(sql_mode_for_dates(thd), rounding_mode)
+ { }
+ Options(date_conv_mode_t fuzzydate, THD *thd)
+ :Temporal_with_date::Options(fuzzydate, default_round_mode(thd))
+ { }
+ };
+
+ class Options_cmp: public Options
+ {
+ public:
+ Options_cmp(THD *thd)
+ :Options(comparison_flags_for_get_date(), thd)
+ { }
+ };
+
+ static Datetime zero()
+ {
+ int warn;
+ static Longlong_hybrid nr(0, false);
+ return Datetime(&warn, nr, date_mode_t(0));
+ }
+public:
+ Datetime() // NULL value
+ :Temporal_with_date()
+ { }
+ Datetime(THD *thd, Item *item, date_mode_t fuzzydate)
+ :Temporal_with_date(thd, item, fuzzydate)
{
date_to_datetime_if_needed();
DBUG_ASSERT(is_valid_value_slow());
}
+ Datetime(THD *thd, Item *item)
+ :Temporal_with_date(Datetime(thd, item, Options(thd)))
+ { }
Datetime(Item *item)
:Datetime(current_thd, item)
{ }
- Datetime(THD *thd, int *warn, const MYSQL_TIME *from, date_mode_t flags);
- Datetime()
- {
- set_zero_time(this, MYSQL_TIMESTAMP_DATETIME);
- }
- Datetime(MYSQL_TIME_STATUS *status,
+
+ Datetime(THD *thd, int *warn, const MYSQL_TIME *from, date_conv_mode_t flags);
+ Datetime(THD *thd, MYSQL_TIME_STATUS *status,
const char *str, size_t len, CHARSET_INFO *cs,
- date_mode_t flags)
- :Temporal_with_date(status, str, len, cs, flags)
+ const date_mode_t fuzzydate)
+ :Temporal_with_date(thd, status, str, len, cs, fuzzydate)
{
date_to_datetime_if_needed();
DBUG_ASSERT(is_valid_value_slow());
}
+
+protected:
Datetime(int *warn, const Sec6 &nr, date_mode_t flags)
:Temporal_with_date(warn, nr, flags)
{
date_to_datetime_if_needed();
DBUG_ASSERT(is_valid_value_slow());
}
+ Datetime(THD *thd, int *warn, const Sec9 &nr, date_mode_t fuzzydate)
+ :Datetime(warn, static_cast<const Sec6>(nr), fuzzydate)
+ {
+ if (is_valid_datetime() &&
+ time_round_mode_t(fuzzydate) == TIME_FRAC_ROUND)
+ round_or_invalidate(thd, 6, warn, nr.nsec());
+ DBUG_ASSERT(is_valid_value_slow());
+ }
+
+public:
+ Datetime(int *warn, const Longlong_hybrid &nr, date_mode_t mode)
+ :Datetime(warn, Sec6(nr), mode)
+ { }
+ Datetime(THD *thd, int *warn, double nr, date_mode_t fuzzydate)
+ :Datetime(thd, warn, Sec9(nr), fuzzydate)
+ { }
+ Datetime(THD *thd, int *warn, const my_decimal *d, date_mode_t fuzzydate)
+ :Datetime(thd, warn, Sec9(d), fuzzydate)
+ { }
+ Datetime(THD *thd, const timeval &tv);
- Datetime(THD *thd, Item *item, date_mode_t flags, uint dec)
- :Datetime(thd, item, flags)
+ Datetime(THD *thd, Item *item, date_mode_t fuzzydate, uint dec)
+ :Datetime(thd, item, fuzzydate)
{
- trunc(dec);
+ int warn= 0;
+ round(thd, dec, time_round_mode_t(fuzzydate), &warn);
}
- Datetime(MYSQL_TIME_STATUS *status,
+ Datetime(THD *thd, MYSQL_TIME_STATUS *status,
const char *str, size_t len, CHARSET_INFO *cs,
date_mode_t fuzzydate, uint dec)
- :Datetime(status, str, len, cs, fuzzydate)
+ :Datetime(thd, status, str, len, cs, fuzzydate)
{
- trunc(dec);
+ round(thd, dec, time_round_mode_t(fuzzydate), &status->warnings);
}
- Datetime(int *warn, const Sec6 &nr, date_mode_t fuzzydate, uint dec)
- :Datetime(warn, nr, fuzzydate)
+ Datetime(THD *thd, int *warn, double nr, date_mode_t fuzzydate, uint dec)
+ :Datetime(thd, warn, nr, fuzzydate)
{
- trunc(dec);
+ round(thd, dec, time_round_mode_t(fuzzydate), warn);
+ }
+ Datetime(THD *thd, int *warn, const my_decimal *d, date_mode_t fuzzydate, uint dec)
+ :Datetime(thd, warn, d, fuzzydate)
+ {
+ round(thd, dec, time_round_mode_t(fuzzydate), warn);
}
Datetime(THD *thd, int *warn, const MYSQL_TIME *from,
date_mode_t fuzzydate, uint dec)
- :Datetime(thd, warn, from, fuzzydate)
+ :Datetime(thd, warn, from, date_conv_mode_t(fuzzydate) & ~TIME_TIME_ONLY)
{
- trunc(dec);
+ round(thd, dec, time_round_mode_t(fuzzydate), warn);
}
bool is_valid_datetime() const
@@ -1533,14 +2095,14 @@ public:
DBUG_ASSERT(is_valid_value_slow());
return time_type == MYSQL_TIMESTAMP_DATETIME;
}
- bool check_date(date_mode_t flags, int *warnings) const
+ bool check_date(date_conv_mode_t flags, int *warnings) const
{
DBUG_ASSERT(is_valid_datetime_slow());
return ::check_date(this, (year || month || day),
ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE),
warnings);
}
- bool check_date(date_mode_t flags) const
+ bool check_date(date_conv_mode_t flags) const
{
int dummy; /* unused */
return check_date(flags, &dummy);
@@ -1555,6 +2117,27 @@ public:
DBUG_ASSERT(is_valid_datetime_slow());
return Temporal_with_date::daynr();
}
+ ulong dayofyear() const
+ {
+ DBUG_ASSERT(is_valid_datetime_slow());
+ return Temporal_with_date::dayofyear();
+ }
+ uint quarter() const
+ {
+ DBUG_ASSERT(is_valid_datetime_slow());
+ return Temporal_with_date::quarter();
+ }
+ uint week(uint week_behaviour) const
+ {
+ DBUG_ASSERT(is_valid_datetime_slow());
+ return Temporal_with_date::week(week_behaviour);
+ }
+ uint yearweek(uint week_behaviour) const
+ {
+ DBUG_ASSERT(is_valid_datetime_slow());
+ return Temporal_with_date::yearweek(week_behaviour);
+ }
+
longlong hhmmss_to_seconds_abs() const
{
DBUG_ASSERT(is_valid_datetime_slow());
@@ -1627,6 +2210,12 @@ public:
{
return is_valid_datetime() ? Temporal::to_packed() : 0;
}
+ long fraction_remainder(uint dec) const
+ {
+ DBUG_ASSERT(is_valid_datetime());
+ return Temporal::fraction_remainder(dec);
+ }
+
Datetime &trunc(uint dec)
{
if (is_valid_datetime())
@@ -1634,6 +2223,255 @@ public:
DBUG_ASSERT(is_valid_value_slow());
return *this;
}
+ Datetime &round(THD *thd, uint dec, int *warn)
+ {
+ if (is_valid_datetime())
+ round_or_invalidate(thd, dec, warn);
+ DBUG_ASSERT(is_valid_value_slow());
+ return *this;
+ }
+ Datetime &round(THD *thd, uint dec, time_round_mode_t mode, int *warn)
+ {
+ switch (mode.mode()) {
+ case time_round_mode_t::FRAC_NONE:
+ DBUG_ASSERT(fraction_remainder(dec) == 0);
+ return trunc(dec);
+ case time_round_mode_t::FRAC_TRUNCATE:
+ return trunc(dec);
+ case time_round_mode_t::FRAC_ROUND:
+ return round(thd, dec, warn);
+ }
+ return *this;
+ }
+ Datetime &round(THD *thd, uint dec, time_round_mode_t mode)
+ {
+ int warn= 0;
+ return round(thd, dec, mode, &warn);
+ }
+
+};
+
+
+/*
+ Datetime to be created from an Item who is known to be of a temporal
+ data type. For temporal data types we don't need nanosecond rounding
+ or truncation, as their precision is limited.
+*/
+class Datetime_from_temporal: public Datetime
+{
+public:
+ // The constructor DBUG_ASSERTs on a proper Item data type.
+ Datetime_from_temporal(THD *thd, Item *temporal, date_conv_mode_t flags);
+};
+
+
+/*
+ Datetime to be created from an Item who is known not to have digits outside
+ of the specified scale. So it's not important which rounding method to use.
+ TRUNCATE should work.
+ Typically, Item is of a temporal data type, but this is not strictly required.
+*/
+class Datetime_truncation_not_needed: public Datetime
+{
+public:
+ Datetime_truncation_not_needed(THD *thd, Item *item, date_conv_mode_t mode);
+ Datetime_truncation_not_needed(THD *thd, Item *item, date_mode_t mode)
+ :Datetime_truncation_not_needed(thd, item, date_conv_mode_t(mode))
+ { }
+};
+
+
+class Timestamp: protected Timeval
+{
+ static uint binary_length_to_precision(uint length);
+protected:
+ void round_or_set_max(uint dec, int *warn);
+ bool add_nanoseconds_usec(uint nanoseconds)
+ {
+ DBUG_ASSERT(nanoseconds <= 1000000000);
+ if (nanoseconds < 500)
+ return false;
+ tv_usec+= (nanoseconds + 500) / 1000;
+ if (tv_usec < 1000000)
+ return false;
+ tv_usec%= 1000000;
+ return true;
+ }
+public:
+ static date_conv_mode_t sql_mode_for_timestamp(THD *thd);
+ static time_round_mode_t default_round_mode(THD *thd);
+ class DatetimeOptions: public date_mode_t
+ {
+ public:
+ DatetimeOptions(date_conv_mode_t fuzzydate, time_round_mode_t round_mode)
+ :date_mode_t(fuzzydate | round_mode)
+ { }
+ DatetimeOptions(THD *thd)
+ :DatetimeOptions(sql_mode_for_timestamp(thd), default_round_mode(thd))
+ { }
+ };
+public:
+ Timestamp(my_time_t timestamp, ulong sec_part)
+ :Timeval(timestamp, sec_part)
+ { }
+ explicit Timestamp(const timeval &tv)
+ :Timeval(tv)
+ { }
+ explicit Timestamp(const Native &native);
+ Timestamp(THD *thd, const MYSQL_TIME *ltime, uint *error_code);
+ const struct timeval &tv() const { return *this; }
+ int cmp(const Timestamp &other) const
+ {
+ return tv_sec < other.tv_sec ? -1 :
+ tv_sec > other.tv_sec ? +1 :
+ tv_usec < other.tv_usec ? -1 :
+ tv_usec > other.tv_usec ? +1 : 0;
+ }
+ bool to_TIME(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
+ bool to_native(Native *to, uint decimals) const;
+ long fraction_remainder(uint dec) const
+ {
+ return my_time_fraction_remainder(tv_usec, dec);
+ }
+ Timestamp &trunc(uint dec)
+ {
+ my_timeval_trunc(this, dec);
+ return *this;
+ }
+ Timestamp &round(uint dec, int *warn)
+ {
+ round_or_set_max(dec, warn);
+ return *this;
+ }
+ Timestamp &round(uint dec, time_round_mode_t mode, int *warn)
+ {
+ switch (mode.mode()) {
+ case time_round_mode_t::FRAC_NONE:
+ DBUG_ASSERT(fraction_remainder(dec) == 0);
+ return trunc(dec);
+ case time_round_mode_t::FRAC_TRUNCATE:
+ return trunc(dec);
+ case time_round_mode_t::FRAC_ROUND:
+ return round(dec, warn);
+ }
+ return *this;
+ }
+ Timestamp &round(uint dec, time_round_mode_t mode)
+ {
+ int warn= 0;
+ return round(dec, mode, &warn);
+ }
+};
+
+
+/**
+ A helper class to store MariaDB TIMESTAMP values, which can be:
+ - real TIMESTAMP (seconds and microseconds since epoch), or
+ - zero datetime '0000-00-00 00:00:00.000000'
+*/
+class Timestamp_or_zero_datetime: public Timestamp
+{
+ bool m_is_zero_datetime;
+public:
+ Timestamp_or_zero_datetime()
+ :Timestamp(0,0), m_is_zero_datetime(true)
+ { }
+ Timestamp_or_zero_datetime(const Native &native)
+ :Timestamp(native.length() ? Timestamp(native) : Timestamp(0,0)),
+ m_is_zero_datetime(native.length() == 0)
+ { }
+ Timestamp_or_zero_datetime(const Timestamp &tm, bool is_zero_datetime)
+ :Timestamp(tm), m_is_zero_datetime(is_zero_datetime)
+ { }
+ Timestamp_or_zero_datetime(THD *thd, const MYSQL_TIME *ltime, uint *err_code);
+ Datetime to_datetime(THD *thd) const
+ {
+ return Datetime(thd, *this);
+ }
+ bool is_zero_datetime() const { return m_is_zero_datetime; }
+ const struct timeval &tv() const
+ {
+ DBUG_ASSERT(!is_zero_datetime());
+ return Timestamp::tv();
+ }
+ void trunc(uint decimals)
+ {
+ if (!is_zero_datetime())
+ Timestamp::trunc(decimals);
+ }
+ int cmp(const Timestamp_or_zero_datetime &other) const
+ {
+ if (is_zero_datetime())
+ return other.is_zero_datetime() ? 0 : -1;
+ if (other.is_zero_datetime())
+ return 1;
+ return Timestamp::cmp(other);
+ }
+ bool to_TIME(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) const;
+ /*
+ Convert to native format:
+ - Real timestamps are encoded in the same way how Field_timestamp2 stores
+ values (big endian seconds followed by big endian microseconds)
+ - Zero datetime '0000-00-00 00:00:00.000000' is encoded as empty string.
+ Two native values are binary comparable.
+ */
+ bool to_native(Native *to, uint decimals) const;
+};
+
+
+/**
+ A helper class to store non-null MariaDB TIMESTAMP values in
+ the native binary encoded representation.
+*/
+class Timestamp_or_zero_datetime_native:
+ public NativeBuffer<STRING_BUFFER_TIMESTAMP_BINARY_SIZE>
+{
+public:
+ Timestamp_or_zero_datetime_native() { }
+ Timestamp_or_zero_datetime_native(const Timestamp_or_zero_datetime &ts,
+ uint decimals)
+ {
+ if (ts.to_native(this, decimals))
+ length(0); // safety
+ }
+ int save_in_field(Field *field, uint decimals) const;
+ bool is_zero_datetime() const
+ {
+ return length() == 0;
+ }
+};
+
+
+/**
+ A helper class to store nullable MariaDB TIMESTAMP values in
+ the native binary encoded representation.
+*/
+class Timestamp_or_zero_datetime_native_null: public Timestamp_or_zero_datetime_native,
+ public Null_flag
+{
+public:
+ // With optional data type conversion
+ Timestamp_or_zero_datetime_native_null(THD *thd, Item *item, bool conv);
+ // Without data type conversion: item is known to be of the TIMESTAMP type
+ Timestamp_or_zero_datetime_native_null(THD *thd, Item *item)
+ :Timestamp_or_zero_datetime_native_null(thd, item, false)
+ { }
+ Datetime to_datetime(THD *thd) const
+ {
+ return is_null() ? Datetime() :
+ Datetime(thd, Timestamp_or_zero_datetime(*this).tv());
+ }
+ void to_TIME(THD *thd, MYSQL_TIME *to)
+ {
+ DBUG_ASSERT(!is_null());
+ Datetime::Options opt(TIME_CONV_NONE, TIME_FRAC_NONE);
+ Timestamp_or_zero_datetime(*this).to_TIME(thd, to, opt);
+ }
+ bool is_zero_datetime() const
+ {
+ DBUG_ASSERT(!is_null());
+ return Timestamp_or_zero_datetime_native::is_zero_datetime();
+ }
};
@@ -2269,6 +3107,7 @@ protected:
bool Item_send_double(Item *item, Protocol *protocol, st_value *buf) const;
bool Item_send_time(Item *item, Protocol *protocol, st_value *buf) const;
bool Item_send_date(Item *item, Protocol *protocol, st_value *buf) const;
+ bool Item_send_timestamp(Item *item, Protocol *protocol, st_value *buf) const;
bool Item_send_datetime(Item *item, Protocol *protocol, st_value *buf) const;
bool Column_definition_prepare_stage2_legacy(Column_definition *c,
enum_field_types type)
@@ -2390,6 +3229,10 @@ public:
*/
virtual bool is_param_long_data_type() const { return false; }
virtual const Type_handler *type_handler_for_comparison() const= 0;
+ virtual const Type_handler *type_handler_for_native_format() const
+ {
+ return this;
+ }
virtual const Type_handler *type_handler_for_item_field() const
{
return this;
@@ -2572,6 +3415,9 @@ public:
Item_param *param,
const Type_all_attributes *attr,
const st_value *value) const= 0;
+ virtual bool Item_param_val_native(THD *thd,
+ Item_param *item,
+ Native *to) const;
virtual bool Item_send(Item *item, Protocol *p, st_value *buf) const= 0;
virtual int Item_save_in_field(Item *item, Field *field,
bool no_conversions) const= 0;
@@ -2674,6 +3520,12 @@ public:
DBUG_ASSERT(0);
return NULL;
}
+ virtual Item_copy *create_item_copy(THD *thd, Item *item) const;
+ virtual int cmp_native(const Native &a, const Native &b) const
+ {
+ DBUG_ASSERT(0);
+ return 0;
+ }
virtual bool set_comparator_func(Arg_comparator *cmp) const= 0;
virtual bool Item_const_eq(const Item_const *a, const Item_const *b,
bool binary_cmp) const
@@ -2698,6 +3550,17 @@ public:
virtual
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const= 0;
+ virtual bool Item_val_native_with_conversion(THD *thd, Item *item,
+ Native *to) const
+ {
+ return true;
+ }
+ virtual bool Item_val_native_with_conversion_result(THD *thd, Item *item,
+ Native *to) const
+ {
+ return true;
+ }
+
virtual bool Item_val_bool(Item *item) const= 0;
virtual void Item_get_date(THD *thd, Item *item,
Temporal::Warn *buff, MYSQL_TIME *ltime,
@@ -2959,6 +3822,11 @@ public:
}
Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
+ Item_copy *create_item_copy(THD *thd, Item *item) const
+ {
+ DBUG_ASSERT(0);
+ return NULL;
+ }
bool set_comparator_func(Arg_comparator *cmp) const;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
@@ -4551,10 +5419,13 @@ public:
class Type_handler_timestamp_common: public Type_handler_temporal_with_date
{
static const Name m_name_timestamp;
+protected:
+ bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const;
public:
virtual ~Type_handler_timestamp_common() {}
const Name name() const { return m_name_timestamp; }
const Type_handler *type_handler_for_comparison() const;
+ const Type_handler *type_handler_for_native_format() const;
enum_field_types field_type() const { return MYSQL_TYPE_TIMESTAMP; }
enum_mysql_timestamp_type mysql_timestamp_type() const
{
@@ -4565,6 +5436,20 @@ public:
return true;
}
void Column_definition_implicit_upgrade(Column_definition *c) const;
+ bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
+ Item *a, Item *b) const;
+ bool Item_val_native_with_conversion(THD *thd, Item *, Native *to) const;
+ bool Item_val_native_with_conversion_result(THD *thd, Item *, Native *to) const;
+ bool Item_param_val_native(THD *thd, Item_param *item, Native *to) const;
+ int cmp_native(const Native &a, const Native &b) const;
+ longlong Item_func_between_val_int(Item_func_between *func) const;
+ cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
+ in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const;
+ void make_sort_key(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field,
+ Sort_param *param) const;
+ void sortlength(THD *thd,
+ const Type_std_attributes *item,
+ SORT_FIELD_ATTR *attr) const;
bool Column_definition_fix_attributes(Column_definition *c) const;
uint Item_decimal_scale(const Item *item) const
{
@@ -4577,15 +5462,18 @@ public:
}
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
{
- return Item_send_datetime(item, protocol, buf);
+ return Item_send_timestamp(item, protocol, buf);
}
+ int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
String *print_item_value(THD *thd, Item *item, String *str) const;
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
+ Item_copy *create_item_copy(THD *thd, Item *item) const;
String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
double Item_func_min_max_val_real(Item_func_min_max *) const;
longlong Item_func_min_max_val_int(Item_func_min_max *) const;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
my_decimal *) const;
+ bool set_comparator_func(Arg_comparator *cmp) const;
bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name,
Type_handler_hybrid_field_type *,
@@ -4593,6 +5481,8 @@ public:
Item **items, uint nitems) const;
void Item_param_set_param_func(Item_param *param,
uchar **pos, ulong len) const;
+ bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
+ MYSQL_TIME *, date_mode_t fuzzydate) const;
};
@@ -5210,6 +6100,16 @@ public:
};
+// A pseudo type handler, mostly for test purposes for now
+class Type_handler_interval_DDhhmmssff: public Type_handler_long_blob
+{
+public:
+ Item *create_typecast_item(THD *thd, Item *item,
+ const Type_cast_attributes &attr) const;
+};
+
+
+
/**
A handler for hybrid type functions, e.g.
COALESCE(), IF(), IFNULL(), NULLIF(), CASE,
@@ -5342,6 +6242,9 @@ extern MYSQL_PLUGIN_IMPORT Type_handler_blob type_handler_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_medium_blob type_handler_medium_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_long_blob type_handler_long_blob;
+extern MYSQL_PLUGIN_IMPORT Type_handler_interval_DDhhmmssff
+ type_handler_interval_DDhhmmssff;
+
class Type_aggregator
{
bool m_is_commutative;
diff --git a/sql/sql_type_int.h b/sql/sql_type_int.h
index 1cc93415176..c7fcd3f793b 100644
--- a/sql/sql_type_int.h
+++ b/sql/sql_type_int.h
@@ -51,11 +51,24 @@ class Longlong_hybrid: public Longlong
{
protected:
bool m_unsigned;
+ int cmp_signed(const Longlong_hybrid& other) const
+ {
+ return m_value < other.m_value ? -1 : m_value == other.m_value ? 0 : 1;
+ }
+ int cmp_unsigned(const Longlong_hybrid& other) const
+ {
+ return (ulonglong) m_value < (ulonglong) other.m_value ? -1 :
+ m_value == other.m_value ? 0 : 1;
+ }
public:
Longlong_hybrid(longlong nr, bool unsigned_flag)
:Longlong(nr), m_unsigned(unsigned_flag)
{ }
bool is_unsigned() const { return m_unsigned; }
+ bool is_unsigned_outside_of_signed_range() const
+ {
+ return m_unsigned && ((ulonglong) m_value) > (ulonglong) LONGLONG_MAX;
+ }
bool neg() const { return m_value < 0 && !m_unsigned; }
ulonglong abs() const
{
@@ -65,6 +78,37 @@ public:
return ((ulonglong) LONGLONG_MAX) + 1;
return m_value < 0 ? -m_value : m_value;
}
+ /*
+ Convert to an unsigned number:
+ - Negative numbers are converted to 0.
+ - Positive numbers bigger than upper_bound are converted to upper_bound.
+ - Other numbers are returned as is.
+ */
+ ulonglong to_ulonglong(ulonglong upper_bound) const
+ {
+ return neg() ? 0 :
+ (ulonglong) m_value > upper_bound ? upper_bound :
+ (ulonglong) m_value;
+ }
+ uint to_uint(uint upper_bound) const
+ {
+ return (uint) to_ulonglong(upper_bound);
+ }
+ int cmp(const Longlong_hybrid& other) const
+ {
+ if (m_unsigned == other.m_unsigned)
+ return m_unsigned ? cmp_unsigned(other) : cmp_signed(other);
+ if (is_unsigned_outside_of_signed_range())
+ return 1;
+ if (other.is_unsigned_outside_of_signed_range())
+ return -1;
+ /*
+ The unsigned argument is in the range 0..LONGLONG_MAX.
+ The signed argument is in the range LONGLONG_MIN..LONGLONG_MAX.
+ Safe to compare as signed.
+ */
+ return cmp_signed(other);
+ }
};
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 9a036156de6..aee4869bd40 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -76,6 +76,8 @@ static const char *init_syms(udf_func *tmp, char *nm)
(void)strmov(end, "_add");
if (!((tmp->func_add= (Udf_func_add) dlsym(tmp->dlhandle, nm))))
return nm;
+ (void)strmov(end, "_remove");
+ tmp->func_remove= (Udf_func_add) dlsym(tmp->dlhandle, nm);
}
(void) strmov(end,"_deinit");
@@ -565,6 +567,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
u_d->func_deinit= udf->func_deinit;
u_d->func_clear= udf->func_clear;
u_d->func_add= udf->func_add;
+ u_d->func_remove= udf->func_remove;
/* create entry in mysql.func table */
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index 6e6fed2a81a..4fa75759269 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -47,6 +47,7 @@ typedef struct st_udf_func
Udf_func_deinit func_deinit;
Udf_func_clear func_clear;
Udf_func_add func_add;
+ Udf_func_add func_remove;
ulong usage_count;
} udf_func;
@@ -131,6 +132,20 @@ class udf_handler :public Sql_alloc
func(&initid, &f_args, &is_null, &error);
*null_value= (my_bool) (is_null || error);
}
+ bool supports_removal() const
+ { return MY_TEST(u_d->func_remove); }
+ void remove(my_bool *null_value)
+ {
+ DBUG_ASSERT(u_d->func_remove);
+ if (get_arguments())
+ {
+ *null_value=1;
+ return;
+ }
+ Udf_func_add func= u_d->func_remove;
+ func(&initid, &f_args, &is_null, &error);
+ *null_value= (my_bool) (is_null || error);
+ }
String *val_str(String *str,String *save_str);
};
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 1910ad0f83e..ca8a5e7a8b3 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -1046,8 +1046,11 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
0))
goto err;
if (!derived_arg->table)
- derived_arg->table= derived_arg->derived_result->table=
- with_element->rec_result->rec_tables.head();
+ {
+ derived_arg->table= with_element->rec_result->rec_tables.head();
+ if (derived_arg->derived_result)
+ derived_arg->derived_result->table= derived_arg->table;
+ }
with_element->mark_as_with_prepared_anchor();
is_rec_result_table_created= true;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 63240c1547d..d74da408dfc 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -2580,7 +2580,7 @@ int multi_update::do_updates()
check_opt_it.rewind();
while(TABLE *tbl= check_opt_it++)
{
- if (unlikely((local_error= tbl->file->ha_rnd_init(1))))
+ if (unlikely((local_error= tbl->file->ha_rnd_init(0))))
{
err_table= tbl;
goto err;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 9a19a5b9c8c..8f62dca4aec 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -553,8 +553,6 @@ bool sp_create_assignment_instr(THD *thd, bool no_lookahead)
if (lex->sphead)
{
- sp_head *sp= lex->sphead;
-
if (!lex->var_list.is_empty())
{
/*
@@ -562,33 +560,17 @@ bool sp_create_assignment_instr(THD *thd, bool no_lookahead)
option setting, so we should construct sp_instr_stmt
for it.
*/
- LEX_STRING qbuff;
- sp_instr_stmt *i;
Lex_input_stream *lip= &thd->m_parser_state->m_lip;
- if (!(i= new (thd->mem_root)
- sp_instr_stmt(sp->instructions(), lex->spcont, lex)))
- return true;
-
/*
Extract the query statement from the tokenizer. The
end is either lip->ptr, if there was no lookahead,
lip->tok_end otherwise.
*/
- if (no_lookahead)
- qbuff.length= lip->get_ptr() - sp->m_tmp_query;
- else
- qbuff.length= lip->get_tok_end() - sp->m_tmp_query;
-
- if (!(qbuff.str= (char*) alloc_root(thd->mem_root,
- qbuff.length + 5)))
- return true;
-
- strmake(strmake(qbuff.str, "SET ", 4), sp->m_tmp_query,
- qbuff.length);
- qbuff.length+= 4;
- i->m_query= qbuff;
- if (sp->add_instr(i))
+ static const LEX_CSTRING setsp= { STRING_WITH_LEN("SET ") };
+ const char *qend= no_lookahead ? lip->get_ptr() : lip->get_tok_end();
+ Lex_cstring qbuf(lex->sphead->m_tmp_query, qend);
+ if (lex->new_sp_instr_stmt(thd, setsp, qbuf))
return true;
}
lex->pop_select();
@@ -705,11 +687,6 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
Lex_for_loop_st for_loop;
Lex_for_loop_bounds_st for_loop_bounds;
Lex_trim_st trim;
- struct
- {
- LEX_CSTRING name;
- uint offset;
- } sp_cursor_name_and_offset;
vers_history_point_t vers_history_point;
struct
{
@@ -807,6 +784,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
DDL_options_st object_ddl_options;
enum vers_sys_type_t vers_range_unit;
enum Column_definition::enum_column_versioning vers_column_versioning;
+ enum plsql_cursor_attr_t plsql_cursor_attr;
}
%{
@@ -817,10 +795,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 52 shift/reduce conflicts.
+ Currently there are 48 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 52
+%expect 48
/*
Comments for TOKENS.
@@ -864,7 +842,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token BIT_AND /* MYSQL-FUNC */
%token BIT_OR /* MYSQL-FUNC */
%token BIT_XOR /* MYSQL-FUNC */
-%token BLOB_SYM /* SQL-2003-R */
+%token BLOB_MARIADB_SYM /* SQL-2003-R */
+%token BLOB_ORACLE_SYM /* Oracle-R */
+%token BODY_ORACLE_SYM /* Oracle-R */
%token BOTH /* SQL-2003-R */
%token BY /* SQL-2003-R */
%token CALL_SYM /* SQL-2003-R */
@@ -877,7 +857,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token COLLATE_SYM /* SQL-2003-R */
%token CONDITION_SYM /* SQL-2003-R, SQL-2008-R */
%token CONSTRAINT /* SQL-2003-R */
-%token CONTINUE_SYM /* SQL-2003-R */
+%token CONTINUE_MARIADB_SYM /* SQL-2003-R, Oracle-R */
+%token CONTINUE_ORACLE_SYM /* SQL-2003-R, Oracle-R */
%token CONVERT_SYM /* SQL-2003-N */
%token COUNT_SYM /* SQL-2003-N */
%token CREATE /* SQL-2003-R */
@@ -898,7 +879,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DAY_SECOND_SYM
%token DECIMAL_NUM
%token DECIMAL_SYM /* SQL-2003-R */
-%token DECLARE_SYM /* SQL-2003-R */
+%token DECLARE_MARIADB_SYM /* SQL-2003-R */
+%token DECLARE_ORACLE_SYM /* Oracle-R */
%token DEFAULT /* SQL-2003-R */
%token DELETE_DOMAIN_ID_SYM
%token DELETE_SYM /* SQL-2003-R */
@@ -915,7 +897,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DUAL_SYM
%token EACH_SYM /* SQL-2003-R */
%token ELSE /* SQL-2003-R */
-%token ELSEIF_SYM
+%token ELSEIF_MARIADB_SYM
+%token ELSIF_ORACLE_SYM /* PLSQL-R */
%token ENCLOSED
%token END_OF_INPUT /* INTERNAL */
%token EQUAL_SYM /* OPERATOR */
@@ -934,6 +917,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token FROM
%token FULLTEXT_SYM
%token GE
+%token GOTO_ORACLE_SYM /* Oracle-R */
%token GRANT /* SQL-2003-R */
%token GROUP_SYM /* SQL-2003-R */
%token GROUP_CONCAT_SYM
@@ -1022,14 +1006,17 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token OR2_SYM
%token ORDER_SYM /* SQL-2003-R */
%token OR_SYM /* SQL-2003-R */
+%token OTHERS_ORACLE_SYM /* SQL-2011-N, PLSQL-R */
%token OUTER
%token OUTFILE
%token OUT_SYM /* SQL-2003-R */
%token OVER_SYM
+%token PACKAGE_ORACLE_SYM /* Oracle-R */
%token PAGE_CHECKSUM_SYM
%token PARAM_MARKER
%token PARSE_VCOL_EXPR_SYM
%token PARTITION_SYM /* SQL-2003-R */
+%token PERCENT_ORACLE_SYM /* INTERNAL */
%token PERCENT_RANK_SYM
%token PERCENTILE_CONT_SYM
%token PERCENTILE_DISC_SYM
@@ -1038,6 +1025,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token PRIMARY_SYM /* SQL-2003-R */
%token PROCEDURE_SYM /* SQL-2003-R */
%token PURGE
+%token RAISE_ORACLE_SYM /* PLSQL-R */
%token RANGE_SYM /* SQL-2003-R */
%token RANK_SYM
%token READS_SYM /* SQL-2003-R */
@@ -1056,10 +1044,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token RESIGNAL_SYM /* SQL-2003-R */
%token RESTRICT
%token RETURNING_SYM
-%token RETURN_SYM /* SQL-2003-R */
+%token RETURN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
+%token RETURN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
%token REVOKE /* SQL-2003-R */
%token RIGHT /* SQL-2003-R */
%token ROWS_SYM /* SQL-2003-R */
+%token ROWTYPE_ORACLE_SYM /* PLSQL-R */
%token ROW_NUMBER_SYM
%token SECOND_MICROSECOND_SYM
%token SELECT_SYM /* SQL-2003-R */
@@ -1144,13 +1134,15 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
/*
Keywords that have different reserved status in std/oracle modes.
*/
-%token <kwd> BODY_SYM /* Oracle-R */
-%token <kwd> ELSIF_SYM /* Oracle, reserved in PL/SQL*/
-%token <kwd> GOTO_SYM /* Oracle, reserved in PL/SQL*/
-%token <kwd> OTHERS_SYM /* SQL-2011-N */
-%token <kwd> PACKAGE_SYM /* Oracle-R */
-%token <kwd> RAISE_SYM /* Oracle-PLSQL-R */
-%token <kwd> ROWTYPE_SYM /* Oracle-PLSQL-R */
+%token <kwd> BODY_MARIADB_SYM // Oracle-R
+%token <kwd> ELSEIF_ORACLE_SYM
+%token <kwd> ELSIF_MARIADB_SYM // PLSQL-R
+%token <kwd> EXCEPTION_ORACLE_SYM // SQL-2003-N, PLSQL-R
+%token <kwd> GOTO_MARIADB_SYM // Oracle-R
+%token <kwd> OTHERS_MARIADB_SYM // SQL-2011-N, PLSQL-R
+%token <kwd> PACKAGE_MARIADB_SYM // Oracle-R
+%token <kwd> RAISE_MARIADB_SYM // PLSQL-R
+%token <kwd> ROWTYPE_MARIADB_SYM // PLSQL-R
/*
Non-reserved keywords
@@ -1175,7 +1167,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> AVG_ROW_LENGTH
%token <kwd> AVG_SYM /* SQL-2003-N */
%token <kwd> BACKUP_SYM
-%token <kwd> BEGIN_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> BEGIN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> BEGIN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
%token <kwd> BINLOG_SYM
%token <kwd> BIT_SYM /* MYSQL-FUNC */
%token <kwd> BLOCK_SYM
@@ -1194,11 +1187,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> CIPHER_SYM
%token <kwd> CLASS_ORIGIN_SYM /* SQL-2003-N */
%token <kwd> CLIENT_SYM
-%token <kwd> CLOB /* SQL-2003-R */
+%token <kwd> CLOB_MARIADB_SYM /* SQL-2003-R */
+%token <kwd> CLOB_ORACLE_SYM /* Oracle-R */
%token <kwd> CLOSE_SYM /* SQL-2003-R */
%token <kwd> COALESCE /* SQL-2003-N */
%token <kwd> CODE_SYM
%token <kwd> COLLATION_SYM /* SQL-2003-N */
+%token <kwd> COLON_ORACLE_SYM /* INTERNAL */
%token <kwd> COLUMNS
%token <kwd> COLUMN_ADD_SYM
%token <kwd> COLUMN_CHECK_SYM
@@ -1235,7 +1230,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> DATE_SYM /* SQL-2003-R, Oracle-R, PLSQL-R */
%token <kwd> DAY_SYM /* SQL-2003-R */
%token <kwd> DEALLOCATE_SYM /* SQL-2003-R */
-%token <kwd> DECODE_SYM /* Oracle function, non-reserved */
+%token <kwd> DECODE_MARIADB_SYM /* Function, non-reserved */
+%token <kwd> DECODE_ORACLE_SYM /* Function, non-reserved */
%token <kwd> DEFINER_SYM
%token <kwd> DELAYED_SYM
%token <kwd> DELAY_KEY_WRITE_SYM
@@ -1265,8 +1261,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> EXAMINED_SYM
%token <kwd> EXCLUDE_SYM /* SQL-2011-N */
%token <kwd> EXECUTE_SYM /* SQL-2003-R */
-%token <kwd> EXCEPTION_SYM /* SQL-2003-N, Oracle-PLSQL-R */
-%token <kwd> EXIT_SYM
+%token <kwd> EXCEPTION_MARIADB_SYM /* SQL-2003-N, PLSQL-R */
+%token <kwd> EXIT_MARIADB_SYM /* PLSQL-R */
+%token <kwd> EXIT_ORACLE_SYM /* PLSQL-R */
%token <kwd> EXPANSION_SYM
%token <kwd> EXPORT_SYM
%token <kwd> EXTENDED_SYM
@@ -1283,7 +1280,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> FORMAT_SYM
%token <kwd> FOUND_SYM /* SQL-2003-R */
%token <kwd> FULL /* SQL-2003-R */
-%token <kwd> FUNCTION_SYM /* SQL-2003-R */
+%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */
%token <kwd> GENERAL
%token <kwd> GENERATED_SYM
%token <kwd> GEOMETRYCOLLECTION
@@ -1396,7 +1393,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> NOMINVALUE_SYM
%token <kwd> NO_WAIT_SYM
%token <kwd> NOWAIT_SYM
-%token <kwd> NUMBER_SYM /* SQL-2003-N, Oracle-R, PLSQL-R */
+%token <kwd> NUMBER_MARIADB_SYM /* SQL-2003-N */
+%token <kwd> NUMBER_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> NVARCHAR_SYM
%token <kwd> OF_SYM /* SQL-1992-R, Oracle-R */
%token <kwd> OFFSET_SYM
@@ -1438,7 +1436,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> QUARTER_SYM
%token <kwd> QUERY_SYM
%token <kwd> QUICK
-%token <kwd> RAW /* Oracle-R */
+%token <kwd> RAW_MARIADB_SYM
+%token <kwd> RAW_ORACLE_SYM /* Oracle-R */
%token <kwd> READ_ONLY_SYM
%token <kwd> REBUILD_SYM
%token <kwd> RECOVER_SYM
@@ -1504,6 +1503,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> SQL_CALC_FOUND_ROWS
%token <kwd> SQL_NO_CACHE_SYM
%token <kwd> SQL_THREAD
+%token <kwd> STAGE_SYM
%token <kwd> STARTS_SYM
%token <kwd> START_SYM /* SQL-2003-R */
%token <kwd> STATEMENT_SYM
@@ -1557,7 +1557,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> USER_SYM /* SQL-2003-R */
%token <kwd> USE_FRM
%token <kwd> VALUE_SYM /* SQL-2003-R */
-%token <kwd> VARCHAR2 /* Oracle-R, PLSQL-R */
+%token <kwd> VARCHAR2_MARIADB_SYM
+%token <kwd> VARCHAR2_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> VARIABLES
%token <kwd> VERSIONING_SYM /* SQL-2011-R */
%token <kwd> VIA_SYM
@@ -1625,7 +1626,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
SELECT TIMESTAMP '2001-01-01 10:20:30';
SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP CONCAT(@date,' ',@time);
- - PERIOD: identifier, period for sytem time:
+ - PERIOD: identifier, period for system time:
SELECT period FROM t1;
ALTER TABLE DROP PERIOD FOR SYSTEM TIME;
@@ -1637,7 +1638,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
SELECT user FROM t1;
KILL USER foo;
- Note, we need here only tokens that cause shirt/reduce conflicts
+ Note, we need here only tokens that cause shift/reduce conflicts
with keyword identifiers. For example:
opt_clause1: %empty | KEYWORD ... ;
clause2: opt_clause1 ident;
@@ -1721,6 +1722,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident
label_ident
sp_decl_ident
+ ident_set_usual_case
ident_or_empty
ident_table_alias
ident_sysvar_name
@@ -1743,6 +1745,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_data_type
keyword_ident
keyword_label
+ keyword_set_special_case
+ keyword_set_usual_case
keyword_sp_block_section
keyword_sp_decl
keyword_sp_head
@@ -1853,7 +1857,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
geometry_function signed_literal expr_or_literal
opt_escape
sp_opt_default
- simple_ident_nospvar simple_ident_q simple_ident_q2
+ simple_ident_nospvar
field_or_var limit_option
part_func_expr
window_func_expr
@@ -1862,6 +1866,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
inverse_distribution_function
percentile_function
inverse_distribution_function_def
+ explicit_cursor_attr
function_call_keyword
function_call_keyword_timestamp
function_call_nonkeyword
@@ -1870,6 +1875,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
signal_allowed_expr
simple_target_specification
condition_number
+ reset_lex_expr
%type <item_param> param_marker
@@ -1881,6 +1887,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <item_list>
expr_list opt_udf_expr_list udf_expr_list when_list when_list_opt_else
ident_list ident_list_arg opt_expr_list
+ decode_when_list_oracle
%type <sp_cursor_stmt>
sp_cursor_stmt_lex
@@ -1992,12 +1999,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <select_order> opt_order_clause order_clause order_list
%type <NONE>
- analyze_stmt_command
+ analyze_stmt_command backup backup_statements
query verb_clause create change select select_into
do drop insert replace insert2
insert_values update delete truncate rename compound_statement
show describe load alter optimize keycache preload flush
- reset purge begin commit rollback savepoint release
+ reset purge begin_stmt_mariadb commit rollback savepoint release
slave master_def master_defs master_file_def slave_until_opts
repair analyze opt_with_admin opt_with_admin_option
analyze_table_list analyze_table_elem_spec
@@ -2068,8 +2075,11 @@ END_OF_INPUT
%type <NONE> sp_proc_stmt_if
%type <NONE> sp_labeled_control sp_unlabeled_control
%type <NONE> sp_labeled_block sp_unlabeled_block sp_unlabeled_block_not_atomic
+%type <NONE> sp_proc_stmt_continue_oracle
+%type <NONE> sp_proc_stmt_exit_oracle
%type <NONE> sp_proc_stmt_leave
%type <NONE> sp_proc_stmt_iterate
+%type <NONE> sp_proc_stmt_goto_oracle
%type <NONE> sp_proc_stmt_open sp_proc_stmt_fetch sp_proc_stmt_close
%type <NONE> case_stmt_specification
%type <NONE> loop_body while_body repeat_body
@@ -2077,9 +2087,12 @@ END_OF_INPUT
%type <num> view_algorithm view_check_option
%type <view_suid> view_suid opt_view_suid
+%type <plsql_cursor_attr> plsql_cursor_attr
+
%type <num> sp_decl_idents sp_decl_idents_init_vars
%type <num> sp_handler_type sp_hcond_list
%type <spcondvalue> sp_cond sp_hcond sqlstate signal_value opt_signal_value
+%type <spblock> sp_decl_handler
%type <spblock> sp_decls sp_decl sp_decl_body sp_decl_variable_list
%type <spname> sp_name
%type <spvar> sp_param_name sp_param_name_and_type
@@ -2092,7 +2105,7 @@ END_OF_INPUT
%type <num> index_hint_clause normal_join inner_join
%type <filetype> data_or_xml
-%type <NONE> signal_stmt resignal_stmt
+%type <NONE> signal_stmt resignal_stmt raise_stmt_oracle
%type <diag_condition_item_name> signal_condition_information_item_name
%type <trg_execution_order> trigger_follows_precedes_clause;
@@ -2206,7 +2219,7 @@ opt_end_of_input:
verb_clause:
statement
- | begin
+ | begin_stmt_mariadb
| compound_statement
;
@@ -2215,6 +2228,7 @@ statement:
alter
| analyze
| analyze_stmt_command
+ | backup
| binlog_base64_event
| call
| change
@@ -2246,6 +2260,7 @@ statement:
| preload
| prepare
| purge
+ | raise_stmt_oracle
| release
| rename
| repair
@@ -2633,7 +2648,7 @@ create:
LEX *lex= thd->lex;
if (!lex->first_select_lex()->
add_table_to_list(thd, $6, NULL, TL_OPTION_UPDATING,
- TL_WRITE, MDL_EXCLUSIVE))
+ TL_WRITE, MDL_SHARED_UPGRADABLE))
MYSQL_YYABORT;
lex->alter_info.reset();
/*
@@ -2926,6 +2941,7 @@ sf_tail_not_aggregate:
}
Lex->sphead->set_chistics_agg_type(NOT_AGGREGATE);
}
+ ;
sf_tail_aggregate:
sf_tail
@@ -2936,6 +2952,7 @@ sf_tail_aggregate:
}
Lex->sphead->set_chistics_agg_type(GROUP_AGGREGATE);
}
+ ;
create_function_tail:
sf_tail_not_aggregate { }
@@ -3516,7 +3533,7 @@ sp_decls:
;
sp_decl:
- DECLARE_SYM sp_decl_body { $$= $2; }
+ DECLARE_MARIADB_SYM sp_decl_body { $$= $2; }
;
@@ -3632,18 +3649,7 @@ sp_decl_body:
$$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1;
}
- | sp_handler_type HANDLER_SYM FOR_SYM
- {
- if (unlikely(Lex->sp_handler_declaration_init(thd, $1)))
- MYSQL_YYABORT;
- }
- sp_hcond_list sp_proc_stmt
- {
- if (unlikely(Lex->sp_handler_declaration_finalize(thd, $1)))
- MYSQL_YYABORT;
- $$.vars= $$.conds= $$.curs= 0;
- $$.hndlrs= 1;
- }
+ | sp_decl_handler
| sp_decl_ident CURSOR_SYM
{
Lex->sp_block_init(thd);
@@ -3661,6 +3667,21 @@ sp_decl_body:
}
;
+sp_decl_handler:
+ sp_handler_type HANDLER_SYM FOR_SYM
+ {
+ if (unlikely(Lex->sp_handler_declaration_init(thd, $1)))
+ MYSQL_YYABORT;
+ }
+ sp_hcond_list sp_proc_stmt
+ {
+ if (unlikely(Lex->sp_handler_declaration_finalize(thd, $1)))
+ MYSQL_YYABORT;
+ $$.vars= $$.conds= $$.curs= 0;
+ $$.hndlrs= 1;
+ }
+ ;
+
opt_parenthesized_cursor_formal_parameters:
/* Empty */
| '(' sp_fdparams ')'
@@ -3693,8 +3714,10 @@ sp_cursor_stmt:
;
sp_handler_type:
- EXIT_SYM { $$= sp_handler::EXIT; }
- | CONTINUE_SYM { $$= sp_handler::CONTINUE; }
+ EXIT_MARIADB_SYM { $$= sp_handler::EXIT; }
+ | CONTINUE_MARIADB_SYM { $$= sp_handler::CONTINUE; }
+ | EXIT_ORACLE_SYM { $$= sp_handler::EXIT; }
+ | CONTINUE_ORACLE_SYM { $$= sp_handler::CONTINUE; }
/*| UNDO_SYM { QQ No yet } */
;
@@ -3764,7 +3787,7 @@ sp_hcond:
}
| ident /* CONDITION name */
{
- $$= Lex->spcont->find_condition(&$1, false);
+ $$= Lex->spcont->find_declared_or_predefined_condition(thd, &$1);
if (unlikely($$ == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
}
@@ -3786,6 +3809,26 @@ sp_hcond:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ | OTHERS_ORACLE_SYM /* All other SQLSTATEs */
+ {
+ $$= new (thd->mem_root) sp_condition_value(sp_condition_value::EXCEPTION);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ ;
+
+
+raise_stmt_oracle:
+ RAISE_ORACLE_SYM opt_set_signal_information
+ {
+ if (unlikely(Lex->add_resignal_statement(thd, NULL)))
+ MYSQL_YYABORT;
+ }
+ | RAISE_ORACLE_SYM signal_value opt_set_signal_information
+ {
+ if (unlikely(Lex->add_signal_statement(thd, $2)))
+ MYSQL_YYABORT;
+ }
;
signal_stmt:
@@ -3805,7 +3848,7 @@ signal_value:
/* SIGNAL foo cannot be used outside of stored programs */
if (unlikely(lex->spcont == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
- cond= lex->spcont->find_condition(&$1, false);
+ cond= lex->spcont->find_declared_or_predefined_condition(thd, &$1);
if (unlikely(cond == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
if (unlikely(cond->type != sp_condition_value::SQLSTATE))
@@ -3977,6 +4020,7 @@ statement_information_item:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ ;
simple_target_specification:
ident_cli
@@ -3993,7 +4037,9 @@ simple_target_specification:
;
statement_information_item_name:
- NUMBER_SYM
+ NUMBER_MARIADB_SYM
+ { $$= Statement_information_item::NUMBER; }
+ | NUMBER_ORACLE_SYM
{ $$= Statement_information_item::NUMBER; }
| ROW_COUNT_SYM
{ $$= Statement_information_item::ROW_COUNT; }
@@ -4031,6 +4077,7 @@ condition_information_item:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ ;
condition_information_item_name:
CLASS_ORIGIN_SYM
@@ -4122,8 +4169,11 @@ sp_proc_stmt_in_returns_clause:
sp_proc_stmt:
sp_proc_stmt_in_returns_clause
| sp_proc_stmt_statement
+ | sp_proc_stmt_continue_oracle
+ | sp_proc_stmt_exit_oracle
| sp_proc_stmt_leave
| sp_proc_stmt_iterate
+ | sp_proc_stmt_goto_oracle
| sp_proc_stmt_open
| sp_proc_stmt_fetch
| sp_proc_stmt_close
@@ -4157,50 +4207,20 @@ sp_proc_stmt_statement:
}
statement
{
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
- sp_head *sp= lex->sphead;
-
- sp->m_flags|= sp_get_flags_for_command(lex);
- /* "USE db" doesn't work in a procedure */
- if (unlikely(lex->sql_command == SQLCOM_CHANGE_DB))
- my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "USE"));
- /*
- Don't add an instruction for SET statements, since all
- instructions for them were already added during processing
- of "set" rule.
- */
- DBUG_ASSERT(lex->sql_command != SQLCOM_SET_OPTION ||
- lex->var_list.is_empty());
- if (lex->sql_command != SQLCOM_SET_OPTION)
- {
- sp_instr_stmt *i=new (thd->mem_root)
- sp_instr_stmt(sp->instructions(), lex->spcont, lex);
- if (unlikely(i == NULL))
- MYSQL_YYABORT;
-
- /*
- Extract the query statement from the tokenizer. The
- end is either lex->ptr, if there was no lookahead,
- lex->tok_end otherwise.
- */
- if (yychar == YYEMPTY)
- i->m_query.length= lip->get_ptr() - sp->m_tmp_query;
- else
- i->m_query.length= lip->get_tok_start() - sp->m_tmp_query;;
- if (unlikely(!(i->m_query.str= strmake_root(thd->mem_root,
- sp->m_tmp_query,
- i->m_query.length))) ||
- unlikely(sp->add_instr(i)))
- MYSQL_YYABORT;
- }
- if (unlikely(sp->restore_lex(thd)))
+ if (Lex->sp_proc_stmt_statement_finalize(thd, yychar == YYEMPTY) ||
+ Lex->sphead->restore_lex(thd))
MYSQL_YYABORT;
}
;
+
+RETURN_ALLMODES_SYM:
+ RETURN_MARIADB_SYM
+ | RETURN_ORACLE_SYM
+ ;
+
sp_proc_stmt_return:
- RETURN_SYM
+ RETURN_ALLMODES_SYM
{ Lex->sphead->reset_lex(thd); }
expr
{
@@ -4211,8 +4231,71 @@ sp_proc_stmt_return:
unlikely(sp->restore_lex(thd)))
MYSQL_YYABORT;
}
+ | RETURN_ORACLE_SYM
+ {
+ LEX *lex= Lex;
+ sp_head *sp= lex->sphead;
+ if (unlikely(sp->m_handler->add_instr_preturn(thd, sp,
+ lex->spcont)))
+ MYSQL_YYABORT;
+ }
+ ;
+
+reset_lex_expr:
+ { Lex->sphead->reset_lex(thd); } expr { $$= $2; }
+ ;
+
+sp_proc_stmt_exit_oracle:
+ EXIT_ORACLE_SYM
+ {
+ if (unlikely(Lex->sp_exit_statement(thd, NULL)))
+ MYSQL_YYABORT;
+ }
+ | EXIT_ORACLE_SYM label_ident
+ {
+ if (unlikely(Lex->sp_exit_statement(thd, &$2, NULL)))
+ MYSQL_YYABORT;
+ }
+ | EXIT_ORACLE_SYM WHEN_SYM reset_lex_expr
+ {
+ if (unlikely(Lex->sp_exit_statement(thd, $3)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
+ MYSQL_YYABORT;
+ }
+ | EXIT_ORACLE_SYM label_ident WHEN_SYM reset_lex_expr
+ {
+ if (unlikely(Lex->sp_exit_statement(thd, &$2, $4)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
+ MYSQL_YYABORT;
+ }
+ ;
+
+sp_proc_stmt_continue_oracle:
+ CONTINUE_ORACLE_SYM
+ {
+ if (unlikely(Lex->sp_continue_statement(thd, NULL)))
+ MYSQL_YYABORT;
+ }
+ | CONTINUE_ORACLE_SYM label_ident
+ {
+ if (unlikely(Lex->sp_continue_statement(thd, &$2, NULL)))
+ MYSQL_YYABORT;
+ }
+ | CONTINUE_ORACLE_SYM WHEN_SYM reset_lex_expr
+ {
+ if (unlikely(Lex->sp_continue_statement(thd, $3)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
+ MYSQL_YYABORT;
+ }
+ | CONTINUE_ORACLE_SYM label_ident WHEN_SYM reset_lex_expr
+ {
+ if (unlikely(Lex->sp_continue_statement(thd, &$2, $4)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
+ MYSQL_YYABORT;
+ }
;
+
sp_proc_stmt_leave:
LEAVE_SYM label_ident
{
@@ -4229,6 +4312,14 @@ sp_proc_stmt_iterate:
}
;
+sp_proc_stmt_goto_oracle:
+ GOTO_ORACLE_SYM label_ident
+ {
+ if (unlikely(Lex->sp_goto_statement(thd, &$2)))
+ MYSQL_YYABORT;
+ }
+ ;
+
assignment_source_lex:
{
DBUG_ASSERT(Lex->sphead);
@@ -4424,7 +4515,7 @@ sp_if:
sp_elseifs:
/* Empty */
- | ELSEIF_SYM sp_if
+ | ELSEIF_MARIADB_SYM sp_if
| ELSE sp_proc_stmts1
;
@@ -4605,7 +4696,7 @@ sp_block_label:
sp_labeled_block:
sp_block_label
- BEGIN_SYM
+ BEGIN_MARIADB_SYM
{
Lex->sp_block_init(thd, &$1);
}
@@ -4620,7 +4711,7 @@ sp_labeled_block:
;
sp_unlabeled_block:
- BEGIN_SYM
+ BEGIN_MARIADB_SYM
{
Lex->sp_block_init(thd);
}
@@ -4634,7 +4725,7 @@ sp_unlabeled_block:
;
sp_unlabeled_block_not_atomic:
- BEGIN_SYM not ATOMIC_SYM /* TODO: BEGIN ATOMIC (not -> opt_not) */
+ BEGIN_MARIADB_SYM not ATOMIC_SYM /* TODO: BEGIN ATOMIC (not -> opt_not) */
{
if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
@@ -4667,16 +4758,13 @@ sp_for_loop_bounds:
IN_SYM opt_sp_for_loop_direction for_loop_bound_expr
DOT_DOT_SYM for_loop_bound_expr
{
- $$.m_direction= $2;
- $$.m_index= $3;
- $$.m_upper_bound= $5;
- $$.m_implicit_cursor= false;
+ $$= Lex_for_loop_bounds_intrange($2, $3, $5);
}
| IN_SYM opt_sp_for_loop_direction for_loop_bound_expr
{
$$.m_direction= $2;
$$.m_index= $3;
- $$.m_upper_bound= NULL;
+ $$.m_target_bound= NULL;
$$.m_implicit_cursor= false;
}
| IN_SYM opt_sp_for_loop_direction '(' sp_cursor_stmt ')'
@@ -6819,6 +6907,13 @@ field_type_numeric:
}
| DECIMAL_SYM float_options field_options
{ $$.set(&type_handler_newdecimal, $2);}
+ | NUMBER_ORACLE_SYM float_options field_options
+ {
+ if ($2.length() != 0)
+ $$.set(&type_handler_newdecimal, $2);
+ else
+ $$.set(&type_handler_double);
+ }
| NUMERIC_SYM float_options field_options
{ $$.set(&type_handler_newdecimal, $2);}
| FIXED_SYM float_options field_options
@@ -6845,6 +6940,10 @@ field_type_string:
{
$$.set(&type_handler_varchar, $2);
}
+ | VARCHAR2_ORACLE_SYM field_length opt_binary
+ {
+ $$.set(&type_handler_varchar, $2);
+ }
| nvarchar field_length opt_bin_mod
{
$$.set(&type_handler_varchar, $2);
@@ -6855,6 +6954,11 @@ field_type_string:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
+ | RAW_ORACLE_SYM field_length
+ {
+ Lex->charset= &my_charset_bin;
+ $$.set(&type_handler_varchar, $2);
+ }
;
field_type_temporal:
@@ -6921,11 +7025,16 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_tiny_blob);
}
- | BLOB_SYM opt_field_length
+ | BLOB_MARIADB_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_blob, $2);
}
+ | BLOB_ORACLE_SYM opt_field_length
+ {
+ Lex->charset=&my_charset_bin;
+ $$.set(&type_handler_long_blob);
+ }
| spatial_type float_options srid_option
{
#ifdef HAVE_SPATIAL
@@ -6962,6 +7071,8 @@ field_type_lob:
{ $$.set(&type_handler_medium_blob); }
| LONGTEXT opt_binary
{ $$.set(&type_handler_long_blob); }
+ | CLOB_ORACLE_SYM opt_binary
+ { $$.set(&type_handler_long_blob); }
| LONG_SYM opt_binary
{ $$.set(&type_handler_medium_blob); }
| JSON_SYM
@@ -7068,10 +7179,12 @@ field_length:
opt_field_length:
/* empty */ { $$= (char*) 0; /* use default length */ }
| field_length { $$= $1; }
+ ;
opt_field_length_default_1:
/* empty */ { $$= (char*) "1"; }
| field_length { $$= $1; }
+ ;
opt_precision:
/* empty */ { $$.set(0, 0); }
@@ -7532,12 +7645,14 @@ fulltext_key_opts:
opt_USING_key_algorithm:
/* Empty*/ { $$= HA_KEY_ALG_UNDEF; }
| USING btree_or_rtree { $$= $2; }
+ ;
/* TYPE is a valid identifier, so it's handled differently than USING */
opt_key_algorithm_clause:
/* Empty*/ { $$= HA_KEY_ALG_UNDEF; }
| USING btree_or_rtree { $$= $2; }
| TYPE_SYM btree_or_rtree { $$= $2; }
+ ;
key_using_alg:
USING btree_or_rtree
@@ -8356,6 +8471,7 @@ opt_index_lock_algorithm:
| alter_algorithm_option
| alter_lock_option alter_algorithm_option
| alter_algorithm_option alter_lock_option
+ ;
alter_algorithm_option:
ALGORITHM_SYM opt_equal DEFAULT
@@ -8414,7 +8530,7 @@ alter_option:
Lex->alter_info.requested_lock=
Alter_info::ALTER_TABLE_LOCK_NONE;
}
-
+ ;
opt_restrict:
/* empty */ { Lex->drop_mode= DROP_DEFAULT; }
@@ -8681,6 +8797,7 @@ persistent_stat_spec:
{}
| COLUMNS persistent_column_stat_spec INDEXES persistent_index_stat_spec
{}
+ ;
persistent_column_stat_spec:
ALL {}
@@ -9213,7 +9330,6 @@ query_expression:
}
;
-
subselect:
remember_tok_start
query_expression
@@ -9470,13 +9586,13 @@ select_alias:
opt_default_time_precision:
/* empty */ { $$= NOT_FIXED_DEC; }
| '(' ')' { $$= NOT_FIXED_DEC; }
- | '(' real_ulong_num ')' { $$= $2; };
+ | '(' real_ulong_num ')' { $$= $2; }
;
opt_time_precision:
/* empty */ { $$= 0; }
| '(' ')' { $$= 0; }
- | '(' real_ulong_num ')' { $$= $2; };
+ | '(' real_ulong_num ')' { $$= $2; }
;
optional_braces:
@@ -9981,6 +10097,7 @@ dyncall_create_element:
else
$$->len= 0;
}
+ ;
dyncall_create_list:
dyncall_create_element
@@ -9997,6 +10114,23 @@ dyncall_create_list:
}
;
+
+plsql_cursor_attr:
+ ISOPEN_SYM { $$= PLSQL_CURSOR_ATTR_ISOPEN; }
+ | FOUND_SYM { $$= PLSQL_CURSOR_ATTR_FOUND; }
+ | NOTFOUND_SYM { $$= PLSQL_CURSOR_ATTR_NOTFOUND; }
+ | ROWCOUNT_SYM { $$= PLSQL_CURSOR_ATTR_ROWCOUNT; }
+ ;
+
+explicit_cursor_attr:
+ ident PERCENT_ORACLE_SYM plsql_cursor_attr
+ {
+ if (unlikely(!($$= Lex->make_item_plsql_cursor_attr(thd, &$1, $3))))
+ MYSQL_YYABORT;
+ }
+ ;
+
+
trim_operands:
expr { $$.set(TRIM_BOTH, $1); }
| LEADING expr FROM expr { $$.set(TRIM_LEADING, $2, $4); }
@@ -10174,6 +10308,7 @@ column_default_non_parenthesized_expr:
primary_expr:
column_default_non_parenthesized_expr
+ | explicit_cursor_attr
| '(' parenthesized_expr ')' { $$= $2; }
;
@@ -10360,6 +10495,14 @@ function_call_keyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ | SQL_SYM PERCENT_ORACLE_SYM ROWCOUNT_SYM
+ {
+ $$= new (thd->mem_root) Item_func_oracle_sql_rowcount(thd);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
+ Lex->safe_to_cache_query= 0;
+ }
| TIME_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_time_typecast(thd, $3,
@@ -10456,12 +10599,18 @@ function_call_nonkeyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | DECODE_SYM '(' expr ',' expr ')'
+ | DECODE_MARIADB_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_decode(thd, $3, $5);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ | DECODE_ORACLE_SYM '(' expr ',' decode_when_list_oracle ')'
+ {
+ $5->push_front($3, thd->mem_root);
+ if (unlikely(!($$= new (thd->mem_root) Item_func_decode_oracle(thd, *$5))))
+ MYSQL_YYABORT;
+ }
| EXTRACT_SYM '(' interval FROM expr ')'
{
$$=new (thd->mem_root) Item_extract(thd, $3, $5);
@@ -11203,6 +11352,21 @@ window_func:
{
((Item_sum *) $1)->mark_as_window_func_sum_expr();
}
+ |
+ function_call_generic
+ {
+ Item* item = (Item*)$1;
+ /* Only UDF aggregate here possible */
+ if ((item == NULL) ||
+ (item->type() != Item::SUM_FUNC_ITEM)
+ || (((Item_sum *)item)->sum_func() != Item_sum::UDF_SUM_FUNC))
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
+
+ ((Item_sum *) $1)->mark_as_window_func_sum_expr();
+ }
;
simple_window_func:
@@ -11443,7 +11607,7 @@ opt_gconcat_separator:
opt_gorder_clause:
/* empty */
- | ORDER_SYM BY gorder_list;
+ | ORDER_SYM BY gorder_list
;
gorder_list:
@@ -11525,6 +11689,14 @@ cast_type:
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
+ | VARCHAR field_length
+ { Lex->charset= thd->variables.collation_connection; }
+ opt_binary
+ { $$.set(&type_handler_long_blob, $2); }
+ | VARCHAR2_ORACLE_SYM field_length
+ { Lex->charset= thd->variables.collation_connection; }
+ opt_binary
+ { $$.set(&type_handler_long_blob, $2); }
| NCHAR_SYM opt_field_length
{
Lex->charset= national_charset_info;
@@ -11548,6 +11720,10 @@ cast_type_temporal:
DATE_SYM { $$.set(&type_handler_newdate); }
| TIME_SYM opt_field_length { $$.set(&type_handler_time2, 0, $2); }
| DATETIME opt_field_length { $$.set(&type_handler_datetime2, 0, $2); }
+ | INTERVAL_SYM DAY_SECOND_SYM field_length
+ {
+ $$.set(&type_handler_interval_DDhhmmssff, 0, $3);
+ }
;
opt_expr_list:
@@ -11619,6 +11795,25 @@ when_list_opt_else:
}
;
+decode_when_list_oracle:
+ expr ',' expr
+ {
+ $$= new (thd->mem_root) List<Item>;
+ if (unlikely($$ == NULL) ||
+ unlikely($$->push_back($1, thd->mem_root)) ||
+ unlikely($$->push_back($3, thd->mem_root)))
+ MYSQL_YYABORT;
+
+ }
+ | decode_when_list_oracle ',' expr
+ {
+ $$= $1;
+ if (unlikely($$->push_back($3, thd->mem_root)))
+ MYSQL_YYABORT;
+ }
+ ;
+
+
/* Equivalent to <table reference> in the SQL:2003 standard. */
/* Warning - may return NULL in case of incomplete SELECT */
table_ref:
@@ -11841,7 +12036,7 @@ use_partition:
$$= $3;
}
;
-
+
table_factor:
table_primary_ident { $$= $1; }
| table_primary_derived { $$= $1; }
@@ -11939,7 +12134,6 @@ table_primary_derived:
}
;
-
opt_outer:
/* empty */ {}
| OUTER {}
@@ -12242,6 +12436,7 @@ opt_window_ref:
if (unlikely(thd->lex->win_ref == NULL))
MYSQL_YYABORT;
}
+ ;
opt_window_partition_clause:
/* empty */ { }
@@ -12342,7 +12537,9 @@ opt_window_frame_exclusion:
{ $$= Window_frame::EXCL_GROUP; }
| EXCLUDE_SYM TIES_SYM
{ $$= Window_frame::EXCL_TIES; }
- | EXCLUDE_SYM NO_SYM OTHERS_SYM
+ | EXCLUDE_SYM NO_SYM OTHERS_MARIADB_SYM
+ { $$= Window_frame::EXCL_NONE; }
+ | EXCLUDE_SYM NO_SYM OTHERS_ORACLE_SYM
{ $$= Window_frame::EXCL_NONE; }
;
@@ -12448,6 +12645,7 @@ opt_global_limit_clause:
Select->select_limit= $1.select_limit;
Select->offset_limit= $1.offset_limit;
}
+ ;
limit_options:
limit_option
@@ -12511,6 +12709,7 @@ limit_rows_option:
LEX *lex=Lex;
lex->limit_rows_examined= $1;
}
+ ;
delete_limit_clause:
/* empty */
@@ -12608,6 +12807,7 @@ opt_plus:
int_num:
opt_plus NUM { int error; $$= (int) my_strtoll10($2.str, (char**) 0, &error); }
| '-' NUM { int error; $$= -(int) my_strtoll10($2.str, (char**) 0, &error); }
+ ;
ulong_num:
opt_plus NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); }
@@ -12631,7 +12831,7 @@ longlong_num:
| LONG_NUM { int error; $$= (longlong) my_strtoll10($1.str, (char**) 0, &error); }
| '-' NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); }
| '-' LONG_NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); }
-
+ ;
ulonglong_num:
opt_plus NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); }
@@ -12668,6 +12868,7 @@ bool:
ulong_num { $$= $1 != 0; }
| TRUE_SYM { $$= 1; }
| FALSE_SYM { $$= 0; }
+ ;
procedure_clause:
PROCEDURE_SYM ident /* Procedure name */
@@ -13048,7 +13249,7 @@ insert:
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_INSERT;
- lex->duplicates= DUP_ERROR;
+ lex->duplicates= DUP_ERROR;
if (Lex->main_select_push())
MYSQL_YYABORT;
mysql_init_select(lex);
@@ -13919,13 +14120,13 @@ show_param:
lex->sql_command = SQLCOM_SHOW_CREATE_FUNC;
lex->spname= $3;
}
- | CREATE PACKAGE_SYM sp_name
+ | CREATE PACKAGE_MARIADB_SYM sp_name
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE_PACKAGE;
lex->spname= $3;
}
- | CREATE PACKAGE_SYM BODY_SYM sp_name
+ | CREATE PACKAGE_MARIADB_SYM BODY_MARIADB_SYM sp_name
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE_PACKAGE_BODY;
@@ -13964,14 +14165,14 @@ show_param:
if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
- | PACKAGE_SYM STATUS_SYM wild_and_where
+ | PACKAGE_MARIADB_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE;
if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
- | PACKAGE_SYM BODY_SYM STATUS_SYM wild_and_where
+ | PACKAGE_MARIADB_SYM BODY_MARIADB_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE_BODY;
@@ -13988,7 +14189,7 @@ show_param:
Lex->sql_command= SQLCOM_SHOW_FUNC_CODE;
Lex->spname= $3;
}
- | PACKAGE_SYM BODY_SYM CODE_SYM sp_name
+ | PACKAGE_MARIADB_SYM BODY_MARIADB_SYM CODE_SYM sp_name
{
Lex->sql_command= SQLCOM_SHOW_PACKAGE_BODY_CODE;
Lex->spname= $4;
@@ -14285,6 +14486,8 @@ flush_option:
{ Lex->type|= REFRESH_DES_KEY_FILE; }
| RESOURCES
{ Lex->type|= REFRESH_USER_RESOURCES; }
+ | SSL_SYM
+ { Lex->type|= REFRESH_SSL;}
| IDENT_sys remember_tok_start
{
Lex->type|= REFRESH_GENERIC;
@@ -14306,6 +14509,37 @@ opt_table_list:
| table_list {}
;
+backup:
+ BACKUP_SYM backup_statements {}
+ ;
+
+backup_statements:
+ STAGE_SYM ident
+ {
+ int type;
+ if (unlikely(Lex->sphead))
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "BACKUP STAGE"));
+ if ((type= find_type($2.str, &backup_stage_names,
+ FIND_TYPE_NO_PREFIX)) <= 0)
+ my_yyabort_error((ER_BACKUP_UNKNOWN_STAGE, MYF(0), $2.str));
+ Lex->sql_command= SQLCOM_BACKUP;
+ Lex->backup_stage= (backup_stages) (type-1);
+ break;
+ }
+ | LOCK_SYM table_ident
+ {
+ if (unlikely(!Select->add_table_to_list(thd, $2, NULL, 0,
+ TL_READ, MDL_SHARED_HIGH_PRIO)))
+ MYSQL_YYABORT;
+ Lex->sql_command= SQLCOM_BACKUP_LOCK;
+ }
+ | UNLOCK_SYM
+ {
+ /* Table list is empty for unlock */
+ Lex->sql_command= SQLCOM_BACKUP_LOCK;
+ }
+ ;
+
opt_delete_gtid_domain:
/* empty */ {}
| DELETE_DOMAIN_ID_SYM '=' '(' delete_domain_id_list ')'
@@ -14336,6 +14570,7 @@ delete_domain_id:
optional_flush_tables_arguments:
/* empty */ {$$= 0;}
| AND_SYM DISABLE_SYM CHECKPOINT_SYM {$$= REFRESH_CHECKPOINT; }
+ ;
reset:
RESET_SYM
@@ -14430,6 +14665,7 @@ kill_type:
/* Empty */ { $$= (int) KILL_HARD_BIT; }
| HARD_SYM { $$= (int) KILL_HARD_BIT; }
| SOFT_SYM { $$= 0; }
+ ;
kill_option:
/* empty */ { $$= (int) KILL_CONNECTION; }
@@ -14750,6 +14986,19 @@ param_marker:
YYLIP->get_tok_start() + 1))))
MYSQL_YYABORT;
}
+ | COLON_ORACLE_SYM ident_cli
+ {
+ if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str,
+ $1.pos(), $2.end()))))
+ MYSQL_YYABORT;
+ }
+ | COLON_ORACLE_SYM NUM
+ {
+ if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str,
+ $1.pos(),
+ YYLIP->get_ptr()))))
+ MYSQL_YYABORT;
+ }
;
signed_literal:
@@ -15059,6 +15308,11 @@ simple_ident:
if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3, &$5))))
MYSQL_YYABORT;
}
+ | COLON_ORACLE_SYM ident_cli '.' ident_cli
+ {
+ if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4))))
+ MYSQL_YYABORT;
+ }
;
simple_ident_nospvar:
@@ -15067,20 +15321,17 @@ simple_ident_nospvar:
if (unlikely(!($$= Lex->create_item_ident_nosp(thd, &$1))))
MYSQL_YYABORT;
}
- | simple_ident_q { $$= $1; }
- ;
-
-simple_ident_q:
- ident '.' ident
+ | ident '.' ident
{
if (unlikely(!($$= Lex->create_item_ident_nospvar(thd, &$1, &$3))))
MYSQL_YYABORT;
}
- | simple_ident_q2
- ;
-
-simple_ident_q2:
- '.' ident '.' ident
+ | COLON_ORACLE_SYM ident_cli '.' ident_cli
+ {
+ if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4))))
+ MYSQL_YYABORT;
+ }
+ | '.' ident '.' ident
{
Lex_ident_sys none;
if (unlikely(!($$= Lex->create_item_ident(thd, &none, &$2, &$4))))
@@ -15216,6 +15467,14 @@ ident_table_alias:
}
;
+ident_set_usual_case:
+ IDENT_sys
+ | keyword_set_usual_case
+ {
+ if (unlikely($$.copy_keyword(thd, &$1)))
+ MYSQL_YYABORT;
+ }
+ ;
ident_sysvar_name:
IDENT_sys
@@ -15323,6 +15582,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15334,6 +15594,7 @@ keyword_table_alias:
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15349,12 +15610,14 @@ keyword_ident:
*/
keyword_label:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sysvar_type
;
keyword_sysvar_name:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15365,6 +15628,18 @@ keyword_sysvar_name:
keyword_sp_decl:
keyword_data_type
+ | keyword_set_special_case
+ | keyword_sp_block_section
+ | keyword_sp_head
+ | keyword_sp_var_and_label
+ | keyword_sp_var_not_label
+ | keyword_sysvar_type
+ | keyword_verb_clause
+ | WINDOW_SYM
+ ;
+
+keyword_set_usual_case:
+ keyword_data_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15410,7 +15685,7 @@ keyword_sp_var_not_label:
| INSTALL_SYM
| OPTION
| OPTIONS_SYM
- | OTHERS_SYM
+ | OTHERS_MARIADB_SYM
| OWNER_SYM
| PARSER_SYM
| PERIOD_SYM
@@ -15506,11 +15781,18 @@ keyword_verb_clause:
| TRUNCATE_SYM /* Verb clause. Reserved in Oracle */
;
+keyword_set_special_case:
+ NAMES_SYM
+ | ROLE_SYM
+ | PASSWORD_SYM
+ ;
+
/*
Keywords that start an SP block section.
*/
keyword_sp_block_section:
- BEGIN_SYM
+ BEGIN_MARIADB_SYM
+ | EXCEPTION_ORACLE_SYM
| END
;
@@ -15529,7 +15811,8 @@ keyword_data_type:
BIT_SYM
| BOOLEAN_SYM
| BOOL_SYM
- | CLOB
+ | CLOB_MARIADB_SYM
+ | CLOB_ORACLE_SYM
| DATE_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| DATETIME
| ENUM
@@ -15544,17 +15827,20 @@ keyword_data_type:
| MULTIPOLYGON
| NATIONAL_SYM
| NCHAR_SYM
- | NUMBER_SYM
+ | NUMBER_MARIADB_SYM
+ | NUMBER_ORACLE_SYM
| NVARCHAR_SYM
| POINT_SYM
| POLYGON
- | RAW
+ | RAW_MARIADB_SYM
+ | RAW_ORACLE_SYM
| ROW_SYM
| SERIAL_SYM
| TEXT_SYM
| TIMESTAMP %prec PREC_BELOW_CONTRACTION_TOKEN2
| TIME_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
- | VARCHAR2
+ | VARCHAR2_MARIADB_SYM
+ | VARCHAR2_ORACLE_SYM
| YEAR_SYM
;
@@ -15581,7 +15867,7 @@ keyword_sp_var_and_label:
| AVG_ROW_LENGTH
| AVG_SYM
| BLOCK_SYM
- | BODY_SYM
+ | BODY_MARIADB_SYM
| BTREE_SYM
| CASCADED
| CATALOG_NAME_SYM
@@ -15621,7 +15907,8 @@ keyword_sp_var_and_label:
| DATAFILE_SYM
| DATE_FORMAT_SYM
| DAY_SYM
- | DECODE_SYM
+ | DECODE_MARIADB_SYM
+ | DECODE_ORACLE_SYM
| DEFINER_SYM
| DELAY_KEY_WRITE_SYM
| DES_KEY_FILE
@@ -15633,7 +15920,8 @@ keyword_sp_var_and_label:
| DUMPFILE
| DUPLICATE_SYM
| DYNAMIC_SYM
- | ELSIF_SYM
+ | ELSEIF_ORACLE_SYM
+ | ELSIF_MARIADB_SYM
| ENDS_SYM
| ENGINE_SYM
| ENGINES_SYM
@@ -15643,7 +15931,7 @@ keyword_sp_var_and_label:
| EVENT_SYM
| EVENTS_SYM
| EVERY_SYM
- | EXCEPTION_SYM
+ | EXCEPTION_MARIADB_SYM
| EXCHANGE_SYM
| EXPANSION_SYM
| EXPORT_SYM
@@ -15660,7 +15948,7 @@ keyword_sp_var_and_label:
| GENERATED_SYM
| GET_FORMAT
| GRANTS
- | GOTO_SYM
+ | GOTO_MARIADB_SYM
| HASH_SYM
| HARD_SYM
| HISTORY_SYM
@@ -15736,7 +16024,6 @@ keyword_sp_var_and_label:
| MYSQL_SYM
| MYSQL_ERRNO_SYM
| NAME_SYM
- | NAMES_SYM
| NEXT_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| NEXTVAL_SYM
| NEW_SYM
@@ -15755,13 +16042,12 @@ keyword_sp_var_and_label:
| ONE_SYM
| ONLINE_SYM
| ONLY_SYM
- | PACKAGE_SYM
+ | PACKAGE_MARIADB_SYM
| PACK_KEYS_SYM
| PAGE_SYM
| PARTIAL
| PARTITIONING_SYM
| PARTITIONS_SYM
- | PASSWORD_SYM
| PERSISTENT_SYM
| PHASE_SYM
| PLUGIN_SYM
@@ -15778,7 +16064,7 @@ keyword_sp_var_and_label:
| QUARTER_SYM
| QUERY_SYM
| QUICK
- | RAISE_SYM
+ | RAISE_MARIADB_SYM
| READ_ONLY_SYM
| REBUILD_SYM
| RECOVER_SYM
@@ -15801,11 +16087,10 @@ keyword_sp_var_and_label:
| RETURNS_SYM
| REUSE_SYM
| REVERSE_SYM
- | ROLE_SYM
| ROLLUP_SYM
| ROUTINE_SYM
| ROWCOUNT_SYM
- | ROWTYPE_SYM
+ | ROWTYPE_MARIADB_SYM
| ROW_COUNT_SYM
| ROW_FORMAT_SYM
| RTREE_SYM
@@ -15827,6 +16112,7 @@ keyword_sp_var_and_label:
| SQL_BUFFER_RESULT
| SQL_NO_CACHE_SYM
| SQL_THREAD
+ | STAGE_SYM
| STARTS_SYM
| STATEMENT_SYM
| STATUS_SYM
@@ -16056,7 +16342,7 @@ option_value_following_option_type:
/* Option values without preceding option_type. */
option_value_no_option_type:
- ident equal set_expr_or_default
+ ident_set_usual_case equal set_expr_or_default
{
if (unlikely(Lex->set_variable(&$1, $3)))
MYSQL_YYABORT;
@@ -16173,6 +16459,11 @@ option_value_no_option_type:
unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
}
+ | ROLE_SYM equal set_expr_or_default
+ {
+ if (unlikely(Lex->set_variable(&$1, $3)))
+ MYSQL_YYABORT;
+ }
| PASSWORD_SYM opt_for_user text_or_password
{
LEX *lex = Lex;
@@ -16395,6 +16686,7 @@ handler:
{
Lex->pop_select(); //main select
}
+ ;
handler_tail:
table_ident OPEN_SYM opt_table_alias_clause
@@ -16516,6 +16808,20 @@ revoke_command:
TYPE_ENUM_PROCEDURE)))
MYSQL_YYABORT;
}
+ | grant_privileges ON PACKAGE_ORACLE_SYM grant_ident
+ FROM user_and_role_list
+ {
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
+ TYPE_ENUM_PACKAGE)))
+ MYSQL_YYABORT;
+ }
+ | grant_privileges ON PACKAGE_ORACLE_SYM BODY_ORACLE_SYM grant_ident
+ FROM user_and_role_list
+ {
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
+ TYPE_ENUM_PACKAGE_BODY)))
+ MYSQL_YYABORT;
+ }
| ALL opt_privileges ',' GRANT OPTION FROM user_and_role_list
{
Lex->sql_command = SQLCOM_REVOKE_ALL;
@@ -16569,6 +16875,20 @@ grant_command:
TYPE_ENUM_PROCEDURE)))
MYSQL_YYABORT;
}
+ | grant_privileges ON PACKAGE_ORACLE_SYM grant_ident TO_SYM grant_list
+ opt_require_clause opt_grant_options
+ {
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
+ TYPE_ENUM_PACKAGE)))
+ MYSQL_YYABORT;
+ }
+ | grant_privileges ON PACKAGE_ORACLE_SYM BODY_ORACLE_SYM grant_ident TO_SYM grant_list
+ opt_require_clause opt_grant_options
+ {
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
+ TYPE_ENUM_PACKAGE_BODY)))
+ MYSQL_YYABORT;
+ }
| PROXY_SYM ON user TO_SYM grant_list opt_grant_option
{
LEX *lex= Lex;
@@ -16588,12 +16908,14 @@ grant_command:
;
opt_with_admin:
- /* nothing */ { Lex->definer = 0; }
- | WITH ADMIN_SYM user_or_role { Lex->definer = $3; }
+ /* nothing */ { Lex->definer = 0; }
+ | WITH ADMIN_SYM user_or_role { Lex->definer = $3; }
+ ;
opt_with_admin_option:
- /* nothing */ { Lex->with_admin_option= false; }
- | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; }
+ /* nothing */ { Lex->with_admin_option= false; }
+ | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; }
+ ;
role_list:
grant_role
@@ -16986,8 +17308,8 @@ grant_option:
| resource_option {}
;
-begin:
- BEGIN_SYM
+begin_stmt_mariadb:
+ BEGIN_MARIADB_SYM
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_BEGIN;
@@ -17094,7 +17416,7 @@ unit_type_decl:
{ $$.unit_type= INTERSECT_TYPE; $$.distinct= 1; }
| EXCEPT_SYM
{ $$.unit_type= EXCEPT_TYPE; $$.distinct= 1; }
-
+ ;
/*
Start a UNION, for non-top level query expressions.
@@ -17477,7 +17799,8 @@ xid:
;
begin_or_start:
- BEGIN_SYM {}
+ BEGIN_MARIADB_SYM {}
+ | BEGIN_ORACLE_SYM {}
| START_SYM {}
;
@@ -17549,10 +17872,11 @@ uninstall:
/* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */
keep_gcc_happy:
- IMPOSSIBLE_ACTION
- {
- YYERROR;
- }
+ IMPOSSIBLE_ACTION
+ {
+ YYERROR;
+ }
+ ;
/**
@} (end of group Parser)
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 5a6914c89c7..0fa45dacd5e 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -183,11 +183,6 @@ void ORAerror(THD *thd, const char *s)
Lex_for_loop_st for_loop;
Lex_for_loop_bounds_st for_loop_bounds;
Lex_trim_st trim;
- struct
- {
- LEX_CSTRING name;
- uint offset;
- } sp_cursor_name_and_offset;
vers_history_point_t vers_history_point;
struct
{
@@ -286,6 +281,7 @@ void ORAerror(THD *thd, const char *s)
DDL_options_st object_ddl_options;
enum vers_sys_type_t vers_range_unit;
enum Column_definition::enum_column_versioning vers_column_versioning;
+ enum plsql_cursor_attr_t plsql_cursor_attr;
}
%{
@@ -296,10 +292,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 53 shift/reduce conflicts.
+ Currently there are 49 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 53
+%expect 49
/*
Comments for TOKENS.
@@ -343,7 +339,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token BIT_AND /* MYSQL-FUNC */
%token BIT_OR /* MYSQL-FUNC */
%token BIT_XOR /* MYSQL-FUNC */
-%token BLOB_SYM /* SQL-2003-R */
+%token BLOB_MARIADB_SYM /* SQL-2003-R */
+%token BLOB_ORACLE_SYM /* Oracle-R */
+%token BODY_ORACLE_SYM /* Oracle-R */
%token BOTH /* SQL-2003-R */
%token BY /* SQL-2003-R */
%token CALL_SYM /* SQL-2003-R */
@@ -356,7 +354,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token COLLATE_SYM /* SQL-2003-R */
%token CONDITION_SYM /* SQL-2003-R, SQL-2008-R */
%token CONSTRAINT /* SQL-2003-R */
-%token CONTINUE_SYM /* SQL-2003-R */
+%token CONTINUE_MARIADB_SYM /* SQL-2003-R, Oracle-R */
+%token CONTINUE_ORACLE_SYM /* SQL-2003-R, Oracle-R */
%token CONVERT_SYM /* SQL-2003-N */
%token COUNT_SYM /* SQL-2003-N */
%token CREATE /* SQL-2003-R */
@@ -377,7 +376,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DAY_SECOND_SYM
%token DECIMAL_NUM
%token DECIMAL_SYM /* SQL-2003-R */
-%token DECLARE_SYM /* SQL-2003-R */
+%token DECLARE_MARIADB_SYM /* SQL-2003-R */
+%token DECLARE_ORACLE_SYM /* Oracle-R */
%token DEFAULT /* SQL-2003-R */
%token DELETE_DOMAIN_ID_SYM
%token DELETE_SYM /* SQL-2003-R */
@@ -394,7 +394,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DUAL_SYM
%token EACH_SYM /* SQL-2003-R */
%token ELSE /* SQL-2003-R */
-%token ELSEIF_SYM
+%token ELSEIF_MARIADB_SYM
+%token ELSIF_ORACLE_SYM /* PLSQL-R */
%token ENCLOSED
%token END_OF_INPUT /* INTERNAL */
%token EQUAL_SYM /* OPERATOR */
@@ -413,6 +414,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token FROM
%token FULLTEXT_SYM
%token GE
+%token GOTO_ORACLE_SYM /* Oracle-R */
%token GRANT /* SQL-2003-R */
%token GROUP_SYM /* SQL-2003-R */
%token GROUP_CONCAT_SYM
@@ -501,14 +503,17 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token OR2_SYM
%token ORDER_SYM /* SQL-2003-R */
%token OR_SYM /* SQL-2003-R */
+%token OTHERS_ORACLE_SYM /* SQL-2011-N, PLSQL-R */
%token OUTER
%token OUTFILE
%token OUT_SYM /* SQL-2003-R */
%token OVER_SYM
+%token PACKAGE_ORACLE_SYM /* Oracle-R */
%token PAGE_CHECKSUM_SYM
%token PARAM_MARKER
%token PARSE_VCOL_EXPR_SYM
%token PARTITION_SYM /* SQL-2003-R */
+%token PERCENT_ORACLE_SYM /* INTERNAL */
%token PERCENT_RANK_SYM
%token PERCENTILE_CONT_SYM
%token PERCENTILE_DISC_SYM
@@ -517,6 +522,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token PRIMARY_SYM /* SQL-2003-R */
%token PROCEDURE_SYM /* SQL-2003-R */
%token PURGE
+%token RAISE_ORACLE_SYM /* PLSQL-R */
%token RANGE_SYM /* SQL-2003-R */
%token RANK_SYM
%token READS_SYM /* SQL-2003-R */
@@ -535,10 +541,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token RESIGNAL_SYM /* SQL-2003-R */
%token RESTRICT
%token RETURNING_SYM
-%token RETURN_SYM /* SQL-2003-R */
+%token RETURN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
+%token RETURN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
%token REVOKE /* SQL-2003-R */
%token RIGHT /* SQL-2003-R */
%token ROWS_SYM /* SQL-2003-R */
+%token ROWTYPE_ORACLE_SYM /* PLSQL-R */
%token ROW_NUMBER_SYM
%token SECOND_MICROSECOND_SYM
%token SELECT_SYM /* SQL-2003-R */
@@ -623,13 +631,15 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
/*
Keywords that have different reserved status in std/oracle modes.
*/
-%token BODY_SYM /* Oracle-R */
-%token ELSIF_SYM /* Oracle, reserved in PL/SQL*/
-%token GOTO_SYM /* Oracle, reserved in PL/SQL*/
-%token OTHERS_SYM /* SQL-2011-N */
-%token PACKAGE_SYM /* Oracle-R */
-%token RAISE_SYM /* Oracle-PLSQL-R */
-%token ROWTYPE_SYM /* Oracle-PLSQL-R */
+%token <kwd> BODY_MARIADB_SYM // Oracle-R
+%token <kwd> ELSEIF_ORACLE_SYM
+%token <kwd> ELSIF_MARIADB_SYM // PLSQL-R
+%token <kwd> EXCEPTION_ORACLE_SYM // SQL-2003-N, PLSQL-R
+%token <kwd> GOTO_MARIADB_SYM // Oracle-R
+%token <kwd> OTHERS_MARIADB_SYM // SQL-2011-N, PLSQL-R
+%token <kwd> PACKAGE_MARIADB_SYM // Oracle-R
+%token <kwd> RAISE_MARIADB_SYM // PLSQL-R
+%token <kwd> ROWTYPE_MARIADB_SYM // PLSQL-R
/*
Non-reserved keywords
@@ -654,7 +664,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> AVG_ROW_LENGTH
%token <kwd> AVG_SYM /* SQL-2003-N */
%token <kwd> BACKUP_SYM
-%token <kwd> BEGIN_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> BEGIN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> BEGIN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */
%token <kwd> BINLOG_SYM
%token <kwd> BIT_SYM /* MYSQL-FUNC */
%token <kwd> BLOCK_SYM
@@ -673,11 +684,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> CIPHER_SYM
%token <kwd> CLASS_ORIGIN_SYM /* SQL-2003-N */
%token <kwd> CLIENT_SYM
-%token <kwd> CLOB /* SQL-2003-R */
+%token <kwd> CLOB_MARIADB_SYM /* SQL-2003-R */
+%token <kwd> CLOB_ORACLE_SYM /* Oracle-R */
%token <kwd> CLOSE_SYM /* SQL-2003-R */
%token <kwd> COALESCE /* SQL-2003-N */
%token <kwd> CODE_SYM
%token <kwd> COLLATION_SYM /* SQL-2003-N */
+%token <kwd> COLON_ORACLE_SYM /* INTERNAL */
%token <kwd> COLUMNS
%token <kwd> COLUMN_ADD_SYM
%token <kwd> COLUMN_CHECK_SYM
@@ -714,7 +727,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> DATE_SYM /* SQL-2003-R, Oracle-R, PLSQL-R */
%token <kwd> DAY_SYM /* SQL-2003-R */
%token <kwd> DEALLOCATE_SYM /* SQL-2003-R */
-%token <kwd> DECODE_SYM /* Oracle function, non-reserved */
+%token <kwd> DECODE_MARIADB_SYM /* Function, non-reserved */
+%token <kwd> DECODE_ORACLE_SYM /* Function, non-reserved */
%token <kwd> DEFINER_SYM
%token <kwd> DELAYED_SYM
%token <kwd> DELAY_KEY_WRITE_SYM
@@ -744,8 +758,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> EXAMINED_SYM
%token <kwd> EXCLUDE_SYM /* SQL-2011-N */
%token <kwd> EXECUTE_SYM /* SQL-2003-R */
-%token <kwd> EXCEPTION_SYM /* SQL-2003-N, Oracle-PLSQL-R */
-%token <kwd> EXIT_SYM
+%token <kwd> EXCEPTION_MARIADB_SYM /* SQL-2003-N, PLSQL-R */
+%token <kwd> EXIT_MARIADB_SYM /* PLSQL-R */
+%token <kwd> EXIT_ORACLE_SYM /* PLSQL-R */
%token <kwd> EXPANSION_SYM
%token <kwd> EXPORT_SYM
%token <kwd> EXTENDED_SYM
@@ -762,7 +777,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> FORMAT_SYM
%token <kwd> FOUND_SYM /* SQL-2003-R */
%token <kwd> FULL /* SQL-2003-R */
-%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-PLSQL-R */
+%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */
%token <kwd> GENERAL
%token <kwd> GENERATED_SYM
%token <kwd> GEOMETRYCOLLECTION
@@ -875,7 +890,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> NOMINVALUE_SYM
%token <kwd> NO_WAIT_SYM
%token <kwd> NOWAIT_SYM
-%token <kwd> NUMBER_SYM /* SQL-2003-N, Oracle-R, PLSQL-R */
+%token <kwd> NUMBER_MARIADB_SYM /* SQL-2003-N */
+%token <kwd> NUMBER_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> NVARCHAR_SYM
%token <kwd> OF_SYM /* SQL-1992-R, Oracle-R */
%token <kwd> OFFSET_SYM
@@ -917,7 +933,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> QUARTER_SYM
%token <kwd> QUERY_SYM
%token <kwd> QUICK
-%token <kwd> RAW /* Oracle-R */
+%token <kwd> RAW_MARIADB_SYM
+%token <kwd> RAW_ORACLE_SYM /* Oracle-R */
%token <kwd> READ_ONLY_SYM
%token <kwd> REBUILD_SYM
%token <kwd> RECOVER_SYM
@@ -983,6 +1000,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> SQL_CALC_FOUND_ROWS
%token <kwd> SQL_NO_CACHE_SYM
%token <kwd> SQL_THREAD
+%token <kwd> STAGE_SYM
%token <kwd> STARTS_SYM
%token <kwd> START_SYM /* SQL-2003-R */
%token <kwd> STATEMENT_SYM
@@ -1036,7 +1054,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> USER_SYM /* SQL-2003-R */
%token <kwd> USE_FRM
%token <kwd> VALUE_SYM /* SQL-2003-R */
-%token <kwd> VARCHAR2 /* Oracle-R, PLSQL-R */
+%token <kwd> VARCHAR2_MARIADB_SYM
+%token <kwd> VARCHAR2_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> VARIABLES
%token <kwd> VERSIONING_SYM /* SQL-2011-R */
%token <kwd> VIA_SYM
@@ -1085,7 +1104,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left '&'
%left SHIFT_LEFT SHIFT_RIGHT
%left '-' '+' ORACLE_CONCAT_SYM
-%left '*' '/' DIV_SYM MOD_SYM
+%left '*' '/' '%' DIV_SYM MOD_SYM
%left '^'
%left MYSQL_CONCAT_SYM
%left NEG '~' NOT2_SYM BINARY
@@ -1104,7 +1123,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
SELECT TIMESTAMP '2001-01-01 10:20:30';
SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP CONCAT(@date,' ',@time);
- - PERIOD: identifier, period for sytem time:
+ - PERIOD: identifier, period for system time:
SELECT period FROM t1;
ALTER TABLE DROP PERIOD FOR SYSTEM TIME;
@@ -1116,7 +1135,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
SELECT user FROM t1;
KILL USER foo;
- Note, we need here only tokens that cause shirt/reduce conflicts
+ Note, we need here only tokens that cause shift/reduce conflicts
with keyword identifiers. For example:
opt_clause1: %empty | KEYWORD ... ;
clause2: opt_clause1 ident;
@@ -1202,6 +1221,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident
label_ident
sp_decl_ident
+ ident_set_usual_case
ident_or_empty
ident_table_alias
ident_sysvar_name
@@ -1225,6 +1245,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_data_type
keyword_ident
keyword_label
+ keyword_set_special_case
+ keyword_set_usual_case
keyword_sp_block_section
keyword_sp_decl
keyword_sp_head
@@ -1247,7 +1269,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
remember_name remember_end remember_end_opt
remember_tok_start remember_tok_end
wild_and_where
- colon_with_pos
%type <const_simple_string>
field_length opt_field_length opt_field_length_default_1
@@ -1370,7 +1391,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <item_list>
expr_list opt_udf_expr_list udf_expr_list when_list when_list_opt_else
ident_list ident_list_arg opt_expr_list
- decode_when_list
+ decode_when_list_oracle
%type <sp_cursor_stmt>
sp_cursor_stmt_lex
@@ -1484,12 +1505,12 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <select_order> opt_order_clause order_clause order_list
%type <NONE>
- analyze_stmt_command
+ analyze_stmt_command backup backup_statements
query verb_clause create change select select_into
do drop insert replace insert2
insert_values update delete truncate rename compound_statement
show describe load alter optimize keycache preload flush
- reset purge commit rollback savepoint release
+ reset purge begin_stmt_mariadb commit rollback savepoint release
slave master_def master_defs master_file_def slave_until_opts
repair analyze opt_with_admin opt_with_admin_option
analyze_table_list analyze_table_elem_spec
@@ -1502,8 +1523,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
assign_to_keycache_parts
preload_list preload_list_or_parts preload_keys preload_keys_parts
select_item_list select_item values_list no_braces
- no_braces_with_names opt_values_with_names values_with_names
delete_limit_clause fields opt_values values
+ no_braces_with_names opt_values_with_names values_with_names
procedure_list procedure_list2 procedure_item
field_def handler opt_generated_always
opt_ignore opt_column opt_restrict
@@ -1563,17 +1584,19 @@ END_OF_INPUT
%type <NONE> sp_labeled_control sp_unlabeled_control
%type <NONE> sp_labeled_block sp_unlabeled_block
%type <NONE> sp_labelable_stmt
-%type <NONE> sp_proc_stmt_continue
-%type <NONE> sp_proc_stmt_exit
+%type <NONE> sp_proc_stmt_continue_oracle
+%type <NONE> sp_proc_stmt_exit_oracle
%type <NONE> sp_proc_stmt_leave
%type <NONE> sp_proc_stmt_iterate
-%type <NONE> sp_proc_stmt_goto
+%type <NONE> sp_proc_stmt_goto_oracle
%type <NONE> sp_proc_stmt_open sp_proc_stmt_fetch sp_proc_stmt_close
%type <NONE> case_stmt_specification
%type <NONE> loop_body while_body repeat_body
%type <num> view_algorithm view_check_option
%type <view_suid> view_suid opt_view_suid
+
+%type <plsql_cursor_attr> plsql_cursor_attr
%type <sp_suid> sp_suid
%type <num> sp_decl_idents sp_decl_idents_init_vars
@@ -1591,7 +1614,6 @@ END_OF_INPUT
%type <spblock_handlers> sp_block_statements_and_exceptions
%type <spblock_handlers> package_implementation_executable_section
%type <sp_instr_addr> sp_instr_addr
-%type <sp_cursor_name_and_offset> sp_cursor_name_and_offset
%type <num> opt_exception_clause exception_handlers
%type <lex> remember_lex package_routine_lex
package_specification_function
@@ -1607,7 +1629,7 @@ END_OF_INPUT
%type <num> index_hint_clause normal_join inner_join
%type <filetype> data_or_xml
-%type <NONE> signal_stmt resignal_stmt raise_stmt
+%type <NONE> signal_stmt resignal_stmt raise_stmt_oracle
%type <diag_condition_item_name> signal_condition_information_item_name
%type <trg_execution_order> trigger_follows_precedes_clause;
@@ -1721,6 +1743,7 @@ opt_end_of_input:
verb_clause:
statement
+ | begin_stmt_mariadb
| compound_statement
;
@@ -1729,6 +1752,7 @@ statement:
alter
| analyze
| analyze_stmt_command
+ | backup
| binlog_base64_event
| call
| change
@@ -1760,7 +1784,7 @@ statement:
| preload
| prepare
| purge
- | raise_stmt
+ | raise_stmt_oracle
| release
| rename
| repair
@@ -2141,7 +2165,7 @@ create:
LEX *lex= thd->lex;
if (!lex->first_select_lex()->
add_table_to_list(thd, $6, NULL, TL_OPTION_UPDATING,
- TL_WRITE, MDL_EXCLUSIVE))
+ TL_WRITE, MDL_SHARED_UPGRADABLE))
MYSQL_YYABORT;
lex->alter_info.reset();
/*
@@ -2414,7 +2438,7 @@ create:
| create_or_replace { Lex->set_command(SQLCOM_CREATE_SERVER, $1); }
server_def
{ }
- | create_or_replace definer_opt PACKAGE_SYM
+ | create_or_replace definer_opt PACKAGE_ORACLE_SYM
opt_if_not_exists sp_name opt_create_package_chistics_init
sp_tail_is
remember_name
@@ -2434,7 +2458,7 @@ create:
if (unlikely(Lex->create_package_finalize(thd, $5, $13, $8, $12)))
MYSQL_YYABORT;
}
- | create_or_replace definer_opt PACKAGE_SYM BODY_SYM
+ | create_or_replace definer_opt PACKAGE_ORACLE_SYM BODY_ORACLE_SYM
opt_if_not_exists sp_name opt_create_package_chistics_init
sp_tail_is
remember_name
@@ -2474,11 +2498,11 @@ package_implementation_executable_section:
MYSQL_YYABORT;
$$.init(0);
}
- | BEGIN_SYM sp_block_statements_and_exceptions END { $$= $2; }
+ | BEGIN_ORACLE_SYM sp_block_statements_and_exceptions END { $$= $2; }
;
/*
- Inside CREATE PACKATE BODY, package-wide items (e.g. variables)
+ Inside CREATE PACKAGE BODY, package-wide items (e.g. variables)
must be declared before routine definitions.
*/
package_implementation_declare_section:
@@ -3153,22 +3177,22 @@ sp_param_name_and_type:
if (unlikely(Lex->sp_param_fill_definition($$= $1)))
MYSQL_YYABORT;
}
- | sp_param_name sp_decl_ident '.' ident '%' TYPE_SYM
+ | sp_param_name sp_decl_ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM
{
if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4)))
MYSQL_YYABORT;
}
- | sp_param_name sp_decl_ident '.' ident '.' ident '%' TYPE_SYM
+ | sp_param_name sp_decl_ident '.' ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM
{
if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4, $6)))
MYSQL_YYABORT;
}
- | sp_param_name sp_decl_ident '%' ROWTYPE_SYM
+ | sp_param_name sp_decl_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM
{
if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2)))
MYSQL_YYABORT;
}
- | sp_param_name sp_decl_ident '.' ident '%' ROWTYPE_SYM
+ | sp_param_name sp_decl_ident '.' ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM
{
if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2, $4)))
MYSQL_YYABORT;
@@ -3198,25 +3222,25 @@ sp_pdparam:
if (unlikely(Lex->sp_param_fill_definition($1)))
MYSQL_YYABORT;
}
- | sp_param_name sp_opt_inout sp_decl_ident '.' ident '%' TYPE_SYM
+ | sp_param_name sp_opt_inout sp_decl_ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM
{
$1->mode= $2;
if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5)))
MYSQL_YYABORT;
}
- | sp_param_name sp_opt_inout sp_decl_ident '.' ident '.' ident '%' TYPE_SYM
+ | sp_param_name sp_opt_inout sp_decl_ident '.' ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM
{
$1->mode= $2;
if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5, $7)))
MYSQL_YYABORT;
}
- | sp_param_name sp_opt_inout sp_decl_ident '%' ROWTYPE_SYM
+ | sp_param_name sp_opt_inout sp_decl_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM
{
$1->mode= $2;
if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3)))
MYSQL_YYABORT;
}
- | sp_param_name sp_opt_inout sp_decl_ident '.' ident '%' ROWTYPE_SYM
+ | sp_param_name sp_opt_inout sp_decl_ident '.' ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM
{
$1->mode= $2;
if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3, $5)))
@@ -3421,7 +3445,7 @@ sp_decl_vars:
$$.init_using_vars($1);
}
| sp_decl_idents_init_vars
- optionally_qualified_column_ident '%' TYPE_SYM
+ optionally_qualified_column_ident PERCENT_ORACLE_SYM TYPE_SYM
sp_opt_default
{
if (unlikely(Lex->sp_variable_declarations_with_ref_finalize(thd, $1, $2, $5)))
@@ -3429,7 +3453,7 @@ sp_decl_vars:
$$.init_using_vars($1);
}
| sp_decl_idents_init_vars
- optionally_qualified_column_ident '%' ROWTYPE_SYM
+ optionally_qualified_column_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM
sp_opt_default
{
if (unlikely(Lex->sp_variable_declarations_rowtype_finalize(thd, $1, $2, $5)))
@@ -3455,7 +3479,7 @@ sp_decl_non_handler:
$$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1;
}
- | ident_directly_assignable EXCEPTION_SYM
+ | ident_directly_assignable EXCEPTION_ORACLE_SYM
{
sp_condition_value *spcond= new (thd->mem_root)
sp_condition_value_user_defined();
@@ -3529,8 +3553,10 @@ sp_cursor_stmt:
;
sp_handler_type:
- EXIT_SYM { $$= sp_handler::EXIT; }
- | CONTINUE_SYM { $$= sp_handler::CONTINUE; }
+ EXIT_MARIADB_SYM { $$= sp_handler::EXIT; }
+ | CONTINUE_MARIADB_SYM { $$= sp_handler::CONTINUE; }
+ | EXIT_ORACLE_SYM { $$= sp_handler::EXIT; }
+ | CONTINUE_ORACLE_SYM { $$= sp_handler::CONTINUE; }
/*| UNDO_SYM { QQ No yet } */
;
@@ -3600,7 +3626,7 @@ sp_hcond:
}
| ident /* CONDITION name */
{
- $$= Lex->spcont->find_declared_or_predefined_condition(&$1);
+ $$= Lex->spcont->find_declared_or_predefined_condition(thd, &$1);
if (unlikely($$ == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
}
@@ -3616,7 +3642,13 @@ sp_hcond:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | OTHERS_SYM /* All other SQLSTATEs */
+ | SQLEXCEPTION_SYM /* All other SQLSTATEs */
+ {
+ $$= new (thd->mem_root) sp_condition_value(sp_condition_value::EXCEPTION);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | OTHERS_ORACLE_SYM /* All other SQLSTATEs */
{
$$= new (thd->mem_root) sp_condition_value(sp_condition_value::EXCEPTION);
if (unlikely($$ == NULL))
@@ -3625,13 +3657,13 @@ sp_hcond:
;
-raise_stmt:
- RAISE_SYM opt_set_signal_information
+raise_stmt_oracle:
+ RAISE_ORACLE_SYM opt_set_signal_information
{
if (unlikely(Lex->add_resignal_statement(thd, NULL)))
MYSQL_YYABORT;
}
- | RAISE_SYM signal_value opt_set_signal_information
+ | RAISE_ORACLE_SYM signal_value opt_set_signal_information
{
if (unlikely(Lex->add_signal_statement(thd, $2)))
MYSQL_YYABORT;
@@ -3655,7 +3687,7 @@ signal_value:
/* SIGNAL foo cannot be used outside of stored programs */
if (unlikely(lex->spcont == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
- cond= lex->spcont->find_declared_or_predefined_condition(&$1);
+ cond= lex->spcont->find_declared_or_predefined_condition(thd, &$1);
if (unlikely(cond == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
if (unlikely(!cond->has_sql_state()))
@@ -3827,6 +3859,7 @@ statement_information_item:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ ;
simple_target_specification:
ident_cli
@@ -3843,7 +3876,9 @@ simple_target_specification:
;
statement_information_item_name:
- NUMBER_SYM
+ NUMBER_MARIADB_SYM
+ { $$= Statement_information_item::NUMBER; }
+ | NUMBER_ORACLE_SYM
{ $$= Statement_information_item::NUMBER; }
| ROW_COUNT_SYM
{ $$= Statement_information_item::ROW_COUNT; }
@@ -3881,6 +3916,7 @@ condition_information_item:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ ;
condition_information_item_name:
CLASS_ORIGIN_SYM
@@ -3964,11 +4000,11 @@ sp_proc_stmt:
sp_labelable_stmt:
sp_proc_stmt_statement
- | sp_proc_stmt_continue
- | sp_proc_stmt_exit
+ | sp_proc_stmt_continue_oracle
+ | sp_proc_stmt_exit_oracle
| sp_proc_stmt_leave
| sp_proc_stmt_iterate
- | sp_proc_stmt_goto
+ | sp_proc_stmt_goto_oracle
| sp_proc_stmt_open
| sp_proc_stmt_fetch
| sp_proc_stmt_close
@@ -4023,50 +4059,20 @@ sp_proc_stmt_statement:
}
sp_statement
{
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
- sp_head *sp= lex->sphead;
-
- sp->m_flags|= sp_get_flags_for_command(lex);
- /* "USE db" doesn't work in a procedure */
- if (unlikely(lex->sql_command == SQLCOM_CHANGE_DB))
- my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "USE"));
- /*
- Don't add an instruction for SET statements, since all
- instructions for them were already added during processing
- of "set" rule.
- */
- DBUG_ASSERT(lex->sql_command != SQLCOM_SET_OPTION ||
- lex->var_list.is_empty());
- if (lex->sql_command != SQLCOM_SET_OPTION)
- {
- sp_instr_stmt *i=new (thd->mem_root)
- sp_instr_stmt(sp->instructions(), lex->spcont, lex);
- if (unlikely(i == NULL))
- MYSQL_YYABORT;
-
- /*
- Extract the query statement from the tokenizer. The
- end is either lex->ptr, if there was no lookahead,
- lex->tok_end otherwise.
- */
- if (yychar == YYEMPTY)
- i->m_query.length= lip->get_ptr() - sp->m_tmp_query;
- else
- i->m_query.length= lip->get_tok_start() - sp->m_tmp_query;;
- if (unlikely(!(i->m_query.str= strmake_root(thd->mem_root,
- sp->m_tmp_query,
- i->m_query.length))) ||
- unlikely(sp->add_instr(i)))
- MYSQL_YYABORT;
- }
- if (unlikely(sp->restore_lex(thd)))
+ if (Lex->sp_proc_stmt_statement_finalize(thd, yychar == YYEMPTY) ||
+ Lex->sphead->restore_lex(thd))
MYSQL_YYABORT;
}
;
+
+RETURN_ALLMODES_SYM:
+ RETURN_MARIADB_SYM
+ | RETURN_ORACLE_SYM
+ ;
+
sp_proc_stmt_return:
- RETURN_SYM
+ RETURN_ALLMODES_SYM
{ Lex->sphead->reset_lex(thd); }
expr
{
@@ -4077,7 +4083,7 @@ sp_proc_stmt_return:
unlikely(sp->restore_lex(thd)))
MYSQL_YYABORT;
}
- | RETURN_SYM
+ | RETURN_ORACLE_SYM
{
LEX *lex= Lex;
sp_head *sp= lex->sphead;
@@ -4093,24 +4099,24 @@ reset_lex_expr:
{ $$= $2; }
;
-sp_proc_stmt_exit:
- EXIT_SYM
+sp_proc_stmt_exit_oracle:
+ EXIT_ORACLE_SYM
{
if (unlikely(Lex->sp_exit_statement(thd, NULL)))
MYSQL_YYABORT;
}
- | EXIT_SYM label_ident
+ | EXIT_ORACLE_SYM label_ident
{
if (unlikely(Lex->sp_exit_statement(thd, &$2, NULL)))
MYSQL_YYABORT;
}
- | EXIT_SYM WHEN_SYM reset_lex_expr
+ | EXIT_ORACLE_SYM WHEN_SYM reset_lex_expr
{
if (Lex->sp_exit_statement(thd, $3) ||
Lex->sphead->restore_lex(thd))
MYSQL_YYABORT;
}
- | EXIT_SYM label_ident WHEN_SYM reset_lex_expr
+ | EXIT_ORACLE_SYM label_ident WHEN_SYM reset_lex_expr
{
if (Lex->sp_exit_statement(thd, &$2, $4) ||
Lex->sphead->restore_lex(thd))
@@ -4118,24 +4124,24 @@ sp_proc_stmt_exit:
}
;
-sp_proc_stmt_continue:
- CONTINUE_SYM
+sp_proc_stmt_continue_oracle:
+ CONTINUE_ORACLE_SYM
{
if (unlikely(Lex->sp_continue_statement(thd, NULL)))
MYSQL_YYABORT;
}
- | CONTINUE_SYM label_ident
+ | CONTINUE_ORACLE_SYM label_ident
{
if (unlikely(Lex->sp_continue_statement(thd, &$2, NULL)))
MYSQL_YYABORT;
}
- | CONTINUE_SYM WHEN_SYM reset_lex_expr
+ | CONTINUE_ORACLE_SYM WHEN_SYM reset_lex_expr
{
if (Lex->sp_continue_statement(thd, $3) ||
Lex->sphead->restore_lex(thd))
MYSQL_YYABORT;
}
- | CONTINUE_SYM label_ident WHEN_SYM reset_lex_expr
+ | CONTINUE_ORACLE_SYM label_ident WHEN_SYM reset_lex_expr
{
if (Lex->sp_continue_statement(thd, &$2, $4) ||
Lex->sphead->restore_lex(thd))
@@ -4160,8 +4166,8 @@ sp_proc_stmt_iterate:
}
;
-sp_proc_stmt_goto:
- GOTO_SYM label_ident
+sp_proc_stmt_goto_oracle:
+ GOTO_ORACLE_SYM label_ident
{
if (unlikely(Lex->sp_goto_statement(thd, &$2)))
MYSQL_YYABORT;
@@ -4358,7 +4364,7 @@ sp_if:
sp_elseifs:
/* Empty */
- | ELSIF_SYM sp_if
+ | ELSIF_ORACLE_SYM sp_if
| ELSE sp_proc_stmts1_implicit_block
;
@@ -4535,7 +4541,7 @@ sp_block_label:
sp_labeled_block:
sp_block_label
- BEGIN_SYM
+ BEGIN_ORACLE_SYM
{
Lex->sp_block_init(thd, &$1);
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
@@ -4549,7 +4555,7 @@ sp_labeled_block:
MYSQL_YYABORT;
}
| sp_block_label
- DECLARE_SYM
+ DECLARE_ORACLE_SYM
{
Lex->sp_block_init(thd, &$1);
}
@@ -4558,7 +4564,7 @@ sp_labeled_block:
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
- BEGIN_SYM
+ BEGIN_ORACLE_SYM
sp_block_statements_and_exceptions
END
sp_opt_label
@@ -4575,7 +4581,7 @@ opt_not_atomic:
;
sp_unlabeled_block:
- BEGIN_SYM opt_not_atomic
+ BEGIN_ORACLE_SYM opt_not_atomic
{
if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
@@ -4589,7 +4595,7 @@ sp_unlabeled_block:
if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4))))
MYSQL_YYABORT;
}
- | DECLARE_SYM
+ | DECLARE_ORACLE_SYM
{
if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
@@ -4600,7 +4606,7 @@ sp_unlabeled_block:
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
- BEGIN_SYM
+ BEGIN_ORACLE_SYM
sp_block_statements_and_exceptions
END
{
@@ -4623,7 +4629,7 @@ sp_body:
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
- BEGIN_SYM
+ BEGIN_ORACLE_SYM
sp_block_statements_and_exceptions
{
$2.hndlrs+= $5.hndlrs;
@@ -4649,8 +4655,8 @@ sp_block_statements_and_exceptions:
;
opt_exception_clause:
- /* Empty */ { $$= 0; }
- | EXCEPTION_SYM exception_handlers { $$= $2; }
+ /* Empty */ { $$= 0; }
+ | EXCEPTION_ORACLE_SYM exception_handlers { $$= $2; }
;
exception_handlers:
@@ -4691,16 +4697,13 @@ sp_for_loop_bounds:
IN_SYM opt_sp_for_loop_direction for_loop_bound_expr
DOT_DOT_SYM for_loop_bound_expr
{
- $$.m_direction= $2;
- $$.m_index= $3;
- $$.m_upper_bound= $5;
- $$.m_implicit_cursor= false;
+ $$= Lex_for_loop_bounds_intrange($2, $3, $5);
}
| IN_SYM opt_sp_for_loop_direction for_loop_bound_expr
{
$$.m_direction= $2;
$$.m_index= $3;
- $$.m_upper_bound= NULL;
+ $$.m_target_bound= NULL;
$$.m_implicit_cursor= false;
}
| IN_SYM opt_sp_for_loop_direction '(' sp_cursor_stmt ')'
@@ -5272,7 +5275,6 @@ create_select_query_expression:
SELECT_LEX *first_select= $3->first_select();
$3->set_with_clause($2);
$2->attach_to(first_select);
-
if (Lex->parsed_insert_select(first_select))
MYSQL_YYABORT;
}
@@ -6855,7 +6857,7 @@ field_type_numeric:
}
| DECIMAL_SYM float_options field_options
{ $$.set(&type_handler_newdecimal, $2);}
- | NUMBER_SYM float_options field_options
+ | NUMBER_ORACLE_SYM float_options field_options
{
if ($2.length() != 0)
$$.set(&type_handler_newdecimal, $2);
@@ -6888,7 +6890,7 @@ field_type_string:
{
$$.set(&type_handler_varchar, $2);
}
- | VARCHAR2 field_length opt_binary
+ | VARCHAR2_ORACLE_SYM field_length opt_binary
{
$$.set(&type_handler_varchar, $2);
}
@@ -6902,7 +6904,7 @@ field_type_string:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
- | RAW field_length
+ | RAW_ORACLE_SYM field_length
{
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
@@ -6929,7 +6931,7 @@ sp_param_field_type_string:
{
$$.set(&type_handler_varchar, $2);
}
- | VARCHAR2 opt_field_length_default_sp_param_varchar opt_binary
+ | VARCHAR2_ORACLE_SYM opt_field_length_default_sp_param_varchar opt_binary
{
$$.set(&type_handler_varchar, $2);
}
@@ -6943,7 +6945,7 @@ sp_param_field_type_string:
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
- | RAW opt_field_length_default_sp_param_varchar
+ | RAW_ORACLE_SYM opt_field_length_default_sp_param_varchar
{
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
@@ -7015,7 +7017,12 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_tiny_blob);
}
- | BLOB_SYM opt_field_length
+ | BLOB_MARIADB_SYM opt_field_length
+ {
+ Lex->charset=&my_charset_bin;
+ $$.set(&type_handler_blob, $2);
+ }
+ | BLOB_ORACLE_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
@@ -7056,7 +7063,7 @@ field_type_lob:
{ $$.set(&type_handler_medium_blob); }
| LONGTEXT opt_binary
{ $$.set(&type_handler_long_blob); }
- | CLOB opt_binary
+ | CLOB_ORACLE_SYM opt_binary
{ $$.set(&type_handler_long_blob); }
| LONG_SYM opt_binary
{ $$.set(&type_handler_medium_blob); }
@@ -7164,11 +7171,12 @@ field_length:
opt_field_length:
/* empty */ { $$= (char*) 0; /* use default length */ }
| field_length { $$= $1; }
+ ;
opt_field_length_default_1:
/* empty */ { $$= (char*) "1"; }
| field_length { $$= $1; }
-
+ ;
/*
In sql_mode=ORACLE, real size of VARCHAR and CHAR with no length
@@ -7190,10 +7198,12 @@ opt_field_length_default_1:
opt_field_length_default_sp_param_varchar:
/* empty */ { $$.set("4000", "4000"); }
| field_length { $$.set($1, NULL); }
+ ;
opt_field_length_default_sp_param_char:
/* empty */ { $$.set("2000", "2000"); }
| field_length { $$.set($1, NULL); }
+ ;
opt_precision:
/* empty */ { $$.set(0, 0); }
@@ -7667,12 +7677,14 @@ fulltext_key_opts:
opt_USING_key_algorithm:
/* Empty*/ { $$= HA_KEY_ALG_UNDEF; }
| USING btree_or_rtree { $$= $2; }
+ ;
/* TYPE is a valid identifier, so it's handled differently than USING */
opt_key_algorithm_clause:
/* Empty*/ { $$= HA_KEY_ALG_UNDEF; }
| USING btree_or_rtree { $$= $2; }
| TYPE_SYM btree_or_rtree { $$= $2; }
+ ;
key_using_alg:
USING btree_or_rtree
@@ -8425,7 +8437,6 @@ alter_list_item:
if (lex->first_select_lex()->db.str == NULL &&
lex->copy_db_to(&lex->first_select_lex()->db))
MYSQL_YYABORT;
-
if (unlikely(check_table_name($3->table.str,$3->table.length,
FALSE)) ||
($3->db.str && unlikely(check_db_name((LEX_STRING*) &$3->db))))
@@ -8489,6 +8500,7 @@ opt_index_lock_algorithm:
| alter_algorithm_option
| alter_lock_option alter_algorithm_option
| alter_algorithm_option alter_lock_option
+ ;
alter_algorithm_option:
ALGORITHM_SYM opt_equal DEFAULT
@@ -8547,7 +8559,7 @@ alter_option:
Lex->alter_info.requested_lock=
Alter_info::ALTER_TABLE_LOCK_NONE;
}
-
+ ;
opt_restrict:
/* empty */ { Lex->drop_mode= DROP_DEFAULT; }
@@ -8814,6 +8826,7 @@ persistent_stat_spec:
{}
| COLUMNS persistent_column_stat_spec INDEXES persistent_index_stat_spec
{}
+ ;
persistent_column_stat_spec:
ALL {}
@@ -9141,7 +9154,6 @@ opt_ignore_leaves:
Select : retrieve data from table
*/
-
select:
query_expression_body
{
@@ -9195,7 +9207,7 @@ simple_table:
query_specification { $$= $1; }
| table_value_constructor { $$= $1; }
;
-
+
table_value_constructor:
VALUES
{
@@ -9208,7 +9220,7 @@ table_value_constructor:
MYSQL_YYABORT;
}
;
-
+
query_specification_start:
SELECT_SYM
{
@@ -9258,8 +9270,9 @@ select_into_query_specification:
opt_from_clause:
/* Empty */
| from_clause
- ;
-
+ ;
+
+
query_primary:
simple_table
{ $$= $1; }
@@ -9492,7 +9505,6 @@ select_lock_type:
}
;
-
opt_select_lock_type:
/* empty */
{
@@ -9504,7 +9516,6 @@ opt_select_lock_type:
}
;
-
opt_lock_wait_timeout_new:
/* empty */
{
@@ -9565,13 +9576,6 @@ select_item:
}
;
-colon_with_pos:
- ':'
- {
- $$= (char *) YYLIP->get_tok_start();
- }
- ;
-
remember_tok_start:
{
$$= (char*) YYLIP->get_tok_start();
@@ -9616,13 +9620,13 @@ select_alias:
opt_default_time_precision:
/* empty */ { $$= NOT_FIXED_DEC; }
| '(' ')' { $$= NOT_FIXED_DEC; }
- | '(' real_ulong_num ')' { $$= $2; };
+ | '(' real_ulong_num ')' { $$= $2; }
;
opt_time_precision:
/* empty */ { $$= 0; }
| '(' ')' { $$= 0; }
- | '(' real_ulong_num ')' { $$= $2; };
+ | '(' real_ulong_num ')' { $$= $2; }
;
optional_braces:
@@ -10001,6 +10005,12 @@ bit_expr:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ | bit_expr '%' bit_expr %prec '%'
+ {
+ $$= new (thd->mem_root) Item_func_mod(thd, $1, $3);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
| bit_expr DIV_SYM bit_expr %prec DIV_SYM
{
$$= new (thd->mem_root) Item_func_int_div(thd, $1, $3);
@@ -10121,6 +10131,7 @@ dyncall_create_element:
else
$$->len= 0;
}
+ ;
dyncall_create_list:
dyncall_create_element
@@ -10137,44 +10148,23 @@ dyncall_create_list:
}
;
-sp_cursor_name_and_offset:
- ident
- {
- LEX *lex= Lex;
- $$.name= $1;
- if (unlikely(!lex->spcont ||
- !lex->spcont->find_cursor(&$1, &$$.offset, false)))
- my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $1.str));
- }
+
+plsql_cursor_attr:
+ ISOPEN_SYM { $$= PLSQL_CURSOR_ATTR_ISOPEN; }
+ | FOUND_SYM { $$= PLSQL_CURSOR_ATTR_FOUND; }
+ | NOTFOUND_SYM { $$= PLSQL_CURSOR_ATTR_NOTFOUND; }
+ | ROWCOUNT_SYM { $$= PLSQL_CURSOR_ATTR_ROWCOUNT; }
;
explicit_cursor_attr:
- sp_cursor_name_and_offset '%' ISOPEN_SYM
+ ident PERCENT_ORACLE_SYM plsql_cursor_attr
{
- if (unlikely(!($$= new (thd->mem_root)
- Item_func_cursor_isopen(thd, &$1.name, $1.offset))))
- MYSQL_YYABORT;
- }
- | sp_cursor_name_and_offset '%' FOUND_SYM
- {
- if (unlikely(!($$= new (thd->mem_root)
- Item_func_cursor_found(thd, &$1.name, $1.offset))))
- MYSQL_YYABORT;
- }
- | sp_cursor_name_and_offset '%' NOTFOUND_SYM
- {
- if (unlikely(!($$= new (thd->mem_root)
- Item_func_cursor_notfound(thd, &$1.name, $1.offset))))
- MYSQL_YYABORT;
- }
- | sp_cursor_name_and_offset '%' ROWCOUNT_SYM
- {
- if (unlikely(!($$= new (thd->mem_root)
- Item_func_cursor_rowcount(thd, &$1.name, $1.offset))))
+ if (unlikely(!($$= Lex->make_item_plsql_cursor_attr(thd, &$1, $3))))
MYSQL_YYABORT;
}
;
+
trim_operands:
expr { $$.set(TRIM_BOTH, $1); }
| LEADING expr FROM expr { $$.set(TRIM_LEADING, $2, $4); }
@@ -10295,24 +10285,6 @@ column_default_non_parenthesized_expr:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | DATE_FORMAT_SYM '(' expr ',' expr ')'
- {
- $$= new (thd->mem_root) Item_func_date_format(thd, $3, $5);
- if (unlikely($$ == NULL))
- MYSQL_YYABORT;
- }
- | DATE_FORMAT_SYM '(' expr ',' expr ',' expr ')'
- {
- $$= new (thd->mem_root) Item_func_date_format(thd, $3, $5, $7);
- if (unlikely($$ == NULL))
- MYSQL_YYABORT;
- }
- | DECODE_SYM '(' expr ',' decode_when_list ')'
- {
- $5->push_front($3, thd->mem_root);
- if (unlikely(!($$= new (thd->mem_root) Item_func_decode_oracle(thd, *$5))))
- MYSQL_YYABORT;
- }
| DEFAULT '(' simple_ident ')'
{
Item_splocal *il= $3->get_item_splocal();
@@ -10557,7 +10529,7 @@ function_call_keyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | SQL_SYM '%' ROWCOUNT_SYM
+ | SQL_SYM PERCENT_ORACLE_SYM ROWCOUNT_SYM
{
$$= new (thd->mem_root) Item_func_oracle_sql_rowcount(thd);
if (unlikely($$ == NULL))
@@ -10649,6 +10621,30 @@ function_call_nonkeyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
+ | DATE_FORMAT_SYM '(' expr ',' expr ')'
+ {
+ $$= new (thd->mem_root) Item_func_date_format(thd, $3, $5);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | DATE_FORMAT_SYM '(' expr ',' expr ',' expr ')'
+ {
+ $$= new (thd->mem_root) Item_func_date_format(thd, $3, $5, $7);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | DECODE_MARIADB_SYM '(' expr ',' expr ')'
+ {
+ $$= new (thd->mem_root) Item_func_decode(thd, $3, $5);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | DECODE_ORACLE_SYM '(' expr ',' decode_when_list_oracle ')'
+ {
+ $5->push_front($3, thd->mem_root);
+ if (unlikely(!($$= new (thd->mem_root) Item_func_decode_oracle(thd, *$5))))
+ MYSQL_YYABORT;
+ }
| EXTRACT_SYM '(' interval FROM expr ')'
{
$$=new (thd->mem_root) Item_extract(thd, $3, $5);
@@ -11390,6 +11386,21 @@ window_func:
{
((Item_sum *) $1)->mark_as_window_func_sum_expr();
}
+ |
+ function_call_generic
+ {
+ Item* item = (Item*)$1;
+ /* Only UDF aggregate here possible */
+ if ((item == NULL) ||
+ (item->type() != Item::SUM_FUNC_ITEM)
+ || (((Item_sum *)item)->sum_func() != Item_sum::UDF_SUM_FUNC))
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
+
+ ((Item_sum *) $1)->mark_as_window_func_sum_expr();
+ }
;
simple_window_func:
@@ -11630,7 +11641,7 @@ opt_gconcat_separator:
opt_gorder_clause:
/* empty */
- | ORDER_SYM BY gorder_list;
+ | ORDER_SYM BY gorder_list
;
gorder_list:
@@ -11716,7 +11727,7 @@ cast_type:
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
- | VARCHAR2 field_length
+ | VARCHAR2_ORACLE_SYM field_length
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
@@ -11743,6 +11754,10 @@ cast_type_temporal:
DATE_SYM { $$.set(&type_handler_newdate); }
| TIME_SYM opt_field_length { $$.set(&type_handler_time2, 0, $2); }
| DATETIME opt_field_length { $$.set(&type_handler_datetime2, 0, $2); }
+ | INTERVAL_SYM DAY_SECOND_SYM field_length
+ {
+ $$.set(&type_handler_interval_DDhhmmssff, 0, $3);
+ }
;
opt_expr_list:
@@ -11814,7 +11829,7 @@ when_list_opt_else:
}
;
-decode_when_list:
+decode_when_list_oracle:
expr ',' expr
{
$$= new (thd->mem_root) List<Item>;
@@ -11824,7 +11839,7 @@ decode_when_list:
MYSQL_YYABORT;
}
- | decode_when_list ',' expr
+ | decode_when_list_oracle ',' expr
{
$$= $1;
if (unlikely($$->push_back($3, thd->mem_root)))
@@ -12454,6 +12469,7 @@ opt_window_ref:
if (unlikely(thd->lex->win_ref == NULL))
MYSQL_YYABORT;
}
+ ;
opt_window_partition_clause:
/* empty */ { }
@@ -12554,7 +12570,9 @@ opt_window_frame_exclusion:
{ $$= Window_frame::EXCL_GROUP; }
| EXCLUDE_SYM TIES_SYM
{ $$= Window_frame::EXCL_TIES; }
- | EXCLUDE_SYM NO_SYM OTHERS_SYM
+ | EXCLUDE_SYM NO_SYM OTHERS_MARIADB_SYM
+ { $$= Window_frame::EXCL_NONE; }
+ | EXCLUDE_SYM NO_SYM OTHERS_ORACLE_SYM
{ $$= Window_frame::EXCL_NONE; }
;
@@ -12660,6 +12678,7 @@ opt_global_limit_clause:
Select->select_limit= $1.select_limit;
Select->offset_limit= $1.offset_limit;
}
+ ;
limit_options:
limit_option
@@ -12723,6 +12742,7 @@ limit_rows_option:
LEX *lex=Lex;
lex->limit_rows_examined= $1;
}
+ ;
delete_limit_clause:
/* empty */
@@ -12820,6 +12840,7 @@ opt_plus:
int_num:
opt_plus NUM { int error; $$= (int) my_strtoll10($2.str, (char**) 0, &error); }
| '-' NUM { int error; $$= -(int) my_strtoll10($2.str, (char**) 0, &error); }
+ ;
ulong_num:
opt_plus NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); }
@@ -12843,7 +12864,7 @@ longlong_num:
| LONG_NUM { int error; $$= (longlong) my_strtoll10($1.str, (char**) 0, &error); }
| '-' NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); }
| '-' LONG_NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); }
-
+ ;
ulonglong_num:
opt_plus NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); }
@@ -12880,6 +12901,7 @@ bool:
ulong_num { $$= $1 != 0; }
| TRUE_SYM { $$= 1; }
| FALSE_SYM { $$= 0; }
+ ;
procedure_clause:
PROCEDURE_SYM ident /* Procedure name */
@@ -13082,7 +13104,7 @@ drop:
lex->set_command(SQLCOM_DROP_DB, $3);
lex->name= $4;
}
- | DROP PACKAGE_SYM opt_if_exists sp_name
+ | DROP PACKAGE_ORACLE_SYM opt_if_exists sp_name
{
LEX *lex= Lex;
lex->set_command(SQLCOM_DROP_PACKAGE, $3);
@@ -13090,7 +13112,7 @@ drop:
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PACKAGE"));
lex->spname= $4;
}
- | DROP PACKAGE_SYM BODY_SYM opt_if_exists sp_name
+ | DROP PACKAGE_ORACLE_SYM BODY_ORACLE_SYM opt_if_exists sp_name
{
LEX *lex= Lex;
lex->set_command(SQLCOM_DROP_PACKAGE_BODY, $4);
@@ -13279,7 +13301,7 @@ insert:
lex->duplicates= DUP_ERROR;
if (Lex->main_select_push())
MYSQL_YYABORT;
- mysql_init_select(lex);
+ mysql_init_select(lex);
lex->current_select->parsing_place= BEFORE_OPT_LIST;
}
insert_lock_option
@@ -13304,7 +13326,7 @@ replace:
lex->duplicates= DUP_REPLACE;
if (Lex->main_select_push())
MYSQL_YYABORT;
- mysql_init_select(lex);
+ mysql_init_select(lex);
lex->current_select->parsing_place= BEFORE_OPT_LIST;
}
replace_lock_option insert2
@@ -13657,10 +13679,10 @@ delete_part2:
| HISTORY_SYM delete_single_table opt_delete_system_time
{
Lex->last_table()->vers_conditions= Lex->vers_conditions;
+ Lex->pop_select(); //main select
}
;
-
delete_single_table:
FROM table_ident opt_use_partition
{
@@ -13717,7 +13739,6 @@ single_multi:
}
;
-
opt_select_expressions:
/* empty */
| RETURNING_SYM select_item_list
@@ -14155,13 +14176,13 @@ show_param:
lex->sql_command = SQLCOM_SHOW_CREATE_FUNC;
lex->spname= $3;
}
- | CREATE PACKAGE_SYM sp_name
+ | CREATE PACKAGE_ORACLE_SYM sp_name
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE_PACKAGE;
lex->spname= $3;
}
- | CREATE PACKAGE_SYM BODY_SYM sp_name
+ | CREATE PACKAGE_ORACLE_SYM BODY_ORACLE_SYM sp_name
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE_PACKAGE_BODY;
@@ -14200,14 +14221,14 @@ show_param:
if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
- | PACKAGE_SYM STATUS_SYM wild_and_where
+ | PACKAGE_ORACLE_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE;
if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
- | PACKAGE_SYM BODY_SYM STATUS_SYM wild_and_where
+ | PACKAGE_ORACLE_SYM BODY_ORACLE_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE_BODY;
@@ -14224,7 +14245,7 @@ show_param:
Lex->sql_command= SQLCOM_SHOW_FUNC_CODE;
Lex->spname= $3;
}
- | PACKAGE_SYM BODY_SYM CODE_SYM sp_name
+ | PACKAGE_ORACLE_SYM BODY_ORACLE_SYM CODE_SYM sp_name
{
Lex->sql_command= SQLCOM_SHOW_PACKAGE_BODY_CODE;
Lex->spname= $4;
@@ -14521,6 +14542,8 @@ flush_option:
{ Lex->type|= REFRESH_DES_KEY_FILE; }
| RESOURCES
{ Lex->type|= REFRESH_USER_RESOURCES; }
+ | SSL_SYM
+ { Lex->type|= REFRESH_SSL;}
| IDENT_sys remember_tok_start
{
Lex->type|= REFRESH_GENERIC;
@@ -14542,6 +14565,37 @@ opt_table_list:
| table_list {}
;
+backup:
+ BACKUP_SYM backup_statements {}
+ ;
+
+backup_statements:
+ STAGE_SYM ident
+ {
+ int type;
+ if (unlikely(Lex->sphead))
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "BACKUP STAGE"));
+ if ((type= find_type($2.str, &backup_stage_names,
+ FIND_TYPE_NO_PREFIX)) <= 0)
+ my_yyabort_error((ER_BACKUP_UNKNOWN_STAGE, MYF(0), $2.str));
+ Lex->sql_command= SQLCOM_BACKUP;
+ Lex->backup_stage= (backup_stages) (type-1);
+ break;
+ }
+ | LOCK_SYM table_ident
+ {
+ if (unlikely(!Select->add_table_to_list(thd, $2, NULL, 0,
+ TL_READ, MDL_SHARED_HIGH_PRIO)))
+ MYSQL_YYABORT;
+ Lex->sql_command= SQLCOM_BACKUP_LOCK;
+ }
+ | UNLOCK_SYM
+ {
+ /* Table list is empty for unlock */
+ Lex->sql_command= SQLCOM_BACKUP_LOCK;
+ }
+ ;
+
opt_delete_gtid_domain:
/* empty */ {}
| DELETE_DOMAIN_ID_SYM '=' '(' delete_domain_id_list ')'
@@ -14572,6 +14626,7 @@ delete_domain_id:
optional_flush_tables_arguments:
/* empty */ {$$= 0;}
| AND_SYM DISABLE_SYM CHECKPOINT_SYM {$$= REFRESH_CHECKPOINT; }
+ ;
reset:
RESET_SYM
@@ -14664,6 +14719,7 @@ kill_type:
/* Empty */ { $$= (int) KILL_HARD_BIT; }
| HARD_SYM { $$= (int) KILL_HARD_BIT; }
| SOFT_SYM { $$= 0; }
+ ;
kill_option:
/* empty */ { $$= (int) KILL_CONNECTION; }
@@ -14983,16 +15039,17 @@ param_marker:
YYLIP->get_tok_start() + 1))))
MYSQL_YYABORT;
}
- | colon_with_pos ident_cli
+ | COLON_ORACLE_SYM ident_cli
{
if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str,
- $1, $2.end()))))
+ $1.pos(), $2.end()))))
MYSQL_YYABORT;
}
- | colon_with_pos NUM
+ | COLON_ORACLE_SYM NUM
{
if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str,
- $1, YYLIP->get_ptr()))))
+ $1.pos(),
+ YYLIP->get_ptr()))))
MYSQL_YYABORT;
}
;
@@ -15304,7 +15361,7 @@ simple_ident:
if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3, &$5))))
MYSQL_YYABORT;
}
- | colon_with_pos ident_cli '.' ident_cli
+ | COLON_ORACLE_SYM ident_cli '.' ident_cli
{
if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4))))
MYSQL_YYABORT;
@@ -15322,7 +15379,7 @@ simple_ident_nospvar:
if (unlikely(!($$= Lex->create_item_ident_nospvar(thd, &$1, &$3))))
MYSQL_YYABORT;
}
- | colon_with_pos ident_cli '.' ident_cli
+ | COLON_ORACLE_SYM ident_cli '.' ident_cli
{
if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4))))
MYSQL_YYABORT;
@@ -15463,6 +15520,14 @@ ident_table_alias:
}
;
+ident_set_usual_case:
+ IDENT_sys
+ | keyword_set_usual_case
+ {
+ if (unlikely($$.copy_keyword(thd, &$1)))
+ MYSQL_YYABORT;
+ }
+ ;
ident_sysvar_name:
IDENT_sys
@@ -15594,6 +15659,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15606,6 +15672,7 @@ keyword_table_alias:
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15622,6 +15689,7 @@ keyword_ident:
*/
keyword_label:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sysvar_type
| FUNCTION_SYM
@@ -15629,6 +15697,7 @@ keyword_label:
keyword_sysvar_name:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
@@ -15640,15 +15709,29 @@ keyword_sysvar_name:
keyword_sp_decl:
keyword_sp_head
+ | keyword_set_special_case
+ | keyword_sp_var_and_label
+ | keyword_sp_var_not_label
+ | keyword_sysvar_type
+ | keyword_verb_clause
+ | WINDOW_SYM
+ ;
+
+keyword_set_usual_case:
+ keyword_data_type
+ | keyword_sp_block_section
+ | keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
+ | FUNCTION_SYM
| WINDOW_SYM
;
keyword_directly_assignable:
keyword_data_type
+ | keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
@@ -15688,11 +15771,11 @@ keyword_sp_var_not_label:
| FORMAT_SYM
| GET_SYM
| HELP_SYM
- | HISTORY_SYM
| HOST_SYM
| INSTALL_SYM
| OPTION
| OPTIONS_SYM
+ | OTHERS_MARIADB_SYM
| OWNER_SYM
| PARSER_SYM
| PERIOD_SYM
@@ -15712,15 +15795,11 @@ keyword_sp_var_not_label:
| START_SYM
| STOP_SYM
| STORED_SYM
- | SYSTEM
- | SYSTEM_TIME_SYM
| TIES_SYM
| UNICODE_SYM
| UNINSTALL_SYM
| UNBOUNDED_SYM
- | VERSIONING_SYM
| WITHIN
- | WITHOUT
| WRAPPER_SYM
| XA_SYM
| UPGRADE_SYM
@@ -15792,12 +15871,18 @@ keyword_verb_clause:
| TRUNCATE_SYM /* Verb clause. Reserved in Oracle */
;
+keyword_set_special_case:
+ NAMES_SYM
+ | ROLE_SYM
+ | PASSWORD_SYM
+ ;
+
/*
Keywords that start an SP block section.
*/
keyword_sp_block_section:
- BEGIN_SYM
- | EXCEPTION_SYM
+ BEGIN_ORACLE_SYM
+ | EXCEPTION_ORACLE_SYM
| END
;
@@ -15816,7 +15901,8 @@ keyword_data_type:
BIT_SYM
| BOOLEAN_SYM
| BOOL_SYM
- | CLOB
+ | CLOB_MARIADB_SYM
+ | CLOB_ORACLE_SYM
| DATE_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| DATETIME
| ENUM
@@ -15831,17 +15917,20 @@ keyword_data_type:
| MULTIPOLYGON
| NATIONAL_SYM
| NCHAR_SYM
- | NUMBER_SYM
+ | NUMBER_MARIADB_SYM
+ | NUMBER_ORACLE_SYM
| NVARCHAR_SYM
| POINT_SYM
| POLYGON
- | RAW
+ | RAW_MARIADB_SYM
+ | RAW_ORACLE_SYM
| ROW_SYM
| SERIAL_SYM
| TEXT_SYM
| TIMESTAMP %prec PREC_BELOW_CONTRACTION_TOKEN2
| TIME_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
- | VARCHAR2
+ | VARCHAR2_MARIADB_SYM
+ | VARCHAR2_ORACLE_SYM
| YEAR_SYM
;
@@ -15868,6 +15957,7 @@ keyword_sp_var_and_label:
| AVG_ROW_LENGTH
| AVG_SYM
| BLOCK_SYM
+ | BODY_MARIADB_SYM
| BTREE_SYM
| CASCADED
| CATALOG_NAME_SYM
@@ -15907,7 +15997,8 @@ keyword_sp_var_and_label:
| DATAFILE_SYM
| DATE_FORMAT_SYM
| DAY_SYM
- | DECODE_SYM
+ | DECODE_MARIADB_SYM
+ | DECODE_ORACLE_SYM
| DEFINER_SYM
| DELAY_KEY_WRITE_SYM
| DES_KEY_FILE
@@ -15919,6 +16010,8 @@ keyword_sp_var_and_label:
| DUMPFILE
| DUPLICATE_SYM
| DYNAMIC_SYM
+ | ELSEIF_ORACLE_SYM
+ | ELSIF_MARIADB_SYM
| ENDS_SYM
| ENGINE_SYM
| ENGINES_SYM
@@ -15928,7 +16021,7 @@ keyword_sp_var_and_label:
| EVENT_SYM
| EVENTS_SYM
| EVERY_SYM
-
+ | EXCEPTION_MARIADB_SYM
| EXCHANGE_SYM
| EXPANSION_SYM
| EXPORT_SYM
@@ -15945,8 +16038,10 @@ keyword_sp_var_and_label:
| GENERATED_SYM
| GET_FORMAT
| GRANTS
+ | GOTO_MARIADB_SYM
| HASH_SYM
| HARD_SYM
+ | HISTORY_SYM
| HOSTS_SYM
| HOUR_SYM
| ID_SYM
@@ -16019,7 +16114,6 @@ keyword_sp_var_and_label:
| MYSQL_SYM
| MYSQL_ERRNO_SYM
| NAME_SYM
- | NAMES_SYM
| NEXT_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| NEXTVAL_SYM
| NEW_SYM
@@ -16038,13 +16132,12 @@ keyword_sp_var_and_label:
| ONE_SYM
| ONLINE_SYM
| ONLY_SYM
-
+ | PACKAGE_MARIADB_SYM
| PACK_KEYS_SYM
| PAGE_SYM
| PARTIAL
| PARTITIONING_SYM
| PARTITIONS_SYM
- | PASSWORD_SYM
| PERSISTENT_SYM
| PHASE_SYM
| PLUGIN_SYM
@@ -16061,7 +16154,7 @@ keyword_sp_var_and_label:
| QUARTER_SYM
| QUERY_SYM
| QUICK
-
+ | RAISE_MARIADB_SYM
| READ_ONLY_SYM
| REBUILD_SYM
| RECOVER_SYM
@@ -16084,10 +16177,10 @@ keyword_sp_var_and_label:
| RETURNS_SYM
| REUSE_SYM
| REVERSE_SYM
- | ROLE_SYM
| ROLLUP_SYM
| ROUTINE_SYM
| ROWCOUNT_SYM
+ | ROWTYPE_MARIADB_SYM
| ROW_COUNT_SYM
| ROW_FORMAT_SYM
| RTREE_SYM
@@ -16109,6 +16202,7 @@ keyword_sp_var_and_label:
| SQL_BUFFER_RESULT
| SQL_NO_CACHE_SYM
| SQL_THREAD
+ | STAGE_SYM
| STARTS_SYM
| STATEMENT_SYM
| STATUS_SYM
@@ -16123,6 +16217,8 @@ keyword_sp_var_and_label:
| SUSPEND_SYM
| SWAPS_SYM
| SWITCHES_SYM
+ | SYSTEM
+ | SYSTEM_TIME_SYM
| TABLE_NAME_SYM
| TABLES
| TABLE_CHECKSUM_SYM
@@ -16148,6 +16244,7 @@ keyword_sp_var_and_label:
| USER_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| USE_FRM
| VARIABLES
+ | VERSIONING_SYM
| VIEW_SYM
| VIRTUAL_SYM
| VALUE_SYM
@@ -16155,6 +16252,7 @@ keyword_sp_var_and_label:
| WAIT_SYM
| WEEK_SYM
| WEIGHT_STRING_SYM
+ | WITHOUT
| WORK_SYM
| X509_SYM
| XML_SYM
@@ -16234,12 +16332,12 @@ set_assign:
unlikely(lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
- | colon_with_pos ident '.' ident SET_VAR
+ | COLON_ORACLE_SYM ident '.' ident SET_VAR
{
LEX *lex= Lex;
if (unlikely(!lex->is_trigger_new_or_old_reference(&$2)))
{
- thd->parse_error(ER_SYNTAX_ERROR, $1);
+ thd->parse_error(ER_SYNTAX_ERROR, $1.pos());
MYSQL_YYABORT;
}
lex->set_stmt_init();
@@ -16383,7 +16481,7 @@ option_value_following_option_type:
/* Option values without preceding option_type. */
option_value_no_option_type:
- ident equal set_expr_or_default
+ ident_set_usual_case equal set_expr_or_default
{
if (unlikely(Lex->set_variable(&$1, $3)))
MYSQL_YYABORT;
@@ -16500,6 +16598,11 @@ option_value_no_option_type:
unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
}
+ | ROLE_SYM equal set_expr_or_default
+ {
+ if (unlikely(Lex->set_variable(&$1, $3)))
+ MYSQL_YYABORT;
+ }
| PASSWORD_SYM opt_for_user text_or_password
{
LEX *lex = Lex;
@@ -16722,6 +16825,7 @@ handler:
{
Lex->pop_select(); //main select
}
+ ;
handler_tail:
table_ident OPEN_SYM opt_table_alias_clause
@@ -16843,13 +16947,15 @@ revoke_command:
TYPE_ENUM_PROCEDURE)))
MYSQL_YYABORT;
}
- | grant_privileges ON PACKAGE_SYM grant_ident FROM user_and_role_list
+ | grant_privileges ON PACKAGE_ORACLE_SYM grant_ident
+ FROM user_and_role_list
{
if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
TYPE_ENUM_PACKAGE)))
MYSQL_YYABORT;
}
- | grant_privileges ON PACKAGE_SYM BODY_SYM grant_ident FROM user_and_role_list
+ | grant_privileges ON PACKAGE_ORACLE_SYM BODY_ORACLE_SYM grant_ident
+ FROM user_and_role_list
{
if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
TYPE_ENUM_PACKAGE_BODY)))
@@ -16908,14 +17014,14 @@ grant_command:
TYPE_ENUM_PROCEDURE)))
MYSQL_YYABORT;
}
- | grant_privileges ON PACKAGE_SYM grant_ident TO_SYM grant_list
+ | grant_privileges ON PACKAGE_ORACLE_SYM grant_ident TO_SYM grant_list
opt_require_clause opt_grant_options
{
if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
TYPE_ENUM_PACKAGE)))
MYSQL_YYABORT;
}
- | grant_privileges ON PACKAGE_SYM BODY_SYM grant_ident TO_SYM grant_list
+ | grant_privileges ON PACKAGE_ORACLE_SYM BODY_ORACLE_SYM grant_ident TO_SYM grant_list
opt_require_clause opt_grant_options
{
if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
@@ -16941,12 +17047,14 @@ grant_command:
;
opt_with_admin:
- /* nothing */ { Lex->definer = 0; }
- | WITH ADMIN_SYM user_or_role { Lex->definer = $3; }
+ /* nothing */ { Lex->definer = 0; }
+ | WITH ADMIN_SYM user_or_role { Lex->definer = $3; }
+ ;
opt_with_admin_option:
- /* nothing */ { Lex->with_admin_option= false; }
- | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; }
+ /* nothing */ { Lex->with_admin_option= false; }
+ | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; }
+ ;
role_list:
grant_role
@@ -17339,6 +17447,16 @@ grant_option:
| resource_option {}
;
+begin_stmt_mariadb:
+ BEGIN_MARIADB_SYM
+ {
+ LEX *lex=Lex;
+ lex->sql_command = SQLCOM_BEGIN;
+ lex->start_transaction_opt= 0;
+ }
+ opt_work {}
+ ;
+
compound_statement:
sp_proc_stmt_compound_ok
{
@@ -17437,11 +17555,11 @@ unit_type_decl:
{ $$.unit_type= INTERSECT_TYPE; $$.distinct= 1; }
| EXCEPT_SYM
{ $$.unit_type= EXCEPT_TYPE; $$.distinct= 1; }
+ ;
/*
Start a UNION, for non-top level query expressions.
*/
-
union_option:
/* empty */ { $$=1; }
| DISTINCT { $$=1; }
@@ -17689,7 +17807,7 @@ udf_tail:
sf_return_type:
- RETURN_SYM
+ RETURN_ORACLE_SYM
{
LEX *lex= Lex;
lex->init_last_field(&lex->sphead->m_return_field_def,
@@ -17860,7 +17978,8 @@ xid:
;
begin_or_start:
- BEGIN_SYM {}
+ BEGIN_MARIADB_SYM {}
+ | BEGIN_ORACLE_SYM {}
| START_SYM {}
;
@@ -17923,10 +18042,11 @@ uninstall:
/* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */
keep_gcc_happy:
- IMPOSSIBLE_ACTION
- {
- YYERROR;
- }
+ IMPOSSIBLE_ACTION
+ {
+ YYERROR;
+ }
+ ;
/**
@} (end of group Parser)
diff --git a/sql/structs.h b/sql/structs.h
index 12b5dee0055..8aec29bac41 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -118,13 +118,13 @@ typedef struct st_key {
pk2 is explicitly present in idx1, it is not in the extension, so
ext_key_part_map.is_set(1) == false
*/
- LEX_CSTRING name;
key_part_map ext_key_part_map;
/*
Bitmap of indexes having common parts with this index
(only key parts from key definitions are taken into account)
*/
key_map overlapped;
+ LEX_CSTRING name;
uint block_size;
enum ha_key_alg algorithm;
/*
@@ -705,26 +705,41 @@ public:
struct Lex_for_loop_bounds_st
{
public:
- class sp_assignment_lex *m_index;
- class sp_assignment_lex *m_upper_bound;
+ class sp_assignment_lex *m_index; // The first iteration value (or cursor)
+ class sp_assignment_lex *m_target_bound; // The last iteration value
int8 m_direction;
bool m_implicit_cursor;
- bool is_for_loop_cursor() const { return m_upper_bound == NULL; }
+ bool is_for_loop_cursor() const { return m_target_bound == NULL; }
+};
+
+
+class Lex_for_loop_bounds_intrange: public Lex_for_loop_bounds_st
+{
+public:
+ Lex_for_loop_bounds_intrange(int8 direction,
+ class sp_assignment_lex *left_expr,
+ class sp_assignment_lex *right_expr)
+ {
+ m_direction= direction;
+ m_index= direction > 0 ? left_expr : right_expr;
+ m_target_bound= direction > 0 ? right_expr : left_expr;
+ m_implicit_cursor= false;
+ }
};
struct Lex_for_loop_st
{
public:
- class sp_variable *m_index;
- class sp_variable *m_upper_bound;
+ class sp_variable *m_index; // The first iteration value (or cursor)
+ class sp_variable *m_target_bound; // The last iteration value
int m_cursor_offset;
int8 m_direction;
bool m_implicit_cursor;
void init()
{
m_index= 0;
- m_upper_bound= 0;
+ m_target_bound= 0;
m_direction= 0;
m_implicit_cursor= false;
}
@@ -732,7 +747,7 @@ public:
{
*this= other;
}
- bool is_for_loop_cursor() const { return m_upper_bound == NULL; }
+ bool is_for_loop_cursor() const { return m_target_bound == NULL; }
bool is_for_loop_explicit_cursor() const
{
return is_for_loop_cursor() && !m_implicit_cursor;
@@ -846,17 +861,17 @@ public:
class Timeval: public timeval
{
+protected:
+ Timeval() { }
public:
Timeval(my_time_t sec, ulong usec)
{
tv_sec= sec;
tv_usec= usec;
}
- Timeval &trunc(uint dec)
- {
- my_timeval_trunc(this, dec);
- return *this;
- }
+ explicit Timeval(const timeval &tv)
+ :timeval(tv)
+ { }
};
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 983d0490f2e..575af82272f 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1515,6 +1515,14 @@ static Sys_var_ulong Sys_max_connect_errors(
VALID_RANGE(1, UINT_MAX), DEFAULT(MAX_CONNECT_ERRORS),
BLOCK_SIZE(1));
+static Sys_var_uint Sys_max_password_errors(
+ "max_password_errors",
+ "If there is more than this number of failed connect attempts "
+ "due to invalid password, user will be blocked from further connections until FLUSH_PRIVILEGES.",
+ GLOBAL_VAR(max_password_errors), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(1, UINT_MAX), DEFAULT(UINT_MAX),
+ BLOCK_SIZE(1));
+
static Sys_var_uint Sys_max_digest_length(
"max_digest_length", "Maximum length considered for digest text.",
READ_ONLY GLOBAL_VAR(max_digest_length),
@@ -1942,6 +1950,19 @@ Sys_var_last_gtid::session_value_ptr(THD *thd, const LEX_CSTRING *base)
}
+static Sys_var_uint Sys_gtid_cleanup_batch_size(
+ "gtid_cleanup_batch_size",
+ "Normally does not need tuning. How many old rows must accumulate in "
+ "the mysql.gtid_slave_pos table before a background job will be run to "
+ "delete them. Can be increased to reduce number of commits if "
+ "using many different engines with --gtid_pos_auto_engines, or to "
+ "reduce CPU overhead if using a huge number of different "
+ "gtid_domain_ids. Can be decreased to reduce number of old rows in the "
+ "table.",
+ GLOBAL_VAR(opt_gtid_cleanup_batch_size), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0,2147483647), DEFAULT(64), BLOCK_SIZE(1));
+
+
static bool
check_slave_parallel_threads(sys_var *self, THD *thd, set_var *var)
{
@@ -2456,7 +2477,7 @@ static Sys_var_ulong Sys_optimizer_use_condition_selectivity(
"5 - additionally use selectivity of certain non-range predicates "
"calculated on record samples",
SESSION_VAR(optimizer_use_condition_selectivity), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 5), DEFAULT(1), BLOCK_SIZE(1));
+ VALID_RANGE(1, 5), DEFAULT(4), BLOCK_SIZE(1));
static Sys_var_ulong Sys_optimizer_search_depth(
"optimizer_search_depth",
@@ -2573,13 +2594,15 @@ static Sys_var_ulong Sys_read_buff_size(
static bool check_read_only(sys_var *self, THD *thd, set_var *var)
{
/* Prevent self dead-lock */
- if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction())
+ if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction() ||
+ thd->current_backup_stage != BACKUP_FINISHED)
{
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
return true;
}
return false;
}
+
static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type)
{
bool result= true;
@@ -2680,7 +2703,7 @@ static Sys_var_uint Sys_eq_range_index_dive_limit(
"ranges for the index is larger than or equal to this number. "
"If set to 0, index dives are always used.",
SESSION_VAR(eq_range_index_dive_limit), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, UINT_MAX32), DEFAULT(0),
+ VALID_RANGE(0, UINT_MAX32), DEFAULT(10),
BLOCK_SIZE(1));
static Sys_var_ulong Sys_range_alloc_block_size(
@@ -3354,6 +3377,7 @@ static const char *sql_mode_names[]=
"ALLOW_INVALID_DATES", "ERROR_FOR_DIVISION_BY_ZERO", "TRADITIONAL",
"NO_AUTO_CREATE_USER", "HIGH_NOT_PRECEDENCE", "NO_ENGINE_SUBSTITUTION",
"PAD_CHAR_TO_FULL_LENGTH", "EMPTY_STRING_IS_NULL", "SIMULTANEOUS_ASSIGNMENT",
+ "TIME_ROUND_FRACTIONAL",
0
};
@@ -3474,11 +3498,15 @@ static Sys_var_charptr Sys_system_time_zone(
CMD_LINE_HELP_ONLY,
IN_SYSTEM_CHARSET, DEFAULT(system_time_zone));
+/*
+ If One use views with prepared statements this should be bigger than
+ table_open_cache (now we allow 2 times bigger value)
+*/
static Sys_var_ulong Sys_table_def_size(
"table_definition_cache",
"The number of cached table definitions",
GLOBAL_VAR(tdc_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(TABLE_DEF_CACHE_MIN, 512*1024),
+ VALID_RANGE(TABLE_DEF_CACHE_MIN, 2*1024*1024),
DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1));
@@ -3490,7 +3518,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type)
return false;
}
-
+/* Check the table_definition_cache comment if makes changes */
static Sys_var_ulong Sys_table_cache_size(
"table_open_cache", "The number of cached open tables",
GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG),
@@ -5350,8 +5378,7 @@ static Sys_var_charptr sys_wsrep_sst_method(
"wsrep_sst_method", "State snapshot transfer method",
GLOBAL_VAR(wsrep_sst_method),CMD_LINE(REQUIRED_ARG),
IN_SYSTEM_CHARSET, DEFAULT(WSREP_SST_DEFAULT), NO_MUTEX_GUARD, NOT_IN_BINLOG,
- ON_CHECK(wsrep_sst_method_check),
- ON_UPDATE(wsrep_sst_method_update));
+ ON_CHECK(wsrep_sst_method_check));
static Sys_var_charptr Sys_wsrep_sst_receive_address(
"wsrep_sst_receive_address", "Address where node is waiting for "
@@ -5492,7 +5519,7 @@ static Sys_var_ulong Sys_wsrep_mysql_replication_bundle(
static Sys_var_mybool Sys_wsrep_load_data_splitting(
"wsrep_load_data_splitting", "To commit LOAD DATA "
- "transaction after every 10K rows inserted",
+ "transaction after every 10K rows inserted (deprecating)",
GLOBAL_VAR(wsrep_load_data_splitting),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
@@ -5512,12 +5539,48 @@ static Sys_var_mybool Sys_wsrep_restart_slave(
"wsrep_restart_slave", "Should MariaDB slave be restarted automatically, when node joins back to cluster",
GLOBAL_VAR(wsrep_restart_slave), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+static Sys_var_ulonglong Sys_wsrep_trx_fragment_size(
+ "wsrep_trx_fragment_size",
+ "Size of transaction fragments for streaming replication (measured in "
+ "units of 'wsrep_trx_fragment_unit')",
+ SESSION_VAR(wsrep_trx_fragment_size), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, WSREP_MAX_WS_SIZE), DEFAULT(0), BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ ON_CHECK(wsrep_trx_fragment_size_check),
+ ON_UPDATE(wsrep_trx_fragment_size_update));
+
+extern const char *wsrep_fragment_units[];
+
+static Sys_var_enum Sys_wsrep_trx_fragment_unit(
+ "wsrep_trx_fragment_unit",
+ "Unit for streaming replication transaction fragments' size: bytes, "
+ "rows, statements",
+ SESSION_VAR(wsrep_trx_fragment_unit), CMD_LINE(REQUIRED_ARG),
+ wsrep_fragment_units,
+ DEFAULT(WSREP_FRAG_BYTES),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ ON_CHECK(0),
+ ON_UPDATE(wsrep_trx_fragment_unit_update));
+
+extern const char *wsrep_SR_store_types[];
+static Sys_var_enum Sys_wsrep_SR_store(
+ "wsrep_SR_store", "Storage for streaming replication fragments",
+ READ_ONLY GLOBAL_VAR(wsrep_SR_store_type), CMD_LINE(REQUIRED_ARG),
+ wsrep_SR_store_types, DEFAULT(WSREP_SR_STORE_TABLE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG);
+
static Sys_var_mybool Sys_wsrep_dirty_reads(
"wsrep_dirty_reads",
"Allow reads even when the node is not in the primary component.",
SESSION_VAR(wsrep_dirty_reads), CMD_LINE(OPT_ARG),
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG);
+static Sys_var_uint Sys_wsrep_ignore_apply_errors (
+ "wsrep_ignore_apply_errors", "Ignore replication errors",
+ GLOBAL_VAR(wsrep_ignore_apply_errors), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(WSREP_IGNORE_ERRORS_NONE, WSREP_IGNORE_ERRORS_MAX),
+ DEFAULT(7), BLOCK_SIZE(1));
+
static Sys_var_uint Sys_wsrep_gtid_domain_id(
"wsrep_gtid_domain_id", "When wsrep_gtid_mode is set, this value is "
"used as gtid_domain_id for galera transactions and also copied to the "
@@ -5842,12 +5905,13 @@ static Sys_var_ulong Sys_progress_report_time(
VALID_RANGE(0, UINT_MAX), DEFAULT(5), BLOCK_SIZE(1));
const char *use_stat_tables_modes[] =
- {"NEVER", "COMPLEMENTARY", "PREFERABLY", 0};
+ {"NEVER", "COMPLEMENTARY", "PREFERABLY",
+ "COMPLEMENTARY_FOR_QUERIES", "PREFERABLY_FOR_QUERIES", 0};
static Sys_var_enum Sys_optimizer_use_stat_tables(
"use_stat_tables",
"Specifies how to use system statistics tables",
SESSION_VAR(use_stat_tables), CMD_LINE(REQUIRED_ARG),
- use_stat_tables_modes, DEFAULT(0));
+ use_stat_tables_modes, DEFAULT(4));
static Sys_var_ulong Sys_histogram_size(
"histogram_size",
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic
index dbc3565e202..1c41cc22411 100644
--- a/sql/sys_vars.ic
+++ b/sql/sys_vars.ic
@@ -2659,7 +2659,8 @@ public:
if (!Sys_var_enum::do_check(thd, var))
return false;
MYSQL_TIME ltime;
- bool res= var->value->get_date(thd, &ltime, date_mode_t(0));
+ Datetime::Options opt(TIME_CONV_NONE, thd);
+ bool res= var->value->get_date(thd, &ltime, opt);
if (!res)
{
var->save_result.ulonglong_value= SYSTEM_TIME_AS_OF;
@@ -2676,7 +2677,9 @@ private:
{
if (var->value)
{
- res= var->value->get_date(current_thd, &out.ltime, date_mode_t(0));
+ THD *thd= current_thd;
+ Datetime::Options opt(TIME_CONV_NONE, thd);
+ res= var->value->get_date(thd, &out.ltime, opt);
}
else // set DEFAULT from global var
{
diff --git a/sql/table.cc b/sql/table.cc
index 3df4c9f543a..6676ce5447d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -44,7 +44,6 @@
#include "sql_cte.h"
#include "ha_sequence.h"
#include "sql_show.h"
-#include <atomic>
/* For MySQL 5.7 virtual fields */
#define MYSQL57_GENERATED_FIELD 128
@@ -70,8 +69,6 @@ LEX_CSTRING GENERAL_LOG_NAME= {STRING_WITH_LEN("general_log")};
LEX_CSTRING SLOW_LOG_NAME= {STRING_WITH_LEN("slow_log")};
LEX_CSTRING TRANSACTION_REG_NAME= {STRING_WITH_LEN("transaction_registry")};
-LEX_CSTRING MYSQL_USER_NAME= {STRING_WITH_LEN("user")};
-LEX_CSTRING MYSQL_DB_NAME= {STRING_WITH_LEN("db")};
LEX_CSTRING MYSQL_PROC_NAME= {STRING_WITH_LEN("proc")};
/*
@@ -250,6 +247,13 @@ TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
DBUG_ASSERT(db != NULL);
DBUG_ASSERT(name != NULL);
+#ifdef WITH_WSREP
+ if (my_strcasecmp(system_charset_info, db->str, "mysql") == 0 &&
+ my_strcasecmp(system_charset_info, name->str, "wsrep_streaming_log") == 0)
+ {
+ return TABLE_CATEGORY_INFORMATION;
+ }
+#endif /* WITH_WSREP */
if (is_infoschema_db(db))
return TABLE_CATEGORY_INFORMATION;
@@ -339,6 +343,9 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data,
&share->LOCK_ha_data, MY_MUTEX_INIT_FAST);
+ DBUG_EXECUTE_IF("simulate_big_table_id",
+ if (last_table_id < UINT_MAX32)
+ last_table_id= UINT_MAX32 - 1;);
/*
There is one reserved number that cannot be used. Remember to
change this when 6-byte global table id's are introduced.
@@ -347,7 +354,8 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
{
share->table_map_id=
last_table_id.fetch_add(1, std::memory_order_relaxed);
- } while (unlikely(share->table_map_id == ~0UL));
+ } while (unlikely(share->table_map_id == ~0UL ||
+ share->table_map_id == 0));
}
DBUG_RETURN(share);
}
@@ -1078,7 +1086,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
while (pos < end)
{
uint type, expr_length;
- if (table->s->mysql_version >= 100202)
+ if (table->s->frm_version >= FRM_VER_EXPRESSSIONS)
{
uint field_nr, name_length;
/* see pack_expression() for how data is stored */
@@ -2349,7 +2357,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
uint pk_part_length= key_first_info->key_part[i].store_length;
if (keyinfo->ext_key_part_map & 1<<i)
{
- if (ext_key_length + pk_part_length > MAX_KEY_LENGTH)
+ if (ext_key_length + pk_part_length > MAX_DATA_LENGTH_FOR_KEY)
{
add_keyparts_for_this_key= i;
break;
@@ -2359,9 +2367,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
}
}
- if (add_keyparts_for_this_key < (keyinfo->ext_key_parts -
- keyinfo->user_defined_key_parts))
- {
+ if (add_keyparts_for_this_key < keyinfo->ext_key_parts -
+ keyinfo->user_defined_key_parts)
+ {
share->ext_key_parts-= keyinfo->ext_key_parts;
key_part_map ext_key_part_map= keyinfo->ext_key_part_map;
keyinfo->ext_key_parts= keyinfo->user_defined_key_parts;
@@ -3601,6 +3609,8 @@ partititon_err:
share->no_replicate= TRUE;
if (outparam->file->table_cache_type() & HA_CACHE_TBL_NOCACHE)
share->not_usable_by_query_cache= TRUE;
+ if (outparam->file->ha_table_flags() & HA_CAN_ONLINE_BACKUPS)
+ share->online_backup= 1;
}
if (share->no_replicate || !binlog_filter->db_ok(share->db.str))
@@ -3998,6 +4008,7 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
create_info->table_options= share->db_create_options;
create_info->avg_row_length= share->avg_row_length;
create_info->row_type= share->row_type;
+ create_info->key_block_size= share->key_block_size;
create_info->default_table_charset= share->table_charset;
create_info->table_charset= 0;
create_info->comment= share->comment;
diff --git a/sql/table.h b/sql/table.h
index 1b8b837c35b..0a2dc63b068 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1,7 +1,7 @@
#ifndef TABLE_INCLUDED
#define TABLE_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2009, 2018, MariaDB
+ Copyright (c) 2009, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -396,28 +396,6 @@ enum enum_table_category
TABLE_CATEGORY_SYSTEM=3,
/**
- Information schema tables.
- These tables are an interface provided by the system
- to inspect the system metadata.
- These tables do *not* honor:
- - LOCK TABLE t FOR READ/WRITE
- - FLUSH TABLES WITH READ LOCK
- - SET GLOBAL READ_ONLY = ON
- as there is no point in locking explicitly
- an INFORMATION_SCHEMA table.
- Nothing is directly written to information schema tables.
- Note that this value is not used currently,
- since information schema tables are not shared,
- but implemented as session specific temporary tables.
- */
- /*
- TODO: Fixing the performance issues of I_S will lead
- to I_S tables in the table cache, which should use
- this table type.
- */
- TABLE_CATEGORY_INFORMATION=4,
-
- /**
Log tables.
These tables are an interface provided by the system
to inspect the system logs.
@@ -437,7 +415,33 @@ enum enum_table_category
The server implementation perform writes.
Log tables are cached in the table cache.
*/
- TABLE_CATEGORY_LOG=5,
+ TABLE_CATEGORY_LOG=4,
+
+ /*
+ Types below are read only tables, not affected by FLUSH TABLES or
+ MDL locks.
+ */
+ /**
+ Information schema tables.
+ These tables are an interface provided by the system
+ to inspect the system metadata.
+ These tables do *not* honor:
+ - LOCK TABLE t FOR READ/WRITE
+ - FLUSH TABLES WITH READ LOCK
+ - SET GLOBAL READ_ONLY = ON
+ as there is no point in locking explicitly
+ an INFORMATION_SCHEMA table.
+ Nothing is directly written to information schema tables.
+ Note that this value is not used currently,
+ since information schema tables are not shared,
+ but implemented as session specific temporary tables.
+ */
+ /*
+ TODO: Fixing the performance issues of I_S will lead
+ to I_S tables in the table cache, which should use
+ this table type.
+ */
+ TABLE_CATEGORY_INFORMATION=5,
/**
Performance schema tables.
@@ -461,6 +465,7 @@ enum enum_table_category
*/
TABLE_CATEGORY_PERFORMANCE=6
};
+
typedef enum enum_table_category TABLE_CATEGORY;
TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
@@ -728,6 +733,7 @@ struct TABLE_SHARE
bool null_field_first;
bool system; /* Set if system table (one record) */
bool not_usable_by_query_cache;
+ bool online_backup; /* Set if on-line backup supported */
bool no_replicate;
bool crashed;
bool is_view;
@@ -2088,7 +2094,7 @@ struct TABLE_LIST
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
List<Index_hint> *index_hints;
TABLE *table; /* opened table */
- uint table_id; /* table id (from binlog) for opened table */
+ ulong table_id; /* table id (from binlog) for opened table */
/*
select_result for derived table to pass it from table creation to table
filling procedure
@@ -2970,7 +2976,7 @@ extern LEX_CSTRING INFORMATION_SCHEMA_NAME;
extern LEX_CSTRING MYSQL_SCHEMA_NAME;
/* table names */
-extern LEX_CSTRING MYSQL_USER_NAME, MYSQL_DB_NAME, MYSQL_PROC_NAME;
+extern LEX_CSTRING MYSQL_PROC_NAME;
inline bool is_infoschema_db(const LEX_CSTRING *name)
{
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 682f9455d26..7a555d53558 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -57,7 +57,7 @@ ulong tdc_size; /**< Table definition cache threshold for LRU eviction. */
ulong tc_size; /**< Table cache threshold for LRU eviction. */
uint32 tc_instances;
uint32 tc_active_instances= 1;
-static uint32 tc_contention_warning_reported;
+static std::atomic<bool> tc_contention_warning_reported;
/** Data collections. */
static LF_HASH tdc_hash; /**< Collection of TABLE_SHARE objects. */
@@ -187,8 +187,8 @@ struct Table_cache_instance
n_instances + 1);
}
}
- else if (!my_atomic_fas32_explicit((int32*) &tc_contention_warning_reported,
- 1, MY_MEMORY_ORDER_RELAXED))
+ else if (!tc_contention_warning_reported.exchange(true,
+ std::memory_order_relaxed))
{
sql_print_warning("Detected table cache mutex contention at instance %d: "
"%d%% waits. Additional table cache instance "
@@ -232,7 +232,7 @@ static void intern_close_table(TABLE *table)
uint tc_records(void)
{
ulong total= 0;
- for (ulong i= 0; i < tc_instances; i++)
+ for (uint32 i= 0; i < tc_instances; i++)
{
mysql_mutex_lock(&tc[i].LOCK_table_cache);
total+= tc[i].records;
@@ -277,7 +277,7 @@ static void tc_remove_all_unused_tables(TDC_element *element,
*/
if (mark_flushed)
element->flushed= true;
- for (ulong i= 0; i < tc_instances; i++)
+ for (uint32 i= 0; i < tc_instances; i++)
{
mysql_mutex_lock(&tc[i].LOCK_table_cache);
while ((table= element->free_tables[i].list.pop_front()))
@@ -406,7 +406,7 @@ void tc_add_table(THD *thd, TABLE *table)
@return TABLE object, or NULL if no unused objects.
*/
-static TABLE *tc_acquire_table(THD *thd, TDC_element *element)
+TABLE *tc_acquire_table(THD *thd, TDC_element *element)
{
uint32 n_instances=
my_atomic_load32_explicit((int32*) &tc_active_instances,
@@ -491,7 +491,7 @@ static void tdc_assert_clean_share(TDC_element *element)
DBUG_ASSERT(element->m_flush_tickets.is_empty());
DBUG_ASSERT(element->all_tables.is_empty());
#ifndef DBUG_OFF
- for (ulong i= 0; i < tc_instances; i++)
+ for (uint32 i= 0; i < tc_instances; i++)
DBUG_ASSERT(element->free_tables[i].list.is_empty());
#endif
DBUG_ASSERT(element->all_tables_refs == 0);
@@ -564,7 +564,7 @@ static void lf_alloc_constructor(uchar *arg)
mysql_cond_init(key_TABLE_SHARE_COND_release, &element->COND_release, 0);
element->m_flush_tickets.empty();
element->all_tables.empty();
- for (ulong i= 0; i < tc_instances; i++)
+ for (uint32 i= 0; i < tc_instances; i++)
element->free_tables[i].list.empty();
element->all_tables_refs= 0;
element->share= 0;
@@ -657,7 +657,7 @@ void tdc_start_shutdown(void)
tdc_size= 0;
tc_size= 0;
/* Free all cached but unused TABLEs and TABLE_SHAREs. */
- close_cached_tables(NULL, NULL, FALSE, LONG_TIMEOUT);
+ purge_tables(true);
}
DBUG_VOID_RETURN;
}
@@ -689,7 +689,7 @@ void tdc_deinit(void)
ulong tdc_records(void)
{
- return my_atomic_load32_explicit(&tdc_hash.count, MY_MEMORY_ORDER_RELAXED);
+ return lf_hash_size(&tdc_hash);
}
@@ -1094,6 +1094,7 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
TABLE *table;
TDC_element *element;
uint my_refs= 1;
+ bool res= false;
DBUG_ENTER("tdc_remove_table");
DBUG_PRINT("enter",("name: %s remove_type: %d", table_name, remove_type));
@@ -1101,7 +1102,6 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
MDL_EXCLUSIVE));
-
mysql_mutex_lock(&LOCK_unused_shares);
if (!(element= tdc_lock_share(thd, db, table_name)))
{
@@ -1123,7 +1123,7 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
mysql_mutex_unlock(&LOCK_unused_shares);
tdc_delete_share_from_hash(element);
- DBUG_RETURN(true);
+ DBUG_RETURN(false);
}
mysql_mutex_unlock(&LOCK_unused_shares);
@@ -1189,10 +1189,16 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
#endif
mysql_mutex_unlock(&element->LOCK_table_share);
}
+ else
+ {
+ mysql_mutex_lock(&element->LOCK_table_share);
+ res= element->ref_count > 1;
+ mysql_mutex_unlock(&element->LOCK_table_share);
+ }
tdc_release_share(element->share);
- DBUG_RETURN(true);
+ DBUG_RETURN(res);
}
diff --git a/sql/table_cache.h b/sql/table_cache.h
index b41665258c9..148edc84223 100644
--- a/sql/table_cache.h
+++ b/sql/table_cache.h
@@ -88,7 +88,6 @@ extern bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
const char *db, const char *table_name,
bool kill_delayed_threads);
-
extern int tdc_wait_for_old_version(THD *thd, const char *db,
const char *table_name,
ulong wait_timeout, uint deadlock_weight,
@@ -102,6 +101,7 @@ extern uint tc_records(void);
extern void tc_purge(bool mark_flushed= false);
extern void tc_add_table(THD *thd, TABLE *table);
extern void tc_release_table(TABLE *table);
+extern TABLE *tc_acquire_table(THD *thd, TDC_element *element);
/**
Create a table cache key for non-temporary table.
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 1c8af5eaf66..917a85e6c3b 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -1041,39 +1041,28 @@ TABLE *THD::find_temporary_table(const char *key, uint key_length,
/* A matching TMP_TABLE_SHARE is found. */
All_share_tables_list::Iterator tables_it(share->all_tmp_tables);
- while ((table= tables_it++))
+ bool found= false;
+ while (!found && (table= tables_it++))
{
switch (state)
{
- case TMP_TABLE_IN_USE:
- if (table->query_id > 0)
- {
- result= table;
- goto done;
- }
- break;
- case TMP_TABLE_NOT_IN_USE:
- if (table->query_id == 0)
- {
- result= table;
- goto done;
- }
- break;
- case TMP_TABLE_ANY:
- {
- result= table;
- goto done;
- }
- break;
- default: /* Invalid */
- DBUG_ASSERT(0);
- goto done;
+ case TMP_TABLE_IN_USE: found= table->query_id > 0; break;
+ case TMP_TABLE_NOT_IN_USE: found= table->query_id == 0; break;
+ case TMP_TABLE_ANY: found= true; break;
}
}
+ if (table && unlikely(table->m_needs_reopen))
+ {
+ share->all_tmp_tables.remove(table);
+ free_temporary_table(table);
+ it.rewind();
+ continue;
+ }
+ result= table;
+ break;
}
}
-done:
if (locked)
{
DBUG_ASSERT(m_tmp_tables_locked);
@@ -1154,8 +1143,7 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
@return Success false
Failure true
*/
-bool THD::find_and_use_tmp_table(const TABLE_LIST *tl,
- TABLE **out_table)
+bool THD::find_and_use_tmp_table(const TABLE_LIST *tl, TABLE **out_table)
{
DBUG_ENTER("THD::find_and_use_tmp_table");
@@ -1165,11 +1153,9 @@ bool THD::find_and_use_tmp_table(const TABLE_LIST *tl,
key_length= create_tmp_table_def_key(key, tl->get_db_name(),
tl->get_table_name());
- result=
- use_temporary_table(find_temporary_table(key, key_length,
- TMP_TABLE_NOT_IN_USE),
- out_table);
-
+ result= use_temporary_table(find_temporary_table(key, key_length,
+ TMP_TABLE_NOT_IN_USE),
+ out_table);
DBUG_RETURN(result);
}
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 24ab972776c..695623cd4ea 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -243,7 +243,7 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
return NULL;
}
delete connect;
- add_to_active_threads(thd);
+ server_threads.insert(thd);
thd->set_mysys_var(mysys_var);
thd->event_scheduler.data= scheduler_data;
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index a306822b1f1..e37fd6f0cf4 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -578,43 +578,24 @@ static void queue_put(thread_group_t *thread_group, native_event *ev, int cnt)
Also, recalculate time when next timeout check should run.
*/
-static void timeout_check(pool_timer_t *timer)
+static my_bool timeout_check(THD *thd, pool_timer_t *timer)
{
DBUG_ENTER("timeout_check");
-
- mysql_mutex_lock(&LOCK_thread_count);
- I_List_iterator<THD> it(threads);
-
- /* Reset next timeout check, it will be recalculated in the loop below */
- my_atomic_fas64((volatile int64*)&timer->next_timeout_check, ULONGLONG_MAX);
-
- THD *thd;
- while ((thd=it++))
+ if (thd->net.reading_or_writing == 1)
{
- if (thd->net.reading_or_writing != 1)
- continue;
-
- TP_connection_generic *connection= (TP_connection_generic *)thd->event_scheduler.data;
- if (!connection)
- {
- /*
- Connection does not have scheduler data. This happens for example
- if THD belongs to a different scheduler, that is listening to extra_port.
- */
- continue;
- }
-
- if(connection->abs_wait_timeout < timer->current_microtime)
- {
- tp_timeout_handler(connection);
- }
- else
+ /*
+ Check if connection does not have scheduler data. This happens for example
+ if THD belongs to a different scheduler, that is listening to extra_port.
+ */
+ if (auto connection= (TP_connection_generic *) thd->event_scheduler.data)
{
- set_next_timeout_check(connection->abs_wait_timeout);
+ if (connection->abs_wait_timeout < timer->current_microtime)
+ tp_timeout_handler(connection);
+ else
+ set_next_timeout_check(connection->abs_wait_timeout);
}
}
- mysql_mutex_unlock(&LOCK_thread_count);
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
@@ -671,7 +652,12 @@ static void* timer_thread(void *param)
/* Check if any client exceeded wait_timeout */
if (timer->next_timeout_check <= timer->current_microtime)
- timeout_check(timer);
+ {
+ /* Reset next timeout check, it will be recalculated below */
+ my_atomic_fas64((volatile int64*) &timer->next_timeout_check,
+ ULONGLONG_MAX);
+ server_threads.iterate(timeout_check, timer);
+ }
}
mysql_mutex_unlock(&timer->mutex);
}
@@ -1694,7 +1680,7 @@ int TP_pool_generic::set_pool_size(uint size)
success= (group->pollfd != INVALID_HANDLE_VALUE);
if(!success)
{
- sql_print_error("io_poll_create() failed, errno=%d\n", errno);
+ sql_print_error("io_poll_create() failed, errno=%d", errno);
}
}
mysql_mutex_unlock(&group->mutex);
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 1c2820200d1..4d61d2a120d 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -24,6 +24,9 @@
#include "debug_sync.h" // DEBUG_SYNC
#include "sql_acl.h"
#include "semisync_master.h"
+#ifdef WITH_WSREP
+#include "wsrep_trans_observer.h"
+#endif /* WITH_WSREP */
#ifndef EMBEDDED_LIBRARY
/**
@@ -135,8 +138,6 @@ static bool xa_trans_force_rollback(THD *thd)
by ha_rollback()/THD::transaction::cleanup().
*/
thd->transaction.xid_state.rm_error= 0;
- if (WSREP_ON)
- wsrep_register_hton(thd, TRUE);
if (ha_rollback_trans(thd, true))
{
my_error(ER_XAER_RMERR, MYF(0));
@@ -184,14 +185,16 @@ bool trans_begin(THD *thd, uint flags)
(thd->variables.option_bits & OPTION_TABLE_LOCK))
{
thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
- if (WSREP_ON)
- wsrep_register_hton(thd, TRUE);
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= MY_TEST(ha_commit_trans(thd, TRUE));
- if (WSREP_ON)
- wsrep_post_commit(thd, TRUE);
+#ifdef WITH_WSREP
+ if (wsrep_thd_is_local(thd))
+ {
+ res= res || wsrep_after_statement(thd);
+ }
+#endif /* WITH_WSREP */
}
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
@@ -252,9 +255,14 @@ bool trans_begin(THD *thd, uint flags)
}
#ifdef WITH_WSREP
- thd->wsrep_PA_safe= true;
- if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd))
- DBUG_RETURN(TRUE);
+ if (wsrep_thd_is_local(thd))
+ {
+ if (wsrep_sync_wait(thd))
+ DBUG_RETURN(TRUE);
+ if (!thd->tx_read_only &&
+ wsrep_start_transaction(thd, thd->wsrep_next_trx_id()))
+ DBUG_RETURN(TRUE);
+ }
#endif /* WITH_WSREP */
thd->variables.option_bits|= OPTION_BEGIN;
@@ -299,8 +307,6 @@ bool trans_commit(THD *thd)
if (trans_check(thd))
DBUG_RETURN(TRUE);
- if (WSREP_ON)
- wsrep_register_hton(thd, TRUE);
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
@@ -311,8 +317,6 @@ bool trans_commit(THD *thd)
mysql_mutex_assert_not_owner(&LOCK_after_binlog_sync);
mysql_mutex_assert_not_owner(&LOCK_commit_ordered);
- if (WSREP_ON)
- wsrep_post_commit(thd, TRUE);
/*
if res is non-zero, then ha_commit_trans has rolled back the
transaction, so the hooks for rollback will be called.
@@ -368,14 +372,10 @@ bool trans_commit_implicit(THD *thd)
/* Safety if one did "drop table" on locked tables */
if (!thd->locked_tables_mode)
thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
- if (WSREP_ON)
- wsrep_register_hton(thd, TRUE);
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= MY_TEST(ha_commit_trans(thd, TRUE));
- if (WSREP_ON)
- wsrep_post_commit(thd, TRUE);
}
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
@@ -409,14 +409,9 @@ bool trans_rollback(THD *thd)
int res;
DBUG_ENTER("trans_rollback");
-#ifdef WITH_WSREP
- thd->wsrep_PA_safe= true;
-#endif /* WITH_WSREP */
if (trans_check(thd))
DBUG_RETURN(TRUE);
- if (WSREP_ON)
- wsrep_register_hton(thd, TRUE);
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
@@ -515,14 +510,10 @@ bool trans_commit_stmt(THD *thd)
if (thd->transaction.stmt.ha_list)
{
- if (WSREP_ON)
- wsrep_register_hton(thd, FALSE);
res= ha_commit_trans(thd, FALSE);
if (! thd->in_active_multi_stmt_transaction())
{
trans_reset_one_shot_chistics(thd);
- if (WSREP_ON)
- wsrep_post_commit(thd, FALSE);
}
}
@@ -578,8 +569,6 @@ bool trans_rollback_stmt(THD *thd)
if (thd->transaction.stmt.ha_list)
{
- if (WSREP_ON)
- wsrep_register_hton(thd, FALSE);
ha_rollback_trans(thd, FALSE);
if (! thd->in_active_multi_stmt_transaction())
trans_reset_one_shot_chistics(thd);
@@ -733,7 +722,8 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_CSTRING name)
logging is off.
*/
bool mdl_can_safely_rollback_to_savepoint=
- (!(mysql_bin_log.is_open() && thd->variables.sql_log_bin) ||
+ (!((WSREP_EMULATE_BINLOG_NNULL(thd) || mysql_bin_log.is_open())
+ && thd->variables.sql_log_bin) ||
ha_rollback_to_savepoint_can_release_mdl(thd));
if (ha_rollback_to_savepoint(thd, sv))
@@ -944,13 +934,9 @@ bool trans_xa_commit(THD *thd)
}
else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
{
- if (WSREP_ON)
- wsrep_register_hton(thd, TRUE);
int r= ha_commit_trans(thd, TRUE);
if ((res= MY_TEST(r)))
my_error(r == 1 ? ER_XA_RBROLLBACK : ER_XAER_RMERR, MYF(0));
- if (WSREP_ON)
- wsrep_post_commit(thd, TRUE);
}
else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE)
{
@@ -963,14 +949,12 @@ bool trans_xa_commit(THD *thd)
We allow FLUSHer to COMMIT; we assume FLUSHer knows what it does.
*/
- mdl_request.init(MDL_key::COMMIT, "", "", MDL_INTENTION_EXCLUSIVE,
+ mdl_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT,
MDL_TRANSACTION);
if (thd->mdl_context.acquire_lock(&mdl_request,
thd->variables.lock_wait_timeout))
{
- if (WSREP_ON)
- wsrep_register_hton(thd, TRUE);
ha_rollback_trans(thd, TRUE);
my_error(ER_XAER_RMERR, MYF(0));
}
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 6db2b5e737a..bdc995b51fc 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -173,6 +173,13 @@ void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error
void avgcost_clear( UDF_INIT* initid, char* is_null, char *error );
void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+my_bool avg2_init( UDF_INIT* initid, UDF_ARGS* args, char* message );
+void avg2_deinit( UDF_INIT* initid );
+void avg2_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+void avg2_clear( UDF_INIT* initid, char* is_null, char *error );
+void avg2_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+void avg2_remove( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+double avg2( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
char *is_const(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long
*length, char *is_null, char *error);
@@ -1049,6 +1056,138 @@ avgcost( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)),
return data->totalprice/(double)data->totalquantity;
}
+
+/*
+** Average 2 (number, sum)*/
+struct avg2_data
+{
+ ulonglong count;
+ double sum;
+};
+
+
+my_bool
+avg2_init( UDF_INIT* initid, UDF_ARGS* args, char* message )
+{
+ struct avg2_data* data;
+
+ if (args->arg_count != 2)
+ {
+ strcpy(
+ message,
+ "wrong number of arguments: AVG2() requires two arguments"
+ );
+ return 1;
+ }
+
+ if ((args->arg_type[0] != INT_RESULT) || (args->arg_type[1] != REAL_RESULT) )
+ {
+ strcpy(
+ message,
+ "wrong argument type: AVG2() requires an INT and a REAL"
+ );
+ return 1;
+ }
+
+ /*
+ ** force arguments to double.
+ */
+ /*args->arg_type[0] = REAL_RESULT;
+ args->arg_type[1] = REAL_RESULT;*/
+
+ initid->maybe_null = 0; /* The result may be null */
+ initid->decimals = 4; /* We want 4 decimals in the result */
+ initid->max_length = 20; /* 6 digits + . + 10 decimals */
+
+ if (!(data = (struct avg2_data*) malloc(sizeof(struct avg2_data))))
+ {
+ strmov(message,"Couldn't allocate memory");
+ return 1;
+ }
+ data->count = 0;
+ data->sum = 0.0;
+
+ initid->ptr = (char*)data;
+
+ return 0;
+}
+
+void
+avg2_deinit( UDF_INIT* initid )
+{
+ free(initid->ptr);
+}
+
+
+/* This is only for MySQL 4.0 compability */
+void
+avg2_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
+{
+ avgcost_clear(initid, is_null, message);
+ avgcost_add(initid, args, is_null, message);
+}
+
+/* This is needed to get things to work in MySQL 4.1.1 and above */
+
+void
+avg2_clear(UDF_INIT* initid, char* is_null __attribute__((unused)),
+ char* message __attribute__((unused)))
+{
+ struct avg2_data* data = (struct avg2_data*)initid->ptr;
+ data->sum= 0.0;
+ data->count= 0;
+}
+
+
+void
+avg2_add(UDF_INIT* initid, UDF_ARGS* args,
+ char* is_null __attribute__((unused)),
+ char* message __attribute__((unused)))
+{
+ if (args->args[0] && args->args[1])
+ {
+ struct avg2_data* data = (struct avg2_data*)initid->ptr;
+ longlong quantity = *((longlong*)args->args[0]);
+ double sum = *((double*)args->args[1]);
+
+ data->count += quantity;
+ data->sum += sum;
+ }
+}
+
+
+void
+avg2_remove(UDF_INIT* initid, UDF_ARGS* args,
+ char* is_null __attribute__((unused)),
+ char* message __attribute__((unused)))
+{
+ if (args->args[0] && args->args[1])
+ {
+ struct avg2_data* data = (struct avg2_data*)initid->ptr;
+ longlong quantity = *((longlong*)args->args[0]);
+ double sum = *((double*)args->args[1]);
+
+ data->count -= quantity;
+ data->sum -= sum;
+ }
+}
+
+
+double
+avg2( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)),
+ char* is_null, char* error __attribute__((unused)))
+{
+ struct avg2_data* data = (struct avg2_data*)initid->ptr;
+ if (!data->count)
+ {
+ *is_null = 1;
+ return 0.0;
+ }
+
+ *is_null = 0;
+ return data->sum/(double)data->count;
+}
+
my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args,
char *message);
char *myfunc_argument_name(UDF_INIT *initid, UDF_ARGS *args, char *result,
diff --git a/sql/udf_example.def b/sql/udf_example.def
index 74230b638bf..903c2b74893 100644
--- a/sql/udf_example.def
+++ b/sql/udf_example.def
@@ -23,6 +23,13 @@ EXPORTS
avgcost_add
avgcost_clear
avgcost
+ avg2_init
+ avg2_deinit
+ avg2_reset
+ avg2_add
+ avg2_remove
+ avg2_clear
+ avg2
is_const
is_const_init
check_const_len
diff --git a/sql/unireg.h b/sql/unireg.h
index 6f224ab4894..a24c1b516c5 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -193,7 +193,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table,
#define FRM_HEADER_SIZE 64
#define FRM_FORMINFO_SIZE 288
-#define FRM_MAX_SIZE (512*1024)
+#define FRM_MAX_SIZE (1024*1024)
static inline bool is_binary_frm_header(uchar *head)
{
diff --git a/sql/upgrade_conf_file.cc b/sql/upgrade_conf_file.cc
new file mode 100644
index 00000000000..4e167f0263f
--- /dev/null
+++ b/sql/upgrade_conf_file.cc
@@ -0,0 +1,177 @@
+/*
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+
+/*
+ Variables that were present in older releases, but are now removed.
+ to get the list of variables that are present in current release
+ execute
+
+ SELECT LOWER(variable_name) from INFORMATION_SCHEMA.GLOBAL_VARIABLES ORDER BY 1
+
+ Compare the list between releases to figure out which variables have gone.
+
+ Note : the list below only includes the default-compiled server and none of the
+ loadable plugins.
+*/
+#include <windows.h>
+#include <initializer_list>
+#include <stdlib.h>
+#include <stdio.h>
+#include <algorithm>
+
+static const char *removed_variables[] =
+{
+"aria_recover",
+"debug_crc_break",
+"engine_condition_pushdown",
+"have_csv",
+"have_innodb",
+"have_ndbcluster",
+"have_partitioning",
+"innodb_adaptive_flushing_method",
+"innodb_adaptive_hash_index_partitions",
+"innodb_additional_mem_pool_size",
+"innodb_api_bk_commit_interval",
+"innodb_api_disable_rowlock",
+"innodb_api_enable_binlog",
+"innodb_api_enable_mdl",
+"innodb_api_trx_level",
+"innodb_blocking_buffer_pool_restore",
+"innodb_buffer_pool_populate",
+"innodb_buffer_pool_restore_at_startup",
+"innodb_buffer_pool_shm_checksum",
+"innodb_buffer_pool_shm_key",
+"innodb_checkpoint_age_target",
+"innodb_cleaner_eviction_factor",
+"innodb_cleaner_flush_chunk_size",
+"innodb_cleaner_free_list_lwm",
+"innodb_cleaner_lru_chunk_size",
+"innodb_cleaner_lsn_age_factor",
+"innodb_cleaner_max_flush_time",
+"innodb_cleaner_max_lru_time",
+"innodb_corrupt_table_action",
+"innodb_dict_size_limit",
+"innodb_doublewrite_file",
+"innodb_empty_free_list_algorithm",
+"innodb_fake_changes",
+"innodb_fast_checksum",
+"innodb_file_format",
+"innodb_file_format_check",
+"innodb_file_format_max",
+"innodb_flush_neighbor_pages",
+"innodb_foreground_preflush",
+"innodb_ibuf_accel_rate",
+"innodb_ibuf_active_contract",
+"innodb_ibuf_max_size",
+"innodb_import_table_from_xtrabackup",
+"innodb_instrument_semaphores",
+"innodb_kill_idle_transaction",
+"innodb_large_prefix",
+"innodb_lazy_drop_table",
+"innodb_locking_fake_changes",
+"innodb_log_arch_dir",
+"innodb_log_arch_expire_sec",
+"innodb_log_archive",
+"innodb_log_block_size",
+"innodb_log_checksum_algorithm",
+"innodb_max_bitmap_file_size",
+"innodb_max_changed_pages",
+"innodb_merge_sort_block_size",
+"innodb_mirrored_log_groups",
+"innodb_mtflush_threads",
+"innodb_persistent_stats_root_page",
+"innodb_print_lock_wait_timeout_info",
+"innodb_purge_run_now",
+"innodb_purge_stop_now",
+"innodb_read_ahead",
+"innodb_recovery_stats",
+"innodb_recovery_update_relay_log",
+"innodb_show_locks_held",
+"innodb_show_verbose_locks",
+"innodb_stats_auto_update",
+"innodb_stats_update_need_lock",
+"innodb_support_xa",
+"innodb_thread_concurrency_timer_based",
+"innodb_track_changed_pages",
+"innodb_track_redo_log_now",
+"innodb_use_fallocate",
+"innodb_use_global_flush_log_at_trx_commit",
+"innodb_use_mtflush",
+"innodb_use_stacktrace",
+"innodb_use_sys_malloc",
+"innodb_use_sys_stats_table",
+"innodb_use_trim",
+"log",
+"log_slow_queries",
+"rpl_recovery_rank",
+"sql_big_tables",
+"sql_low_priority_updates",
+"sql_max_join_size"
+};
+
+
+static int cmp_strings(const void* a, const void *b)
+{
+ return strcmp((const char *)a, *(const char **)b);
+}
+
+/**
+ Convert file from a previous version, by removing
+*/
+int upgrade_config_file(const char *myini_path)
+{
+#define MY_INI_SECTION_SIZE 32*1024 +3
+ static char section_data[MY_INI_SECTION_SIZE];
+ for (const char *section_name : { "mysqld","server","mariadb" })
+ {
+ DWORD size = GetPrivateProfileSection(section_name, section_data, MY_INI_SECTION_SIZE, myini_path);
+ if (size == MY_INI_SECTION_SIZE - 2)
+ {
+ return -1;
+ }
+
+ for (char *keyval = section_data; *keyval; keyval += strlen(keyval) + 1)
+ {
+ char varname[256];
+ char *key_end = strchr(keyval, '=');
+ if (!key_end)
+ key_end = keyval+ strlen(keyval);
+
+ if (key_end - keyval > sizeof(varname))
+ continue;
+ // copy and normalize (convert dash to underscore) to variable names
+ for (char *p = keyval, *q = varname;; p++,q++)
+ {
+ if (p == key_end)
+ {
+ *q = 0;
+ break;
+ }
+ *q = (*p == '-') ? '_' : *p;
+ }
+ const char *v = (const char *)bsearch(varname, removed_variables, sizeof(removed_variables) / sizeof(removed_variables[0]),
+ sizeof(char *), cmp_strings);
+
+ if (v)
+ {
+ fprintf(stdout, "Removing variable '%s' from config file\n", varname);
+ // delete variable
+ *key_end = 0;
+ WritePrivateProfileString(section_name, keyval, 0, myini_path);
+ }
+ }
+ }
+ return 0;
+}
diff --git a/sql/vers_string.h b/sql/vers_string.h
index 75abd40d5fa..9d8ca358565 100644
--- a/sql/vers_string.h
+++ b/sql/vers_string.h
@@ -58,6 +58,12 @@ class Lex_cstring : public LEX_CSTRING
str= _str;
length= _len;
}
+ Lex_cstring(const char *start, const char *end)
+ {
+ DBUG_ASSERT(start <= end);
+ str= start;
+ length= end - start;
+ }
void set(const char *_str, size_t _len)
{
str= _str;
diff --git a/sql/vers_utils.h b/sql/vers_utils.h
index e896f84135e..2bea191da9e 100644
--- a/sql/vers_utils.h
+++ b/sql/vers_utils.h
@@ -5,43 +5,4 @@
#include "sql_class.h"
#include "vers_string.h"
-class MDL_auto_lock
-{
- THD *thd;
- TABLE_LIST &table;
- bool error;
-
-public:
- MDL_auto_lock(THD *_thd, TABLE_LIST &_table) :
- thd(_thd), table(_table)
- {
- DBUG_ASSERT(thd);
- MDL_request protection_request;
- if (thd->global_read_lock.can_acquire_protection())
- {
- error= true;
- return;
- }
- protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
- MDL_EXPLICIT);
- error= thd->mdl_context.acquire_lock(&protection_request, thd->variables.lock_wait_timeout);
- if (error)
- return;
-
- table.mdl_request.init(MDL_key::TABLE, table.db.str, table.table_name.str, MDL_EXCLUSIVE, MDL_EXPLICIT);
- error= thd->mdl_context.acquire_lock(&table.mdl_request, thd->variables.lock_wait_timeout);
- thd->mdl_context.release_lock(protection_request.ticket);
- }
- ~MDL_auto_lock()
- {
- if (!error)
- {
- DBUG_ASSERT(table.mdl_request.ticket);
- thd->mdl_context.release_lock(table.mdl_request.ticket);
- table.mdl_request.ticket= NULL;
- }
- }
- bool acquire_error() const { return error; }
-};
-
#endif // VERS_UTILS_INCLUDED
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index 1f50ee55711..2c4dab3bd20 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -14,12 +14,17 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#include "mariadb.h"
+#include "mysql/service_wsrep.h"
+#include "wsrep_applier.h"
+
#include "wsrep_priv.h"
#include "wsrep_binlog.h" // wsrep_dump_rbr_buf()
#include "wsrep_xid.h"
+#include "wsrep_thd.h"
+#include "wsrep_trans_observer.h"
+#include "slave.h" // opt_log_slave_updates
#include "log_event.h" // class THD, EVENT_LEN_OFFSET, etc.
-#include "wsrep_applier.h"
#include "debug_sync.h"
/*
@@ -27,7 +32,6 @@
At the end (*buf) is shitfed to point to the following event or NULL and
(*buf_len) will be changed to account just being read bytes of the 1st event.
*/
-
static Log_event* wsrep_read_log_event(
char **arg_buf, size_t *arg_buf_len,
const Format_description_log_event *description_event)
@@ -35,7 +39,7 @@ static Log_event* wsrep_read_log_event(
DBUG_ENTER("wsrep_read_log_event");
char *head= (*arg_buf);
- uint data_len = uint4korr(head + EVENT_LEN_OFFSET);
+ uint data_len= uint4korr(head + EVENT_LEN_OFFSET);
char *buf= (*arg_buf);
const char *error= 0;
Log_event *res= 0;
@@ -62,12 +66,13 @@ void wsrep_set_apply_format(THD* thd, Format_description_log_event* ev)
{
if (thd->wsrep_apply_format)
{
- delete (Format_description_log_event*)thd->wsrep_apply_format;
+ delete (Format_description_log_event*)thd->wsrep_apply_format;
}
thd->wsrep_apply_format= ev;
}
-Format_description_log_event* wsrep_get_apply_format(THD* thd)
+Format_description_log_event*
+wsrep_get_apply_format(THD* thd)
{
if (thd->wsrep_apply_format)
{
@@ -79,45 +84,77 @@ Format_description_log_event* wsrep_get_apply_format(THD* thd)
return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
}
-static wsrep_cb_status_t wsrep_apply_events(THD* thd,
- const void* events_buf,
- size_t buf_len)
+void wsrep_apply_error::store(const THD* const thd)
{
- char *buf= (char *)events_buf;
- int rcode= 0;
- int event= 1;
- Log_event_type typ;
+ Diagnostics_area::Sql_condition_iterator it=
+ thd->get_stmt_da()->sql_conditions();
+ const Sql_condition* cond;
- DBUG_ENTER("wsrep_apply_events");
+ static size_t const max_len= 2*MAX_SLAVE_ERRMSG; // 2x so that we have enough
+
+ if (NULL == str_)
+ {
+ // this must be freeable by standard free()
+ str_= static_cast<char*>(malloc(max_len));
+ if (NULL == str_)
+ {
+ WSREP_ERROR("Failed to allocate %zu bytes for error buffer.", max_len);
+ len_= 0;
+ return;
+ }
+ }
+ else
+ {
+ /* This is possible when we invoke rollback after failed applying.
+ * In this situation DA should not be reset yet and should contain
+ * all previous errors from applying and new ones from rollbacking,
+ * so we just overwrite is from scratch */
+ }
- if (thd->killed == KILL_CONNECTION &&
- thd->wsrep_conflict_state != REPLAYING)
+ char* slider= str_;
+ const char* const buf_end= str_ + max_len - 1; // -1: leave space for \0
+
+ for (cond= it++; cond && slider < buf_end; cond= it++)
{
- WSREP_INFO("applier has been aborted, skipping apply_rbr: %lld",
- (long long) wsrep_thd_trx_seqno(thd));
- DBUG_RETURN(WSREP_CB_FAILURE);
+ uint const err_code= cond->get_sql_errno();
+ const char* const err_str= cond->get_message_text();
+
+ slider+= my_snprintf(slider, buf_end - slider, " %s, Error_code: %d;",
+ err_str, err_code);
}
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_EXEC;
- if (thd->wsrep_conflict_state!= REPLAYING)
- thd->wsrep_conflict_state= NO_CONFLICT;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ *slider= '\0';
+ len_= slider - str_ + 1; // +1: add \0
+
+ WSREP_DEBUG("Error buffer for thd %llu seqno %lld, %zu bytes: %s",
+ thd->thread_id, (long long)wsrep_thd_trx_seqno(thd),
+ len_, str_ ? str_ : "(null)");
+}
+
+int wsrep_apply_events(THD* thd,
+ Relay_log_info* rli,
+ const void* events_buf,
+ size_t buf_len)
+{
+ char *buf= (char *)events_buf;
+ int rcode= 0;
+ int event= 1;
+ Log_event_type typ;
+ DBUG_ENTER("wsrep_apply_events");
if (!buf_len) WSREP_DEBUG("empty rbr buffer to apply: %lld",
(long long) wsrep_thd_trx_seqno(thd));
- while(buf_len)
+ while (buf_len)
{
int exec_res;
Log_event* ev= wsrep_read_log_event(&buf, &buf_len,
- wsrep_get_apply_format(thd));
-
+ wsrep_get_apply_format(thd));
if (!ev)
{
WSREP_ERROR("applier could not read binlog event, seqno: %lld, len: %zu",
(long long)wsrep_thd_trx_seqno(thd), buf_len);
- rcode= 1;
+ rcode= WSREP_ERR_BAD_EVENT;
goto error;
}
@@ -147,9 +184,12 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
thd->set_server_id(ev->server_id);
thd->set_time(); // time the query
thd->transaction.start_time.reset(thd);
+ //#define mariadb_10_4_0
+#ifdef mariadb_10_4_0
wsrep_xid_init(&thd->transaction.xid_state.xid,
thd->wsrep_trx_meta.gtid.uuid,
thd->wsrep_trx_meta.gtid.seqno);
+#endif
thd->lex->current_select= 0;
if (!ev->when)
{
@@ -162,13 +202,13 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
(thd->variables.option_bits & ~OPTION_SKIP_REPLICATION) |
(ev->flags & LOG_EVENT_SKIP_REPLICATION_F ? OPTION_SKIP_REPLICATION : 0);
- ev->thd = thd;
- exec_res = ev->apply_event(thd->wsrep_rgi);
+ ev->thd= thd;
+ exec_res= ev->apply_event(thd->wsrep_rgi);
DBUG_PRINT("info", ("exec_event result: %d", exec_res));
if (exec_res)
{
- WSREP_WARN("RBR event %d %s apply warning: %d, %lld",
+ WSREP_WARN("Event %d %s apply failed: %d, seqno %lld",
event, ev->get_type_str(), exec_res,
(long long) wsrep_thd_trx_seqno(thd));
rcode= exec_res;
@@ -178,230 +218,14 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
}
event++;
- if (thd->wsrep_conflict_state!= NO_CONFLICT &&
- thd->wsrep_conflict_state!= REPLAYING)
- WSREP_WARN("conflict state after RBR event applying: %d, %lld",
- thd->wsrep_query_state, (long long)wsrep_thd_trx_seqno(thd));
-
- if (thd->wsrep_conflict_state == MUST_ABORT) {
- WSREP_WARN("RBR event apply failed, rolling back: %lld",
- (long long) wsrep_thd_trx_seqno(thd));
- trans_rollback(thd);
- thd->locked_tables_list.unlock_locked_tables(thd);
- /* Release transactional metadata locks. */
- thd->mdl_context.release_transactional_locks();
- thd->wsrep_conflict_state= NO_CONFLICT;
- DBUG_RETURN(WSREP_CB_FAILURE);
- }
-
delete_or_keep_event_post_apply(thd->wsrep_rgi, typ, ev);
}
- error:
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_IDLE;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-
- assert(thd->wsrep_exec_mode== REPL_RECV);
-
+error:
if (thd->killed == KILL_CONNECTION)
WSREP_INFO("applier aborted: %lld", (long long)wsrep_thd_trx_seqno(thd));
- if (rcode) DBUG_RETURN(WSREP_CB_FAILURE);
- DBUG_RETURN(WSREP_CB_SUCCESS);
-}
-
-wsrep_cb_status_t wsrep_apply_cb(void* const ctx,
- const void* const buf,
- size_t const buf_len,
- uint32_t const flags,
- const wsrep_trx_meta_t* meta)
-{
- THD* const thd((THD*)ctx);
-
- assert(thd->wsrep_apply_toi == false);
-
- // Allow tests to block the applier thread using the DBUG facilities.
- DBUG_EXECUTE_IF("sync.wsrep_apply_cb",
- {
- const char act[]=
- "now "
- "SIGNAL sync.wsrep_apply_cb_reached "
- "WAIT_FOR signal.wsrep_apply_cb";
- DBUG_ASSERT(!debug_sync_set_action(thd,
- STRING_WITH_LEN(act)));
- };);
-
- thd->wsrep_trx_meta = *meta;
-
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Applying write set %lld: %p, %zu",
- (long long)wsrep_thd_trx_seqno(thd), buf, buf_len);
- thd_proc_info(thd, thd->wsrep_info);
-#else
- thd_proc_info(thd, "Applying write set");
-#endif /* WSREP_PROC_INFO */
-
- /* tune FK and UK checking policy */
- if (wsrep_slave_UK_checks == FALSE)
- thd->variables.option_bits|= OPTION_RELAXED_UNIQUE_CHECKS;
- else
- thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS;
-
- if (wsrep_slave_FK_checks == FALSE)
- thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
- else
- thd->variables.option_bits&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
-
- /* With galera we assume that the master has done the constraint checks */
- thd->variables.option_bits|= OPTION_NO_CHECK_CONSTRAINT_CHECKS;
-
- if (flags & WSREP_FLAG_ISOLATION)
- {
- thd->wsrep_apply_toi= true;
- /*
- Don't run in transaction mode with TOI actions.
- */
- thd->variables.option_bits&= ~OPTION_BEGIN;
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
- }
- wsrep_cb_status_t rcode(wsrep_apply_events(thd, buf, buf_len));
-
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Applied write set %lld", (long long)wsrep_thd_trx_seqno(thd));
- thd_proc_info(thd, thd->wsrep_info);
-#else
- thd_proc_info(thd, "Applied write set");
-#endif /* WSREP_PROC_INFO */
-
- if (WSREP_CB_SUCCESS != rcode)
- {
- wsrep_dump_rbr_buf_with_header(thd, buf, buf_len);
- }
-
- if (thd->has_thd_temporary_tables())
- {
- WSREP_DEBUG("Applier %lld has temporary tables. Closing them now..",
- thd->thread_id);
- thd->close_temporary_tables();
- }
-
- return rcode;
-}
-
-static wsrep_cb_status_t wsrep_commit(THD* const thd)
-{
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Committing %lld", (long long)wsrep_thd_trx_seqno(thd));
- thd_proc_info(thd, thd->wsrep_info);
-#else
- thd_proc_info(thd, "Committing");
-#endif /* WSREP_PROC_INFO */
-
- wsrep_cb_status_t const rcode(trans_commit(thd) ?
- WSREP_CB_FAILURE : WSREP_CB_SUCCESS);
-
- if (WSREP_CB_SUCCESS == rcode)
- {
- thd->wsrep_rgi->cleanup_context(thd, false);
-#ifdef GTID_SUPPORT
- thd->variables.gtid_next.set_automatic();
-#endif /* GTID_SUPPORT */
- if (thd->wsrep_apply_toi)
- {
- wsrep_set_SE_checkpoint(thd->wsrep_trx_meta.gtid.uuid,
- thd->wsrep_trx_meta.gtid.seqno);
- }
- }
-
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Committed %lld", (long long) wsrep_thd_trx_seqno(thd));
- thd_proc_info(thd, thd->wsrep_info);
-#else
- thd_proc_info(thd, "Committed");
-#endif /* WSREP_PROC_INFO */
-
- return rcode;
-}
-
-static wsrep_cb_status_t wsrep_rollback(THD* const thd)
-{
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Rolling back %lld", (long long)wsrep_thd_trx_seqno(thd));
- thd_proc_info(thd, thd->wsrep_info);
-#else
- thd_proc_info(thd, "Rolling back");
-#endif /* WSREP_PROC_INFO */
-
- wsrep_cb_status_t const rcode(trans_rollback(thd) ?
- WSREP_CB_FAILURE : WSREP_CB_SUCCESS);
-
-#ifdef WSREP_PROC_INFO
- snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
- "Rolled back %lld", (long long)wsrep_thd_trx_seqno(thd));
- thd_proc_info(thd, thd->wsrep_info);
-#else
- thd_proc_info(thd, "Rolled back");
-#endif /* WSREP_PROC_INFO */
-
- return rcode;
-}
-
-wsrep_cb_status_t wsrep_commit_cb(void* const ctx,
- uint32_t const flags,
- const wsrep_trx_meta_t* meta,
- wsrep_bool_t* const exit,
- bool const commit)
-{
- THD* const thd((THD*)ctx);
-
- assert(meta->gtid.seqno == wsrep_thd_trx_seqno(thd));
-
- wsrep_cb_status_t rcode;
-
- if (commit)
- rcode = wsrep_commit(thd);
- else
- rcode = wsrep_rollback(thd);
-
- /* Cleanup */
wsrep_set_apply_format(thd, NULL);
- thd->mdl_context.release_transactional_locks();
- thd->reset_query(); /* Mutex protected */
- free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
- thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
- if (wsrep_slave_count_change < 0 && commit && WSREP_CB_SUCCESS == rcode)
- {
- mysql_mutex_lock(&LOCK_wsrep_slave_threads);
- if (wsrep_slave_count_change < 0)
- {
- wsrep_slave_count_change++;
- *exit = true;
- }
- mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
- }
-
- if (thd->wsrep_applier)
- {
- /* From trans_begin() */
- thd->variables.option_bits|= OPTION_BEGIN;
- thd->server_status|= SERVER_STATUS_IN_TRANS;
- thd->wsrep_apply_toi= false;
- }
-
- return rcode;
-}
-
-
-wsrep_cb_status_t wsrep_unordered_cb(void* const ctx,
- const void* const data,
- size_t const size)
-{
- return WSREP_CB_SUCCESS;
+ DBUG_RETURN(rcode);
}
diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h
index f19d2d46d0c..a8da2acbb9a 100644
--- a/sql/wsrep_applier.h
+++ b/sql/wsrep_applier.h
@@ -1,4 +1,4 @@
-/* Copyright 2013 Codership Oy <http://www.codership.com>
+/* Copyright 2013-2015 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,28 +17,57 @@
#define WSREP_APPLIER_H
#include <my_config.h>
-#include "../wsrep/wsrep_api.h"
-void wsrep_set_apply_format(THD* thd, Format_description_log_event* ev);
-Format_description_log_event* wsrep_get_apply_format(THD* thd);
+#include "sql_class.h" // THD class
+
+int wsrep_apply_events(THD* thd,
+ Relay_log_info* rli,
+ const void* events_buf,
+ size_t buf_len);
-/* wsrep callback prototypes */
-extern "C" {
-wsrep_cb_status_t wsrep_apply_cb(void *ctx,
- const void* buf, size_t buf_len,
- uint32_t flags,
- const wsrep_trx_meta_t* meta);
+/* Applier error codes, when nothing better is available. */
+#define WSREP_RET_SUCCESS 0 // Success
+#define WSREP_ERR_GENERIC 1 // When in doubt (MySQL default error code)
+#define WSREP_ERR_BAD_EVENT 2 // Can't parse event
+#define WSREP_ERR_NOT_FOUND 3 // Key. table, schema not found
+#define WSREP_ERR_EXISTS 4 // Key, table, schema already exists
+#define WSREP_ERR_WRONG_TYPE 5 // Incompatible data type
+#define WSREP_ERR_FAILED 6 // Operation failed for some internal reason
+#define WSREP_ERR_ABORTED 7 // Operation was aborted externally
-wsrep_cb_status_t wsrep_commit_cb(void *ctx,
- uint32_t flags,
- const wsrep_trx_meta_t* meta,
- wsrep_bool_t* exit,
- bool commit);
+class wsrep_apply_error
+{
+public:
+ wsrep_apply_error() : str_(NULL), len_(0) {};
+ ~wsrep_apply_error() { ::free(str_); }
+ /* stores the current THD error info from the diagnostic area. Works only
+ * once, subsequent invocations are ignored in order to preserve the original
+ * condition. */
+ void store(const THD* thd);
+ const char* c_str() const { return str_; }
+ size_t length() const { return len_; }
+ bool is_null() const { return (c_str() == NULL && length() == 0); }
+ wsrep_buf_t get_buf() const
+ {
+ wsrep_buf_t ret= { c_str(), length() };
+ return ret;
+ }
+private:
+ char* str_;
+ size_t len_;
+};
+
+class Format_description_log_event;
+void wsrep_set_apply_format(THD*, Format_description_log_event*);
+Format_description_log_event* wsrep_get_apply_format(THD* thd);
+int wsrep_apply(void* ctx,
+ uint32_t flags,
+ const wsrep_buf_t* buf,
+ const wsrep_trx_meta_t* meta,
+ wsrep_apply_error& err);
-wsrep_cb_status_t wsrep_unordered_cb(void* ctx,
- const void* data,
- size_t size);
+wsrep_cb_status_t wsrep_unordered_cb(void* ctx,
+ const wsrep_buf_t* data);
-} /* extern "C" */
#endif /* WSREP_APPLIER_H */
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index 0cbcdcd64aa..8fcb2fae694 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -14,12 +14,15 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#include "mariadb.h"
+#include "mysql/service_wsrep.h"
#include "wsrep_binlog.h"
#include "wsrep_priv.h"
#include "log.h"
#include "log_event.h"
#include "wsrep_applier.h"
+#include "transaction.h"
+
extern handlerton *binlog_hton;
/*
Write the contents of a cache to a memory buffer.
@@ -40,10 +43,10 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len)
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
- uint length = my_b_bytes_in_cache(cache);
- if (unlikely(0 == length)) length = my_b_fill(cache);
+ uint length= my_b_bytes_in_cache(cache);
+ if (unlikely(0 == length)) length= my_b_fill(cache);
- size_t total_length = 0;
+ size_t total_length= 0;
if (likely(length > 0)) do
{
@@ -60,7 +63,7 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len)
wsrep_max_ws_size, total_length);
goto error;
}
- uchar* tmp = (uchar *)my_realloc(*buf, total_length,
+ uchar* tmp= (uchar *)my_realloc(*buf, total_length,
MYF(MY_ALLOW_ZERO_PTR));
if (!tmp)
{
@@ -68,17 +71,17 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len)
*buf_len, length);
goto error;
}
- *buf = tmp;
+ *buf= tmp;
memcpy(*buf + *buf_len, cache->read_pos, length);
- *buf_len = total_length;
+ *buf_len= total_length;
if (cache->file < 0)
{
cache->read_pos= cache->read_end;
break;
}
- } while ((length = my_b_fill(cache)));
+ } while ((length= my_b_fill(cache)));
if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
{
@@ -104,137 +107,6 @@ cleanup:
* many transactions would fit in there
* so there is no need to reach for the heap */
-/* Returns minimum multiple of HEAP_PAGE_SIZE that is >= length */
-static inline size_t
-heap_size(size_t length)
-{
- return (length + HEAP_PAGE_SIZE - 1)/HEAP_PAGE_SIZE*HEAP_PAGE_SIZE;
-}
-
-/* append data to writeset */
-static inline wsrep_status_t
-wsrep_append_data(wsrep_t* const wsrep,
- wsrep_ws_handle_t* const ws,
- const void* const data,
- size_t const len)
-{
- struct wsrep_buf const buff = { data, len };
- wsrep_status_t const rc(wsrep->append_data(wsrep, ws, &buff, 1,
- WSREP_DATA_ORDERED, true));
- DBUG_DUMP("buff", (uchar*) data, len);
- if (rc != WSREP_OK)
- {
- WSREP_WARN("append_data() returned %d", rc);
- }
-
- return rc;
-}
-
-/*
- Write the contents of a cache to wsrep provider.
-
- This function quite the same as MYSQL_BIN_LOG::write_cache(),
- with the exception that here we write in buffer instead of log file.
-
- This version reads all of cache into single buffer and then appends to a
- writeset at once.
- */
-static int wsrep_write_cache_once(wsrep_t* const wsrep,
- THD* const thd,
- IO_CACHE* const cache,
- size_t* const len)
-{
- my_off_t const saved_pos(my_b_tell(cache));
- DBUG_ENTER("wsrep_write_cache_once");
-
- if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
- {
- WSREP_ERROR("failed to initialize io-cache");
- DBUG_RETURN(ER_ERROR_ON_WRITE);
- }
-
- int err(WSREP_OK);
-
- size_t total_length(0);
- uchar stack_buf[STACK_SIZE]; /* to avoid dynamic allocations for few data*/
- uchar* heap_buf(NULL);
- uchar* buf(stack_buf);
- size_t allocated(sizeof(stack_buf));
- size_t used(0);
-
- uint length(my_b_bytes_in_cache(cache));
- if (unlikely(0 == length)) length = my_b_fill(cache);
-
- if (likely(length > 0)) do
- {
- total_length += length;
- /*
- Bail out if buffer grows too large.
- A temporary fix to avoid allocating indefinitely large buffer,
- not a real limit on a writeset size which includes other things
- like header and keys.
- */
- if (unlikely(total_length > wsrep_max_ws_size))
- {
- WSREP_WARN("transaction size limit (%lu) exceeded: %zu",
- wsrep_max_ws_size, total_length);
- err = WSREP_TRX_SIZE_EXCEEDED;
- goto cleanup;
- }
-
- if (total_length > allocated)
- {
- size_t const new_size(heap_size(total_length));
- uchar* tmp = (uchar *)my_realloc(heap_buf, new_size,
- MYF(MY_ALLOW_ZERO_PTR));
- if (!tmp)
- {
- WSREP_ERROR("could not (re)allocate buffer: %zu + %u",
- allocated, length);
- err = WSREP_TRX_SIZE_EXCEEDED;
- goto cleanup;
- }
-
- heap_buf = tmp;
- buf = heap_buf;
- allocated = new_size;
-
- if (used <= STACK_SIZE && used > 0) // there's data in stack_buf
- {
- DBUG_ASSERT(buf == stack_buf);
- memcpy(heap_buf, stack_buf, used);
- }
- }
-
- memcpy(buf + used, cache->read_pos, length);
- used = total_length;
- if (cache->file < 0)
- {
- cache->read_pos= cache->read_end;
- break;
- }
- } while ((length = my_b_fill(cache)));
-
- if (used > 0)
- err = wsrep_append_data(wsrep, &thd->wsrep_ws_handle, buf, used);
-
- if (WSREP_OK == err) *len = total_length;
-
-cleanup:
- if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
- {
- WSREP_ERROR("failed to reinitialize io-cache");
- }
-
- if (unlikely(WSREP_OK != err))
- {
- wsrep_dump_rbr_buf_with_header(thd, buf, used);
- }
-
- my_free(heap_buf);
- DBUG_RETURN(err);
-}
-
/*
Write the contents of a cache to wsrep provider.
@@ -243,62 +115,58 @@ cleanup:
This version uses incremental data appending as it reads it from cache.
*/
-static int wsrep_write_cache_inc(wsrep_t* const wsrep,
- THD* const thd,
+static int wsrep_write_cache_inc(THD* const thd,
IO_CACHE* const cache,
size_t* const len)
{
- my_off_t const saved_pos(my_b_tell(cache));
- DBUG_ENTER("wsrep_write_cache_inc");
-
- if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
- {
- WSREP_ERROR("failed to initialize io-cache");
- DBUG_RETURN(WSREP_TRX_ERROR);
- }
+ DBUG_ENTER("wsrep_write_cache_inc");
+ my_off_t const saved_pos(my_b_tell(cache));
- int err(WSREP_OK);
+ if (reinit_io_cache(cache, READ_CACHE, thd->wsrep_sr().bytes_certified(), 0, 0))
+ {
+ WSREP_ERROR("failed to initialize io-cache");
+ DBUG_RETURN(1);;
+ }
- size_t total_length(0);
+ int ret= 0;
+ size_t total_length(0);
- uint length(my_b_bytes_in_cache(cache));
- if (unlikely(0 == length)) length = my_b_fill(cache);
+ uint length(my_b_bytes_in_cache(cache));
+ if (unlikely(0 == length)) length= my_b_fill(cache);
- if (likely(length > 0)) do
+ if (likely(length > 0))
+ {
+ do
{
- total_length += length;
- /* bail out if buffer grows too large
- not a real limit on a writeset size which includes other things
- like header and keys.
- */
- if (unlikely(total_length > wsrep_max_ws_size))
- {
- WSREP_WARN("transaction size limit (%lu) exceeded: %zu",
- wsrep_max_ws_size, total_length);
- err = WSREP_TRX_SIZE_EXCEEDED;
- goto cleanup;
- }
-
- if(WSREP_OK != (err=wsrep_append_data(wsrep, &thd->wsrep_ws_handle,
- cache->read_pos, length)))
- goto cleanup;
-
- if (cache->file < 0)
- {
- cache->read_pos= cache->read_end;
- break;
- }
- } while ((length = my_b_fill(cache)));
-
- if (WSREP_OK == err) *len = total_length;
+ total_length += length;
+ /* bail out if buffer grows too large
+ not a real limit on a writeset size which includes other things
+ like header and keys.
+ */
+ if (unlikely(total_length > wsrep_max_ws_size))
+ {
+ WSREP_WARN("transaction size limit (%lu) exceeded: %zu",
+ wsrep_max_ws_size, total_length);
+ ret= 1;
+ goto cleanup;
+ }
+ if (thd->wsrep_cs().append_data(wsrep::const_buffer(cache->read_pos, length)))
+ goto cleanup;
+ cache->read_pos= cache->read_end;
+ } while ((cache->file >= 0) && (length= my_b_fill(cache)));
+ }
+ if (ret == 0)
+ {
+ assert(total_length + thd->wsrep_sr().bytes_certified() == saved_pos);
+ }
cleanup:
- if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
- {
- WSREP_ERROR("failed to reinitialize io-cache");
- }
-
- DBUG_RETURN(err);
+ *len= total_length;
+ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
+ {
+ WSREP_ERROR("failed to reinitialize io-cache");
+ }
+ DBUG_RETURN(ret);
}
/*
@@ -307,17 +175,11 @@ cleanup:
This function quite the same as MYSQL_BIN_LOG::write_cache(),
with the exception that here we write in buffer instead of log file.
*/
-int wsrep_write_cache(wsrep_t* const wsrep,
- THD* const thd,
+int wsrep_write_cache(THD* const thd,
IO_CACHE* const cache,
size_t* const len)
{
- if (wsrep_incremental_data_collection) {
- return wsrep_write_cache_inc(wsrep, thd, cache, len);
- }
- else {
- return wsrep_write_cache_once(wsrep, thd, cache, len);
- }
+ return wsrep_write_cache_inc(thd, cache, len);
}
void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len)
@@ -383,80 +245,17 @@ int wsrep_binlog_close_connection(THD* thd)
int wsrep_binlog_savepoint_set(THD *thd, void *sv)
{
if (!wsrep_emulate_bin_log) return 0;
- int rcode = binlog_hton->savepoint_set(binlog_hton, thd, sv);
+ int rcode= binlog_hton->savepoint_set(binlog_hton, thd, sv);
return rcode;
}
int wsrep_binlog_savepoint_rollback(THD *thd, void *sv)
{
if (!wsrep_emulate_bin_log) return 0;
- int rcode = binlog_hton->savepoint_rollback(binlog_hton, thd, sv);
+ int rcode= binlog_hton->savepoint_rollback(binlog_hton, thd, sv);
return rcode;
}
-#if 0
-void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache)
-{
- char filename[PATH_MAX]= {0};
- int len= snprintf(filename, PATH_MAX, "%s/GRA_%lld_%lld.log",
- wsrep_data_home_dir, (longlong) thd->thread_id,
- (longlong) wsrep_thd_trx_seqno(thd));
- size_t bytes_in_cache = 0;
- // check path
- if (len >= PATH_MAX)
- {
- WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len);
- return ;
- }
- // init cache
- my_off_t const saved_pos(my_b_tell(cache));
- if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
- {
- WSREP_ERROR("failed to initialize io-cache");
- return ;
- }
- // open file
- FILE* of = fopen(filename, "wb");
- if (!of)
- {
- WSREP_ERROR("Failed to open file '%s': %d (%s)",
- filename, errno, strerror(errno));
- goto cleanup;
- }
- // ready to write
- bytes_in_cache= my_b_bytes_in_cache(cache);
- if (unlikely(bytes_in_cache == 0)) bytes_in_cache = my_b_fill(cache);
- if (likely(bytes_in_cache > 0)) do
- {
- if (my_fwrite(of, cache->read_pos, bytes_in_cache,
- MYF(MY_WME | MY_NABP)) == (size_t) -1)
- {
- WSREP_ERROR("Failed to write file '%s'", filename);
- goto cleanup;
- }
-
- if (cache->file < 0)
- {
- cache->read_pos= cache->read_end;
- break;
- }
- } while ((bytes_in_cache= my_b_fill(cache)));
- if (cache->error == -1)
- {
- WSREP_ERROR("RBR inconsistent");
- goto cleanup;
- }
-cleanup:
- // init back
- if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
- {
- WSREP_ERROR("failed to reinitialize io-cache");
- }
- // close file
- if (of) fclose(of);
-}
-#endif
-
void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end)
{
thd->binlog_flush_pending_rows_event(stmt_end);
@@ -544,3 +343,31 @@ cleanup1:
DBUG_VOID_RETURN;
}
+#include "log_event.h"
+
+int wsrep_write_skip_event(THD* thd)
+{
+ DBUG_ENTER("wsrep_write_skip_event");
+ Ignorable_log_event skip_event(thd);
+ int ret= mysql_bin_log.write_event(&skip_event);
+ if (ret)
+ {
+ WSREP_WARN("wsrep_write_skip_event: write to binlog failed: %d", ret);
+ }
+ if (!ret && (ret= trans_commit_stmt(thd)))
+ {
+ WSREP_WARN("wsrep_write_skip_event: statt commit failed");
+ }
+ DBUG_RETURN(ret);
+}
+
+int wsrep_write_dummy_event_low(THD *thd, const char *msg)
+{
+ ::abort();
+ return 0;
+}
+
+int wsrep_write_dummy_event(THD *orig_thd, const char *msg)
+{
+ return 0;
+}
diff --git a/sql/wsrep_binlog.h b/sql/wsrep_binlog.h
index 864813d5c98..4cef38c85d3 100644
--- a/sql/wsrep_binlog.h
+++ b/sql/wsrep_binlog.h
@@ -16,6 +16,7 @@
#ifndef WSREP_BINLOG_H
#define WSREP_BINLOG_H
+#include "my_global.h"
#include "sql_class.h" // THD, IO_CACHE
#define HEAP_PAGE_SIZE 65536 /* 64K */
@@ -38,23 +39,39 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len);
@param len total amount of data written
@return wsrep error status
*/
-int wsrep_write_cache (wsrep_t* const wsrep,
- THD* const thd,
- IO_CACHE* const cache,
- size_t* const len);
+int wsrep_write_cache(THD* thd,
+ IO_CACHE* cache,
+ size_t* len);
/* Dump replication buffer to disk */
void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len);
-/* Dump replication buffer to disk without intermediate buffer */
-void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache);
-
/* Dump replication buffer along with header to a file */
void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
size_t buf_len);
int wsrep_binlog_close_connection(THD* thd);
-int wsrep_binlog_savepoint_set(THD *thd, void *sv);
-int wsrep_binlog_savepoint_rollback(THD *thd, void *sv);
+
+/**
+ Write a skip event into binlog.
+
+ @param thd Thread object pointer
+ @return Zero in case of success, non-zero on failure.
+*/
+int wsrep_write_skip_event(THD* thd);
+
+/*
+ Write dummy event into binlog in place of unused GTID.
+ The binlog write is done in thd context.
+*/
+int wsrep_write_dummy_event_low(THD *thd, const char *msg);
+/*
+ Write dummy event to binlog in place of unused GTID and
+ commit. The binlog write and commit are done in temporary
+ thd context, the original thd state is not altered.
+*/
+int wsrep_write_dummy_event(THD* thd, const char *msg);
+
+void wsrep_register_binlog_handler(THD *thd, bool trx);
#endif /* WSREP_BINLOG_H */
diff --git a/sql/wsrep_check_opts.cc b/sql/wsrep_check_opts.cc
index 0b7a9ca6252..7b8067ef238 100644
--- a/sql/wsrep_check_opts.cc
+++ b/sql/wsrep_check_opts.cc
@@ -33,7 +33,7 @@ int wsrep_check_opts()
autoinc_lock_mode->val_int(&is_null, 0, OPT_GLOBAL, 0) != 2)
{
WSREP_ERROR("Parallel applying (wsrep_slave_threads > 1) requires"
- " innodb_autoinc_lock_mode = 2.");
+ " innodb_autoinc_lock_mode= 2.");
return 1;
}
}
@@ -88,7 +88,7 @@ int wsrep_check_opts()
{
if (global_system_variables.binlog_format != BINLOG_FORMAT_ROW)
{
- WSREP_ERROR("Only binlog_format = 'ROW' is currently supported. "
+ WSREP_ERROR("Only binlog_format= 'ROW' is currently supported. "
"Configured value: '%s'. Please adjust your "
"configuration.",
binlog_format_names[global_system_variables.binlog_format]);
diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc
new file mode 100644
index 00000000000..994fa97db60
--- /dev/null
+++ b/sql/wsrep_client_service.cc
@@ -0,0 +1,307 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "wsrep_client_service.h"
+#include "wsrep_high_priority_service.h"
+#include "wsrep_applier.h" /* wsrep_apply_events() */
+#include "wsrep_binlog.h" /* wsrep_dump_rbr_buf() */
+#include "wsrep_schema.h" /* remove_fragments() */
+#include "wsrep_thd.h"
+#include "wsrep_xid.h"
+#include "wsrep_trans_observer.h"
+
+#include "sql_base.h" /* close_temporary_table() */
+#include "sql_class.h" /* THD */
+#include "sql_parse.h" /* stmt_causes_implicit_commit() */
+#include "rpl_filter.h" /* binlog_filter */
+#include "rpl_rli.h" /* Relay_log_info */
+#include "slave.h" /* opt_log_slave_updates */
+#include "transaction.h" /* trans_commit()... */
+#include "log.h" /* stmt_has_updated_trans_table() */
+//#include "debug_sync.h"
+#include "mysql/service_debug_sync.h"
+namespace
+{
+
+void debug_sync_caller(THD* thd, const char* sync_point)
+{
+#ifdef ENABLED_DEBUG_SYNC_OUT
+ debug_sync_set_action(thd, sync_point, strlen(sync_point));
+#endif
+#ifdef ENABLED_DEBUG_SYNC
+ if (debug_sync_service) debug_sync_service(thd,sync_point,strlen(sync_point));
+#endif
+
+}
+}
+
+Wsrep_client_service::Wsrep_client_service(THD* thd,
+ Wsrep_client_state& client_state)
+ : wsrep::client_service()
+ , m_thd(thd)
+ , m_client_state(client_state)
+{ }
+
+void Wsrep_client_service::store_globals()
+{
+ DBUG_ENTER("Wsrep_client_service::store_globals");
+ m_thd->store_globals();
+ DBUG_VOID_RETURN;
+}
+
+void Wsrep_client_service::reset_globals()
+{
+ DBUG_ENTER("Wsrep_client_service::reset_globals");
+ m_thd->reset_globals();
+ DBUG_VOID_RETURN;
+}
+
+bool Wsrep_client_service::interrupted() const
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ mysql_mutex_lock(&m_thd->LOCK_thd_data);
+
+ /* wsrep state can be interrupted only if THD was explicitly killed,
+ for wsrep conflicts, we use deadlock error only
+ */
+ bool ret= (m_thd->killed != NOT_KILLED &&
+ m_thd->wsrep_trx().state() != wsrep::transaction::s_must_abort &&
+ m_thd->wsrep_trx().state() != wsrep::transaction::s_aborting &&
+ m_thd->wsrep_trx().state() != wsrep::transaction::s_aborted);
+ mysql_mutex_unlock(&m_thd->LOCK_thd_data);
+ if (ret)
+ {
+ WSREP_DEBUG("wsrep state is interrupted, THD::killed %d trx state %d",
+ m_thd->killed, m_thd->wsrep_trx().state());
+ }
+ return ret;
+}
+
+int Wsrep_client_service::prepare_data_for_replication()
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_ENTER("Wsrep_client_service::prepare_data_for_replication");
+ size_t data_len= 0;
+ IO_CACHE* cache= wsrep_get_trans_cache(m_thd);
+
+ if (cache)
+ {
+ m_thd->binlog_flush_pending_rows_event(true);
+ if (wsrep_write_cache(m_thd, cache, &data_len))
+ {
+ WSREP_ERROR("rbr write fail, data_len: %zu",
+ data_len);
+ // wsrep_override_error(m_thd, ER_ERROR_DURING_COMMIT);
+ DBUG_RETURN(1);
+ }
+ }
+
+ if (data_len == 0)
+ {
+ if (m_thd->get_stmt_da()->is_ok() &&
+ m_thd->get_stmt_da()->affected_rows() > 0 &&
+ !binlog_filter->is_on() &&
+ !m_thd->wsrep_trx().is_streaming())
+ {
+ WSREP_DEBUG("empty rbr buffer, query: %s, "
+ "affected rows: %llu, "
+ "changed tables: %d, "
+ "sql_log_bin: %d",
+ WSREP_QUERY(m_thd),
+ m_thd->get_stmt_da()->affected_rows(),
+ stmt_has_updated_trans_table(m_thd),
+ m_thd->variables.sql_log_bin);
+ }
+ else
+ {
+ WSREP_DEBUG("empty rbr buffer, query: %s", WSREP_QUERY(m_thd));
+ }
+ }
+ DBUG_RETURN(0);
+}
+
+
+void Wsrep_client_service::cleanup_transaction()
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ if (WSREP_EMULATE_BINLOG(m_thd)) wsrep_thd_binlog_trx_reset(m_thd);
+ m_thd->wsrep_affected_rows= 0;
+}
+
+
+int Wsrep_client_service::prepare_fragment_for_replication(wsrep::mutable_buffer& buffer)
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ THD* thd= m_thd;
+ DBUG_ENTER("Wsrep_client_service::prepare_fragment_for_replication");
+ IO_CACHE* cache= wsrep_get_trans_cache(thd);
+ thd->binlog_flush_pending_rows_event(true);
+
+ if (!cache)
+ {
+ DBUG_RETURN(0);
+ }
+
+ const my_off_t saved_pos(my_b_tell(cache));
+ if (reinit_io_cache(cache, READ_CACHE, thd->wsrep_sr().bytes_certified(), 0, 0))
+ {
+ DBUG_RETURN(1);
+ }
+
+ int ret= 0;
+ size_t total_length= 0;
+ size_t length= my_b_bytes_in_cache(cache);
+
+ if (!length)
+ {
+ length= my_b_fill(cache);
+ }
+
+ if (length > 0)
+ {
+ do
+ {
+ total_length+= length;
+ if (total_length > wsrep_max_ws_size)
+ {
+ WSREP_WARN("transaction size limit (%lu) exceeded: %zu",
+ wsrep_max_ws_size, total_length);
+ ret= 1;
+ goto cleanup;
+ }
+
+ buffer.push_back(reinterpret_cast<const char*>(cache->read_pos),
+ reinterpret_cast<const char*>(cache->read_pos + length));
+ cache->read_pos= cache->read_end;
+ }
+ while (cache->file >= 0 && (length= my_b_fill(cache)));
+ }
+ DBUG_ASSERT(total_length == buffer.size());
+cleanup:
+ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
+ {
+ WSREP_WARN("Failed to reinitialize IO cache");
+ ret= 1;
+ }
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_client_service::remove_fragments()
+{
+ DBUG_ENTER("Wsrep_client_service::remove_fragments");
+ if (wsrep_schema->remove_fragments(m_thd,
+ Wsrep_server_state::instance().id(),
+ m_thd->wsrep_trx().id(),
+ m_thd->wsrep_sr().fragments()))
+ {
+ WSREP_DEBUG("Failed to remove fragments from SR storage for transaction "
+ "%llu, %llu",
+ m_thd->thread_id, m_thd->wsrep_trx().id().get());
+ DBUG_RETURN(1);
+ }
+ DBUG_RETURN(0);
+}
+
+bool Wsrep_client_service::statement_allowed_for_streaming() const
+{
+ /*
+ Todo: Decide if implicit commit is allowed with streaming
+ replication.
+ !stmt_causes_implicit_commit(m_thd, CF_IMPLICIT_COMMIT_BEGIN);
+ */
+ return true;
+}
+
+size_t Wsrep_client_service::bytes_generated() const
+{
+ IO_CACHE* cache= wsrep_get_trans_cache(m_thd);
+ if (cache)
+ {
+ m_thd->binlog_flush_pending_rows_event(true);
+ return my_b_tell(cache);
+ }
+ return 0;
+}
+
+void Wsrep_client_service::will_replay()
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ mysql_mutex_lock(&LOCK_wsrep_replaying);
+ ++wsrep_replaying;
+ mysql_mutex_unlock(&LOCK_wsrep_replaying);
+}
+
+enum wsrep::provider::status Wsrep_client_service::replay()
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ Wsrep_replayer_service replayer_service(m_thd);
+ wsrep::provider& provider(m_thd->wsrep_cs().provider());
+ mysql_mutex_lock(&m_thd->LOCK_thd_data);
+ m_thd->killed= NOT_KILLED;
+ mysql_mutex_unlock(&m_thd->LOCK_thd_data);
+ enum wsrep::provider::status ret=
+ provider.replay(m_thd->wsrep_trx().ws_handle(), &replayer_service);
+ replayer_service.replay_status(ret);
+ mysql_mutex_lock(&LOCK_wsrep_replaying);
+ --wsrep_replaying;
+ mysql_mutex_unlock(&LOCK_wsrep_replaying);
+ return ret;
+}
+
+void Wsrep_client_service::wait_for_replayers(wsrep::unique_lock<wsrep::mutex>& lock)
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ lock.unlock();
+ mysql_mutex_lock(&LOCK_wsrep_replaying);
+ while (wsrep_replaying > 0)
+ {
+ mysql_cond_wait(&COND_wsrep_replaying, &LOCK_wsrep_replaying);
+ }
+ mysql_mutex_unlock(&LOCK_wsrep_replaying);
+ lock.lock();
+}
+
+void Wsrep_client_service::debug_sync(const char* sync_point)
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ debug_sync_caller(m_thd, sync_point);
+}
+
+void Wsrep_client_service::debug_crash(const char* crash_point)
+{
+ // DBUG_ASSERT(m_thd == current_thd);
+ DBUG_EXECUTE_IF(crash_point, DBUG_SUICIDE(); );
+}
+
+int Wsrep_client_service::bf_rollback()
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_ENTER("Wsrep_client_service::rollback");
+
+ int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd));
+ if (m_thd->locked_tables_mode && m_thd->lock)
+ {
+ m_thd->locked_tables_list.unlock_locked_tables(m_thd);
+ m_thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
+ }
+ if (m_thd->global_read_lock.is_acquired())
+ {
+ m_thd->global_read_lock.unlock_global_read_lock(m_thd);
+ }
+ m_thd->mdl_context.release_transactional_locks();
+ m_thd->mdl_context.release_explicit_locks();
+
+ DBUG_RETURN(ret);
+}
diff --git a/sql/wsrep_client_service.h b/sql/wsrep_client_service.h
new file mode 100644
index 00000000000..43edae3441d
--- /dev/null
+++ b/sql/wsrep_client_service.h
@@ -0,0 +1,63 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/** @file wsrep_client_service.h
+
+ This file provides declaratios for client service implementation.
+ See wsrep/client_service.hpp for interface documentation.
+*/
+
+#ifndef WSREP_CLIENT_SERVICE_H
+#define WSREP_CLIENT_SERVICE_H
+
+/* wsrep-lib */
+#include "wsrep/client_service.hpp"
+#include "wsrep/client_state.hpp"
+#include "wsrep/exception.hpp" /* not_implemented_error, remove when finished */
+
+class THD;
+class Wsrep_client_state;
+class Wsrep_high_priority_context;
+
+class Wsrep_client_service : public wsrep::client_service
+{
+public:
+ Wsrep_client_service(THD*, Wsrep_client_state&);
+
+ bool interrupted() const;
+ void reset_globals();
+ void store_globals();
+ int prepare_data_for_replication();
+ void cleanup_transaction();
+ bool statement_allowed_for_streaming() const;
+ size_t bytes_generated() const;
+ int prepare_fragment_for_replication(wsrep::mutable_buffer&);
+ int remove_fragments();
+ void emergency_shutdown()
+ { throw wsrep::not_implemented_error(); }
+ void will_replay();
+ enum wsrep::provider::status replay();
+ void wait_for_replayers(wsrep::unique_lock<wsrep::mutex>&);
+ void debug_sync(const char*);
+ void debug_crash(const char*);
+ int bf_rollback();
+private:
+ friend class Wsrep_server_service;
+ THD* m_thd;
+ Wsrep_client_state& m_client_state;
+};
+
+
+#endif /* WSREP_CLIENT_SERVICE_H */
diff --git a/sql/wsrep_client_state.h b/sql/wsrep_client_state.h
new file mode 100644
index 00000000000..403bfa81365
--- /dev/null
+++ b/sql/wsrep_client_state.h
@@ -0,0 +1,47 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_CLIENT_STATE_H
+#define WSREP_CLIENT_STATE_H
+
+/* wsrep-lib */
+#include "wsrep/client_state.hpp"
+#include "my_global.h"
+
+class THD;
+
+class Wsrep_client_state : public wsrep::client_state
+{
+public:
+ Wsrep_client_state(THD* thd,
+ wsrep::mutex& mutex,
+ wsrep::condition_variable& cond,
+ wsrep::server_state& server_state,
+ wsrep::client_service& client_service,
+ const wsrep::client_id& id)
+ : wsrep::client_state(mutex,
+ cond,
+ server_state,
+ client_service,
+ id,
+ wsrep::client_state::m_local)
+ , m_thd(thd)
+ { }
+ THD* thd() { return m_thd; }
+private:
+ THD* m_thd;
+};
+
+#endif /* WSREP_CLIENT_STATE_H */
diff --git a/sql/wsrep_condition_variable.h b/sql/wsrep_condition_variable.h
new file mode 100644
index 00000000000..4412154e67b
--- /dev/null
+++ b/sql/wsrep_condition_variable.h
@@ -0,0 +1,54 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_CONDITION_VARIABLE_H
+#define WSREP_CONDITION_VARIABLE_H
+
+/* wsrep-lib */
+#include "wsrep/condition_variable.hpp"
+
+/* implementation */
+#include "my_pthread.h"
+
+class Wsrep_condition_variable : public wsrep::condition_variable
+{
+public:
+
+ Wsrep_condition_variable(mysql_cond_t& cond)
+ : m_cond(cond)
+ { }
+ ~Wsrep_condition_variable()
+ { }
+
+ void notify_one()
+ {
+ mysql_cond_signal(&m_cond);
+ }
+
+ void notify_all()
+ {
+ mysql_cond_broadcast(&m_cond);
+ }
+
+ void wait(wsrep::unique_lock<wsrep::mutex>& lock)
+ {
+ mysql_mutex_t* mutex= static_cast<mysql_mutex_t*>(lock.mutex().native());
+ mysql_cond_wait(&m_cond, mutex);
+ }
+private:
+ mysql_cond_t& m_cond;
+};
+
+#endif /* WSREP_CONDITION_VARIABLE_H */
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 9a4bbd01bcd..916788483ab 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -17,16 +17,10 @@
#include <sql_class.h>
#include <mysql/service_wsrep.h>
-my_bool wsrep_thd_is_BF(THD *, my_bool)
+my_bool wsrep_thd_is_BF(const THD *, my_bool)
{ return 0; }
-int wsrep_trx_order_before(THD *, THD *)
-{ return 0; }
-
-enum wsrep_conflict_state wsrep_thd_conflict_state(THD *, my_bool)
-{ return NO_CONFLICT; }
-
-int wsrep_is_wsrep_xid(const XID*)
+int wsrep_is_wsrep_xid(const void* xid)
{ return 0; }
long long wsrep_xid_seqno(const XID* x)
@@ -34,111 +28,99 @@ long long wsrep_xid_seqno(const XID* x)
const unsigned char* wsrep_xid_uuid(const XID*)
{
- static const unsigned char uuid[16] = {0};
+ static const unsigned char uuid[16]= {0};
return uuid;
}
+bool wsrep_prepare_key_for_innodb(THD* thd, const uchar*, size_t, const uchar*, size_t, struct wsrep_buf*, size_t*)
+{ return 1; }
+
bool wsrep_prepare_key(const uchar*, size_t, const uchar*, size_t, struct wsrep_buf*, size_t*)
{ return 0; }
struct wsrep *get_wsrep()
{ return 0; }
-my_bool get_wsrep_certify_nonPK()
-{ return 0; }
-
-my_bool get_wsrep_debug()
-{ return 0; }
-
-my_bool get_wsrep_drupal_282555_workaround()
-{ return 0; }
-
-my_bool get_wsrep_load_data_splitting()
-{ return 0; }
-
my_bool get_wsrep_recovery()
{ return 0; }
-my_bool get_wsrep_log_conflicts()
-{ return 0; }
-
-long get_wsrep_protocol_version()
-{ return 0; }
-
-my_bool wsrep_aborting_thd_contains(THD *)
-{ return 0; }
-
-void wsrep_aborting_thd_enqueue(THD *)
-{ }
-
bool wsrep_consistency_check(THD *)
{ return 0; }
void wsrep_lock_rollback()
{ }
-int wsrep_on(THD *thd)
+my_bool wsrep_on(const THD *)
{ return 0; }
-void wsrep_post_commit(THD*, bool)
-{ }
-
-enum wsrep_trx_status wsrep_run_wsrep_commit(THD *, bool)
-{ return WSREP_TRX_ERROR; }
-
-void wsrep_thd_LOCK(THD *)
-{ }
-
-void wsrep_thd_UNLOCK(THD *)
+void wsrep_thd_LOCK(const THD *)
{ }
-void wsrep_thd_awake(THD *, my_bool)
+void wsrep_thd_UNLOCK(const THD *)
{ }
const char *wsrep_thd_conflict_state_str(THD *)
{ return 0; }
-enum wsrep_exec_mode wsrep_thd_exec_mode(THD *)
-{ return LOCAL_STATE; }
-
const char *wsrep_thd_exec_mode_str(THD *)
{ return NULL; }
-enum wsrep_conflict_state wsrep_thd_get_conflict_state(THD *)
-{ return NO_CONFLICT; }
+const char *wsrep_thd_query(const THD *)
+{ return 0; }
-my_bool wsrep_thd_is_wsrep(THD *)
+const char *wsrep_thd_query_state_str(THD *)
{ return 0; }
-char *wsrep_thd_query(THD *)
+int wsrep_thd_retry_counter(const THD *)
{ return 0; }
-enum wsrep_query_state wsrep_thd_query_state(THD *)
-{ return QUERY_IDLE; }
+bool wsrep_thd_ignore_table(THD *)
+{ return 0; }
-const char *wsrep_thd_query_state_str(THD *)
+long long wsrep_thd_trx_seqno(const THD *)
+{ return -1; }
+
+my_bool wsrep_thd_is_aborting(const THD *)
{ return 0; }
-int wsrep_thd_retry_counter(THD *)
+void wsrep_set_data_home_dir(const char *)
+{ }
+
+my_bool wsrep_thd_is_local(const THD *)
{ return 0; }
-void wsrep_thd_set_conflict_state(THD *, enum wsrep_conflict_state)
+void wsrep_thd_self_abort(THD *)
{ }
-bool wsrep_thd_ignore_table(THD *)
+int wsrep_thd_append_key(THD *, const struct wsrep_key*, int, enum Wsrep_service_key_type)
{ return 0; }
-longlong wsrep_thd_trx_seqno(THD *)
-{ return -1; }
+const char* wsrep_thd_client_state_str(const THD*)
+{ return 0; }
-struct wsrep_ws_handle* wsrep_thd_ws_handle(THD *)
+const char* wsrep_thd_client_mode_str(const THD*)
{ return 0; }
-int wsrep_trx_is_aborting(THD *)
+const char* wsrep_thd_transaction_state_str(const THD*)
{ return 0; }
-void wsrep_unlock_rollback()
-{ }
+query_id_t wsrep_thd_transaction_id(const THD *)
+{ return 0; }
-void wsrep_set_data_home_dir(const char *)
+my_bool wsrep_thd_bf_abort(const THD *, THD *, my_bool)
+{ return 0; }
+
+my_bool wsrep_thd_order_before(const THD*, const THD *)
+{ return 0; }
+
+void wsrep_handle_SR_rollback(THD*, THD*)
{ }
+
+my_bool wsrep_thd_skip_locking(const THD*)
+{ return 0;}
+
+const char* wsrep_get_sr_table_name()
+{ return 0; }
+
+my_bool wsrep_get_debug()
+{ return 0;}
diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc
new file mode 100644
index 00000000000..f1637e2ece0
--- /dev/null
+++ b/sql/wsrep_high_priority_service.cc
@@ -0,0 +1,649 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "wsrep_high_priority_service.h"
+#include "wsrep_applier.h"
+#include "wsrep_binlog.h"
+#include "wsrep_schema.h"
+#include "wsrep_xid.h"
+#include "wsrep_trans_observer.h"
+
+#include "sql_class.h" /* THD */
+#include "transaction.h"
+#include "debug_sync.h"
+/* RLI */
+#include "rpl_rli.h"
+#define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1
+#define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2
+#include "slave.h"
+#include "rpl_mi.h"
+
+namespace
+{
+/*
+ Scoped mode for applying non-transactional write sets (TOI)
+ */
+class Wsrep_non_trans_mode
+{
+public:
+ Wsrep_non_trans_mode(THD* thd, const wsrep::ws_meta& ws_meta)
+ : m_thd(thd)
+ , m_option_bits(thd->variables.option_bits)
+ , m_server_status(thd->server_status)
+ {
+ m_thd->variables.option_bits&= ~OPTION_BEGIN;
+ m_thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ m_thd->wsrep_cs().enter_toi(ws_meta);
+ }
+ ~Wsrep_non_trans_mode()
+ {
+ m_thd->variables.option_bits= m_option_bits;
+ m_thd->server_status= m_server_status;
+ m_thd->wsrep_cs().leave_toi();
+ }
+private:
+ Wsrep_non_trans_mode(const Wsrep_non_trans_mode&);
+ Wsrep_non_trans_mode& operator=(const Wsrep_non_trans_mode&);
+ THD* m_thd;
+ ulonglong m_option_bits;
+ uint m_server_status;
+};
+}
+
+static rpl_group_info* wsrep_relay_group_init(THD* thd, const char* log_fname)
+{
+ Relay_log_info* rli= new Relay_log_info(false);
+
+ if (!rli->relay_log.description_event_for_exec)
+ {
+ rli->relay_log.description_event_for_exec=
+ new Format_description_log_event(4);
+ }
+
+ static LEX_CSTRING connection_name= { STRING_WITH_LEN("wsrep") };
+
+ /*
+ Master_info's constructor initializes rpl_filter by either an already
+ constructed Rpl_filter object from global 'rpl_filters' list if the
+ specified connection name is same, or it constructs a new Rpl_filter
+ object and adds it to rpl_filters. This object is later destructed by
+ Mater_info's destructor by looking it up based on connection name in
+ rpl_filters list.
+
+ However, since all Master_info objects created here would share same
+ connection name ("wsrep"), destruction of any of the existing Master_info
+ objects (in wsrep_return_from_bf_mode()) would free rpl_filter referenced
+ by any/all existing Master_info objects.
+
+ In order to avoid that, we have added a check in Master_info's destructor
+ to not free the "wsrep" rpl_filter. It will eventually be freed by
+ free_all_rpl_filters() when server terminates.
+ */
+ rli->mi= new Master_info(&connection_name, false);
+
+ struct rpl_group_info *rgi= new rpl_group_info(rli);
+ rgi->thd= rli->sql_driver_thd= thd;
+
+ if ((rgi->deferred_events_collecting= rli->mi->rpl_filter->is_on()))
+ {
+ rgi->deferred_events= new Deferred_log_events(rli);
+ }
+
+ return rgi;
+}
+
+static void wsrep_setup_uk_and_fk_checks(THD* thd)
+{
+ /* Tune FK and UK checking policy. These are reset back to original
+ in Wsrep_high_priority_service destructor. */
+ if (wsrep_slave_UK_checks == FALSE)
+ thd->variables.option_bits|= OPTION_RELAXED_UNIQUE_CHECKS;
+ else
+ thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS;
+
+ if (wsrep_slave_FK_checks == FALSE)
+ thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
+ else
+ thd->variables.option_bits&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
+}
+
+/****************************************************************************
+ High priority service
+*****************************************************************************/
+
+Wsrep_high_priority_service::Wsrep_high_priority_service(THD* thd)
+ : wsrep::high_priority_service(Wsrep_server_state::instance())
+ , wsrep::high_priority_context(thd->wsrep_cs())
+ , m_thd(thd)
+ , m_rli()
+{
+ LEX_CSTRING db_str= { NULL, 0 };
+ m_shadow.option_bits = thd->variables.option_bits;
+ m_shadow.server_status= thd->server_status;
+ m_shadow.vio = thd->net.vio;
+ m_shadow.tx_isolation = thd->variables.tx_isolation;
+ m_shadow.db = (char *)thd->db.str;
+ m_shadow.db_length = thd->db.length;
+ m_shadow.user_time = thd->user_time;
+ m_shadow.row_count_func= thd->get_row_count_func();
+ m_shadow.wsrep_applier= thd->wsrep_applier;
+
+ /* Disable general logging on applier threads */
+ thd->variables.option_bits |= OPTION_LOG_OFF;
+ /* Enable binlogging if opt_log_slave_updates is set */
+ if (opt_log_slave_updates)
+ thd->variables.option_bits|= OPTION_BIN_LOG;
+ else
+ thd->variables.option_bits&= ~(OPTION_BIN_LOG);
+
+ thd->net.vio= 0;
+ thd->reset_db(&db_str);
+ thd->clear_error();
+ thd->variables.tx_isolation= ISO_READ_COMMITTED;
+ thd->tx_isolation = ISO_READ_COMMITTED;
+
+ /* From trans_begin() */
+ thd->variables.option_bits|= OPTION_BEGIN;
+ thd->server_status|= SERVER_STATUS_IN_TRANS;
+
+ /* Make THD wsrep_applier so that it cannot be killed */
+ thd->wsrep_applier= true;
+
+ if (!thd->wsrep_rgi) thd->wsrep_rgi= wsrep_relay_group_init(thd, "wsrep_relay");
+
+ m_rgi= thd->wsrep_rgi;
+ m_rgi->thd= thd;
+ m_rli= m_rgi->rli;
+ thd_proc_info(thd, "wsrep applier idle");
+}
+
+Wsrep_high_priority_service::~Wsrep_high_priority_service()
+{
+ THD* thd= m_thd;
+ thd->variables.option_bits = m_shadow.option_bits;
+ thd->server_status = m_shadow.server_status;
+ thd->net.vio = m_shadow.vio;
+ thd->variables.tx_isolation= m_shadow.tx_isolation;
+ LEX_CSTRING db_str= { m_shadow.db, m_shadow.db_length };
+ thd->reset_db(&db_str);
+ thd->user_time = m_shadow.user_time;
+
+ if (thd->wsrep_rgi && thd->wsrep_rgi->rli)
+ delete thd->wsrep_rgi->rli->mi;
+ if (thd->wsrep_rgi)
+ delete thd->wsrep_rgi->rli;
+ delete thd->wsrep_rgi;
+ thd->wsrep_rgi= NULL;
+
+ thd->set_row_count_func(m_shadow.row_count_func);
+ thd->wsrep_applier = m_shadow.wsrep_applier;
+}
+
+int Wsrep_high_priority_service::start_transaction(
+ const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER(" Wsrep_high_priority_service::start_transaction");
+ DBUG_RETURN(m_thd->wsrep_cs().start_transaction(ws_handle, ws_meta));
+}
+
+const wsrep::transaction& Wsrep_high_priority_service::transaction() const
+{
+ DBUG_ENTER(" Wsrep_high_priority_service::transaction");
+ DBUG_RETURN(m_thd->wsrep_trx());
+}
+
+void Wsrep_high_priority_service::adopt_transaction(const wsrep::transaction& transaction)
+{
+ DBUG_ENTER(" Wsrep_high_priority_service::adopt_transaction");
+ m_thd->wsrep_cs().adopt_transaction(transaction);
+ DBUG_VOID_RETURN;
+}
+
+
+int Wsrep_high_priority_service::append_fragment_and_commit(
+ const wsrep::ws_handle& ws_handle,
+ const wsrep::ws_meta& ws_meta,
+ const wsrep::const_buffer& data)
+{
+ DBUG_ENTER("Wsrep_high_priority_service::append_fragment_and_commit");
+ int ret= start_transaction(ws_handle, ws_meta);
+ /*
+ Start transaction explicitly to avoid early commit via
+ trans_commit_stmt() in append_fragment()
+ */
+ ret= ret || trans_begin(m_thd);
+ ret= ret || wsrep_schema->append_fragment(m_thd,
+ ws_meta.server_id(),
+ ws_meta.transaction_id(),
+ ws_meta.seqno(),
+ ws_meta.flags(),
+ data);
+
+ /*
+ Note: The commit code below seems to be identical to
+ Wsrep_storage_service::commit(). Consider implementing
+ common utility function to deal with commit.
+ */
+ const bool do_binlog_commit= (opt_log_slave_updates &&
+ wsrep_gtid_mode &&
+ m_thd->variables.gtid_seq_no);
+ /*
+ Write skip event into binlog if gtid_mode is on. This is to
+ maintain gtid continuity.
+ */
+ if (do_binlog_commit)
+ {
+ ret= wsrep_write_skip_event(m_thd);
+ }
+
+ if (!ret)
+ {
+ ret= m_thd->wsrep_cs().prepare_for_ordering(ws_handle,
+ ws_meta, true);
+ }
+
+ if (!ret)
+ {
+ DBUG_ASSERT(wsrep_thd_trx_seqno(m_thd) > 0);
+ if (!do_binlog_commit)
+ {
+ ret= wsrep_before_commit(m_thd, true);
+ }
+ ret= ret || trans_commit(m_thd);
+ if (!do_binlog_commit)
+ {
+ if (opt_log_slave_updates)
+ {
+ ret= ret || wsrep_ordered_commit(m_thd, true, wsrep_apply_error());
+ }
+ ret= ret || wsrep_after_commit(m_thd, true);
+ }
+ }
+ m_thd->wsrep_cs().after_applying();
+ m_thd->mdl_context.release_transactional_locks();
+
+ thd_proc_info(m_thd, "wsrep applier committed");
+
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_high_priority_service::remove_fragments(const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_high_priority_service::remove_fragments");
+ int ret= wsrep_schema->remove_fragments(m_thd,
+ ws_meta.server_id(),
+ ws_meta.transaction_id(),
+ m_thd->wsrep_sr().fragments());
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_high_priority_service::commit(const wsrep::ws_handle& ws_handle,
+ const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_high_priority_service::commit");
+ THD* thd= m_thd;
+ DBUG_ASSERT(thd->wsrep_trx().active());
+ thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, true);
+ thd_proc_info(thd, "committing");
+
+ int ret= 0;
+ const bool is_ordered= !ws_meta.seqno().is_undefined();
+ /* If opt_log_slave_updates is not on, applier does not write
+ anything to binlog cache and neither wsrep_before_commit()
+ nor wsrep_after_commit() we be reached from binlog code
+ path for applier. Therefore run wsrep_before_commit()
+ and wsrep_after_commit() here. wsrep_ordered_commit()
+ will be called from wsrep_ordered_commit_if_no_binlog(). */
+ if (!opt_log_slave_updates && !opt_bin_log && is_ordered)
+ {
+ if (m_thd->transaction.all.no_2pc == false)
+ {
+ ret= wsrep_before_prepare(thd, true);
+ ret= ret || wsrep_after_prepare(thd, true);
+ }
+ ret= ret || wsrep_before_commit(thd, true);
+ }
+ ret= ret || trans_commit(thd);
+
+ if (ret == 0)
+ {
+ m_rgi->cleanup_context(thd, 0);
+ }
+
+ if (ret == 0 && !opt_log_slave_updates && !opt_bin_log && is_ordered)
+ {
+ ret= wsrep_after_commit(thd, true);
+ }
+
+ m_thd->mdl_context.release_transactional_locks();
+
+ thd_proc_info(thd, "wsrep applier committed");
+
+ if (!is_ordered)
+ {
+ /* Wsrep commit was not ordered so it does not go through commit time
+ hooks and remains active. Roll it back to make cleanup happen
+ in after_applying() call. */
+ m_thd->wsrep_cs().before_rollback();
+ m_thd->wsrep_cs().after_rollback();
+ }
+
+ must_exit_= check_exit_status();
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle,
+ const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_high_priority_service::rollback");
+ m_thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, false);
+ int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd));
+ m_thd->mdl_context.release_transactional_locks();
+ m_thd->mdl_context.release_explicit_locks();
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta,
+ const wsrep::const_buffer& data)
+{
+ DBUG_ENTER("Wsrep_high_priority_service::apply_toi");
+ THD* thd= m_thd;
+ Wsrep_non_trans_mode non_trans_mode(thd, ws_meta);
+
+ wsrep::client_state& client_state(thd->wsrep_cs());
+ DBUG_ASSERT(client_state.in_toi());
+
+ thd_proc_info(thd, "wsrep applier toi");
+
+ WSREP_DEBUG("Wsrep_high_priority_service::apply_toi: %lld",
+ client_state.toi_meta().seqno().get());
+
+ int ret= wsrep_apply_events(thd, m_rli, data.data(), data.size());
+ if (ret != 0 || thd->wsrep_has_ignored_error)
+ {
+ wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
+ thd->wsrep_has_ignored_error= false;
+ /* todo: error voting */
+ }
+ trans_commit(thd);
+
+ thd->close_temporary_tables();
+ wsrep_set_SE_checkpoint(client_state.toi_meta().gtid());
+
+ must_exit_= check_exit_status();
+
+ DBUG_RETURN(ret);
+}
+
+void Wsrep_high_priority_service::store_globals()
+{
+ DBUG_ENTER("Wsrep_high_priority_service::store_globals");
+ /* In addition to calling THD::store_globals(), call
+ wsrep::client_state::store_globals() to gain ownership of
+ the client state */
+ m_thd->store_globals();
+ m_thd->wsrep_cs().store_globals();
+ DBUG_VOID_RETURN;
+}
+
+void Wsrep_high_priority_service::reset_globals()
+{
+ DBUG_ENTER("Wsrep_high_priority_service::reset_globals");
+ m_thd->reset_globals();
+ DBUG_VOID_RETURN;
+}
+
+void Wsrep_high_priority_service::switch_execution_context(wsrep::high_priority_service& orig_high_priority_service)
+{
+ DBUG_ENTER("Wsrep_high_priority_service::switch_execution_context");
+ Wsrep_high_priority_service&
+ orig_hps= static_cast<Wsrep_high_priority_service&>(orig_high_priority_service);
+ m_thd->thread_stack= orig_hps.m_thd->thread_stack;
+ DBUG_VOID_RETURN;
+}
+
+int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_handle,
+ const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_high_priority_service::log_dummy_write_set");
+ int ret= 0;
+ DBUG_PRINT("info",
+ ("Wsrep_high_priority_service::log_dummy_write_set: seqno=%lld",
+ ws_meta.seqno().get()));
+ m_thd->wsrep_cs().start_transaction(ws_handle, ws_meta);
+ WSREP_DEBUG("Log dummy write set %lld", ws_meta.seqno().get());
+ if (!(opt_log_slave_updates && wsrep_gtid_mode && m_thd->variables.gtid_seq_no))
+ {
+ m_thd->wsrep_cs().before_rollback();
+ m_thd->wsrep_cs().after_rollback();
+ }
+ m_thd->wsrep_cs().after_applying();
+ DBUG_RETURN(ret);
+}
+
+void Wsrep_high_priority_service::debug_crash(const char* crash_point)
+{
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_EXECUTE_IF(crash_point, DBUG_SUICIDE(););
+}
+
+/****************************************************************************
+ Applier service
+*****************************************************************************/
+
+Wsrep_applier_service::Wsrep_applier_service(THD* thd)
+ : Wsrep_high_priority_service(thd)
+{
+ thd->wsrep_applier_service= this;
+ thd->wsrep_cs().open(wsrep::client_id(thd->thread_id));
+ thd->wsrep_cs().before_command();
+ thd->wsrep_cs().debug_log_level(wsrep_debug);
+
+}
+
+Wsrep_applier_service::~Wsrep_applier_service()
+{
+ m_thd->wsrep_cs().after_command_before_result();
+ m_thd->wsrep_cs().after_command_after_result();
+ m_thd->wsrep_cs().close();
+ m_thd->wsrep_cs().cleanup();
+}
+
+int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta,
+ const wsrep::const_buffer& data)
+{
+ DBUG_ENTER("Wsrep_applier_service::apply_write_set");
+ THD* thd= m_thd;
+
+ thd->variables.option_bits |= OPTION_BEGIN;
+ thd->variables.option_bits |= OPTION_NOT_AUTOCOMMIT;
+ DBUG_ASSERT(thd->wsrep_trx().active());
+ DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_executing);
+
+ thd_proc_info(thd, "applying write set");
+ /* moved dbug sync point here, after possible THD switch for SR transactions
+ has ben done
+ */
+ /* Allow tests to block the applier thread using the DBUG facilities */
+ DBUG_EXECUTE_IF("sync.wsrep_apply_cb",
+ {
+ const char act[]=
+ "now "
+ "SIGNAL sync.wsrep_apply_cb_reached "
+ "WAIT_FOR signal.wsrep_apply_cb";
+ DBUG_ASSERT(!debug_sync_set_action(thd,
+ STRING_WITH_LEN(act)));
+ };);
+
+ wsrep_setup_uk_and_fk_checks(thd);
+
+ int ret= wsrep_apply_events(thd, m_rli, data.data(), data.size());
+
+ if (ret || thd->wsrep_has_ignored_error)
+ {
+ wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
+ }
+
+ thd->close_temporary_tables();
+ if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit))
+ {
+ thd->wsrep_cs().fragment_applied(ws_meta.seqno());
+ }
+ thd_proc_info(thd, "wsrep applied write set");
+ DBUG_RETURN(ret);
+}
+
+void Wsrep_applier_service::after_apply()
+{
+ DBUG_ENTER("Wsrep_applier_service::after_apply");
+ wsrep_after_apply(m_thd);
+ DBUG_VOID_RETURN;
+}
+
+bool Wsrep_applier_service::check_exit_status() const
+{
+ bool ret= false;
+ mysql_mutex_lock(&LOCK_wsrep_slave_threads);
+ if (wsrep_slave_count_change < 0)
+ {
+ ++wsrep_slave_count_change;
+ ret= true;
+ }
+ mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
+ return ret;
+}
+
+/****************************************************************************
+ Replayer service
+*****************************************************************************/
+
+Wsrep_replayer_service::Wsrep_replayer_service(THD* thd)
+ : Wsrep_high_priority_service(thd)
+ , m_da_shadow()
+ , m_replay_status()
+{
+ /* Response must not have been sent to client */
+ DBUG_ASSERT(!thd->get_stmt_da()->is_sent());
+ /* PS reprepare observer should have been removed already
+ open_table() will fail if we have dangling observer here */
+ DBUG_ASSERT(!thd->m_reprepare_observer);
+ /* Replaying should happen always from after_statement() hook
+ after rollback, which should guarantee that there are no
+ transactional locks */
+ DBUG_ASSERT(!thd->mdl_context.has_transactional_locks());
+
+ /* Make a shadow copy of diagnostics area and reset */
+ m_da_shadow.status= thd->get_stmt_da()->status();
+ if (m_da_shadow.status == Diagnostics_area::DA_OK)
+ {
+ m_da_shadow.affected_rows= thd->get_stmt_da()->affected_rows();
+ m_da_shadow.last_insert_id= thd->get_stmt_da()->last_insert_id();
+ strmake(m_da_shadow.message, thd->get_stmt_da()->message(),
+ sizeof(m_da_shadow.message) - 1);
+ }
+ thd->get_stmt_da()->reset_diagnostics_area();
+
+ /* Release explicit locks */
+ if (thd->locked_tables_mode && thd->lock)
+ {
+ WSREP_WARN("releasing table lock for replaying (%llu)",
+ thd->thread_id);
+ thd->locked_tables_list.unlock_locked_tables(thd);
+ thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
+ }
+
+ /*
+ Replaying will call MYSQL_START_STATEMENT when handling
+ BEGIN Query_log_event so end statement must be called before
+ replaying.
+ */
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
+ thd_proc_info(thd, "wsrep replaying trx");
+}
+
+Wsrep_replayer_service::~Wsrep_replayer_service()
+{
+ THD* thd= m_thd;
+ DBUG_ASSERT(!thd->get_stmt_da()->is_sent());
+ DBUG_ASSERT(!thd->get_stmt_da()->is_set());
+ if (m_replay_status == wsrep::provider::success)
+ {
+ DBUG_ASSERT(thd->wsrep_cs().current_error() == wsrep::e_success);
+ thd->killed= NOT_KILLED;
+ if (m_da_shadow.status == Diagnostics_area::DA_OK)
+ {
+ my_ok(thd,
+ m_da_shadow.affected_rows,
+ m_da_shadow.last_insert_id,
+ m_da_shadow.message);
+ }
+ else
+ {
+ my_ok(thd);
+ }
+ }
+ else if (m_replay_status == wsrep::provider::error_certification_failed)
+ {
+ DBUG_ASSERT(thd->wsrep_cs().current_error() == wsrep::e_deadlock_error);
+ }
+ else
+ {
+ DBUG_ASSERT(0);
+ WSREP_ERROR("trx_replay failed for: %d, schema: %s, query: %s",
+ m_replay_status,
+ thd->db.str, WSREP_QUERY(thd));
+ unireg_abort(1);
+ }
+}
+
+int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta,
+ const wsrep::const_buffer& data)
+{
+ DBUG_ENTER("Wsrep_replayer_service::apply_write_set");
+ THD* thd= m_thd;
+
+ DBUG_ASSERT(thd->wsrep_trx().active());
+ DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_replaying);
+
+ wsrep_setup_uk_and_fk_checks(thd);
+
+ int ret= 0;
+ if (!wsrep::starts_transaction(ws_meta.flags()))
+ {
+ DBUG_ASSERT(thd->wsrep_trx().is_streaming());
+ ret= wsrep_schema->replay_transaction(thd,
+ m_rli,
+ ws_meta,
+ thd->wsrep_sr().fragments());
+ }
+
+ ret= ret || wsrep_apply_events(thd, m_rli, data.data(), data.size());
+
+ if (ret || thd->wsrep_has_ignored_error)
+ {
+ wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
+ }
+
+ thd->close_temporary_tables();
+ if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit))
+ {
+ thd->wsrep_cs().fragment_applied(ws_meta.seqno());
+ }
+
+ thd_proc_info(thd, "wsrep replayed write set");
+ DBUG_RETURN(ret);
+}
diff --git a/sql/wsrep_high_priority_service.h b/sql/wsrep_high_priority_service.h
new file mode 100644
index 00000000000..4012ca60a3e
--- /dev/null
+++ b/sql/wsrep_high_priority_service.h
@@ -0,0 +1,118 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_HIGH_PRIORITY_SERVICE_H
+#define WSREP_HIGH_PRIORITY_SERVICE_H
+
+#include "wsrep/high_priority_service.hpp"
+#include "wsrep/client_state.hpp"
+#include "my_global.h"
+#include "sql_error.h" /* Diagnostics area */
+#include "sql_class.h" /* rpl_group_info */
+
+class THD;
+class Relay_log_info;
+class Wsrep_server_service;
+
+class Wsrep_high_priority_service :
+ public wsrep::high_priority_service,
+ public wsrep::high_priority_context
+{
+public:
+ Wsrep_high_priority_service(THD*);
+ ~Wsrep_high_priority_service();
+ int start_transaction(const wsrep::ws_handle&,
+ const wsrep::ws_meta&);
+ const wsrep::transaction& transaction() const;
+ void adopt_transaction(const wsrep::transaction&);
+ int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&) = 0;
+ int append_fragment_and_commit(const wsrep::ws_handle&,
+ const wsrep::ws_meta&,
+ const wsrep::const_buffer&);
+ int remove_fragments(const wsrep::ws_meta&);
+ int commit(const wsrep::ws_handle&, const wsrep::ws_meta&);
+ int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&);
+ int apply_toi(const wsrep::ws_meta&, const wsrep::const_buffer&);
+ void store_globals();
+ void reset_globals();
+ void switch_execution_context(wsrep::high_priority_service&);
+ int log_dummy_write_set(const wsrep::ws_handle&,
+ const wsrep::ws_meta&);
+
+ virtual bool check_exit_status() const = 0;
+ void debug_crash(const char*);
+protected:
+ friend Wsrep_server_service;
+ THD* m_thd;
+ Relay_log_info* m_rli;
+ rpl_group_info* m_rgi;
+ struct shadow
+ {
+ ulonglong option_bits;
+ uint server_status;
+ struct st_vio* vio;
+ ulong tx_isolation;
+ char* db;
+ size_t db_length;
+ //struct timeval user_time;
+ my_hrtime_t user_time;
+ longlong row_count_func;
+ bool wsrep_applier;
+} m_shadow;
+};
+
+class Wsrep_applier_service : public Wsrep_high_priority_service
+{
+public:
+ Wsrep_applier_service(THD*);
+ ~Wsrep_applier_service();
+ int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&);
+ void after_apply();
+ bool is_replaying() const { return false; }
+ bool check_exit_status() const;
+};
+
+class Wsrep_replayer_service : public Wsrep_high_priority_service
+{
+public:
+ Wsrep_replayer_service(THD*);
+ ~Wsrep_replayer_service();
+ int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&);
+ void after_apply() { }
+ bool is_replaying() const { return true; }
+ void replay_status(enum wsrep::provider::status status)
+ { m_replay_status = status; }
+ enum wsrep::provider::status replay_status() const
+ { return m_replay_status; }
+ /* Replayer should never be forced to exit */
+ bool check_exit_status() const { return false; }
+private:
+ struct da_shadow
+ {
+ enum Diagnostics_area::enum_diagnostics_status status;
+ ulonglong affected_rows;
+ ulonglong last_insert_id;
+ char message[MYSQL_ERRMSG_SIZE];
+ da_shadow()
+ : status()
+ , affected_rows()
+ , last_insert_id()
+ , message()
+ { }
+ } m_da_shadow;
+ enum wsrep::provider::status m_replay_status;
+};
+
+#endif /* WSREP_HIGH_PRIORITY_SERVICE_H */
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
deleted file mode 100644
index 8110faf7d11..00000000000
--- a/sql/wsrep_hton.cc
+++ /dev/null
@@ -1,658 +0,0 @@
-/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
-
-#include "mariadb.h"
-#include <mysqld.h>
-#include "sql_base.h"
-#include "rpl_filter.h"
-#include <sql_class.h>
-#include "wsrep_mysqld.h"
-#include "wsrep_binlog.h"
-#include "wsrep_xid.h"
-#include <cstdio>
-#include <cstdlib>
-#include "debug_sync.h"
-
-extern handlerton *binlog_hton;
-extern int binlog_close_connection(handlerton *hton, THD *thd);
-extern ulonglong thd_to_trx_id(THD *thd);
-
-extern "C" int thd_binlog_format(const MYSQL_THD thd);
-// todo: share interface with ha_innodb.c
-
-/*
- Cleanup after local transaction commit/rollback, replay or TOI.
-*/
-void wsrep_cleanup_transaction(THD *thd)
-{
- if (!WSREP(thd)) return;
-
- if (wsrep_emulate_bin_log) thd_binlog_trx_reset(thd);
- thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID;
- thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
- thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
- thd->wsrep_exec_mode= LOCAL_STATE;
- thd->wsrep_affected_rows= 0;
- thd->wsrep_skip_wsrep_GTID= false;
- return;
-}
-
-/*
- wsrep hton
-*/
-handlerton *wsrep_hton;
-
-
-/*
- Registers wsrep hton at commit time if transaction has registered htons
- for supported engine types.
-
- Hton should not be registered for TOTAL_ORDER operations.
-
- Registration is needed for both LOCAL_MODE and REPL_RECV transactions to run
- commit in 2pc so that wsrep position gets properly recorded in storage
- engines.
-
- Note that all hton calls should immediately return for threads that are
- in REPL_RECV mode as their states are controlled by wsrep appliers or
- replaying code. Only threads in LOCAL_MODE should run wsrep callbacks
- from hton methods.
-*/
-void wsrep_register_hton(THD* thd, bool all)
-{
- if (WSREP(thd) && thd->wsrep_exec_mode != TOTAL_ORDER &&
- !thd->wsrep_apply_toi)
- {
- if (thd->wsrep_exec_mode == LOCAL_STATE &&
- (thd_sql_command(thd) == SQLCOM_OPTIMIZE ||
- thd_sql_command(thd) == SQLCOM_ANALYZE ||
- thd_sql_command(thd) == SQLCOM_REPAIR) &&
- thd->lex->no_write_to_binlog == 1)
- {
- WSREP_DEBUG("Skipping wsrep_register_hton for LOCAL sql admin command : %s",
- thd->query());
- return;
- }
-
- THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
- for (Ha_trx_info *i= trans->ha_list; i; i = i->next())
- {
- if ((i->ht()->db_type == DB_TYPE_INNODB) ||
- (i->ht()->db_type == DB_TYPE_TOKUDB))
- {
- trans_register_ha(thd, all, wsrep_hton);
-
- /* follow innodb read/write settting
- * but, as an exception: CTAS with empty result set will not be
- * replicated unless we declare wsrep hton as read/write here
- */
- if (i->is_trx_read_write() ||
- ((thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
- thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE) &&
- thd->wsrep_exec_mode == LOCAL_STATE))
- {
- thd->ha_data[wsrep_hton->slot].ha_info[all].set_trx_read_write();
- }
- break;
- }
- }
- }
-}
-
-/*
- Calls wsrep->post_commit() for locally executed transactions that have
- got seqno from provider (must commit) and don't require replaying.
- */
-void wsrep_post_commit(THD* thd, bool all)
-{
- if (!WSREP(thd)) return;
-
- switch (thd->wsrep_exec_mode)
- {
- case LOCAL_COMMIT:
- {
- DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED);
- if (wsrep && wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
- {
- DBUG_PRINT("wsrep", ("set committed fail"));
- WSREP_WARN("set committed fail: %llu %d",
- (long long)thd->real_id, thd->get_stmt_da()->status());
- }
- wsrep_cleanup_transaction(thd);
- break;
- }
- case LOCAL_STATE:
- {
- /* non-InnoDB statements may have populated events in stmt cache
- => cleanup
- */
- WSREP_DEBUG("cleanup transaction for LOCAL_STATE");
- /*
- Run post-rollback hook to clean up in the case if
- some keys were populated for the transaction in provider
- but during commit time there was no write set to replicate.
- This may happen when client sets the SAVEPOINT and immediately
- rolls back to savepoint after first operation.
- */
- if (all && thd->wsrep_conflict_state != MUST_REPLAY &&
- wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
- {
- WSREP_WARN("post_rollback fail: %llu %d",
- (long long)thd->thread_id, thd->get_stmt_da()->status());
- }
- wsrep_cleanup_transaction(thd);
- break;
- }
- default: break;
- }
-}
-
-/*
- wsrep exploits binlog's caches even if binlogging itself is not
- activated. In such case connection close needs calling
- actual binlog's method.
- Todo: split binlog hton from its caches to use ones by wsrep
- without referring to binlog's stuff.
-*/
-static int
-wsrep_close_connection(handlerton* hton, THD* thd)
-{
- DBUG_ENTER("wsrep_close_connection");
-
- if (thd->wsrep_exec_mode == REPL_RECV)
- {
- DBUG_RETURN(0);
- }
-
- if (wsrep_emulate_bin_log && thd_get_ha_data(thd, binlog_hton) != NULL)
- binlog_hton->close_connection (binlog_hton, thd);
- DBUG_RETURN(0);
-}
-
-/*
- prepare/wsrep_run_wsrep_commit can fail in two ways
- - certification test or an equivalent. As a result,
- the current transaction just rolls back
- Error codes:
- WSREP_TRX_CERT_FAIL, WSREP_TRX_SIZE_EXCEEDED, WSREP_TRX_ERROR
- - a post-certification failure makes this server unable to
- commit its own WS and therefore the server must abort
-*/
-static int wsrep_prepare(handlerton *hton, THD *thd, bool all)
-{
- DBUG_ENTER("wsrep_prepare");
-
- if (thd->wsrep_exec_mode == REPL_RECV)
- {
- DBUG_RETURN(0);
- }
-
- DBUG_ASSERT(thd->ha_data[wsrep_hton->slot].ha_info[all].is_trx_read_write());
- DBUG_ASSERT(thd->wsrep_exec_mode == LOCAL_STATE);
- DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno == WSREP_SEQNO_UNDEFINED);
-
- if ((all ||
- !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
- (thd->variables.wsrep_on && !wsrep_trans_cache_is_empty(thd)))
- {
- int res= wsrep_run_wsrep_commit(thd, all);
- if (res != 0)
- {
- if (res == WSREP_TRX_SIZE_EXCEEDED)
- res= EMSGSIZE;
- else
- res= EDEADLK; // for a better error message
- }
- DBUG_RETURN (res);
- }
- DBUG_RETURN(0);
-}
-
-static int wsrep_savepoint_set(handlerton *hton, THD *thd, void *sv)
-{
- DBUG_ENTER("wsrep_savepoint_set");
-
- if (thd->wsrep_exec_mode == REPL_RECV)
- {
- DBUG_RETURN(0);
- }
-
- if (!wsrep_emulate_bin_log) DBUG_RETURN(0);
- int rcode = wsrep_binlog_savepoint_set(thd, sv);
- DBUG_RETURN(rcode);
-}
-
-static int wsrep_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
-{
- DBUG_ENTER("wsrep_savepoint_rollback");
-
- if (thd->wsrep_exec_mode == REPL_RECV)
- {
- DBUG_RETURN(0);
- }
-
- if (!wsrep_emulate_bin_log) DBUG_RETURN(0);
- int rcode = wsrep_binlog_savepoint_rollback(thd, sv);
- DBUG_RETURN(rcode);
-}
-
-static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
-{
- DBUG_ENTER("wsrep_rollback");
-
- if (thd->wsrep_exec_mode == REPL_RECV)
- {
- DBUG_RETURN(0);
- }
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- switch (thd->wsrep_exec_mode)
- {
- case TOTAL_ORDER:
- case REPL_RECV:
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- WSREP_DEBUG("Avoiding wsrep rollback for failed DDL: %s", thd->query());
- DBUG_RETURN(0);
- default: break;
- }
-
- if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
- thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY)
- {
- if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
- {
- DBUG_PRINT("wsrep", ("setting rollback fail"));
- WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
- (long long)thd->real_id, thd->get_db(), thd->query());
- }
- wsrep_cleanup_transaction(thd);
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- DBUG_RETURN(0);
-}
-
-int wsrep_commit(handlerton *hton, THD *thd, bool all)
-{
- DBUG_ENTER("wsrep_commit");
-
- if (thd->wsrep_exec_mode == REPL_RECV)
- {
- DBUG_RETURN(0);
- }
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
- (thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY))
- {
- if (thd->wsrep_exec_mode == LOCAL_COMMIT)
- {
- DBUG_ASSERT(thd->ha_data[wsrep_hton->slot].ha_info[all].is_trx_read_write());
- /*
- Call to wsrep->post_commit() (moved to wsrep_post_commit()) must
- be done only after commit has done for all involved htons.
- */
- DBUG_PRINT("wsrep", ("commit"));
- }
- else
- {
- /*
- Transaction didn't go through wsrep->pre_commit() so just roll back
- possible changes to clean state.
- */
- if (WSREP_PROVIDER_EXISTS) {
- if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
- {
- DBUG_PRINT("wsrep", ("setting rollback fail"));
- WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
- (long long)thd->real_id, thd->get_db(),
- thd->query());
- }
- }
- wsrep_cleanup_transaction(thd);
- }
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- DBUG_RETURN(0);
-}
-
-
-extern Rpl_filter* binlog_filter;
-extern my_bool opt_log_slave_updates;
-
-enum wsrep_trx_status
-wsrep_run_wsrep_commit(THD *thd, bool all)
-{
- int rcode= -1;
- size_t data_len= 0;
- IO_CACHE *cache;
- int replay_round= 0;
- DBUG_ENTER("wsrep_run_wsrep_commit");
-
- if (thd->get_stmt_da()->is_error()) {
- WSREP_DEBUG("commit issue, error: %d %s",
- thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
- }
-
- DEBUG_SYNC(thd, "wsrep_before_replication");
-
- if (thd->slave_thread && !opt_log_slave_updates) DBUG_RETURN(WSREP_TRX_OK);
-
- if (thd->wsrep_exec_mode == REPL_RECV) {
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- if (thd->wsrep_conflict_state == MUST_ABORT) {
- if (wsrep_debug)
- WSREP_INFO("WSREP: must abort for BF");
- DBUG_PRINT("wsrep", ("BF apply commit fail"));
- thd->wsrep_conflict_state = NO_CONFLICT;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- //
- // TODO: test all calls of the rollback.
- // rollback must happen automagically innobase_rollback(hton, thd, 1);
- //
- DBUG_RETURN(WSREP_TRX_ERROR);
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
-
- if (thd->wsrep_exec_mode != LOCAL_STATE) DBUG_RETURN(WSREP_TRX_OK);
-
- if (thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING) {
- WSREP_DEBUG("commit for consistency check: %s", thd->query());
- DBUG_RETURN(WSREP_TRX_OK);
- }
-
- DBUG_PRINT("wsrep", ("replicating commit"));
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- if (thd->wsrep_conflict_state == MUST_ABORT) {
- DBUG_PRINT("wsrep", ("replicate commit fail"));
- thd->wsrep_conflict_state = ABORTED;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- if (wsrep_debug) {
- WSREP_INFO("innobase_commit, abort %s",
- (thd->query()) ? thd->query() : "void");
- }
- DBUG_RETURN(WSREP_TRX_CERT_FAIL);
- }
-
- mysql_mutex_lock(&LOCK_wsrep_replaying);
-
- DBUG_PRINT("info", ("wsrep_replaying: %d wsrep_conflict_state: %d killed: %d shutdown_in_progress: %d",
- (int) wsrep_replaying, (int) thd->wsrep_conflict_state,
- (int) thd->killed,
- (int) shutdown_in_progress));
-
- while (wsrep_replaying > 0 &&
- thd->wsrep_conflict_state == NO_CONFLICT &&
- thd->killed == NOT_KILLED &&
- !shutdown_in_progress)
- {
-
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd_proc_info(thd, "WSREP waiting on replaying");
- thd->mysys_var->current_mutex= &LOCK_wsrep_replaying;
- thd->mysys_var->current_cond= &COND_wsrep_replaying;
- mysql_mutex_unlock(&thd->mysys_var->mutex);
-
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- // Using timedwait is a hack to avoid deadlock in case if BF victim
- // misses the signal.
- struct timespec wtime = {0, 1000000};
- mysql_cond_timedwait(&COND_wsrep_replaying, &LOCK_wsrep_replaying,
- &wtime);
-
- if (replay_round++ % 100000 == 0)
- WSREP_DEBUG("commit waiting for replaying: replayers %d, thd: %lld "
- "conflict: %d (round: %d)",
- wsrep_replaying, (longlong) thd->thread_id,
- thd->wsrep_conflict_state, replay_round);
-
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
-
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd->mysys_var->current_mutex= 0;
- thd->mysys_var->current_cond= 0;
- mysql_mutex_unlock(&thd->mysys_var->mutex);
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- }
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
-
- if (thd->wsrep_conflict_state == MUST_ABORT) {
- DBUG_PRINT("wsrep", ("replicate commit fail"));
- thd->wsrep_conflict_state = ABORTED;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- WSREP_DEBUG("innobase_commit abort after replaying wait %s",
- (thd->query()) ? thd->query() : "void");
- DBUG_RETURN(WSREP_TRX_CERT_FAIL);
- }
-
- thd->wsrep_query_state = QUERY_COMMITTING;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-
- cache = get_trans_log(thd);
- rcode = 0;
- if (cache) {
- thd->binlog_flush_pending_rows_event(true);
- rcode = wsrep_write_cache(wsrep, thd, cache, &data_len);
- if (WSREP_OK != rcode) {
- WSREP_ERROR("rbr write fail, data_len: %zu, %d", data_len, rcode);
- DBUG_RETURN(WSREP_TRX_SIZE_EXCEEDED);
- }
- }
-
- DBUG_PRINT("info", ("rcode: %d wsrep_conflict_state: %d",
- rcode, thd->wsrep_conflict_state));
-
- if (data_len == 0)
- {
- if (thd->get_stmt_da()->is_ok() &&
- thd->get_stmt_da()->affected_rows() > 0 &&
- !binlog_filter->is_on())
- {
- WSREP_DEBUG("empty rbr buffer, query: %s, "
- "affected rows: %llu, "
- "changed tables: %d, "
- "sql_log_bin: %d, "
- "wsrep status (%d %d %d)",
- thd->query(), thd->get_stmt_da()->affected_rows(),
- stmt_has_updated_trans_table(thd), thd->variables.sql_log_bin,
- thd->wsrep_exec_mode, thd->wsrep_query_state,
- thd->wsrep_conflict_state);
- }
- else
- {
- WSREP_DEBUG("empty rbr buffer, query: %s", thd->query());
- }
- thd->wsrep_query_state= QUERY_EXEC;
- DBUG_RETURN(WSREP_TRX_OK);
- }
-
- if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_ws_handle.trx_id)
- {
- WSREP_WARN("SQL statement was ineffective thd: %lld buf: %zu\n"
- "schema: %s \n"
- "QUERY: %s\n"
- " => Skipping replication",
- (longlong) thd->thread_id, data_len,
- thd->get_db(), thd->query());
- rcode = WSREP_TRX_FAIL;
- }
- else if (!rcode)
- {
- if (WSREP_OK == rcode && wsrep)
- rcode = wsrep->pre_commit(wsrep,
- (wsrep_conn_id_t)thd->thread_id,
- &thd->wsrep_ws_handle,
- WSREP_FLAG_COMMIT |
- ((thd->wsrep_PA_safe) ?
- 0ULL : WSREP_FLAG_PA_UNSAFE),
- &thd->wsrep_trx_meta);
-
- DBUG_PRINT("info", ("rcode after pre_commit: %d", rcode));
-
- if (rcode == WSREP_TRX_MISSING) {
- WSREP_WARN("Transaction missing in provider, thd: %lld schema: %s SQL: %s",
- (longlong) thd->thread_id,
- thd->get_db(), thd->query());
- rcode = WSREP_TRX_FAIL;
- } else if (rcode == WSREP_BF_ABORT) {
- WSREP_DEBUG("thd: %lld seqno: %lld BF aborted by provider, will replay",
- (longlong) thd->thread_id,
- (longlong) thd->wsrep_trx_meta.gtid.seqno);
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_conflict_state = MUST_REPLAY;
- DBUG_ASSERT(wsrep_thd_trx_seqno(thd) > 0);
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- wsrep_replaying++;
- WSREP_DEBUG("replaying increased: %d, thd: %lld",
- wsrep_replaying, (longlong) thd->thread_id);
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
- }
- } else {
- WSREP_ERROR("I/O error reading from thd's binlog iocache: "
- "errno=%d, io cache code=%d", my_errno, cache->error);
- DBUG_ASSERT(0); // failure like this can not normally happen
- DBUG_RETURN(WSREP_TRX_ERROR);
- }
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
-
- DEBUG_SYNC(thd, "wsrep_after_replication");
-
- DBUG_PRINT("info", ("rcode: %d wsrep_conflict_state: %d",
- rcode, thd->wsrep_conflict_state));
-
- switch(rcode) {
- case 0:
- /*
- About MUST_ABORT: We assume that even if thd conflict state was set
- to MUST_ABORT, underlying transaction was not rolled back or marked
- as deadlock victim in QUERY_COMMITTING state. Conflict state is
- set to NO_CONFLICT and commit proceeds as usual.
- */
- if (thd->wsrep_conflict_state == MUST_ABORT)
- thd->wsrep_conflict_state= NO_CONFLICT;
-
- if (thd->wsrep_conflict_state != NO_CONFLICT)
- {
- WSREP_WARN("thd: %llu seqno: %lld conflict state %d after post commit",
- (longlong) thd->thread_id,
- (longlong) thd->wsrep_trx_meta.gtid.seqno,
- thd->wsrep_conflict_state);
- }
- thd->wsrep_exec_mode= LOCAL_COMMIT;
- DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED);
- /* Override XID iff it was generated by mysql */
- if (thd->transaction.xid_state.xid.get_my_xid())
- {
- wsrep_xid_init(&thd->transaction.xid_state.xid,
- thd->wsrep_trx_meta.gtid.uuid,
- thd->wsrep_trx_meta.gtid.seqno);
- }
- DBUG_PRINT("wsrep", ("replicating commit success"));
- break;
- case WSREP_BF_ABORT:
- DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED);
- /* fall through */
- case WSREP_TRX_FAIL:
- WSREP_DEBUG("commit failed for reason: %d", rcode);
- DBUG_PRINT("wsrep", ("replicating commit fail"));
-
- thd->wsrep_query_state= QUERY_EXEC;
-
- if (thd->wsrep_conflict_state == MUST_ABORT) {
- thd->wsrep_conflict_state= ABORTED;
- }
- else
- {
- WSREP_DEBUG("conflict state: %d", thd->wsrep_conflict_state);
- if (thd->wsrep_conflict_state == NO_CONFLICT)
- {
- thd->wsrep_conflict_state = CERT_FAILURE;
- WSREP_LOG_CONFLICT(NULL, thd, FALSE);
- }
- }
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-
- DBUG_RETURN(WSREP_TRX_CERT_FAIL);
-
- case WSREP_SIZE_EXCEEDED:
- WSREP_ERROR("transaction size exceeded");
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- DBUG_RETURN(WSREP_TRX_SIZE_EXCEEDED);
- case WSREP_CONN_FAIL:
- WSREP_ERROR("connection failure");
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- DBUG_RETURN(WSREP_TRX_ERROR);
- default:
- WSREP_ERROR("unknown connection failure");
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- DBUG_RETURN(WSREP_TRX_ERROR);
- }
-
- thd->wsrep_query_state= QUERY_EXEC;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-
- DBUG_RETURN(WSREP_TRX_OK);
-}
-
-
-static int wsrep_hton_init(void *p)
-{
- wsrep_hton= (handlerton *)p;
- //wsrep_hton->state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO;
- wsrep_hton->state= SHOW_OPTION_YES;
- wsrep_hton->db_type=(legacy_db_type)0;
- wsrep_hton->savepoint_offset= sizeof(my_off_t);
- wsrep_hton->close_connection= wsrep_close_connection;
- wsrep_hton->savepoint_set= wsrep_savepoint_set;
- wsrep_hton->savepoint_rollback= wsrep_savepoint_rollback;
- wsrep_hton->commit= wsrep_commit;
- wsrep_hton->rollback= wsrep_rollback;
- wsrep_hton->prepare= wsrep_prepare;
- wsrep_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN; // todo: fix flags
- return 0;
-}
-
-
-struct st_mysql_storage_engine wsrep_storage_engine=
-{ MYSQL_HANDLERTON_INTERFACE_VERSION };
-
-
-maria_declare_plugin(wsrep)
-{
- MYSQL_STORAGE_ENGINE_PLUGIN,
- &wsrep_storage_engine,
- "wsrep",
- "Codership Oy",
- "A pseudo storage engine to represent transactions in multi-master "
- "synchornous replication",
- PLUGIN_LICENSE_GPL,
- wsrep_hton_init, /* Plugin Init */
- NULL, /* Plugin Deinit */
- 0x0100 /* 1.0 */,
- NULL, /* status variables */
- NULL, /* system variables */
- "1.0", /* string version */
- MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
-}
-maria_declare_plugin_end;
diff --git a/sql/wsrep_mutex.h b/sql/wsrep_mutex.h
new file mode 100644
index 00000000000..3454b44e0ec
--- /dev/null
+++ b/sql/wsrep_mutex.h
@@ -0,0 +1,50 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_MUTEX_H
+#define WSREP_MUTEX_H
+
+/* wsrep-lib */
+#include "wsrep/mutex.hpp"
+
+/* implementation */
+#include "my_pthread.h"
+
+class Wsrep_mutex : public wsrep::mutex
+{
+public:
+ Wsrep_mutex(mysql_mutex_t& mutex)
+ : m_mutex(mutex)
+ { }
+
+ void lock()
+ {
+ mysql_mutex_lock(&m_mutex);
+ }
+
+ void unlock()
+ {
+ mysql_mutex_unlock(&m_mutex);
+ }
+
+ void* native()
+ {
+ return &m_mutex;
+ }
+private:
+ mysql_mutex_t& m_mutex;
+};
+
+#endif /* WSREP_MUTEX_H */
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index bc52bff0de9..7a9c8922296 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -14,7 +14,12 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "sql_plugin.h" /* wsrep_plugins_pre_init() */
+#include "my_global.h"
+#include "wsrep_server_state.h"
+
+#include "mariadb.h"
#include <mysqld.h>
+#include <transaction.h>
#include <sql_class.h>
#include <sql_parse.h>
#include <sql_base.h> /* find_temporary_table() */
@@ -33,26 +38,32 @@
#include "wsrep_var.h"
#include "wsrep_binlog.h"
#include "wsrep_applier.h"
+#include "wsrep_schema.h"
#include "wsrep_xid.h"
+#include "wsrep_trans_observer.h"
+#include "mysql/service_wsrep.h"
#include <cstdio>
#include <cstdlib>
+#include <string>
#include "log_event.h"
#include <slave.h>
-wsrep_t *wsrep = NULL;
-/*
- wsrep_emulate_bin_log is a flag to tell that binlog has not been configured.
- wsrep needs to get binlog events from transaction cache even when binlog is
- not enabled, wsrep_emulate_bin_log opens needed code paths to make this
- possible
-*/
-my_bool wsrep_emulate_bin_log = FALSE; // activating parts of binlog interface
+#include <sstream>
+
+/* wsrep-lib */
+Wsrep_server_state* Wsrep_server_state::m_instance;
+
+my_bool wsrep_emulate_bin_log = FALSE; // activating parts of binlog interface
#ifdef GTID_SUPPORT
/* Sidno in global_sid_map corresponding to group uuid */
rpl_sidno wsrep_sidno= -1;
#endif /* GTID_SUPPORT */
my_bool wsrep_preordered_opt= FALSE;
+/* Streaming Replication */
+const char *wsrep_fragment_units[]= { "bytes", "rows", "statements", NullS };
+const char *wsrep_SR_store_types[]= { "none", "table", NullS };
+
/*
* Begin configuration options
*/
@@ -82,7 +93,7 @@ my_bool wsrep_certify_nonPK; // Certify, even when no primary
my_bool wsrep_recovery; // Recovery
my_bool wsrep_replicate_myisam; // Enable MyISAM replication
my_bool wsrep_log_conflicts;
-my_bool wsrep_load_data_splitting; // Commit load data every 10K intervals
+my_bool wsrep_load_data_splitting= 0; // Commit load data every 10K intervals
my_bool wsrep_slave_UK_checks; // Slave thread does UK checks
my_bool wsrep_slave_FK_checks; // Slave thread does FK checks
my_bool wsrep_restart_slave; // Should mysql slave thread be
@@ -107,7 +118,13 @@ my_bool wsrep_restart_slave_activated= 0; // Node has dropped, and slave
bool wsrep_new_cluster= false; // Bootstrap the cluster?
int wsrep_slave_count_change= 0; // No. of appliers to stop/start
int wsrep_to_isolation= 0; // No. of active TO isolation threads
-long wsrep_max_protocol_version= 3; // Maximum protocol version to use
+long wsrep_max_protocol_version= 4; // Maximum protocol version to use
+long int wsrep_protocol_version= wsrep_max_protocol_version;
+ulong wsrep_trx_fragment_unit= WSREP_FRAG_BYTES;
+ // unit for fragment size
+ulong wsrep_SR_store_type= WSREP_SR_STORE_TABLE;
+uint wsrep_ignore_apply_errors= 0;
+
/*
* End configuration options
@@ -123,29 +140,33 @@ mysql_mutex_t LOCK_wsrep_sst;
mysql_cond_t COND_wsrep_sst;
mysql_mutex_t LOCK_wsrep_sst_init;
mysql_cond_t COND_wsrep_sst_init;
-mysql_mutex_t LOCK_wsrep_rollback;
-mysql_cond_t COND_wsrep_rollback;
-wsrep_aborting_thd_t wsrep_aborting_thd= NULL;
mysql_mutex_t LOCK_wsrep_replaying;
mysql_cond_t COND_wsrep_replaying;
mysql_mutex_t LOCK_wsrep_slave_threads;
mysql_mutex_t LOCK_wsrep_desync;
mysql_mutex_t LOCK_wsrep_config_state;
+mysql_mutex_t LOCK_wsrep_SR_pool;
+mysql_mutex_t LOCK_wsrep_SR_store;
int wsrep_replaying= 0;
-ulong wsrep_running_threads = 0; // # of currently running wsrep threads
+ulong wsrep_running_threads= 0; // # of currently running wsrep threads
ulong my_bind_addr;
#ifdef HAVE_PSI_INTERFACE
-PSI_mutex_key key_LOCK_wsrep_rollback,
+PSI_mutex_key
key_LOCK_wsrep_replaying, key_LOCK_wsrep_ready, key_LOCK_wsrep_sst,
key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init,
key_LOCK_wsrep_slave_threads, key_LOCK_wsrep_desync,
- key_LOCK_wsrep_config_state;
+ key_LOCK_wsrep_config_state,
+ key_LOCK_wsrep_SR_pool,
+ key_LOCK_wsrep_SR_store,
+ key_LOCK_wsrep_thd_queue;
-PSI_cond_key key_COND_wsrep_rollback,
+PSI_cond_key key_COND_wsrep_thd,
key_COND_wsrep_replaying, key_COND_wsrep_ready, key_COND_wsrep_sst,
- key_COND_wsrep_sst_init, key_COND_wsrep_sst_thread;
+ key_COND_wsrep_sst_init, key_COND_wsrep_sst_thread,
+ key_COND_wsrep_thd_queue;
+
PSI_file_key key_file_wsrep_gra_log;
@@ -156,11 +177,12 @@ static PSI_mutex_info wsrep_mutexes[]=
{ &key_LOCK_wsrep_sst_thread, "wsrep_sst_thread", 0},
{ &key_LOCK_wsrep_sst_init, "LOCK_wsrep_sst_init", PSI_FLAG_GLOBAL},
{ &key_LOCK_wsrep_sst, "LOCK_wsrep_sst", PSI_FLAG_GLOBAL},
- { &key_LOCK_wsrep_rollback, "LOCK_wsrep_rollback", PSI_FLAG_GLOBAL},
{ &key_LOCK_wsrep_replaying, "LOCK_wsrep_replaying", PSI_FLAG_GLOBAL},
{ &key_LOCK_wsrep_slave_threads, "LOCK_wsrep_slave_threads", PSI_FLAG_GLOBAL},
{ &key_LOCK_wsrep_desync, "LOCK_wsrep_desync", PSI_FLAG_GLOBAL},
- { &key_LOCK_wsrep_config_state, "LOCK_wsrep_config_state", PSI_FLAG_GLOBAL}
+ { &key_LOCK_wsrep_config_state, "LOCK_wsrep_config_state", PSI_FLAG_GLOBAL},
+ { &key_LOCK_wsrep_SR_pool, "LOCK_wsrep_SR_pool", PSI_FLAG_GLOBAL},
+ { &key_LOCK_wsrep_SR_store, "LOCK_wsrep_SR_store", PSI_FLAG_GLOBAL}
};
static PSI_cond_info wsrep_conds[]=
@@ -169,7 +191,7 @@ static PSI_cond_info wsrep_conds[]=
{ &key_COND_wsrep_sst, "COND_wsrep_sst", PSI_FLAG_GLOBAL},
{ &key_COND_wsrep_sst_init, "COND_wsrep_sst_init", PSI_FLAG_GLOBAL},
{ &key_COND_wsrep_sst_thread, "wsrep_sst_thread", 0},
- { &key_COND_wsrep_rollback, "COND_wsrep_rollback", PSI_FLAG_GLOBAL},
+ { &key_COND_wsrep_thd, "THD::COND_wsrep_thd", 0},
{ &key_COND_wsrep_replaying, "COND_wsrep_replaying", PSI_FLAG_GLOBAL}
};
@@ -179,310 +201,218 @@ static PSI_file_info wsrep_files[]=
};
#endif
-my_bool wsrep_inited = 0; // initialized ?
+my_bool wsrep_inited= 0; // initialized ?
-static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED;
+static wsrep_uuid_t node_uuid= WSREP_UUID_UNDEFINED;
static char cluster_uuid_str[40]= { 0, };
-static const char* cluster_status_str[WSREP_VIEW_MAX] =
-{
- "Primary",
- "non-Primary",
- "Disconnected"
-};
static char provider_name[256]= { 0, };
static char provider_version[256]= { 0, };
static char provider_vendor[256]= { 0, };
/*
- * wsrep status variables
+ * Wsrep status variables. LOCK_status must be locked When modifying
+ * these variables,
*/
-my_bool wsrep_connected = FALSE;
-my_bool wsrep_ready = FALSE; // node can accept queries
-const char* wsrep_cluster_state_uuid = cluster_uuid_str;
-long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED;
-const char* wsrep_cluster_status = cluster_status_str[WSREP_VIEW_DISCONNECTED];
-long wsrep_cluster_size = 0;
-long wsrep_local_index = -1;
-long long wsrep_local_bf_aborts = 0;
-const char* wsrep_provider_name = provider_name;
-const char* wsrep_provider_version = provider_version;
-const char* wsrep_provider_vendor = provider_vendor;
+my_bool wsrep_connected = FALSE;
+my_bool wsrep_ready = FALSE;
+const char* wsrep_cluster_state_uuid= cluster_uuid_str;
+long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED;
+const char* wsrep_cluster_status = "Disconnected";
+long wsrep_cluster_size = 0;
+long wsrep_local_index = -1;
+long long wsrep_local_bf_aborts = 0;
+const char* wsrep_provider_name = provider_name;
+const char* wsrep_provider_version = provider_version;
+const char* wsrep_provider_vendor = provider_vendor;
+char* wsrep_provider_capabilities = NULL;
+char* wsrep_cluster_capabilities = NULL;
/* End wsrep status variables */
-wsrep_uuid_t local_uuid = WSREP_UUID_UNDEFINED;
-wsrep_seqno_t local_seqno = WSREP_SEQNO_UNDEFINED;
-long wsrep_protocol_version = 3;
-
wsp::Config_state *wsrep_config_state;
-// Boolean denoting if server is in initial startup phase. This is needed
-// to make sure that main thread waiting in wsrep_sst_wait() is signaled
-// if there was no state gap on receiving first view event.
-static my_bool wsrep_startup = TRUE;
+wsrep_uuid_t local_uuid = WSREP_UUID_UNDEFINED;
+wsrep_seqno_t local_seqno = WSREP_SEQNO_UNDEFINED;
+wsp::node_status local_status;
-static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) {
- switch (level) {
- case WSREP_LOG_INFO:
- sql_print_information("WSREP: %s", msg);
- break;
- case WSREP_LOG_WARN:
- sql_print_warning("WSREP: %s", msg);
- break;
- case WSREP_LOG_ERROR:
- case WSREP_LOG_FATAL:
+/*
+ */
+Wsrep_schema *wsrep_schema= 0;
+
+static void wsrep_log_cb(wsrep::log::level level, const char *msg)
+{
+ /*
+ Silence all wsrep related logging from lib and provider if
+ wsrep is not enabled.
+ */
+ if (WSREP_ON)
+ {
+ switch (level) {
+ case wsrep::log::info:
+ sql_print_information("WSREP: %s", msg);
+ break;
+ case wsrep::log::warning:
+ sql_print_warning("WSREP: %s", msg);
+ break;
+ case wsrep::log::error:
sql_print_error("WSREP: %s", msg);
break;
- case WSREP_LOG_DEBUG:
- if (wsrep_debug) sql_print_information ("[Debug] WSREP: %s", msg);
- default:
- break;
+ case wsrep::log::debug:
+ if (wsrep_debug) sql_print_information ("[Debug] WSREP: %s", msg);
+ default:
+ break;
+ }
}
}
-void wsrep_log(void (*fun)(const char *, ...), const char *format, ...)
-{
- va_list args;
- char msg[1024];
- va_start(args, format);
- vsnprintf(msg, sizeof(msg) - 1, format, args);
- va_end(args);
- (fun)("WSREP: %s", msg);
-}
-
-
-static void wsrep_log_states (wsrep_log_level_t const level,
- const wsrep_uuid_t* const group_uuid,
- wsrep_seqno_t const group_seqno,
- const wsrep_uuid_t* const node_uuid,
- wsrep_seqno_t const node_seqno)
-{
- char uuid_str[37];
- char msg[256];
-
- wsrep_uuid_print (group_uuid, uuid_str, sizeof(uuid_str));
- snprintf (msg, 255, "WSREP: Group state: %s:%lld",
- uuid_str, (long long)group_seqno);
- wsrep_log_cb (level, msg);
-
- wsrep_uuid_print (node_uuid, uuid_str, sizeof(uuid_str));
- snprintf (msg, 255, "WSREP: Local state: %s:%lld",
- uuid_str, (long long)node_seqno);
- wsrep_log_cb (level, msg);
-}
-
-#ifdef GTID_SUPPORT
-void wsrep_init_sidno(const wsrep_uuid_t& wsrep_uuid)
+void wsrep_init_sidno(const wsrep::id& uuid)
{
- /* generate new Sid map entry from inverted uuid */
- rpl_sid sid;
- wsrep_uuid_t ltid_uuid;
-
- for (size_t i= 0; i < sizeof(ltid_uuid.data); ++i)
+ /*
+ Protocol versions starting from 4 use group gtid as it is.
+ For lesser protocol versions generate new Sid map entry from inverted
+ uuid.
+ */
+ rpl_gtid sid;
+ if (wsrep_protocol_version >= 4)
{
- ltid_uuid.data[i] = ~wsrep_uuid.data[i];
+ memcpy((void*)&sid, (const uchar*)uuid.data(),16);
}
-
- sid.copy_from(ltid_uuid.data);
+ else
+ {
+ wsrep_uuid_t ltid_uuid;
+ for (size_t i= 0; i < sizeof(ltid_uuid.data); ++i)
+ {
+ ltid_uuid.data[i]= ~((const uchar*)uuid.data())[i];
+ }
+ memcpy((void*)&sid, (const uchar*)ltid_uuid.data,16);
+ }
+#ifdef GTID_SUPPORT
global_sid_lock->wrlock();
wsrep_sidno= global_sid_map->add_sid(sid);
WSREP_INFO("Initialized wsrep sidno %d", wsrep_sidno);
global_sid_lock->unlock();
+#endif
}
-#endif /* GTID_SUPPORT */
-static wsrep_cb_status_t
-wsrep_view_handler_cb (void* app_ctx,
- void* recv_ctx,
- const wsrep_view_info_t* view,
- const char* state,
- size_t state_len,
- void** sst_req,
- size_t* sst_req_len)
+void wsrep_init_schema()
{
- *sst_req = NULL;
- *sst_req_len = 0;
+ DBUG_ASSERT(!wsrep_schema);
- wsrep_member_status_t memb_status= wsrep_config_state->get_status();
-
- if (memcmp(&cluster_uuid, &view->state_id.uuid, sizeof(wsrep_uuid_t)))
+ WSREP_INFO("wsrep_init_schema_and_SR %p", wsrep_schema);
+ if (!wsrep_schema)
{
- memcpy(&cluster_uuid, &view->state_id.uuid, sizeof(cluster_uuid));
-
- wsrep_uuid_print (&cluster_uuid, cluster_uuid_str,
- sizeof(cluster_uuid_str));
- }
-
- wsrep_cluster_conf_id= view->view;
- wsrep_cluster_status= cluster_status_str[view->status];
- wsrep_cluster_size= view->memb_num;
- wsrep_local_index= view->my_idx;
-
- WSREP_INFO("New cluster view: global state: %s:%lld, view# %lld: %s, "
- "number of nodes: %ld, my index: %ld, protocol version %d",
- wsrep_cluster_state_uuid, (long long)view->state_id.seqno,
- (long long)wsrep_cluster_conf_id, wsrep_cluster_status,
- wsrep_cluster_size, wsrep_local_index, view->proto_ver);
-
- /* Proceed further only if view is PRIMARY */
- if (WSREP_VIEW_PRIMARY != view->status)
- {
-#ifdef HAVE_QUERY_CACHE
- // query cache must be initialised by now
- query_cache.flush();
-#endif /* HAVE_QUERY_CACHE */
-
- wsrep_ready_set(FALSE);
- memb_status= WSREP_MEMBER_UNDEFINED;
- /* Always record local_uuid and local_seqno in non-prim since this
- * may lead to re-initializing provider and start position is
- * determined according to these variables */
- // WRONG! local_uuid should be the last primary configuration uuid we were
- // a member of. local_seqno should be updated in commit calls.
- // local_uuid= cluster_uuid;
- // local_seqno= view->first - 1;
- goto out;
- }
-
- switch (view->proto_ver)
- {
- case 0:
- case 1:
- case 2:
- case 3:
- // version change
- if (view->proto_ver != wsrep_protocol_version)
- {
- my_bool wsrep_ready_saved= wsrep_ready_get();
- wsrep_ready_set(FALSE);
- WSREP_INFO("closing client connections for "
- "protocol change %ld -> %d",
- wsrep_protocol_version, view->proto_ver);
- wsrep_close_client_connections(TRUE);
- wsrep_protocol_version= view->proto_ver;
- wsrep_ready_set(wsrep_ready_saved);
- }
- break;
- default:
- WSREP_ERROR("Unsupported application protocol version: %d",
- view->proto_ver);
- unireg_abort(1);
- }
-
- if (view->state_gap)
- {
- WSREP_WARN("Gap in state sequence. Need state transfer.");
-
- /* After that wsrep will call wsrep_sst_prepare. */
- /* keep ready flag 0 until we receive the snapshot */
- wsrep_ready_set(FALSE);
-
- /* Close client connections to ensure that they don't interfere
- * with SST. Necessary only if storage engines are initialized
- * before SST.
- * TODO: Just killing all ongoing transactions should be enough
- * since wsrep_ready is OFF and no new transactions can start.
- */
- if (!wsrep_before_SE())
+ wsrep_schema= new Wsrep_schema();
+ if (wsrep_schema->init())
{
- WSREP_DEBUG("[debug]: closing client connections for PRIM");
- wsrep_close_client_connections(FALSE);
+ WSREP_ERROR("Failed to init wsrep schema");
+ unireg_abort(1);
}
+ }
+}
- ssize_t const req_len= wsrep_sst_prepare (sst_req);
+void wsrep_deinit_schema()
+{
+ delete wsrep_schema;
+ wsrep_schema= 0;
+}
- if (req_len < 0)
+void wsrep_recover_sr_from_storage(THD *orig_thd)
+{
+ switch (wsrep_SR_store_type)
+ {
+ case WSREP_SR_STORE_TABLE:
+ if (!wsrep_schema)
{
- WSREP_ERROR("SST preparation failed: %zd (%s)", -req_len,
- strerror(-req_len));
- memb_status= WSREP_MEMBER_UNDEFINED;
+ WSREP_ERROR("Wsrep schema not initialized when trying to recover "
+ "streaming transactions");
+ unireg_abort(1);
}
- else
+ if (wsrep_schema->recover_sr_transactions(orig_thd))
{
- assert(sst_req != NULL);
- *sst_req_len= req_len;
- memb_status= WSREP_MEMBER_JOINER;
+ WSREP_ERROR("Failed to recover SR transactions from schema");
+ unireg_abort(1);
}
+ break;
+ default:
+ /* */
+ WSREP_ERROR("Unsupported wsrep SR store type: %lu", wsrep_SR_store_type);
+ unireg_abort(1);
+ break;
}
- else
- {
- /*
- * NOTE: Initialize wsrep_group_uuid here only if it wasn't initialized
- * before - OR - it was reinitilized on startup (lp:992840)
- */
- if (wsrep_startup)
+}
+
+/** Export the WSREP provider's capabilities as a human readable string.
+ * The result is saved in a dynamically allocated string of the form:
+ * :cap1:cap2:cap3:
+ */
+static void wsrep_capabilities_export(wsrep_cap_t const cap, char** str)
+{
+ static const char* names[] =
+ {
+ /* Keep in sync with wsrep/wsrep_api.h WSREP_CAP_* macros. */
+ "MULTI_MASTER",
+ "CERTIFICATION",
+ "PARALLEL_APPLYING",
+ "TRX_REPLAY",
+ "ISOLATION",
+ "PAUSE",
+ "CAUSAL_READS",
+ "CAUSAL_TRX",
+ "INCREMENTAL_WRITESET",
+ "SESSION_LOCKS",
+ "DISTRIBUTED_LOCKS",
+ "CONSISTENCY_CHECK",
+ "UNORDERED",
+ "ANNOTATION",
+ "PREORDERED",
+ "STREAMING",
+ "SNAPSHOT",
+ "NBO",
+ };
+
+ std::string s;
+ for (size_t i= 0; i < sizeof(names) / sizeof(names[0]); ++i)
+ {
+ if (cap & (1ULL << i))
{
- if (wsrep_before_SE())
- {
- wsrep_SE_init_grab();
- // Signal mysqld init thread to continue
- wsrep_sst_complete (&cluster_uuid, view->state_id.seqno, false);
- // and wait for SE initialization
- wsrep_SE_init_wait();
- }
- else
+ if (s.empty())
{
- local_uuid= cluster_uuid;
- local_seqno= view->state_id.seqno;
+ s= ":";
}
- /* Init storage engine XIDs from first view */
- wsrep_set_SE_checkpoint(local_uuid, local_seqno);
-#ifdef GTID_SUPPORT
- wsrep_init_sidno(local_uuid);
-#endif /* GTID_SUPPORT */
- memb_status= WSREP_MEMBER_JOINED;
+ s += names[i];
+ s += ":";
}
-
- // just some sanity check
- if (memcmp (&local_uuid, &cluster_uuid, sizeof (wsrep_uuid_t)))
- {
- WSREP_ERROR("Undetected state gap. Can't continue.");
- wsrep_log_states(WSREP_LOG_FATAL, &cluster_uuid, view->state_id.seqno,
- &local_uuid, -1);
- unireg_abort(1);
- }
- }
-
- if (wsrep_auto_increment_control)
- {
- global_system_variables.auto_increment_offset= view->my_idx + 1;
- global_system_variables.auto_increment_increment= view->memb_num;
}
- { /* capabilities may be updated on new configuration */
- uint64_t const caps(wsrep->capabilities (wsrep));
+ /* A read from the string pointed to by *str may be started at any time,
+ * so it must never point to free(3)d memory or non '\0' terminated string. */
- my_bool const idc((caps & WSREP_CAP_INCREMENTAL_WRITESET) != 0);
- if (TRUE == wsrep_incremental_data_collection && FALSE == idc)
- {
- WSREP_WARN("Unsupported protocol downgrade: "
- "incremental data collection disabled. Expect abort.");
- }
- wsrep_incremental_data_collection = idc;
- }
+ char* const previous= *str;
-out:
- if (view->status == WSREP_VIEW_PRIMARY) wsrep_startup= FALSE;
- wsrep_config_state->set(memb_status, view);
+ *str= strdup(s.c_str());
- return WSREP_CB_SUCCESS;
+ if (previous != NULL)
+ {
+ free(previous);
+ }
}
-my_bool wsrep_ready_set (my_bool x)
+/* Verifies that SE position is consistent with the group position
+ * and initializes other variables */
+void wsrep_verify_SE_checkpoint(const wsrep_uuid_t& uuid,
+ wsrep_seqno_t const seqno)
{
- WSREP_DEBUG("Setting wsrep_ready to %d", x);
- if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
- my_bool ret= (wsrep_ready != x);
- if (ret)
- {
- wsrep_ready= x;
- mysql_cond_signal (&COND_wsrep_ready);
- }
- mysql_mutex_unlock (&LOCK_wsrep_ready);
- return ret;
}
+/*
+ Wsrep is considered ready if
+ 1) Provider is not loaded (native mode)
+ 2) Server has reached synced state
+ 3) Server is in joiner mode and mysqldump SST method has been
+ specified
+ See Wsrep_server_service::log_state_change() for further details.
+ */
my_bool wsrep_ready_get (void)
{
if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
@@ -499,178 +429,67 @@ int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff)
return 0;
}
-// Wait until wsrep has reached ready state
-void wsrep_ready_wait ()
+void wsrep_update_cluster_state_uuid(const char* uuid)
{
- if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
- while (!wsrep_ready)
- {
- WSREP_INFO("Waiting to reach ready state");
- mysql_cond_wait (&COND_wsrep_ready, &LOCK_wsrep_ready);
- }
- WSREP_INFO("ready state reached");
- mysql_mutex_unlock (&LOCK_wsrep_ready);
+ strncpy(cluster_uuid_str, uuid, sizeof(cluster_uuid_str) - 1);
}
-static void wsrep_synced_cb(void* app_ctx)
+static void wsrep_init_position()
{
- WSREP_INFO("Synchronized with group, ready for connections");
- my_bool signal_main= wsrep_ready_set(TRUE);
- wsrep_config_state->set(WSREP_MEMBER_SYNCED);
-
- if (signal_main)
- {
- wsrep_SE_init_grab();
- // Signal mysqld init thread to continue
- wsrep_sst_complete (&local_uuid, local_seqno, false);
- // and wait for SE initialization
- wsrep_SE_init_wait();
- }
- if (wsrep_restart_slave_activated)
- {
- int rcode;
- WSREP_INFO("MariaDB slave restart");
- wsrep_restart_slave_activated= FALSE;
-
- mysql_mutex_lock(&LOCK_active_mi);
- if ((rcode = start_slave_threads(0,
- 1 /* need mutex */,
- 0 /* no wait for start*/,
- active_mi,
- master_info_file,
- relay_log_info_file,
- SLAVE_SQL)))
- {
- WSREP_WARN("Failed to create slave threads: %d", rcode);
- }
- mysql_mutex_unlock(&LOCK_active_mi);
-
- }
}
-static void wsrep_init_position()
+/****************************************************************************
+ Helpers for wsrep_init()
+ ****************************************************************************/
+static std::string wsrep_server_name()
{
- /* read XIDs from storage engines */
- wsrep_uuid_t uuid;
- wsrep_seqno_t seqno;
- wsrep_get_SE_checkpoint(uuid, seqno);
-
- if (!memcmp(&uuid, &WSREP_UUID_UNDEFINED, sizeof(wsrep_uuid_t)))
- {
- WSREP_INFO("Read nil XID from storage engines, skipping position init");
- return;
- }
-
- char uuid_str[40] = {0, };
- wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str));
- WSREP_INFO("Initial position: %s:%lld", uuid_str, (long long)seqno);
-
- if (!memcmp(&local_uuid, &WSREP_UUID_UNDEFINED, sizeof(local_uuid)) &&
- local_seqno == WSREP_SEQNO_UNDEFINED)
- {
- // Initial state
- local_uuid= uuid;
- local_seqno= seqno;
- }
- else if (memcmp(&local_uuid, &uuid, sizeof(local_uuid)) ||
- local_seqno != seqno)
- {
- WSREP_WARN("Initial position was provided by configuration or SST, "
- "avoiding override");
- }
+ std::string ret(wsrep_node_name ? wsrep_node_name : "");
+ return ret;
}
-extern char* my_bind_addr_str;
-
-int wsrep_init()
+static std::string wsrep_server_id()
{
- int rcode= -1;
- DBUG_ASSERT(wsrep_inited == 0);
-
- if (strcmp(wsrep_start_position, WSREP_START_POSITION_ZERO) &&
- wsrep_start_position_init(wsrep_start_position))
- {
- return 1;
- }
-
- wsrep_sst_auth_init();
-
- wsrep_ready_set(FALSE);
- assert(wsrep_provider);
-
- wsrep_init_position();
-
- if ((rcode= wsrep_load(wsrep_provider, &wsrep, wsrep_log_cb)) != WSREP_OK)
- {
- if (strcasecmp(wsrep_provider, WSREP_NONE))
- {
- WSREP_ERROR("wsrep_load(%s) failed: %s (%d). Reverting to no provider.",
- wsrep_provider, strerror(rcode), rcode);
- strcpy((char*)wsrep_provider, WSREP_NONE); // damn it's a dirty hack
- return wsrep_init();
- }
- else /* this is for recursive call above */
- {
- WSREP_ERROR("Could not revert to no provider: %s (%d). Need to abort.",
- strerror(rcode), rcode);
- unireg_abort(1);
- }
- }
+ /* using empty server_id, which enables view change handler to
+ set final server_id later on
+ */
+ std::string ret("");
+ return ret;
+}
- if (!WSREP_PROVIDER_EXISTS)
- {
- // enable normal operation in case no provider is specified
- wsrep_ready_set(TRUE);
- wsrep_inited= 1;
- global_system_variables.wsrep_on = 0;
- wsrep_init_args args;
- args.logger_cb = wsrep_log_cb;
- args.options = (wsrep_provider_options) ?
- wsrep_provider_options : "";
- rcode = wsrep->init(wsrep, &args);
- if (rcode)
- {
- DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode));
- WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode);
- wsrep->free(wsrep);
- free(wsrep);
- wsrep = NULL;
- }
- return rcode;
- }
- else
- {
- global_system_variables.wsrep_on = 1;
- strncpy(provider_name,
- wsrep->provider_name, sizeof(provider_name) - 1);
- strncpy(provider_version,
- wsrep->provider_version, sizeof(provider_version) - 1);
- strncpy(provider_vendor,
- wsrep->provider_vendor, sizeof(provider_vendor) - 1);
- }
+static std::string wsrep_server_node_address()
+{
+ std::string ret;
if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0)
- wsrep_data_home_dir = mysql_real_data_home;
+ wsrep_data_home_dir= mysql_real_data_home;
/* Initialize node address */
- char node_addr[512]= { 0, };
- size_t const node_addr_max= sizeof(node_addr) - 1;
if (!wsrep_node_address || !strcmp(wsrep_node_address, ""))
{
- size_t const ret= wsrep_guess_ip(node_addr, node_addr_max);
- if (!(ret > 0 && ret < node_addr_max))
+ char node_addr[512]= {0, };
+ const size_t node_addr_max= sizeof(node_addr) - 1;
+ size_t guess_ip_ret= wsrep_guess_ip(node_addr, node_addr_max);
+ if (!(guess_ip_ret > 0 && guess_ip_ret < node_addr_max))
{
WSREP_WARN("Failed to guess base node address. Set it explicitly via "
"wsrep_node_address.");
- node_addr[0]= '\0';
+ }
+ else
+ {
+ ret= node_addr;
}
}
else
{
- strncpy(node_addr, wsrep_node_address, node_addr_max);
+ ret= wsrep_node_address;
}
+ return ret;
+}
- /* Initialize node's incoming address */
+static std::string wsrep_server_incoming_address()
+{
+ std::string ret;
+ const std::string node_addr(wsrep_server_node_address());
char inc_addr[512]= { 0, };
size_t const inc_addr_max= sizeof (inc_addr);
@@ -685,7 +504,8 @@ int wsrep_init()
bool is_ipv6= false;
unsigned int my_bind_ip= INADDR_ANY; // default if not set
- if (my_bind_addr_str && strlen(my_bind_addr_str))
+ if (my_bind_addr_str && strlen(my_bind_addr_str) &&
+ strcmp(my_bind_addr_str, "*") != 0)
{
my_bind_ip= wsrep_check_ip(my_bind_addr_str, &is_ipv6);
}
@@ -704,22 +524,28 @@ int wsrep_init()
}
else /* mysqld binds to 0.0.0.0, try taking IP from wsrep_node_address. */
{
- size_t const node_addr_len= strlen(node_addr);
- if (node_addr_len > 0)
+ if (node_addr.size())
{
- wsp::Address addr(node_addr);
-
- if (!addr.is_valid())
+ size_t const ip_len= wsrep_host_len(node_addr.c_str(), node_addr.size());
+ if (ip_len + 7 /* :55555\0 */ < inc_addr_max)
{
- WSREP_DEBUG("Could not parse node address : %s", node_addr);
- WSREP_WARN("Guessing address for incoming client connections failed. "
- "Try setting wsrep_node_incoming_address explicitly.");
- goto done;
+ memcpy (inc_addr, node_addr.c_str(), ip_len);
+ snprintf(inc_addr + ip_len, inc_addr_max - ip_len, ":%u",
+ (int)mysqld_port);
}
+ else
+ {
+ WSREP_WARN("Guessing address for incoming client connections: "
+ "address too long.");
+ inc_addr[0]= '\0';
+ }
+ }
- const char *fmt= (addr.is_ipv6()) ? "[%s]:%u" : "%s:%u";
- snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(),
- (int) mysqld_port);
+ if (!strlen(inc_addr))
+ {
+ WSREP_WARN("Guessing address for incoming client connections failed. "
+ "Try setting wsrep_node_incoming_address explicitly.");
+ WSREP_INFO("Node addr: %s", node_addr.c_str());
}
}
}
@@ -743,52 +569,178 @@ int wsrep_init()
snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), port);
}
+
+ done:
+ ret= wsrep_node_incoming_address;
+ return ret;
+}
-done:
- struct wsrep_init_args wsrep_args;
+static std::string wsrep_server_working_dir()
+{
+ std::string ret;
+ if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0)
+ {
+ ret= mysql_real_data_home;
+ }
+ else
+ {
+ ret= wsrep_data_home_dir;
+ }
+ return ret;
+}
- struct wsrep_gtid const state_id = { local_uuid, local_seqno };
+static wsrep::gtid wsrep_server_initial_position()
+{
+ wsrep::gtid ret;
+ WSREP_DEBUG("Server initial position: %s", wsrep_start_position);
+ std::istringstream is(wsrep_start_position);
+ is >> ret;
+ return ret;
+}
- wsrep_args.data_dir = wsrep_data_home_dir;
- wsrep_args.node_name = (wsrep_node_name) ? wsrep_node_name : "";
- wsrep_args.node_address = node_addr;
- wsrep_args.node_incoming = inc_addr;
- wsrep_args.options = (wsrep_provider_options) ?
- wsrep_provider_options : "";
- wsrep_args.proto_ver = wsrep_max_protocol_version;
+/*
+ Intitialize provider specific status variables
+ */
+static void wsrep_init_provider_status_variables()
+{
+ const wsrep::provider& provider=
+ Wsrep_server_state::instance().provider();
+ strncpy(provider_name,
+ provider.name().c_str(), sizeof(provider_name) - 1);
+ strncpy(provider_version,
+ provider.version().c_str(), sizeof(provider_version) - 1);
+ strncpy(provider_vendor,
+ provider.vendor().c_str(), sizeof(provider_vendor) - 1);
+}
+
+int wsrep_init_server()
+{
+ wsrep::log::logger_fn(wsrep_log_cb);
+ try
+ {
+ std::string server_name;
+ std::string server_id;
+ std::string node_address;
+ std::string incoming_address;
+ std::string working_dir;
+ wsrep::gtid initial_position;
+
+ server_name= wsrep_server_name();
+ server_id= wsrep_server_id();
+ node_address= wsrep_server_node_address();
+ incoming_address= wsrep_server_incoming_address();
+ working_dir= wsrep_server_working_dir();
+ initial_position= wsrep_server_initial_position();
+
+ Wsrep_server_state::init_once(server_name,
+ incoming_address,
+ node_address,
+ working_dir,
+ initial_position,
+ wsrep_max_protocol_version);
+ }
+ catch (const wsrep::runtime_error& e)
+ {
+ WSREP_ERROR("Failed to init wsrep server %s", e.what());
+ return 1;
+ }
+ catch (const std::exception& e)
+ {
+ WSREP_ERROR("Failed to init wsrep server %s", e.what());
+ }
+ return 0;
+}
+
+void wsrep_init_globals()
+{
+ wsrep_init_sidno(Wsrep_server_state::instance().connected_gtid().id());
+ wsrep_init_schema();
+ if (WSREP_ON)
+ {
+ Wsrep_server_state::instance().initialized();
+ }
+}
- wsrep_args.state_id = &state_id;
+void wsrep_deinit_server()
+{
+ wsrep_deinit_schema();
+ Wsrep_server_state::destroy();
+}
+
+int wsrep_init()
+{
+ assert(wsrep_provider);
+
+ wsrep_init_position();
+ wsrep_sst_auth_init();
- wsrep_args.logger_cb = wsrep_log_cb;
- wsrep_args.view_handler_cb = wsrep_view_handler_cb;
- wsrep_args.apply_cb = wsrep_apply_cb;
- wsrep_args.commit_cb = wsrep_commit_cb;
- wsrep_args.unordered_cb = wsrep_unordered_cb;
- wsrep_args.sst_donate_cb = wsrep_sst_donate_cb;
- wsrep_args.synced_cb = wsrep_synced_cb;
+ if (strlen(wsrep_provider)== 0 ||
+ !strcmp(wsrep_provider, WSREP_NONE))
+ {
+ // enable normal operation in case no provider is specified
+ global_system_variables.wsrep_on= 0;
+ int err= Wsrep_server_state::instance().load_provider(wsrep_provider, wsrep_provider_options ? wsrep_provider_options : "");
+ if (err)
+ {
+ DBUG_PRINT("wsrep",("wsrep::init() failed: %d", err));
+ WSREP_ERROR("wsrep::init() failed: %d, must shutdown", err);
+ }
+ else
+ {
+ wsrep_init_provider_status_variables();
+ }
+ return err;
+ }
- rcode = wsrep->init(wsrep, &wsrep_args);
+ global_system_variables.wsrep_on= 1;
- if (rcode)
+ if (wsrep_gtid_mode && opt_bin_log && !opt_log_slave_updates)
{
- DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode));
- WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode);
- wsrep->free(wsrep);
- free(wsrep);
- wsrep = NULL;
- } else {
- wsrep_inited= 1;
+ WSREP_ERROR("Option --log-slave-updates is required if "
+ "binlog is enabled, GTID mode is on and wsrep provider "
+ "is specified");
+ return 1;
}
- return rcode;
-}
+ if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0)
+ wsrep_data_home_dir= mysql_real_data_home;
+
+ if (Wsrep_server_state::instance().load_provider(wsrep_provider,
+ wsrep_provider_options))
+ {
+ WSREP_ERROR("Failed to load provider");
+ return 1;
+ }
+ if (!wsrep_provider_is_SR_capable() &&
+ global_system_variables.wsrep_trx_fragment_size > 0)
+ {
+ WSREP_ERROR("The WSREP provider (%s) does not support streaming "
+ "replication but wsrep_trx_fragment_size is set to a "
+ "value other than 0 (%llu). Cannot continue. Either set "
+ "wsrep_trx_fragment_size to 0 or use wsrep_provider that "
+ "supports streaming replication.",
+ wsrep_provider, global_system_variables.wsrep_trx_fragment_size);
+ Wsrep_server_state::instance().unload_provider();
+ return 1;
+ }
+ wsrep_inited= 1;
+
+ wsrep_init_provider_status_variables();
+ wsrep_capabilities_export(Wsrep_server_state::instance().provider().capabilities(),
+ &wsrep_provider_capabilities);
+
+ WSREP_DEBUG("SR storage init for: %s",
+ (wsrep_SR_store_type == WSREP_SR_STORE_TABLE) ? "table" : "void");
+
+ return 0;
+}
/* Initialize wsrep thread LOCKs and CONDs */
void wsrep_thr_init()
{
DBUG_ENTER("wsrep_thr_init");
- wsrep_config_state = new wsp::Config_state;
+ wsrep_config_state= new wsp::Config_state;
#ifdef HAVE_PSI_INTERFACE
mysql_mutex_register("sql", wsrep_mutexes, array_elements(wsrep_mutexes));
mysql_cond_register("sql", wsrep_conds, array_elements(wsrep_conds));
@@ -801,31 +753,30 @@ void wsrep_thr_init()
mysql_cond_init(key_COND_wsrep_sst, &COND_wsrep_sst, NULL);
mysql_mutex_init(key_LOCK_wsrep_sst_init, &LOCK_wsrep_sst_init, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_wsrep_sst_init, &COND_wsrep_sst_init, NULL);
- mysql_mutex_init(key_LOCK_wsrep_rollback, &LOCK_wsrep_rollback, MY_MUTEX_INIT_FAST);
- mysql_cond_init(key_COND_wsrep_rollback, &COND_wsrep_rollback, NULL);
mysql_mutex_init(key_LOCK_wsrep_replaying, &LOCK_wsrep_replaying, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_wsrep_replaying, &COND_wsrep_replaying, NULL);
mysql_mutex_init(key_LOCK_wsrep_slave_threads, &LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_wsrep_desync, &LOCK_wsrep_desync, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_wsrep_config_state, &LOCK_wsrep_config_state, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(key_LOCK_wsrep_SR_pool,
+ &LOCK_wsrep_SR_pool, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(key_LOCK_wsrep_SR_store,
+ &LOCK_wsrep_SR_store, MY_MUTEX_INIT_FAST);
DBUG_VOID_RETURN;
}
-void wsrep_init_startup (bool first)
+void wsrep_init_startup (bool sst_first)
{
if (wsrep_init()) unireg_abort(1);
- wsrep_thr_lock_init(
- (wsrep_thd_is_brute_force_fun)wsrep_thd_is_BF,
- (wsrep_abort_thd_fun)wsrep_abort_thd,
- wsrep_debug, wsrep_convert_LOCK_to_trx,
- (wsrep_on_fun)wsrep_on);
+ wsrep_thr_lock_init(wsrep_thd_is_BF, wsrep_thd_bf_abort,
+ wsrep_debug, wsrep_convert_LOCK_to_trx, wsrep_on);
/*
Pre-initialize global_system_variables.table_plugin with a dummy engine
(placeholder) required during the initialization of wsrep threads (THDs).
(see: plugin_thdvar_init())
- Note: This only needs to be done for rsync & xtrabackup based SST methods.
+ Note: This only needs to be done for rsync & mariabackup based SST methods.
In case of mysqldump SST method, the wsrep threads are created after the
server plugins & global system variables are initialized.
*/
@@ -838,28 +789,54 @@ void wsrep_init_startup (bool first)
/* Skip replication start if no cluster address */
if (!wsrep_cluster_address || wsrep_cluster_address[0] == 0) return;
- if (first) wsrep_sst_grab(); // do it so we can wait for SST below
-
+ /*
+ Read value of wsrep_new_cluster before wsrep_start_replication(),
+ the value is reset to FALSE inside wsrep_start_replication.
+ */
if (!wsrep_start_replication()) unireg_abort(1);
wsrep_create_rollbacker();
wsrep_create_appliers(1);
- if (first && !wsrep_sst_wait()) unireg_abort(1);// wait until SST is completed
+ Wsrep_server_state& server_state= Wsrep_server_state::instance();
+ /*
+ If the SST happens before server initialization, wait until the server
+ state reaches initializing. This indicates that
+ either SST was not necessary or SST has been delivered.
+
+ With mysqldump SST (!sst_first) wait until the server reaches
+ joiner state and procedd to accepting connections.
+ */
+ if (sst_first)
+ {
+ server_state.wait_until_state(Wsrep_server_state::s_initializing);
+ }
+ else
+ {
+ server_state.wait_until_state(Wsrep_server_state::s_joiner);
+ }
}
void wsrep_deinit(bool free_options)
{
DBUG_ASSERT(wsrep_inited == 1);
- wsrep_unload(wsrep);
- wsrep= 0;
+ WSREP_DEBUG("wsrep_deinit");
+
+ Wsrep_server_state::instance().unload_provider();
provider_name[0]= '\0';
provider_version[0]= '\0';
provider_vendor[0]= '\0';
wsrep_inited= 0;
+ if (wsrep_provider_capabilities != NULL)
+ {
+ char* p= wsrep_provider_capabilities;
+ wsrep_provider_capabilities= NULL;
+ free(p);
+ }
+
if (free_options)
{
wsrep_sst_auth_free();
@@ -871,28 +848,37 @@ void wsrep_thr_deinit()
{
if (!wsrep_config_state)
return; // Never initialized
+ WSREP_DEBUG("wsrep_thr_deinit");
mysql_mutex_destroy(&LOCK_wsrep_ready);
mysql_cond_destroy(&COND_wsrep_ready);
mysql_mutex_destroy(&LOCK_wsrep_sst);
mysql_cond_destroy(&COND_wsrep_sst);
mysql_mutex_destroy(&LOCK_wsrep_sst_init);
mysql_cond_destroy(&COND_wsrep_sst_init);
- mysql_mutex_destroy(&LOCK_wsrep_rollback);
- mysql_cond_destroy(&COND_wsrep_rollback);
mysql_mutex_destroy(&LOCK_wsrep_replaying);
mysql_cond_destroy(&COND_wsrep_replaying);
mysql_mutex_destroy(&LOCK_wsrep_slave_threads);
mysql_mutex_destroy(&LOCK_wsrep_desync);
mysql_mutex_destroy(&LOCK_wsrep_config_state);
+ mysql_mutex_destroy(&LOCK_wsrep_SR_pool);
+ mysql_mutex_destroy(&LOCK_wsrep_SR_store);
+
delete wsrep_config_state;
wsrep_config_state= 0; // Safety
+
+ if (wsrep_cluster_capabilities != NULL)
+ {
+ char* p= wsrep_cluster_capabilities;
+ wsrep_cluster_capabilities= NULL;
+ free(p);
+ }
}
void wsrep_recover()
{
char uuid_str[40];
- if (!memcmp(&local_uuid, &WSREP_UUID_UNDEFINED, sizeof(wsrep_uuid_t)) &&
+ if (wsrep_uuid_compare(&local_uuid, &WSREP_UUID_UNDEFINED) == 0 &&
local_seqno == -2)
{
wsrep_uuid_print(&local_uuid, uuid_str, sizeof(uuid_str));
@@ -900,43 +886,60 @@ void wsrep_recover()
uuid_str, (long long)local_seqno);
return;
}
- wsrep_uuid_t uuid;
- wsrep_seqno_t seqno;
- wsrep_get_SE_checkpoint(uuid, seqno);
- wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str));
- WSREP_INFO("Recovered position: %s:%lld", uuid_str, (long long)seqno);
+ wsrep::gtid gtid= wsrep_get_SE_checkpoint();
+ std::ostringstream oss;
+ oss << gtid;
+ WSREP_INFO("Recovered position: %s", oss.str().c_str());
}
void wsrep_stop_replication(THD *thd)
{
WSREP_INFO("Stop replication");
- if (!wsrep)
+ if (Wsrep_server_state::instance().state() !=
+ Wsrep_server_state::s_disconnected)
{
- WSREP_INFO("Provider was not loaded, in stop replication");
- return;
+ WSREP_DEBUG("Disconnect provider");
+ Wsrep_server_state::instance().disconnect();
+ Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected);
}
- /* disconnect from group first to get wsrep_ready == FALSE */
- WSREP_DEBUG("Provider disconnect");
- wsrep->disconnect(wsrep);
+ /* my connection, should not terminate with wsrep_close_client_connection(),
+ make transaction to rollback
+ */
+ if (thd && !thd->wsrep_applier) trans_rollback(thd);
+ wsrep_close_client_connections(TRUE, thd);
+
+ /* wait until appliers have stopped */
+ wsrep_wait_appliers_close(thd);
+
+ node_uuid= WSREP_UUID_UNDEFINED;
+}
- wsrep_connected= FALSE;
+void wsrep_shutdown_replication()
+{
+ WSREP_INFO("Shutdown replication");
+ if (Wsrep_server_state::instance().state() != wsrep::server_state::s_disconnected)
+ {
+ WSREP_DEBUG("Disconnect provider");
+ Wsrep_server_state::instance().disconnect();
+ Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected);
+ }
wsrep_close_client_connections(TRUE);
/* wait until appliers have stopped */
- wsrep_wait_appliers_close(thd);
+ wsrep_wait_appliers_close(NULL);
+ node_uuid= WSREP_UUID_UNDEFINED;
- return;
+ /* Undocking the thread specific data. */
+ my_pthread_setspecific_ptr(THR_THD, NULL);
}
bool wsrep_start_replication()
{
- wsrep_status_t rcode;
-
- /* wsrep provider must be loaded. */
- DBUG_ASSERT(wsrep);
+ int rcode;
+ WSREP_DEBUG("wsrep_start_replication");
/*
if provider is trivial, don't even try to connect,
@@ -945,34 +948,27 @@ bool wsrep_start_replication()
if (!WSREP_PROVIDER_EXISTS)
{
// enable normal operation in case no provider is specified
- wsrep_ready_set(TRUE);
return true;
}
if (!wsrep_cluster_address || wsrep_cluster_address[0]== 0)
{
// if provider is non-trivial, but no address is specified, wait for address
- wsrep_ready_set(FALSE);
return true;
}
- bool const bootstrap= wsrep_new_cluster;
+ bool const bootstrap(TRUE == wsrep_new_cluster);
+ wsrep_new_cluster= FALSE;
WSREP_INFO("Start replication");
- if (wsrep_new_cluster)
+ if ((rcode= Wsrep_server_state::instance().connect(
+ wsrep_cluster_name,
+ wsrep_cluster_address,
+ wsrep_sst_donor,
+ bootstrap)))
{
- WSREP_INFO("'wsrep-new-cluster' option used, bootstrapping the cluster");
- wsrep_new_cluster= false;
- }
-
- if ((rcode = wsrep->connect(wsrep,
- wsrep_cluster_name,
- wsrep_cluster_address,
- wsrep_sst_donor,
- bootstrap)))
- {
- DBUG_PRINT("wsrep",("wsrep->connect(%s) failed: %d",
+ DBUG_PRINT("wsrep",("wsrep_ptr->connect(%s) failed: %d",
wsrep_cluster_address, rcode));
WSREP_ERROR("wsrep::connect(%s) failed: %d",
wsrep_cluster_address, rcode);
@@ -980,15 +976,12 @@ bool wsrep_start_replication()
}
else
{
- wsrep_connected= TRUE;
-
- char* opts= wsrep->options_get(wsrep);
- if (opts)
+ try
{
- wsrep_provider_options_init(opts);
- free(opts);
+ std::string opts= Wsrep_server_state::instance().provider().options();
+ wsrep_provider_options_init(opts.c_str());
}
- else
+ catch (const wsrep::runtime_error&)
{
WSREP_WARN("Failed to get wsrep options");
}
@@ -999,40 +992,50 @@ bool wsrep_start_replication()
bool wsrep_must_sync_wait (THD* thd, uint mask)
{
- return (thd->variables.wsrep_sync_wait & mask) &&
+ bool ret;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ ret= (thd->variables.wsrep_sync_wait & mask) &&
+ thd->wsrep_client_thread &&
thd->variables.wsrep_on &&
!(thd->variables.wsrep_dirty_reads &&
!is_update_query(thd->lex->sql_command)) &&
!thd->in_active_multi_stmt_transaction() &&
- thd->wsrep_conflict_state != REPLAYING &&
- thd->wsrep_sync_wait_gtid.seqno == WSREP_SEQNO_UNDEFINED;
+ thd->wsrep_trx().state() !=
+ wsrep::transaction::s_replaying &&
+ thd->wsrep_cs().sync_wait_gtid().is_undefined();
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ return ret;
}
bool wsrep_sync_wait (THD* thd, uint mask)
{
if (wsrep_must_sync_wait(thd, mask))
{
- WSREP_DEBUG("wsrep_sync_wait: thd->variables.wsrep_sync_wait = %u, mask = %u",
- thd->variables.wsrep_sync_wait, mask);
- // This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0
- // TODO: modify to check if thd has locked any rows.
- wsrep_status_t ret= wsrep->causal_read (wsrep, &thd->wsrep_sync_wait_gtid);
-
- if (unlikely(WSREP_OK != ret))
+ WSREP_DEBUG("wsrep_sync_wait: thd->variables.wsrep_sync_wait= %u, "
+ "mask= %u, thd->variables.wsrep_on= %d",
+ thd->variables.wsrep_sync_wait, mask,
+ thd->variables.wsrep_on);
+ /*
+ This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0
+ TODO: modify to check if thd has locked any rows.
+ */
+ if (thd->wsrep_cs().sync_wait(-1))
{
const char* msg;
int err;
- // Possibly relevant error codes:
- // ER_CHECKREAD, ER_ERROR_ON_READ, ER_INVALID_DEFAULT, ER_EMPTY_QUERY,
- // ER_FUNCTION_NOT_DEFINED, ER_NOT_ALLOWED_COMMAND, ER_NOT_SUPPORTED_YET,
- // ER_FEATURE_DISABLED, ER_QUERY_INTERRUPTED
+ /*
+ Possibly relevant error codes:
+ ER_CHECKREAD, ER_ERROR_ON_READ, ER_INVALID_DEFAULT, ER_EMPTY_QUERY,
+ ER_FUNCTION_NOT_DEFINED, ER_NOT_ALLOWED_COMMAND, ER_NOT_SUPPORTED_YET,
+ ER_FEATURE_DISABLED, ER_QUERY_INTERRUPTED
+ */
- switch (ret)
+ switch (thd->wsrep_cs().current_error())
{
- case WSREP_NOT_IMPLEMENTED:
+ case wsrep::e_not_supported_error:
msg= "synchronous reads by wsrep backend. "
- "Please unset wsrep_causal_reads variable.";
+ "Please unset wsrep_causal_reads variable.";
err= ER_NOT_SUPPORTED_YET;
break;
default:
@@ -1050,6 +1053,27 @@ bool wsrep_sync_wait (THD* thd, uint mask)
return false;
}
+enum wsrep::provider::status
+wsrep_sync_wait_upto (THD* thd,
+ wsrep_gtid_t* upto,
+ int timeout)
+{
+ DBUG_ASSERT(upto);
+ enum wsrep::provider::status ret;
+ if (upto)
+ {
+ wsrep::gtid upto_gtid(wsrep::id(upto->uuid.data, sizeof(upto->uuid.data)),
+ wsrep::seqno(upto->seqno));
+ ret= Wsrep_server_state::instance().wait_for_gtid(upto_gtid, timeout);
+ }
+ else
+ {
+ ret= Wsrep_server_state::instance().causal_read(timeout).second;
+ }
+ WSREP_DEBUG("wsrep_sync_wait_upto: %d", ret);
+ return ret;
+}
+
void wsrep_keys_free(wsrep_key_arr_t* key_arr)
{
for (size_t i= 0; i < key_arr->keys_len; ++i)
@@ -1061,7 +1085,6 @@ void wsrep_keys_free(wsrep_key_arr_t* key_arr)
key_arr->keys_len= 0;
}
-
/*!
* @param db Database string
* @param table Table string
@@ -1073,9 +1096,9 @@ void wsrep_keys_free(wsrep_key_arr_t* key_arr)
*/
static bool wsrep_prepare_key_for_isolation(const char* db,
- const char* table,
- wsrep_buf_t* key,
- size_t* key_len)
+ const char* table,
+ wsrep_buf_t* key,
+ size_t* key_len)
{
if (*key_len < 2) return false;
@@ -1087,11 +1110,11 @@ static bool wsrep_prepare_key_for_isolation(const char* db,
case 1:
case 2:
case 3:
+ case 4:
{
*key_len= 0;
if (db)
{
- // sql_print_information("%s.%s", db, table);
key[*key_len].ptr= db;
key[*key_len].len= strlen(db);
++(*key_len);
@@ -1105,26 +1128,23 @@ static bool wsrep_prepare_key_for_isolation(const char* db,
break;
}
default:
+ assert(0);
+ WSREP_ERROR("Unsupported protocol version: %ld", wsrep_protocol_version);
+ unireg_abort(1);
return false;
}
- return true;
-}
+ return true;
+}
static bool wsrep_prepare_key_for_isolation(const char* db,
const char* table,
wsrep_key_arr_t* ka)
{
wsrep_key_t* tmp;
-
- if (!ka->keys)
- tmp= (wsrep_key_t*)my_malloc((ka->keys_len + 1) * sizeof(wsrep_key_t),
- MYF(0));
- else
- tmp= (wsrep_key_t*)my_realloc(ka->keys,
- (ka->keys_len + 1) * sizeof(wsrep_key_t),
- MYF(0));
-
+ tmp= (wsrep_key_t*)my_realloc(ka->keys,
+ (ka->keys_len + 1) * sizeof(wsrep_key_t),
+ MYF(MY_ALLOW_ZERO_PTR));
if (!tmp)
{
WSREP_ERROR("Can't allocate memory for key_array");
@@ -1150,7 +1170,6 @@ static bool wsrep_prepare_key_for_isolation(const char* db,
return true;
}
-
static bool wsrep_prepare_keys_for_alter_add_fk(const char* child_table_db,
Alter_info* alter_info,
wsrep_key_arr_t* ka)
@@ -1177,7 +1196,6 @@ static bool wsrep_prepare_keys_for_alter_add_fk(const char* child_table_db,
return true;
}
-
static bool wsrep_prepare_keys_for_isolation(THD* thd,
const char* db,
const char* table,
@@ -1205,16 +1223,19 @@ static bool wsrep_prepare_keys_for_isolation(THD* thd,
if (!wsrep_prepare_keys_for_alter_add_fk(table_list->db.str, alter_info, ka))
goto err;
}
-
return false;
err:
- wsrep_keys_free(ka);
- return true;
+ wsrep_keys_free(ka);
+ return true;
}
+/*
+ * Prepare key list from db/table and table_list
+ *
+ * Return zero in case of success, 1 in case of failure.
+ */
-/* Prepare key list from db/table and table_list */
bool wsrep_prepare_keys_for_isolation(THD* thd,
const char* db,
const char* table,
@@ -1224,7 +1245,6 @@ bool wsrep_prepare_keys_for_isolation(THD* thd,
return wsrep_prepare_keys_for_isolation(thd, db, table, table_list, NULL, ka);
}
-
bool wsrep_prepare_key(const uchar* cache_key, size_t cache_key_len,
const uchar* row_id, size_t row_id_len,
wsrep_buf_t* key, size_t* key_len)
@@ -1236,37 +1256,110 @@ bool wsrep_prepare_key(const uchar* cache_key, size_t cache_key_len,
{
case 0:
{
- key[0].ptr = cache_key;
- key[0].len = cache_key_len;
+ key[0].ptr= cache_key;
+ key[0].len= cache_key_len;
- *key_len = 1;
+ *key_len= 1;
break;
}
case 1:
case 2:
case 3:
+ case 4:
{
- key[0].ptr = cache_key;
- key[0].len = strlen( (char*)cache_key );
+ key[0].ptr= cache_key;
+ key[0].len= strlen( (char*)cache_key );
- key[1].ptr = cache_key + strlen( (char*)cache_key ) + 1;
- key[1].len = strlen( (char*)(key[1].ptr) );
+ key[1].ptr= cache_key + strlen( (char*)cache_key ) + 1;
+ key[1].len= strlen( (char*)(key[1].ptr) );
- *key_len = 2;
+ *key_len= 2;
break;
}
default:
return false;
}
- key[*key_len].ptr = row_id;
- key[*key_len].len = row_id_len;
+ key[*key_len].ptr= row_id;
+ key[*key_len].len= row_id_len;
++(*key_len);
return true;
}
+bool wsrep_prepare_key_for_innodb(THD* thd,
+ const uchar* cache_key,
+ size_t cache_key_len,
+ const uchar* row_id,
+ size_t row_id_len,
+ wsrep_buf_t* key,
+ size_t* key_len)
+{
+
+ return wsrep_prepare_key(cache_key, cache_key_len, row_id, row_id_len, key, key_len);
+}
+wsrep::key wsrep_prepare_key_for_toi(const char* db, const char* table,
+ enum wsrep::key::type type)
+{
+ wsrep::key ret(type);
+ DBUG_ASSERT(db);
+ ret.append_key_part(db, strlen(db));
+ if (table) ret.append_key_part(table, strlen(table));
+ return ret;
+}
+
+wsrep::key_array
+wsrep_prepare_keys_for_alter_add_fk(const char* child_table_db,
+ Alter_info* alter_info)
+
+{
+ wsrep::key_array ret;
+ Key *key;
+ List_iterator<Key> key_iterator(alter_info->key_list);
+ while ((key= key_iterator++))
+ {
+ if (key->type == Key::FOREIGN_KEY)
+ {
+ Foreign_key *fk_key= (Foreign_key *)key;
+ const char *db_name= fk_key->ref_db.str;
+ const char *table_name= fk_key->ref_table.str;
+ if (!db_name)
+ {
+ db_name= child_table_db;
+ }
+ ret.push_back(wsrep_prepare_key_for_toi(db_name, table_name,
+ wsrep::key::exclusive));
+ }
+ }
+ return ret;
+}
+
+wsrep::key_array wsrep_prepare_keys_for_toi(const char* db,
+ const char* table,
+ const TABLE_LIST* table_list,
+ Alter_info* alter_info)
+{
+ wsrep::key_array ret;
+ if (db || table)
+ {
+ ret.push_back(wsrep_prepare_key_for_toi(db, table, wsrep::key::exclusive));
+ }
+ for (const TABLE_LIST* table= table_list; table; table= table->next_global)
+ {
+ ret.push_back(wsrep_prepare_key_for_toi(table->db.str, table->table_name.str,
+ wsrep::key::exclusive));
+ }
+ if (alter_info && (alter_info->flags & ALTER_ADD_FOREIGN_KEY))
+ {
+ wsrep::key_array fk(wsrep_prepare_keys_for_alter_add_fk(table_list->db.str, alter_info));
+ if (!fk.empty())
+ {
+ ret.insert(ret.end(), fk.begin(), fk.end());
+ }
+ }
+ return ret;
+}
/*
* Construct Query_log_Event from thd query and serialize it
* into buffer.
@@ -1277,7 +1370,7 @@ int wsrep_to_buf_helper(
THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len)
{
IO_CACHE tmp_io_cache;
- Log_event_writer writer(&tmp_io_cache,0);
+ Log_event_writer writer(&tmp_io_cache, 0);
if (open_cached_file(&tmp_io_cache, mysql_tmpdir, TEMP_PREFIX,
65536, MYF(MY_WME)))
return 1;
@@ -1365,7 +1458,7 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
LEX *lex= thd->lex;
SELECT_LEX *select_lex= lex->first_select_lex();
TABLE_LIST *first_table= select_lex->table_list.first;
- TABLE_LIST *views = first_table;
+ TABLE_LIST *views= first_table;
LEX_USER *definer;
String buff;
const LEX_CSTRING command[3]=
@@ -1390,16 +1483,16 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
if (definer)
{
- views->definer.user = definer->user;
- views->definer.host = definer->host;
+ views->definer.user= definer->user;
+ views->definer.host= definer->host;
} else {
WSREP_ERROR("Failed to get DEFINER for VIEW.");
return 1;
}
- views->algorithm = lex->create_view->algorithm;
- views->view_suid = lex->create_view->suid;
- views->with_check = lex->create_view->check;
+ views->algorithm = lex->create_view->algorithm;
+ views->view_suid = lex->create_view->suid;
+ views->with_check = lex->create_view->check;
view_store_options(thd, views, &buff);
buff.append(STRING_WITH_LEN("VIEW "));
@@ -1425,12 +1518,8 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
buff.append(')');
}
buff.append(STRING_WITH_LEN(" AS "));
- //buff.append(views->source.str, views->source.length);
buff.append(thd->lex->create_view->select.str,
thd->lex->create_view->select.length);
- //int errcode= query_error_code(thd, TRUE);
- //if (thd->binlog_query(THD::STMT_QUERY_TYPE,
- // buff.ptr(), buff.length(), FALSE, FALSE, FALSE, errcod
return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len);
}
@@ -1496,8 +1585,7 @@ static int wsrep_drop_table_query(THD* thd, uchar** buf, size_t* buf_len)
/* Forward declarations. */
-static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len);
-static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
+int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
/*
Decide if statement should run in TOI.
@@ -1577,6 +1665,7 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
}
}
+#if UNUSED /* 323f269d4099 (Jan Lindström 2018-07-19) */
static const char* wsrep_get_query_or_msg(const THD* thd)
{
switch(thd->lex->sql_command)
@@ -1589,58 +1678,70 @@ static const char* wsrep_get_query_or_msg(const THD* thd)
return "REVOKE";
case SQLCOM_SET_OPTION:
if (thd->lex->definer)
- return "SET PASSWORD";
+ return "SET PASSWORD";
/* fallthrough */
default:
return thd->query();
}
}
+#endif //UNUSED
-/*
- returns:
- 0: statement was replicated as TOI
- 1: TOI replication was skipped
- -1: TOI replication failed
- */
-static int wsrep_TOI_begin(THD *thd, const char *db_, const char *table_,
- const TABLE_LIST* table_list,
- Alter_info* alter_info)
+static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
{
- wsrep_status_t ret(WSREP_WARNING);
- uchar* buf(0);
- size_t buf_len(0);
- int buf_err;
- int rc= 0;
+ String log_query;
+ sp_head *sp= thd->lex->sphead;
+ sql_mode_t saved_mode= thd->variables.sql_mode;
+ String retstr(64);
+ LEX_CSTRING returns= empty_clex_str;
+ retstr.set_charset(system_charset_info);
+
+ log_query.set_charset(system_charset_info);
- if (wsrep_can_run_in_toi(thd, db_, table_, table_list) == false)
+ if (sp->m_handler->type() == TYPE_ENUM_FUNCTION)
{
- WSREP_DEBUG("No TOI for %s", WSREP_QUERY(thd));
+ sp_returns_type(thd, retstr, sp);
+ returns= retstr.lex_cstring();
+ }
+ if (sp->m_handler->
+ show_create_sp(thd, &log_query,
+ sp->m_explicit_name ? sp->m_db : null_clex_str,
+ sp->m_name, sp->m_params, returns,
+ sp->m_body, sp->chistics(),
+ thd->lex->definer[0],
+ thd->lex->create_info,
+ saved_mode))
+ {
+ WSREP_WARN("SP create string failed: schema: %s, query: %s",
+ thd->get_db(), thd->query());
return 1;
}
- WSREP_DEBUG("TO BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
- thd->wsrep_exec_mode, wsrep_get_query_or_msg(thd));
+ return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len);
+}
+static int wsrep_TOI_event_buf(THD* thd, uchar** buf, size_t* buf_len)
+{
+ int err;
switch (thd->lex->sql_command)
{
case SQLCOM_CREATE_VIEW:
- buf_err= create_view_query(thd, &buf, &buf_len);
+ err= create_view_query(thd, buf, buf_len);
break;
case SQLCOM_CREATE_PROCEDURE:
case SQLCOM_CREATE_SPFUNCTION:
- buf_err= wsrep_create_sp(thd, &buf, &buf_len);
+ err= wsrep_create_sp(thd, buf, buf_len);
break;
case SQLCOM_CREATE_TRIGGER:
- buf_err= wsrep_create_trigger_query(thd, &buf, &buf_len);
+ err= wsrep_create_trigger_query(thd, buf, buf_len);
break;
case SQLCOM_CREATE_EVENT:
- buf_err= wsrep_create_event_query(thd, &buf, &buf_len);
+ err= wsrep_create_event_query(thd, buf, buf_len);
break;
case SQLCOM_ALTER_EVENT:
- buf_err= wsrep_alter_event_query(thd, &buf, &buf_len);
+ err= wsrep_alter_event_query(thd, buf, buf_len);
break;
case SQLCOM_DROP_TABLE:
- buf_err= wsrep_drop_table_query(thd, &buf, &buf_len);
+ err= wsrep_drop_table_query(thd, buf, buf_len);
break;
case SQLCOM_CREATE_ROLE:
if (sp_process_definer(thd))
@@ -1649,169 +1750,212 @@ static int wsrep_TOI_begin(THD *thd, const char *db_, const char *table_,
}
/* fallthrough */
default:
- buf_err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(),
- &buf, &buf_len);
+ err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(), buf,
+ buf_len);
break;
}
- wsrep_key_arr_t key_arr= {0, 0};
- struct wsrep_buf buff = { buf, buf_len };
- if (!buf_err &&
- !wsrep_prepare_keys_for_isolation(thd, db_, table_,
- table_list, alter_info, &key_arr) &&
- key_arr.keys_len > 0 &&
- WSREP_OK == (ret = wsrep->to_execute_start(wsrep, thd->thread_id,
- key_arr.keys, key_arr.keys_len,
- &buff, 1,
- &thd->wsrep_trx_meta)))
- {
- thd->wsrep_exec_mode= TOTAL_ORDER;
- wsrep_to_isolation++;
- wsrep_keys_free(&key_arr);
- WSREP_DEBUG("TO BEGIN: %lld, %d",(long long)wsrep_thd_trx_seqno(thd),
- thd->wsrep_exec_mode);
- }
- else if (key_arr.keys_len > 0) {
- /* jump to error handler in mysql_execute_command() */
- WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. Check wsrep "
- "connection state and retry the query.",
- ret,
- thd->get_db(),
- (thd->query()) ? thd->query() : "void");
- my_message(ER_LOCK_DEADLOCK, "WSREP replication failed. Check "
- "your wsrep connection state and retry the query.", MYF(0));
- wsrep_keys_free(&key_arr);
- rc= -1;
- }
- else {
- /* non replicated DDL, affecting temporary tables only */
- WSREP_DEBUG("TO isolation skipped for: %d, sql: %s."
- "Only temporary tables affected.",
- ret, (thd->query()) ? thd->query() : "void");
- rc= 1;
+ return err;
+}
+
+static void wsrep_TOI_begin_failed(THD* thd, const wsrep_buf_t* /* const err */)
+{
+ if (wsrep_thd_trx_seqno(thd) > 0)
+ {
+ /* GTID was granted and TO acquired - need to log event and release TO */
+ if (wsrep_emulate_bin_log) wsrep_thd_binlog_trx_reset(thd);
+ if (wsrep_write_dummy_event(thd, "TOI begin failed")) { goto fail; }
+ wsrep::client_state& cs(thd->wsrep_cs());
+ int const ret= cs.leave_toi();
+ if (ret)
+ {
+ WSREP_ERROR("Leaving critical section for failed TOI failed: thd: %lld, "
+ "schema: %s, SQL: %s, rcode: %d wsrep_error: %s",
+ (long long)thd->real_id, thd->db.str,
+ thd->query(), ret, wsrep::to_c_string(cs.current_error()));
+ goto fail;
+ }
}
- if (buf) my_free(buf);
- return rc;
+ return;
+fail:
+ WSREP_ERROR("Failed to release TOI resources. Need to abort.");
+ unireg_abort(1);
}
-static void wsrep_TOI_end(THD *thd) {
- wsrep_status_t ret;
- wsrep_to_isolation--;
- WSREP_DEBUG("TO END: %lld, %d: %s", (long long)wsrep_thd_trx_seqno(thd),
- thd->wsrep_exec_mode, wsrep_get_query_or_msg(thd));
+/*
+ returns:
+ 0: statement was replicated as TOI
+ 1: TOI replication was skipped
+ -1: TOI replication failed
+ */
+static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
+ const TABLE_LIST* table_list,
+ Alter_info* alter_info)
+{
+ DBUG_ASSERT(thd->variables.wsrep_OSU_method == WSREP_OSU_TOI);
- wsrep_set_SE_checkpoint(thd->wsrep_trx_meta.gtid.uuid,
- thd->wsrep_trx_meta.gtid.seqno);
- WSREP_DEBUG("TO END: %lld, update seqno",
- (long long)wsrep_thd_trx_seqno(thd));
-
- if (WSREP_OK == (ret = wsrep->to_execute_end(wsrep, thd->thread_id))) {
- WSREP_DEBUG("TO END: %lld", (long long)wsrep_thd_trx_seqno(thd));
+ WSREP_DEBUG("TOI Begin");
+ if (wsrep_can_run_in_toi(thd, db, table, table_list) == false)
+ {
+ WSREP_DEBUG("No TOI for %s", WSREP_QUERY(thd));
+ return 1;
}
- else {
- WSREP_WARN("TO isolation end failed for: %d, schema: %s, sql: %s",
- ret,
- thd->get_db(),
- (thd->query()) ? thd->query() : "void");
+
+ uchar* buf= 0;
+ size_t buf_len(0);
+ int buf_err;
+ int rc;
+
+ buf_err= wsrep_TOI_event_buf(thd, &buf, &buf_len);
+ if (buf_err) {
+ WSREP_ERROR("Failed to create TOI event buf: %d", buf_err);
+ my_message(ER_UNKNOWN_ERROR,
+ "WSREP replication failed to prepare TOI event buffer. "
+ "Check your query.",
+ MYF(0));
+ return -1;
}
-}
+ struct wsrep_buf buff= { buf, buf_len };
-static int wsrep_RSU_begin(THD *thd, const char *db_, const char *table_)
-{
- wsrep_status_t ret(WSREP_WARNING);
- WSREP_DEBUG("RSU BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
- thd->wsrep_exec_mode, thd->query() );
+ wsrep::key_array key_array=
+ wsrep_prepare_keys_for_toi(db, table, table_list, alter_info);
- ret = wsrep->desync(wsrep);
- if (ret != WSREP_OK)
+ if (thd->has_read_only_protection())
{
- WSREP_WARN("RSU desync failed %d for schema: %s, query: %s",
- ret, thd->get_db(), thd->query());
- my_error(ER_LOCK_DEADLOCK, MYF(0));
- return(ret);
+ /* non replicated DDL, affecting temporary tables only */
+ WSREP_DEBUG("TO isolation skipped, sql: %s."
+ "Only temporary tables affected.",
+ WSREP_QUERY(thd));
+ if (buf) my_free(buf);
+ return -1;
}
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- wsrep_replaying++;
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
+ thd_proc_info(thd, "acquiring total order isolation");
- if (wsrep_wait_committing_connections_close(5000))
+ wsrep::client_state& cs(thd->wsrep_cs());
+ int ret= cs.enter_toi(key_array,
+ wsrep::const_buffer(buff.ptr, buff.len),
+ wsrep::provider::flag::start_transaction |
+ wsrep::provider::flag::commit);
+
+ if (ret)
{
- /* no can do, bail out from DDL */
- WSREP_WARN("RSU failed due to pending transactions, schema: %s, query %s",
- thd->get_db(), thd->query());
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- wsrep_replaying--;
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
+ DBUG_ASSERT(cs.current_error());
+ WSREP_DEBUG("to_execute_start() failed for %llu: %s, seqno: %lld",
+ thd->thread_id, WSREP_QUERY(thd),
+ (long long)wsrep_thd_trx_seqno(thd));
- ret = wsrep->resync(wsrep);
- if (ret != WSREP_OK)
+ /* jump to error handler in mysql_execute_command() */
+ switch (cs.current_error())
{
- WSREP_WARN("resync failed %d for schema: %s, query: %s",
- ret, thd->get_db(), thd->query());
+ case wsrep::e_size_exceeded_error:
+ WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
+ "Maximum size exceeded.",
+ ret,
+ (thd->db.str ? thd->db.str : "(null)"),
+ WSREP_QUERY(thd));
+ my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED);
+ break;
+ default:
+ WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
+ "Check wsrep connection state and retry the query.",
+ ret,
+ (thd->db.str ? thd->db.str : "(null)"),
+ WSREP_QUERY(thd));
+ if (!thd->is_error())
+ {
+ my_error(ER_LOCK_DEADLOCK, MYF(0), "WSREP replication failed. Check "
+ "your wsrep connection state and retry the query.");
+ }
}
-
- my_error(ER_LOCK_DEADLOCK, MYF(0));
- return(1);
+ rc= -1;
}
-
- wsrep_seqno_t seqno = wsrep->pause(wsrep);
- if (seqno == WSREP_SEQNO_UNDEFINED)
- {
- WSREP_WARN("pause failed %lld for schema: %s, query: %s", (long long)seqno,
- thd->get_db(), thd->query());
- return(1);
+ else {
+ ++wsrep_to_isolation;
+ rc= 0;
}
- WSREP_DEBUG("paused at %lld", (long long)seqno);
- thd->variables.wsrep_on = 0;
- return 0;
-}
-static void wsrep_RSU_end(THD *thd)
-{
- wsrep_status_t ret(WSREP_WARNING);
- WSREP_DEBUG("RSU END: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
- thd->wsrep_exec_mode, thd->query() );
+ if (buf) my_free(buf);
+ if (rc) wsrep_TOI_begin_failed(thd, NULL);
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- wsrep_replaying--;
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
+ return rc;
+}
- ret = wsrep->resume(wsrep);
- if (ret != WSREP_OK)
+static void wsrep_TOI_end(THD *thd) {
+ int ret;
+ wsrep_to_isolation--;
+ wsrep::client_state& client_state(thd->wsrep_cs());
+ DBUG_ASSERT(wsrep_thd_is_local_toi(thd));
+ WSREP_DEBUG("TO END: %lld: %s", client_state.toi_meta().seqno().get(),
+ WSREP_QUERY(thd));
+
+ if (wsrep_thd_is_local_toi(thd))
{
- WSREP_WARN("resume failed %d for schema: %s, query: %s", ret,
- thd->get_db(), thd->query());
+ wsrep_set_SE_checkpoint(client_state.toi_meta().gtid());
+ if (thd->is_error() && !wsrep_must_ignore_error(thd))
+ {
+ wsrep_apply_error err;
+ err.store(thd);
+ client_state.leave_toi();
+ }
+ else
+ {
+ ret= client_state.leave_toi();
+ }
+
+ if (ret == 0)
+ {
+ WSREP_DEBUG("TO END: %lld", client_state.toi_meta().seqno().get());
+ }
+ else
+ {
+ WSREP_WARN("TO isolation end failed for: %d, schema: %s, sql: %s",
+ ret, (thd->db.str ? thd->db.str : "(null)"), WSREP_QUERY(thd));
+ }
}
+}
- ret = wsrep->resync(wsrep);
- if (ret != WSREP_OK)
+static int wsrep_RSU_begin(THD *thd, const char *db_, const char *table_)
+{
+ WSREP_DEBUG("RSU BEGIN: %lld, : %s", wsrep_thd_trx_seqno(thd),
+ WSREP_QUERY(thd));
+ if (thd->wsrep_cs().begin_rsu(5000))
{
- WSREP_WARN("resync failed %d for schema: %s, query: %s", ret,
- thd->get_db(), thd->query());
- return;
+ WSREP_WARN("RSU begin failed");
+ }
+ else
+ {
+ thd->variables.wsrep_on= 0;
}
+ return 0;
+}
- thd->variables.wsrep_on = 1;
+static void wsrep_RSU_end(THD *thd)
+{
+ WSREP_DEBUG("RSU END: %lld : %s", wsrep_thd_trx_seqno(thd),
+ WSREP_QUERY(thd));
+ if (thd->wsrep_cs().end_rsu())
+ {
+ WSREP_WARN("Failed to end RSU, server may need to be restarted");
+ }
+ thd->variables.wsrep_on= 1;
}
int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
const TABLE_LIST* table_list,
Alter_info* alter_info)
{
- int ret= 0;
-
/*
No isolation for applier or replaying threads.
*/
- if (thd->wsrep_exec_mode == REPL_RECV)
- return 0;
+ if (!wsrep_thd_is_local(thd)) return 0;
+ int ret= 0;
mysql_mutex_lock(&thd->LOCK_thd_data);
- if (thd->wsrep_conflict_state == MUST_ABORT)
+ if (thd->wsrep_trx().state() == wsrep::transaction::s_must_abort)
{
WSREP_INFO("thread: %lld schema: %s query: %s has been aborted due to multi-master conflict",
(longlong) thd->thread_id, thd->get_db(), thd->query());
@@ -1820,20 +1964,20 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
}
mysql_mutex_unlock(&thd->LOCK_thd_data);
- DBUG_ASSERT(thd->wsrep_exec_mode == LOCAL_STATE);
- DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno == WSREP_SEQNO_UNDEFINED);
+ DBUG_ASSERT(wsrep_thd_is_local(thd));
+ DBUG_ASSERT(thd->wsrep_trx().ws_meta().seqno().is_undefined());
- if (thd->global_read_lock.can_acquire_protection())
+ if (thd->global_read_lock.is_acquired())
{
- WSREP_DEBUG("Aborting TOI: Global Read-Lock (FTWRL) in place: %s %lld",
- thd->query(), (longlong) thd->thread_id);
+ WSREP_DEBUG("Aborting TOI: Global Read-Lock (FTWRL) in place: %s %llu",
+ WSREP_QUERY(thd), thd->thread_id);
return -1;
}
if (wsrep_debug && thd->mdl_context.has_locks())
{
- WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lld",
- thd->query(), (longlong) thd->thread_id);
+ WSREP_DEBUG("thread holds MDL locks at TI begin: %s %llu",
+ WSREP_QUERY(thd), thd->thread_id);
}
/*
@@ -1845,11 +1989,11 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
*/
if (wsrep_auto_increment_control)
{
- thd->variables.auto_increment_offset = 1;
- thd->variables.auto_increment_increment = 1;
+ thd->variables.auto_increment_offset= 1;
+ thd->variables.auto_increment_increment= 1;
}
- if (thd->variables.wsrep_on && thd->wsrep_exec_mode==LOCAL_STATE)
+ if (thd->variables.wsrep_on && wsrep_thd_is_local(thd))
{
switch (thd->variables.wsrep_OSU_method) {
case WSREP_OSU_TOI:
@@ -1865,48 +2009,53 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
break;
}
switch (ret) {
- case 0: thd->wsrep_exec_mode= TOTAL_ORDER; break;
+ case 0: /* wsrep_TOI_begin sould set toi mode */ break;
case 1:
/* TOI replication skipped, treat as success */
- ret = 0;
+ ret= 0;
break;
case -1:
/* TOI replication failed, treat as error */
break;
}
}
+
return ret;
}
void wsrep_to_isolation_end(THD *thd)
{
- if (thd->wsrep_exec_mode == TOTAL_ORDER)
+ DBUG_ASSERT(wsrep_thd_is_local_toi(thd) ||
+ wsrep_thd_is_in_rsu(thd));
+ if (wsrep_thd_is_local_toi(thd))
{
- switch(thd->variables.wsrep_OSU_method)
- {
- case WSREP_OSU_TOI: wsrep_TOI_end(thd); break;
- case WSREP_OSU_RSU: wsrep_RSU_end(thd); break;
- default:
- WSREP_WARN("Unsupported wsrep OSU method at isolation end: %lu",
- thd->variables.wsrep_OSU_method);
- break;
- }
- wsrep_cleanup_transaction(thd);
+ DBUG_ASSERT(thd->variables.wsrep_OSU_method == WSREP_OSU_TOI);
+ wsrep_TOI_end(thd);
+ }
+ else if (wsrep_thd_is_in_rsu(thd))
+ {
+ DBUG_ASSERT(thd->variables.wsrep_OSU_method == WSREP_OSU_RSU);
+ wsrep_RSU_end(thd);
+ }
+ else
+ {
+ DBUG_ASSERT(0);
}
+ if (wsrep_emulate_bin_log) wsrep_thd_binlog_trx_reset(thd);
}
#define WSREP_MDL_LOG(severity, msg, schema, schema_len, req, gra) \
WSREP_##severity( \
"%s\n" \
"schema: %.*s\n" \
- "request: (%lld \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)\n" \
- "granted: (%lld \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)", \
+ "request: (%llu \tseqno %lld \twsrep (%s, %s, %s) cmd %d %d \t%s)\n" \
+ "granted: (%llu \tseqno %lld \twsrep (%s, %s, %s) cmd %d %d \t%s)", \
msg, schema_len, schema, \
- (longlong) req->thread_id, (long long)wsrep_thd_trx_seqno(req), \
- req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \
+ req->thread_id, (long long)wsrep_thd_trx_seqno(req), \
+ wsrep_thd_client_mode_str(req), wsrep_thd_client_state_str(req), wsrep_thd_transaction_state_str(req), \
req->get_command(), req->lex->sql_command, req->query(), \
- (longlong) gra->thread_id, (long long)wsrep_thd_trx_seqno(gra), \
- gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \
+ gra->thread_id, (long long)wsrep_thd_trx_seqno(gra), \
+ wsrep_thd_client_mode_str(gra), wsrep_thd_client_state_str(gra), wsrep_thd_transaction_state_str(gra), \
gra->get_command(), gra->lex->sql_command, gra->query());
/**
@@ -1919,58 +2068,47 @@ void wsrep_to_isolation_end(THD *thd)
@retval FALSE Lock request cannot be granted
*/
-bool wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
+void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
MDL_ticket *ticket,
const MDL_key *key)
{
/* Fallback to the non-wsrep behaviour */
- if (!WSREP_ON) return FALSE;
+ if (!WSREP_ON) return;
THD *request_thd= requestor_ctx->get_thd();
THD *granted_thd= ticket->get_ctx()->get_thd();
- bool ret= false;
const char* schema= key->db_name();
int schema_len= key->db_name_length();
mysql_mutex_lock(&request_thd->LOCK_thd_data);
+ if (wsrep_thd_is_toi(request_thd) ||
+ wsrep_thd_is_applying(request_thd)) {
- /*
- We consider granting MDL exceptions only for appliers (BF THD) and ones
- executing under TOI mode.
-
- Rules:
- 1. If granted/owner THD is also an applier (BF THD) or one executing
- under TOI mode, then we grant the requested lock to the requester
- THD.
- @return true
-
- 2. If granted/owner THD is executing a FLUSH command or already has an
- explicit lock, then do not grant the requested lock to the requester
- THD and it has to wait.
- @return false
-
- 3. In all other cases the granted/owner THD is aborted and the requested
- lock is not granted to the requester THD, thus it has to wait.
- @return false
- */
- if (request_thd->wsrep_exec_mode == TOTAL_ORDER ||
- request_thd->wsrep_exec_mode == REPL_RECV)
- {
mysql_mutex_unlock(&request_thd->LOCK_thd_data);
WSREP_MDL_LOG(DEBUG, "MDL conflict ", schema, schema_len,
request_thd, granted_thd);
ticket->wsrep_report(wsrep_debug);
mysql_mutex_lock(&granted_thd->LOCK_thd_data);
- if (granted_thd->wsrep_exec_mode == TOTAL_ORDER ||
- granted_thd->wsrep_exec_mode == REPL_RECV)
+ if (wsrep_thd_is_toi(granted_thd) ||
+ wsrep_thd_is_applying(granted_thd))
{
- WSREP_MDL_LOG(INFO, "MDL BF-BF conflict", schema, schema_len,
- request_thd, granted_thd);
- ticket->wsrep_report(true);
- mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
- ret= true;
+ if (wsrep_thd_is_SR(granted_thd) && !wsrep_thd_is_SR(request_thd))
+ {
+ WSREP_MDL_LOG(INFO, "MDL conflict, DDL vs SR",
+ schema, schema_len, request_thd, granted_thd);
+ mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);
+ }
+ else
+ {
+ WSREP_MDL_LOG(INFO, "MDL BF-BF conflict", schema, schema_len,
+ request_thd, granted_thd);
+ ticket->wsrep_report(true);
+ mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+ unireg_abort(1);
+ }
}
else if (granted_thd->lex->sql_command == SQLCOM_FLUSH ||
granted_thd->mdl_context.has_explicit_locks())
@@ -1978,173 +2116,57 @@ bool wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
WSREP_DEBUG("BF thread waiting for FLUSH");
ticket->wsrep_report(wsrep_debug);
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
- ret= false;
+ }
+ else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE)
+ {
+ WSREP_DEBUG("DROP caused BF abort, conf %s",
+ wsrep_thd_transaction_state_str(granted_thd));
+ ticket->wsrep_report(wsrep_debug);
+ mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);
}
else
{
- /* Print some debug information. */
- if (wsrep_debug)
+ WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", schema, schema_len,
+ request_thd, granted_thd);
+ ticket->wsrep_report(wsrep_debug);
+ if (granted_thd->wsrep_trx().active())
{
- if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE ||
- request_thd->lex->sql_command == SQLCOM_DROP_SEQUENCE)
- {
- WSREP_DEBUG("DROP caused BF abort, conf %d", granted_thd->wsrep_conflict_state);
- }
- else if (granted_thd->wsrep_query_state == QUERY_COMMITTING)
+ mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+ wsrep_abort_thd(request_thd, granted_thd, 1);
+ }
+ else
+ {
+ /*
+ Granted_thd is likely executing with wsrep_on=0. If the requesting
+ thd is BF, BF abort and wait.
+ */
+ mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+ if (wsrep_thd_is_BF(request_thd, FALSE))
{
- WSREP_DEBUG("MDL granted, but committing thd abort scheduled");
+ ha_abort_transaction(request_thd, granted_thd, TRUE);
}
else
{
- WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", schema, schema_len,
- request_thd, granted_thd);
+ WSREP_MDL_LOG(INFO, "MDL unknown BF-BF conflict", schema, schema_len,
+ request_thd, granted_thd);
+ ticket->wsrep_report(true);
+ unireg_abort(1);
}
- ticket->wsrep_report(true);
}
-
- mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
- wsrep_abort_thd((void *) request_thd, (void *) granted_thd, 1);
- ret= false;
}
}
else
{
mysql_mutex_unlock(&request_thd->LOCK_thd_data);
}
-
- return ret;
}
-
-pthread_handler_t start_wsrep_THD(void *arg)
-{
- THD *thd;
- wsrep_thd_processor_fun processor= (wsrep_thd_processor_fun)arg;
-
- if (my_thread_init() || (!(thd= new THD(next_thread_id(), true))))
- {
- goto error;
- }
-
- mysql_mutex_lock(&LOCK_thread_count);
-
- if (wsrep_gtid_mode)
- {
- /* Adjust domain_id. */
- thd->variables.gtid_domain_id= wsrep_gtid_domain_id;
- }
-
- thd->real_id=pthread_self(); // Keep purify happy
- thread_created++;
- threads.append(thd);
-
- my_net_init(&thd->net,(st_vio*) 0, thd, MYF(0));
-
- DBUG_PRINT("wsrep",(("creating thread %lld"), (long long)thd->thread_id));
- thd->prior_thr_create_utime= thd->start_utime= microsecond_interval_timer();
- (void) mysql_mutex_unlock(&LOCK_thread_count);
-
- /* from bootstrap()... */
- thd->bootstrap=1;
- thd->max_client_packet_length= thd->net.max_packet;
- thd->security_ctx->master_access= ~(ulong)0;
-
- /* from handle_one_connection... */
- pthread_detach_this_thread();
-
- mysql_thread_set_psi_id(thd->thread_id);
- thd->thr_create_utime= microsecond_interval_timer();
- if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0))
- {
- close_connection(thd, ER_OUT_OF_RESOURCES);
- statistic_increment(aborted_connects,&LOCK_status);
- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
- goto error;
- }
-
-// </5.1.17>
- /*
- handle_one_connection() is normally the only way a thread would
- start and would always be on the very high end of the stack ,
- therefore, the thread stack always starts at the address of the
- first local variable of handle_one_connection, which is thd. We
- need to know the start of the stack so that we could check for
- stack overruns.
- */
- DBUG_PRINT("wsrep", ("handle_one_connection called by thread %lld\n",
- (long long)thd->thread_id));
- /* now that we've called my_thread_init(), it is safe to call DBUG_* */
-
- thd->thread_stack= (char*) &thd;
- if (thd->store_globals())
- {
- close_connection(thd, ER_OUT_OF_RESOURCES);
- statistic_increment(aborted_connects,&LOCK_status);
- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
- goto error;
- }
-
- thd->system_thread= SYSTEM_THREAD_SLAVE_SQL;
- thd->security_ctx->skip_grants();
-
- /* handle_one_connection() again... */
- //thd->version= refresh_version;
- thd->proc_info= 0;
- thd->set_command(COM_SLEEP);
- thd->init_for_queries();
-
- mysql_mutex_lock(&LOCK_thread_count);
- wsrep_running_threads++;
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
-
- processor(thd);
-
- close_connection(thd, 0);
-
- mysql_mutex_lock(&LOCK_thread_count);
- wsrep_running_threads--;
- WSREP_DEBUG("wsrep running threads now: %lu", wsrep_running_threads);
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
-
- // Note: We can't call THD destructor without crashing
- // if plugins have not been initialized. However, in most of the
- // cases this means that pre SE initialization SST failed and
- // we are going to exit anyway.
- if (plugins_are_initialized)
- {
- net_end(&thd->net);
- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 1));
- }
- else
- {
- // TODO: lightweight cleanup to get rid of:
- // 'Error in my_thread_global_end(): 2 threads didn't exit'
- // at server shutdown
- }
-
- unlink_not_visible_thd(thd);
- delete thd;
- my_thread_end();
- return(NULL);
-
-error:
- WSREP_ERROR("Failed to create/initialize system thread");
-
- /* Abort if its the first applier/rollbacker thread. */
- if (!mysqld_server_initialized)
- unireg_abort(1);
- else
- return NULL;
-}
-
-
/**/
static bool abort_replicated(THD *thd)
{
bool ret_code= false;
- if (thd->wsrep_query_state== QUERY_COMMITTING)
+ if (thd->wsrep_trx().state() == wsrep::transaction::s_committing)
{
WSREP_DEBUG("aborting replicated trx: %llu", (ulonglong)(thd->real_id));
@@ -2154,54 +2176,44 @@ static bool abort_replicated(THD *thd)
return ret_code;
}
-
/**/
static inline bool is_client_connection(THD *thd)
{
return (thd->wsrep_client_thread && thd->variables.wsrep_on);
}
-
static inline bool is_replaying_connection(THD *thd)
{
bool ret;
mysql_mutex_lock(&thd->LOCK_thd_data);
- ret= (thd->wsrep_conflict_state == REPLAYING) ? true : false;
+ ret= (thd->wsrep_trx().state() == wsrep::transaction::s_replaying) ? true : false;
mysql_mutex_unlock(&thd->LOCK_thd_data);
return ret;
}
-
static inline bool is_committing_connection(THD *thd)
{
bool ret;
mysql_mutex_lock(&thd->LOCK_thd_data);
- ret= (thd->wsrep_query_state == QUERY_COMMITTING) ? true : false;
+ ret= (thd->wsrep_trx().state() == wsrep::transaction::s_committing) ? true : false;
mysql_mutex_unlock(&thd->LOCK_thd_data);
return ret;
}
-
-static bool have_client_connections()
+static my_bool have_client_connections(THD *thd, void*)
{
- THD *tmp;
-
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
+ DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
+ (longlong) thd->thread_id));
+ if (is_client_connection(thd) && thd->killed == KILL_CONNECTION)
{
- DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
- (longlong) tmp->thread_id));
- if (is_client_connection(tmp) && tmp->killed == KILL_CONNECTION)
- {
- (void)abort_replicated(tmp);
- return true;
- }
+ (void)abort_replicated(thd);
+ return 1;
}
- return false;
+ return 0;
}
static void wsrep_close_thread(THD *thd)
@@ -2222,81 +2234,72 @@ static void wsrep_close_thread(THD *thd)
}
}
-
-static my_bool have_committing_connections()
+static my_bool have_committing_connections(THD *thd, void *)
{
- THD *tmp;
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
-
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- {
- if (!is_client_connection(tmp))
- continue;
-
- if (is_committing_connection(tmp))
- {
- return TRUE;
- }
- }
- mysql_mutex_unlock(&LOCK_thread_count);
- return FALSE;
+ return is_client_connection(thd) && is_committing_connection(thd) ? 1 : 0;
}
-
int wsrep_wait_committing_connections_close(int wait_time)
{
int sleep_time= 100;
- while (have_committing_connections() && wait_time > 0)
+ while (server_threads.iterate(have_committing_connections) && wait_time > 0)
{
WSREP_DEBUG("wait for committing transaction to close: %d", wait_time);
my_sleep(sleep_time);
wait_time -= sleep_time;
}
- if (have_committing_connections())
+ return server_threads.iterate(have_committing_connections);
+}
+
+static my_bool kill_all_threads(THD *thd, THD *caller_thd)
+{
+ DBUG_PRINT("quit", ("Informing thread %lld that it's time to die",
+ (longlong) thd->thread_id));
+ /* We skip slave threads & scheduler on this first loop through. */
+ if (is_client_connection(thd) && thd != caller_thd)
{
- return 1;
+ if (is_replaying_connection(thd))
+ thd->set_killed(KILL_CONNECTION);
+ else if (!abort_replicated(thd))
+ {
+ /* replicated transactions must be skipped */
+ WSREP_DEBUG("closing connection %lld", (longlong) thd->thread_id);
+ /* instead of wsrep_close_thread() we do now soft kill by THD::awake */
+ thd->awake(KILL_CONNECTION);
+ }
}
return 0;
}
+static my_bool kill_remaining_threads(THD *thd, THD *caller_thd)
+{
+#ifndef __bsdi__ // Bug in BSDI kernel
+ if (is_client_connection(thd) &&
+ !abort_replicated(thd) &&
+ !is_replaying_connection(thd) &&
+ thd != caller_thd)
+ {
+ WSREP_INFO("killing local connection: %lld", (longlong) thd->thread_id);
+ close_connection(thd, 0);
+ }
+#endif
+ return 0;
+}
-void wsrep_close_client_connections(my_bool wait_to_end)
+void wsrep_close_client_connections(my_bool wait_to_end, THD* except_caller_thd)
{
/*
First signal all threads that it's time to die
*/
- THD *tmp;
mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
bool kill_cached_threads_saved= kill_cached_threads;
kill_cached_threads= true; // prevent future threads caching
mysql_cond_broadcast(&COND_thread_cache); // tell cached threads to die
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- {
- DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
- (longlong) tmp->thread_id));
- /* We skip slave threads & scheduler on this first loop through. */
- if (!is_client_connection(tmp))
- continue;
-
- if (is_replaying_connection(tmp))
- {
- tmp->set_killed(KILL_CONNECTION);
- continue;
- }
-
- /* replicated transactions must be skipped */
- if (abort_replicated(tmp))
- continue;
-
- WSREP_DEBUG("closing connection %lld", (longlong) tmp->thread_id);
- wsrep_close_thread(tmp);
- }
+ server_threads.iterate(kill_all_threads, except_caller_thd);
mysql_mutex_unlock(&LOCK_thread_count);
if (thread_count)
@@ -2306,28 +2309,17 @@ void wsrep_close_client_connections(my_bool wait_to_end)
/*
Force remaining threads to die by closing the connection to the client
*/
+ server_threads.iterate(kill_remaining_threads, except_caller_thd);
- I_List_iterator<THD> it2(threads);
- while ((tmp=it2++))
- {
-#ifndef __bsdi__ // Bug in BSDI kernel
- if (is_client_connection(tmp) &&
- !abort_replicated(tmp) &&
- !is_replaying_connection(tmp))
- {
- WSREP_INFO("killing local connection: %lld", (longlong) tmp->thread_id);
- close_connection(tmp,0);
- }
-#endif
- }
-
- DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count));
- WSREP_DEBUG("waiting for client connections to close: %u", thread_count);
+ DBUG_PRINT("quit", ("Waiting for threads to die (count=%u)",
+ uint32_t(thread_count)));
+ WSREP_DEBUG("waiting for client connections to close: %u",
+ uint32_t(thread_count));
- while (wait_to_end && have_client_connections())
+ while (wait_to_end && server_threads.iterate(have_client_connections))
{
mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
- DBUG_PRINT("quit",("One thread died (count=%u)", thread_count));
+ DBUG_PRINT("quit",("One thread died (count=%u)", uint32_t(thread_count)));
}
kill_cached_threads= kill_cached_threads_saved;
@@ -2344,36 +2336,34 @@ void wsrep_close_applier(THD *thd)
wsrep_close_thread(thd);
}
-
-void wsrep_close_threads(THD *thd)
+static my_bool wsrep_close_threads_callback(THD *thd, THD *caller_thd)
{
- THD *tmp;
- mysql_mutex_lock(&LOCK_thread_count); // For unlink from list
-
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
+ DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
+ (longlong) thd->thread_id));
+ /* We skip slave threads & scheduler on this first loop through. */
+ if (thd->wsrep_applier && thd != caller_thd)
{
- DBUG_PRINT("quit",("Informing thread %lld that it's time to die",
- (longlong) tmp->thread_id));
- /* We skip slave threads & scheduler on this first loop through. */
- if (tmp->wsrep_applier && tmp != thd)
- {
- WSREP_DEBUG("closing wsrep thread %lld", (longlong) tmp->thread_id);
- wsrep_close_thread (tmp);
- }
+ WSREP_DEBUG("closing wsrep thread %lld", (longlong) thd->thread_id);
+ wsrep_close_thread(thd);
}
+ return 0;
+}
- mysql_mutex_unlock(&LOCK_thread_count);
+void wsrep_close_threads(THD *thd)
+{
+ server_threads.iterate(wsrep_close_threads_callback, thd);
}
void wsrep_wait_appliers_close(THD *thd)
{
/* Wait for wsrep appliers to gracefully exit */
mysql_mutex_lock(&LOCK_thread_count);
- while (wsrep_running_threads > 1)
- // 1 is for rollbacker thread which needs to be killed explicitly.
- // This gotta be fixed in a more elegant manner if we gonna have arbitrary
- // number of non-applier wsrep threads.
+ while (wsrep_running_threads > 2)
+ /*
+ 2 is for rollbacker thread which needs to be killed explicitly.
+ This gotta be fixed in a more elegant manner if we gonna have arbitrary
+ number of non-applier wsrep threads.
+ */
{
if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
{
@@ -2383,7 +2373,7 @@ void wsrep_wait_appliers_close(THD *thd)
}
else
mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
- DBUG_PRINT("quit",("One applier died (count=%u)",thread_count));
+ DBUG_PRINT("quit",("One applier died (count=%u)", uint32_t(thread_count)));
}
mysql_mutex_unlock(&LOCK_thread_count);
/* Now kill remaining wsrep threads: rollbacker */
@@ -2400,7 +2390,7 @@ void wsrep_wait_appliers_close(THD *thd)
}
else
mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
- DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
+ DBUG_PRINT("quit",("One thread died (count=%u)", uint32_t(thread_count)));
}
mysql_mutex_unlock(&LOCK_thread_count);
@@ -2409,15 +2399,14 @@ void wsrep_wait_appliers_close(THD *thd)
*/
}
-
void wsrep_kill_mysql(THD *thd)
{
if (mysqld_server_started)
{
- if (!shutdown_in_progress)
+ if (!abort_loop)
{
WSREP_INFO("starting shutdown");
- kill_mysql();
+ kill_mysql(thd);
}
}
else
@@ -2426,267 +2415,167 @@ void wsrep_kill_mysql(THD *thd)
}
}
-
-static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
-{
- String log_query;
- sp_head *sp = thd->lex->sphead;
- sql_mode_t saved_mode= thd->variables.sql_mode;
- String retstr(64);
- LEX_CSTRING returns= empty_clex_str;
- retstr.set_charset(system_charset_info);
-
- log_query.set_charset(system_charset_info);
-
- if (sp->m_handler->type() == TYPE_ENUM_FUNCTION)
- {
- sp_returns_type(thd, retstr, sp);
- returns= retstr.lex_cstring();
- }
- if (sp->m_handler->
- show_create_sp(thd, &log_query,
- sp->m_explicit_name ? sp->m_db : null_clex_str,
- sp->m_name, sp->m_params, returns,
- sp->m_body, sp->chistics(),
- thd->lex->definer[0],
- thd->lex->create_info,
- saved_mode))
- {
- WSREP_WARN("SP create string failed: schema: %s, query: %s",
- thd->get_db(), thd->query());
- return 1;
- }
-
- return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len);
-}
-
-
-extern int wsrep_on(THD *thd)
-{
- return (int)(WSREP(thd));
-}
-
-
-extern "C" bool wsrep_thd_is_wsrep_on(THD *thd)
-{
- return thd->variables.wsrep_on;
-}
-
-
-bool wsrep_consistency_check(THD *thd)
-{
- return thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING;
-}
-
-
-extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode)
-{
- thd->wsrep_exec_mode= mode;
-}
-
-
-extern "C" void wsrep_thd_set_query_state(
- THD *thd, enum wsrep_query_state state)
-{
- thd->wsrep_query_state= state;
-}
-
-
-void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state)
-{
- if (WSREP(thd)) thd->wsrep_conflict_state= state;
-}
-
-
-enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd)
-{
- return thd->wsrep_exec_mode;
-}
-
-
-const char *wsrep_thd_exec_mode_str(THD *thd)
-{
- return
- (!thd) ? "void" :
- (thd->wsrep_exec_mode == LOCAL_STATE) ? "local" :
- (thd->wsrep_exec_mode == REPL_RECV) ? "applier" :
- (thd->wsrep_exec_mode == TOTAL_ORDER) ? "total order" :
- (thd->wsrep_exec_mode == LOCAL_COMMIT) ? "local commit" : "void";
-}
-
-
-enum wsrep_query_state wsrep_thd_query_state(THD *thd)
-{
- return thd->wsrep_query_state;
-}
-
-
-const char *wsrep_thd_query_state_str(THD *thd)
+void
+wsrep_last_committed_id(wsrep_gtid_t* gtid)
{
- return
- (!thd) ? "void" :
- (thd->wsrep_query_state == QUERY_IDLE) ? "idle" :
- (thd->wsrep_query_state == QUERY_EXEC) ? "executing" :
- (thd->wsrep_query_state == QUERY_COMMITTING) ? "committing" :
- (thd->wsrep_query_state == QUERY_EXITING) ? "exiting" :
- (thd->wsrep_query_state == QUERY_ROLLINGBACK) ? "rolling back" : "void";
+ wsrep::gtid ret= Wsrep_server_state::instance().last_committed_gtid();
+ memcpy(gtid->uuid.data, ret.id().data(), sizeof(gtid->uuid.data));
+ gtid->seqno= ret.seqno().get();
}
-
-enum wsrep_conflict_state wsrep_thd_get_conflict_state(THD *thd)
+void
+wsrep_node_uuid(wsrep_uuid_t& uuid)
{
- return thd->wsrep_conflict_state;
+ uuid= node_uuid;
}
-
-const char *wsrep_thd_conflict_state_str(THD *thd)
+int wsrep_must_ignore_error(THD* thd)
{
- return
- (!thd) ? "void" :
- (thd->wsrep_conflict_state == NO_CONFLICT) ? "no conflict" :
- (thd->wsrep_conflict_state == MUST_ABORT) ? "must abort" :
- (thd->wsrep_conflict_state == ABORTING) ? "aborting" :
- (thd->wsrep_conflict_state == MUST_REPLAY) ? "must replay" :
- (thd->wsrep_conflict_state == REPLAYING) ? "replaying" :
- (thd->wsrep_conflict_state == RETRY_AUTOCOMMIT) ? "retrying" :
- (thd->wsrep_conflict_state == CERT_FAILURE) ? "cert failure" : "void";
-}
+ const int error= thd->get_stmt_da()->sql_errno();
+ const uint flags= sql_command_flags[thd->lex->sql_command];
+ DBUG_ASSERT(error);
+ DBUG_ASSERT((wsrep_thd_is_toi(thd)) ||
+ (wsrep_thd_is_applying(thd) && thd->wsrep_apply_toi));
-wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd)
-{
- return &thd->wsrep_ws_handle;
-}
-
+ if ((wsrep_ignore_apply_errors & WSREP_IGNORE_ERRORS_ON_DDL))
+ goto ignore_error;
-void wsrep_thd_LOCK(THD *thd)
-{
- mysql_mutex_lock(&thd->LOCK_thd_data);
-}
+ if ((flags & CF_WSREP_MAY_IGNORE_ERRORS) &&
+ (wsrep_ignore_apply_errors & WSREP_IGNORE_ERRORS_ON_RECONCILING_DDL))
+ {
+ switch (error)
+ {
+ case ER_DB_DROP_EXISTS:
+ case ER_BAD_TABLE_ERROR:
+ case ER_CANT_DROP_FIELD_OR_KEY:
+ goto ignore_error;
+ }
+ }
+ return 0;
-void wsrep_thd_UNLOCK(THD *thd)
-{
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ignore_error:
+ WSREP_WARN("Ignoring error '%s' on query. "
+ "Default database: '%s'. Query: '%s', Error_code: %d",
+ thd->get_stmt_da()->message(),
+ print_slave_db_safe(thd->db.str),
+ thd->query(),
+ error);
+ return 1;
}
-
-extern "C" time_t wsrep_thd_query_start(THD *thd)
+int wsrep_ignored_error_code(Log_event* ev, int error)
{
- return thd->query_start();
-}
-
+ const THD* thd= ev->thd;
-extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd)
-{
- return thd->wsrep_rand;
-}
+ DBUG_ASSERT(error);
+ DBUG_ASSERT(wsrep_thd_is_applying(thd) &&
+ !wsrep_thd_is_local_toi(thd));
-longlong wsrep_thd_trx_seqno(THD *thd)
-{
- return (thd) ? thd->wsrep_trx_meta.gtid.seqno : WSREP_SEQNO_UNDEFINED;
-}
+ if ((wsrep_ignore_apply_errors & WSREP_IGNORE_ERRORS_ON_RECONCILING_DML))
+ {
+ const int ev_type= ev->get_type_code();
+ if ((ev_type == DELETE_ROWS_EVENT || ev_type == DELETE_ROWS_EVENT_V1)
+ && error == ER_KEY_NOT_FOUND)
+ goto ignore_error;
+ }
+ return 0;
-extern "C" query_id_t wsrep_thd_query_id(THD *thd)
-{
- return thd->query_id;
+ignore_error:
+ WSREP_WARN("Ignoring error '%s' on %s event. Error_code: %d",
+ thd->get_stmt_da()->message(),
+ ev->get_type_str(),
+ error);
+ return 1;
}
-
-char *wsrep_thd_query(THD *thd)
+bool wsrep_provider_is_SR_capable()
{
- return (thd) ? thd->query() : NULL;
+ return Wsrep_server_state::has_capability(wsrep::provider::capability::streaming);
}
-extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd)
+int wsrep_ordered_commit_if_no_binlog(THD* thd, bool all)
{
- return thd->wsrep_last_query_id;
+ if (((wsrep_thd_is_local(thd) &&
+ (WSREP_EMULATE_BINLOG(thd) || !thd->variables.sql_log_bin)) ||
+ (wsrep_thd_is_applying(thd) && !opt_log_slave_updates))
+ && wsrep_thd_trx_seqno(thd) > 0)
+ {
+ wsrep_apply_error unused;
+ return wsrep_ordered_commit(thd, all, unused);
+ }
+ return 0;
}
-
-extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id)
+wsrep_status_t wsrep_tc_log_commit(THD* thd)
{
- thd->wsrep_last_query_id= id;
-}
-
+ int cookie;
+ my_xid xid= thd->transaction.xid_state.xid.get_my_xid();
-extern "C" void wsrep_thd_awake(THD *thd, my_bool signal)
-{
- if (signal)
+ DBUG_ASSERT(thd->lex->sql_command == SQLCOM_LOAD);
+ if (wsrep_before_commit(thd, true))
{
- thd->awake(KILL_QUERY);
+ WSREP_DEBUG("wsrep_tc_log_commit: wsrep_before_commit failed %llu",
+ thd->thread_id);
+ return WSREP_TRX_FAIL;
}
- else
+ cookie= tc_log->log_and_order(thd, xid, 1, false, true);
+ if (wsrep_after_commit(thd, true))
{
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- mysql_cond_broadcast(&COND_wsrep_replaying);
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
+ WSREP_DEBUG("wsrep_tc_log_commit: wsrep_after_commit failed %llu",
+ thd->thread_id);
+ return WSREP_TRX_FAIL;
+ }
+ if (!cookie)
+ {
+ WSREP_DEBUG("log_and_order has failed %llu %d", thd->thread_id, cookie);
+ return WSREP_TRX_FAIL;
+ }
+ if (tc_log->unlog(cookie, xid))
+ {
+ WSREP_DEBUG("log_and_order has failed %llu %d", thd->thread_id, cookie);
+ return WSREP_TRX_FAIL;
}
-}
-
-
-int wsrep_thd_retry_counter(THD *thd)
-{
- return(thd->wsrep_retry_counter);
-}
-
-
-extern "C" bool wsrep_thd_ignore_table(THD *thd)
-{
- return thd->wsrep_ignore_table;
-}
-
-extern int
-wsrep_trx_order_before(THD *thd1, THD *thd2)
-{
- if (wsrep_thd_trx_seqno(thd1) < wsrep_thd_trx_seqno(thd2)) {
- WSREP_DEBUG("BF conflict, order: %lld %lld\n",
- (long long)wsrep_thd_trx_seqno(thd1),
- (long long)wsrep_thd_trx_seqno(thd2));
- return 1;
+ if (wsrep_after_statement(thd))
+ {
+ return WSREP_TRX_FAIL;
+ }
+ /* Set wsrep transaction id if not set. */
+ if (thd->wsrep_trx_id() == WSREP_UNDEFINED_TRX_ID)
+ {
+ if (thd->wsrep_next_trx_id() == WSREP_UNDEFINED_TRX_ID)
+ {
+ thd->set_wsrep_next_trx_id(thd->query_id);
}
- WSREP_DEBUG("waiting for BF, trx order: %lld %lld\n",
- (long long)wsrep_thd_trx_seqno(thd1),
- (long long)wsrep_thd_trx_seqno(thd2));
- return 0;
+ DBUG_ASSERT(thd->wsrep_next_trx_id() != WSREP_UNDEFINED_TRX_ID);
+ }
+ if (wsrep_start_transaction(thd, thd->wsrep_next_trx_id()))
+ {
+ return WSREP_TRX_FAIL;
+ }
+ DBUG_ASSERT(thd->wsrep_trx_id() != WSREP_UNDEFINED_TRX_ID);
+ return WSREP_OK;
}
-
-int wsrep_trx_is_aborting(THD *thd_ptr)
+int wsrep_thd_retry_counter(const THD *thd)
{
- if (thd_ptr) {
- if ((((THD *)thd_ptr)->wsrep_conflict_state == MUST_ABORT) ||
- (((THD *)thd_ptr)->wsrep_conflict_state == ABORTING)) {
- return 1;
- }
- }
- return 0;
+ return thd->wsrep_retry_counter;
}
-
-void wsrep_copy_query(THD *thd)
+extern bool wsrep_thd_ignore_table(THD *thd)
{
- thd->wsrep_retry_command = thd->get_command();
- thd->wsrep_retry_query_len = thd->query_length();
- if (thd->wsrep_retry_query) {
- my_free(thd->wsrep_retry_query);
- }
- thd->wsrep_retry_query = (char *)my_malloc(
- thd->wsrep_retry_query_len + 1, MYF(0));
- strncpy(thd->wsrep_retry_query, thd->query(), thd->wsrep_retry_query_len);
- thd->wsrep_retry_query[thd->wsrep_retry_query_len] = '\0';
+ return thd->wsrep_ignore_table;
}
-
bool wsrep_is_show_query(enum enum_sql_command command)
{
DBUG_ASSERT(command >= 0 && command <= SQLCOM_END);
return (sql_command_flags[command] & CF_STATUS_COMMAND) != 0;
}
-
bool wsrep_create_like_table(THD* thd, TABLE_LIST* table,
TABLE_LIST* src_table,
HA_CREATE_INFO *create_info)
@@ -2737,8 +2626,7 @@ wsrep_error_label:
#endif
}
-
-static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
+int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
{
LEX *lex= thd->lex;
String stmt_query;
@@ -2793,88 +2681,164 @@ static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
buf, buf_len);
}
-/***** callbacks for wsrep service ************/
-
-my_bool get_wsrep_debug()
+void* start_wsrep_THD(void *arg)
{
- return wsrep_debug;
-}
+ THD *thd;
-my_bool get_wsrep_load_data_splitting()
-{
- return wsrep_load_data_splitting;
-}
+ Wsrep_thd_args* thd_args= (Wsrep_thd_args*) arg;
-long get_wsrep_protocol_version()
-{
- return wsrep_protocol_version;
-}
+ if (my_thread_init() || (!(thd= new THD(next_thread_id(), true))))
+ {
+ goto error;
+ }
-my_bool get_wsrep_drupal_282555_workaround()
-{
- return wsrep_drupal_282555_workaround;
-}
+ statistic_increment(thread_created, &LOCK_status);
-my_bool get_wsrep_recovery()
-{
- return wsrep_recovery;
-}
+ if (wsrep_gtid_mode)
+ {
+ /* Adjust domain_id. */
+ thd->variables.gtid_domain_id= wsrep_gtid_domain_id;
+ }
-my_bool get_wsrep_log_conflicts()
-{
- return wsrep_log_conflicts;
-}
+ thd->real_id=pthread_self(); // Keep purify happy
-wsrep_t *get_wsrep()
-{
- return wsrep;
-}
+ my_net_init(&thd->net,(st_vio*) 0, thd, MYF(0));
-my_bool get_wsrep_certify_nonPK()
-{
- return wsrep_certify_nonPK;
-}
+ DBUG_PRINT("wsrep",(("creating thread %lld"), (long long)thd->thread_id));
+ thd->prior_thr_create_utime= thd->start_utime= microsecond_interval_timer();
-void wsrep_lock_rollback()
-{
- mysql_mutex_lock(&LOCK_wsrep_rollback);
-}
+ server_threads.insert(thd);
-void wsrep_unlock_rollback()
-{
- mysql_cond_signal(&COND_wsrep_rollback);
- mysql_mutex_unlock(&LOCK_wsrep_rollback);
-}
+ /* from bootstrap()... */
+ thd->bootstrap=1;
+ thd->max_client_packet_length= thd->net.max_packet;
+ thd->security_ctx->master_access= ~(ulong)0;
-my_bool wsrep_aborting_thd_contains(THD *thd)
-{
- mysql_mutex_assert_owner(&LOCK_wsrep_rollback);
- wsrep_aborting_thd_t abortees = wsrep_aborting_thd;
- while (abortees)
+ /* from handle_one_connection... */
+ pthread_detach_this_thread();
+
+ mysql_thread_set_psi_id(thd->thread_id);
+ thd->thr_create_utime= microsecond_interval_timer();
+ if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0))
{
- if (abortees->aborting_thd == thd)
- return true;
- abortees = abortees->next;
+ close_connection(thd, ER_OUT_OF_RESOURCES);
+ statistic_increment(aborted_connects,&LOCK_status);
+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
+ goto error;
}
- return false;
+
+// </5.1.17>
+ /*
+ handle_one_connection() is normally the only way a thread would
+ start and would always be on the very high end of the stack ,
+ therefore, the thread stack always starts at the address of the
+ first local variable of handle_one_connection, which is thd. We
+ need to know the start of the stack so that we could check for
+ stack overruns.
+ */
+ DBUG_PRINT("wsrep", ("handle_one_connection called by thread %lld\n",
+ (long long)thd->thread_id));
+ /* now that we've called my_thread_init(), it is safe to call DBUG_* */
+
+ thd->thread_stack= (char*) &thd;
+ if (thd->store_globals())
+ {
+ close_connection(thd, ER_OUT_OF_RESOURCES);
+ statistic_increment(aborted_connects,&LOCK_status);
+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
+ delete thd;
+ delete thd_args;
+ goto error;
+ }
+
+ thd->system_thread= SYSTEM_THREAD_SLAVE_SQL;
+ thd->security_ctx->skip_grants();
+
+ /* handle_one_connection() again... */
+ thd->proc_info= 0;
+ thd->set_command(COM_SLEEP);
+ thd->init_for_queries();
+ mysql_mutex_lock(&LOCK_thread_count);
+ wsrep_running_threads++;
+ mysql_cond_broadcast(&COND_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
+
+ WSREP_DEBUG("wsrep system thread %llu, %p starting",
+ thd->thread_id, thd);
+ thd_args->fun()(thd, thd_args->args());
+
+ WSREP_DEBUG("wsrep system thread: %llu, %p closing",
+ thd->thread_id, thd);
+
+ /* Wsrep may reset globals during thread context switches, store globals
+ before cleanup. */
+ thd->store_globals();
+
+ close_connection(thd, 0);
+
+ delete thd_args;
+
+ mysql_mutex_lock(&LOCK_thread_count);
+ wsrep_running_threads--;
+ WSREP_DEBUG("wsrep running threads now: %lu", wsrep_running_threads);
+ mysql_cond_broadcast(&COND_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
+ /*
+ Note: We can't call THD destructor without crashing
+ if plugins have not been initialized. However, in most of the
+ cases this means that pre SE initialization SST failed and
+ we are going to exit anyway.
+ */
+ if (plugins_are_initialized)
+ {
+ net_end(&thd->net);
+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 1));
+ }
+ else
+ {
+ /*
+ TODO: lightweight cleanup to get rid of:
+ 'Error in my_thread_global_end(): 2 threads didn't exit'
+ at server shutdown
+ */
+ }
+
+ server_threads.erase(thd);
+ delete thd;
+ my_thread_end();
+ return(NULL);
+
+error:
+ WSREP_ERROR("Failed to create/initialize system thread");
+
+ /* Abort if its the first applier/rollbacker thread. */
+ if (!mysqld_server_initialized)
+ unireg_abort(1);
+ else
+ return NULL;
}
-void wsrep_aborting_thd_enqueue(THD *thd)
+enum wsrep::streaming_context::fragment_unit wsrep_fragment_unit(ulong unit)
{
- mysql_mutex_assert_owner(&LOCK_wsrep_rollback);
- wsrep_aborting_thd_t aborting = (wsrep_aborting_thd_t)
- my_malloc(sizeof(struct wsrep_aborting_thd), MYF(0));
- aborting->aborting_thd = thd;
- aborting->next = wsrep_aborting_thd;
- wsrep_aborting_thd = aborting;
+ switch (unit)
+ {
+ case WSREP_FRAG_BYTES: return wsrep::streaming_context::bytes;
+ case WSREP_FRAG_ROWS: return wsrep::streaming_context::row;
+ case WSREP_FRAG_STATEMENTS: return wsrep::streaming_context::statement;
+ default:
+ DBUG_ASSERT(0);
+ return wsrep::streaming_context::bytes;
+ }
}
-bool wsrep_node_is_donor()
+/***** callbacks for wsrep service ************/
+
+my_bool get_wsrep_recovery()
{
- return (WSREP_ON) ? (wsrep_config_state->get_status() == 2) : false;
+ return wsrep_recovery;
}
-bool wsrep_node_is_synced()
+bool wsrep_consistency_check(THD *thd)
{
- return (WSREP_ON) ? (wsrep_config_state->get_status() == 4) : false;
+ return thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING;
}
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 819a56b9f23..957f1ef3ab1 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -1,4 +1,4 @@
-/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
+/* Copyright 2008-2017 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,24 +13,32 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
-#include <wsrep.h>
-
#ifndef WSREP_MYSQLD_H
#define WSREP_MYSQLD_H
-#include <mysql/plugin.h>
-#include <mysql/service_wsrep.h>
+#include <wsrep.h>
#ifdef WITH_WSREP
+#include <mysql/plugin.h>
+#include "mysql/service_wsrep.h"
+
+#include <my_global.h>
+#include <my_pthread.h>
+#include "log.h"
+#include "mysqld.h"
+
typedef struct st_mysql_show_var SHOW_VAR;
#include <sql_priv.h>
-//#include "rpl_gtid.h"
-#include "../wsrep/wsrep_api.h"
#include "mdl.h"
-#include "mysqld.h"
#include "sql_table.h"
+#include "wsrep/provider.hpp"
+#include "wsrep/streaming_context.hpp"
+#include "wsrep_api.h"
+#include <vector>
+#include "wsrep_server_state.h"
+
#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX
class set_var;
@@ -42,20 +50,7 @@ enum wsrep_consistency_check_mode {
CONSISTENCY_CHECK_RUNNING,
};
-struct wsrep_thd_shadow {
- ulonglong options;
- uint server_status;
- enum wsrep_exec_mode wsrep_exec_mode;
- Vio *vio;
- ulong tx_isolation;
- const char *db;
- size_t db_length;
- my_hrtime_t user_time;
- longlong row_count_func;
-};
-
// Global wsrep parameters
-extern wsrep_t* wsrep;
// MySQL wsrep options
extern const char* wsrep_provider;
@@ -69,24 +64,33 @@ extern const char* wsrep_data_home_dir;
extern const char* wsrep_dbug_option;
extern long wsrep_slave_threads;
extern int wsrep_slave_count_change;
+extern MYSQL_PLUGIN_IMPORT my_bool wsrep_debug;
extern my_bool wsrep_convert_LOCK_to_trx;
extern ulong wsrep_retry_autocommit;
extern my_bool wsrep_auto_increment_control;
+extern my_bool wsrep_drupal_282555_workaround;
extern my_bool wsrep_incremental_data_collection;
extern const char* wsrep_start_position;
extern ulong wsrep_max_ws_size;
extern ulong wsrep_max_ws_rows;
extern const char* wsrep_notify_cmd;
-extern long wsrep_max_protocol_version;
+extern my_bool wsrep_certify_nonPK;
+extern long int wsrep_protocol_version;
extern ulong wsrep_forced_binlog_format;
extern my_bool wsrep_desync;
extern ulong wsrep_reject_queries;
+extern my_bool wsrep_recovery;
extern my_bool wsrep_replicate_myisam;
+extern my_bool wsrep_log_conflicts;
extern ulong wsrep_mysql_replication_bundle;
+extern my_bool wsrep_load_data_splitting;
extern my_bool wsrep_restart_slave;
extern my_bool wsrep_restart_slave_activated;
extern my_bool wsrep_slave_FK_checks;
extern my_bool wsrep_slave_UK_checks;
+extern ulong wsrep_trx_fragment_unit;
+extern ulong wsrep_SR_store_type;
+extern uint wsrep_ignore_apply_errors;
extern ulong wsrep_running_threads;
extern bool wsrep_new_cluster;
extern bool wsrep_gtid_mode;
@@ -105,15 +109,34 @@ enum enum_wsrep_OSU_method {
};
enum enum_wsrep_sync_wait {
- WSREP_SYNC_WAIT_NONE = 0x0,
+ WSREP_SYNC_WAIT_NONE= 0x0,
// select, begin
- WSREP_SYNC_WAIT_BEFORE_READ = 0x1,
- WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE = 0x2,
- WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE = 0x4,
- WSREP_SYNC_WAIT_BEFORE_SHOW = 0x8,
- WSREP_SYNC_WAIT_MAX = 0xF
+ WSREP_SYNC_WAIT_BEFORE_READ= 0x1,
+ WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE= 0x2,
+ WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE= 0x4,
+ WSREP_SYNC_WAIT_BEFORE_SHOW= 0x8,
+ WSREP_SYNC_WAIT_MAX= 0xF
+};
+
+enum enum_wsrep_ignore_apply_error {
+ WSREP_IGNORE_ERRORS_NONE= 0x0,
+ WSREP_IGNORE_ERRORS_ON_RECONCILING_DDL= 0x1,
+ WSREP_IGNORE_ERRORS_ON_RECONCILING_DML= 0x2,
+ WSREP_IGNORE_ERRORS_ON_DDL= 0x4,
+ WSREP_IGNORE_ERRORS_MAX= 0x7
};
+// Streaming Replication
+#define WSREP_FRAG_BYTES 0
+#define WSREP_FRAG_ROWS 1
+#define WSREP_FRAG_STATEMENTS 2
+
+#define WSREP_SR_STORE_NONE 0
+#define WSREP_SR_STORE_TABLE 1
+
+extern const char *wsrep_fragment_units[];
+extern const char *wsrep_SR_store_types[];
+
// MySQL status variables
extern my_bool wsrep_connected;
extern my_bool wsrep_ready;
@@ -126,9 +149,18 @@ extern long long wsrep_local_bf_aborts;
extern const char* wsrep_provider_name;
extern const char* wsrep_provider_version;
extern const char* wsrep_provider_vendor;
+extern char* wsrep_provider_capabilities;
+extern char* wsrep_cluster_capabilities;
+
+int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff);
+int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff);
+void wsrep_free_status(THD *thd);
+void wsrep_update_cluster_state_uuid(const char* str);
+
+/* Filters out --wsrep-new-cluster oprtion from argv[]
+ * should be called in the very beginning of main() */
+void wsrep_filter_new_cluster (int* argc, char* argv[]);
-int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope);
int wsrep_init();
void wsrep_deinit(bool free_options);
@@ -144,83 +176,107 @@ bool wsrep_before_SE(); // initialize wsrep before storage
* @param before wsrep_before_SE() value */
void wsrep_init_startup(bool before);
+/* Recover streaming transactions from fragment storage */
+void wsrep_recover_sr_from_storage(THD *);
+
// Other wsrep global variables
extern my_bool wsrep_inited; // whether wsrep is initialized ?
-
-extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode);
-extern "C" void wsrep_thd_set_query_state(
- THD *thd, enum wsrep_query_state state);
-
-extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id);
-
+extern "C" void wsrep_fire_rollbacker(THD *thd);
extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd);
extern "C" time_t wsrep_thd_query_start(THD *thd);
-extern "C" query_id_t wsrep_thd_query_id(THD *thd);
+extern void wsrep_close_client_connections(my_bool wait_to_end,
+ THD *except_caller_thd= NULL);
extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd);
extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id);
-extern void wsrep_close_client_connections(my_bool wait_to_end);
extern int wsrep_wait_committing_connections_close(int wait_time);
extern void wsrep_close_applier(THD *thd);
extern void wsrep_wait_appliers_close(THD *thd);
extern void wsrep_close_applier_threads(int count);
extern void wsrep_kill_mysql(THD *thd);
+
/* new defines */
extern void wsrep_stop_replication(THD *thd);
extern bool wsrep_start_replication();
-extern bool wsrep_must_sync_wait(THD* thd, uint mask = WSREP_SYNC_WAIT_BEFORE_READ);
-extern bool wsrep_sync_wait(THD* thd, uint mask = WSREP_SYNC_WAIT_BEFORE_READ);
+extern void wsrep_shutdown_replication();
+extern bool wsrep_must_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ);
+extern bool wsrep_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ);
+extern enum wsrep::provider::status
+wsrep_sync_wait_upto (THD* thd, wsrep_gtid_t* upto, int timeout);
+extern void wsrep_last_committed_id (wsrep_gtid_t* gtid);
extern int wsrep_check_opts();
extern void wsrep_prepend_PATH (const char* path);
/* Other global variables */
extern wsrep_seqno_t wsrep_locked_seqno;
-
#define WSREP_ON \
- (global_system_variables.wsrep_on)
-
-#define WSREP_ON_NEW \
((global_system_variables.wsrep_on) && \
wsrep_provider && \
strcmp(wsrep_provider, WSREP_NONE))
-#define WSREP(thd) \
+/* use xxxxxx_NNULL macros when thd pointer is guaranteed to be non-null to
+ * avoid compiler warnings (GCC 6 and later) */
+#define WSREP_NNULL(thd) \
(WSREP_ON && thd->variables.wsrep_on)
+#define WSREP(thd) \
+ (thd && WSREP_NNULL(thd))
+
+#define WSREP_CLIENT_NNULL(thd) \
+ (WSREP_NNULL(thd) && thd->wsrep_client_thread)
+
#define WSREP_CLIENT(thd) \
(WSREP(thd) && thd->wsrep_client_thread)
+#define WSREP_EMULATE_BINLOG_NNULL(thd) \
+ (WSREP_NNULL(thd) && wsrep_emulate_bin_log)
+
#define WSREP_EMULATE_BINLOG(thd) \
(WSREP(thd) && wsrep_emulate_bin_log)
-#define WSREP_FORMAT(my_format) \
- ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) \
- ? wsrep_forced_binlog_format : (ulong)(my_format))
+#define WSREP_BINLOG_FORMAT(my_format) \
+ ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \
+ wsrep_forced_binlog_format : my_format)
// prefix all messages with "WSREP"
-void wsrep_log(void (*fun)(const char *, ...), const char *format, ...);
-#define WSREP_LOG(fun, ...) wsrep_log(fun, ## __VA_ARGS__)
-#define WSREP_LOG_CONFLICT_THD(thd, role) \
- WSREP_LOG(sql_print_information, \
- "%s: \n " \
- " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \
- " SQL: %s", \
- role, thd_get_thread_id(thd), wsrep_thd_exec_mode_str(thd), \
- wsrep_thd_query_state_str(thd), \
- wsrep_thd_conflict_state_str(thd), (long long)wsrep_thd_trx_seqno(thd), \
- wsrep_thd_query(thd) \
- );
-
-#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \
- if (wsrep_debug || wsrep_log_conflicts) \
- { \
- WSREP_LOG(sql_print_information, "cluster conflict due to %s for threads:",\
- (bf_abort) ? "high priority abort" : "certification failure" \
- ); \
- if (bf_thd != NULL) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \
- if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \
+#define WSREP_LOG(fun, ...) \
+ do { \
+ char msg[1024]= {'\0'}; \
+ snprintf(msg, sizeof(msg) - 1, ## __VA_ARGS__); \
+ fun("WSREP: %s", msg); \
+ } while(0)
+
+#define WSREP_DEBUG(...) \
+ if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
+#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
+#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
+#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
+
+#define WSREP_LOG_CONFLICT_THD(thd, role) \
+ WSREP_LOG(sql_print_information, \
+ "%s: \n " \
+ " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \
+ " SQL: %s", \
+ role, \
+ thd_get_thread_id(thd), \
+ wsrep_thd_client_mode_str(thd), \
+ wsrep_thd_client_state_str(thd), \
+ wsrep_thd_transaction_state_str(thd), \
+ wsrep_thd_trx_seqno(thd), \
+ wsrep_thd_query(thd) \
+ );
+
+#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \
+ if (wsrep_debug || wsrep_log_conflicts) \
+ { \
+ WSREP_LOG(sql_print_information, "cluster conflict due to %s for threads:", \
+ (bf_abort) ? "high priority abort" : "certification failure" \
+ ); \
+ if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \
+ if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \
+ WSREP_LOG(sql_print_information, "context: %s:%d", __FILE__, __LINE__); \
}
#define WSREP_PROVIDER_EXISTS \
@@ -233,15 +289,6 @@ extern void wsrep_ready_wait();
class Ha_trx_info;
struct THD_TRANS;
-void wsrep_register_hton(THD* thd, bool all);
-void wsrep_brute_force_killer(THD *thd);
-int wsrep_hire_brute_force_killer(THD *thd, uint64_t trx_id);
-
-/* this is visible for client build so that innodb plugin gets this */
-typedef struct wsrep_aborting_thd {
- struct wsrep_aborting_thd *next;
- THD *aborting_thd;
-} *wsrep_aborting_thd_t;
extern mysql_mutex_t LOCK_wsrep_ready;
extern mysql_cond_t COND_wsrep_ready;
@@ -249,24 +296,26 @@ extern mysql_mutex_t LOCK_wsrep_sst;
extern mysql_cond_t COND_wsrep_sst;
extern mysql_mutex_t LOCK_wsrep_sst_init;
extern mysql_cond_t COND_wsrep_sst_init;
-extern mysql_mutex_t LOCK_wsrep_rollback;
-extern mysql_cond_t COND_wsrep_rollback;
extern int wsrep_replaying;
extern mysql_mutex_t LOCK_wsrep_replaying;
extern mysql_cond_t COND_wsrep_replaying;
extern mysql_mutex_t LOCK_wsrep_slave_threads;
extern mysql_mutex_t LOCK_wsrep_desync;
+extern mysql_mutex_t LOCK_wsrep_SR_pool;
+extern mysql_mutex_t LOCK_wsrep_SR_store;
+extern mysql_mutex_t LOCK_wsrep_thd_pool;
extern mysql_mutex_t LOCK_wsrep_config_state;
-extern wsrep_aborting_thd_t wsrep_aborting_thd;
extern my_bool wsrep_emulate_bin_log;
extern int wsrep_to_isolation;
#ifdef GTID_SUPPORT
extern rpl_sidno wsrep_sidno;
#endif /* GTID_SUPPORT */
extern my_bool wsrep_preordered_opt;
-extern handlerton *wsrep_hton;
#ifdef HAVE_PSI_INTERFACE
+
+extern PSI_cond_key key_COND_wsrep_thd;
+
extern PSI_mutex_key key_LOCK_wsrep_ready;
extern PSI_mutex_key key_COND_wsrep_ready;
extern PSI_mutex_key key_LOCK_wsrep_sst;
@@ -275,12 +324,16 @@ extern PSI_mutex_key key_LOCK_wsrep_sst_init;
extern PSI_cond_key key_COND_wsrep_sst_init;
extern PSI_mutex_key key_LOCK_wsrep_sst_thread;
extern PSI_cond_key key_COND_wsrep_sst_thread;
-extern PSI_mutex_key key_LOCK_wsrep_rollback;
-extern PSI_cond_key key_COND_wsrep_rollback;
extern PSI_mutex_key key_LOCK_wsrep_replaying;
extern PSI_cond_key key_COND_wsrep_replaying;
extern PSI_mutex_key key_LOCK_wsrep_slave_threads;
extern PSI_mutex_key key_LOCK_wsrep_desync;
+extern PSI_mutex_key key_LOCK_wsrep_SR_pool;
+extern PSI_mutex_key key_LOCK_wsrep_SR_store;
+extern PSI_mutex_key key_LOCK_wsrep_thd_pool;
+extern PSI_mutex_key key_LOCK_wsrep_global_seqno;
+extern PSI_mutex_key key_LOCK_wsrep_thd_queue;
+extern PSI_cond_key key_COND_wsrep_thd_queue;
extern PSI_file_key key_file_wsrep_gra_log;
#endif /* HAVE_PSI_INTERFACE */
@@ -288,41 +341,33 @@ struct TABLE_LIST;
class Alter_info;
int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
const TABLE_LIST* table_list,
- Alter_info* alter_info = NULL);
+ Alter_info* alter_info= NULL);
+
void wsrep_to_isolation_end(THD *thd);
-void wsrep_cleanup_transaction(THD *thd);
+
+bool wsrep_append_SR_keys(THD *thd);
int wsrep_to_buf_helper(
THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len);
+int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len);
-extern bool
-wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
- MDL_ticket *ticket,
- const MDL_key *key);
-IO_CACHE * get_trans_log(THD * thd);
-bool wsrep_trans_cache_is_empty(THD *thd);
-void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end);
-void thd_binlog_rollback_stmt(THD * thd);
-void thd_binlog_trx_reset(THD * thd);
+bool wsrep_stmt_rollback_is_safe(THD* thd);
-typedef void (*wsrep_thd_processor_fun)(THD *);
-pthread_handler_t start_wsrep_THD(void *arg);
-int wsrep_wait_committing_connections_close(int wait_time);
-void wsrep_close_client_connections(my_bool wait_to_end);
-void wsrep_close_applier(THD *thd);
-void wsrep_close_applier_threads(int count);
-void wsrep_wait_appliers_close(THD *thd);
-void wsrep_kill_mysql(THD *thd);
-void wsrep_close_threads(THD *thd);
-void wsrep_copy_query(THD *thd);
-bool wsrep_is_show_query(enum enum_sql_command command);
-void wsrep_replay_transaction(THD *thd);
-bool wsrep_create_like_table(THD* thd, TABLE_LIST* table,
- TABLE_LIST* src_table,
- HA_CREATE_INFO *create_info);
+void wsrep_init_sidno(const wsrep_uuid_t&);
bool wsrep_node_is_donor();
bool wsrep_node_is_synced();
+void wsrep_init_SR();
+void wsrep_verify_SE_checkpoint(const wsrep_uuid_t& uuid, wsrep_seqno_t seqno);
+int wsrep_replay_from_SR_store(THD*, const wsrep_trx_meta_t&);
+void wsrep_node_uuid(wsrep_uuid_t&);
+
+class Log_event;
+int wsrep_ignored_error_code(Log_event* ev, int error);
+int wsrep_must_ignore_error(THD* thd);
+
+bool wsrep_replicate_GTID(THD* thd);
+
typedef struct wsrep_key_arr
{
wsrep_key_t* keys;
@@ -335,38 +380,125 @@ bool wsrep_prepare_keys_for_isolation(THD* thd,
wsrep_key_arr_t* ka);
void wsrep_keys_free(wsrep_key_arr_t* key_arr);
-#define WSREP_BINLOG_FORMAT(my_format) \
- ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \
- wsrep_forced_binlog_format : my_format)
+extern void
+wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
+ MDL_ticket *ticket,
+ const MDL_key *key);
+IO_CACHE * get_trans_log(THD * thd);
+bool wsrep_trans_cache_is_empty(THD *thd);
+void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end);
+void thd_binlog_rollback_stmt(THD * thd);
+void thd_binlog_trx_reset(THD * thd);
+
+typedef void (*wsrep_thd_processor_fun)(THD*, void *);
+class Wsrep_thd_args
+{
+ public:
+ Wsrep_thd_args(wsrep_thd_processor_fun fun, void* args)
+ :
+ fun_ (fun),
+ args_(args)
+ { }
+
+ wsrep_thd_processor_fun fun() { return fun_; }
+
+ void* args() { return args_; }
+
+ private:
+
+ Wsrep_thd_args(const Wsrep_thd_args&);
+ Wsrep_thd_args& operator=(const Wsrep_thd_args&);
+
+ wsrep_thd_processor_fun fun_;
+ void* args_;
+};
+
+void* start_wsrep_THD(void*);
-#else /* WITH_WSREP */
+void wsrep_close_threads(THD *thd);
+bool wsrep_is_show_query(enum enum_sql_command command);
+void wsrep_replay_transaction(THD *thd);
+bool wsrep_create_like_table(THD* thd, TABLE_LIST* table,
+ TABLE_LIST* src_table,
+ HA_CREATE_INFO *create_info);
+bool wsrep_node_is_donor();
+bool wsrep_node_is_synced();
+
+/**
+ * Check if the wsrep provider (ie the Galera library) is capable of
+ * doing streaming replication.
+ * @return true if SR capable
+ */
+bool wsrep_provider_is_SR_capable();
+
+/**
+ * Mark current commit ordered if binlogging is not enabled.
+ *
+ * The purpose of this function is to leave commit order critical
+ * section if binlog is not enabled.
+ *
+ * The function can be called from inside storage engine during commit.
+ * Binlog options are checked inside the function.
+ *
+ * @return Zero in case of success, non-zero in case of failure.
+ */
+int wsrep_ordered_commit_if_no_binlog(THD*, bool);
+
+/**
+ * Commit the current transaction with the
+ * MySQL "Transaction Coordinator Log" (see `class TC_LOG` in sql/log.h).
+ * Calling this function will generate and assign a new wsrep transaction id
+ * for `thd`.
+ * @return WSREP_OK on success or other WSREP_* error code on failure
+ */
+wsrep_status_t wsrep_tc_log_commit(THD* thd);
+
+/**
+ * Initialize WSREP server instance.
+ *
+ * @return Zero on success, non-zero on error.
+ */
+int wsrep_init_server();
+
+/**
+ * Initialize WSREP globals. This should be done after server initialization
+ * is complete and the server has joined to the cluster.
+ *
+ */
+void wsrep_init_globals();
+
+/**
+ * Deinit and release WSREP resources.
+ */
+void wsrep_deinit_server();
+
+/**
+ * Convert streaming fragment unit (WSREP_FRAG_BYTES, WSREP_FRAG_ROWS...)
+ * to corresponding wsrep-lib fragment_unit
+ */
+enum wsrep::streaming_context::fragment_unit wsrep_fragment_unit(ulong unit);
+
+#else /* !WITH_WSREP */
+
+/* These macros are needed to compile MariaDB without WSREP support
+ * (e.g. embedded) */
#define WSREP(T) (0)
#define WSREP_ON (0)
#define WSREP_EMULATE_BINLOG(thd) (0)
-#define WSREP_CLIENT(thd) (0)
-#define WSREP_FORMAT(my_format) ((ulong)my_format)
+#define WSREP_EMULATE_BINLOG_NNULL(thd) (0)
+#define WSREP_BINLOG_FORMAT(my_format) ((ulong)my_format)
#define WSREP_PROVIDER_EXISTS (0)
#define wsrep_emulate_bin_log (0)
#define wsrep_to_isolation (0)
-#define wsrep_init() (1)
-#define wsrep_prepend_PATH(X)
#define wsrep_before_SE() (0)
#define wsrep_init_startup(X)
-#define wsrep_must_sync_wait(...) (0)
-#define wsrep_sync_wait(...) (0)
-#define wsrep_to_isolation_begin(...) (0)
-#define wsrep_register_hton(...) do { } while(0)
#define wsrep_check_opts() (0)
-#define wsrep_stop_replication(X) do { } while(0)
-#define wsrep_inited (0)
-#define wsrep_deinit(X) do { } while(0)
-#define wsrep_recover() do { } while(0)
-#define wsrep_slave_threads (1)
-#define wsrep_replicate_myisam (0)
#define wsrep_thr_init() do {} while(0)
#define wsrep_thr_deinit() do {} while(0)
-#define wsrep_running_threads (0)
-#define WSREP_BINLOG_FORMAT(my_format) my_format
+#define wsrep_init_globals() do {} while(0)
+#define wsrep_create_appliers(X) do {} while(0)
+
#endif /* WITH_WSREP */
+
#endif /* WSREP_MYSQLD_H */
diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc
index 92bcc8eda43..ad94aecb6b4 100644
--- a/sql/wsrep_notify.cc
+++ b/sql/wsrep_notify.cc
@@ -18,22 +18,8 @@
#include "wsrep_priv.h"
#include "wsrep_utils.h"
-
-static const char* _status_str(wsrep_member_status_t status)
-{
- switch (status)
- {
- case WSREP_MEMBER_UNDEFINED: return "Undefined";
- case WSREP_MEMBER_JOINER: return "Joiner";
- case WSREP_MEMBER_DONOR: return "Donor";
- case WSREP_MEMBER_JOINED: return "Joined";
- case WSREP_MEMBER_SYNCED: return "Synced";
- default: return "Error(?)";
- }
-}
-
-void wsrep_notify_status (wsrep_member_status_t status,
- const wsrep_view_info_t* view)
+void wsrep_notify_status(enum wsrep::server_state::state status,
+ const wsrep::view* view)
{
if (!wsrep_notify_cmd || 0 == strlen(wsrep_notify_cmd))
{
@@ -42,51 +28,44 @@ void wsrep_notify_status (wsrep_member_status_t status,
}
char cmd_buf[1 << 16]; // this can be long
- long cmd_len = sizeof(cmd_buf) - 1;
- char* cmd_ptr = cmd_buf;
- long cmd_off = 0;
+ long cmd_len= sizeof(cmd_buf) - 1;
+ char* cmd_ptr= cmd_buf;
+ long cmd_off= 0;
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, "%s",
wsrep_notify_cmd);
- if (status >= WSREP_MEMBER_UNDEFINED && status < WSREP_MEMBER_ERROR)
- {
- cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --status %s",
- _status_str(status));
- }
- else
- {
- /* here we preserve provider error codes */
- cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
- " --status 'Error(%d)'", status);
- }
+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --status %s",
+ to_c_string(status));
- if (0 != view)
+ if (view != NULL)
{
- char uuid_str[40];
-
- wsrep_uuid_print (&view->state_id.uuid, uuid_str, sizeof(uuid_str));
+ std::ostringstream uuid;
+ uuid << view->state_id().id();
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
- " --uuid %s", uuid_str);
+ " --uuid %s", uuid.str().c_str());
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
- " --primary %s", view->view >= 0 ? "yes" : "no");
+ " --primary %s", view->view_seqno().get() >= 0 ? "yes" : "no");
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
- " --index %d", view->my_idx);
+ " --index %ld", view->own_index());
- if (view->memb_num)
+ const std::vector<wsrep::view::member>& members(view->members());
+ if (members.size())
{
- cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --members");
-
- for (int i = 0; i < view->memb_num; i++)
- {
- wsrep_uuid_print (&view->members[i].id, uuid_str, sizeof(uuid_str));
- cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
- "%c%s/%s/%s", i > 0 ? ',' : ' ',
- uuid_str, view->members[i].name,
- view->members[i].incoming);
- }
+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --members");
+
+ for (unsigned int i= 0; i < members.size(); i++)
+ {
+ std::ostringstream id;
+ id << members[i].id();
+ cmd_off += snprintf(cmd_ptr + cmd_off, cmd_len - cmd_off,
+ "%c%s/%s/%s", i > 0 ? ',' : ' ',
+ id.str().c_str(),
+ members[i].name().c_str(),
+ members[i].incoming().c_str());
+ }
}
}
@@ -100,7 +79,7 @@ void wsrep_notify_status (wsrep_member_status_t status,
wsp::process p(cmd_ptr, "r", NULL);
p.wait();
- int err = p.error();
+ int err= p.error();
if (err)
{
diff --git a/sql/wsrep_plugin.cc b/sql/wsrep_plugin.cc
new file mode 100644
index 00000000000..743b8a593b8
--- /dev/null
+++ b/sql/wsrep_plugin.cc
@@ -0,0 +1,53 @@
+/* Copyright 2016 Codership Oy <http://www.codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "wsrep_trans_observer.h"
+#include "wsrep_mysqld.h"
+
+#include <mysql/plugin.h>
+
+static int wsrep_plugin_init(void *p)
+{
+ WSREP_DEBUG("wsrep_plugin_init()");
+ return 0;
+}
+
+static int wsrep_plugin_deinit(void *p)
+{
+ WSREP_DEBUG("wsrep_plugin_deinit()");
+ return 0;
+}
+
+struct Mysql_replication wsrep_plugin= {
+ MYSQL_REPLICATION_INTERFACE_VERSION
+};
+
+maria_declare_plugin(wsrep)
+{
+ MYSQL_REPLICATION_PLUGIN,
+ &wsrep_plugin,
+ "wsrep",
+ "Codership Oy",
+ "Wsrep replication plugin",
+ PLUGIN_LICENSE_GPL,
+ wsrep_plugin_init,
+ wsrep_plugin_deinit,
+ 0x0100,
+ NULL, /* Status variables */
+ NULL, /* System variables */
+ "1.0", /* Version (string) */
+ MariaDB_PLUGIN_MATURITY_STABLE /* Maturity */
+}
+maria_declare_plugin_end;
diff --git a/sql/wsrep_priv.h b/sql/wsrep_priv.h
index 222a49cc2ab..68773d27948 100644
--- a/sql/wsrep_priv.h
+++ b/sql/wsrep_priv.h
@@ -19,8 +19,9 @@
#ifndef WSREP_PRIV_H
#define WSREP_PRIV_H
+#include <my_global.h>
#include "wsrep_mysqld.h"
-#include "../wsrep/wsrep_api.h"
+#include "wsrep_schema.h"
#include <log.h>
#include <pthread.h>
@@ -31,25 +32,20 @@ my_bool wsrep_ready_set (my_bool x);
ssize_t wsrep_sst_prepare (void** msg);
wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx,
void* recv_ctx,
- const void* msg, size_t msg_len,
+ const wsrep_buf_t* msg,
const wsrep_gtid_t* state_id,
- const char* state, size_t state_len,
+ const wsrep_buf_t* state,
bool bypass);
extern wsrep_uuid_t local_uuid;
extern wsrep_seqno_t local_seqno;
+extern Wsrep_schema* wsrep_schema;
// a helper function
-bool wsrep_sst_received (wsrep_t* const wsrep,
- const wsrep_uuid_t& uuid,
- const wsrep_seqno_t seqno,
- const void* const state,
- const size_t state_len,
- const bool implicit);
-/*! SST thread signals init thread about sst completion */
-void wsrep_sst_complete(const wsrep_uuid_t*, wsrep_seqno_t, bool);
-
-void wsrep_notify_status (wsrep_member_status_t new_status,
- const wsrep_view_info_t* view = 0);
+void wsrep_sst_received(THD*, const wsrep_uuid_t&, wsrep_seqno_t,
+ const void*, size_t);
+
+void wsrep_notify_status(enum wsrep::server_state::state status,
+ const wsrep::view* view= 0);
#endif /* WSREP_PRIV_H */
diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc
new file mode 100644
index 00000000000..98f17e41c94
--- /dev/null
+++ b/sql/wsrep_schema.cc
@@ -0,0 +1,1360 @@
+/* Copyright (C) 2015-2017 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "mariadb.h"
+
+#include "table.h"
+#include "key.h"
+#include "sql_base.h"
+#include "sql_parse.h"
+#include "sql_update.h"
+#include "transaction.h"
+
+#include "mysql/service_wsrep.h"
+#include "wsrep_schema.h"
+#include "wsrep_applier.h"
+#include "wsrep_xid.h"
+#include "wsrep_binlog.h"
+#include "wsrep_high_priority_service.h"
+#include "wsrep_storage_service.h"
+
+#include <string>
+#include <sstream>
+
+#define WSREP_SCHEMA "mysql"
+#define WSREP_STREAMING_TABLE "wsrep_streaming_log"
+#define WSREP_CLUSTER_TABLE "wsrep_cluster"
+#define WSREP_MEMBERS_TABLE "wsrep_cluster_members"
+
+const char* wsrep_sr_table_name_full= WSREP_SCHEMA "/" WSREP_STREAMING_TABLE;
+
+static const std::string wsrep_schema_str= WSREP_SCHEMA;
+static const std::string sr_table_str= WSREP_STREAMING_TABLE;
+static const std::string cluster_table_str= WSREP_CLUSTER_TABLE;
+static const std::string members_table_str= WSREP_MEMBERS_TABLE;
+
+static const std::string create_cluster_table_str=
+ "CREATE TABLE IF NOT EXISTS " + wsrep_schema_str + "." + cluster_table_str +
+ "("
+ "cluster_uuid CHAR(36) PRIMARY KEY,"
+ "view_id BIGINT NOT NULL,"
+ "view_seqno BIGINT NOT NULL,"
+ "protocol_version INT NOT NULL,"
+ "capabilities INT NOT NULL"
+ ") ENGINE=InnoDB";
+
+static const std::string create_members_table_str=
+ "CREATE TABLE IF NOT EXISTS " + wsrep_schema_str + "." + members_table_str +
+ "("
+ "node_uuid CHAR(36) PRIMARY KEY,"
+ "cluster_uuid CHAR(36) NOT NULL,"
+ "node_name CHAR(32) NOT NULL,"
+ "node_incoming_address VARCHAR(256) NOT NULL"
+ ") ENGINE=InnoDB";
+
+#ifdef WSREP_SCHEMA_MEMBERS_HISTORY
+static const std::string cluster_member_history_table_str= "wsrep_cluster_member_history";
+static const std::string create_members_history_table_str=
+ "CREATE TABLE IF NOT EXISTS " + wsrep_schema_str + "." + cluster_member_history_table_str +
+ "("
+ "node_uuid CHAR(36) PRIMARY KEY,"
+ "cluster_uuid CHAR(36) NOT NULL,"
+ "last_view_id BIGINT NOT NULL,"
+ "last_view_seqno BIGINT NOT NULL,"
+ "node_name CHAR(32) NOT NULL,"
+ "node_incoming_address VARCHAR(256) NOT NULL"
+ ") ENGINE=InnoDB";
+#endif /* WSREP_SCHEMA_MEMBERS_HISTORY */
+
+static const std::string create_frag_table_str=
+ "CREATE TABLE IF NOT EXISTS " + wsrep_schema_str + "." + sr_table_str +
+ "("
+ "node_uuid CHAR(36), "
+ "trx_id BIGINT, "
+ "seqno BIGINT, "
+ "flags INT NOT NULL, "
+ "frag LONGBLOB NOT NULL, "
+ "PRIMARY KEY (node_uuid, trx_id, seqno)"
+ ") ENGINE=InnoDB";
+
+static const std::string delete_from_cluster_table=
+ "DELETE FROM " + wsrep_schema_str + "." + cluster_table_str;
+
+static const std::string delete_from_members_table=
+ "DELETE FROM " + wsrep_schema_str + "." + members_table_str;
+
+namespace Wsrep_schema_impl
+{
+
+class binlog_off
+{
+public:
+ binlog_off(THD* thd)
+ : m_thd(thd)
+ , m_option_bits(thd->variables.option_bits)
+ , m_sql_log_bin(thd->variables.sql_log_bin)
+ {
+ thd->variables.option_bits&= ~OPTION_BIN_LOG;
+ thd->variables.sql_log_bin= 0;
+ }
+ ~binlog_off()
+ {
+ m_thd->variables.option_bits= m_option_bits;
+ m_thd->variables.sql_log_bin= m_sql_log_bin;
+ }
+private:
+ THD* m_thd;
+ ulonglong m_option_bits;
+ my_bool m_sql_log_bin;
+};
+
+class wsrep_off
+{
+public:
+ wsrep_off(THD* thd)
+ : m_thd(thd)
+ , m_wsrep_on(thd->variables.wsrep_on)
+ {
+ thd->variables.wsrep_on= 0;
+ }
+ ~wsrep_off()
+ {
+ m_thd->variables.wsrep_on= m_wsrep_on;
+ }
+private:
+ THD* m_thd;
+ my_bool m_wsrep_on;
+};
+
+class thd_context_switch
+{
+public:
+ thd_context_switch(THD *orig_thd, THD *cur_thd)
+ : m_orig_thd(orig_thd)
+ , m_cur_thd(cur_thd)
+ {
+ m_orig_thd->reset_globals();
+ m_cur_thd->store_globals();
+ }
+ ~thd_context_switch()
+ {
+ m_cur_thd->reset_globals();
+ m_orig_thd->store_globals();
+ }
+private:
+ THD *m_orig_thd;
+ THD *m_cur_thd;
+};
+
+static int execute_SQL(THD* thd, const char* sql, uint length) {
+ DBUG_ENTER("Wsrep_schema::execute_SQL()");
+ int err= 0;
+
+ PSI_statement_locker *parent_locker= thd->m_statement_psi;
+ Parser_state parser_state;
+
+ WSREP_DEBUG("SQL: %d %s thd: %lld", length, sql, (long long)thd->thread_id);
+
+ if (parser_state.init(thd, (char*)sql, length) == 0) {
+ thd->reset_for_next_command();
+ lex_start(thd);
+
+ thd->m_statement_psi= NULL;
+
+ thd->set_query((char*)sql, length);
+ thd->set_query_id(next_query_id());
+
+ mysql_parse(thd, (char*)sql, length, & parser_state, FALSE, FALSE);
+
+ if (thd->is_error()) {
+ WSREP_WARN("Wsrep_schema::execute_sql() failed, %d %s\nSQL: %s",
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->message(),
+ sql);
+ err= 1;
+ }
+ thd->m_statement_psi= parent_locker;
+ thd->end_statement();
+ thd->reset_query();
+ close_thread_tables(thd);
+ delete_explain_query(thd->lex);
+ }
+ else {
+ WSREP_WARN("SR init failure");
+ }
+ thd->cleanup_after_query();
+ DBUG_RETURN(err);
+}
+
+/*
+ Initialize thd for next "statement"
+ */
+static void init_stmt(THD* thd) {
+ thd->reset_for_next_command();
+}
+
+static void finish_stmt(THD* thd) {
+ trans_commit_stmt(thd);
+ close_thread_tables(thd);
+}
+
+static int open_table(THD* thd,
+ const LEX_CSTRING *schema_name,
+ const LEX_CSTRING *table_name,
+ enum thr_lock_type const lock_type,
+ TABLE** table) {
+ assert(table);
+ *table= NULL;
+
+ DBUG_ENTER("Wsrep_schema::open_table()");
+
+ TABLE_LIST tables;
+ uint flags= (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
+ MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |
+ MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_LOCK_IGNORE_TIMEOUT);
+
+ tables.init_one_table(schema_name,
+ table_name,
+ NULL, lock_type);
+
+ if (!open_n_lock_single_table(thd, &tables, tables.lock_type, flags)) {
+ close_thread_tables(thd);
+ my_error(ER_NO_SUCH_TABLE, MYF(0), schema_name->str, table_name->str);
+ DBUG_RETURN(1);
+ }
+
+ *table= tables.table;
+ (*table)->use_all_columns();
+
+ DBUG_RETURN(0);
+}
+
+
+static int open_for_write(THD* thd, const char* table_name, TABLE** table) {
+ LEX_CSTRING schema_str= { wsrep_schema_str.c_str(), wsrep_schema_str.length() };
+ LEX_CSTRING table_str= { table_name, strlen(table_name) };
+ if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_WRITE,
+ table)) {
+ WSREP_ERROR("Failed to open table %s.%s for writing",
+ schema_str.str, table_name);
+ return 1;
+ }
+ empty_record(*table);
+ (*table)->use_all_columns();
+ restore_record(*table, s->default_values);
+ return 0;
+}
+
+static void store(TABLE* table, uint field, const Wsrep_id& id) {
+ assert(field < table->s->fields);
+ std::ostringstream os;
+ os << id;
+ table->field[field]->store(os.str().c_str(),
+ os.str().size(),
+ &my_charset_bin);
+}
+
+
+template <typename INTTYPE>
+static void store(TABLE* table, uint field, const INTTYPE val) {
+ assert(field < table->s->fields);
+ table->field[field]->store(val);
+}
+
+template <typename CHARTYPE>
+static void store(TABLE* table, uint field, const CHARTYPE* str, size_t str_len) {
+ assert(field < table->s->fields);
+ table->field[field]->store((const char*)str,
+ str_len,
+ &my_charset_bin);
+}
+
+static void store(TABLE* table, uint field, const std::string& str)
+{
+ store(table, field, str.c_str(), str.size());
+}
+
+static int update_or_insert(TABLE* table) {
+ DBUG_ENTER("Wsrep_schema::update_or_insert()");
+ int ret= 0;
+ char* key;
+ int error;
+
+ /*
+ Verify that the table has primary key defined.
+ */
+ if (table->s->primary_key >= MAX_KEY ||
+ !table->s->keys_in_use.is_set(table->s->primary_key)) {
+ WSREP_ERROR("No primary key for %s.%s",
+ table->s->db.str, table->s->table_name.str);
+ DBUG_RETURN(1);
+ }
+
+ /*
+ Find the record and update or insert a new one if not found.
+ */
+ if (!(key= (char*) my_safe_alloca(table->s->max_unique_length))) {
+ WSREP_ERROR("Error allocating %ud bytes for key",
+ table->s->max_unique_length);
+ DBUG_RETURN(1);
+ }
+
+ key_copy((uchar*) key, table->record[0],
+ table->key_info + table->s->primary_key, 0);
+
+ if ((error= table->file->ha_index_read_idx_map(table->record[1],
+ table->s->primary_key,
+ (uchar*) key,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT))) {
+ /*
+ Row not found, insert a new one.
+ */
+ if ((error= table->file->ha_write_row(table->record[0]))) {
+ WSREP_ERROR("Error writing into %s.%s: %d",
+ table->s->db.str,
+ table->s->table_name.str,
+ error);
+ ret= 1;
+ }
+ }
+ else if (!records_are_comparable(table) || compare_record(table)) {
+ /*
+ Record has changed
+ */
+ if ((error= table->file->ha_update_row(table->record[1],
+ table->record[0])) &&
+ error != HA_ERR_RECORD_IS_THE_SAME) {
+ WSREP_ERROR("Error updating record in %s.%s: %d",
+ table->s->db.str,
+ table->s->table_name.str,
+ error);
+ ret= 1;
+ }
+ }
+
+ my_safe_afree(key, table->s->max_unique_length);
+
+ DBUG_RETURN(ret);
+}
+
+static int insert(TABLE* table) {
+ DBUG_ENTER("Wsrep_schema::insert()");
+ int ret= 0;
+ int error;
+
+ /*
+ Verify that the table has primary key defined.
+ */
+ if (table->s->primary_key >= MAX_KEY ||
+ !table->s->keys_in_use.is_set(table->s->primary_key)) {
+ WSREP_ERROR("No primary key for %s.%s",
+ table->s->db.str, table->s->table_name.str);
+ DBUG_RETURN(1);
+ }
+
+ if ((error= table->file->ha_write_row(table->record[0]))) {
+ WSREP_ERROR("Error writing into %s.%s: %d",
+ table->s->db.str,
+ table->s->table_name.str,
+ error);
+ ret= 1;
+ }
+
+ DBUG_RETURN(ret);
+}
+
+static int delete_row(TABLE* table) {
+ int error;
+ int retry= 3;
+
+ do {
+ error= table->file->ha_delete_row(table->record[0]);
+ retry--;
+ } while (error && retry);
+
+ if (error) {
+ WSREP_ERROR("Error deleting row from %s.%s: %d",
+ table->s->db.str,
+ table->s->table_name.str,
+ error);
+ return 1;
+ }
+ return 0;
+}
+
+static int open_for_read(THD* thd, const char* table_name, TABLE** table) {
+
+ LEX_CSTRING schema_str= { wsrep_schema_str.c_str(), wsrep_schema_str.length() };
+ LEX_CSTRING table_str= { table_name, strlen(table_name) };
+ if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_READ,
+ table)) {
+ WSREP_ERROR("Failed to open table %s.%s for reading",
+ schema_str.str, table_name);
+ return 1;
+ }
+ empty_record(*table);
+ (*table)->use_all_columns();
+ restore_record(*table, s->default_values);
+ return 0;
+}
+
+/*
+ Init table for sequential scan.
+
+ @return 0 in case of success, 1 in case of error.
+ */
+static int init_for_scan(TABLE* table) {
+ int error;
+ if ((error= table->file->ha_rnd_init(TRUE))) {
+ WSREP_ERROR("Failed to init table for scan: %d", error);
+ return 1;
+ }
+ return 0;
+}
+/*
+ Scan next record. For return codes see handler::ha_rnd_next()
+
+ @return 0 in case of success, error code in case of error
+ */
+static int next_record(TABLE* table) {
+ int error;
+ if ((error= table->file->ha_rnd_next(table->record[0])) &&
+ error != HA_ERR_END_OF_FILE) {
+ WSREP_ERROR("Failed to read next record: %d", error);
+ }
+ return error;
+}
+
+/*
+ End scan.
+
+ @return 0 in case of success, 1 in case of error.
+ */
+static int end_scan(TABLE* table) {
+ int error;
+ if ((error= table->file->ha_rnd_end())) {
+ WSREP_ERROR("Failed to end scan: %d", error);
+ return 1;
+ }
+ return 0;
+}
+
+static int scan(TABLE* table, uint field, wsrep::id& id)
+{
+ assert(field < table->s->fields);
+ String uuid_str;
+ (void)table->field[field]->val_str(&uuid_str);
+ id= wsrep::id(std::string(uuid_str.c_ptr(), uuid_str.length()));
+ return 0;
+}
+
+template <typename INTTYPE>
+static int scan(TABLE* table, uint field, INTTYPE& val)
+{
+ assert(field < table->s->fields);
+ val= table->field[field]->val_int();
+ return 0;
+}
+
+static int scan(TABLE* table, uint field, char* strbuf, uint strbuf_len)
+{
+ String str;
+ (void)table->field[field]->val_str(&str);
+ strncpy(strbuf, str.c_ptr(), std::min(str.length(), strbuf_len));
+ strbuf[strbuf_len - 1]= '\0';
+ return 0;
+}
+
+/*
+ Scan member
+ TODO: filter members by cluster UUID
+ */
+static int scan_member(TABLE* table,
+ const Wsrep_id& cluster_uuid,
+ std::vector<Wsrep_view::member>& members)
+{
+ Wsrep_id member_id;
+ char member_name[128]= { 0, };
+ char member_incoming[128]= { 0, };
+
+ if (scan(table, 0, member_id) ||
+ scan(table, 2, member_name, sizeof(member_name)) ||
+ scan(table, 3, member_incoming, sizeof(member_incoming))) {
+ return 1;
+ }
+
+ if (members.empty() == false) {
+ assert(members.rbegin()->id() < member_id);
+ }
+
+ try {
+ members.push_back(Wsrep_view::member(member_id,
+ member_name,
+ member_incoming));
+ }
+ catch (...) {
+ WSREP_ERROR("Caught exception while scanning members table");
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ Init table for index scan and retrieve first record
+
+ @return 0 in case of success, error code in case of error.
+ */
+static int init_for_index_scan(TABLE* table, const uchar* key,
+ key_part_map map) {
+ int error;
+ if ((error= table->file->ha_index_init(table->s->primary_key, true))) {
+ WSREP_ERROR("Failed to init table for index scan: %d", error);
+ return error;
+ }
+
+ error= table->file->ha_index_read_map(table->record[0],
+ key, map, HA_READ_KEY_EXACT);
+ switch(error) {
+ case 0:
+ case HA_ERR_END_OF_FILE:
+ case HA_ERR_KEY_NOT_FOUND:
+ case HA_ERR_ABORTED_BY_USER:
+ break;
+ case -1:
+ WSREP_DEBUG("init_for_index_scan interrupted");
+ break;
+ default:
+ WSREP_ERROR("init_for_index_scan failed to read first record, error %d", error);
+ }
+ return error;
+}
+
+/*
+ End index scan.
+
+ @return 0 in case of success, 1 in case of error.
+ */
+static int end_index_scan(TABLE* table) {
+ int error;
+ if ((error= table->file->ha_index_end())) {
+ WSREP_ERROR("Failed to end scan: %d", error);
+ return 1;
+ }
+ return 0;
+}
+
+static void make_key(TABLE* table, uchar* key, key_part_map* map, int parts) {
+ uint prefix_length= 0;
+ KEY_PART_INFO* key_part= table->key_info->key_part;
+ for (int i=0; i < parts; i++)
+ prefix_length += key_part[i].store_length;
+ *map= make_prev_keypart_map(parts);
+ key_copy(key, table->record[0], table->key_info, prefix_length);
+}
+} /* namespace Wsrep_schema_impl */
+
+
+Wsrep_schema::Wsrep_schema()
+{
+}
+
+Wsrep_schema::~Wsrep_schema()
+{ }
+
+static void wsrep_init_thd_for_schema(THD *thd)
+{
+ thd->security_ctx->skip_grants();
+ thd->system_thread= SYSTEM_THREAD_GENERIC;
+
+ mysql_mutex_lock(&LOCK_thread_count);
+
+ thd->real_id=pthread_self(); // Keep purify happy
+
+ WSREP_DEBUG("Wsrep_thd_pool: creating system thread: %lld",
+ (long long)thd->thread_id);
+ thd->prior_thr_create_utime= thd->start_utime= thd->thr_create_utime;
+ (void) mysql_mutex_unlock(&LOCK_thread_count);
+
+ /* */
+ thd->variables.wsrep_on = 0;
+ /* No binlogging */
+ thd->variables.sql_log_bin = 0;
+ thd->variables.option_bits &= ~OPTION_BIN_LOG;
+ /* No general log */
+ thd->variables.option_bits |= OPTION_LOG_OFF;
+ /* Read committed isolation to avoid gap locking */
+ thd->variables.tx_isolation= ISO_READ_COMMITTED;
+ thd->store_globals();
+}
+
+int Wsrep_schema::init()
+{
+ DBUG_ENTER("Wsrep_schema::init()");
+ int ret;
+ THD* thd= new THD(next_thread_id());
+ if (!thd) {
+ WSREP_ERROR("Unable to get thd");
+ DBUG_RETURN(1);
+ }
+ thd->thread_stack= (char*)&thd;
+ wsrep_init_thd_for_schema(thd);
+
+ if (Wsrep_schema_impl::execute_SQL(thd, create_cluster_table_str.c_str(),
+ create_cluster_table_str.size()) ||
+ Wsrep_schema_impl::execute_SQL(thd, create_members_table_str.c_str(),
+ create_members_table_str.size()) ||
+#ifdef WSREP_SCHEMA_MEMBERS_HISTORY
+ Wsrep_schema_impl::execute_SQL(thd,
+ create_members_history_table_str.c_str(),
+ create_members_history_table_str.size()) ||
+#endif /* WSREP_SCHEMA_MEMBERS_HISTORY */
+ Wsrep_schema_impl::execute_SQL(thd,
+ create_frag_table_str.c_str(),
+ create_frag_table_str.size())) {
+ ret= 1;
+ }
+ else {
+ ret= 0;
+ }
+
+ delete thd;
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view)
+{
+ DBUG_ENTER("Wsrep_schema::store_view()");
+ assert(view.status() == Wsrep_view::primary);
+ int ret= 1;
+ int error;
+ TABLE* cluster_table= 0;
+ TABLE* members_table= 0;
+#ifdef WSREP_SCHEMA_MEMBERS_HISTORY
+ TABLE* members_history_table= 0;
+#endif /* WSREP_SCHEMA_MEMBERS_HISTORY */
+
+ Wsrep_schema_impl::wsrep_off wsrep_off(thd);
+ Wsrep_schema_impl::binlog_off binlog_off(thd);
+
+ /*
+ Clean up cluster table and members table.
+ */
+ if (Wsrep_schema_impl::execute_SQL(thd,
+ delete_from_cluster_table.c_str(),
+ delete_from_cluster_table.size()) ||
+ Wsrep_schema_impl::execute_SQL(thd,
+ delete_from_members_table.c_str(),
+ delete_from_members_table.size())) {
+ goto out;
+ }
+
+ /*
+ Store cluster view info
+ */
+ Wsrep_schema_impl::init_stmt(thd);
+ if (Wsrep_schema_impl::open_for_write(thd, cluster_table_str.c_str(), &cluster_table))
+ {
+ goto out;
+ }
+
+ Wsrep_schema_impl::store(cluster_table, 0, view.state_id().id());
+ Wsrep_schema_impl::store(cluster_table, 1, view.view_seqno().get());
+ Wsrep_schema_impl::store(cluster_table, 2, view.state_id().seqno().get());
+ Wsrep_schema_impl::store(cluster_table, 3, view.protocol_version());
+ Wsrep_schema_impl::store(cluster_table, 4, view.capabilities());
+
+ if ((error= Wsrep_schema_impl::update_or_insert(cluster_table)))
+ {
+ WSREP_ERROR("failed to write to cluster table: %d", error);
+ goto out;
+ }
+
+ Wsrep_schema_impl::finish_stmt(thd);
+
+ /*
+ Store info about current members
+ */
+ Wsrep_schema_impl::init_stmt(thd);
+ if (Wsrep_schema_impl::open_for_write(thd, members_table_str.c_str(),
+ &members_table))
+ {
+ WSREP_ERROR("failed to open wsrep.members table");
+ goto out;
+ }
+
+ for (size_t i= 0; i < view.members().size(); ++i)
+ {
+ Wsrep_schema_impl::store(members_table, 0, view.members()[i].id());
+ Wsrep_schema_impl::store(members_table, 1, view.state_id().id());
+ Wsrep_schema_impl::store(members_table, 2, view.members()[i].name());
+ Wsrep_schema_impl::store(members_table, 3, view.members()[i].incoming());
+ if ((error= Wsrep_schema_impl::update_or_insert(members_table)))
+ {
+ WSREP_ERROR("failed to write wsrep.members table: %d", error);
+ goto out;
+ }
+ }
+ Wsrep_schema_impl::finish_stmt(thd);
+
+#ifdef WSREP_SCHEMA_MEMBERS_HISTORY
+ /*
+ Store members history
+ */
+ Wsrep_schema_impl::init_stmt(thd);
+ if (Wsrep_schema_impl::open_for_write(thd, cluster_member_history.c_str(),
+ &members_history_table)) {
+ WSREP_ERROR("failed to open wsrep.members table");
+ goto out;
+ }
+
+ for (size_t i= 0; i < view.members().size(); ++i) {
+ Wsrep_schema_impl::store(members_history_table, 0, view.members()[i].id());
+ Wsrep_schema_impl::store(members_history_table, 1, view.state_id().id());
+ Wsrep_schema_impl::store(members_history_table, 2, view.view_seqno());
+ Wsrep_schema_impl::store(members_history_table, 3, view.state_id().seqno());
+ Wsrep_schema_impl::store(members_history_table, 4,
+ view.members()[i].name());
+ Wsrep_schema_impl::store(members_history_table, 5,
+ view.members()[i].incoming());
+ if ((error= Wsrep_schema_impl::update_or_insert(members_history_table))) {
+ WSREP_ERROR("failed to write wsrep_cluster_member_history table: %d", error);
+ goto out;
+ }
+ }
+ Wsrep_schema_impl::finish_stmt(thd);
+#endif /* WSREP_SCHEMA_MEMBERS_HISTORY */
+ ret= 0;
+ out:
+
+ DBUG_RETURN(ret);
+}
+
+Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const {
+ DBUG_ENTER("Wsrep_schema::restore_view()");
+
+ int ret= 1;
+ int error;
+
+ TABLE* cluster_table= 0;
+ bool end_cluster_scan= false;
+ TABLE* members_table= 0;
+ bool end_members_scan= false;
+
+ /* variables below need to be initialized in case cluster table is empty */
+ Wsrep_id cluster_uuid;
+ wsrep_seqno_t view_id= -1;
+ wsrep_seqno_t view_seqno= -1;
+ int my_idx= -1;
+ int proto_ver= 0;
+ wsrep_cap_t capabilities= 0;
+ std::vector<Wsrep_view::member> members;
+
+ // we don't want causal waits for reading non-replicated private data
+ int const wsrep_sync_wait_saved= thd->variables.wsrep_sync_wait;
+ thd->variables.wsrep_sync_wait= 0;
+
+ if (trans_begin(thd, MYSQL_START_TRANS_OPT_READ_ONLY)) {
+ WSREP_ERROR("wsrep_schema::restore_view(): Failed to start transaction");
+ goto out;
+ }
+
+ /*
+ Read cluster info from cluster table
+ */
+ Wsrep_schema_impl::init_stmt(thd);
+ if (Wsrep_schema_impl::open_for_read(thd, cluster_table_str.c_str(), &cluster_table) ||
+ Wsrep_schema_impl::init_for_scan(cluster_table)) {
+ goto out;
+ }
+
+ if (((error= Wsrep_schema_impl::next_record(cluster_table)) != 0 ||
+ Wsrep_schema_impl::scan(cluster_table, 0, cluster_uuid) ||
+ Wsrep_schema_impl::scan(cluster_table, 1, view_id) ||
+ Wsrep_schema_impl::scan(cluster_table, 2, view_seqno) ||
+ Wsrep_schema_impl::scan(cluster_table, 3, proto_ver) ||
+ Wsrep_schema_impl::scan(cluster_table, 4, capabilities)) &&
+ error != HA_ERR_END_OF_FILE) {
+ end_cluster_scan= true;
+ goto out;
+ }
+
+ if (Wsrep_schema_impl::end_scan(cluster_table)) {
+ goto out;
+ }
+ Wsrep_schema_impl::finish_stmt(thd);
+
+ /*
+ Read members from members table
+ */
+ Wsrep_schema_impl::init_stmt(thd);
+ if (Wsrep_schema_impl::open_for_read(thd, members_table_str.c_str(), &members_table) ||
+ Wsrep_schema_impl::init_for_scan(members_table)) {
+ goto out;
+ }
+ end_members_scan= true;
+
+ while (true) {
+ if ((error= Wsrep_schema_impl::next_record(members_table)) == 0) {
+ if (Wsrep_schema_impl::scan_member(members_table,
+ cluster_uuid,
+ members)) {
+ goto out;
+ }
+ }
+ else if (error == HA_ERR_END_OF_FILE) {
+ break;
+ }
+ else {
+ goto out;
+ }
+ }
+
+ end_members_scan= false;
+ if (Wsrep_schema_impl::end_scan(members_table)) {
+ goto out;
+ }
+ Wsrep_schema_impl::finish_stmt(thd);
+
+ if (own_id.is_undefined() == false) {
+ for (uint i= 0; i < members.size(); ++i) {
+ if (members[i].id() == own_id) {
+ my_idx= i;
+ break;
+ }
+ }
+ }
+
+ (void)trans_commit(thd);
+ ret= 0; /* Success*/
+ out:
+
+ if (end_cluster_scan) Wsrep_schema_impl::end_scan(cluster_table);
+ if (end_members_scan) Wsrep_schema_impl::end_scan(members_table);
+
+ if (0 != ret) {
+ trans_rollback_stmt(thd);
+ if (!trans_rollback(thd)) {
+ close_thread_tables(thd);
+ }
+ }
+ thd->mdl_context.release_transactional_locks();
+
+ thd->variables.wsrep_sync_wait= wsrep_sync_wait_saved;
+
+ if (0 == ret) {
+ Wsrep_view ret_view(
+ wsrep::gtid(cluster_uuid, Wsrep_seqno(view_seqno)),
+ Wsrep_seqno(view_id),
+ wsrep::view::primary,
+ capabilities,
+ my_idx,
+ proto_ver,
+ members
+ );
+
+ if (wsrep_debug) {
+ std::ostringstream os;
+ os << "Restored cluster view:\n" << ret_view;
+ WSREP_INFO("%s", os.str().c_str());
+ }
+ DBUG_RETURN(ret_view);
+ }
+ else
+ {
+ WSREP_ERROR("wsrep_schema::restore_view() failed.");
+ Wsrep_view ret_view;
+ DBUG_RETURN(ret_view);
+ }
+}
+
+int Wsrep_schema::append_fragment(THD* thd,
+ const wsrep::id& server_id,
+ wsrep::transaction_id transaction_id,
+ wsrep::seqno seqno,
+ int flags,
+ const wsrep::const_buffer& data)
+{
+ DBUG_ENTER("Wsrep_schema::append_fragment");
+ std::ostringstream os;
+ os << server_id;
+ WSREP_DEBUG("Append fragment(%llu) %s, %llu",
+ thd->thread_id,
+ os.str().c_str(),
+ transaction_id.get());
+ Wsrep_schema_impl::binlog_off binlog_off(thd);
+ Wsrep_schema_impl::init_stmt(thd);
+
+ TABLE* frag_table= 0;
+ if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table))
+ {
+ trans_rollback_stmt(thd);
+ DBUG_RETURN(1);
+ }
+
+ Wsrep_schema_impl::store(frag_table, 0, server_id);
+ Wsrep_schema_impl::store(frag_table, 1, transaction_id.get());
+ Wsrep_schema_impl::store(frag_table, 2, seqno.get());
+ Wsrep_schema_impl::store(frag_table, 3, flags);
+ Wsrep_schema_impl::store(frag_table, 4, data.data(), data.size());
+
+ int error;
+ if ((error= Wsrep_schema_impl::insert(frag_table))) {
+ WSREP_ERROR("Failed to write to frag table: %d", error);
+ trans_rollback_stmt(thd);
+ DBUG_RETURN(1);
+ }
+ Wsrep_schema_impl::finish_stmt(thd);
+ DBUG_RETURN(0);
+}
+
+int Wsrep_schema::update_fragment_meta(THD* thd,
+ const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_schema::update_fragment_meta");
+ std::ostringstream os;
+ os << ws_meta.server_id();
+ WSREP_DEBUG("update_frag_seqno(%llu) %s, %llu, seqno %lld",
+ thd->thread_id,
+ os.str().c_str(),
+ ws_meta.transaction_id().get(),
+ ws_meta.seqno().get());
+ DBUG_ASSERT(ws_meta.seqno().is_undefined() == false);
+
+ Wsrep_schema_impl::binlog_off binlog_off(thd);
+ int error;
+ uchar key[MAX_KEY_LENGTH];
+ key_part_map key_map= 0;
+ TABLE* frag_table= 0;
+
+ Wsrep_schema_impl::init_stmt(thd);
+ if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table))
+ {
+ DBUG_RETURN(1);
+ }
+
+ /* Find record with the given uuid, trx id, and seqno -1 */
+ Wsrep_schema_impl::store(frag_table, 0, ws_meta.server_id());
+ Wsrep_schema_impl::store(frag_table, 1, ws_meta.transaction_id().get());
+ Wsrep_schema_impl::store(frag_table, 2, -1);
+ Wsrep_schema_impl::make_key(frag_table, key, &key_map, 3);
+
+ if ((error= Wsrep_schema_impl::init_for_index_scan(frag_table,
+ key, key_map)))
+ {
+ if (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND)
+ {
+ WSREP_WARN("Record not found in %s.%s: %d",
+ frag_table->s->db.str,
+ frag_table->s->table_name.str,
+ error);
+ }
+ Wsrep_schema_impl::finish_stmt(thd);
+ DBUG_RETURN(1);
+ }
+
+ /* Copy the original record to frag_table->record[1] */
+ store_record(frag_table, record[1]);
+
+ /* Store seqno in frag_table->record[0] and update the row */
+ Wsrep_schema_impl::store(frag_table, 2, ws_meta.seqno().get());
+ if ((error= frag_table->file->ha_update_row(frag_table->record[1],
+ frag_table->record[0]))) {
+ WSREP_ERROR("Error updating record in %s.%s: %d",
+ frag_table->s->db.str,
+ frag_table->s->table_name.str,
+ error);
+ Wsrep_schema_impl::finish_stmt(thd);
+ DBUG_RETURN(1);
+ }
+
+ int ret= Wsrep_schema_impl::end_index_scan(frag_table);
+ Wsrep_schema_impl::finish_stmt(thd);
+ DBUG_RETURN(ret);
+}
+
+static int remove_fragment(THD* thd,
+ TABLE* frag_table,
+ const wsrep::id& server_id,
+ wsrep::transaction_id transaction_id,
+ wsrep::seqno seqno)
+{
+ WSREP_DEBUG("remove_fragment(%llu) trx %llu, seqno %lld",
+ thd->thread_id,
+ transaction_id.get(),
+ seqno.get());
+ int ret= 0;
+ int error;
+ uchar key[MAX_KEY_LENGTH];
+ key_part_map key_map= 0;
+
+ DBUG_ASSERT(server_id.is_undefined() == false);
+ DBUG_ASSERT(transaction_id.is_undefined() == false);
+ DBUG_ASSERT(seqno.is_undefined() == false);
+
+ /*
+ Remove record with the given uuid, trx id, and seqno.
+ Using a complete key here avoids gap locks.
+ */
+ Wsrep_schema_impl::store(frag_table, 0, server_id);
+ Wsrep_schema_impl::store(frag_table, 1, transaction_id.get());
+ Wsrep_schema_impl::store(frag_table, 2, seqno.get());
+ Wsrep_schema_impl::make_key(frag_table, key, &key_map, 3);
+
+ if ((error= Wsrep_schema_impl::init_for_index_scan(frag_table,
+ key,
+ key_map)))
+ {
+ if (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND)
+ {
+ WSREP_DEBUG("Record not found in %s.%s:trx %llu, seqno %lld, error %d",
+ frag_table->s->db.str,
+ frag_table->s->table_name.str,
+ transaction_id.get(),
+ seqno.get(),
+ error);
+ }
+ ret= error;
+ }
+ else if (Wsrep_schema_impl::delete_row(frag_table))
+ {
+ ret= 1;
+ }
+
+ Wsrep_schema_impl::end_index_scan(frag_table);
+ return ret;
+}
+
+int Wsrep_schema::remove_fragments(THD* thd,
+ const wsrep::id& server_id,
+ wsrep::transaction_id transaction_id,
+ const std::vector<wsrep::seqno>& fragments)
+{
+ DBUG_ENTER("Wsrep_schema::remove_fragments");
+ int ret= 0;
+
+ WSREP_DEBUG("Removing %zu fragments", fragments.size());
+ Wsrep_schema_impl::wsrep_off wsrep_off(thd);
+ Wsrep_schema_impl::binlog_off binlog_off(thd);
+
+ /*
+ Open SR table for write.
+ Adopted from Rpl_info_table_access::open_table()
+ */
+ uint flags= (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
+ MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |
+ MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_LOCK_IGNORE_TIMEOUT);
+ Query_tables_list query_tables_list_backup;
+ Open_tables_backup open_tables_backup;
+ thd->lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
+ thd->reset_n_backup_open_tables_state(&open_tables_backup);
+ TABLE_LIST tables;
+ LEX_CSTRING schema_str= { wsrep_schema_str.c_str(), wsrep_schema_str.length() };
+ LEX_CSTRING table_str= { sr_table_str.c_str(), sr_table_str.length() };
+ tables.init_one_table(&schema_str,
+ &table_str, 0, TL_WRITE);
+
+ if (!open_n_lock_single_table(thd, &tables, tables.lock_type, flags))
+ {
+ WSREP_DEBUG("Failed to open SR table for access");
+ ret= 1;
+ }
+ else
+ {
+ tables.table->use_all_columns();
+ for (std::vector<wsrep::seqno>::const_iterator i= fragments.begin();
+ i != fragments.end(); ++i)
+ {
+ if (remove_fragment(thd,
+ tables.table,
+ server_id,
+ transaction_id, *i))
+ {
+ ret= 1;
+ break;
+ }
+ }
+ }
+ close_thread_tables(thd);
+ thd->restore_backup_open_tables_state(&open_tables_backup);
+ thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
+
+ if (thd->wsrep_cs().mode() == wsrep::client_state::m_local &&
+ !thd->in_multi_stmt_transaction_mode())
+ {
+ /*
+ The ugly part: Locally executing autocommit statement is
+ committing and it has removed a fragment from stable storage.
+ Now calling finish_stmt() will call trans_commit_stmt(), which will
+ actually commit the transaction, what we really don't want
+ to do at this point.
+
+ Doing nothing at this point seems to work ok, this block is
+ intentionally no-op and for documentation purposes only.
+ */
+ }
+ else
+ {
+ Wsrep_schema_impl::finish_stmt(thd);
+ }
+
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_schema::replay_transaction(THD* thd,
+ Relay_log_info* rli,
+ const wsrep::ws_meta& ws_meta,
+ const std::vector<wsrep::seqno>& fragments)
+{
+ DBUG_ENTER("Wsrep_schema::replay_transaction");
+ DBUG_ASSERT(!fragments.empty());
+
+ Wsrep_schema_impl::wsrep_off wsrep_off(thd);
+ Wsrep_schema_impl::binlog_off binlog_off(thd);
+
+ int ret= 1;
+ int error;
+ TABLE* frag_table= 0;
+ uchar key[MAX_KEY_LENGTH];
+ key_part_map key_map= 0;
+
+ for (std::vector<wsrep::seqno>::const_iterator i= fragments.begin();
+ i != fragments.end(); ++i)
+ {
+ Wsrep_schema_impl::init_stmt(thd);
+ if ((error= Wsrep_schema_impl::open_for_read(thd, sr_table_str.c_str(), &frag_table)))
+ {
+ WSREP_WARN("Could not open SR table for read: %d", error);
+ Wsrep_schema_impl::finish_stmt(thd);
+ DBUG_RETURN(1);
+ }
+
+ Wsrep_schema_impl::store(frag_table, 0, ws_meta.server_id());
+ Wsrep_schema_impl::store(frag_table, 1, ws_meta.transaction_id().get());
+ Wsrep_schema_impl::store(frag_table, 2, i->get());
+ Wsrep_schema_impl::make_key(frag_table, key, &key_map, 3);
+
+ int error= Wsrep_schema_impl::init_for_index_scan(frag_table,
+ key,
+ key_map);
+ if (error)
+ {
+ WSREP_WARN("Failed to init streaming log table for index scan: %d",
+ error);
+ Wsrep_schema_impl::end_index_scan(frag_table);
+ ret= 1;
+ break;
+ }
+
+ int flags;
+ Wsrep_schema_impl::scan(frag_table, 3, flags);
+ WSREP_DEBUG("replay_fragment(%llu): seqno: %lld flags: %x",
+ ws_meta.transaction_id().get(),
+ i->get(),
+ flags);
+ String buf;
+ frag_table->field[4]->val_str(&buf);
+
+ Wsrep_schema_impl::end_index_scan(frag_table);
+ Wsrep_schema_impl::finish_stmt(thd);
+ ret= wsrep_apply_events(thd, rli, buf.c_ptr_safe(), buf.length());
+ if (ret)
+ {
+ WSREP_WARN("Wsrep_schema::replay_transaction: failed to apply fragments");
+ break;
+ }
+ Wsrep_schema_impl::init_stmt(thd);
+
+ if ((error= Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table)))
+ {
+ WSREP_WARN("Could not open SR table for write: %d", error);
+ Wsrep_schema_impl::finish_stmt(thd);
+ DBUG_RETURN(1);
+ }
+ error= Wsrep_schema_impl::init_for_index_scan(frag_table,
+ key,
+ key_map);
+ if (error)
+ {
+ WSREP_WARN("Failed to init streaming log table for index scan: %d",
+ error);
+ Wsrep_schema_impl::end_index_scan(frag_table);
+ ret= 1;
+ break;
+ }
+
+ error= Wsrep_schema_impl::delete_row(frag_table);
+ if (error)
+ {
+ WSREP_WARN("Could not delete row from streaming log table: %d", error);
+ Wsrep_schema_impl::end_index_scan(frag_table);
+ ret= 1;
+ break;
+ }
+ Wsrep_schema_impl::end_index_scan(frag_table);
+ Wsrep_schema_impl::finish_stmt(thd);
+ }
+
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
+{
+ DBUG_ENTER("Wsrep_schema::recover_sr_transactions");
+ THD storage_thd(true, true);
+ storage_thd.thread_stack= (orig_thd ? orig_thd->thread_stack :
+ (char*) &storage_thd);
+ TABLE* frag_table= 0;
+ TABLE* cluster_table= 0;
+ Wsrep_storage_service storage_service(&storage_thd);
+ Wsrep_schema_impl::binlog_off binlog_off(&storage_thd);
+ Wsrep_schema_impl::wsrep_off binglog_off(&storage_thd);
+ Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd,
+ &storage_thd);
+ Wsrep_server_state& server_state(Wsrep_server_state::instance());
+
+ int ret= 1;
+ int error;
+ wsrep::id cluster_id;
+
+ Wsrep_schema_impl::init_stmt(&storage_thd);
+ storage_thd.wsrep_skip_locking= FALSE;
+ /*
+ Open the table for reading and writing so that fragments without
+ valid seqno can be deleted.
+ */
+ if (Wsrep_schema_impl::open_for_write(&storage_thd,
+ cluster_table_str.c_str(),
+ &cluster_table) ||
+ Wsrep_schema_impl::init_for_scan(cluster_table))
+ {
+ Wsrep_schema_impl::finish_stmt(&storage_thd);
+ DBUG_RETURN(1);
+ }
+
+ if ((error= Wsrep_schema_impl::next_record(cluster_table)))
+ {
+ Wsrep_schema_impl::end_scan(cluster_table);
+ Wsrep_schema_impl::finish_stmt(&storage_thd);
+ trans_commit(&storage_thd);
+ if (error == HA_ERR_END_OF_FILE)
+ {
+ WSREP_INFO("Cluster table is empty, not recovering transactions");
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ WSREP_ERROR("Failed to read cluster table: %d", error);
+ DBUG_RETURN(1);
+ }
+ }
+
+ Wsrep_schema_impl::scan(cluster_table, 0, cluster_id);
+ Wsrep_schema_impl::end_scan(cluster_table);
+ Wsrep_schema_impl::finish_stmt(&storage_thd);
+
+ std::ostringstream os;
+ os << cluster_id;
+ WSREP_INFO("Recovered cluster id %s", os.str().c_str());
+
+ storage_thd.wsrep_skip_locking= TRUE;
+ Wsrep_schema_impl::init_stmt(&storage_thd);
+ if (Wsrep_schema_impl::open_for_read(&storage_thd, sr_table_str.c_str(), &frag_table) ||
+ Wsrep_schema_impl::init_for_scan(frag_table))
+ {
+ WSREP_ERROR("Failed to open SR table for read");
+ goto out;
+ }
+
+ while (true)
+ {
+ if ((error= Wsrep_schema_impl::next_record(frag_table)) == 0)
+ {
+ wsrep::id server_id;
+ Wsrep_schema_impl::scan(frag_table, 0, server_id);
+ wsrep::client_id client_id;
+ unsigned long long transaction_id_ull;
+ Wsrep_schema_impl::scan(frag_table, 1, transaction_id_ull);
+ wsrep::transaction_id transaction_id(transaction_id_ull);
+ long long seqno_ll;
+ Wsrep_schema_impl::scan(frag_table, 2, seqno_ll);
+ wsrep::seqno seqno(seqno_ll);
+
+ /* This is possible if the server crashes between inserting the
+ fragment into table and updating the fragment seqno after
+ certification. */
+ if (seqno.is_undefined())
+ {
+ Wsrep_schema_impl::delete_row(frag_table);
+ continue;
+ }
+
+ wsrep::gtid gtid(cluster_id, seqno);
+ int flags;
+ Wsrep_schema_impl::scan(frag_table, 3, flags);
+ String data_str;
+
+ (void)frag_table->field[4]->val_str(&data_str);
+ wsrep::const_buffer data(data_str.c_ptr(), data_str.length());
+ wsrep::ws_meta ws_meta(gtid,
+ wsrep::stid(server_id,
+ transaction_id,
+ client_id),
+ wsrep::seqno::undefined(),
+ flags);
+
+ wsrep::high_priority_service* applier;
+ if (!(applier= server_state.find_streaming_applier(server_id,
+ transaction_id)))
+ {
+ DBUG_ASSERT(wsrep::starts_transaction(flags));
+ THD* thd= new THD(true, true);
+ thd->thread_stack= (char*)&storage_thd;
+
+ mysql_mutex_lock(&LOCK_thread_count);
+ thd->thread_id= next_thread_id();
+ thd->real_id= pthread_self();
+ mysql_mutex_unlock(&LOCK_thread_count);
+
+ applier= new Wsrep_applier_service(thd);
+ server_state.start_streaming_applier(server_id, transaction_id,
+ applier);
+ applier->start_transaction(wsrep::ws_handle(transaction_id, 0),
+ ws_meta);
+ }
+ applier->store_globals();
+ applier->apply_write_set(ws_meta, data);
+ applier->after_apply();
+ storage_service.store_globals();
+ }
+ else if (error == HA_ERR_END_OF_FILE)
+ {
+ ret= 0;
+ break;
+ }
+ else
+ {
+ WSREP_ERROR("SR table scan returned error %d", error);
+ break;
+ }
+ }
+ Wsrep_schema_impl::end_scan(frag_table);
+ Wsrep_schema_impl::finish_stmt(&storage_thd);
+ trans_commit(&storage_thd);
+out:
+ DBUG_RETURN(ret);
+}
diff --git a/sql/wsrep_schema.h b/sql/wsrep_schema.h
new file mode 100644
index 00000000000..fb5eaa8931f
--- /dev/null
+++ b/sql/wsrep_schema.h
@@ -0,0 +1,161 @@
+/* Copyright (C) 2015-2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+
+#ifndef WSREP_SCHEMA_H
+#define WSREP_SCHEMA_H
+
+/* wsrep-lib */
+#include "wsrep_types.h"
+
+
+#include "mysqld.h"
+#include "thr_lock.h" /* enum thr_lock_type */
+#include "wsrep_mysqld.h"
+
+#include <string>
+
+/*
+ Forward decls
+*/
+class THD;
+class Relay_log_info;
+struct TABLE;
+struct TABLE_LIST;
+struct st_mysql_lex_string;
+typedef struct st_mysql_lex_string LEX_STRING;
+
+/** Name of the table in `wsrep_schema_str` used for storing streaming
+replication data. In an InnoDB full format, e.g. "database/tablename". */
+extern const char* wsrep_sr_table_name_full;
+
+class Wsrep_schema
+{
+ public:
+
+ Wsrep_schema();
+ ~Wsrep_schema();
+
+ /*
+ Initialize wsrep schema. Storage engines must be running before
+ calling this function.
+ */
+ int init();
+
+ /*
+ Store wsrep view info into wsrep schema.
+ */
+ int store_view(THD*, const Wsrep_view& view);
+
+ /*
+ Restore view info from stable storage.
+ */
+ Wsrep_view restore_view(THD* thd, const Wsrep_id& own_id) const;
+
+ /*
+ Append transaction fragment to fragment storage.
+ Starts a trx using a THD from thd_pool, does not commit.
+ Should be followed by a call to update_frag_seqno(), or
+ release_SR_thd() if wsrep->certify() fails.
+ */
+ THD* append_frag(const wsrep_trx_meta_t&, uint32_t,
+ const unsigned char*, size_t);
+ /**
+ Append transaction fragment to fragment storage.
+ Transaction must have been started for THD before this call.
+ In order to make changes durable, transaction must be committed
+ separately after this call.
+
+ @param thd THD object
+ @param server_id Wsrep server identifier
+ @param transaction_id Transaction identifier
+ @param flags Flags for the fragment
+ @param data Fragment data buffer
+
+ @return Zero in case of success, non-zero on failure.
+ */
+ int append_fragment(THD* thd,
+ const wsrep::id& server_id,
+ wsrep::transaction_id transaction_id,
+ wsrep::seqno seqno,
+ int flags,
+ const wsrep::const_buffer& data);
+ /**
+ Update existing fragment meta data. The fragment must have been
+ inserted before using append_fragment().
+
+ @param thd THD object
+ @param ws_meta Wsrep meta data
+
+ @return Zero in case of success, non-zero on failure.
+ */
+ int update_fragment_meta(THD* thd,
+ const wsrep::ws_meta& ws_meta);
+
+ /**
+ Remove fragments from storage. This method must be called
+ inside active transaction. Fragment removal will be committed
+ once the transaction commits.
+
+ @param thd Pointer to THD object
+ @param server_id Identifier of the running server
+ @param transaction_id Identifier of the current transaction
+ @param fragments Vector of fragment seqnos to be removed
+ */
+ int remove_fragments(THD* thd,
+ const wsrep::id& server_id,
+ wsrep::transaction_id transaction_id,
+ const std::vector<wsrep::seqno>& fragments);
+
+ /**
+ Replay a transaction from stored fragments. The caller must have
+ started a transaction for a thd.
+
+ @param thd Pointer to THD object
+ @param ws_meta Write set meta data for commit fragment.
+ @param fragments Vector of fragments to be replayed
+
+ @return Zero on success, non-zero on failure.
+ */
+ int replay_transaction(THD* thd,
+ Relay_log_info* rli,
+ const wsrep::ws_meta& ws_meta,
+ const std::vector<wsrep::seqno>& fragments);
+
+ /**
+ Recover streaming transactions from SR table.
+ This method should be called after storage enignes are initialized.
+ It will scan SR table and replay found streaming transactions.
+
+ @param orig_thd The THD object of the calling thread.
+
+ @return Zero on success, non-zero on failure.
+ */
+ int recover_sr_transactions(THD* orig_thd);
+
+ /*
+ Close wsrep schema.
+ */
+ void close();
+
+ private:
+ /* Non-copyable */
+ Wsrep_schema(const Wsrep_schema&);
+ Wsrep_schema& operator=(const Wsrep_schema&);
+};
+
+extern Wsrep_schema* wsrep_schema;
+
+#endif /* !WSREP_SCHEMA_H */
diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc
new file mode 100644
index 00000000000..7efff35f2b1
--- /dev/null
+++ b/sql/wsrep_server_service.cc
@@ -0,0 +1,318 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "my_global.h"
+#include "wsrep_server_service.h"
+#include "wsrep_server_state.h"
+#include "wsrep_client_state.h"
+#include "wsrep_client_service.h"
+#include "wsrep_storage_service.h"
+#include "wsrep_high_priority_service.h"
+
+#include "wsrep_sst.h"
+#include "wsrep_xid.h"
+#include "wsrep_mysqld.h"
+#include "wsrep_schema.h"
+#include "wsrep_utils.h"
+
+#include "log.h" /* sql_print_xxx() */
+#include "sql_class.h" /* system variables */
+#include "transaction.h" /* trans_xxx */
+#include "sql_base.h" /* close_thread_tables */
+
+static void init_service_thd(THD* thd, char* thread_stack)
+{
+ thd->thread_stack= thread_stack;
+ thd->real_id= pthread_self();
+ thd->prior_thr_create_utime= thd->start_utime= microsecond_interval_timer();
+ thd->set_command(COM_SLEEP);
+ thd->reset_for_next_command(true);
+}
+
+wsrep::storage_service* Wsrep_server_service::storage_service(
+ wsrep::client_service& client_service)
+{
+ Wsrep_client_service& cs=
+ static_cast<Wsrep_client_service&>(client_service);
+ THD* thd= new THD(next_thread_id(), true, true);
+ init_service_thd(thd, cs.m_thd->thread_stack);
+ WSREP_DEBUG("Created storage service with thread id %llu",
+ thd->thread_id);
+ return new Wsrep_storage_service(thd);
+}
+
+wsrep::storage_service* Wsrep_server_service::storage_service(
+ wsrep::high_priority_service& high_priority_service)
+{
+ Wsrep_high_priority_service& hps=
+ static_cast<Wsrep_high_priority_service&>(high_priority_service);
+ THD* thd= new THD(next_thread_id(), true, true);
+ init_service_thd(thd, hps.m_thd->thread_stack);
+ WSREP_DEBUG("Created high priority storage service with thread id %llu",
+ thd->thread_id);
+ return new Wsrep_storage_service(thd);
+}
+
+void Wsrep_server_service::release_storage_service(
+ wsrep::storage_service* storage_service)
+{
+ Wsrep_storage_service* ss=
+ static_cast<Wsrep_storage_service*>(storage_service);
+ THD* thd= ss->m_thd;
+ delete ss;
+ delete thd;
+}
+
+wsrep::high_priority_service*
+Wsrep_server_service::streaming_applier_service(
+ wsrep::client_service& orig_client_service)
+{
+ Wsrep_client_service& orig_cs=
+ static_cast<Wsrep_client_service&>(orig_client_service);
+ THD* thd= new THD(next_thread_id(), true, true);
+ init_service_thd(thd, orig_cs.m_thd->thread_stack);
+ WSREP_DEBUG("Created streaming applier service in local context with "
+ "thread id %llu", thd->thread_id);
+ return new Wsrep_applier_service(thd);
+}
+
+wsrep::high_priority_service*
+Wsrep_server_service::streaming_applier_service(
+ wsrep::high_priority_service& orig_high_priority_service)
+{
+ Wsrep_high_priority_service&
+ orig_hps(static_cast<Wsrep_high_priority_service&>(orig_high_priority_service));
+ THD* thd= new THD(next_thread_id(), true, true);
+ init_service_thd(thd, orig_hps.m_thd->thread_stack);
+ WSREP_DEBUG("Created streaming applier service in high priority "
+ "context with thread id %llu", thd->thread_id);
+ return new Wsrep_applier_service(thd);
+}
+
+void Wsrep_server_service::release_high_priority_service(wsrep::high_priority_service* high_priority_service)
+{
+ Wsrep_high_priority_service* hps=
+ static_cast<Wsrep_high_priority_service*>(high_priority_service);
+ THD* thd= hps->m_thd;
+ delete hps;
+ delete thd;
+}
+
+void Wsrep_server_service::background_rollback(wsrep::client_state& client_state)
+{
+ Wsrep_client_state& cs= static_cast<Wsrep_client_state&>(client_state);
+ wsrep_fire_rollbacker(cs.thd());
+}
+
+void Wsrep_server_service::bootstrap()
+{
+ wsrep::log_info()
+ << "Bootstrapping a new cluster, setting initial position to "
+ << wsrep::gtid::undefined();
+ wsrep_set_SE_checkpoint(wsrep::gtid::undefined());
+}
+
+void Wsrep_server_service::log_message(enum wsrep::log::level level,
+ const char* message)
+{
+ switch (level)
+ {
+ case wsrep::log::debug:
+ sql_print_information("debug: %s", message);
+ break;
+ case wsrep::log::info:
+ sql_print_information("%s", message);
+ break;
+ case wsrep::log::warning:
+ sql_print_warning("%s", message);
+ break;
+ case wsrep::log::error:
+ sql_print_error("%s", message);
+ break;
+ }
+}
+
+void Wsrep_server_service::log_view(
+ wsrep::high_priority_service* high_priority_service,
+ const wsrep::view& view)
+{
+ Wsrep_high_priority_service* applier=
+ static_cast<Wsrep_high_priority_service*>(high_priority_service);
+ /* Update global system variables */
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ if (wsrep_auto_increment_control && view.own_index() >= 0)
+ {
+ global_system_variables.auto_increment_offset= view.own_index() + 1;
+ global_system_variables.auto_increment_increment= view.members().size();
+ wsrep_protocol_version= view.protocol_version();
+ }
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+
+ /* Update wsrep status variables */
+ mysql_mutex_lock(&LOCK_status);
+ wsrep_cluster_size= view.members().size();
+ wsrep_local_index= view.own_index();
+ std::ostringstream os;
+ os << view.state_id().id();
+ wsrep_update_cluster_state_uuid(os.str().c_str());
+ mysql_mutex_unlock(&LOCK_status);
+ wsrep_config_state->set(view);
+
+ if (view.status() == wsrep::view::primary)
+ {
+ if (applier)
+ {
+ Wsrep_id id;
+ Wsrep_view prev_view= wsrep_schema->restore_view(applier->m_thd, id);
+ if (prev_view.state_id().id() != view.state_id().id())
+ {
+ WSREP_DEBUG("New cluster UUID was generated, resetting position info");
+ wsrep_set_SE_checkpoint(wsrep::gtid::undefined());
+ }
+
+ if (wsrep_debug)
+ {
+ std::ostringstream os;
+ os << "Storing cluster view:\n" << view;
+ WSREP_INFO("%s", os.str().c_str());
+ DBUG_ASSERT(prev_view.state_id().id() != view.state_id().id() ||
+ view.state_id().seqno() > prev_view.state_id().seqno());
+ }
+
+ if (trans_begin(applier->m_thd, MYSQL_START_TRANS_OPT_READ_WRITE))
+ {
+ WSREP_WARN("Failed to start transaction for store view");
+ }
+ else
+ {
+ if (wsrep_schema->store_view(applier->m_thd, view))
+ {
+ WSREP_WARN("Failed to store view");
+ trans_rollback_stmt(applier->m_thd);
+ if (!trans_rollback(applier->m_thd))
+ {
+ close_thread_tables(applier->m_thd);
+ }
+ }
+ else
+ {
+ if (trans_commit(applier->m_thd))
+ {
+ WSREP_WARN("Failed to commit transaction for store view");
+ }
+ }
+ applier->m_thd->mdl_context.release_transactional_locks();
+ }
+
+ wsrep_set_SE_checkpoint(view.state_id());
+ DBUG_ASSERT(wsrep_get_SE_checkpoint().id() == view.state_id().id());
+ }
+ else
+ {
+ WSREP_DEBUG("No applier in Wsrep_server_service::log_view(), "
+ "skipping write to wsrep_schema");
+ }
+ }
+}
+
+void Wsrep_server_service::recover_streaming_appliers(wsrep::client_service& cs)
+{
+ Wsrep_client_service& client_service= static_cast<Wsrep_client_service&>(cs);
+ wsrep_recover_sr_from_storage(client_service.m_thd);
+}
+
+void Wsrep_server_service::recover_streaming_appliers(
+ wsrep::high_priority_service& hs)
+{
+ Wsrep_high_priority_service& high_priority_service=
+ static_cast<Wsrep_high_priority_service&>(hs);
+ wsrep_recover_sr_from_storage(high_priority_service.m_thd);
+}
+
+wsrep::view Wsrep_server_service::get_view(wsrep::client_service& c,
+ const wsrep::id& own_id)
+{
+ Wsrep_client_service& cs(static_cast<Wsrep_client_service&>(c));
+ wsrep::view v(wsrep_schema->restore_view(cs.m_thd, own_id));
+ return v;
+}
+
+wsrep::gtid Wsrep_server_service::get_position(wsrep::client_service&)
+{
+ return wsrep_get_SE_checkpoint();
+}
+
+void Wsrep_server_service::log_state_change(
+ enum Wsrep_server_state::state prev_state,
+ enum Wsrep_server_state::state current_state)
+{
+ WSREP_INFO("Server status change %s -> %s",
+ wsrep::to_c_string(prev_state),
+ wsrep::to_c_string(current_state));
+ mysql_mutex_lock(&LOCK_status);
+ switch (current_state)
+ {
+ case Wsrep_server_state::s_synced:
+ wsrep_ready= TRUE;
+ WSREP_INFO("Synchronized with group, ready for connections");
+ /* fall through */
+ case Wsrep_server_state::s_joined:
+ case Wsrep_server_state::s_donor:
+ wsrep_cluster_status= "Primary";
+ break;
+ case Wsrep_server_state::s_connected:
+ wsrep_cluster_status= "non-Primary";
+ wsrep_ready= FALSE;
+ wsrep_connected= TRUE;
+ break;
+ case Wsrep_server_state::s_disconnected:
+ wsrep_ready= FALSE;
+ wsrep_connected= FALSE;
+ wsrep_cluster_status= "Disconnected";
+ break;
+ default:
+ wsrep_ready= FALSE;
+ wsrep_cluster_status= "non-Primary";
+ break;
+ }
+ mysql_mutex_unlock(&LOCK_status);
+ wsrep_config_state->set(current_state);
+}
+
+bool Wsrep_server_service::sst_before_init() const
+{
+ return wsrep_before_SE();
+}
+
+std::string Wsrep_server_service::sst_request()
+{
+ return wsrep_sst_prepare();
+}
+
+int Wsrep_server_service::start_sst(const std::string& sst_request,
+ const wsrep::gtid& gtid,
+ bool bypass)
+{
+ return wsrep_sst_donate(sst_request, gtid, bypass);
+}
+
+int Wsrep_server_service::wait_committing_transactions(int timeout)
+{
+ return wsrep_wait_committing_connections_close(timeout);
+}
+
+void Wsrep_server_service::debug_sync(const char*)
+{
+}
diff --git a/sql/wsrep_server_service.h b/sql/wsrep_server_service.h
new file mode 100644
index 00000000000..b8f1f009cde
--- /dev/null
+++ b/sql/wsrep_server_service.h
@@ -0,0 +1,81 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_SERVER_SERVICE_H
+#define WSREP_SERVER_SERVICE_H
+
+/* wsrep-lib */
+#include "wsrep/server_service.hpp"
+#include "wsrep/exception.hpp" // not_impemented_error(), remove when finished
+#include "wsrep/storage_service.hpp"
+
+class Wsrep_server_state;
+
+
+/* wsrep::server_service interface implementation */
+class Wsrep_server_service : public wsrep::server_service
+{
+public:
+ Wsrep_server_service(Wsrep_server_state& server_state)
+ : m_server_state(server_state)
+ { }
+
+ wsrep::storage_service* storage_service(wsrep::client_service&);
+
+ wsrep::storage_service* storage_service(wsrep::high_priority_service&);
+
+ void release_storage_service(wsrep::storage_service*);
+
+ wsrep::high_priority_service*
+ streaming_applier_service(wsrep::client_service&);
+
+ wsrep::high_priority_service*
+ streaming_applier_service(wsrep::high_priority_service&);
+
+ void release_high_priority_service(wsrep::high_priority_service*);
+
+ void background_rollback(wsrep::client_state&);
+
+ void bootstrap();
+ void log_message(enum wsrep::log::level, const char*);
+
+ void log_dummy_write_set(wsrep::client_state&, const wsrep::ws_meta&)
+ { throw wsrep::not_implemented_error(); }
+
+ void log_view(wsrep::high_priority_service*, const wsrep::view&);
+
+ void recover_streaming_appliers(wsrep::client_service&);
+ void recover_streaming_appliers(wsrep::high_priority_service&);
+ wsrep::view get_view(wsrep::client_service&, const wsrep::id& own_id);
+
+ wsrep::gtid get_position(wsrep::client_service&);
+
+ void log_state_change(enum wsrep::server_state::state,
+ enum wsrep::server_state::state);
+
+ bool sst_before_init() const;
+
+ std::string sst_request();
+ int start_sst(const std::string&, const wsrep::gtid&, bool);
+
+ int wait_committing_transactions(int);
+
+ void debug_sync(const char*);
+private:
+ Wsrep_server_state& m_server_state;
+};
+
+
+#endif /* WSREP_SERVER_SERVICE */
diff --git a/sql/wsrep_server_state.cc b/sql/wsrep_server_state.cc
new file mode 100644
index 00000000000..4571201b07d
--- /dev/null
+++ b/sql/wsrep_server_state.cc
@@ -0,0 +1,82 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "my_global.h"
+#include "wsrep_api.h"
+#include "wsrep_server_state.h"
+
+mysql_mutex_t LOCK_wsrep_server_state;
+mysql_cond_t COND_wsrep_server_state;
+
+#ifdef HAVE_PSI_INTERFACE
+PSI_mutex_key key_LOCK_wsrep_server_state;
+PSI_cond_key key_COND_wsrep_server_state;
+#endif
+
+Wsrep_server_state::Wsrep_server_state(const std::string& name,
+ const std::string& incoming_address,
+ const std::string& address,
+ const std::string& working_dir,
+ const wsrep::gtid& initial_position,
+ int max_protocol_version)
+ : wsrep::server_state(m_mutex,
+ m_cond,
+ m_service,
+ name,
+ incoming_address,
+ address,
+ working_dir,
+ initial_position,
+ max_protocol_version,
+ wsrep::server_state::rm_sync)
+ , m_mutex(LOCK_wsrep_server_state)
+ , m_cond(COND_wsrep_server_state)
+ , m_service(*this)
+{
+
+}
+
+void Wsrep_server_state::init_once(const std::string& name,
+ const std::string& incoming_address,
+ const std::string& address,
+ const std::string& working_dir,
+ const wsrep::gtid& initial_position,
+ int max_protocol_version)
+{
+ if (m_instance == 0)
+ {
+ mysql_mutex_init(key_LOCK_wsrep_server_state, &LOCK_wsrep_server_state,
+ MY_MUTEX_INIT_FAST);
+ mysql_cond_init(key_COND_wsrep_server_state, &COND_wsrep_server_state, 0);
+ m_instance = new Wsrep_server_state(name,
+ incoming_address,
+ address,
+ working_dir,
+ initial_position,
+ max_protocol_version);
+ }
+}
+
+void Wsrep_server_state::destroy()
+{
+
+ if (m_instance)
+ {
+ delete m_instance;
+ m_instance= 0;
+ mysql_mutex_destroy(&LOCK_wsrep_server_state);
+ mysql_cond_destroy(&COND_wsrep_server_state);
+ }
+}
diff --git a/sql/wsrep_server_state.h b/sql/wsrep_server_state.h
new file mode 100644
index 00000000000..d0946498d56
--- /dev/null
+++ b/sql/wsrep_server_state.h
@@ -0,0 +1,66 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_SERVER_STATE_H
+#define WSREP_SERVER_STATE_H
+
+/* wsrep-lib */
+#include "wsrep/server_state.hpp"
+#include "wsrep/provider.hpp"
+
+/* implementation */
+#include "wsrep_server_service.h"
+#include "wsrep_mutex.h"
+#include "wsrep_condition_variable.h"
+
+class Wsrep_server_state : public wsrep::server_state
+{
+public:
+ static void init_once(const std::string& name,
+ const std::string& incoming_address,
+ const std::string& address,
+ const std::string& working_dir,
+ const wsrep::gtid& initial_position,
+ int max_protocol_version);
+ static void destroy();
+ static Wsrep_server_state& instance()
+ {
+ return *m_instance;
+ }
+
+ static wsrep::provider& get_provider()
+ {
+ return instance().provider();
+ }
+
+ static bool has_capability(int capability)
+ {
+ return (get_provider().capabilities() & capability);
+ }
+private:
+ Wsrep_server_state(const std::string& name,
+ const std::string& incoming_address,
+ const std::string& address,
+ const std::string& working_dir,
+ const wsrep::gtid& initial_position,
+ int max_protocol_version);
+ Wsrep_mutex m_mutex;
+ Wsrep_condition_variable m_cond;
+ Wsrep_server_service m_service;
+
+ static Wsrep_server_state* m_instance;
+};
+
+#endif // WSREP_SERVER_STATE_H
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index e648a7f4c69..afbcd4d6c52 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1,4 +1,4 @@
-/* Copyright 2008-2015 Codership Oy <http://www.codership.com>
+/* Copyright 2008-2017 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,16 +35,16 @@
static char wsrep_defaults_file[FN_REFLEN * 2 + 10 + 30 +
sizeof(WSREP_SST_OPT_CONF) +
sizeof(WSREP_SST_OPT_CONF_SUFFIX) +
- sizeof(WSREP_SST_OPT_CONF_EXTRA)] = {0};
+ sizeof(WSREP_SST_OPT_CONF_EXTRA)]= {0};
-const char* wsrep_sst_method = WSREP_SST_DEFAULT;
-const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO;
-const char* wsrep_sst_donor = "";
-const char* wsrep_sst_auth = NULL;
+const char* wsrep_sst_method = WSREP_SST_DEFAULT;
+const char* wsrep_sst_receive_address= WSREP_SST_ADDRESS_AUTO;
+const char* wsrep_sst_donor = "";
+const char* wsrep_sst_auth = NULL;
// container for real auth string
-static const char* sst_auth_real = NULL;
-my_bool wsrep_sst_donor_rejects_queries = FALSE;
+static const char* sst_auth_real = NULL;
+my_bool wsrep_sst_donor_rejects_queries= FALSE;
bool wsrep_sst_method_check (sys_var *self, THD* thd, set_var* var)
{
@@ -60,12 +60,7 @@ bool wsrep_sst_method_check (sys_var *self, THD* thd, set_var* var)
return 0;
}
-bool wsrep_sst_method_update (sys_var *self, THD* thd, enum_var_type type)
-{
- return 0;
-}
-
-static const char* data_home_dir = NULL;
+static const char* data_home_dir;
void wsrep_set_data_home_dir(const char *data_dir)
{
@@ -139,7 +134,7 @@ static bool sst_auth_real_set (const char* value)
{
// set sst_auth_real
if (sst_auth_real) { my_free((void *) sst_auth_real); }
- sst_auth_real = v;
+ sst_auth_real= v;
// mask wsrep_sst_auth
if (strlen(sst_auth_real))
@@ -180,6 +175,7 @@ bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type)
return 0;
}
+
bool wsrep_before_SE()
{
return (wsrep_provider != NULL
@@ -188,111 +184,29 @@ bool wsrep_before_SE()
&& strcmp (wsrep_sst_method, WSREP_SST_MYSQLDUMP));
}
-static bool sst_complete = false;
-static bool sst_needed = false;
-
-#define WSREP_EXTEND_TIMEOUT_INTERVAL 30
-#define WSREP_TIMEDWAIT_SECONDS 10
-
-void wsrep_sst_grab ()
-{
- WSREP_INFO("wsrep_sst_grab()");
- if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort();
- sst_complete = false;
- mysql_mutex_unlock (&LOCK_wsrep_sst);
-}
-
-// Wait for end of SST
-bool wsrep_sst_wait ()
-{
- double total_wtime = 0;
-
- if (mysql_mutex_lock (&LOCK_wsrep_sst))
- abort();
-
- WSREP_INFO("Waiting for SST to complete.");
-
- while (!sst_complete)
- {
- struct timespec wtime;
- set_timespec(wtime, WSREP_TIMEDWAIT_SECONDS);
- time_t start_time = time(NULL);
- mysql_cond_timedwait (&COND_wsrep_sst, &LOCK_wsrep_sst, &wtime);
- time_t end_time = time(NULL);
-
- if (!sst_complete)
- {
- total_wtime += difftime(end_time, start_time);
- WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime);
- service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
- "WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
- }
- }
-
- if (local_seqno >= 0)
- {
- WSREP_INFO("SST complete, seqno: %lld", (long long) local_seqno);
- }
- else
- {
- WSREP_ERROR("SST failed: %d (%s)",
- int(-local_seqno), strerror(-local_seqno));
- }
-
- mysql_mutex_unlock (&LOCK_wsrep_sst);
-
- return (local_seqno >= 0);
-}
-
// Signal end of SST
-void wsrep_sst_complete (const wsrep_uuid_t* sst_uuid,
- wsrep_seqno_t sst_seqno,
- bool needed)
+static void wsrep_sst_complete (THD* thd,
+ int const rcode)
{
- if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort();
- if (!sst_complete)
- {
- sst_complete = true;
- sst_needed = needed;
- local_uuid = *sst_uuid;
- local_seqno = sst_seqno;
- mysql_cond_signal (&COND_wsrep_sst);
- }
- else
- {
- /* This can happen when called from wsrep_synced_cb().
- At the moment there is no way to check there
- if main thread is still waiting for signal,
- so wsrep_sst_complete() is called from there
- each time wsrep_ready changes from FALSE -> TRUE.
- */
- WSREP_DEBUG("Nobody is waiting for SST.");
- }
- mysql_mutex_unlock (&LOCK_wsrep_sst);
+ Wsrep_client_service client_service(thd, thd->wsrep_cs());
+ Wsrep_server_state::instance().sst_received(client_service, rcode);
}
-/*
+ /*
If wsrep provider is loaded, inform that the new state snapshot
has been received. Also update the local checkpoint.
- @param wsrep [IN] wsrep handle
+ @param thd [IN]
@param uuid [IN] Initial state UUID
@param seqno [IN] Initial state sequence number
@param state [IN] Always NULL, also ignored by wsrep provider (?)
@param state_len [IN] Always 0, also ignored by wsrep provider (?)
- @param implicit [IN] Whether invoked implicitly due to SST
- (true) or explicitly because if change
- in wsrep_start_position by user (false).
- @return false Success
- true Error
-
*/
-bool wsrep_sst_received (wsrep_t* const wsrep,
- const wsrep_uuid_t& uuid,
- const wsrep_seqno_t seqno,
- const void* const state,
- const size_t state_len,
- const bool implicit)
+void wsrep_sst_received (THD* thd,
+ const wsrep_uuid_t& uuid,
+ wsrep_seqno_t const seqno,
+ const void* const state,
+ size_t const state_len)
{
/*
To keep track of whether the local uuid:seqno should be updated. Also, note
@@ -300,81 +214,40 @@ bool wsrep_sst_received (wsrep_t* const wsrep,
OK from wsrep provider. By doing so, the values remain consistent across
the server & wsrep provider.
*/
- bool do_update= false;
-
- // Get the locally stored uuid:seqno.
- if (wsrep_get_SE_checkpoint(local_uuid, local_seqno))
- {
- return true;
- }
-
- if (memcmp(&local_uuid, &uuid, sizeof(wsrep_uuid_t)) ||
- local_seqno < seqno || seqno < 0)
- {
- do_update= true;
- }
- else if (local_seqno > seqno)
- {
- WSREP_WARN("SST position can't be set in past. Requested: %lld, Current: "
- " %lld.", (long long)seqno, (long long)local_seqno);
/*
- If we are here because of SET command, simply return true (error) instead of
- aborting.
+ TODO: Handle backwards compatibility. WSREP API v25 does not have
+ wsrep schema.
*/
- if (implicit)
- {
- WSREP_WARN("Can't continue.");
- unireg_abort(1);
- }
- else
- {
- return true;
+ /*
+ Logical SST methods (mysqldump etc) don't update InnoDB sys header.
+ Reset the SE checkpoint before recovering view in order to avoid
+ sanity check failure.
+ */
+ wsrep::gtid const sst_gtid(wsrep::id(uuid.data, sizeof(uuid.data)),
+ wsrep::seqno(seqno));
+
+ if (!wsrep_before_SE()) {
+ wsrep_set_SE_checkpoint(wsrep::gtid::undefined());
+ wsrep_set_SE_checkpoint(sst_gtid);
}
- }
-
-#ifdef GTID_SUPPORT
- wsrep_init_sidno(uuid);
-#endif /* GTID_SUPPORT */
-
- if (wsrep)
- {
- int const rcode(seqno < 0 ? seqno : 0);
- wsrep_gtid_t const state_id= {uuid,
- (rcode ? WSREP_SEQNO_UNDEFINED : seqno)};
+ wsrep_verify_SE_checkpoint(uuid, seqno);
- wsrep_status_t ret= wsrep->sst_received(wsrep, &state_id, state,
- state_len, rcode);
-
- if (ret != WSREP_OK)
- {
- return true;
+ /*
+ Both wsrep_init_SR() and wsrep_recover_view() may use
+ wsrep thread pool. Restore original thd context before returning.
+ */
+ if (thd) {
+ thd->store_globals();
+ }
+ else {
+ my_pthread_setspecific_ptr(THR_THD, NULL);
}
- }
- // Now is the good time to update the local state and checkpoint.
- if (do_update)
- {
- if (wsrep_set_SE_checkpoint(uuid, seqno))
+ if (WSREP_ON)
{
- return true;
+ int const rcode(seqno < 0 ? seqno : 0);
+ wsrep_sst_complete(thd,rcode);
}
-
- local_uuid= uuid;
- local_seqno= seqno;
- }
-
- return false;
-}
-
-// Let applier threads to continue
-bool wsrep_sst_continue ()
-{
- if (sst_needed)
- {
- WSREP_INFO("Signalling provider to continue.");
- return wsrep_sst_received (wsrep, local_uuid, local_seqno, NULL, 0, true);
- }
- return false;
}
struct sst_thread_arg
@@ -404,11 +277,11 @@ struct sst_thread_arg
static int sst_scan_uuid_seqno (const char* str,
wsrep_uuid_t* uuid, wsrep_seqno_t* seqno)
{
- int offt = wsrep_uuid_scan (str, strlen(str), uuid);
+ int offt= wsrep_uuid_scan (str, strlen(str), uuid);
errno= 0; /* Reset the errno */
if (offt > 0 && strlen(str) > (unsigned int)offt && ':' == str[offt])
{
- *seqno = strtoll (str + offt + 1, NULL, 10);
+ *seqno= strtoll (str + offt + 1, NULL, 10);
if (*seqno != LLONG_MAX || errno != ERANGE)
{
return 0;
@@ -416,7 +289,7 @@ static int sst_scan_uuid_seqno (const char* str,
}
WSREP_ERROR("Failed to parse uuid:seqno pair: '%s'", str);
- return EINVAL;
+ return -EINVAL;
}
// get rid of trailing \n
@@ -426,8 +299,8 @@ static char* my_fgets (char* buf, size_t buf_len, FILE* stream)
if (ret)
{
- size_t len = strlen(ret);
- if (len > 0 && ret[len - 1] == '\n') ret[len - 1] = '\0';
+ size_t len= strlen(ret);
+ if (len > 0 && ret[len - 1] == '\n') ret[len - 1]= '\0';
}
return ret;
@@ -482,9 +355,10 @@ static void* sst_joiner_thread (void* a)
int err= 1;
{
- const char magic[] = "ready";
- const size_t magic_len = sizeof(magic) - 1;
- const size_t out_len = 512;
+ THD* thd;
+ const char magic[]= "ready";
+ const size_t magic_len= sizeof(magic) - 1;
+ const size_t out_len= 512;
char out[out_len];
WSREP_INFO("Running: '%s'", arg->cmd);
@@ -501,29 +375,31 @@ static void* sst_joiner_thread (void* a)
WSREP_ERROR("Failed to read '%s <addr>' from: %s\n\tRead: '%s'",
magic, arg->cmd, tmp);
proc.wait();
- if (proc.error()) err = proc.error();
+ if (proc.error()) err= proc.error();
}
else
{
- err = 0;
+ err= 0;
}
}
else
{
- err = proc.error();
+ err= proc.error();
WSREP_ERROR("Failed to execute: %s : %d (%s)",
arg->cmd, err, strerror(err));
}
- // signal sst_prepare thread with ret code,
- // it will go on sending SST request
+ /*
+ signal sst_prepare thread with ret code,
+ it will go on sending SST request
+ */
mysql_mutex_lock (&arg->lock);
if (!err)
{
- arg->ret_str = strdup (out + magic_len + 1);
- if (!arg->ret_str) err = ENOMEM;
+ arg->ret_str= strdup (out + magic_len + 1);
+ if (!arg->ret_str) err= ENOMEM;
}
- arg->err = -err;
+ arg->err= -err;
mysql_cond_signal (&arg->cond);
mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that.
@@ -531,11 +407,11 @@ static void* sst_joiner_thread (void* a)
* initializer thread to ensure single thread of
* shutdown. */
- wsrep_uuid_t ret_uuid = WSREP_UUID_UNDEFINED;
- wsrep_seqno_t ret_seqno = WSREP_SEQNO_UNDEFINED;
+ wsrep_uuid_t ret_uuid = WSREP_UUID_UNDEFINED;
+ wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED;
// in case of successfull receiver start, wait for SST completion/end
- char* tmp = my_fgets (out, out_len, proc.pipe());
+ char* tmp= my_fgets (out, out_len, proc.pipe());
proc.wait();
err= EINVAL;
@@ -544,7 +420,7 @@ static void* sst_joiner_thread (void* a)
{
WSREP_ERROR("Failed to read uuid:seqno and wsrep_gtid_domain_id from "
"joiner script.");
- if (proc.error()) err = proc.error();
+ if (proc.error()) err= proc.error();
}
else
{
@@ -552,7 +428,14 @@ static void* sst_joiner_thread (void* a)
const char *pos= strchr(out, ' ');
if (!pos) {
- // There is no wsrep_gtid_domain_id (some older version SST script?).
+
+ if (wsrep_gtid_mode)
+ {
+ // There is no wsrep_gtid_domain_id (some older version SST script?).
+ WSREP_WARN("Did not find domain ID from SST script output '%s'. "
+ "Domain ID must be set manually to keep binlog consistent",
+ out);
+ }
err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno);
} else {
@@ -588,14 +471,59 @@ static void* sst_joiner_thread (void* a)
err:
+ wsrep::gtid ret_gtid;
+
if (err)
{
- ret_uuid= WSREP_UUID_UNDEFINED;
- ret_seqno= -err;
+ ret_gtid= wsrep::gtid::undefined();
}
+ else
+ {
+ ret_gtid= wsrep::gtid(wsrep::id(ret_uuid.data, sizeof(ret_uuid.data)),
+ wsrep::seqno(ret_seqno));
+ }
+
+ /*
+ Tell initializer thread that SST is complete
+ For that initialize a THD
+ */
+ if (my_thread_init())
+ {
+ WSREP_ERROR("my_thread_init() failed, can't signal end of SST. "
+ "Aborting.");
+ unireg_abort(1);
+ }
+
+ thd= new THD(next_thread_id());
+
+ if (!thd)
+ {
+ WSREP_ERROR("Failed to allocate THD to restore view from local state, "
+ "can't signal end of SST. Aborting.");
+ unireg_abort(1);
+ }
+
+ thd->thread_stack= (char*) &thd;
+ thd->security_ctx->skip_grants();
+ thd->system_thread= SYSTEM_THREAD_GENERIC;
+ thd->real_id= pthread_self();
+
+ thd->store_globals();
+
+ /* */
+ thd->variables.wsrep_on = 0;
+ /* No binlogging */
+ thd->variables.sql_log_bin = 0;
+ thd->variables.option_bits &= ~OPTION_BIN_LOG;
+ /* No general log */
+ thd->variables.option_bits |= OPTION_LOG_OFF;
+ /* Read committed isolation to avoid gap locking */
+ thd->variables.tx_isolation= ISO_READ_COMMITTED;
- // Tell initializer thread that SST is complete
- wsrep_sst_complete (&ret_uuid, ret_seqno, true);
+ wsrep_sst_complete (thd, -err);
+
+ delete thd;
+ my_thread_end();
}
return NULL;
@@ -694,7 +622,7 @@ static ssize_t sst_prepare_other (const char* method,
" %s "
WSREP_SST_OPT_PARENT " '%d'"
" %s '%s'"
- " %s '%s'",
+ " %s '%s'",
method, addr_in, mysql_real_data_home,
wsrep_defaults_file,
(int)getpid(), binlog_opt, binlog_opt_val,
@@ -734,7 +662,7 @@ static ssize_t sst_prepare_other (const char* method,
pthread_t tmp;
sst_thread_arg arg(cmd_str(), env());
mysql_mutex_lock (&arg.lock);
- ret = pthread_create (&tmp, NULL, sst_joiner_thread, &arg);
+ ret= pthread_create (&tmp, NULL, sst_joiner_thread, &arg);
if (ret)
{
WSREP_ERROR("sst_prepare_other(): pthread_create() failed: %d (%s)",
@@ -746,11 +674,11 @@ static ssize_t sst_prepare_other (const char* method,
*addr_out= arg.ret_str;
if (!arg.err)
- ret = strlen(*addr_out);
+ ret= strlen(*addr_out);
else
{
assert (arg.err < 0);
- ret = arg.err;
+ ret= arg.err;
}
pthread_detach (tmp);
@@ -764,12 +692,12 @@ extern uint mysqld_port;
static ssize_t sst_prepare_mysqldump (const char* addr_in,
const char** addr_out)
{
- ssize_t ret = strlen (addr_in);
+ ssize_t ret= strlen (addr_in);
if (!strrchr(addr_in, ':'))
{
- ssize_t s = ret + 7;
- char* tmp = (char*) malloc (s);
+ ssize_t s= ret + 7;
+ char* tmp= (char*) malloc (s);
if (tmp)
{
@@ -780,7 +708,7 @@ static ssize_t sst_prepare_mysqldump (const char* addr_in,
*addr_out= tmp;
return ret;
}
- if (ret > 0) /* buffer too short */ ret = -EMSGSIZE;
+ if (ret > 0) /* buffer too short */ ret= -EMSGSIZE;
free (tmp);
}
else {
@@ -797,31 +725,22 @@ static ssize_t sst_prepare_mysqldump (const char* addr_in,
return ret;
}
-static bool SE_initialized = false;
-
-ssize_t wsrep_sst_prepare (void** msg)
+std::string wsrep_sst_prepare()
{
+ const ssize_t ip_max= 256;
+ char ip_buf[ip_max];
const char* addr_in= NULL;
const char* addr_out= NULL;
+ const char* method;
if (!strcmp(wsrep_sst_method, WSREP_SST_SKIP))
{
- ssize_t ret = strlen(WSREP_STATE_TRANSFER_TRIVIAL) + 1;
- *msg = strdup(WSREP_STATE_TRANSFER_TRIVIAL);
- if (!msg)
- {
- WSREP_ERROR("Could not allocate %zd bytes for state request", ret);
- unireg_abort(1);
- }
- return ret;
+ return WSREP_STATE_TRANSFER_TRIVIAL;
}
/*
Figure out SST receive address. Common for all SST methods.
*/
- char ip_buf[256];
- const ssize_t ip_max= sizeof(ip_buf);
-
// Attempt 1: wsrep_sst_receive_address
if (wsrep_sst_receive_address &&
strcmp (wsrep_sst_receive_address, WSREP_SST_ADDRESS_AUTO))
@@ -838,7 +757,7 @@ ssize_t wsrep_sst_prepare (void** msg)
{
WSREP_ERROR("Could not parse wsrep_node_address : %s",
wsrep_node_address);
- unireg_abort(1);
+ throw wsrep::runtime_error("Failed to prepare for SST. Unrecoverable");
}
memcpy(ip_buf, addr.get_address(), addr.get_address_len());
addr_in= ip_buf;
@@ -856,21 +775,33 @@ ssize_t wsrep_sst_prepare (void** msg)
{
WSREP_ERROR("Failed to guess address to accept state transfer. "
"wsrep_sst_receive_address must be set manually.");
- unireg_abort(1);
+ throw wsrep::runtime_error("Could not prepare state transfer request");
}
}
ssize_t addr_len= -ENOSYS;
- if (!strcmp(wsrep_sst_method, WSREP_SST_MYSQLDUMP))
+ method = wsrep_sst_method;
+ if (!strcmp(method, WSREP_SST_MYSQLDUMP))
{
addr_len= sst_prepare_mysqldump (addr_in, &addr_out);
- if (addr_len < 0) unireg_abort(1);
+ if (addr_len < 0)
+ {
+ throw wsrep::runtime_error("Could not prepare mysqldimp address");
+ }
}
else
{
/*! A heuristic workaround until we learn how to stop and start engines */
- if (SE_initialized)
+ if (Wsrep_server_state::instance().is_initialized() &&
+ Wsrep_server_state::instance().state() == Wsrep_server_state::s_joiner)
{
+ if (!strcmp(method, WSREP_SST_XTRABACKUP) ||
+ !strcmp(method, WSREP_SST_XTRABACKUPV2))
+ {
+ WSREP_WARN("The %s SST method is deprecated, so it is automatically "
+ "replaced by %s", method, WSREP_SST_MARIABACKUP);
+ method = WSREP_SST_MARIABACKUP;
+ }
// we already did SST at initializaiton, now engines are running
// sql_print_information() is here because the message is too long
// for WSREP_INFO.
@@ -880,48 +811,38 @@ ssize_t wsrep_sst_prepare (void** msg)
"Wsrep provider won't be able to fall back to it "
"if other means of state transfer are unavailable. "
"In that case you will need to restart the server.",
- wsrep_sst_method);
- *msg = 0;
- return 0;
+ method);
+ return "";
}
- addr_len = sst_prepare_other (wsrep_sst_method, sst_auth_real,
+ addr_len = sst_prepare_other (method, sst_auth_real,
addr_in, &addr_out);
if (addr_len < 0)
{
WSREP_ERROR("Failed to prepare for '%s' SST. Unrecoverable.",
- wsrep_sst_method);
- unireg_abort(1);
+ method);
+ throw wsrep::runtime_error("Failed to prepare for SST. Unrecoverable");
}
}
- size_t const method_len(strlen(wsrep_sst_method));
- size_t const msg_len (method_len + addr_len + 2 /* + auth_len + 1*/);
-
- *msg = malloc (msg_len);
- if (NULL != *msg) {
- char* const method_ptr(reinterpret_cast<char*>(*msg));
- strcpy (method_ptr, wsrep_sst_method);
- char* const addr_ptr(method_ptr + method_len + 1);
- strcpy (addr_ptr, addr_out);
+ std::string ret;
+ ret += method;
+ ret.push_back('\0');
+ ret += addr_out;
- WSREP_INFO ("Prepared SST request: %s|%s", method_ptr, addr_ptr);
- }
- else {
- WSREP_ERROR("Failed to allocate SST request of size %zu. Can't continue.",
- msg_len);
- unireg_abort(1);
- }
+ const char* method_ptr(ret.data());
+ const char* addr_ptr(ret.data() + strlen(method_ptr) + 1);
+ WSREP_INFO ("Prepared SST request: %s|%s", method_ptr, addr_ptr);
if (addr_out != addr_in) /* malloc'ed */ free ((char*)addr_out);
- return msg_len;
+ return ret;
}
// helper method for donors
static int sst_run_shell (const char* cmd_str, char** env, int max_tries)
{
- int ret = 0;
+ int ret= 0;
for (int tries=1; tries <= max_tries; tries++)
{
@@ -932,7 +853,7 @@ static int sst_run_shell (const char* cmd_str, char** env, int max_tries)
proc.wait();
}
- if ((ret = proc.error()))
+ if ((ret= proc.error()))
{
WSREP_ERROR("Try %d/%d: '%s' failed: %d (%s)",
tries, max_tries, proc.cmd(), ret, strerror(ret));
@@ -950,15 +871,12 @@ static int sst_run_shell (const char* cmd_str, char** env, int max_tries)
static void sst_reject_queries(my_bool close_conn)
{
- wsrep_ready_set (FALSE); // this will be resotred when donor becomes synced
- WSREP_INFO("Rejecting client queries for the duration of SST.");
- if (TRUE == close_conn) wsrep_close_client_connections(FALSE);
+ WSREP_INFO("Rejecting client queries for the duration of SST.");
+ if (TRUE == close_conn) wsrep_close_client_connections(FALSE);
}
static int sst_donate_mysqldump (const char* addr,
- const wsrep_uuid_t* uuid,
- const char* uuid_str,
- wsrep_seqno_t seqno,
+ const wsrep::gtid& gtid,
bool bypass,
char** env) // carries auth info
{
@@ -981,23 +899,31 @@ static int sst_donate_mysqldump (const char* addr,
return -ENOMEM;
}
+ /*
+ we enable new client connections so that mysqldump donation can connect in,
+ but we reject local connections from modifyingcdata during SST, to keep
+ data intact
+ */
if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE);
make_wsrep_defaults_file();
+ std::ostringstream uuid_oss;
+ uuid_oss << gtid.id();
int ret= snprintf (cmd_str(), cmd_len,
"wsrep_sst_mysqldump "
WSREP_SST_OPT_ADDR " '%s' "
- WSREP_SST_OPT_PORT " '%d' "
+ WSREP_SST_OPT_PORT " '%u' "
WSREP_SST_OPT_LPORT " '%u' "
WSREP_SST_OPT_SOCKET " '%s' "
" %s "
WSREP_SST_OPT_GTID " '%s:%lld' "
WSREP_SST_OPT_GTID_DOMAIN_ID " '%d'"
"%s",
- addr, port, mysqld_port, mysqld_unix_port,
- wsrep_defaults_file, uuid_str,
- (long long)seqno, wsrep_gtid_domain_id,
+ addr, port, mysqld_port, mysqld_unix_port,
+ wsrep_defaults_file,
+ uuid_oss.str().c_str(), gtid.seqno().get(),
+ wsrep_gtid_domain_id,
bypass ? " " WSREP_SST_OPT_BYPASS : "");
if (ret < 0 || ret >= cmd_len)
@@ -1010,16 +936,17 @@ static int sst_donate_mysqldump (const char* addr,
ret= sst_run_shell (cmd_str(), env, 3);
- wsrep_gtid_t const state_id = { *uuid, (ret ? WSREP_SEQNO_UNDEFINED : seqno)};
-
- wsrep->sst_sent (wsrep, &state_id, ret);
+ wsrep::gtid sst_sent_gtid(ret == 0 ?
+ gtid :
+ wsrep::gtid(gtid.id(),
+ wsrep::seqno::undefined()));
+ Wsrep_server_state::instance().sst_sent(sst_sent_gtid, ret);
return ret;
}
wsrep_seqno_t wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED;
-
/*
Create a file under data directory.
*/
@@ -1068,7 +995,6 @@ static int sst_create_file(const char *name, const char *content)
return err;
}
-
static int run_sql_command(THD *thd, const char *query)
{
thd->set_query((char *)query, strlen(query));
@@ -1114,9 +1040,9 @@ static int sst_flush_tables(THD* thd)
{
/* Do not use non-supported parser character sets */
WSREP_WARN("Current client character set is non-supported parser character set: %s", current_charset->csname);
- thd->variables.character_set_client = &my_charset_latin1;
+ thd->variables.character_set_client= &my_charset_latin1;
WSREP_WARN("For SST temporally setting character set to : %s",
- my_charset_latin1.csname);
+ my_charset_latin1.csname);
}
if (run_sql_command(thd, "FLUSH TABLES WITH READ LOCK"))
@@ -1137,7 +1063,7 @@ static int sst_flush_tables(THD* thd)
}
}
- thd->variables.character_set_client = current_charset;
+ thd->variables.character_set_client= current_charset;
if (err)
{
@@ -1155,7 +1081,6 @@ static int sst_flush_tables(THD* thd)
else
{
WSREP_INFO("Tables flushed.");
-
/*
Tables have been flushed. Create a file with cluster state ID and
wsrep_gtid_domain_id.
@@ -1164,6 +1089,41 @@ static int sst_flush_tables(THD* thd)
snprintf(content, sizeof(content), "%s:%lld %d\n", wsrep_cluster_state_uuid,
(long long)wsrep_locked_seqno, wsrep_gtid_domain_id);
err= sst_create_file(flush_success, content);
+
+ const char base_name[]= "tables_flushed";
+ ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2;
+ char *real_name= (char*) malloc(full_len);
+ sprintf(real_name, "%s/%s", mysql_real_data_home, base_name);
+ char *tmp_name= (char*) malloc(full_len + 4);
+ sprintf(tmp_name, "%s.tmp", real_name);
+
+ FILE* file= fopen(tmp_name, "w+");
+ if (0 == file)
+ {
+ err= errno;
+ WSREP_ERROR("Failed to open '%s': %d (%s)", tmp_name, err,strerror(err));
+ }
+ else
+ {
+ Wsrep_server_state& server_state= Wsrep_server_state::instance();
+ std::ostringstream uuid_oss;
+
+ uuid_oss << server_state.current_view().state_id().id();
+
+ fprintf(file, "%s:%lld %u\n",
+ uuid_oss.str().c_str(), server_state.pause_seqno().get(),
+ wsrep_gtid_domain_id);
+ fsync(fileno(file));
+ fclose(file);
+ if (rename(tmp_name, real_name) == -1)
+ {
+ err= errno;
+ WSREP_ERROR("Failed to rename '%s' to '%s': %d (%s)",
+ tmp_name, real_name, err,strerror(err));
+ }
+ }
+ free(real_name);
+ free(tmp_name);
}
return err;
@@ -1172,19 +1132,19 @@ static int sst_flush_tables(THD* thd)
static void sst_disallow_writes (THD* thd, bool yes)
{
- char query_str[64] = { 0, };
- ssize_t const query_max = sizeof(query_str) - 1;
+ char query_str[64]= { 0, };
+ ssize_t const query_max= sizeof(query_str) - 1;
CHARSET_INFO *current_charset;
- current_charset = thd->variables.character_set_client;
+ current_charset= thd->variables.character_set_client;
if (!is_supported_parser_charset(current_charset))
{
/* Do not use non-supported parser character sets */
WSREP_WARN("Current client character set is non-supported parser character set: %s", current_charset->csname);
- thd->variables.character_set_client = &my_charset_latin1;
+ thd->variables.character_set_client= &my_charset_latin1;
WSREP_WARN("For SST temporally setting character set to : %s",
- my_charset_latin1.csname);
+ my_charset_latin1.csname);
}
snprintf (query_str, query_max, "SET GLOBAL innodb_disallow_writes=%d",
@@ -1194,7 +1154,7 @@ static void sst_disallow_writes (THD* thd, bool yes)
{
WSREP_ERROR("Failed to disallow InnoDB writes");
}
- thd->variables.character_set_client = current_charset;
+ thd->variables.character_set_client= current_charset;
}
static void* sst_donor_thread (void* a)
@@ -1217,11 +1177,11 @@ static void* sst_donor_thread (void* a)
// operate with wsrep_ready == OFF
wsp::process proc(arg->cmd, "r", arg->env);
- err= proc.error();
+ err= -proc.error();
/* Inform server about SST script startup and release TO isolation */
mysql_mutex_lock (&arg->lock);
- arg->err = -err;
+ arg->err= -err;
mysql_cond_signal (&arg->cond);
mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that.
@@ -1266,7 +1226,7 @@ wait_signal:
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
}
sst_disallow_writes (thd.ptr, false);
- thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr);
+ thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr);
locked= false;
}
err= 0;
@@ -1280,6 +1240,7 @@ wait_signal:
else
{
WSREP_WARN("Received unknown signal: '%s'", out);
+ proc.wait();
}
}
else
@@ -1287,7 +1248,7 @@ wait_signal:
WSREP_ERROR("Failed to read from: %s", proc.cmd());
proc.wait();
}
- if (!err && proc.error()) err= proc.error();
+ if (!err && proc.error()) err= -proc.error();
}
else
{
@@ -1303,27 +1264,23 @@ wait_signal:
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
}
sst_disallow_writes (thd.ptr, false);
- thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr);
+ thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr);
}
- // signal to donor that SST is over
- struct wsrep_gtid const state_id = {
- ret_uuid, err ? WSREP_SEQNO_UNDEFINED : ret_seqno
- };
- wsrep->sst_sent (wsrep, &state_id, -err);
+ wsrep::gtid gtid(wsrep::id(ret_uuid.data, sizeof(ret_uuid.data)),
+ wsrep::seqno(err ? wsrep::seqno::undefined() :
+ wsrep::seqno(ret_seqno)));
+ Wsrep_server_state::instance().sst_sent(gtid, err);
proc.wait();
return NULL;
}
-
-
-static int sst_donate_other (const char* method,
- const char* addr,
- const char* uuid,
- wsrep_seqno_t seqno,
- bool bypass,
- char** env) // carries auth info
+static int sst_donate_other (const char* method,
+ const char* addr,
+ const wsrep::gtid& gtid,
+ bool bypass,
+ char** env) // carries auth info
{
int const cmd_len= 4096;
wsp::string cmd_str(cmd_len);
@@ -1348,6 +1305,8 @@ static int sst_donate_other (const char* method,
make_wsrep_defaults_file();
+ std::ostringstream uuid_oss;
+ uuid_oss << gtid.id();
ret= snprintf (cmd_str(), cmd_len,
"wsrep_sst_%s "
WSREP_SST_OPT_ROLE " 'donor' "
@@ -1362,7 +1321,7 @@ static int sst_donate_other (const char* method,
method, addr, mysqld_unix_port, mysql_real_data_home,
wsrep_defaults_file,
binlog_opt, binlog_opt_val,
- uuid, (long long) seqno, wsrep_gtid_domain_id,
+ uuid_oss.str().c_str(), gtid.seqno().get(), wsrep_gtid_domain_id,
bypass ? " " WSREP_SST_OPT_BYPASS : "");
my_free(binlog_opt_val);
@@ -1377,7 +1336,7 @@ static int sst_donate_other (const char* method,
pthread_t tmp;
sst_thread_arg arg(cmd_str(), env);
mysql_mutex_lock (&arg.lock);
- ret = pthread_create (&tmp, NULL, sst_donor_thread, &arg);
+ ret= pthread_create (&tmp, NULL, sst_donor_thread, &arg);
if (ret)
{
WSREP_ERROR("sst_donate_other(): pthread_create() failed: %d (%s)",
@@ -1390,23 +1349,18 @@ static int sst_donate_other (const char* method,
return arg.err;
}
-wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx,
- const void* msg, size_t msg_len,
- const wsrep_gtid_t* current_gtid,
- const char* state, size_t state_len,
- bool bypass)
+int wsrep_sst_donate(const std::string& msg,
+ const wsrep::gtid& current_gtid,
+ const bool bypass)
{
/* This will be reset when sync callback is called.
* Should we set wsrep_ready to FALSE here too? */
- wsrep_config_state->set(WSREP_MEMBER_DONOR);
-
- const char* method = (char*)msg;
- size_t method_len = strlen (method);
- const char* data = method + method_len + 1;
+ wsrep_config_state->set(wsrep::server_state::s_donor);
- char uuid_str[37];
- wsrep_uuid_print (&current_gtid->uuid, uuid_str, sizeof(uuid_str));
+ const char* method= msg.data();
+ size_t method_len= strlen (method);
+ const char* data= method + method_len + 1;
wsp::env env(NULL);
if (env.error())
@@ -1434,54 +1388,13 @@ wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx,
if (!strcmp (WSREP_SST_MYSQLDUMP, method))
{
- ret = sst_donate_mysqldump(data, &current_gtid->uuid, uuid_str,
- current_gtid->seqno, bypass, env());
+ ret= sst_donate_mysqldump(data, current_gtid, bypass, env());
}
else
{
- ret = sst_donate_other(method, data, uuid_str,
- current_gtid->seqno, bypass, env());
+ ret= sst_donate_other(method, data, current_gtid, bypass, env());
}
- return (ret >= 0 ? WSREP_CB_SUCCESS : WSREP_CB_FAILURE);
-}
-
-void wsrep_SE_init_grab()
-{
- if (mysql_mutex_lock (&LOCK_wsrep_sst_init)) abort();
-}
-
-void wsrep_SE_init_wait()
-{
- double total_wtime=0;
-
- while (SE_initialized == false)
- {
- struct timespec wtime;
- set_timespec(wtime, WSREP_TIMEDWAIT_SECONDS);
- time_t start_time = time(NULL);
- mysql_cond_timedwait (&COND_wsrep_sst_init, &LOCK_wsrep_sst_init, &wtime);
- time_t end_time = time(NULL);
-
- if (!SE_initialized)
- {
- total_wtime += difftime(end_time, start_time);
- WSREP_DEBUG("Waiting for SST to complete. current seqno: %" PRId64 " waited %f secs.", local_seqno, total_wtime);
- service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
- "WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
- }
- }
-
- mysql_mutex_unlock (&LOCK_wsrep_sst_init);
-}
-
-void wsrep_SE_init_done()
-{
- mysql_cond_signal (&COND_wsrep_sst_init);
- mysql_mutex_unlock (&LOCK_wsrep_sst_init);
-}
-
-void wsrep_SE_initialized()
-{
- SE_initialized = true;
+ return (ret >= 0 ? 0 : 1);
}
+
diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h
index cc0f1f5389d..46059a7f436 100644
--- a/sql/wsrep_sst.h
+++ b/sql/wsrep_sst.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 Codership Oy <info@codership.com>
+/* Copyright (C) 2013-2018 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,14 +13,14 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#include <my_config.h>
-
#ifndef WSREP_SST_H
#define WSREP_SST_H
-#ifdef WITH_WSREP
+#include <my_config.h>
-#include <mysql.h> // my_bool
+#include "wsrep/gtid.hpp"
+#include <my_global.h>
+#include <string>
#define WSREP_SST_OPT_ROLE "--role"
#define WSREP_SST_OPT_ADDR "--address"
@@ -49,6 +49,9 @@
#define WSREP_SST_MYSQLDUMP "mysqldump"
#define WSREP_SST_RSYNC "rsync"
#define WSREP_SST_SKIP "skip"
+#define WSREP_SST_MARIABACKUP "mariabackup"
+#define WSREP_SST_XTRABACKUP "xtrabackup"
+#define WSREP_SST_XTRABACKUPV2 "xtrabackupv2"
#define WSREP_SST_DEFAULT WSREP_SST_RSYNC
#define WSREP_SST_ADDRESS_AUTO "AUTO"
#define WSREP_SST_AUTH_MASK "********"
@@ -74,11 +77,29 @@ extern void wsrep_SE_init_wait(); /*! wait for SE init to complete */
extern void wsrep_SE_init_done(); /*! signal that SE init is complte */
extern void wsrep_SE_initialized(); /*! mark SE initialization complete */
+/**
+ Return a string containing the state transfer request string.
+ Note that the string may contain a '\0' in the middle.
+*/
+std::string wsrep_sst_prepare();
+
+/**
+ Donate a SST.
+
+ @param request SST request string received from the joiner. Note that
+ the string may contain a '\0' in the middle.
+ @param gtid Current position of the donor
+ @param bypass If true, full SST is not needed. Joiner needs to be
+ notified that it can continue starting from gtid.
+ */
+int wsrep_sst_donate(const std::string& request,
+ const wsrep::gtid& gtid,
+ bool bypass);
+
#else
#define wsrep_SE_initialized() do { } while(0)
#define wsrep_SE_init_grab() do { } while(0)
#define wsrep_SE_init_done() do { } while(0)
#define wsrep_sst_continue() (0)
-#endif /* WITH_WSREP */
#endif /* WSREP_SST_H */
diff --git a/sql/wsrep_storage_service.cc b/sql/wsrep_storage_service.cc
new file mode 100644
index 00000000000..5a15f22ab57
--- /dev/null
+++ b/sql/wsrep_storage_service.cc
@@ -0,0 +1,238 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "my_global.h"
+#include "wsrep_storage_service.h"
+#include "wsrep_trans_observer.h" /* wsrep_open() */
+#include "wsrep_schema.h"
+#include "wsrep_binlog.h"
+
+#include "sql_class.h"
+#include "mysqld.h" /* next_query_id() */
+#include "slave.h" /* opt_log_slave_updates() */
+#include "transaction.h" /* trans_commit(), trans_rollback() */
+
+/*
+ Temporarily enable wsrep on thd
+ */
+class Wsrep_on
+{
+public:
+ Wsrep_on(THD* thd)
+ : m_thd(thd)
+ , m_wsrep_on(thd->variables.wsrep_on)
+ {
+ thd->variables.wsrep_on= TRUE;
+ }
+ ~Wsrep_on()
+ {
+ m_thd->variables.wsrep_on= m_wsrep_on;
+ }
+private:
+ THD* m_thd;
+ my_bool m_wsrep_on;
+};
+
+Wsrep_storage_service::Wsrep_storage_service(THD* thd)
+ : wsrep::storage_service()
+ , wsrep::high_priority_context(thd->wsrep_cs())
+ , m_thd(thd)
+{
+ thd->security_ctx->skip_grants();
+ thd->system_thread= SYSTEM_THREAD_SLAVE_SQL;
+
+ /* No binlogging */
+
+ /* No general log */
+ thd->variables.option_bits |= OPTION_LOG_OFF;
+
+ /* Read committed isolation to avoid gap locking */
+ thd->variables.tx_isolation = ISO_READ_COMMITTED;
+
+ /* Keep wsrep on to enter commit ordering hooks */
+ thd->variables.wsrep_on= 1;
+ thd->wsrep_skip_locking= true;
+
+ wsrep_open(thd);
+ wsrep_before_command(thd);
+}
+
+Wsrep_storage_service::~Wsrep_storage_service()
+{
+ wsrep_after_command_ignore_result(m_thd);
+ wsrep_close(m_thd);
+ m_thd->wsrep_skip_locking= false;
+}
+
+int Wsrep_storage_service::start_transaction(const wsrep::ws_handle& ws_handle)
+{
+ DBUG_ENTER("Wsrep_storage_service::start_transaction");
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_PRINT("info", ("Wsrep_storage_service::start_transcation(%llu, %p)",
+ m_thd->thread_id, m_thd));
+ m_thd->set_wsrep_next_trx_id(ws_handle.transaction_id().get());
+ DBUG_RETURN(m_thd->wsrep_cs().start_transaction(
+ wsrep::transaction_id(m_thd->wsrep_next_trx_id())) ||
+ trans_begin(m_thd, MYSQL_START_TRANS_OPT_READ_WRITE));
+}
+
+void Wsrep_storage_service::adopt_transaction(const wsrep::transaction& transaction)
+{
+ DBUG_ENTER("Wsrep_Storage_server::adopt_transaction");
+ DBUG_ASSERT(m_thd == current_thd);
+ m_thd->wsrep_cs().adopt_transaction(transaction);
+ trans_begin(m_thd, MYSQL_START_TRANS_OPT_READ_WRITE);
+ DBUG_VOID_RETURN;
+}
+
+int Wsrep_storage_service::append_fragment(const wsrep::id& server_id,
+ wsrep::transaction_id transaction_id,
+ int flags,
+ const wsrep::const_buffer& data)
+{
+ DBUG_ENTER("Wsrep_storage_service::append_fragment");
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_PRINT("info", ("Wsrep_storage_service::append_fragment(%llu, %p)",
+ m_thd->thread_id, m_thd));
+ int ret= wsrep_schema->append_fragment(m_thd,
+ server_id,
+ transaction_id,
+ wsrep::seqno(-1),
+ flags,
+ data);
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_storage_service::update_fragment_meta(const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_storage_service::update_fragment_meta");
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_PRINT("info", ("Wsrep_storage_service::update_fragment_meta(%llu, %p)",
+ m_thd->thread_id, m_thd));
+ int ret= wsrep_schema->update_fragment_meta(m_thd, ws_meta);
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_storage_service::remove_fragments()
+{
+ DBUG_ENTER("Wsrep_storage_service::remove_fragments");
+ DBUG_ASSERT(m_thd == current_thd);
+
+ int ret= wsrep_schema->remove_fragments(m_thd,
+ m_thd->wsrep_trx().server_id(),
+ m_thd->wsrep_trx().id(),
+ m_thd->wsrep_sr().fragments());
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_storage_service::commit(const wsrep::ws_handle& ws_handle,
+ const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_storage_service::commit");
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_PRINT("info", ("Wsrep_storage_service::commit(%llu, %p)",
+ m_thd->thread_id, m_thd));
+ WSREP_DEBUG("Storage service commit: %llu, %lld",
+ ws_meta.transaction_id().get(), ws_meta.seqno().get());
+ int ret= 0;
+ const bool do_binlog_commit= (opt_log_slave_updates && wsrep_gtid_mode);
+ const bool is_ordered= !ws_meta.seqno().is_undefined();
+ /*
+ Write skip event into binlog if gtid_mode is on. This is to
+ maintain gtid continuity.
+ */
+ if (do_binlog_commit && is_ordered)
+ {
+ ret= wsrep_write_skip_event(m_thd);
+ }
+
+ if (!ret && is_ordered)
+ {
+ ret= m_thd->wsrep_cs().prepare_for_ordering(ws_handle,
+ ws_meta, true);
+ }
+
+ if (!ret)
+ {
+ if (!do_binlog_commit && is_ordered)
+ {
+ ret= wsrep_before_commit(m_thd, true);
+ }
+ ret= ret || trans_commit(m_thd);
+ if (!do_binlog_commit && is_ordered)
+ {
+ if (opt_log_slave_updates)
+ {
+ ret= ret || wsrep_ordered_commit(m_thd, true, wsrep_apply_error());
+ }
+ ret= ret || wsrep_after_commit(m_thd, true);
+ }
+ }
+
+ if (!is_ordered)
+ {
+ /* Wsrep commit was not ordered so it does not go through commit time
+ hooks and remains active. Roll it back to make cleanup happen
+ in after_applying() call. */
+ m_thd->wsrep_cs().before_rollback();
+ m_thd->wsrep_cs().after_rollback();
+ }
+ else if (ret)
+ {
+ /* Commit failed, this probably means that the parent SR transaction
+ was BF aborted. Roll back out of order, the parent
+ transaction will release commit order after it has rolled back. */
+ m_thd->wsrep_cs().prepare_for_ordering(wsrep::ws_handle(),
+ wsrep::ws_meta(),
+ false);
+ trans_rollback(m_thd);
+ }
+ m_thd->wsrep_cs().after_applying();
+ m_thd->mdl_context.release_transactional_locks();
+ DBUG_RETURN(ret);
+}
+
+int Wsrep_storage_service::rollback(const wsrep::ws_handle& ws_handle,
+ const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER("Wsrep_storage_service::rollback");
+ DBUG_ASSERT(m_thd == current_thd);
+ DBUG_PRINT("info", ("Wsrep_storage_service::rollback(%llu, %p)",
+ m_thd->thread_id, m_thd));
+ int ret= (m_thd->wsrep_cs().prepare_for_ordering(
+ ws_handle, ws_meta, false) ||
+ trans_rollback(m_thd));
+ m_thd->wsrep_cs().after_applying();
+ m_thd->mdl_context.release_transactional_locks();
+ DBUG_RETURN(ret);
+}
+
+void Wsrep_storage_service::store_globals()
+{
+ DBUG_ENTER("Wsrep_storage_service::store_globals");
+ DBUG_PRINT("info", ("Wsrep_storage_service::store_globals(%llu, %p)",
+ m_thd->thread_id, m_thd));
+ m_thd->store_globals();
+ DBUG_VOID_RETURN;
+}
+
+void Wsrep_storage_service::reset_globals()
+{
+ DBUG_ENTER("Wsrep_storage_service::reset_globals");
+ DBUG_PRINT("info", ("Wsrep_storage_service::reset_globals(%llu, %p)",
+ m_thd->thread_id, m_thd));
+ m_thd->reset_globals();
+ DBUG_VOID_RETURN;
+}
diff --git a/sql/wsrep_storage_service.h b/sql/wsrep_storage_service.h
new file mode 100644
index 00000000000..6208300930f
--- /dev/null
+++ b/sql/wsrep_storage_service.h
@@ -0,0 +1,48 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_STORAGE_SERVICE_H
+#define WSREP_STORAGE_SERVICE_H
+
+#include "wsrep/storage_service.hpp"
+#include "wsrep/client_state.hpp"
+
+class THD;
+class Wsrep_server_service;
+class Wsrep_storage_service :
+ public wsrep::storage_service,
+ public wsrep::high_priority_context
+{
+public:
+ Wsrep_storage_service(THD*);
+ ~Wsrep_storage_service();
+ int start_transaction(const wsrep::ws_handle&);
+ void adopt_transaction(const wsrep::transaction&);
+ int append_fragment(const wsrep::id&,
+ wsrep::transaction_id,
+ int flags,
+ const wsrep::const_buffer&);
+ int update_fragment_meta(const wsrep::ws_meta&);
+ int remove_fragments();
+ int commit(const wsrep::ws_handle&, const wsrep::ws_meta&);
+ int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&);
+ void store_globals();
+ void reset_globals();
+private:
+ friend class Wsrep_server_service;
+ THD* m_thd;
+};
+
+#endif /* WSREP_STORAGE_SERVICE_H */
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index ce6d9688cb3..4f9915fa05f 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -15,412 +15,82 @@
#include "mariadb.h"
#include "wsrep_thd.h"
+#include "wsrep_trans_observer.h"
+#include "wsrep_high_priority_service.h"
+#include "wsrep_storage_service.h"
#include "transaction.h"
#include "rpl_rli.h"
#include "log_event.h"
#include "sql_parse.h"
-//#include "global_threads.h" // LOCK_thread_count, etc.
#include "sql_base.h" // close_thread_tables()
#include "mysqld.h" // start_wsrep_THD();
-
-#include "slave.h" // opt_log_slave_updates
-#include "rpl_filter.h"
+#include "wsrep_applier.h" // start_wsrep_THD();
+#include "mysql/service_wsrep.h"
+#include "debug_sync.h"
+#include "slave.h"
#include "rpl_rli.h"
#include "rpl_mi.h"
-#if (__LP64__)
-static volatile int64 wsrep_bf_aborts_counter(0);
-#define WSREP_ATOMIC_LOAD_LONG my_atomic_load64
-#define WSREP_ATOMIC_ADD_LONG my_atomic_add64
-#else
-static volatile int32 wsrep_bf_aborts_counter(0);
-#define WSREP_ATOMIC_LOAD_LONG my_atomic_load32
-#define WSREP_ATOMIC_ADD_LONG my_atomic_add32
-#endif
+static Wsrep_thd_queue* wsrep_rollback_queue= 0;
+static Wsrep_thd_queue* wsrep_post_rollback_queue= 0;
+static Atomic_counter<uint64_t> wsrep_bf_aborts_counter;
+
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
- wsrep_local_bf_aborts = WSREP_ATOMIC_LOAD_LONG(&wsrep_bf_aborts_counter);
- var->type = SHOW_LONGLONG;
- var->value = (char*)&wsrep_local_bf_aborts;
+ wsrep_local_bf_aborts= wsrep_bf_aborts_counter;
+ var->type= SHOW_LONGLONG;
+ var->value= (char*)&wsrep_local_bf_aborts;
return 0;
}
-/* must have (&thd->LOCK_thd_data) */
-void wsrep_client_rollback(THD *thd)
-{
- WSREP_DEBUG("client rollback due to BF abort for (%lld), query: %s",
- (longlong) thd->thread_id, thd->query());
-
- WSREP_ATOMIC_ADD_LONG(&wsrep_bf_aborts_counter, 1);
-
- thd->wsrep_conflict_state= ABORTING;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- trans_rollback(thd);
-
- if (thd->locked_tables_mode && thd->lock)
- {
- WSREP_DEBUG("unlocking tables for BF abort (%lld)",
- (longlong) thd->thread_id);
- thd->locked_tables_list.unlock_locked_tables(thd);
- thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
- }
-
- if (thd->global_read_lock.is_acquired())
- {
- WSREP_DEBUG("unlocking GRL for BF abort (%lld)",
- (longlong) thd->thread_id);
- thd->global_read_lock.unlock_global_read_lock(thd);
- }
-
- /* Release transactional metadata locks. */
- thd->mdl_context.release_transactional_locks();
-
- /* release explicit MDL locks */
- thd->mdl_context.release_explicit_locks();
-
- if (thd->get_binlog_table_maps())
- {
- WSREP_DEBUG("clearing binlog table map for BF abort (%lld)",
- (longlong) thd->thread_id);
- thd->clear_binlog_table_maps();
- }
- mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_conflict_state= ABORTED;
-}
-
-#define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1
-#define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2
-
-static rpl_group_info* wsrep_relay_group_init(const char* log_fname)
-{
- Relay_log_info* rli= new Relay_log_info(false);
-
- if (!rli->relay_log.description_event_for_exec)
- {
- rli->relay_log.description_event_for_exec=
- new Format_description_log_event(4);
- }
-
- static LEX_CSTRING connection_name= { STRING_WITH_LEN("wsrep") };
-
- /*
- Master_info's constructor initializes rpl_filter by either an already
- constructed Rpl_filter object from global 'rpl_filters' list if the
- specified connection name is same, or it constructs a new Rpl_filter
- object and adds it to rpl_filters. This object is later destructed by
- Mater_info's destructor by looking it up based on connection name in
- rpl_filters list.
-
- However, since all Master_info objects created here would share same
- connection name ("wsrep"), destruction of any of the existing Master_info
- objects (in wsrep_return_from_bf_mode()) would free rpl_filter referenced
- by any/all existing Master_info objects.
-
- In order to avoid that, we have added a check in Master_info's destructor
- to not free the "wsrep" rpl_filter. It will eventually be freed by
- free_all_rpl_filters() when server terminates.
- */
- rli->mi = new Master_info(&connection_name, false);
-
- struct rpl_group_info *rgi= new rpl_group_info(rli);
- rgi->thd= rli->sql_driver_thd= current_thd;
-
- if ((rgi->deferred_events_collecting= rli->mi->rpl_filter->is_on()))
- {
- rgi->deferred_events= new Deferred_log_events(rli);
- }
-
- return rgi;
-}
-
-static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
+static void wsrep_replication_process(THD *thd,
+ void* arg __attribute__((unused)))
{
- shadow->options = thd->variables.option_bits;
- shadow->server_status = thd->server_status;
- shadow->wsrep_exec_mode = thd->wsrep_exec_mode;
- shadow->vio = thd->net.vio;
-
- // Disable general logging on applier threads
- thd->variables.option_bits |= OPTION_LOG_OFF;
- // Enable binlogging if opt_log_slave_updates is set
- if (opt_log_slave_updates)
- thd->variables.option_bits|= OPTION_BIN_LOG;
- else
- thd->variables.option_bits&= ~(OPTION_BIN_LOG);
+ DBUG_ENTER("wsrep_replication_process");
- if (!thd->wsrep_rgi) thd->wsrep_rgi= wsrep_relay_group_init("wsrep_relay");
+ Wsrep_applier_service applier_service(thd);
/* thd->system_thread_info.rpl_sql_info isn't initialized. */
thd->system_thread_info.rpl_sql_info=
new rpl_sql_thread_info(thd->wsrep_rgi->rli->mi->rpl_filter);
- thd->wsrep_exec_mode= REPL_RECV;
- thd->net.vio= 0;
- thd->clear_error();
-
- shadow->tx_isolation = thd->variables.tx_isolation;
- thd->variables.tx_isolation = ISO_READ_COMMITTED;
- thd->tx_isolation = ISO_READ_COMMITTED;
-
- shadow->db = thd->db.str;
- shadow->db_length = thd->db.length;
- shadow->user_time = thd->user_time;
- shadow->row_count_func= thd->get_row_count_func();
- thd->reset_db(&null_clex_str);
-}
+ WSREP_INFO("Starting applier thread %llu", thd->thread_id);
+ enum wsrep::provider::status
+ ret= Wsrep_server_state::get_provider().run_applier(&applier_service);
-static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
-{
- LEX_CSTRING db= {shadow->db, shadow->db_length };
- thd->variables.option_bits = shadow->options;
- thd->server_status = shadow->server_status;
- thd->wsrep_exec_mode = shadow->wsrep_exec_mode;
- thd->net.vio = shadow->vio;
- thd->variables.tx_isolation = shadow->tx_isolation;
- thd->user_time = shadow->user_time;
- thd->reset_db(&db);
+ WSREP_INFO("Applier thread exiting %d", ret);
+ mysql_mutex_lock(&LOCK_thread_count);
+ wsrep_close_applier(thd);
+ mysql_cond_broadcast(&COND_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
delete thd->system_thread_info.rpl_sql_info;
delete thd->wsrep_rgi->rli->mi;
delete thd->wsrep_rgi->rli;
-
+
thd->wsrep_rgi->cleanup_after_session();
delete thd->wsrep_rgi;
- thd->wsrep_rgi = NULL;
- thd->set_row_count_func(shadow->row_count_func);
-}
-
-void wsrep_replay_transaction(THD *thd)
-{
- DBUG_ENTER("wsrep_replay_transaction");
- /* checking if BF trx must be replayed */
- if (thd->wsrep_conflict_state== MUST_REPLAY) {
- DBUG_ASSERT(wsrep_thd_trx_seqno(thd));
- if (thd->wsrep_exec_mode!= REPL_RECV) {
- if (thd->get_stmt_da()->is_sent())
- {
- WSREP_ERROR("replay issue, thd has reported status already");
- }
-
-
- /*
- PS reprepare observer should have been removed already.
- open_table() will fail if we have dangling observer here.
- */
- DBUG_ASSERT(thd->m_reprepare_observer == NULL);
-
- struct da_shadow
- {
- enum Diagnostics_area::enum_diagnostics_status status;
- ulonglong affected_rows;
- ulonglong last_insert_id;
- char message[MYSQL_ERRMSG_SIZE];
- };
- struct da_shadow da_status;
- da_status.status= thd->get_stmt_da()->status();
- if (da_status.status == Diagnostics_area::DA_OK)
- {
- da_status.affected_rows= thd->get_stmt_da()->affected_rows();
- da_status.last_insert_id= thd->get_stmt_da()->last_insert_id();
- strmake(da_status.message,
- thd->get_stmt_da()->message(),
- sizeof(da_status.message)-1);
- }
-
- thd->get_stmt_da()->reset_diagnostics_area();
-
- thd->wsrep_conflict_state= REPLAYING;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ thd->wsrep_rgi= NULL;
- thd->reset_for_next_command();
- thd->reset_killed();
- close_thread_tables(thd);
- if (thd->locked_tables_mode && thd->lock)
- {
- WSREP_DEBUG("releasing table lock for replaying (%lld)",
- (longlong) thd->thread_id);
- thd->locked_tables_list.unlock_locked_tables(thd);
- thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
- }
- thd->mdl_context.release_transactional_locks();
- /*
- Replaying will call MYSQL_START_STATEMENT when handling
- BEGIN Query_log_event so end statement must be called before
- replaying.
- */
- MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
- thd->m_statement_psi= NULL;
- thd->m_digest= NULL;
- thd_proc_info(thd, "WSREP replaying trx");
- WSREP_DEBUG("replay trx: %s %lld",
- thd->query() ? thd->query() : "void",
- (long long)wsrep_thd_trx_seqno(thd));
- struct wsrep_thd_shadow shadow;
- wsrep_prepare_bf_thd(thd, &shadow);
-
- /* From trans_begin() */
- thd->variables.option_bits|= OPTION_BEGIN;
- thd->server_status|= SERVER_STATUS_IN_TRANS;
-
- int rcode = wsrep->replay_trx(wsrep,
- &thd->wsrep_ws_handle,
- (void *)thd);
-
- wsrep_return_from_bf_mode(thd, &shadow);
- if (thd->wsrep_conflict_state!= REPLAYING)
- WSREP_WARN("lost replaying mode: %d", thd->wsrep_conflict_state );
-
- mysql_mutex_lock(&thd->LOCK_thd_data);
-
- switch (rcode)
- {
- case WSREP_OK:
- thd->wsrep_conflict_state= NO_CONFLICT;
- wsrep->post_commit(wsrep, &thd->wsrep_ws_handle);
- WSREP_DEBUG("trx_replay successful for: %lld %lld",
- (longlong) thd->thread_id, (longlong) thd->real_id);
- if (thd->get_stmt_da()->is_sent())
- {
- WSREP_WARN("replay ok, thd has reported status");
- }
- else if (thd->get_stmt_da()->is_set())
- {
- if (thd->get_stmt_da()->status() != Diagnostics_area::DA_OK &&
- thd->get_stmt_da()->status() != Diagnostics_area::DA_OK_BULK)
- {
- WSREP_WARN("replay ok, thd has error status %d",
- thd->get_stmt_da()->status());
- }
- }
- else
- {
- if (da_status.status == Diagnostics_area::DA_OK)
- {
- my_ok(thd,
- da_status.affected_rows,
- da_status.last_insert_id,
- da_status.message);
- }
- else
- {
- my_ok(thd);
- }
- }
- break;
- case WSREP_TRX_FAIL:
- if (thd->get_stmt_da()->is_sent())
- {
- WSREP_ERROR("replay failed, thd has reported status");
- }
- else
- {
- WSREP_DEBUG("replay failed, rolling back");
- }
- thd->wsrep_conflict_state= ABORTED;
- wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle);
- break;
- default:
- WSREP_ERROR("trx_replay failed for: %d, schema: %s, query: %s",
- rcode, thd->get_db(),
- thd->query() ? thd->query() : "void");
- /* we're now in inconsistent state, must abort */
-
- /* http://bazaar.launchpad.net/~codership/codership-mysql/5.6/revision/3962#sql/wsrep_thd.cc */
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-
- unireg_abort(1);
- break;
- }
-
- wsrep_cleanup_transaction(thd);
-
- mysql_mutex_lock(&LOCK_wsrep_replaying);
- wsrep_replaying--;
- WSREP_DEBUG("replaying decreased: %d, thd: %lld",
- wsrep_replaying, (longlong) thd->thread_id);
- mysql_cond_broadcast(&COND_wsrep_replaying);
- mysql_mutex_unlock(&LOCK_wsrep_replaying);
- }
- }
- DBUG_VOID_RETURN;
-}
-
-static void wsrep_replication_process(THD *thd)
-{
- int rcode;
- DBUG_ENTER("wsrep_replication_process");
-
- struct wsrep_thd_shadow shadow;
- wsrep_prepare_bf_thd(thd, &shadow);
-
- /* From trans_begin() */
- thd->variables.option_bits|= OPTION_BEGIN;
- thd->server_status|= SERVER_STATUS_IN_TRANS;
-
- rcode = wsrep->recv(wsrep, (void *)thd);
- DBUG_PRINT("wsrep",("wsrep_repl returned: %d", rcode));
-
- WSREP_INFO("applier thread exiting (code:%d)", rcode);
-
- switch (rcode) {
- case WSREP_OK:
- case WSREP_NOT_IMPLEMENTED:
- case WSREP_CONN_FAIL:
- /* provider does not support slave operations / disconnected from group,
- * just close applier thread */
- break;
- case WSREP_NODE_FAIL:
- /* data inconsistency => SST is needed */
- /* Note: we cannot just blindly restart replication here,
- * SST might require server restart if storage engines must be
- * initialized after SST */
- WSREP_ERROR("node consistency compromised, aborting");
- wsrep_kill_mysql(thd);
- break;
- case WSREP_WARNING:
- case WSREP_TRX_FAIL:
- case WSREP_TRX_MISSING:
- /* these suggests a bug in provider code */
- WSREP_WARN("bad return from recv() call: %d", rcode);
- /* Shut down this node. */
- /* fall through */
- case WSREP_FATAL:
- /* Cluster connectivity is lost.
- *
- * If applier was killed on purpose (KILL_CONNECTION), we
- * avoid mysql shutdown. This is because the killer will then handle
- * shutdown processing (or replication restarting)
- */
- if (thd->killed != KILL_CONNECTION)
- {
- wsrep_kill_mysql(thd);
- }
- break;
- }
-
- mysql_mutex_lock(&LOCK_thread_count);
- wsrep_close_applier(thd);
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
if(thd->has_thd_temporary_tables())
{
WSREP_WARN("Applier %lld has temporary tables at exit.",
thd->thread_id);
}
- wsrep_return_from_bf_mode(thd, &shadow);
DBUG_VOID_RETURN;
}
-static bool create_wsrep_THD(wsrep_thd_processor_fun processor)
+static bool create_wsrep_THD(Wsrep_thd_args* args)
{
ulong old_wsrep_running_threads= wsrep_running_threads;
pthread_t unused;
mysql_mutex_lock(&LOCK_thread_count);
+
bool res= pthread_create(&unused, &connection_attrib, start_wsrep_THD,
- (void*)processor);
+ args);
/*
if starting a thread on server startup, wait until the this thread's THD
is fully initialized (otherwise a THD initialization code might
@@ -435,244 +105,291 @@ static bool create_wsrep_THD(wsrep_thd_processor_fun processor)
void wsrep_create_appliers(long threads)
{
- if (!wsrep_connected)
+ /* Dont' start slave threads if wsrep-provider or wsrep-cluster-address
+ is not set.
+ */
+ if (!WSREP_PROVIDER_EXISTS)
+ {
+ return;
+ }
+
+ if (!wsrep_cluster_address || wsrep_cluster_address[0]== 0)
{
- /* see wsrep_replication_start() for the logic */
- if (wsrep_cluster_address && strlen(wsrep_cluster_address) &&
- wsrep_provider && strcasecmp(wsrep_provider, "none"))
- {
- WSREP_ERROR("Trying to launch slave threads before creating "
- "connection at '%s'", wsrep_cluster_address);
- assert(0);
- }
return;
}
long wsrep_threads=0;
- while (wsrep_threads++ < threads) {
- if (create_wsrep_THD(wsrep_replication_process))
+
+ while (wsrep_threads++ < threads)
+ {
+ Wsrep_thd_args* args(new Wsrep_thd_args(wsrep_replication_process, 0));
+ if (create_wsrep_THD(args))
+ {
WSREP_WARN("Can't create thread to manage wsrep replication");
+ }
}
}
-static void wsrep_rollback_process(THD *thd)
+static void wsrep_rollback_process(THD *rollbacker,
+ void *arg __attribute__((unused)))
{
DBUG_ENTER("wsrep_rollback_process");
- mysql_mutex_lock(&LOCK_wsrep_rollback);
- wsrep_aborting_thd= NULL;
-
- while (thd->killed == NOT_KILLED) {
- thd_proc_info(thd, "WSREP aborter idle");
- thd->mysys_var->current_mutex= &LOCK_wsrep_rollback;
- thd->mysys_var->current_cond= &COND_wsrep_rollback;
+ THD* thd= NULL;
+ DBUG_ASSERT(!wsrep_rollback_queue);
+ wsrep_rollback_queue= new Wsrep_thd_queue(rollbacker);
- mysql_cond_wait(&COND_wsrep_rollback,&LOCK_wsrep_rollback);
+ thd_proc_info(rollbacker, "wsrep aborter idle");
+ while ((thd= wsrep_rollback_queue->pop_front()) != NULL)
+ {
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ wsrep::client_state& cs(thd->wsrep_cs());
+ const wsrep::transaction& tx(cs.transaction());
+ if (tx.state() == wsrep::transaction::s_aborted)
+ {
+ WSREP_DEBUG("rollbacker thd already aborted: %llu state: %d",
+ (long long)thd->real_id,
+ tx.state());
- WSREP_DEBUG("WSREP rollback thread wakes for signal");
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ continue;
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd_proc_info(thd, "WSREP aborter active");
- thd->mysys_var->current_mutex= 0;
- thd->mysys_var->current_cond= 0;
- mysql_mutex_unlock(&thd->mysys_var->mutex);
+ thd_proc_info(rollbacker, "wsrep aborter active");
- /* check for false alarms */
- if (!wsrep_aborting_thd)
+ wsrep::transaction_id transaction_id(thd->wsrep_trx().id());
+ if (thd->wsrep_trx().is_streaming() &&
+ thd->wsrep_trx().bf_aborted_in_total_order())
{
- WSREP_DEBUG("WSREP rollback thread has empty abort queue");
- }
- /* process all entries in the queue */
- while (wsrep_aborting_thd) {
- THD *aborting;
- wsrep_aborting_thd_t next = wsrep_aborting_thd->next;
- aborting = wsrep_aborting_thd->aborting_thd;
- my_free(wsrep_aborting_thd);
- wsrep_aborting_thd= next;
- /*
- * must release mutex, appliers my want to add more
- * aborting thds in our work queue, while we rollback
- */
- mysql_mutex_unlock(&LOCK_wsrep_rollback);
-
- mysql_mutex_lock(&aborting->LOCK_thd_data);
- if (aborting->wsrep_conflict_state== ABORTED)
+ thd->store_globals();
+ thd->wsrep_cs().store_globals();
+ if (thd->wsrep_cs().mode() == wsrep::client_state::m_high_priority)
{
- WSREP_DEBUG("WSREP, thd already aborted: %llu state: %d",
- (long long)aborting->real_id,
- aborting->wsrep_conflict_state);
-
- mysql_mutex_unlock(&aborting->LOCK_thd_data);
- mysql_mutex_lock(&LOCK_wsrep_rollback);
- continue;
+ DBUG_ASSERT(thd->wsrep_applier_service);
+ thd->wsrep_applier_service->rollback(wsrep::ws_handle(),
+ wsrep::ws_meta());
+ thd->wsrep_applier_service->after_apply();
+ /* Will free THD */
+ Wsrep_server_state::instance().server_service().
+ release_high_priority_service(thd->wsrep_applier_service);
}
- aborting->wsrep_conflict_state= ABORTING;
-
- mysql_mutex_unlock(&aborting->LOCK_thd_data);
-
- set_current_thd(aborting);
- aborting->store_globals();
-
- mysql_mutex_lock(&aborting->LOCK_thd_data);
- wsrep_client_rollback(aborting);
- WSREP_DEBUG("WSREP rollbacker aborted thd: (%lld %lld)",
- (longlong) aborting->thread_id,
- (longlong) aborting->real_id);
- mysql_mutex_unlock(&aborting->LOCK_thd_data);
-
- set_current_thd(thd);
+ else
+ {
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ /* prepare THD for rollback processing */
+ thd->reset_for_next_command(true);
+ thd->lex->sql_command= SQLCOM_ROLLBACK;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ /* Perform a client rollback, restore globals and signal
+ the victim only when all the resources have been
+ released */
+ thd->wsrep_cs().client_service().bf_rollback();
+ thd->reset_globals();
+ thd->wsrep_cs().sync_rollback_complete();
+ }
+ }
+ else if (wsrep_thd_is_applying(thd))
+ {
+ WSREP_DEBUG("rollbacker aborting SR thd: (%lld %llu)",
+ thd->thread_id, (long long)thd->real_id);
+ DBUG_ASSERT(thd->wsrep_cs().mode() == Wsrep_client_state::m_high_priority);
+ /* Must be streaming and must have been removed from the
+ server state streaming appliers map. */
+ DBUG_ASSERT(thd->wsrep_trx().is_streaming());
+ DBUG_ASSERT(!Wsrep_server_state::instance().find_streaming_applier(
+ thd->wsrep_trx().server_id(),
+ thd->wsrep_trx().id()));
+ DBUG_ASSERT(thd->wsrep_applier_service);
+
+ /* Fragment removal should happen before rollback to make
+ the transaction non-observable in SR table after the rollback
+ completes. For correctness the order does not matter here,
+ but currently it is mandated by checks in some MTR tests. */
+ Wsrep_storage_service* storage_service=
+ static_cast<Wsrep_storage_service*>(
+ Wsrep_server_state::instance().server_service().storage_service(
+ *thd->wsrep_applier_service));
+ storage_service->store_globals();
+ storage_service->adopt_transaction(thd->wsrep_trx());
+ storage_service->remove_fragments();
+ storage_service->commit(wsrep::ws_handle(transaction_id, 0),
+ wsrep::ws_meta());
+ Wsrep_server_state::instance().server_service().release_storage_service(storage_service);
thd->store_globals();
+ thd->wsrep_cs().store_globals();
+ thd->wsrep_applier_service->rollback(wsrep::ws_handle(),
+ wsrep::ws_meta());
+ thd->wsrep_applier_service->after_apply();
+ /* Will free THD */
+ Wsrep_server_state::instance().server_service()
+ .release_high_priority_service(thd->wsrep_applier_service);
- mysql_mutex_lock(&LOCK_wsrep_rollback);
}
+ else
+ {
+ if (thd->wsrep_trx().is_streaming())
+ {
+ Wsrep_storage_service* storage_service=
+ static_cast<Wsrep_storage_service*>(
+ Wsrep_server_state::instance().server_service().
+ storage_service(thd->wsrep_cs().client_service()));
+
+ storage_service->store_globals();
+ storage_service->adopt_transaction(thd->wsrep_trx());
+ storage_service->remove_fragments();
+ storage_service->commit(wsrep::ws_handle(transaction_id, 0),
+ wsrep::ws_meta());
+ Wsrep_server_state::instance().server_service().
+ release_storage_service(storage_service);
+ }
+ thd->store_globals();
+ thd->wsrep_cs().store_globals();
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ /* prepare THD for rollback processing */
+ thd->reset_for_next_command();
+ thd->lex->sql_command= SQLCOM_ROLLBACK;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ /* Perform a client rollback, restore globals and signal
+ the victim only when all the resources have been
+ released */
+ thd->wsrep_cs().client_service().bf_rollback();
+ thd->reset_globals();
+ thd->wsrep_cs().sync_rollback_complete();
+ WSREP_DEBUG("rollbacker aborted thd: (%llu %llu)",
+ thd->thread_id, (long long)thd->real_id);
+ }
+
+ thd_proc_info(rollbacker, "wsrep aborter idle");
}
+
+ delete wsrep_rollback_queue;
+ wsrep_rollback_queue= NULL;
- mysql_mutex_unlock(&LOCK_wsrep_rollback);
sql_print_information("WSREP: rollbacker thread exiting");
+ DBUG_ASSERT(rollbacker->killed != NOT_KILLED);
DBUG_PRINT("wsrep",("wsrep rollbacker thread exiting"));
DBUG_VOID_RETURN;
}
-void wsrep_create_rollbacker()
+static void wsrep_post_rollback_process(THD *post_rollbacker,
+ void *arg __attribute__((unused)))
{
- if (wsrep_provider && strcasecmp(wsrep_provider, "none"))
- {
- /* create rollbacker */
- if (create_wsrep_THD(wsrep_rollback_process))
- WSREP_WARN("Can't create thread to manage wsrep rollback");
- }
-}
+ DBUG_ENTER("wsrep_post_rollback_process");
+ THD* thd= NULL;
-void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe)
-{
- if (thd_ptr)
- {
- THD* thd = (THD*)thd_ptr;
- thd->wsrep_PA_safe = safe;
- }
-}
+ DBUG_ASSERT(!wsrep_post_rollback_queue);
+ wsrep_post_rollback_queue= new Wsrep_thd_queue(post_rollbacker);
-enum wsrep_conflict_state wsrep_thd_conflict_state(THD *thd, my_bool sync)
-{
- enum wsrep_conflict_state state = NO_CONFLICT;
- if (thd)
+ while ((thd= wsrep_post_rollback_queue->pop_front()) != NULL)
{
- if (sync) mysql_mutex_lock(&thd->LOCK_thd_data);
-
- state = thd->wsrep_conflict_state;
- if (sync) mysql_mutex_unlock(&thd->LOCK_thd_data);
+ thd->store_globals();
+ wsrep::client_state& cs(thd->wsrep_cs());
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_aborting);
+ WSREP_DEBUG("post rollbacker calling post rollback for thd %llu, conf %s",
+ thd->thread_id, wsrep_thd_transaction_state_str(thd));
+
+ cs.after_rollback();
+ DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_aborted);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
}
- return state;
-}
-my_bool wsrep_thd_is_wsrep(THD *thd)
-{
- my_bool status = FALSE;
- if (thd)
- {
- status = (WSREP(thd) && WSREP_PROVIDER_EXISTS);
- }
- return status;
+ delete wsrep_post_rollback_queue;
+ wsrep_post_rollback_queue= NULL;
+
+ DBUG_ASSERT(post_rollbacker->killed != NOT_KILLED);
+ DBUG_PRINT("wsrep",("wsrep post rollbacker thread exiting"));
+ DBUG_VOID_RETURN;
}
-my_bool wsrep_thd_is_BF(THD *thd, my_bool sync)
+void wsrep_create_rollbacker()
{
- my_bool status = FALSE;
- if (thd)
+ if (wsrep_provider && strcasecmp(wsrep_provider, "none"))
{
- // THD can be BF only if provider exists
- if (wsrep_thd_is_wsrep(thd))
- {
- if (sync)
- mysql_mutex_lock(&thd->LOCK_thd_data);
+ Wsrep_thd_args* args= new Wsrep_thd_args(wsrep_rollback_process, 0);
- status = ((thd->wsrep_exec_mode == REPL_RECV) ||
- (thd->wsrep_exec_mode == TOTAL_ORDER));
- if (sync)
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
- }
- return status;
-}
+ /* create rollbacker */
+ if (create_wsrep_THD(args))
+ WSREP_WARN("Can't create thread to manage wsrep rollback");
-extern "C"
-my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync)
-{
- bool status = FALSE;
- if (thd_ptr)
- {
- THD* thd = (THD*)thd_ptr;
- if (sync) mysql_mutex_lock(&thd->LOCK_thd_data);
-
- status = ((thd->wsrep_exec_mode == REPL_RECV) ||
- (thd->wsrep_exec_mode == TOTAL_ORDER) ||
- (thd->wsrep_exec_mode == LOCAL_COMMIT));
- if (sync) mysql_mutex_unlock(&thd->LOCK_thd_data);
- }
- return status;
+ /* create post_rollbacker */
+ args= new Wsrep_thd_args(wsrep_post_rollback_process, 0);
+ if (create_wsrep_THD(args))
+ WSREP_WARN("Can't create thread to manage wsrep post rollback");
+ }
}
-extern "C"
-my_bool wsrep_thd_is_local(void *thd_ptr, my_bool sync)
+/*
+ Start async rollback process
+
+ Asserts thd->LOCK_thd_data ownership
+ */
+void wsrep_fire_rollbacker(THD *thd)
{
- bool status = FALSE;
- if (thd_ptr)
+ DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_aborting);
+ DBUG_PRINT("wsrep",("enqueuing trx abort for %llu", thd->thread_id));
+ WSREP_DEBUG("enqueuing trx abort for (%llu)", thd->thread_id);
+ if (wsrep_rollback_queue->push_back(thd))
{
- THD* thd = (THD*)thd_ptr;
- if (sync) mysql_mutex_lock(&thd->LOCK_thd_data);
-
- status = (thd->wsrep_exec_mode == LOCAL_STATE);
- if (sync) mysql_mutex_unlock(&thd->LOCK_thd_data);
+ WSREP_WARN("duplicate thd %llu for rollbacker",
+ thd->thread_id);
}
- return status;
}
+
int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal)
{
- THD *victim_thd = (THD *) victim_thd_ptr;
- THD *bf_thd = (THD *) bf_thd_ptr;
DBUG_ENTER("wsrep_abort_thd");
-
+ THD *victim_thd= (THD *) victim_thd_ptr;
+ THD *bf_thd= (THD *) bf_thd_ptr;
+ mysql_mutex_lock(&victim_thd->LOCK_thd_data);
if ( (WSREP(bf_thd) ||
( (WSREP_ON || bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU) &&
- bf_thd->wsrep_exec_mode == TOTAL_ORDER) ) &&
- victim_thd)
+ wsrep_thd_is_toi(bf_thd)) ) &&
+ victim_thd &&
+ !wsrep_thd_is_aborting(victim_thd))
{
- if ((victim_thd->wsrep_conflict_state == MUST_ABORT) ||
- (victim_thd->wsrep_conflict_state == ABORTED) ||
- (victim_thd->wsrep_conflict_state == ABORTING))
- {
- WSREP_DEBUG("wsrep_abort_thd called by %llu with victim %llu already "
- "aborted. Ignoring.",
- (bf_thd) ? (long long)bf_thd->real_id : 0,
- (long long)victim_thd->real_id);
- DBUG_RETURN(1);
- }
-
- WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ?
- (long long)bf_thd->real_id : 0, (long long)victim_thd->real_id);
- ha_abort_transaction(bf_thd, victim_thd, signal);
+ WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ?
+ (long long)bf_thd->real_id : 0, (long long)victim_thd->real_id);
+ mysql_mutex_unlock(&victim_thd->LOCK_thd_data);
+ ha_abort_transaction(bf_thd, victim_thd, signal);
+ mysql_mutex_lock(&victim_thd->LOCK_thd_data);
}
else
{
WSREP_DEBUG("wsrep_abort_thd not effective: %p %p", bf_thd, victim_thd);
}
-
+ mysql_mutex_unlock(&victim_thd->LOCK_thd_data);
DBUG_RETURN(1);
}
-extern "C"
-int wsrep_thd_in_locking_session(void *thd_ptr)
+bool wsrep_bf_abort(const THD* bf_thd, THD* victim_thd)
{
- if (thd_ptr && ((THD *)thd_ptr)->in_lock_tables) {
- return 1;
+ WSREP_LOG_THD((THD*)bf_thd, "BF aborter before");
+ WSREP_LOG_THD(victim_thd, "victim before");
+ wsrep::seqno bf_seqno(bf_thd->wsrep_trx().ws_meta().seqno());
+
+ if (WSREP(victim_thd) && !victim_thd->wsrep_trx().active())
+ {
+ WSREP_DEBUG("wsrep_bf_abort, BF abort for non active transaction");
+ wsrep_start_transaction(victim_thd, victim_thd->wsrep_next_trx_id());
}
- return 0;
-}
-bool wsrep_thd_has_explicit_locks(THD *thd)
-{
- assert(thd);
- return thd->mdl_context.has_explicit_locks();
+ bool ret;
+ if (wsrep_thd_is_toi(bf_thd))
+ {
+ ret= victim_thd->wsrep_cs().total_order_bf_abort(bf_seqno);
+ }
+ else
+ {
+ ret= victim_thd->wsrep_cs().bf_abort(bf_seqno);
+ }
+ if (ret)
+ {
+ wsrep_bf_aborts_counter++;
+ }
+ return ret;
}
+
diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h
index 5900668f3fb..3114e02e1b8 100644
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@ -13,42 +13,220 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#include <my_config.h>
-
#ifndef WSREP_THD_H
#define WSREP_THD_H
-#ifdef WITH_WSREP
+#include <my_config.h>
+#include "mysql/service_wsrep.h"
+#include "wsrep/client_state.hpp"
#include "sql_class.h"
+#include "wsrep_utils.h"
+#include <deque>
+class Wsrep_thd_queue
+{
+public:
+ Wsrep_thd_queue(THD* t) : thd(t)
+ {
+ mysql_mutex_init(key_LOCK_wsrep_thd_queue,
+ &LOCK_wsrep_thd_queue,
+ MY_MUTEX_INIT_FAST);
+ mysql_cond_init(key_COND_wsrep_thd_queue, &COND_wsrep_thd_queue, NULL);
+ }
+ ~Wsrep_thd_queue()
+ {
+ mysql_mutex_destroy(&LOCK_wsrep_thd_queue);
+ mysql_cond_destroy(&COND_wsrep_thd_queue);
+ }
+ bool push_back(THD* thd)
+ {
+ DBUG_ASSERT(thd);
+ wsp::auto_lock lock(&LOCK_wsrep_thd_queue);
+ std::deque<THD*>::iterator it = queue.begin();
+ while (it != queue.end())
+ {
+ if (*it == thd)
+ {
+ return true;
+ }
+ it++;
+ }
+ queue.push_back(thd);
+ mysql_cond_signal(&COND_wsrep_thd_queue);
+ return false;
+ }
+ THD* pop_front()
+ {
+ wsp::auto_lock lock(&LOCK_wsrep_thd_queue);
+ while (queue.empty())
+ {
+ if (thd->killed != NOT_KILLED)
+ return NULL;
+
+ thd->mysys_var->current_mutex= &LOCK_wsrep_thd_queue;
+ thd->mysys_var->current_cond= &COND_wsrep_thd_queue;
+
+ mysql_cond_wait(&COND_wsrep_thd_queue, &LOCK_wsrep_thd_queue);
+
+ thd->mysys_var->current_mutex= 0;
+ thd->mysys_var->current_cond= 0;
+ }
+ THD* ret= queue.front();
+ queue.pop_front();
+ return ret;
+ }
+private:
+ THD* thd;
+ std::deque<THD*> queue;
+ mysql_mutex_t LOCK_wsrep_thd_queue;
+ mysql_cond_t COND_wsrep_thd_queue;
+};
+
+void wsrep_prepare_bf_thd(THD*, struct wsrep_thd_shadow*);
+void wsrep_return_from_bf_mode(THD*, struct wsrep_thd_shadow*);
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope);
-void wsrep_client_rollback(THD *thd);
+void wsrep_client_rollback(THD *thd, bool rollbacker = false);
void wsrep_replay_transaction(THD *thd);
void wsrep_create_appliers(long threads);
void wsrep_create_rollbacker();
+bool wsrep_bf_abort(const THD*, THD*);
int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr,
my_bool signal);
-
-/*
- PA = Parallel Applying (on the slave side)
-*/
extern void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe);
-extern my_bool wsrep_thd_is_BF(THD *thd, my_bool sync);
-extern my_bool wsrep_thd_is_wsrep(void *thd_ptr);
+THD* wsrep_start_SR_THD(char *thread_stack);
+void wsrep_end_SR_THD(THD* thd);
+
+/**
+ Helper functions to override error status
+
+ In many contexts it is desirable to mask the original error status
+ set for THD or it is necessary to change OK status to error.
+ This function implements the common logic for the most
+ of the cases.
+
+ Rules:
+ * If the diagnostics are has OK or EOF status, override it unconditionally
+ * If the error is either ER_ERROR_DURING_COMMIT or ER_LOCK_DEADLOCK
+ it is usually the correct error status to be returned to client,
+ so don't override those by default
+ */
+
+static inline void wsrep_override_error(THD *thd, uint error)
+{
+ DBUG_ASSERT(error != ER_ERROR_DURING_COMMIT);
+ Diagnostics_area *da= thd->get_stmt_da();
+ if (da->is_ok() ||
+ da->is_eof() ||
+ !da->is_set() ||
+ (da->is_error() &&
+ da->sql_errno() != error &&
+ da->sql_errno() != ER_ERROR_DURING_COMMIT &&
+ da->sql_errno() != ER_LOCK_DEADLOCK))
+ {
+ da->reset_diagnostics_area();
+ my_error(error, MYF(0));
+ }
+}
+
+/**
+ Override error with additional wsrep status.
+ */
+static inline void wsrep_override_error(THD *thd, uint error,
+ enum wsrep::provider::status status)
+{
+ Diagnostics_area *da= thd->get_stmt_da();
+ if (da->is_ok() ||
+ !da->is_set() ||
+ (da->is_error() &&
+ da->sql_errno() != error &&
+ da->sql_errno() != ER_ERROR_DURING_COMMIT &&
+ da->sql_errno() != ER_LOCK_DEADLOCK))
+ {
+ da->reset_diagnostics_area();
+ my_error(error, MYF(0), status);
+ }
+}
+
+static inline void wsrep_override_error(THD* thd,
+ wsrep::client_error ce,
+ enum wsrep::provider::status status)
+{
+ DBUG_ASSERT(ce != wsrep::e_success);
+ switch (ce)
+ {
+ case wsrep::e_error_during_commit:
+ wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
+ break;
+ case wsrep::e_deadlock_error:
+ wsrep_override_error(thd, ER_LOCK_DEADLOCK);
+ break;
+ case wsrep::e_interrupted_error:
+ wsrep_override_error(thd, ER_QUERY_INTERRUPTED);
+ break;
+ case wsrep::e_size_exceeded_error:
+ wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
+ break;
+ case wsrep::e_append_fragment_error:
+ /* TODO: Figure out better error number */
+ wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
+ break;
+ case wsrep::e_not_supported_error:
+ wsrep_override_error(thd, ER_NOT_SUPPORTED_YET);
+ break;
+ case wsrep::e_timeout_error:
+ wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT);
+ break;
+ default:
+ wsrep_override_error(thd, ER_UNKNOWN_ERROR);
+ break;
+ }
+}
-enum wsrep_conflict_state wsrep_thd_conflict_state(void *thd_ptr, my_bool sync);
-extern "C" my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync);
-extern "C" my_bool wsrep_thd_is_local(void *thd_ptr, my_bool sync);
-extern "C" int wsrep_thd_in_locking_session(void *thd_ptr);
+/**
+ Helper function to log THD wsrep context.
-#else /* WITH_WSREP */
+ @param thd Pointer to THD
+ @param message Optional message
+ @param function Function where the call was made from
+ */
+static inline void wsrep_log_thd(THD *thd,
+ const char *message,
+ const char *function)
+{
+ WSREP_DEBUG("%s %s\n"
+ " thd: %llu thd_ptr: %p client_mode: %s client_state: %s trx_state: %s\n"
+ " next_trx_id: %lld trx_id: %lld seqno: %lld\n"
+ " is_streaming: %d fragments: %zu\n"
+ " sql_errno: %u message: %s\n"
+#define WSREP_THD_LOG_QUERIES
+#ifdef WSREP_THD_LOG_QUERIES
+ " command: %d query: %.72s"
+#endif /* WSREP_OBSERVER_LOG_QUERIES */
+ ,
+ function,
+ message ? message : "",
+ thd->thread_id,
+ thd,
+ wsrep_thd_client_mode_str(thd),
+ wsrep_thd_client_state_str(thd),
+ wsrep_thd_transaction_state_str(thd),
+ (long long)thd->wsrep_next_trx_id(),
+ (long long)thd->wsrep_trx_id(),
+ (long long)wsrep_thd_trx_seqno(thd),
+ thd->wsrep_trx().is_streaming(),
+ thd->wsrep_sr().fragments().size(),
+ (thd->get_stmt_da()->is_error() ? thd->get_stmt_da()->sql_errno() : 0),
+ (thd->get_stmt_da()->is_error() ? thd->get_stmt_da()->message() : "")
+#ifdef WSREP_THD_LOG_QUERIES
+ , thd->lex->sql_command,
+ WSREP_QUERY(thd)
+#endif /* WSREP_OBSERVER_LOG_QUERIES */
+ );
+}
-#define wsrep_thd_is_BF(T, S) (0)
-#define wsrep_abort_thd(X,Y,Z) do { } while(0)
-#define wsrep_create_appliers(T) do { } while(0)
+#define WSREP_LOG_THD(thd_, message_) wsrep_log_thd(thd_, message_, __FUNCTION__)
-#endif
#endif /* WSREP_THD_H */
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
new file mode 100644
index 00000000000..a3acc9e78fb
--- /dev/null
+++ b/sql/wsrep_trans_observer.h
@@ -0,0 +1,423 @@
+/* Copyright 2016 Codership Oy <http://www.codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef WSREP_TRANS_OBSERVER_H
+#define WSREP_TRANS_OBSERVER_H
+
+#include "my_global.h"
+#include "mysql/service_wsrep.h"
+#include "wsrep_applier.h" /* wsrep_apply_error */
+#include "wsrep_xid.h"
+#include "wsrep_thd.h"
+
+#include "my_dbug.h"
+
+class THD;
+
+/*
+ Return true if THD has active wsrep transaction.
+ */
+static inline bool wsrep_is_active(THD* thd)
+{
+ return (thd->wsrep_cs().state() != wsrep::client_state::s_none &&
+ thd->wsrep_cs().transaction().active());
+}
+
+/*
+ Return true if THD is either committing a transaction or statement
+ is autocommit.
+ */
+static inline bool wsrep_is_real(THD* thd, bool all)
+{
+ return (all || thd->transaction.all.ha_list == 0);
+}
+
+/*
+ Check if a transaction has generated changes.
+ */
+static inline bool wsrep_has_changes(THD* thd, my_bool all)
+{
+ return (thd->wsrep_trx().is_empty() == false);
+}
+
+/*
+ Check if an active transaction has been BF aborted.
+ */
+static inline bool wsrep_is_bf_aborted(THD* thd)
+{
+ return (thd->wsrep_trx().active() && thd->wsrep_trx().bf_aborted());
+}
+
+static inline int wsrep_check_pk(THD* thd)
+{
+ if (!wsrep_certify_nonPK)
+ {
+ for (TABLE* table= thd->open_tables; table != NULL; table= table->next)
+ {
+ if (table->key_info == NULL || table->s->primary_key == MAX_KEY)
+ {
+ WSREP_DEBUG("No primary key found for table %s.%s",
+ table->s->db.str, table->s->table_name.str);
+ wsrep_override_error(thd, ER_LOCK_DEADLOCK);
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+static inline bool wsrep_streaming_enabled(THD* thd)
+{
+ return (thd->wsrep_sr().fragment_size() > 0);
+}
+
+
+static inline int wsrep_start_transaction(THD* thd, wsrep_trx_id_t trx_id)
+{
+ return (thd->wsrep_cs().state() != wsrep::client_state::s_none ?
+ thd->wsrep_cs().start_transaction(wsrep::transaction_id(trx_id)) :
+ 0);
+}
+
+/**/
+static inline int wsrep_start_trx_if_not_started(THD* thd)
+{
+ int ret= 0;
+ DBUG_ASSERT(thd->wsrep_next_trx_id() != WSREP_UNDEFINED_TRX_ID);
+ DBUG_ASSERT(thd->wsrep_cs().mode() == Wsrep_client_state::m_local);
+ if (thd->wsrep_trx().active() == false)
+ {
+ ret= wsrep_start_transaction(thd, thd->wsrep_next_trx_id());
+ }
+ return ret;
+}
+
+/*
+ Called after each row operation.
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_after_row(THD* thd, bool)
+{
+ if (thd->wsrep_cs().state() != wsrep::client_state::s_none &&
+ wsrep_thd_is_local(thd))
+ {
+ if (wsrep_check_pk(thd))
+ {
+ return 1;
+ }
+ else if (wsrep_streaming_enabled(thd))
+ {
+ return thd->wsrep_cs().after_row();
+ }
+ }
+ return 0;
+}
+
+/*
+ Helper method to determine whether commit time hooks
+ should be run for the transaction.
+ */
+static inline bool wsrep_run_commit_hook(THD* thd, bool all)
+{
+ return (wsrep_is_real(thd, all) && wsrep_is_active(thd) &&
+ (wsrep_thd_is_applying(thd) || wsrep_has_changes(thd, all)));
+}
+
+/*
+ Called before the transaction is prepared.
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_before_prepare(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_before_prepare");
+ WSREP_DEBUG("wsrep_before_prepare: %d", wsrep_is_real(thd, all));
+ int ret= 0;
+ if (wsrep_run_commit_hook(thd, all))
+ {
+ if ((ret= thd->wsrep_cs().before_prepare()) == 0)
+ {
+ DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined());
+ wsrep_xid_init(&thd->wsrep_xid,
+ thd->wsrep_trx().ws_meta().gtid());
+ }
+ }
+ DBUG_RETURN(ret);
+}
+
+/*
+ Called after the transaction has been prepared.
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_after_prepare(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_after_prepare");
+ WSREP_DEBUG("wsrep_after_prepare: %d", wsrep_is_real(thd, all));
+ int ret= (wsrep_run_commit_hook(thd, all) ?
+ thd->wsrep_cs().after_prepare() : 0);
+ DBUG_ASSERT(ret == 0 || thd->wsrep_cs().current_error() ||
+ thd->wsrep_cs().transaction().state() == wsrep::transaction::s_must_replay);
+ DBUG_RETURN(ret);
+}
+
+
+/*
+ Called before the transaction is committed.
+
+ This function must be called from both client and
+ applier contexts before commit.
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_before_commit(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_before_commit");
+ WSREP_DEBUG("wsrep_before_commit: %d, %lld",
+ wsrep_is_real(thd, all),
+ (long long)wsrep_thd_trx_seqno(thd));
+ int ret= 0;
+ if (wsrep_run_commit_hook(thd, all))
+ {
+ if ((ret= thd->wsrep_cs().before_commit()) == 0)
+ {
+ DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined());
+ wsrep_xid_init(&thd->wsrep_xid,
+ thd->wsrep_trx().ws_meta().gtid());
+ }
+ }
+ DBUG_RETURN(ret);
+}
+
+/*
+ Called after the transaction has been ordered for commit.
+
+ This function must be called from both client and
+ applier contexts after the commit has been ordered.
+
+ @param thd Pointer to THD
+ @param all
+ @param err Error buffer in case of applying error
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_ordered_commit(THD* thd,
+ bool all,
+ const wsrep_apply_error&)
+{
+ DBUG_ENTER("wsrep_ordered_commit");
+ WSREP_DEBUG("wsrep_ordered_commit: %d", wsrep_is_real(thd, all));
+ DBUG_RETURN(wsrep_run_commit_hook(thd, all) ?
+ thd->wsrep_cs().ordered_commit() : 0);
+}
+
+/*
+ Called after the transaction has been committed.
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_after_commit(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_after_commit");
+ WSREP_DEBUG("wsrep_after_commit: %d, %d, %lld, %d",
+ wsrep_is_real(thd, all),
+ wsrep_is_active(thd),
+ (long long)wsrep_thd_trx_seqno(thd),
+ wsrep_has_changes(thd, all));
+ if (wsrep_run_commit_hook(thd, all))
+ {
+ DBUG_RETURN((wsrep_ordered_commit_if_no_binlog(thd, all) ||
+ (thd->wsrep_xid.null(),
+ thd->wsrep_cs().after_commit())));
+ }
+ DBUG_RETURN(0);
+}
+
+/*
+ Called before the transaction is rolled back.
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_before_rollback(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_before_rollback");
+ int ret= 0;
+ if (wsrep_is_active(thd))
+ {
+ if (!all && thd->in_active_multi_stmt_transaction() &&
+ thd->wsrep_trx().is_streaming() &&
+ !wsrep_stmt_rollback_is_safe(thd))
+ {
+ /* Non-safe statement rollback during SR multi statement
+ transasction. Self abort the transaction, the actual rollback
+ and error handling will be done in after statement phase. */
+ wsrep_thd_self_abort(thd);
+ ret= 0;
+ }
+ else if (wsrep_is_real(thd, all) &&
+ thd->wsrep_trx().state() != wsrep::transaction::s_aborted)
+ {
+ /* Real transaction rolling back and wsrep abort not completed
+ yet */
+ /* Reset XID so that it does not trigger writing serialization
+ history in InnoDB. This needs to be avoided because rollback
+ may happen out of order and replay may follow. */
+ thd->wsrep_xid.null();
+ ret= thd->wsrep_cs().before_rollback();
+ }
+ }
+ DBUG_RETURN(ret);
+}
+
+/*
+ Called after the transaction has been rolled back.
+
+ Return zero on succes, non-zero on failure.
+ */
+static inline int wsrep_after_rollback(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_after_rollback");
+ DBUG_RETURN((wsrep_is_real(thd, all) && wsrep_is_active(thd) &&
+ thd->wsrep_cs().transaction().state() !=
+ wsrep::transaction::s_aborted) ?
+ thd->wsrep_cs().after_rollback() : 0);
+}
+
+static inline int wsrep_before_statement(THD* thd)
+{
+ return (thd->wsrep_cs().state() != wsrep::client_state::s_none ?
+ thd->wsrep_cs().before_statement() : 0);
+}
+
+static inline
+int wsrep_after_statement(THD* thd)
+{
+ DBUG_ENTER("wsrep_after_statement");
+ DBUG_RETURN(thd->wsrep_cs().state() != wsrep::client_state::s_none ?
+ thd->wsrep_cs().after_statement() : 0);
+}
+
+static inline void wsrep_after_apply(THD* thd)
+{
+ DBUG_ASSERT(wsrep_thd_is_applying(thd));
+ WSREP_DEBUG("wsrep_after_apply %lld", thd->thread_id);
+ thd->wsrep_cs().after_applying();
+}
+
+static inline void wsrep_open(THD* thd)
+{
+ DBUG_ENTER("wsrep_open");
+ if (wsrep_on(thd))
+ {
+ thd->wsrep_cs().open(wsrep::client_id(thd->thread_id));
+ thd->wsrep_cs().debug_log_level(wsrep_debug);
+ if (!thd->wsrep_applier && thd->variables.wsrep_trx_fragment_size)
+ {
+ thd->wsrep_cs().enable_streaming(
+ wsrep_fragment_unit(thd->variables.wsrep_trx_fragment_unit),
+ size_t(thd->variables.wsrep_trx_fragment_size));
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+
+static inline void wsrep_close(THD* thd)
+{
+ DBUG_ENTER("wsrep_close");
+ if (thd->wsrep_cs().state() != wsrep::client_state::s_none)
+ {
+ thd->wsrep_cs().close();
+ }
+ DBUG_VOID_RETURN;
+}
+
+static inline int wsrep_before_command(THD* thd)
+{
+ return (thd->wsrep_cs().state() != wsrep::client_state::s_none ?
+ thd->wsrep_cs().before_command() : 0);
+}
+/*
+ Called after each command.
+
+ Return zero on success, non-zero on failure.
+*/
+static inline void wsrep_after_command_before_result(THD* thd)
+{
+ if (thd->wsrep_cs().state() != wsrep::client_state::s_none)
+ {
+ thd->wsrep_cs().after_command_before_result();
+ }
+}
+
+static inline void wsrep_after_command_after_result(THD* thd)
+{
+ if (thd->wsrep_cs().state() != wsrep::client_state::s_none)
+ {
+ thd->wsrep_cs().after_command_after_result();
+ }
+}
+
+static inline void wsrep_after_command_ignore_result(THD* thd)
+{
+ wsrep_after_command_before_result(thd);
+ DBUG_ASSERT(!thd->wsrep_cs().current_error());
+ wsrep_after_command_after_result(thd);
+}
+
+static inline enum wsrep::client_error wsrep_current_error(THD* thd)
+{
+ return thd->wsrep_cs().current_error();
+}
+
+static inline enum wsrep::provider::status
+wsrep_current_error_status(THD* thd)
+{
+ return thd->wsrep_cs().current_error_status();
+}
+
+
+/*
+ Commit an empty transaction.
+
+ If the transaction is real and the wsrep transaction is still active,
+ the transaction did not generate any rows or keys and is committed
+ as empty. Here the wsrep transaction is rolled back and after statement
+ step is performed to leave the wsrep transaction in the state as it
+ never existed.
+*/
+static inline void wsrep_commit_empty(THD* thd, bool all)
+{
+ DBUG_ENTER("wsrep_commit_empty");
+ WSREP_DEBUG("wsrep_commit_empty(%llu)", thd->thread_id);
+ if (wsrep_is_real(thd, all) &&
+ wsrep_thd_is_local(thd) &&
+ thd->wsrep_trx().active() &&
+ thd->wsrep_trx().state() != wsrep::transaction::s_committed)
+ {
+ bool have_error= wsrep_current_error(thd);
+ int ret= wsrep_before_rollback(thd, all) ||
+ wsrep_after_rollback(thd, all) ||
+ wsrep_after_statement(thd);
+ DBUG_ASSERT(have_error || !wsrep_current_error(thd));
+ if (ret)
+ {
+ WSREP_DEBUG("wsrep_commit_empty failed: %d", wsrep_current_error(thd));
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+
+#endif /* WSREP_TRANS_OBSERVER */
diff --git a/sql/wsrep_types.h b/sql/wsrep_types.h
new file mode 100644
index 00000000000..9da00e305a7
--- /dev/null
+++ b/sql/wsrep_types.h
@@ -0,0 +1,29 @@
+/* Copyright 2018 Codership Oy <info@codership.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/*
+ Wsrep typedefs to better conform to coding style.
+ */
+#ifndef WSREP_TYPES_H
+#define WSREP_TYPES_H
+
+#include "wsrep/seqno.hpp"
+#include "wsrep/view.hpp"
+
+typedef wsrep::id Wsrep_id;
+typedef wsrep::seqno Wsrep_seqno;
+typedef wsrep::view Wsrep_view;
+
+#endif /* WSREP_TYPES_H */
diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc
index 3c341e222b3..8db0f7be99a 100644
--- a/sql/wsrep_utils.cc
+++ b/sql/wsrep_utils.cc
@@ -21,6 +21,8 @@
#endif
#include "mariadb.h"
+#include "my_global.h"
+#include "wsrep_api.h"
#include "wsrep_utils.h"
#include "wsrep_mysqld.h"
@@ -47,7 +49,7 @@ static wsp::string wsrep_PATH;
void
wsrep_prepend_PATH (const char* path)
{
- int count = 0;
+ int count= 0;
while (environ[count])
{
@@ -72,7 +74,7 @@ wsrep_prepend_PATH (const char* path)
old_path + strlen("PATH="));
wsrep_PATH.set (new_path);
- environ[count] = new_path;
+ environ[count]= new_path;
}
else
{
@@ -93,28 +95,28 @@ namespace wsp
bool
env::ctor_common(char** e)
{
- env_ = static_cast<char**>(malloc((len_ + 1) * sizeof(char*)));
+ env_= static_cast<char**>(malloc((len_ + 1) * sizeof(char*)));
if (env_)
{
for (size_t i(0); i < len_; ++i)
{
assert(e[i]); // caller should make sure about len_
- env_[i] = strdup(e[i]);
+ env_[i]= strdup(e[i]);
if (!env_[i])
{
- errno_ = errno;
+ errno_= errno;
WSREP_ERROR("Failed to allocate env. var: %s", e[i]);
return true;
}
}
- env_[len_] = NULL;
+ env_[len_]= NULL;
return false;
}
else
{
- errno_ = errno;
+ errno_= errno;
WSREP_ERROR("Failed to allocate env. var vector of length: %zu", len_);
return true;
}
@@ -128,15 +130,15 @@ env::dtor()
/* don't need to go beyond the first NULL */
for (size_t i(0); env_[i] != NULL; ++i) { free(env_[i]); }
free(env_);
- env_ = NULL;
+ env_= NULL;
}
- len_ = 0;
+ len_= 0;
}
env::env(char** e)
: len_(0), env_(NULL), errno_(0)
{
- if (!e) { e = environ; }
+ if (!e) { e= environ; }
/* count the size of the vector */
while (e[len_]) { ++len_; }
@@ -154,21 +156,21 @@ env::~env() { dtor(); }
int
env::append(const char* val)
{
- char** tmp = static_cast<char**>(realloc(env_, (len_ + 2)*sizeof(char*)));
+ char** tmp= static_cast<char**>(realloc(env_, (len_ + 2)*sizeof(char*)));
if (tmp)
{
- env_ = tmp;
- env_[len_] = strdup(val);
+ env_= tmp;
+ env_[len_]= strdup(val);
if (env_[len_])
{
++len_;
- env_[len_] = NULL;
+ env_[len_]= NULL;
}
- else errno_ = errno;
+ else errno_= errno;
}
- else errno_ = errno;
+ else errno_= errno;
return errno_;
}
@@ -189,7 +191,7 @@ process::process (const char* cmd, const char* type, char** env)
if (0 == str_)
{
WSREP_ERROR ("Can't allocate command line of size: %zu", strlen(cmd));
- err_ = ENOMEM;
+ err_= ENOMEM;
return;
}
@@ -205,12 +207,12 @@ process::process (const char* cmd, const char* type, char** env)
return;
}
- if (NULL == env) { env = environ; } // default to global environment
+ if (NULL == env) { env= environ; } // default to global environment
- int pipe_fds[2] = { -1, };
+ int pipe_fds[2]= { -1, };
if (::pipe(pipe_fds))
{
- err_ = errno;
+ err_= errno;
WSREP_ERROR ("pipe() failed: %d (%s)", err_, strerror(err_));
return;
}
@@ -220,16 +222,16 @@ process::process (const char* cmd, const char* type, char** env)
int const child_end (parent_end == PIPE_READ ? PIPE_WRITE : PIPE_READ);
int const close_fd (parent_end == PIPE_READ ? STDOUT_FD : STDIN_FD);
- char* const pargv[4] = { strdup("sh"), strdup("-c"), strdup(str_), NULL };
+ char* const pargv[4]= { strdup("sh"), strdup("-c"), strdup(str_), NULL };
if (!(pargv[0] && pargv[1] && pargv[2]))
{
- err_ = ENOMEM;
+ err_= ENOMEM;
WSREP_ERROR ("Failed to allocate pargv[] array.");
goto cleanup_pipe;
}
posix_spawnattr_t attr;
- err_ = posix_spawnattr_init (&attr);
+ err_= posix_spawnattr_init (&attr);
if (err_)
{
WSREP_ERROR ("posix_spawnattr_init() failed: %d (%s)",
@@ -239,7 +241,7 @@ process::process (const char* cmd, const char* type, char** env)
/* make sure that no signlas are masked in child process */
sigset_t sigmask_empty; sigemptyset(&sigmask_empty);
- err_ = posix_spawnattr_setsigmask(&attr, &sigmask_empty);
+ err_= posix_spawnattr_setsigmask(&attr, &sigmask_empty);
if (err_)
{
WSREP_ERROR ("posix_spawnattr_setsigmask() failed: %d (%s)",
@@ -255,7 +257,7 @@ process::process (const char* cmd, const char* type, char** env)
sigaddset(&default_signals, SIGPIPE);
sigaddset(&default_signals, SIGTERM);
sigaddset(&default_signals, SIGCHLD);
- err_ = posix_spawnattr_setsigdefault(&attr, &default_signals);
+ err_= posix_spawnattr_setsigdefault(&attr, &default_signals);
if (err_)
{
WSREP_ERROR ("posix_spawnattr_setsigdefault() failed: %d (%s)",
@@ -263,7 +265,7 @@ process::process (const char* cmd, const char* type, char** env)
goto cleanup_attr;
}
- err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF |
+ err_= posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF |
POSIX_SPAWN_SETSIGMASK |
POSIX_SPAWN_USEVFORK);
if (err_)
@@ -274,7 +276,7 @@ process::process (const char* cmd, const char* type, char** env)
}
posix_spawn_file_actions_t fact;
- err_ = posix_spawn_file_actions_init (&fact);
+ err_= posix_spawn_file_actions_init (&fact);
if (err_)
{
WSREP_ERROR ("posix_spawn_file_actions_init() failed: %d (%s)",
@@ -283,7 +285,7 @@ process::process (const char* cmd, const char* type, char** env)
}
// close child's stdout|stdin depending on what we returning
- err_ = posix_spawn_file_actions_addclose (&fact, close_fd);
+ err_= posix_spawn_file_actions_addclose (&fact, close_fd);
if (err_)
{
WSREP_ERROR ("posix_spawn_file_actions_addclose() failed: %d (%s)",
@@ -292,7 +294,7 @@ process::process (const char* cmd, const char* type, char** env)
}
// substitute our pipe descriptor in place of the closed one
- err_ = posix_spawn_file_actions_adddup2 (&fact,
+ err_= posix_spawn_file_actions_adddup2 (&fact,
pipe_fds[child_end], close_fd);
if (err_)
{
@@ -301,30 +303,30 @@ process::process (const char* cmd, const char* type, char** env)
goto cleanup_fact;
}
- err_ = posix_spawnp (&pid_, pargv[0], &fact, &attr, pargv, env);
+ err_= posix_spawnp (&pid_, pargv[0], &fact, &attr, pargv, env);
if (err_)
{
WSREP_ERROR ("posix_spawnp(%s) failed: %d (%s)",
pargv[2], err_, strerror(err_));
- pid_ = 0; // just to make sure it was not messed up in the call
+ pid_= 0; // just to make sure it was not messed up in the call
goto cleanup_fact;
}
- io_ = fdopen (pipe_fds[parent_end], type);
+ io_= fdopen (pipe_fds[parent_end], type);
if (io_)
{
- pipe_fds[parent_end] = -1; // skip close on cleanup
+ pipe_fds[parent_end]= -1; // skip close on cleanup
}
else
{
- err_ = errno;
+ err_= errno;
WSREP_ERROR ("fdopen() failed: %d (%s)", err_, strerror(err_));
}
cleanup_fact:
int err; // to preserve err_ code
- err = posix_spawn_file_actions_destroy (&fact);
+ err= posix_spawn_file_actions_destroy (&fact);
if (err)
{
WSREP_ERROR ("posix_spawn_file_actions_destroy() failed: %d (%s)\n",
@@ -332,7 +334,7 @@ cleanup_fact:
}
cleanup_attr:
- err = posix_spawnattr_destroy (&attr);
+ err= posix_spawnattr_destroy (&attr);
if (err)
{
WSREP_ERROR ("posix_spawnattr_destroy() failed: %d (%s)",
@@ -360,7 +362,7 @@ process::~process ()
if (fclose (io_) == -1)
{
- err_ = errno;
+ err_= errno;
WSREP_ERROR("fclose() failed: %d (%s)", err_, strerror(err_));
}
}
@@ -376,34 +378,34 @@ process::wait ()
int status;
if (-1 == waitpid(pid_, &status, 0))
{
- err_ = errno; assert (err_);
+ err_= errno; assert (err_);
WSREP_ERROR("Waiting for process failed: %s, PID(%ld): %d (%s)",
str_, (long)pid_, err_, strerror (err_));
}
else
{ // command completed, check exit status
if (WIFEXITED (status)) {
- err_ = WEXITSTATUS (status);
+ err_= WEXITSTATUS (status);
}
else { // command didn't complete with exit()
WSREP_ERROR("Process was aborted.");
- err_ = errno ? errno : ECHILD;
+ err_= errno ? errno : ECHILD;
}
if (err_) {
switch (err_) /* Translate error codes to more meaningful */
{
- case 126: err_ = EACCES; break; /* Permission denied */
- case 127: err_ = ENOENT; break; /* No such file or directory */
- case 143: err_ = EINTR; break; /* Subprocess killed */
+ case 126: err_= EACCES; break; /* Permission denied */
+ case 127: err_= ENOENT; break; /* No such file or directory */
+ case 143: err_= EINTR; break; /* Subprocess killed */
}
WSREP_ERROR("Process completed with error: %s: %d (%s)",
str_, err_, strerror(err_));
}
- pid_ = 0;
+ pid_= 0;
if (io_) fclose (io_);
- io_ = NULL;
+ io_= NULL;
}
}
else {
@@ -421,7 +423,7 @@ thd::thd (my_bool won) : init(), ptr(new THD(0))
ptr->thread_stack= (char*) &ptr;
ptr->store_globals();
ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog
- ptr->variables.wsrep_on = won;
+ ptr->variables.wsrep_on= won;
ptr->security_ctx->master_access= ~(ulong)0;
lex_start(ptr);
}
@@ -441,7 +443,7 @@ thd::~thd ()
/* Returns INADDR_NONE, INADDR_ANY, INADDR_LOOPBACK or something else */
unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6)
{
- unsigned int ret = INADDR_NONE;
+ unsigned int ret= INADDR_NONE;
struct addrinfo *res, hints;
memset (&hints, 0, sizeof(hints));
@@ -451,7 +453,7 @@ unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6)
*is_ipv6= false;
- int gai_ret = getaddrinfo(addr, NULL, &hints, &res);
+ int gai_ret= getaddrinfo(addr, NULL, &hints, &res);
if (0 == gai_ret)
{
if (AF_INET == res->ai_family) /* IPv4 */
@@ -488,7 +490,9 @@ size_t wsrep_guess_ip (char* buf, size_t buf_len)
size_t ret= 0;
// Attempt 1: Try to get the IP from bind-address.
- if (my_bind_addr_str && my_bind_addr_str[0] != '\0')
+ // Skip if empty or bind-address=*
+ if (my_bind_addr_str && my_bind_addr_str[0] != '\0' &&
+ strcmp(my_bind_addr_str, "*") != 0)
{
bool unused;
unsigned int const ip_type= wsrep_check_ip(my_bind_addr_str, &unused);
@@ -539,7 +543,7 @@ size_t wsrep_guess_ip (char* buf, size_t buf_len)
if (getifaddrs(&ifaddr) == 0)
{
- for (ifa= ifaddr; ifa != NULL; ifa = ifa->ifa_next)
+ for (ifa= ifaddr; ifa != NULL; ifa= ifa->ifa_next)
{
if (!ifa->ifa_addr)
continue;
diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h
index 277cea9dc31..488b455938b 100644
--- a/sql/wsrep_utils.h
+++ b/sql/wsrep_utils.h
@@ -21,6 +21,27 @@
unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6);
size_t wsrep_guess_ip (char* buf, size_t buf_len);
+namespace wsp {
+class node_status
+{
+public:
+ node_status() : status(wsrep::server_state::s_disconnected) {}
+ void set(enum wsrep::server_state::state new_status,
+ const wsrep::view* view= 0)
+ {
+ if (status != new_status || 0 != view)
+ {
+ wsrep_notify_status(new_status, view);
+ status= new_status;
+ }
+ }
+ enum wsrep::server_state::state get() const { return status; }
+private:
+ enum wsrep::server_state::state status;
+};
+} /* namespace wsp */
+
+extern wsp::node_status local_status;
/* returns the length of the host part of the address string */
size_t wsrep_host_len(const char* addr, size_t addr_len);
@@ -108,7 +129,8 @@ private:
/* Hostname with port (host:port) */
start= addr_in;
end= colon;
- parse_port(colon + 1);
+ if (parse_port(colon + 1))
+ return; /* Error: invalid port */
break;
default:
/* IPv6 address */
@@ -173,52 +195,37 @@ private:
class Config_state
{
public:
- Config_state() : view_(), status_(WSREP_MEMBER_UNDEFINED)
+ Config_state() : view_(), status_(wsrep::server_state::s_disconnected)
{}
- void set(wsrep_member_status_t status, const wsrep_view_info_t* view)
+ void set(const wsrep::view& view)
{
- wsrep_notify_status(status, view);
+ wsrep_notify_status(status_, &view);
lock();
-
- status_= status;
- view_= *view;
- member_info_.clear();
-
- wsrep_member_info_t memb;
- for(int i= 0; i < view->memb_num; i ++)
- {
- memb= view->members[i];
- member_info_.append_val(memb);
- }
-
+ view_= view;
unlock();
}
- void set(wsrep_member_status_t status)
+ void set(enum wsrep::server_state::state status)
{
- wsrep_notify_status(status, 0);
+ wsrep_notify_status(status);
+
lock();
status_= status;
unlock();
}
- wsrep_view_info_t get_view_info() const
+ const wsrep::view& get_view_info() const
{
return view_;
}
- wsrep_member_status_t get_status() const
+ enum wsrep::server_state::state get_status() const
{
return status_;
}
- Dynamic_array<wsrep_member_info_t> * get_member_info()
- {
- return &member_info_;
- }
-
int lock()
{
return mysql_mutex_lock(&LOCK_wsrep_config_state);
@@ -230,9 +237,8 @@ public:
}
private:
- wsrep_view_info_t view_;
- wsrep_member_status_t status_;
- Dynamic_array<wsrep_member_info_t> member_info_;
+ wsrep::view view_;
+ enum wsrep::server_state::state status_;
};
} /* namespace wsp */
@@ -308,12 +314,23 @@ public:
string() : string_(0) {}
explicit string(size_t s) : string_(static_cast<char*>(malloc(s))) {}
char* operator()() { return string_; }
- void set(char* str) { if (string_) free (string_); string_ = str; }
+ void set(char* str) { if (string_) free (string_); string_= str; }
~string() { set (0); }
private:
char* string_;
};
+/* scope level lock */
+class auto_lock
+{
+public:
+ auto_lock(mysql_mutex_t* m) : m_(m) { mysql_mutex_lock(m_); }
+ ~auto_lock() { mysql_mutex_unlock(m_); }
+private:
+ mysql_mutex_t& operator =(mysql_mutex_t&);
+ mysql_mutex_t* const m_;
+};
+
#ifdef REMOVED
class lock
{
@@ -323,7 +340,7 @@ public:
lock (pthread_mutex_t* mtx) : mtx_(mtx)
{
- int err = pthread_mutex_lock (mtx_);
+ int err= pthread_mutex_lock (mtx_);
if (err)
{
@@ -334,7 +351,7 @@ public:
virtual ~lock ()
{
- int err = pthread_mutex_unlock (mtx_);
+ int err= pthread_mutex_unlock (mtx_);
if (err)
{
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index f8a494416e2..8a0968639c2 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -28,8 +28,6 @@
ulong wsrep_reject_queries;
-static long wsrep_prev_slave_threads = wsrep_slave_threads;
-
int wsrep_init_vars()
{
wsrep_provider = my_strdup(WSREP_NONE, MYF(MY_WME));
@@ -53,7 +51,7 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
{
if (var_type == OPT_GLOBAL) {
// FIXME: this variable probably should be changed only per session
- thd->variables.wsrep_on = global_system_variables.wsrep_on;
+ thd->variables.wsrep_on= global_system_variables.wsrep_on;
}
return false;
@@ -68,8 +66,8 @@ bool wsrep_on_check(sys_var *self, THD* thd, set_var* var)
if (new_wsrep_on && innodb_hton_ptr && innodb_lock_schedule_algorithm != 0) {
my_message(ER_WRONG_ARGUMENTS, " WSREP (galera) can't be enabled "
- "if innodb_lock_schedule_algorithm=VATS. Please configure"
- " innodb_lock_schedule_algorithm=FCFS and restart.", MYF(0));
+ "if innodb_lock_schedule_algorithm=VATS. Please configure"
+ " innodb_lock_schedule_algorithm=FCFS and restart.", MYF(0));
return true;
}
return false;
@@ -77,10 +75,6 @@ bool wsrep_on_check(sys_var *self, THD* thd, set_var* var)
bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type)
{
- // global setting should not affect session setting.
- // if (var_type == OPT_GLOBAL) {
- // thd->variables.wsrep_causal_reads = global_system_variables.wsrep_causal_reads;
- // }
if (thd->variables.wsrep_causal_reads) {
thd->variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
@@ -99,15 +93,11 @@ bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type)
bool wsrep_sync_wait_update (sys_var* self, THD* thd, enum_var_type var_type)
{
- // global setting should not affect session setting.
- // if (var_type == OPT_GLOBAL) {
- // thd->variables.wsrep_sync_wait = global_system_variables.wsrep_sync_wait;
- // }
- thd->variables.wsrep_causal_reads = thd->variables.wsrep_sync_wait &
+ thd->variables.wsrep_causal_reads= thd->variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ;
// update global settings too
- global_system_variables.wsrep_causal_reads = global_system_variables.wsrep_sync_wait &
+ global_system_variables.wsrep_causal_reads= global_system_variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ;
return false;
@@ -129,7 +119,7 @@ bool wsrep_start_position_verify (const char* start_str)
ssize_t uuid_len;
// Check whether it has minimum acceptable length.
- start_len = strlen (start_str);
+ start_len= strlen (start_str);
if (start_len < 34)
return true;
@@ -137,7 +127,7 @@ bool wsrep_start_position_verify (const char* start_str)
Parse the input to check whether UUID length is acceptable
and seqno has been provided.
*/
- uuid_len = wsrep_uuid_scan (start_str, start_len, &uuid);
+ uuid_len= wsrep_uuid_scan (start_str, start_len, &uuid);
if (uuid_len < 0 || (start_len - uuid_len) < 2)
return true;
@@ -157,19 +147,18 @@ bool wsrep_start_position_verify (const char* start_str)
static
-bool wsrep_set_local_position(const char* const value, size_t length,
- bool const sst)
+bool wsrep_set_local_position(THD* thd, const char* const value,
+ size_t length, bool const sst)
{
wsrep_uuid_t uuid;
- size_t const uuid_len = wsrep_uuid_scan(value, length, &uuid);
- wsrep_seqno_t const seqno = strtoll(value + uuid_len + 1, NULL, 10);
+ size_t const uuid_len= wsrep_uuid_scan(value, length, &uuid);
+ wsrep_seqno_t const seqno= strtoll(value + uuid_len + 1, NULL, 10);
if (sst) {
- return wsrep_sst_received (wsrep, uuid, seqno, NULL, 0, false);
+ wsrep_sst_received (thd, uuid, seqno, NULL, 0);
} else {
- // initialization
- local_uuid = uuid;
- local_seqno = seqno;
+ local_uuid= uuid;
+ local_seqno= seqno;
}
return false;
}
@@ -194,7 +183,7 @@ bool wsrep_start_position_check (sys_var *self, THD* thd, set_var* var)
As part of further verification, we try to update the value and catch
errors (if any).
*/
- if (wsrep_set_local_position(var->save_result.string_value.str,
+ if (wsrep_set_local_position(thd, var->save_result.string_value.str,
var->save_result.string_value.length,
true))
{
@@ -226,7 +215,7 @@ bool wsrep_start_position_init (const char* val)
return true;
}
- if (wsrep_set_local_position (val, strlen(val), false))
+ if (wsrep_set_local_position (NULL, val, strlen(val), false))
{
WSREP_ERROR("Failed to set initial wsep_start_position: %s", val);
return true;
@@ -263,25 +252,23 @@ end:
static bool refresh_provider_options()
{
- DBUG_ASSERT(wsrep);
-
WSREP_DEBUG("refresh_provider_options: %s",
(wsrep_provider_options) ? wsrep_provider_options : "null");
- char* opts= wsrep->options_get(wsrep);
- if (opts)
+
+ try
{
- wsrep_provider_options_init(opts);
+ std::string opts= Wsrep_server_state::instance().provider().options();
+ wsrep_provider_options_init(opts.c_str());
get_provider_option_value(wsrep_provider_options,
(char*)"repl.max_ws_size",
&wsrep_max_ws_size);
- free(opts);
+ return false;
}
- else
+ catch (...)
{
WSREP_ERROR("Failed to get provider options");
return true;
}
- return false;
}
static int wsrep_provider_verify (const char* provider_str)
@@ -332,8 +319,6 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type)
{
bool rcode= false;
- bool wsrep_on_saved= thd->variables.wsrep_on;
- thd->variables.wsrep_on= false;
WSREP_DEBUG("wsrep_provider_update: %s", wsrep_provider);
@@ -346,7 +331,12 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type)
*/
mysql_mutex_unlock(&LOCK_global_system_variables);
wsrep_stop_replication(thd);
- mysql_mutex_lock(&LOCK_global_system_variables);
+
+ /* provider status variables are allocated in provider library
+ and need to freed here, otherwise a dangling reference to
+ wsrep_status_vars would remain in THD
+ */
+ wsrep_free_status(thd);
if (wsrep_inited == 1)
wsrep_deinit(false);
@@ -357,17 +347,17 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type)
if (wsrep_init())
{
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, my_error, "wsrep_init failed");
- rcode = true;
+ rcode= true;
}
free(tmp);
// we sure don't want to use old address with new provider
wsrep_cluster_address_init(NULL);
wsrep_provider_options_init(NULL);
+ if (!rcode)
+ refresh_provider_options();
- thd->variables.wsrep_on= wsrep_on_saved;
-
- refresh_provider_options();
+ mysql_mutex_lock(&LOCK_global_system_variables);
return rcode;
}
@@ -385,12 +375,12 @@ void wsrep_provider_init (const char* value)
}
if (wsrep_provider) my_free((void *)wsrep_provider);
- wsrep_provider = my_strdup(value, MYF(0));
+ wsrep_provider= my_strdup(value, MYF(0));
}
bool wsrep_provider_options_check(sys_var *self, THD* thd, set_var* var)
{
- if (wsrep == NULL)
+ if (!WSREP_ON)
{
my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0));
return true;
@@ -400,9 +390,9 @@ bool wsrep_provider_options_check(sys_var *self, THD* thd, set_var* var)
bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type)
{
- DBUG_ASSERT(wsrep);
- wsrep_status_t ret= wsrep->options_set(wsrep, wsrep_provider_options);
- if (ret != WSREP_OK)
+ enum wsrep::provider::status ret=
+ Wsrep_server_state::instance().provider().options(wsrep_provider_options);
+ if (ret)
{
WSREP_ERROR("Set options returned %d", ret);
refresh_provider_options();
@@ -415,7 +405,7 @@ void wsrep_provider_options_init(const char* value)
{
if (wsrep_provider_options && wsrep_provider_options != value)
my_free((void *)wsrep_provider_options);
- wsrep_provider_options = (value) ? my_strdup(value, MYF(0)) : NULL;
+ wsrep_provider_options= (value) ? my_strdup(value, MYF(0)) : NULL;
}
bool wsrep_reject_queries_update(sys_var *self, THD* thd, enum_var_type type)
@@ -428,7 +418,8 @@ bool wsrep_reject_queries_update(sys_var *self, THD* thd, enum_var_type type)
WSREP_INFO("Rejecting client queries due to manual setting");
break;
case WSREP_REJECT_ALL_KILL:
- wsrep_close_client_connections(FALSE);
+ /* close all client connections, but this one */
+ wsrep_close_client_connections(FALSE, thd);
WSREP_INFO("Rejecting client queries and killing connections due to manual setting");
break;
default:
@@ -468,18 +459,12 @@ bool wsrep_cluster_address_check (sys_var *self, THD* thd, set_var* var)
bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type)
{
- bool wsrep_on_saved;
-
- /* Do not proceed if wsrep provider is not loaded. */
- if (!wsrep)
+ if (!Wsrep_server_state::instance().is_provider_loaded())
{
- WSREP_INFO("wsrep provider is not loaded, can't re(start) replication.");
+ WSREP_INFO("WSREP (galera) provider is not loaded, can't re(start) replication.");
return false;
}
- wsrep_on_saved= thd->variables.wsrep_on;
- thd->variables.wsrep_on= false;
-
/* stop replication is heavy operation, and includes closing all client
connections. Closing clients may need to get LOCK_global_system_variables
at least in MariaDB.
@@ -490,13 +475,6 @@ bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type)
mysql_mutex_unlock(&LOCK_global_system_variables);
wsrep_stop_replication(thd);
- /*
- Unlock and lock LOCK_wsrep_slave_threads to maintain lock order & avoid
- any potential deadlock.
- */
- mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
- mysql_mutex_lock(&LOCK_global_system_variables);
- mysql_mutex_lock(&LOCK_wsrep_slave_threads);
if (wsrep_start_replication())
{
@@ -504,7 +482,13 @@ bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type)
wsrep_create_appliers(wsrep_slave_threads);
}
- thd->variables.wsrep_on= wsrep_on_saved;
+ /* locking order to be enforced is:
+ 1. LOCK_global_system_variables
+ 2. LOCK_wsrep_slave_threads
+ */
+ mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ mysql_mutex_lock(&LOCK_wsrep_slave_threads);
return false;
}
@@ -589,15 +573,14 @@ void wsrep_node_address_init (const char* value)
if (wsrep_node_address && strcmp(wsrep_node_address, value))
my_free ((void*)wsrep_node_address);
- wsrep_node_address = (value) ? my_strdup(value, MYF(0)) : NULL;
+ wsrep_node_address= (value) ? my_strdup(value, MYF(0)) : NULL;
}
static void wsrep_slave_count_change_update ()
{
- wsrep_slave_count_change = (wsrep_slave_threads - wsrep_prev_slave_threads);
+ wsrep_slave_count_change= (wsrep_slave_threads - wsrep_running_threads + 2);
WSREP_DEBUG("Change on slave threads: New %lu old %lu difference %d",
- wsrep_slave_threads, wsrep_prev_slave_threads, wsrep_slave_count_change);
- wsrep_prev_slave_threads = wsrep_slave_threads;
+ wsrep_slave_threads, wsrep_running_threads, wsrep_slave_count_change);
}
bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
@@ -606,14 +589,14 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
if (wsrep_slave_count_change > 0)
{
wsrep_create_appliers(wsrep_slave_count_change);
- wsrep_slave_count_change = 0;
+ wsrep_slave_count_change= 0;
}
return false;
}
bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var)
{
- if (wsrep == NULL)
+ if (!WSREP_ON)
{
my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0));
return true;
@@ -638,17 +621,17 @@ bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var)
}
return false;
}
- wsrep_status_t ret(WSREP_WARNING);
+ int ret= 1;
if (new_wsrep_desync) {
- ret = wsrep->desync (wsrep);
- if (ret != WSREP_OK) {
- WSREP_WARN ("SET desync failed %d for schema: %s, query: %s",
- ret, thd->get_db(), thd->query());
+ ret= Wsrep_server_state::instance().provider().desync();
+ if (ret) {
+ WSREP_WARN ("SET desync failed %d for schema: %s, query: %s", ret,
+ thd->db.str, WSREP_QUERY(thd));
my_error (ER_CANNOT_USER, MYF(0), "'desync'", thd->query());
return true;
}
} else {
- ret = wsrep->resync (wsrep);
+ ret= Wsrep_server_state::instance().provider().resync();
if (ret != WSREP_OK) {
WSREP_WARN ("SET resync failed %d for schema: %s, query: %s", ret,
thd->get_db(), thd->query());
@@ -661,13 +644,70 @@ bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var)
bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type)
{
- DBUG_ASSERT(wsrep);
+ return false;
+}
+
+bool wsrep_trx_fragment_size_check (sys_var *self, THD* thd, set_var* var)
+{
+ if (var->value == NULL) {
+ return false;
+ }
+
+ const ulong new_trx_fragment_size= var->value->val_uint();
+
+ if (!WSREP(thd) && new_trx_fragment_size > 0) {
+ push_warning (thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_VAR,
+ "Cannot set 'wsrep_trx_fragment_size' to a value other than "
+ "0 because wsrep is switched off.");
+ return true;
+ }
+
+ if (new_trx_fragment_size > 0 && !wsrep_provider_is_SR_capable()) {
+ push_warning (thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_VAR,
+ "Cannot set 'wsrep_trx_fragment_size' to a value other than "
+ "0 because the wsrep_provider does not support streaming "
+ "replication.");
+ return true;
+ }
+
+ return false;
+}
+
+bool wsrep_trx_fragment_size_update(sys_var* self, THD *thd, enum_var_type)
+{
+ WSREP_DEBUG("wsrep_trx_fragment_size_update: %llu",
+ thd->variables.wsrep_trx_fragment_size);
+ if (thd->variables.wsrep_trx_fragment_size)
+ {
+ return thd->wsrep_cs().enable_streaming(
+ wsrep_fragment_unit(thd->variables.wsrep_trx_fragment_unit),
+ size_t(thd->variables.wsrep_trx_fragment_size));
+ }
+ else
+ {
+ thd->wsrep_cs().disable_streaming();
+ return false;
+ }
+}
+
+bool wsrep_trx_fragment_unit_update(sys_var* self, THD *thd, enum_var_type)
+{
+ WSREP_DEBUG("wsrep_trx_fragment_unit_update: %lu",
+ thd->variables.wsrep_trx_fragment_unit);
+ if (thd->variables.wsrep_trx_fragment_size)
+ {
+ return thd->wsrep_cs().enable_streaming(
+ wsrep_fragment_unit(thd->variables.wsrep_trx_fragment_unit),
+ size_t(thd->variables.wsrep_trx_fragment_size));
+ }
return false;
}
bool wsrep_max_ws_size_check(sys_var *self, THD* thd, set_var* var)
{
- if (wsrep == NULL)
+ if (!WSREP_ON)
{
my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0));
return true;
@@ -675,36 +715,35 @@ bool wsrep_max_ws_size_check(sys_var *self, THD* thd, set_var* var)
return false;
}
-bool wsrep_max_ws_size_update (sys_var *self, THD *thd, enum_var_type)
+bool wsrep_max_ws_size_update(sys_var *self, THD *thd, enum_var_type)
{
- DBUG_ASSERT(wsrep);
-
char max_ws_size_opt[128];
my_snprintf(max_ws_size_opt, sizeof(max_ws_size_opt),
- "repl.max_ws_size=%lu", wsrep_max_ws_size);
- wsrep_status_t ret= wsrep->options_set(wsrep, max_ws_size_opt);
- if (ret != WSREP_OK)
+ "repl.max_ws_size=%d", wsrep_max_ws_size);
+ enum wsrep::provider::status ret= Wsrep_server_state::instance().provider().options(max_ws_size_opt);
+ if (ret)
{
WSREP_ERROR("Set options returned %d", ret);
- refresh_provider_options();
return true;
}
return refresh_provider_options();
}
+#if UNUSED /* eaec266eb16c (Sergei Golubchik 2014-09-28) */
static SHOW_VAR wsrep_status_vars[]=
{
{"connected", (char*) &wsrep_connected, SHOW_BOOL},
- {"ready", (char*) &wsrep_ready, SHOW_BOOL},
+ {"ready", (char*) &wsrep_show_ready, SHOW_FUNC},
{"cluster_state_uuid",(char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR},
{"cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG},
{"cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR},
{"cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH},
{"local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH},
- {"local_bf_aborts", (char*) &wsrep_show_bf_aborts, SHOW_SIMPLE_FUNC},
+ {"local_bf_aborts", (char*) &wsrep_show_bf_aborts, SHOW_FUNC},
{"provider_name", (char*) &wsrep_provider_name, SHOW_CHAR_PTR},
{"provider_version", (char*) &wsrep_provider_version, SHOW_CHAR_PTR},
{"provider_vendor", (char*) &wsrep_provider_vendor, SHOW_CHAR_PTR},
+ {"wsrep_provider_capabilities", (char*) &wsrep_provider_capabilities, SHOW_CHAR_PTR},
{"thread_count", (char*) &wsrep_running_threads, SHOW_LONG_NOFLUSH}
};
@@ -712,49 +751,90 @@ static int show_var_cmp(const void *var1, const void *var2)
{
return strcasecmp(((SHOW_VAR*)var1)->name, ((SHOW_VAR*)var2)->name);
}
+#endif /* UNUSED */
+/*
+ * Status variables stuff below
+ */
+static inline void
+wsrep_assign_to_mysql (SHOW_VAR* mysql, wsrep_stats_var* wsrep_var)
+{
+ mysql->name= wsrep_var->name;
+ switch (wsrep_var->type) {
+ case WSREP_VAR_INT64:
+ mysql->value= (char*) &wsrep_var->value._int64;
+ mysql->type= SHOW_LONGLONG;
+ break;
+ case WSREP_VAR_STRING:
+ mysql->value= (char*) &wsrep_var->value._string;
+ mysql->type= SHOW_CHAR_PTR;
+ break;
+ case WSREP_VAR_DOUBLE:
+ mysql->value= (char*) &wsrep_var->value._double;
+ mysql->type= SHOW_DOUBLE;
+ break;
+ }
+}
-int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
+#if DYNAMIC
+// somehow this mysql status thing works only with statically allocated arrays.
+static SHOW_VAR* mysql_status_vars= NULL;
+static int mysql_status_len= -1;
+#else
+static SHOW_VAR mysql_status_vars[512 + 1];
+static const int mysql_status_len= 512;
+#endif
+
+static void export_wsrep_status_to_mysql(THD* thd)
{
- uint i, maxi= SHOW_VAR_FUNC_BUFF_SIZE / sizeof(*var) - 1;
- SHOW_VAR *v= (SHOW_VAR *)buff;
+ int wsrep_status_len, i;
- var->type= SHOW_ARRAY;
- var->value= buff;
+ thd->wsrep_status_vars= Wsrep_server_state::instance().status();
- for (i=0; i < array_elements(wsrep_status_vars); i++)
- *v++= wsrep_status_vars[i];
+ wsrep_status_len= thd->wsrep_status_vars.size();
- DBUG_ASSERT(i < maxi);
+#if DYNAMIC
+ if (wsrep_status_len != mysql_status_len) {
+ void* tmp= realloc (mysql_status_vars,
+ (wsrep_status_len + 1) * sizeof(SHOW_VAR));
+ if (!tmp) {
- if (wsrep != NULL)
- {
- wsrep_stats_var* stats= wsrep->stats_get(wsrep);
- for (wsrep_stats_var *sv= stats;
- i < maxi && sv && sv->name; i++,
- sv++, v++)
- {
- v->name = thd->strdup(sv->name);
- switch (sv->type) {
- case WSREP_VAR_INT64:
- v->value = (char*)thd->memdup(&sv->value._integer64, sizeof(longlong));
- v->type = SHOW_LONGLONG;
- break;
- case WSREP_VAR_STRING:
- v->value = thd->strdup(sv->value._string);
- v->type = SHOW_CHAR;
- break;
- case WSREP_VAR_DOUBLE:
- v->value = (char*)thd->memdup(&sv->value._double, sizeof(double));
- v->type = SHOW_DOUBLE;
- break;
- }
+ sql_print_error ("Out of memory for wsrep status variables."
+ "Number of variables: %d", wsrep_status_len);
+ return;
}
- wsrep->stats_free(wsrep, stats);
+
+ mysql_status_len= wsrep_status_len;
+ mysql_status_vars= (SHOW_VAR*)tmp;
+ }
+ /* @TODO: fix this: */
+#else
+ if (mysql_status_len < wsrep_status_len) wsrep_status_len= mysql_status_len;
+#endif
+
+ for (i= 0; i < wsrep_status_len; i++)
+ {
+ mysql_status_vars[i].name= (char*)thd->wsrep_status_vars[i].name().c_str();
+ mysql_status_vars[i].value= (char*)thd->wsrep_status_vars[i].value().c_str();
+ mysql_status_vars[i].type= SHOW_CHAR;
}
- my_qsort(buff, i, sizeof(*v), show_var_cmp);
+ mysql_status_vars[wsrep_status_len].name = NullS;
+ mysql_status_vars[wsrep_status_len].value = NullS;
+ mysql_status_vars[wsrep_status_len].type = SHOW_LONG;
+}
- v->name= 0; // terminator
+int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff)
+{
+ if (WSREP_ON)
+ {
+ export_wsrep_status_to_mysql(thd);
+ var->type= SHOW_ARRAY;
+ var->value= (char *) &mysql_status_vars;
+ }
return 0;
}
+
+void wsrep_free_status (THD* thd)
+{
+ thd->wsrep_status_vars.clear();
+}
diff --git a/sql/wsrep_var.h b/sql/wsrep_var.h
index 7d3ff50f1d2..b732fb48b38 100644
--- a/sql/wsrep_var.h
+++ b/sql/wsrep_var.h
@@ -13,11 +13,11 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#include <my_config.h>
-
#ifndef WSREP_VAR_H
#define WSREP_VAR_H
+#include <my_config.h>
+
#ifdef WITH_WSREP
#define WSREP_CLUSTER_NAME "my_wsrep_cluster"
@@ -90,13 +90,18 @@ extern bool wsrep_slave_threads_update UPDATE_ARGS;
extern bool wsrep_desync_check CHECK_ARGS;
extern bool wsrep_desync_update UPDATE_ARGS;
+extern bool wsrep_trx_fragment_size_check CHECK_ARGS;
+extern bool wsrep_trx_fragment_size_update UPDATE_ARGS;
+
+extern bool wsrep_trx_fragment_unit_update UPDATE_ARGS;
+
extern bool wsrep_max_ws_size_check CHECK_ARGS;
extern bool wsrep_max_ws_size_update UPDATE_ARGS;
+
extern bool wsrep_reject_queries_update UPDATE_ARGS;
#else /* WITH_WSREP */
-#define WSREP_NONE
#define wsrep_provider_init(X)
#define wsrep_init_vars() (0)
#define wsrep_start_position_init(X)
diff --git a/sql/wsrep_xid.cc b/sql/wsrep_xid.cc
index 2834100568a..a1c454d9d65 100644
--- a/sql/wsrep_xid.cc
+++ b/sql/wsrep_xid.cc
@@ -21,6 +21,9 @@
#include "sql_class.h"
#include "wsrep_mysqld.h" // for logging macros
+#include <mysql/service_wsrep.h>
+
+#include <algorithm> /* std::sort() */
/*
* WSREPXid
*/
@@ -34,20 +37,22 @@
#define WSREP_XID_SEQNO_OFFSET (WSREP_XID_UUID_OFFSET + sizeof(wsrep_uuid_t))
#define WSREP_XID_GTRID_LEN (WSREP_XID_SEQNO_OFFSET + sizeof(wsrep_seqno_t))
-void wsrep_xid_init(XID* xid, const wsrep_uuid_t& uuid, wsrep_seqno_t seqno)
+void wsrep_xid_init(XID* xid, const wsrep::gtid& wsgtid)
{
xid->formatID= 1;
xid->gtrid_length= WSREP_XID_GTRID_LEN;
xid->bqual_length= 0;
memset(xid->data, 0, sizeof(xid->data));
memcpy(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN);
- xid->data[WSREP_XID_VERSION_OFFSET] = WSREP_XID_VERSION_2;
- memcpy(xid->data + WSREP_XID_UUID_OFFSET, &uuid, sizeof(wsrep_uuid_t));
- int8store(xid->data + WSREP_XID_SEQNO_OFFSET,seqno);
+ xid->data[WSREP_XID_VERSION_OFFSET]= WSREP_XID_VERSION_2;
+ memcpy(xid->data + WSREP_XID_UUID_OFFSET, wsgtid.id().data(),sizeof(wsrep::id));
+ int8store(xid->data + WSREP_XID_SEQNO_OFFSET, wsgtid.seqno().get());
}
-int wsrep_is_wsrep_xid(const XID* xid)
+extern "C"
+int wsrep_is_wsrep_xid(const void* xid_ptr)
{
+ const XID* xid= static_cast<const XID*>(xid_ptr);
return (xid->formatID == 1 &&
xid->gtrid_length == WSREP_XID_GTRID_LEN &&
xid->bqual_length == 0 &&
@@ -56,33 +61,36 @@ int wsrep_is_wsrep_xid(const XID* xid)
xid->data[WSREP_XID_VERSION_OFFSET] == WSREP_XID_VERSION_2));
}
-const wsrep_uuid_t* wsrep_xid_uuid(const XID& xid)
+const unsigned char* wsrep_xid_uuid(const xid_t* xid)
{
- if (wsrep_is_wsrep_xid(&xid))
- return reinterpret_cast<const wsrep_uuid_t*>(xid.data
- + WSREP_XID_UUID_OFFSET);
+ DBUG_ASSERT(xid);
+ static wsrep::id const undefined;
+ if (wsrep_is_wsrep_xid(xid))
+ return reinterpret_cast<const unsigned char*>
+ (xid->data + WSREP_XID_UUID_OFFSET);
else
- return &WSREP_UUID_UNDEFINED;
+ return static_cast<const unsigned char*>(wsrep::id::undefined().data());
}
-const unsigned char* wsrep_xid_uuid(const xid_t* xid)
+const wsrep::id& wsrep_xid_uuid(const XID& xid)
{
- DBUG_ASSERT(xid);
- return wsrep_xid_uuid(*xid)->data;
+ compile_time_assert(sizeof(wsrep::id) == sizeof(wsrep_uuid_t));
+ return *reinterpret_cast<const wsrep::id*>(wsrep_xid_uuid(&xid));
}
-wsrep_seqno_t wsrep_xid_seqno(const XID& xid)
+long long wsrep_xid_seqno(const xid_t* xid)
{
- wsrep_seqno_t ret= WSREP_SEQNO_UNDEFINED;
- if (wsrep_is_wsrep_xid(&xid))
+ DBUG_ASSERT(xid);
+ long long ret= wsrep::seqno::undefined().get();
+ if (wsrep_is_wsrep_xid(xid))
{
- switch (xid.data[WSREP_XID_VERSION_OFFSET])
+ switch (xid->data[WSREP_XID_VERSION_OFFSET])
{
case WSREP_XID_VERSION_1:
- memcpy(&ret, xid.data + WSREP_XID_SEQNO_OFFSET, sizeof ret);
+ memcpy(&ret, xid->data + WSREP_XID_SEQNO_OFFSET, sizeof ret);
break;
case WSREP_XID_VERSION_2:
- ret= sint8korr(xid.data + WSREP_XID_SEQNO_OFFSET);
+ ret= sint8korr(xid->data + WSREP_XID_SEQNO_OFFSET);
break;
default:
break;
@@ -91,10 +99,9 @@ wsrep_seqno_t wsrep_xid_seqno(const XID& xid)
return ret;
}
-long long wsrep_xid_seqno(const xid_t* xid)
+wsrep::seqno wsrep_xid_seqno(const XID& xid)
{
- DBUG_ASSERT(xid);
- return wsrep_xid_seqno(*xid);
+ return wsrep::seqno(wsrep_xid_seqno(&xid));
}
static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
@@ -104,11 +111,11 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
if (hton->set_checkpoint)
{
- const wsrep_uuid_t* uuid(wsrep_xid_uuid(*xid));
- char uuid_str[40] = {0, };
- wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
+ const unsigned char* uuid= wsrep_xid_uuid(xid);
+ char uuid_str[40]= {0, };
+ wsrep_uuid_print((const wsrep_uuid_t*)uuid, uuid_str, sizeof(uuid_str));
WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld",
- uuid_str, (long long)wsrep_xid_seqno(*xid));
+ uuid_str, (long long)wsrep_xid_seqno(xid));
hton->set_checkpoint(hton, xid);
}
return FALSE;
@@ -120,10 +127,10 @@ bool wsrep_set_SE_checkpoint(XID& xid)
&xid);
}
-bool wsrep_set_SE_checkpoint(const wsrep_uuid_t& uuid, wsrep_seqno_t seqno)
+bool wsrep_set_SE_checkpoint(const wsrep::gtid& wsgtid)
{
XID xid;
- wsrep_xid_init(&xid, uuid, seqno);
+ wsrep_xid_init(&xid, wsgtid);
return wsrep_set_SE_checkpoint(xid);
}
@@ -135,11 +142,12 @@ static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
if (hton->get_checkpoint)
{
hton->get_checkpoint(hton, xid);
- const wsrep_uuid_t* uuid(wsrep_xid_uuid(*xid));
- char uuid_str[40] = {0, };
- wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
+ wsrep_uuid_t uuid;
+ memcpy(&uuid, wsrep_xid_uuid(xid), sizeof(uuid));
+ char uuid_str[40]= {0, };
+ wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str));
WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld",
- uuid_str, (long long)wsrep_xid_seqno(*xid));
+ uuid_str, (long long)wsrep_xid_seqno(xid));
}
return FALSE;
}
@@ -150,32 +158,58 @@ bool wsrep_get_SE_checkpoint(XID& xid)
&xid);
}
-bool wsrep_get_SE_checkpoint(wsrep_uuid_t& uuid, wsrep_seqno_t& seqno)
+wsrep::gtid wsrep_get_SE_checkpoint()
{
- uuid= WSREP_UUID_UNDEFINED;
- seqno= WSREP_SEQNO_UNDEFINED;
-
XID xid;
xid.null();
if (wsrep_get_SE_checkpoint(xid))
{
- return true;
+ return wsrep::gtid();
}
if (xid.is_null())
{
- return false;
+ return wsrep::gtid();
}
if (!wsrep_is_wsrep_xid(&xid))
{
WSREP_WARN("Read non-wsrep XID from storage engines.");
- return false;
+ return wsrep::gtid();
}
- uuid= *wsrep_xid_uuid(xid);
- seqno= wsrep_xid_seqno(xid);
+ return wsrep::gtid(wsrep_xid_uuid(xid),wsrep_xid_seqno(xid));
+}
+
+/*
+ Sort order for XIDs. Wsrep XIDs are sorted according to
+ seqno in ascending order. Non-wsrep XIDs are considered
+ equal among themselves and greater than with respect
+ to wsrep XIDs.
+ */
+struct Wsrep_xid_cmp
+{
+ bool operator()(const XID& left, const XID& right) const
+ {
+ const bool left_is_wsrep= wsrep_is_wsrep_xid(&left);
+ const bool right_is_wsrep= wsrep_is_wsrep_xid(&right);
+ if (left_is_wsrep && right_is_wsrep)
+ {
+ return (wsrep_xid_seqno(&left) < wsrep_xid_seqno(&right));
+ }
+ else if (left_is_wsrep)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+};
- return false;
+void wsrep_sort_xid_array(XID *array, int len)
+{
+ std::sort(array, array + len, Wsrep_xid_cmp());
}
diff --git a/sql/wsrep_xid.h b/sql/wsrep_xid.h
index 5b33a904de1..e41f6fba420 100644
--- a/sql/wsrep_xid.h
+++ b/sql/wsrep_xid.h
@@ -20,17 +20,19 @@
#ifdef WITH_WSREP
-#include "../wsrep/wsrep_api.h"
+#include "wsrep/gtid.hpp"
#include "handler.h" // XID typedef
-void wsrep_xid_init(xid_t*, const wsrep_uuid_t&, wsrep_seqno_t);
-const wsrep_uuid_t* wsrep_xid_uuid(const XID&);
-wsrep_seqno_t wsrep_xid_seqno(const XID&);
+void wsrep_xid_init(xid_t*, const wsrep::gtid&);
+const wsrep::id& wsrep_xid_uuid(const XID&);
+wsrep::seqno wsrep_xid_seqno(const XID&);
+wsrep::gtid wsrep_get_SE_checkpoint();
+bool wsrep_set_SE_checkpoint(const wsrep::gtid& gtid);
//void wsrep_get_SE_checkpoint(XID&); /* uncomment if needed */
-bool wsrep_get_SE_checkpoint(wsrep_uuid_t&, wsrep_seqno_t&);
//void wsrep_set_SE_checkpoint(XID&); /* uncomment if needed */
-bool wsrep_set_SE_checkpoint(const wsrep_uuid_t&, wsrep_seqno_t);
+
+void wsrep_sort_xid_array(XID *array, int len);
#endif /* WITH_WSREP */
#endif /* WSREP_UTILS_H */
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index 0f66b999c94..3529d875f72 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -866,7 +866,10 @@ int azclose (azio_stream *s)
if (s->mode == 'w')
{
if (do_flush(s, Z_FINISH) != Z_OK)
- return destroy(s);
+ {
+ destroy(s);
+ return Z_ERRNO;
+ }
putLong(s->file, s->crc);
putLong(s->file, (uLong)(s->in & 0xffffffff));
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index bb15aa9297d..f97bc52b6a9 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1737,6 +1737,20 @@ int ha_archive::info(uint flag)
}
+int ha_archive::extra(enum ha_extra_function operation)
+{
+ switch (operation) {
+ case HA_EXTRA_FLUSH:
+ mysql_mutex_lock(&share->mutex);
+ share->close_archive_writer();
+ mysql_mutex_unlock(&share->mutex);
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
/*
This method tells us that a bulk insert operation is about to occur. We set
a flag which will keep write_row from saying that its data is dirty. This in
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index 56ff566db8c..17649c9c110 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -108,7 +108,7 @@ public:
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_CAN_BIT_FIELD |
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
HA_STATS_RECORDS_IS_EXACT | HA_CAN_EXPORT |
- HA_HAS_RECORDS | HA_CAN_REPAIR |
+ HA_HAS_RECORDS | HA_CAN_REPAIR | HA_SLOW_RND_POS |
HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_CAN_GEOMETRY);
}
ulong index_flags(uint idx, uint part, bool all_parts) const
@@ -148,6 +148,7 @@ public:
int read_data_header(azio_stream *file_to_read);
void position(const uchar *record);
int info(uint);
+ int extra(enum ha_extra_function operation);
void update_create_info(HA_CREATE_INFO *create_info);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index 9a4b34809f8..345d6683938 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -55,7 +55,7 @@ public:
{
return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE |
- HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
+ HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_CAN_ONLINE_BACKUPS |
HA_FILE_BASED | HA_CAN_GEOMETRY | HA_CAN_INSERT_DELAYED);
}
ulong index_flags(uint inx, uint part, bool all_parts) const
diff --git a/storage/connect/global.h b/storage/connect/global.h
index 36e8a311124..dc1e149745f 100644
--- a/storage/connect/global.h
+++ b/storage/connect/global.h
@@ -219,11 +219,11 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR prefix, LPCSTR name, LPCSTR dir);
DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
DllExport bool AllocSarea(PGLOBAL, uint);
DllExport void FreeSarea(PGLOBAL);
-DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
+DllExport BOOL PlugSubSet(void *, uint);
+DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
DllExport char *PlugDup(PGLOBAL g, const char *str);
DllExport void *MakePtr(void *, OFFSET);
DllExport void htrc(char const *fmt, ...);
-//DllExport int GetTraceValue(void);
DllExport uint GetTraceValue(void);
#if defined(__cplusplus)
@@ -233,6 +233,6 @@ DllExport uint GetTraceValue(void);
/***********************************************************************/
/* Non exported routine declarations. */
/***********************************************************************/
-void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
+//void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
/*-------------------------- End of Global.H --------------------------*/
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index d3f89aca910..7599765c07a 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -4187,7 +4187,7 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
rc= rnd_next(buf);
} else {
PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp);
- strcpy(g->Message, "Not supported by this table type");
+// strcpy(g->Message, "Not supported by this table type");
my_message(ER_ILLEGAL_HA, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR;
} // endif SetRecpos
@@ -7305,7 +7305,7 @@ maria_declare_plugin(connect)
PLUGIN_LICENSE_GPL,
connect_init_func, /* Plugin Init */
connect_done_func, /* Plugin Deinit */
- 0x0107, /* version number (1.05) */
+ 0x0106, /* version number (1.06) */
NULL, /* status variables */
connect_system_variables, /* system variables */
"1.06.0008", /* string version */
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 145c48b81d5..07a67e37379 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -3056,7 +3056,7 @@ my_bool json_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
PGLOBAL g = (PGLOBAL)initid->ptr;
- PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ PlugSubSet(g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR);
g->N = (int)n;
return false;
@@ -3099,7 +3099,7 @@ void json_array_grp_clear(UDF_INIT *initid, char*, char*)
{
PGLOBAL g = (PGLOBAL)initid->ptr;
- PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ PlugSubSet(g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR);
g->N = GetJsonGroupSize();
} // end of json_array_grp_clear
@@ -3133,7 +3133,7 @@ my_bool json_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
PGLOBAL g = (PGLOBAL)initid->ptr;
- PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ PlugSubSet(g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB);
g->N = (int)n;
return false;
@@ -3170,7 +3170,7 @@ void json_object_grp_clear(UDF_INIT *initid, char*, char*)
{
PGLOBAL g = (PGLOBAL)initid->ptr;
- PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ PlugSubSet(g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB);
g->N = GetJsonGroupSize();
} // end of json_object_grp_clear
@@ -4419,7 +4419,7 @@ char *json_file(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else if (initid->const_item)
g->N = 1;
- PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ PlugSubSet(g->Sarea, g->Sarea_Size);
fn = MakePSZ(g, args, 0);
if (args->arg_count > 1) {
@@ -5663,7 +5663,7 @@ char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result,
if (bsp && !bsp->Changed)
goto fin;
- PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ PlugSubSet(g->Sarea, g->Sarea_Size);
g->Xchk = NULL;
fn = MakePSZ(g, args, 0);
pretty = (args->arg_count > 2 && args->args[2]) ? (int)*(longlong*)args->args[2] : 3;
diff --git a/storage/connect/mysql-test/connect/r/dir.result b/storage/connect/mysql-test/connect/r/dir.result
index e10bb458d62..139544b99e9 100644
--- a/storage/connect/mysql-test/connect/r/dir.result
+++ b/storage/connect/mysql-test/connect/r/dir.result
@@ -26,7 +26,7 @@ fname ftype size
boys .txt 282
boyswin .txt 288
INSERT INTO t1 VALUES ('','','','');
-ERROR 22007: Incorrect double value: '' for column 'size' at row 1
+ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`size` at row 1
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
ERROR HY000: Cannot get column info for table type DIR
diff --git a/storage/connect/mysql-test/connect/r/jdbc.result b/storage/connect/mysql-test/connect/r/jdbc.result
index 12c8779f96d..0dbdf851860 100644
--- a/storage/connect/mysql-test/connect/r/jdbc.result
+++ b/storage/connect/mysql-test/connect/r/jdbc.result
@@ -236,24 +236,37 @@ WHEELFOR SALESMAN 10030.00
MARTIN ENGINEER 10000.00
DROP TABLE t1, connect.emp;
CREATE TABLE t2 (command varchar(128) not null,number int(5) not null flag=1,message varchar(255) flag=2) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mariadb://localhost:PORT/connect' OPTION_LIST='User=root,Execsrc=1';
+SELECT * FROM t2 WHERE command='drop table tx1';
command number message
drop table tx1 0 Execute: java.sql.SQLSyntaxErrorException: (conn:24) Unknown table 'connect.tx1'
+Warnings:
+Warning 1105 Execute: java.sql.SQLSyntaxErrorException: (conn:24) Unknown table 'connect.tx1'
SELECT * FROM t2 WHERE command = 'create table tx1 (a int not null, b char(32), c double(8,2))';
command number message
create table tx1 (a int not null, b char(32), c double(8,2)) 0 Affected rows
+Warnings:
+Warning 1105 Affected rows
SELECT * FROM t2 WHERE command in ('insert into tx1 values(1,''The number one'',456.12)',"insert into tx1(a,b) values(2,'The number two'),(3,'The number three')");
command number message
insert into tx1 values(1,'The number one',456.12) 1 Affected rows
insert into tx1(a,b) values(2,'The number two'),(3,'The number three') 2 Affected rows
+Warnings:
+Warning 1105 Affected rows
SELECT * FROM t2 WHERE command='update tx1 set c = 3.1416 where a = 2';
command number message
update tx1 set c = 3.1416 where a = 2 1 Affected rows
+Warnings:
+Warning 1105 Affected rows
SELECT * FROM t2 WHERE command='select * from tx1';
command number message
select * from tx1 3 Result set column number
+Warnings:
+Warning 1105 Result set column number
SELECT * FROM t2 WHERE command='delete from tx1 where a = 2';
command number message
delete from tx1 where a = 2 1 Affected rows
+Warnings:
+Warning 1105 Affected rows
SELECT * FROM connect.tx1;
a b c
1 The number one 456.12
diff --git a/storage/connect/mysql-test/connect/r/jdbc_oracle.result b/storage/connect/mysql-test/connect/r/jdbc_oracle.result
index 2e36891a037..ec314c5f072 100644
--- a/storage/connect/mysql-test/connect/r/jdbc_oracle.result
+++ b/storage/connect/mysql-test/connect/r/jdbc_oracle.result
@@ -8,12 +8,19 @@ SELECT * FROM t2 WHERE command = 'drop table employee';
command number message
drop table employee 0 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
+Warnings:
+Warning 1105 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
+
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary number(8,2))';
command number message
create table employee (id int not null, name varchar(32), title char(16), salary number(8,2)) 0 Affected rows
+Warnings:
+Warning 1105 Affected rows
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
command number message
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
+Warnings:
+Warning 1105 Affected rows
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
CONNECTION='jdbc:oracle:thin:@localhost:1521:xe'
OPTION_LIST='User=system,Password=manager';
@@ -27,8 +34,8 @@ OPTION_LIST='User=system,Password=manager';
SELECT * FROM t1;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
NULL SYSTEM EMPLOYEE ID 3 NUMBER 38 0 0 10 0 NULL
-NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 0 10 1 NULL
-NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 0 10 1 NULL
+NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 NULL 10 1 NULL
+NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 NULL 10 1 NULL
NULL SYSTEM EMPLOYEE SALARY 3 NUMBER 8 0 2 10 1 NULL
DROP TABLE t1;
CREATE SERVER 'oracle' FOREIGN DATA WRAPPER 'oracle.jdbc.driver.OracleDriver' OPTIONS (
@@ -52,7 +59,7 @@ Note 1105 EMPLOYEE: 1 affected rows
SELECT * FROM t1;
ID NAME TITLE SALARY
4567 Trump Engineer 12560.50
-6214 Clinton Retired 0.00
+6214 Clinton Retired NULL
DELETE FROM t1 WHERE id = 6214;
Warnings:
Note 1105 EMPLOYEE: 1 affected rows
@@ -63,8 +70,7 @@ DROP TABLE t1;
SELECT * FROM t2 WHERE command = 'drop table employee';
command number message
drop table employee 0 Affected rows
+Warnings:
+Warning 1105 Affected rows
DROP TABLE t2;
DROP SERVER 'oracle';
-SET GLOBAL connect_jvm_path=NULL;
-SET GLOBAL connect_class_path=NULL;
-SET GLOBAL time_zone = SYSTEM;
diff --git a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result
index 7969672dd66..07cc3c465ea 100644
--- a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result
+++ b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result
@@ -9,12 +9,18 @@ OPTION_LIST='Execsrc=1';
SELECT * FROM t2 WHERE command='drop table employee';
command number message
drop table employee 0 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
+Warnings:
+Warning 1105 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2))';
command number message
create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2)) 0 Affected rows
+Warnings:
+Warning 1105 Affected rows
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
command number message
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
+Warnings:
+Warning 1105 Affected rows
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
OPTION_LIST='Tabtype=TABLE,Maxres=10';
@@ -63,4 +69,6 @@ DROP SERVER 'postgresql';
SELECT * FROM t2 WHERE command='drop table employee';
command number message
drop table employee 0 Affected rows
+Warnings:
+Warning 1105 Affected rows
DROP TABLE t2;
diff --git a/storage/connect/mysql-test/connect/r/xml2.result b/storage/connect/mysql-test/connect/r/xml2.result
index b8075fa1928..f7bbc17c8a0 100644
--- a/storage/connect/mysql-test/connect/r/xml2.result
+++ b/storage/connect/mysql-test/connect/r/xml2.result
@@ -325,7 +325,7 @@ HEX(c) 3F3F3F3F3F3F3F
Warnings:
Level Warning
Code 1366
-Message Incorrect string value: '\xC3\x81\xC3\x82\xC3\x83...' for column 'c' at row 1
+Message Incorrect string value: '\xC3\x81\xC3\x82\xC3\x83...' for column `test`.`t1`.`c` at row 1
Level Warning
Code 1105
Message Out of range value ÃÂÃÄÅÆÇ for column 'c' at row 1
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index 887527e38ab..6790e7eb45c 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -514,27 +514,31 @@ void FreeSarea(PGLOBAL g)
/* Here there should be some verification done such as validity of */
/* the address and size not larger than memory size. */
/***********************************************************************/
-BOOL PlugSubSet(PGLOBAL g __attribute__((unused)), void *memp, uint size)
+BOOL PlugSubSet(void *memp, uint size)
{
PPOOLHEADER pph = (PPOOLHEADER)memp;
pph->To_Free = (OFFSET)sizeof(POOLHEADER);
pph->FreeBlk = size - pph->To_Free;
-
return FALSE;
} /* end of PlugSubSet */
/***********************************************************************/
+/* Use it to export a function that do throwing. */
+/***********************************************************************/
+static void *DoThrow(int n)
+{
+ throw n;
+} /* end of DoThrow */
+
+/***********************************************************************/
/* Program for sub-allocating one item in a storage area. */
-/* Note: SubAlloc routines of OS/2 are no more used to increase the */
-/* code portability and avoid problems when a grammar compiled under */
-/* one version of OS/2 is used under another version. */
-/* The simple way things are done here is also based on the fact */
-/* that no freeing of suballocated blocks is permitted in Plug. */
+/* The simple way things are done here is based on the fact */
+/* that no freeing of suballocated blocks is permitted in CONNECT. */
/***********************************************************************/
void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
- {
- PPOOLHEADER pph; /* Points on area header. */
+{
+ PPOOLHEADER pph; /* Points on area header. */
if (!memp)
/*******************************************************************/
@@ -559,8 +563,8 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
if (trace(1))
htrc("PlugSubAlloc: %s\n", g->Message);
- throw 1234;
- } /* endif size OS32 code */
+ DoThrow(1234);
+ } /* endif size OS32 code */
/*********************************************************************/
/* Do the suballocation the simplest way. */
@@ -574,7 +578,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
memp, pph->To_Free, pph->FreeBlk);
return (memp);
- } /* end of PlugSubAlloc */
+} /* end of PlugSubAlloc */
/***********************************************************************/
/* Program for sub-allocating and copying a string in a storage area. */
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp
index e4f169575f8..30d8063d1a6 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -522,8 +522,15 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
// Get the function returning an instance of the external DEF class
if (!(getdef = (XGETDEF)GetProcAddress((HINSTANCE)Hdll, getname))) {
- sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname);
- FreeLibrary((HMODULE)Hdll);
+ char buf[256];
+ DWORD rc = GetLastError();
+
+ sprintf(g->Message, MSG(PROCADD_ERROR), rc, getname);
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
+ (LPTSTR)buf, sizeof(buf), NULL);
+ strcat(strcat(g->Message, ": "), buf);
+ FreeLibrary((HMODULE)Hdll);
return NULL;
} // endif getdef
#else // !__WIN__
diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h
index 396bba568ff..10f0757c60b 100644
--- a/storage/connect/tabfmt.h
+++ b/storage/connect/tabfmt.h
@@ -13,7 +13,7 @@ typedef class TDBFMT *PTDBFMT;
/***********************************************************************/
/* Functions used externally. */
/***********************************************************************/
-PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info);
+DllExport PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info);
/***********************************************************************/
/* CSV table. */
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 9e4f5ab987d..d20e793ff88 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -299,7 +299,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
memset(G, 0, sizeof(GLOBAL));
G->Sarea_Size = tdp->Lrecl * 10;
G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size);
- PlugSubSet(G, G->Sarea, G->Sarea_Size);
+ PlugSubSet(G->Sarea, G->Sarea_Size);
G->jump_level = 0;
tjnp->SetG(G);
@@ -670,7 +670,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
memset(G, 0, sizeof(GLOBAL));
G->Sarea_Size = Lrecl * 10;
G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size);
- PlugSubSet(G, G->Sarea, G->Sarea_Size);
+ PlugSubSet(G->Sarea, G->Sarea_Size);
G->jump_level = 0;
((TDBJSN*)tdbp)->G = G;
} else {
@@ -963,7 +963,7 @@ int TDBJSN::ReadDB(PGLOBAL g)
return rc;
// Recover the memory used for parsing
- PlugSubSet(G, G->Sarea, G->Sarea_Size);
+ PlugSubSet(G->Sarea, G->Sarea_Size);
if ((Row = ParseJson(G, To_Line, strlen(To_Line), &Pretty, &Comma))) {
Row = FindRow(g);
@@ -1079,13 +1079,13 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
} // end of PrepareWriting
/***********************************************************************/
-/* WriteDB: Data Base write routine for DOS access method. */
+/* WriteDB: Data Base write routine for JSON access method. */
/***********************************************************************/
int TDBJSN::WriteDB(PGLOBAL g)
{
int rc = TDBDOS::WriteDB(g);
- PlugSubSet(G, G->Sarea, G->Sarea_Size);
+ PlugSubSet(G->Sarea, G->Sarea_Size);
Row->Clear();
return rc;
} // end of WriteDB
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index 2ff72905e86..fcbfe4ed1ec 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -1,11 +1,11 @@
/*************** tabjson H Declares Source Code File (.H) **************/
/* Name: tabjson.h Version 1.3 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
+/* (C) Copyright to the author Olivier BERTRAND 2014 - 2018 */
/* */
/* This file contains the JSON classes declares. */
/***********************************************************************/
-#include "osutil.h"
+//#include "osutil.h" // Unuseful and bad for OEM
#include "block.h"
#include "colblk.h"
#include "json.h"
@@ -16,7 +16,7 @@ typedef class JSONDEF *PJDEF;
typedef class TDBJSON *PJTDB;
typedef class JSONCOL *PJCOL;
class TDBJSN;
-PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info);
+DllExport PQRYRES JSONColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
/***********************************************************************/
/* The JSON tree node. Can be an Object or an Array. */
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index fddfb0c0420..0fa117c3d2f 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2000-2017 */
+/* (C) Copyright to the author Olivier BERTRAND 2000-2018 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -95,23 +95,23 @@ bool ExactInfo(void);
/* Constructor. */
/***********************************************************************/
ODBCDEF::ODBCDEF(void)
- {
+{
Connect = NULL;
Catver = 0;
UseCnc = false;
- } // end of ODBCDEF constructor
+} // end of ODBCDEF constructor
/***********************************************************************/
/* DefineAM: define specific AM block values from XDB file. */
/***********************************************************************/
bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
- {
+{
Desc = Connect = GetStringCatInfo(g, "Connect", NULL);
if (!Connect && !Catfunc) {
sprintf(g->Message, "Missing connection for ODBC table %s", Name);
return true;
- } // endif Connect
+ } // endif Connect
if (EXTDEF::DefineAM(g, am, poff))
return true;
@@ -123,13 +123,13 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT);
UseCnc = GetBoolCatInfo("UseDSN", false);
return false;
- } // end of DefineAM
+} // end of DefineAM
/***********************************************************************/
/* GetTable: makes a new Table Description Block. */
/***********************************************************************/
PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
- {
+{
PTDB tdbp = NULL;
/*********************************************************************/
@@ -158,10 +158,10 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
tdbp = new(g) TDBMUL(tdbp);
else if (Multiple == 2)
strcpy(g->Message, MSG(NO_ODBC_MUL));
- } // endswitch Catfunc
+ } // endswitch Catfunc
return tdbp;
- } // end of GetTable
+} // end of GetTable
/* -------------------------- Class TDBODBC -------------------------- */
@@ -169,7 +169,7 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
/* Implementation of the TDBODBC class. */
/***********************************************************************/
TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp)
- {
+{
Ocp = NULL;
Cnp = NULL;
@@ -191,19 +191,19 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp)
Ops.UseCnc = false;
} // endif tdp
- } // end of TDBODBC standard constructor
+} // end of TDBODBC standard constructor
TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBEXT(tdbp)
- {
+{
Ocp = tdbp->Ocp; // is that right ?
Cnp = tdbp->Cnp;
Connect = tdbp->Connect;
Ops = tdbp->Ops;
- } // end of TDBODBC copy constructor
+} // end of TDBODBC copy constructor
// Method
PTDB TDBODBC::Clone(PTABS t)
- {
+{
PTDB tp;
PODBCCOL cp1, cp2;
PGLOBAL g = t->G; // Is this really useful ???
@@ -213,18 +213,18 @@ PTDB TDBODBC::Clone(PTABS t)
for (cp1 = (PODBCCOL)Columns; cp1; cp1 = (PODBCCOL)cp1->GetNext()) {
cp2 = new(g) ODBCCOL(cp1, tp); // Make a copy
NewPointer(t, cp1, cp2);
- } // endfor cp1
+ } // endfor cp1
return tp;
- } // end of CopyOne
+} // end of CopyOne
/***********************************************************************/
/* Allocate ODBC column description block. */
/***********************************************************************/
PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
- {
+{
return new(g) ODBCCOL(cdp, this, cprec, n);
- } // end of MakeCol
+} // end of MakeCol
/***********************************************************************/
/* Extract the filename from connect string and return it. */
@@ -232,7 +232,7 @@ PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
/* with a place holder to be used by SetFile. */
/***********************************************************************/
PCSZ TDBODBC::GetFile(PGLOBAL g)
- {
+{
if (Connect) {
char *p1, *p2;
int i;
@@ -263,18 +263,18 @@ PCSZ TDBODBC::GetFile(PGLOBAL g)
memcpy(MulConn, Connect, p1 - Connect);
MulConn[p1 - Connect] = '\0';
strcat(strcat(MulConn, "%s"), (p2) ? p2 : ";");
- } // endif p1
+ } // endif p1
- } // endif Connect
+ } // endif Connect
return (DBQ) ? DBQ : (PSZ)"???";
- } // end of GetFile
+} // end of GetFile
/***********************************************************************/
/* Set DBQ and get the new file name into the connect string. */
/***********************************************************************/
void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
- {
+{
if (MulConn) {
int n = strlen(MulConn) + strlen(fn) - 1;
@@ -283,20 +283,20 @@ void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
// of having to reallocate it is reduced.
BufSize = n + 6;
Connect = (char*)PlugSubAlloc(g, NULL, BufSize);
- } // endif n
+ } // endif n
// Make the complete connect string
sprintf(Connect, MulConn, fn);
- } // endif MultConn
+ } // endif MultConn
DBQ = PlugDup(g, fn);
- } // end of SetFile
+} // end of SetFile
/***********************************************************************/
/* MakeInsert: make the Insert statement used with ODBC connection. */
/***********************************************************************/
bool TDBODBC::MakeInsert(PGLOBAL g)
- {
+{
PCSZ schmp = NULL;
char *catp = NULL, buf[NAM_LEN * 3];
int len = 0;
@@ -377,7 +377,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
} else
Query->Append(buf);
- } // endfor colp
+ } // endfor colp
Query->Append(") VALUES (");
@@ -390,32 +390,32 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
Query->RepLast(')');
return oom;
- } // end of MakeInsert
+} // end of MakeInsert
/***********************************************************************/
/* ODBC Bind Parameter function. */
/***********************************************************************/
bool TDBODBC::BindParameters(PGLOBAL g)
- {
- PODBCCOL colp;
+{
+ PODBCCOL colp;
- for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
- colp->AllocateBuffers(g, 0);
+ for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
+ colp->AllocateBuffers(g, 0);
- if (Ocp->BindParam(colp))
- return true;
+ if (Ocp->BindParam(colp))
+ return true;
- } // endfor colp
+ } // endfor colp
- return false;
- } // end of BindParameters
+ return false;
+} // end of BindParameters
#if 0
/***********************************************************************/
/* MakeUpdate: make the SQL statement to send to ODBC connection. */
/***********************************************************************/
char *TDBODBC::MakeUpdate(PGLOBAL g)
- {
+{
char *qc, *stmt = NULL, cmd[8], tab[96], end[1024];
stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
@@ -440,60 +440,60 @@ char *TDBODBC::MakeUpdate(PGLOBAL g)
strcat(stmt, end);
return stmt;
- } // end of MakeUpdate
+} // end of MakeUpdate
/***********************************************************************/
/* MakeDelete: make the SQL statement to send to ODBC connection. */
/***********************************************************************/
char *TDBODBC::MakeDelete(PGLOBAL g)
- {
- char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512];
-
- stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
- memset(end, 0, sizeof(end));
-
- if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 ||
- sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2)
- qc = Ocp->GetQuoteChar();
- else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
- qc = (Quoted) ? Quote : "";
- else {
- strcpy(g->Message, "Cannot use this DELETE command");
- return NULL;
- } // endif sscanf
-
- assert(!stricmp(cmd, "delete") && !stricmp(from, "from"));
- strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc);
-
- if (*end) {
- for (int i = 0; end[i]; i++)
- if (end[i] == '`')
- end[i] = *qc;
-
- strcat(stmt, end);
- } // endif end
-
- return stmt;
- } // end of MakeDelete
+{
+ char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512];
+
+ stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
+ memset(end, 0, sizeof(end));
+
+ if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 ||
+ sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2)
+ qc = Ocp->GetQuoteChar();
+ else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
+ qc = (Quoted) ? Quote : "";
+ else {
+ strcpy(g->Message, "Cannot use this DELETE command");
+ return NULL;
+ } // endif sscanf
+
+ assert(!stricmp(cmd, "delete") && !stricmp(from, "from"));
+ strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc);
+
+ if (*end) {
+ for (int i = 0; end[i]; i++)
+ if (end[i] == '`')
+ end[i] = *qc;
+
+ strcat(stmt, end);
+ } // endif end
+
+ return stmt;
+} // end of MakeDelete
#endif // 0
/***********************************************************************/
/* ResetSize: call by TDBMUL when calculating size estimate. */
/***********************************************************************/
void TDBODBC::ResetSize(void)
- {
+{
MaxSize = -1;
if (Ocp && Ocp->IsOpen())
Ocp->Close();
- } // end of ResetSize
+} // end of ResetSize
/***********************************************************************/
/* ODBC Cardinality: returns table size in number of rows. */
/***********************************************************************/
int TDBODBC::Cardinality(PGLOBAL g)
- {
+{
if (!g)
return (Mode == MODE_ANY && !Srcdef) ? 1 : 0;
@@ -526,7 +526,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
Cardinal = 10; // To make MySQL happy
return Cardinal;
- } // end of Cardinality
+} // end of Cardinality
/***********************************************************************/
/* ODBC Access Method opening routine. */
@@ -535,7 +535,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
/* join block of next table if it exists or else are discarted. */
/***********************************************************************/
bool TDBODBC::OpenDB(PGLOBAL g)
- {
+{
bool rc = true;
if (trace(1))
@@ -571,7 +571,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
Fpos = 0;
Curpos = 1;
return false;
- } // endif use
+ } // endif use
/*********************************************************************/
/* Open an ODBC connection for this table. */
@@ -593,7 +593,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
Use = USE_OPEN; // Do it now in case we are recursively called
/*********************************************************************/
- /* Make the command and allocate whatever is used for getting results. */
+ /* Make the command and allocate whatever is used for getting results*/
/*********************************************************************/
if (Mode == MODE_READ || Mode == MODE_READX) {
if (Memory > 1 && !Srcdef) {
@@ -624,7 +624,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
} else
return true;
- } // endif Memory
+ } // endif Memory
if (!(rc = MakeSQL(g, false))) {
for (PODBCCOL colp = (PODBCCOL)Columns; colp;
@@ -635,7 +635,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
rc = (Mode == MODE_READ)
? ((Rows = Ocp->ExecDirectSQL(Query->GetStr(), (PODBCCOL)Columns)) < 0)
: false;
- } // endif rc
+ } // endif rc
} else if (Mode == MODE_INSERT) {
if (!(rc = MakeInsert(g))) {
@@ -645,7 +645,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
} else
rc = BindParameters(g);
- } // endif rc
+ } // endif rc
} else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
rc = false; // wait for CheckCond before calling MakeCommand(g);
@@ -655,30 +655,30 @@ bool TDBODBC::OpenDB(PGLOBAL g)
if (rc) {
Ocp->Close();
return true;
- } // endif rc
+ } // endif rc
/*********************************************************************/
/* Reset statistics values. */
/*********************************************************************/
num_read = num_there = num_eq[0] = num_eq[1] = 0;
return false;
- } // end of OpenDB
+} // end of OpenDB
#if 0
/***********************************************************************/
/* GetRecpos: return the position of last read record. */
/***********************************************************************/
int TDBODBC::GetRecpos(void)
- {
+{
return Fpos;
- } // end of GetRecpos
+} // end of GetRecpos
#endif // 0
/***********************************************************************/
/* SetRecpos: set the position of next read record. */
/***********************************************************************/
bool TDBODBC::SetRecpos(PGLOBAL g, int recpos)
- {
+{
if (Ocp->m_Full) {
Fpos = 0;
CurNum = recpos - 1;
@@ -696,14 +696,15 @@ bool TDBODBC::SetRecpos(PGLOBAL g, int recpos)
} // endif recpos
} else {
- strcpy(g->Message, "This action requires a scrollable cursor");
+ strcpy(g->Message,
+ "This action requires Memory setting or a scrollable cursor");
return true;
} // endif's
// Indicate the table position was externally set
Placed = true;
return false;
- } // end of SetRecpos
+} // end of SetRecpos
/***********************************************************************/
/* Data Base indexed read routine for ODBC access method. */
@@ -721,7 +722,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
Rows = Ocp->ExecDirectSQL((char*)Query->GetStr(), (PODBCCOL)Columns);
Mode = MODE_READ;
return (Rows < 0);
- } // endif key
+ } // endif key
return false;
} else {
@@ -737,7 +738,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
if ((To_CondFil = hc->CheckCond(g, To_CondFil, Cond)))
PlugSubAlloc(g, NULL, strlen(To_CondFil->Body) + 1);
- } // endif active_index
+ } // endif active_index
if (To_CondFil)
if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) {
@@ -762,7 +763,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
/* VRDNDOS: Data Base read routine for odbc access method. */
/***********************************************************************/
int TDBODBC::ReadDB(PGLOBAL g)
- {
+{
int rc;
if (trace(2))
@@ -784,7 +785,7 @@ int TDBODBC::ReadDB(PGLOBAL g)
} else
return RC_FX; // Error
- } // endif Mode
+ } // endif Mode
/*********************************************************************/
/* Now start the reading process. */
@@ -813,7 +814,7 @@ int TDBODBC::ReadDB(PGLOBAL g)
Qrp->Nblin++;
Fpos++; // Used for memory and pos
- } // endif rc
+ } // endif rc
} // endif Placed
@@ -821,13 +822,13 @@ int TDBODBC::ReadDB(PGLOBAL g)
htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc);
return rc;
- } // end of ReadDB
+} // end of ReadDB
/***********************************************************************/
/* Data Base Insert write routine for ODBC access method. */
/***********************************************************************/
int TDBODBC::WriteDB(PGLOBAL g)
- {
+{
int n = Ocp->ExecuteSQL();
if (n < 0) {
@@ -837,13 +838,13 @@ int TDBODBC::WriteDB(PGLOBAL g)
AftRows += n;
return RC_OK;
- } // end of WriteDB
+} // end of WriteDB
/***********************************************************************/
/* Data Base delete line routine for ODBC access method. */
/***********************************************************************/
int TDBODBC::DeleteDB(PGLOBAL g, int irc)
- {
+{
if (irc == RC_FX) {
if (!Query && MakeCommand(g))
return RC_FX;
@@ -863,13 +864,13 @@ int TDBODBC::DeleteDB(PGLOBAL g, int irc)
} else
return RC_OK; // Ignore
- } // end of DeleteDB
+} // end of DeleteDB
/***********************************************************************/
/* Data Base close routine for ODBC access method. */
/***********************************************************************/
void TDBODBC::CloseDB(PGLOBAL g)
- {
+{
if (Ocp)
Ocp->Close();
@@ -877,7 +878,7 @@ void TDBODBC::CloseDB(PGLOBAL g)
if (trace(1))
htrc("ODBC CloseDB: closing %s\n", Name);
- } // end of CloseDB
+} // end of CloseDB
/* --------------------------- ODBCCOL ------------------------------- */
@@ -886,33 +887,33 @@ void TDBODBC::CloseDB(PGLOBAL g)
/***********************************************************************/
ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
: EXTCOL(cdp, tdbp, cprec, i, am)
- {
+{
// Set additional ODBC access method information for column.
Slen = 0;
StrLen = &Slen;
Sqlbuf = NULL;
- } // end of ODBCCOL constructor
+} // end of ODBCCOL constructor
/***********************************************************************/
/* ODBCCOL private constructor. */
/***********************************************************************/
ODBCCOL::ODBCCOL(void) : EXTCOL()
- {
+{
Slen = 0;
StrLen = &Slen;
Sqlbuf = NULL;
- } // end of ODBCCOL constructor
+} // end of ODBCCOL constructor
/***********************************************************************/
/* ODBCCOL constructor used for copying columns. */
/* tdbp is the pointer to the new table descriptor. */
/***********************************************************************/
ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
- {
+{
Slen = col1->Slen;
StrLen = col1->StrLen;
Sqlbuf = col1->Sqlbuf;
- } // end of ODBCCOL copy constructor
+} // end of ODBCCOL copy constructor
/***********************************************************************/
/* ReadColumn: when SQLFetch is used there is nothing to do as the */
@@ -920,7 +921,7 @@ ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
/* when calculating MaxSize (Bufp is NULL even when Rows is not). */
/***********************************************************************/
void ODBCCOL::ReadColumn(PGLOBAL g)
- {
+{
PTDBODBC tdbp = (PTDBODBC)To_Tdb;
int i = tdbp->Fpos - 1, n = tdbp->CurNum;
@@ -953,7 +954,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
else
Value->SetValue_pvblk(Blkp, n);
- } // endif Bufp
+ } // endif Bufp
if (Buf_Type == TYPE_DATE) {
struct tm dbtime;
@@ -980,7 +981,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
htrc("ODBC Column %s: rows=%d buf=%p type=%d value=%s\n",
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
- } // endif trace
+ } // endif trace
put:
if (tdbp->Memory != 2)
@@ -997,7 +998,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
} else
Crp->Kdata->SetValue(Value, i);
- } // end of ReadColumn
+} // end of ReadColumn
/***********************************************************************/
/* AllocateBuffers: allocate the extended buffer for SQLExtendedFetch */
@@ -1005,7 +1006,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
/* for the ending null character. */
/***********************************************************************/
void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows)
- {
+{
if (Buf_Type == TYPE_DATE)
Sqlbuf = (TIMESTAMP_STRUCT*)PlugSubAlloc(g, NULL,
sizeof(TIMESTAMP_STRUCT));
@@ -1019,31 +1020,31 @@ void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows)
Blkp = AllocValBlock(g, NULL, Buf_Type, rows, GetBuflen(),
GetScale(), true, false, false);
Bufp = Blkp->GetValPointer();
- } // endelse
+ } // endelse
if (rows > 1)
StrLen = (SQLLEN *)PlugSubAlloc(g, NULL, rows * sizeof(SQLLEN));
- } // end of AllocateBuffers
+} // end of AllocateBuffers
/***********************************************************************/
/* Returns the buffer to use for Fetch or Extended Fetch. */
/***********************************************************************/
void *ODBCCOL::GetBuffer(DWORD rows)
- {
+{
if (rows && To_Tdb) {
assert(rows == (DWORD)((TDBODBC*)To_Tdb)->Rows);
return Bufp;
} else
return (Buf_Type == TYPE_DATE) ? Sqlbuf : Value->GetTo_Val();
- } // end of GetBuffer
+} // end of GetBuffer
/***********************************************************************/
/* Returns the buffer length to use for Fetch or Extended Fetch. */
/***********************************************************************/
SWORD ODBCCOL::GetBuflen(void)
- {
+{
SWORD flen;
switch (Buf_Type) {
@@ -1059,13 +1060,13 @@ SWORD ODBCCOL::GetBuflen(void)
} // endswitch Buf_Type
return flen;
- } // end of GetBuflen
+} // end of GetBuflen
/***********************************************************************/
/* WriteColumn: make sure the bind buffer is updated. */
/***********************************************************************/
void ODBCCOL::WriteColumn(PGLOBAL g)
- {
+{
/*********************************************************************/
/* Do convert the column value if necessary. */
/*********************************************************************/
@@ -1095,7 +1096,7 @@ void ODBCCOL::WriteColumn(PGLOBAL g)
*StrLen = (Value->IsNull()) ? SQL_NULL_DATA :
(IsTypeChar(Buf_Type)) ? SQL_NTS : 0;
- } // end of WriteColumn
+} // end of WriteColumn
/* -------------------------- Class TDBXDBC -------------------------- */
@@ -1119,7 +1120,7 @@ TDBXDBC::TDBXDBC(PTDBXDBC tdbp) : TDBODBC(tdbp)
} // end of TDBXDBC copy constructor
PTDB TDBXDBC::Clone(PTABS t)
- {
+{
PTDB tp;
PXSRCCOL cp1, cp2;
PGLOBAL g = t->G; // Is this really useful ???
@@ -1129,29 +1130,29 @@ PTDB TDBXDBC::Clone(PTABS t)
for (cp1 = (PXSRCCOL)Columns; cp1; cp1 = (PXSRCCOL)cp1->GetNext()) {
cp2 = new(g) XSRCCOL(cp1, tp); // Make a copy
NewPointer(t, cp1, cp2);
- } // endfor cp1
+ } // endfor cp1
return tp;
- } // end of CopyOne
+} // end of CopyOne
/***********************************************************************/
/* Allocate XSRC column description block. */
/***********************************************************************/
PCOL TDBXDBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
- {
+{
PXSRCCOL colp = new(g) XSRCCOL(cdp, this, cprec, n);
if (!colp->Flag)
Cmdcol = colp->GetName();
return colp;
- } // end of MakeCol
+} // end of MakeCol
/***********************************************************************/
/* MakeCMD: make the SQL statement to send to ODBC connection. */
/***********************************************************************/
PCMD TDBXDBC::MakeCMD(PGLOBAL g)
- {
+{
PCMD xcmd = NULL;
if (To_CondFil) {
@@ -1171,14 +1172,14 @@ PCMD TDBXDBC::MakeCMD(PGLOBAL g)
xcmd = new(g) CMD(g, Srcdef);
return xcmd;
- } // end of MakeCMD
+} // end of MakeCMD
#if 0
/***********************************************************************/
/* ODBC Bind Parameter function. */
/***********************************************************************/
bool TDBXDBC::BindParameters(PGLOBAL g)
- {
+{
PODBCCOL colp;
for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
@@ -1190,19 +1191,19 @@ bool TDBXDBC::BindParameters(PGLOBAL g)
} // endfor colp
return false;
- } // end of BindParameters
+} // end of BindParameters
#endif // 0
/***********************************************************************/
/* XDBC GetMaxSize: returns table size (not always one row). */
/***********************************************************************/
int TDBXDBC::GetMaxSize(PGLOBAL g)
- {
+{
if (MaxSize < 0)
MaxSize = 10; // Just a guess
return MaxSize;
- } // end of GetMaxSize
+} // end of GetMaxSize
/***********************************************************************/
/* ODBC Access Method opening routine. */
@@ -1211,7 +1212,7 @@ int TDBXDBC::GetMaxSize(PGLOBAL g)
/* join block of next table if it exists or else are discarted. */
/***********************************************************************/
bool TDBXDBC::OpenDB(PGLOBAL g)
- {
+{
bool rc = false;
if (trace(1))
@@ -1221,7 +1222,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
if (Use == USE_OPEN) {
strcpy(g->Message, "Multiple execution is not allowed");
return true;
- } // endif use
+ } // endif use
/*********************************************************************/
/* Open an ODBC connection for this table. */
@@ -1243,7 +1244,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
if (Mode != MODE_READ && Mode != MODE_READX) {
strcpy(g->Message, "No INSERT/DELETE/UPDATE of XDBC tables");
return true;
- } // endif Mode
+ } // endif Mode
/*********************************************************************/
/* Get the command to execute. */
@@ -1256,13 +1257,13 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
Rows = 1;
return false;
- } // end of OpenDB
+} // end of OpenDB
/***********************************************************************/
/* ReadDB: Data Base read routine for xdbc access method. */
/***********************************************************************/
int TDBXDBC::ReadDB(PGLOBAL g)
- {
+{
if (Cmdlist) {
if (!Query)
Query = new(g)STRING(g, 0, Cmdlist->Cmd);
@@ -1280,25 +1281,25 @@ int TDBXDBC::ReadDB(PGLOBAL g)
return RC_EF;
} // endif Cmdlist
- } // end of ReadDB
+} // end of ReadDB
/***********************************************************************/
-/* Data Base delete line routine for ODBC access method. */
+/* Data Base write line routine for XDBC access method. */
/***********************************************************************/
int TDBXDBC::WriteDB(PGLOBAL g)
- {
+{
strcpy(g->Message, "Execsrc tables are read only");
return RC_FX;
- } // end of DeleteDB
+} // end of DeleteDB
/***********************************************************************/
-/* Data Base delete line routine for ODBC access method. */
+/* Data Base delete line routine for XDBC access method. */
/***********************************************************************/
int TDBXDBC::DeleteDB(PGLOBAL g, int irc)
- {
+{
strcpy(g->Message, MSG(NO_ODBC_DELETE));
return RC_FX;
- } // end of DeleteDB
+} // end of DeleteDB
/* --------------------------- XSRCCOL ------------------------------- */
@@ -1307,25 +1308,25 @@ int TDBXDBC::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/
XSRCCOL::XSRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
: ODBCCOL(cdp, tdbp, cprec, i, am)
- {
+{
// Set additional ODBC access method information for column.
Flag = cdp->GetOffset();
- } // end of XSRCCOL constructor
+} // end of XSRCCOL constructor
/***********************************************************************/
/* XSRCCOL constructor used for copying columns. */
/* tdbp is the pointer to the new table descriptor. */
/***********************************************************************/
XSRCCOL::XSRCCOL(XSRCCOL *col1, PTDB tdbp) : ODBCCOL(col1, tdbp)
- {
+{
Flag = col1->Flag;
- } // end of XSRCCOL copy constructor
+} // end of XSRCCOL copy constructor
/***********************************************************************/
/* ReadColumn: set column value according to Flag. */
/***********************************************************************/
void XSRCCOL::ReadColumn(PGLOBAL g)
- {
+{
PTDBXDBC tdbp = (PTDBXDBC)To_Tdb;
switch (Flag) {
@@ -1335,15 +1336,15 @@ void XSRCCOL::ReadColumn(PGLOBAL g)
default: Value->SetValue_psz("Invalid Flag"); break;
} // endswitch Flag
- } // end of ReadColumn
+} // end of ReadColumn
/***********************************************************************/
/* WriteColumn: Should never be called. */
/***********************************************************************/
void XSRCCOL::WriteColumn(PGLOBAL g)
- {
+{
// Should never be called
- } // end of WriteColumn
+} // end of WriteColumn
/* ---------------------------TDBDRV class --------------------------- */
@@ -1351,9 +1352,9 @@ void XSRCCOL::WriteColumn(PGLOBAL g)
/* GetResult: Get the list of ODBC drivers. */
/***********************************************************************/
PQRYRES TDBDRV::GetResult(PGLOBAL g)
- {
+{
return ODBCDrivers(g, Maxres, false);
- } // end of GetResult
+} // end of GetResult
/* ---------------------------TDBSRC class --------------------------- */
@@ -1361,9 +1362,9 @@ PQRYRES TDBDRV::GetResult(PGLOBAL g)
/* GetResult: Get the list of ODBC data sources. */
/***********************************************************************/
PQRYRES TDBSRC::GetResult(PGLOBAL g)
- {
+{
return ODBCDataSources(g, Maxres, false);
- } // end of GetResult
+} // end of GetResult
/* ---------------------------TDBOTB class --------------------------- */
@@ -1371,7 +1372,7 @@ PQRYRES TDBSRC::GetResult(PGLOBAL g)
/* TDBOTB class constructor. */
/***********************************************************************/
TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
- {
+{
Dsn = tdp->GetConnect();
Schema = tdp->GetTabschema();
Tab = tdp->GetTabname();
@@ -1381,15 +1382,15 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
Ops.Cto = tdp->Cto;
Ops.Qto = tdp->Qto;
Ops.UseCnc = tdp->UseCnc;
- } // end of TDBOTB constructor
+} // end of TDBOTB constructor
/***********************************************************************/
/* GetResult: Get the list of ODBC tables. */
/***********************************************************************/
PQRYRES TDBOTB::GetResult(PGLOBAL g)
- {
+{
return ODBCTables(g, Dsn, Schema, Tab, Tabtyp, Maxres, false, &Ops);
- } // end of GetResult
+} // end of GetResult
/* ---------------------------TDBOCL class --------------------------- */
@@ -1405,8 +1406,8 @@ TDBOCL::TDBOCL(PODEF tdp) : TDBOTB(tdp)
/* GetResult: Get the list of ODBC table columns. */
/***********************************************************************/
PQRYRES TDBOCL::GetResult(PGLOBAL g)
- {
+{
return ODBCColumns(g, Dsn, Schema, Tab, Colpat, Maxres, false, &Ops);
- } // end of GetResult
+} // end of GetResult
/* ------------------------ End of Tabodbc --------------------------- */
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 16bc9f91017..573339bce35 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -682,6 +682,14 @@ PTDB TDBXML::Clone(PTABS t)
} // end of Clone
/***********************************************************************/
+/* Must not be in tabxml.h because of OEM tables */
+/***********************************************************************/
+const CHARSET_INFO *TDBXML::data_charset()
+{
+ return &my_charset_utf8_general_ci;
+} // end of data_charset
+
+/***********************************************************************/
/* Allocate XML column description block. */
/***********************************************************************/
PCOL TDBXML::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
@@ -2209,8 +2217,9 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
TDBXCT::TDBXCT(PXMLDEF tdp) : TDBCAT(tdp)
{
Topt = tdp->GetTopt();
- Db = (char*)tdp->GetDB();
- Tabn = tdp->Tabname;
+ //Db = (char*)tdp->GetDB();
+ Db = (char*)tdp->Schema;
+ Tabn = tdp->Tabname;
} // end of TDBXCT constructor
/***********************************************************************/
diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h
index f55b7d98de7..102767e965a 100644
--- a/storage/connect/tabxml.h
+++ b/storage/connect/tabxml.h
@@ -9,6 +9,8 @@ typedef class XMLDEF *PXMLDEF;
typedef class TDBXML *PTDBXML;
typedef class XMLCOL *PXMLCOL;
+DllExport PQRYRES XMLColumns(PGLOBAL, char *, char *, PTOS, bool);
+
/* --------------------------- XML classes --------------------------- */
/***********************************************************************/
@@ -100,8 +102,7 @@ class DllExport TDBXML : public TDBASE {
virtual int DeleteDB(PGLOBAL g, int irc);
virtual void CloseDB(PGLOBAL g);
virtual int CheckWrite(PGLOBAL g) {Checked = true; return 0;}
- virtual const CHARSET_INFO *data_charset()
- {return &my_charset_utf8_general_ci;}
+ virtual const CHARSET_INFO *data_charset();
protected:
// Members
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index e2d3b664aeb..a2a8faf9b38 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -107,7 +107,7 @@ bool user_connect::user_init()
g= PlugInit(NULL, worksize);
// Check whether the initialization is complete
- if (!g || !g->Sarea || PlugSubSet(g, g->Sarea, g->Sarea_Size)
+ if (!g || !g->Sarea || PlugSubSet(g->Sarea, g->Sarea_Size)
|| !(dup= PlgMakeUser(g))) {
if (g)
printf("%s\n", g->Message);
@@ -172,7 +172,7 @@ bool user_connect::CheckCleanup(bool force)
} // endif worksize
- PlugSubSet(g, g->Sarea, g->Sarea_Size);
+ PlugSubSet(g->Sarea, g->Sarea_Size);
g->Xchk = NULL;
g->Createas = 0;
g->Alchecked = 0;
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index d5db465588a..f69dd7989a2 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -1311,12 +1311,28 @@ int ha_tina::info(uint flag)
int ha_tina::extra(enum ha_extra_function operation)
{
DBUG_ENTER("ha_tina::extra");
- if (operation == HA_EXTRA_MARK_AS_LOG_TABLE)
- {
- mysql_mutex_lock(&share->mutex);
- share->is_log_table= TRUE;
- mysql_mutex_unlock(&share->mutex);
- }
+ switch (operation) {
+ case HA_EXTRA_MARK_AS_LOG_TABLE:
+ {
+ mysql_mutex_lock(&share->mutex);
+ share->is_log_table= TRUE;
+ mysql_mutex_unlock(&share->mutex);
+ }
+ break;
+ case HA_EXTRA_FLUSH:
+ mysql_mutex_lock(&share->mutex);
+ if (share->tina_write_opened)
+ {
+ (void)write_meta_file(share->meta_file, share->rows_recorded,
+ share->crashed ? TRUE :FALSE);
+ mysql_file_close(share->tina_write_filedes, MYF(0));
+ share->tina_write_opened= FALSE;
+ }
+ mysql_mutex_unlock(&share->mutex);
+ break;
+ default:
+ break;
+ }
DBUG_RETURN(0);
}
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index c75a64faa52..5b389d984d6 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -107,7 +107,7 @@ public:
{
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT |
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_CAN_EXPORT |
- HA_CAN_REPAIR);
+ HA_CAN_REPAIR | HA_SLOW_RND_POS);
}
ulong index_flags(uint idx, uint part, bool all_parts) const
{
diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h
index 8fe42bd2b08..45318f4c594 100644
--- a/storage/federated/ha_federated.h
+++ b/storage/federated/ha_federated.h
@@ -146,6 +146,7 @@ public:
HA_NO_PREFIX_CHAR_KEYS | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE |
HA_NO_TRANSACTIONS /* until fixed by WL#2952 */ |
HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY |
+ HA_CAN_ONLINE_BACKUPS |
HA_CAN_REPAIR);
}
/*
diff --git a/storage/federatedx/TODO b/storage/federatedx/TODO
deleted file mode 100644
index 71330742f4e..00000000000
--- a/storage/federatedx/TODO
+++ /dev/null
@@ -1,30 +0,0 @@
-Features
-
-* Add Pushdown conditions
-* Add other network driver interfaces
-* Handle large result sets
-* Auto-discovery of tables on foreign data sources
-
-Bugs (http://bugs.mysql.com)
-
-20026 2006-05-23 FEDERATED lacks support for auto_increment_increment and auto_increment_offset
-20724 2006-06-27 FEDERATED does not honour SET INSERT_ID
-28269 2007-05-06 Any FEDERATED engine fails to quote reserved words for field names
-25509 2007-01-10 Federated: Failure with non-ASCII characters
-26697 2007-02-27 Every query to a federated table results in a full scan of MyISAM table.
-21360 2006-07-31 Microsoft Windows (Windows/Linux) mysqldump error on federated tables
-34189 2008-01-31 Any ALTER TABLE t1 ENGINE=FEDERATED CONNECTION='connectionString' on MyISAM fails
-31757 2007-10-22 Any Federated tables break replication Antony Curtis
-33953 2008-01-21 Any mysqld dies on search federated table using nullable index with < or <= operator
-34015 2008-01-23 Linux Problems with float fields using federated tables
-21583 2006-08-11 Linux (Linux) Federated table returns broken strings.
-33702 2008-01-05 Accessing a federated table with a non existing server returns random error code
-25512 2007-01-10 Federated: CREATE failures
-32426 2007-11-16 Any FEDERATED query returns corrupt results for ORDER BY on a TEXT field
-25510 2007-01-10 Federated: double trigger activation
-33250 2007-12-14 SELECT * FROM really_big_federated_table eats lots of virtual memory (OOM)
-14874 2005-11-11 Error 2013: Lost connection to MySQL server with Federated table
-25508 2007-01-10 Federated: Failure to Remove Partitioning
-27180 2007-03-15 #1030 - Got error 1 from storage engine with big tables
-33947 2008-01-20 Any Join on Federated tables with Unique index and IS NOT NULL crashes server
-30051 (fixed) CREATE TABLE does not connect and check existence of remote table
diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h
index 16a1944b172..7eed0fa539e 100644
--- a/storage/federatedx/ha_federatedx.h
+++ b/storage/federatedx/ha_federatedx.h
@@ -333,7 +333,7 @@ public:
return (HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED
| HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS |
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_CAN_REPAIR |
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE |
+ HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | HA_CAN_ONLINE_BACKUPS |
HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY);
}
/*
diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h
index e17c18c8b14..3a7e0060a05 100644
--- a/storage/heap/ha_heap.h
+++ b/storage/heap/ha_heap.h
@@ -49,7 +49,7 @@ public:
{
return (HA_FAST_KEY_READ | HA_NO_BLOBS | HA_NULL_IN_KEY |
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
- HA_CAN_SQL_HANDLER |
+ HA_CAN_SQL_HANDLER | HA_CAN_ONLINE_BACKUPS |
HA_REC_NOT_IN_SEQ | HA_CAN_INSERT_DELAYED | HA_NO_TRANSACTIONS |
HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT);
}
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 90a01540000..7d255531b15 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -194,8 +194,6 @@ IF(MSVC)
TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065")
ENDIF()
-ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)
-
-IF(TARGET innobase)
- ADD_DEPENDENCIES(innobase GenError)
+IF(NOT (PLUGIN_INNOBASE STREQUAL DYNAMIC))
+ ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)
ENDIF()
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 7e2436a6356..1b3ea2eb487 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -26,9 +26,7 @@ Created 6/2/1994 Heikki Tuuri
*******************************************************/
#include "btr0btr.h"
-#include "ha_prototypes.h"
-#include "fsp0sysspace.h"
#include "page0page.h"
#include "page0zip.h"
#include "gis0rtree.h"
@@ -43,10 +41,11 @@ Created 6/2/1994 Heikki Tuuri
#include "trx0trx.h"
#include "srv0mon.h"
#include "gis0geo.h"
-#include "ut0new.h"
#include "dict0boot.h"
#include "row0sel.h" /* row_search_max_autoinc() */
+Atomic_counter<uint32_t> btr_validate_index_running;
+
/**************************************************************//**
Checks if the page in the cursor can be merged with given page.
If necessary, re-organize the merge_page.
@@ -60,15 +59,12 @@ btr_can_merge_with_page(
buf_block_t** merge_block, /*!< out: the merge block */
mtr_t* mtr); /*!< in: mini-transaction */
-/**************************************************************//**
-Report that an index page is corrupted. */
-void
-btr_corruption_report(
-/*==================*/
- const buf_block_t* block, /*!< in: corrupted block */
- const dict_index_t* index) /*!< in: index tree */
+/** Report that an index page is corrupted.
+@param[in] buffer block
+@param[in] index tree */
+void btr_corruption_report(const buf_block_t* block, const dict_index_t* index)
{
- ib::error()
+ ib::fatal()
<< "Flag mismatch in page " << block->page.id
<< " index " << index->name
<< " of table " << index->table->name;
@@ -228,7 +224,7 @@ btr_root_block_get(
}
buf_block_t* block = btr_block_get(
- page_id_t(index->table->space->id, index->page),
+ page_id_t(index->table->space_id, index->page),
page_size_t(index->table->space->flags), mode,
index, mtr);
@@ -253,9 +249,9 @@ btr_root_block_get(
const page_t* root = buf_block_get_frame(block);
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
- + root, index->table->space->id));
+ + root, index->table->space_id));
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
- + root, index->table->space->id));
+ + root, index->table->space_id));
}
#endif /* UNIV_BTR_DEBUG */
@@ -366,7 +362,7 @@ btr_root_adjust_on_import(
buf_block_t* block;
page_zip_des_t* page_zip;
dict_table_t* table = index->table;
- const page_id_t page_id(table->space->id, index->page);
+ const page_id_t page_id(table->space_id, index->page);
const page_size_t page_size(table->space->flags);
DBUG_EXECUTE_IF("ib_import_trigger_corruption_3",
@@ -408,10 +404,10 @@ btr_root_adjust_on_import(
if (err == DB_SUCCESS
&& (!btr_root_fseg_adjust_on_import(
FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
- + page, page_zip, table->space->id, &mtr)
+ + page, page_zip, table->space_id, &mtr)
|| !btr_root_fseg_adjust_on_import(
FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
- + page, page_zip, table->space->id, &mtr))) {
+ + page, page_zip, table->space_id, &mtr))) {
err = DB_CORRUPTION;
}
@@ -477,7 +473,7 @@ btr_page_alloc_for_ibuf(
ut_a(node_addr.page != FIL_NULL);
new_block = buf_page_get(
- page_id_t(index->table->space->id, node_addr.page),
+ page_id_t(index->table->space_id, node_addr.page),
page_size_t(index->table->space->flags),
RW_X_LATCH, mtr);
@@ -926,11 +922,11 @@ btr_node_ptr_get_child(
mtr_t* mtr) /*!< in: mtr */
{
ut_ad(rec_offs_validate(node_ptr, index, offsets));
- ut_ad(index->table->space->id
+ ut_ad(index->table->space_id
== page_get_space_id(page_align(node_ptr)));
return btr_block_get(
- page_id_t(index->table->space->id,
+ page_id_t(index->table->space_id,
btr_node_ptr_get_child_page_no(node_ptr, offsets)),
page_size_t(index->table->space->flags),
RW_SX_LATCH, index, mtr);
@@ -1434,7 +1430,7 @@ btr_read_autoinc(dict_index_t* index)
mtr.start();
ib_uint64_t autoinc;
if (buf_block_t* block = buf_page_get(
- page_id_t(index->table->space->id, index->page),
+ page_id_t(index->table->space_id, index->page),
page_size_t(index->table->space->flags),
RW_S_LATCH, &mtr)) {
autoinc = page_get_autoinc(block->frame);
@@ -1466,7 +1462,7 @@ btr_read_autoinc_with_fallback(const dict_table_t* table, unsigned col_no)
mtr_t mtr;
mtr.start();
buf_block_t* block = buf_page_get(
- page_id_t(index->table->space->id, index->page),
+ page_id_t(index->table->space_id, index->page),
page_size_t(index->table->space->flags),
RW_S_LATCH, &mtr);
@@ -2017,7 +2013,7 @@ btr_root_raise_and_insert(
#endif /* UNIV_ZIP_DEBUG */
#ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) {
- ulint space = index->table->space->id;
+ ulint space = index->table->space_id;
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
+ root, space));
@@ -3935,7 +3931,7 @@ retry:
btr_search_drop_page_hash_index(block);
/* Remove the page from the level list */
- btr_level_list_remove(index->table->space->id,
+ btr_level_list_remove(index->table->space_id,
page_size, page, index, mtr);
if (dict_index_is_spatial(index)) {
@@ -4065,7 +4061,7 @@ retry:
#endif /* UNIV_BTR_DEBUG */
/* Remove the page from the level list */
- btr_level_list_remove(index->table->space->id,
+ btr_level_list_remove(index->table->space_id,
page_size, page, index, mtr);
ut_ad(btr_node_ptr_get_child_page_no(
@@ -4305,7 +4301,7 @@ btr_discard_only_page_on_level(
#ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) {
const page_t* root = buf_block_get_frame(block);
- const ulint space = index->table->space->id;
+ const ulint space = index->table->space_id;
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
+ root, space));
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
@@ -4413,7 +4409,7 @@ btr_discard_page(
if (left_page_no != FIL_NULL) {
merge_block = btr_block_get(
- page_id_t(index->table->space->id, left_page_no),
+ page_id_t(index->table->space_id, left_page_no),
page_size, RW_X_LATCH, index, mtr);
merge_page = buf_block_get_frame(merge_block);
@@ -4429,7 +4425,7 @@ btr_discard_page(
== btr_cur_get_rec(&parent_cursor)));
} else if (right_page_no != FIL_NULL) {
merge_block = btr_block_get(
- page_id_t(index->table->space->id, right_page_no),
+ page_id_t(index->table->space_id, right_page_no),
page_size, RW_X_LATCH, index, mtr);
merge_page = buf_block_get_frame(merge_block);
@@ -4478,7 +4474,7 @@ btr_discard_page(
}
/* Remove the page from the level list */
- btr_level_list_remove(index->table->space->id, page_size,
+ btr_level_list_remove(index->table->space_id, page_size,
page, index, mtr);
#ifdef UNIV_ZIP_DEBUG
@@ -4647,7 +4643,7 @@ btr_print_index(
mtr_commit(&mtr);
- ut_ad(btr_validate_index(index, 0, false));
+ ut_ad(btr_validate_index(index, 0));
}
#endif /* UNIV_BTR_PRINT */
@@ -5068,7 +5064,7 @@ btr_validate_level(
ret = false;
}
- ut_a(index->table->space->id == block->page.id.space());
+ ut_a(index->table->space_id == block->page.id.space());
ut_a(block->page.id.space() == page_get_space_id(page));
#ifdef UNIV_ZIP_DEBUG
page_zip = buf_block_get_page_zip(block);
@@ -5105,7 +5101,7 @@ btr_validate_level(
savepoint2 = mtr_set_savepoint(&mtr);
block = btr_block_get(
- page_id_t(index->table->space->id,
+ page_id_t(index->table->space_id,
left_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
@@ -5134,7 +5130,7 @@ loop:
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
- ut_a(block->page.id.space() == index->table->space->id);
+ ut_a(block->page.id.space() == index->table->space_id);
if (fseg_page_is_free(space, block->page.id.page_no())) {
@@ -5177,7 +5173,7 @@ loop:
savepoint = mtr_set_savepoint(&mtr);
right_block = btr_block_get(
- page_id_t(index->table->space->id, right_page_no),
+ page_id_t(index->table->space_id, right_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
@@ -5354,13 +5350,13 @@ loop:
&mtr, savepoint, right_block);
btr_block_get(
- page_id_t(index->table->space->id,
+ page_id_t(index->table->space_id,
parent_right_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
right_block = btr_block_get(
- page_id_t(index->table->space->id,
+ page_id_t(index->table->space_id,
right_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
@@ -5438,14 +5434,14 @@ node_ptr_fails:
if (parent_right_page_no != FIL_NULL) {
btr_block_get(
page_id_t(
- index->table->space->id,
+ index->table->space_id,
parent_right_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
}
} else if (parent_page_no != FIL_NULL) {
btr_block_get(
- page_id_t(index->table->space->id,
+ page_id_t(index->table->space_id,
parent_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
@@ -5453,7 +5449,7 @@ node_ptr_fails:
}
block = btr_block_get(
- page_id_t(index->table->space->id, right_page_no),
+ page_id_t(index->table->space_id, right_page_no),
table_page_size,
RW_SX_LATCH, index, &mtr);
@@ -5468,57 +5464,16 @@ node_ptr_fails:
}
/**************************************************************//**
-Do an index level validation of spaital index tree.
-@return true if no error found */
-static
-bool
-btr_validate_spatial_index(
-/*=======================*/
- dict_index_t* index, /*!< in: index */
- const trx_t* trx) /*!< in: transaction or NULL */
-{
-
- mtr_t mtr;
- bool ok = true;
-
- mtr_start(&mtr);
-
- mtr_x_lock(dict_index_get_lock(index), &mtr);
-
- page_t* root = btr_root_get(index, &mtr);
- ulint n = btr_page_get_level(root);
-
-#ifdef UNIV_RTR_DEBUG
- fprintf(stderr, "R-tree level is %lu\n", n);
-#endif /* UNIV_RTR_DEBUG */
-
- for (ulint i = 0; i <= n; ++i) {
-#ifdef UNIV_RTR_DEBUG
- fprintf(stderr, "Level %lu:\n", n - i);
-#endif /* UNIV_RTR_DEBUG */
-
- if (!btr_validate_level(index, trx, n - i, true)) {
- ok = false;
- break;
- }
- }
-
- mtr_commit(&mtr);
-
- return(ok);
-}
-
-/**************************************************************//**
Checks the consistency of an index tree.
@return DB_SUCCESS if ok, error code if not */
dberr_t
btr_validate_index(
/*===============*/
dict_index_t* index, /*!< in: index */
- const trx_t* trx, /*!< in: transaction or NULL */
- bool lockout)/*!< in: true if X-latch index is intended */
+ const trx_t* trx) /*!< in: transaction or NULL */
{
dberr_t err = DB_SUCCESS;
+ bool lockout = dict_index_is_spatial(index);
/* Full Text index are implemented by auxiliary tables,
not the B-tree */
@@ -5526,13 +5481,6 @@ btr_validate_index(
return(err);
}
- if (dict_index_is_spatial(index)) {
- if(!btr_validate_spatial_index(index, trx)) {
- err = DB_ERROR;
- }
- return(err);
- }
-
mtr_t mtr;
mtr_start(&mtr);
@@ -5547,14 +5495,14 @@ btr_validate_index(
page_t* root = btr_root_get(index, &mtr);
- if (root == NULL && !index->is_readable()) {
- err = DB_DECRYPTION_FAILED;
+ if (!root) {
mtr_commit(&mtr);
- return err;
+ return DB_CORRUPTION;
}
ulint n = btr_page_get_level(root);
+ btr_validate_index_running++;
for (ulint i = 0; i <= n; ++i) {
if (!btr_validate_level(index, trx, n - i, lockout)) {
@@ -5564,6 +5512,14 @@ btr_validate_index(
}
mtr_commit(&mtr);
+ /* In theory we need release barrier here, so that
+ btr_validate_index_running decrement is guaranteed to
+ happen after latches are released.
+
+ Original code issued SEQ_CST on update and non-atomic
+ access on load. Which means it had broken synchronisation
+ as well. */
+ btr_validate_index_running--;
return(err);
}
@@ -5599,7 +5555,7 @@ btr_can_merge_with_page(
index = btr_cur_get_index(cursor);
page = btr_cur_get_page(cursor);
- const page_id_t page_id(index->table->space->id, page_no);
+ const page_id_t page_id(index->table->space_id, page_no);
const page_size_t page_size(index->table->space->flags);
mblock = btr_block_get(page_id, page_size, RW_X_LATCH, index, mtr);
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index 73b4335d265..09f31259e8e 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -120,7 +120,7 @@ PageBulk::init()
}
} else {
new_block = btr_block_get(
- page_id_t(m_index->table->space->id, m_page_no),
+ page_id_t(m_index->table->space_id, m_page_no),
page_size_t(m_index->table->space->flags),
RW_X_LATCH, m_index, &m_mtr);
@@ -663,7 +663,7 @@ PageBulk::latch()
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
__FILE__, __LINE__, &m_mtr)) {
m_block = buf_page_get_gen(
- page_id_t(m_index->table->space->id, m_page_no),
+ page_id_t(m_index->table->space_id, m_page_no),
page_size_t(m_index->table->space->flags),
RW_X_LATCH, m_block, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &m_mtr, &m_err);
@@ -833,6 +833,7 @@ BtrBulk::insert(
level, m_flush_observer));
err = new_page_bulk->init();
if (err != DB_SUCCESS) {
+ UT_DELETE(new_page_bulk);
return(err);
}
@@ -1015,7 +1016,7 @@ BtrBulk::finish(dberr_t err)
ut_ad(last_page_no != FIL_NULL);
last_block = btr_block_get(
- page_id_t(m_index->table->space->id, last_page_no),
+ page_id_t(m_index->table->space_id, last_page_no),
page_size_t(m_index->table->space->flags),
RW_X_LATCH, m_index, &mtr);
first_rec = page_rec_get_next(
@@ -1044,6 +1045,6 @@ BtrBulk::finish(dberr_t err)
ut_ad(!sync_check_iterate(dict_sync_check()));
- ut_ad(err != DB_SUCCESS || btr_validate_index(m_index, NULL, false));
+ ut_ad(err != DB_SUCCESS || btr_validate_index(m_index, NULL));
return(err);
}
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 0654829e3f4..f4cbb4e51a3 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3,7 +3,7 @@
Copyright (c) 1994, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -486,7 +486,7 @@ incompatible:
always written with zero length. The DB_TRX_ID will
start right after any fixed-length columns. */
for (uint i = index->n_uniq; i--; ) {
- trx_id_offset += index->fields[0].fixed_len;
+ trx_id_offset += index->fields[i].fixed_len;
}
}
@@ -591,7 +591,7 @@ inconsistent:
} else {
col->def_val.data = btr_copy_externally_stored_field(
&col->def_val.len, data,
- dict_table_page_size(index->table),
+ cur.page_cur.block->page.size,
len, index->table->heap);
}
}
@@ -754,7 +754,7 @@ btr_cur_optimistic_latch_leaves(
if (left_page_no != FIL_NULL) {
cursor->left_block = btr_block_get(
- page_id_t(cursor->index->table->space->id,
+ page_id_t(cursor->index->table->space_id,
left_page_no),
page_size_t(cursor->index->table->space
->flags),
@@ -1054,6 +1054,37 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
field_max_size = dict_col_get_max_size(col);
if (UNIV_UNLIKELY(!field_max_size)) {
+ switch (col->mtype) {
+ case DATA_VARCHAR:
+ if (!comp
+ && (!strcmp(index->table->name.m_name,
+ "SYS_FOREIGN")
+ || !strcmp(index->table->name.m_name,
+ "SYS_FOREIGN_COLS"))) {
+ break;
+ }
+ /* fall through */
+ case DATA_VARMYSQL:
+ case DATA_CHAR:
+ case DATA_MYSQL:
+ /* CHAR(0) and VARCHAR(0) are possible
+ data type definitions in MariaDB.
+ The InnoDB internal SQL parser maps
+ CHAR to DATA_VARCHAR, so DATA_CHAR (or
+ DATA_MYSQL) is only coming from the
+ MariaDB SQL layer. */
+ if (comp) {
+ /* Add a length byte, because
+ fixed-length empty field are
+ encoded as variable-length.
+ For ROW_FORMAT=REDUNDANT,
+ these bytes were added to
+ rec_max_size before this loop. */
+ rec_max_size++;
+ }
+ continue;
+ }
+
/* SYS_FOREIGN.ID is defined as CHAR in the
InnoDB internal SQL parser, which translates
into the incorrect VARCHAR(0). InnoDB does
@@ -1070,6 +1101,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
|| !strcmp(index->table->name.m_name,
"SYS_FOREIGN_COLS"));
ut_ad(!comp);
+ ut_ad(col->mtype == DATA_VARCHAR);
rec_max_size += (srv_page_size == UNIV_PAGE_SIZE_MAX)
? REDUNDANT_REC_MAX_DATA_SIZE
@@ -1373,7 +1405,7 @@ btr_cur_search_to_nth_level_func(
Free blocks and read IO bandwidth should be prior
for them, when the history list is glowing huge. */
if (lock_intention == BTR_INTENTION_DELETE
- && trx_sys.history_size() > BTR_CUR_FINE_HISTORY_LENGTH
+ && trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
&& buf_get_n_pending_read_ios()) {
mtr_x_lock(dict_index_get_lock(index), mtr);
} else if (dict_index_is_spatial(index)
@@ -1433,7 +1465,7 @@ btr_cur_search_to_nth_level_func(
const page_size_t page_size(index->table->space->flags);
/* Start with the root page. */
- page_id_t page_id(index->table->space->id, index->page);
+ page_id_t page_id(index->table->space_id, index->page);
if (root_leaf_rw_latch == RW_X_LATCH) {
node_ptr_max_size = btr_node_ptr_max_size(index);
@@ -2509,7 +2541,7 @@ btr_cur_open_at_index_side_func(
Free blocks and read IO bandwidth should be prior
for them, when the history list is glowing huge. */
if (lock_intention == BTR_INTENTION_DELETE
- && trx_sys.history_size() > BTR_CUR_FINE_HISTORY_LENGTH
+ && trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
&& buf_get_n_pending_read_ios()) {
mtr_x_lock(dict_index_get_lock(index), mtr);
} else {
@@ -2541,7 +2573,7 @@ btr_cur_open_at_index_side_func(
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
- page_id_t page_id(index->table->space->id, index->page);
+ page_id_t page_id(index->table->space_id, index->page);
const page_size_t page_size(index->table->space->flags);
if (root_leaf_rw_latch == RW_X_LATCH) {
@@ -2854,7 +2886,7 @@ btr_cur_open_at_rnd_pos_func(
Free blocks and read IO bandwidth should be prior
for them, when the history list is glowing huge. */
if (lock_intention == BTR_INTENTION_DELETE
- && trx_sys.history_size() > BTR_CUR_FINE_HISTORY_LENGTH
+ && trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
&& buf_get_n_pending_read_ios()) {
mtr_x_lock(dict_index_get_lock(index), mtr);
} else {
@@ -2898,7 +2930,7 @@ btr_cur_open_at_rnd_pos_func(
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
- page_id_t page_id(index->table->space->id, index->page);
+ page_id_t page_id(index->table->space_id, index->page);
const page_size_t page_size(index->table->space->flags);
dberr_t err = DB_SUCCESS;
@@ -3229,8 +3261,11 @@ btr_cur_ins_lock_and_undo(
roll_ptr = roll_ptr_t(1) << ROLL_PTR_INSERT_FLAG_POS;
if (!(flags & BTR_KEEP_SYS_FLAG)) {
upd_sys:
- row_upd_index_entry_sys_field(entry, index,
- DATA_ROLL_PTR, roll_ptr);
+ dfield_t* r = dtuple_get_nth_field(
+ entry, index->db_roll_ptr());
+ ut_ad(r->len == DATA_ROLL_PTR_LEN);
+ trx_write_roll_ptr(static_cast<byte*>(r->data),
+ roll_ptr);
}
} else {
err = trx_undo_report_row_operation(thr, index, entry,
@@ -3659,9 +3694,14 @@ btr_cur_pessimistic_insert(
}
if (page_zip_rec_needs_ext(rec_get_converted_size(index, entry, n_ext),
- dict_table_is_comp(index->table),
+ index->table->not_redundant(),
dtuple_get_n_fields(entry),
- dict_table_page_size(index->table))) {
+ btr_cur_get_block(cursor)->page.size)
+ || UNIV_UNLIKELY(entry->is_alter_metadata()
+ && !dfield_is_ext(
+ dtuple_get_nth_field(
+ entry,
+ index->first_user_field())))) {
/* The record is so big that we have to store some fields
externally on separate database pages */
@@ -3736,8 +3776,8 @@ btr_cur_pessimistic_insert(
if (entry->info_bits & REC_INFO_MIN_REC_FLAG) {
ut_ad(entry->is_metadata());
ut_ad(index->is_instant());
- ut_ad((flags & ulint(~BTR_KEEP_IBUF_BITMAP))
- == BTR_NO_LOCKING_FLAG);
+ ut_ad(flags & BTR_NO_LOCKING_FLAG);
+ ut_ad(!(flags & BTR_CREATE_FLAG));
} else {
btr_search_update_hash_on_insert(
cursor, btr_get_search_latch(index));
@@ -3819,6 +3859,50 @@ btr_cur_upd_lock_and_undo(
cmpl_info, rec, offsets, roll_ptr));
}
+/** Copy DB_TRX_ID,DB_ROLL_PTR to the redo log.
+@param[in] index clustered index
+@param[in] trx_id_t DB_TRX_ID
+@param[in] roll_ptr DB_ROLL_PTR
+@param[in,out] log_ptr redo log buffer
+@return current end of the redo log buffer */
+static byte*
+btr_cur_log_sys(
+ const dict_index_t* index,
+ trx_id_t trx_id,
+ roll_ptr_t roll_ptr,
+ byte* log_ptr)
+{
+ log_ptr += mach_write_compressed(log_ptr, index->db_trx_id());
+ /* Yes, we are writing DB_ROLL_PTR,DB_TRX_ID in reverse order,
+ after emitting the position of DB_TRX_ID in the index.
+ This is how row_upd_write_sys_vals_to_log()
+ originally worked, and it is part of the redo log format. */
+ trx_write_roll_ptr(log_ptr, roll_ptr);
+ log_ptr += DATA_ROLL_PTR_LEN;
+ log_ptr += mach_u64_write_compressed(log_ptr, trx_id);
+
+ return log_ptr;
+}
+
+/** Write DB_TRX_ID,DB_ROLL_PTR to a clustered index entry.
+@param[in,out] entry clustered index entry
+@param[in] index clustered index
+@param[in] trx_id DB_TRX_ID
+@param[in] roll_ptr DB_ROLL_PTR */
+static void btr_cur_write_sys(
+ dtuple_t* entry,
+ const dict_index_t* index,
+ trx_id_t trx_id,
+ roll_ptr_t roll_ptr)
+{
+ dfield_t* t = dtuple_get_nth_field(entry, index->db_trx_id());
+ ut_ad(t->len == DATA_TRX_ID_LEN);
+ trx_write_trx_id(static_cast<byte*>(t->data), trx_id);
+ dfield_t* r = dtuple_get_nth_field(entry, index->db_roll_ptr());
+ ut_ad(r->len == DATA_ROLL_PTR_LEN);
+ trx_write_roll_ptr(static_cast<byte*>(r->data), roll_ptr);
+}
+
/***********************************************************//**
Writes a redo log record of updating a record in-place. */
void
@@ -3858,8 +3942,7 @@ btr_cur_update_in_place_log(
log_ptr++;
if (dict_index_is_clust(index)) {
- log_ptr = row_upd_write_sys_vals_to_log(
- index, trx_id, roll_ptr, log_ptr, mtr);
+ log_ptr = btr_cur_log_sys(index, trx_id, roll_ptr, log_ptr);
} else {
/* Dummy system fields for a secondary index */
/* TRX_ID Position */
@@ -4212,6 +4295,72 @@ func_exit:
return(err);
}
+/** Trim a metadata record during the rollback of instant ALTER TABLE.
+@param[in] entry metadata tuple
+@param[in] index primary key
+@param[in] update update vector for the rollback */
+ATTRIBUTE_COLD
+static void btr_cur_trim_alter_metadata(dtuple_t* entry,
+ const dict_index_t* index,
+ const upd_t* update)
+{
+ ut_ad(index->is_instant());
+ ut_ad(update->is_alter_metadata());
+ ut_ad(entry->is_alter_metadata());
+
+ ut_ad(update->fields[0].field_no == index->first_user_field());
+ ut_ad(update->fields[0].new_val.ext);
+ ut_ad(update->fields[0].new_val.len == FIELD_REF_SIZE);
+ ut_ad(entry->n_fields - 1 == index->n_fields);
+
+ const byte* ptr = static_cast<const byte*>(
+ update->fields[0].new_val.data);
+ ut_ad(!mach_read_from_4(ptr + BTR_EXTERN_LEN));
+ ut_ad(mach_read_from_4(ptr + BTR_EXTERN_LEN + 4) > 4);
+ ut_ad(mach_read_from_4(ptr + BTR_EXTERN_OFFSET) == FIL_PAGE_DATA);
+ ut_ad(mach_read_from_4(ptr + BTR_EXTERN_SPACE_ID)
+ == index->table->space->id);
+
+ ulint n_fields = update->fields[1].field_no;
+ ut_ad(n_fields <= index->n_fields);
+ if (n_fields != index->n_uniq) {
+ ut_ad(n_fields
+ >= index->n_core_fields);
+ entry->n_fields = n_fields;
+ return;
+ }
+
+ /* This is based on dict_table_t::deserialise_columns()
+ and btr_cur_instant_init_low(). */
+ mtr_t mtr;
+ mtr.start();
+ buf_block_t* block = buf_page_get(
+ page_id_t(index->table->space->id,
+ mach_read_from_4(ptr + BTR_EXTERN_PAGE_NO)),
+ univ_page_size, RW_S_LATCH, &mtr);
+ buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE);
+ ut_ad(fil_page_get_type(block->frame) == FIL_PAGE_TYPE_BLOB);
+ ut_ad(mach_read_from_4(&block->frame[FIL_PAGE_DATA
+ + BTR_BLOB_HDR_NEXT_PAGE_NO])
+ == FIL_NULL);
+ ut_ad(mach_read_from_4(&block->frame[FIL_PAGE_DATA
+ + BTR_BLOB_HDR_PART_LEN])
+ == mach_read_from_4(ptr + BTR_EXTERN_LEN + 4));
+ n_fields = mach_read_from_4(
+ &block->frame[FIL_PAGE_DATA + BTR_BLOB_HDR_SIZE])
+ + index->first_user_field();
+ /* Rollback should not increase the number of fields. */
+ ut_ad(n_fields <= index->n_fields);
+ ut_ad(n_fields + 1 <= entry->n_fields);
+ /* dict_index_t::clear_instant_alter() cannot be invoked while
+ rollback of an instant ALTER TABLE transaction is in progress
+ for an is_alter_metadata() record. */
+ ut_ad(n_fields >= index->n_core_fields);
+
+ mtr.commit();
+ entry->n_fields = n_fields + 1;
+}
+
/** Trim an update tuple due to instant ADD COLUMN, if needed.
For normal records, the trailing instantly added fields that match
the initial default values are omitted.
@@ -4238,6 +4387,7 @@ btr_cur_trim(
(instant ALTER TABLE on a table where instant ALTER was
already executed) or rolling back such an operation. */
ut_ad(!upd_get_nth_field(update, 0)->orig_len);
+ ut_ad(entry->is_metadata());
if (thr->graph->trx->in_rollback) {
/* This rollback can occur either as part of
@@ -4255,17 +4405,11 @@ btr_cur_trim(
innobase_add_instant_try(). */
ut_ad(update->n_fields > 2);
if (update->is_alter_metadata()) {
- ut_ad(update->fields[0].field_no
- == index->first_user_field());
- ut_ad(update->fields[0].new_val.ext);
- ut_ad(update->fields[0].new_val.len
- == FIELD_REF_SIZE);
- ut_ad(entry->n_fields - 1 == index->n_fields);
- ulint n_fields = update->fields[1].field_no;
- ut_ad(n_fields <= index->n_fields);
- entry->n_fields = n_fields;
+ btr_cur_trim_alter_metadata(
+ entry, index, update);
return;
}
+ ut_ad(!entry->is_alter_metadata());
ulint n_fields = upd_get_nth_field(update, 0)
->field_no;
@@ -4426,7 +4570,7 @@ any_extern:
if (page_zip_rec_needs_ext(new_rec_size, page_is_comp(page),
dict_index_get_n_fields(index),
- dict_table_page_size(index->table))) {
+ block->page.size)) {
goto any_extern;
}
@@ -4532,10 +4676,7 @@ any_extern:
page_cur_move_to_prev(page_cursor);
if (!(flags & BTR_KEEP_SYS_FLAG)) {
- row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
- roll_ptr);
- row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,
- trx_id);
+ btr_cur_write_sys(new_entry, index, trx_id, roll_ptr);
}
/* There are no externally stored columns in new_entry */
@@ -4850,10 +4991,7 @@ btr_cur_pessimistic_update(
}
if (!(flags & BTR_KEEP_SYS_FLAG)) {
- row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
- roll_ptr);
- row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,
- trx_id);
+ btr_cur_write_sys(new_entry, index, trx_id, roll_ptr);
}
if (!page_zip) {
@@ -5125,8 +5263,7 @@ btr_cur_del_mark_set_clust_rec_log(
*log_ptr++ = 0;
*log_ptr++ = 1;
- log_ptr = row_upd_write_sys_vals_to_log(
- index, trx_id, roll_ptr, log_ptr, mtr);
+ log_ptr = btr_cur_log_sys(index, trx_id, roll_ptr, log_ptr);
mach_write_to_2(log_ptr, page_offset(rec));
log_ptr += 2;
@@ -5797,7 +5934,8 @@ btr_cur_pessimistic_delete(
only user record, also delete the metadata record
if one exists for instant ADD COLUMN
(not generic ALTER TABLE).
- If we are deleting the metadata record and the
+ If we are deleting the metadata record
+ (in the rollback of instant ALTER TABLE) and the
table becomes empty, clean up the whole page. */
const rec_t* first_rec = page_rec_get_next_const(
@@ -7311,7 +7449,7 @@ struct btr_blob_log_check_t {
if (m_op == BTR_STORE_INSERT_BULK) {
mtr_x_lock(dict_index_get_lock(index), m_mtr);
m_pcur->btr_cur.page_cur.block = btr_block_get(
- page_id_t(index->table->space->id, page_no),
+ page_id_t(index->table->space_id, page_no),
page_size_t(index->table->space->flags),
RW_X_LATCH, index, m_mtr);
m_pcur->btr_cur.page_cur.rec
@@ -7400,8 +7538,8 @@ btr_store_big_rec_extern_fields(
ut_ad(buf_block_get_frame(rec_block) == page_align(rec));
ut_a(dict_index_is_clust(index));
- ut_a(dict_table_page_size(index->table)
- .equals_to(rec_block->page.size));
+ ut_ad(dict_table_page_size(index->table)
+ .equals_to(rec_block->page.size));
btr_blob_log_check_t redo_log(pcur, btr_mtr, offsets, &rec_block,
&rec, op);
@@ -7446,15 +7584,13 @@ btr_store_big_rec_extern_fields(
}
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
- const page_size_t page_size(dict_table_page_size(index->table));
-
/* Space available in compressed page to carry blob data */
- const ulint payload_size_zip = page_size.physical()
+ const ulint payload_size_zip = rec_block->page.size.physical()
- FIL_PAGE_DATA;
/* Space available in uncompressed page to carry blob data */
- const ulint payload_size = page_size.physical()
- - FIL_PAGE_DATA - BTR_BLOB_HDR_SIZE - FIL_PAGE_DATA_END;
+ const ulint payload_size = payload_size_zip
+ - (BTR_BLOB_HDR_SIZE + FIL_PAGE_DATA_END);
/* We have to create a file segment to the tablespace
for each field and put the pointer to the field in rec */
@@ -7919,6 +8055,7 @@ btr_free_externally_stored_field(
& ~((BTR_EXTERN_OWNER_FLAG
| BTR_EXTERN_INHERITED_FLAG) << 24)));
ut_ad(space_id == index->table->space->id);
+ ut_ad(space_id == index->table->space_id);
const page_size_t ext_page_size(dict_table_page_size(index->table));
const page_size_t& rec_page_size(rec == NULL
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 6f36198f129..86daa90dc0b 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -63,14 +63,14 @@ UNIV_INTERN mysql_pfs_key_t btr_defragment_mutex_key;
/* Number of compression failures caused by defragmentation since server
start. */
-ulint btr_defragment_compression_failures = 0;
+Atomic_counter<ulint> btr_defragment_compression_failures;
/* Number of btr_defragment_n_pages calls that altered page but didn't
manage to release any page. */
-ulint btr_defragment_failures = 0;
+Atomic_counter<ulint> btr_defragment_failures;
/* Total number of btr_defragment_n_pages calls that altered page.
The difference between btr_defragment_count and btr_defragment_failures shows
the amount of effort wasted. */
-ulint btr_defragment_count = 0;
+Atomic_counter<ulint> btr_defragment_count;
/******************************************************************//**
Constructor for btr_defragment_item_t. */
@@ -166,7 +166,7 @@ btr_defragment_add_index(
mtr_start(&mtr);
// Load index rood page.
buf_block_t* block = btr_block_get(
- page_id_t(index->table->space->id, index->page),
+ page_id_t(index->table->space_id, index->page),
page_size_t(index->table->space->flags),
RW_NO_LATCH, index, &mtr);
page_t* page = NULL;
@@ -314,7 +314,7 @@ btr_defragment_save_defrag_stats_if_needed(
dict_index_t* index) /*!< in: index */
{
if (srv_defragment_stats_accuracy != 0 // stats tracking disabled
- && index->table->space->id != 0 // do not track system tables
+ && index->table->space_id != 0 // do not track system tables
&& index->stat_defrag_modified_counter
>= srv_defragment_stats_accuracy) {
dict_stats_defrag_pool_add(index);
@@ -448,8 +448,7 @@ btr_defragment_merge_pages(
// n_recs_to_move number of records to to_page. We try to reduce
// the targeted data size on the to_page by
// BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE and try again.
- my_atomic_addlint(
- &btr_defragment_compression_failures, 1);
+ btr_defragment_compression_failures++;
max_ins_size_to_use =
move_size > BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE
? move_size - BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE
@@ -489,7 +488,7 @@ btr_defragment_merge_pages(
from_block);
btr_search_drop_page_hash_index(from_block);
btr_level_list_remove(
- index->table->space->id,
+ index->table->space_id,
page_size, from_page, index, mtr);
btr_node_ptr_delete(index, from_block, mtr);
/* btr_blob_dbg_remove(from_page, index,
@@ -564,7 +563,7 @@ btr_defragment_n_pages(
return NULL;
}
- if (!index->table->space || !index->table->space->id) {
+ if (!index->table->space || !index->table->space_id) {
/* Ignore space 0. */
return NULL;
}
@@ -589,7 +588,7 @@ btr_defragment_n_pages(
break;
}
- blocks[i] = btr_block_get(page_id_t(index->table->space->id,
+ blocks[i] = btr_block_get(page_id_t(index->table->space_id,
page_no), page_size,
RW_X_LATCH, index, mtr);
}
@@ -668,11 +667,9 @@ btr_defragment_n_pages(
}
mem_heap_free(heap);
n_defragmented ++;
- my_atomic_addlint(
- &btr_defragment_count, 1);
+ btr_defragment_count++;
if (n_pages == n_defragmented) {
- my_atomic_addlint(
- &btr_defragment_failures, 1);
+ btr_defragment_failures++;
} else {
index->stat_defrag_n_pages_freed += (n_pages - n_defragmented);
}
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index ac28cd1e665..20cb199fbe5 100644
--- a/storage/innobase/btr/btr0pcur.cc
+++ b/storage/innobase/btr/btr0pcur.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2017, MariaDB Corporation.
+Copyright (c) 2016, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -141,6 +141,7 @@ btr_pcur_store_position(
if (page_rec_is_supremum_low(offs)) {
cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE;
} else {
+before_first:
cursor->rel_pos = BTR_PCUR_BEFORE_FIRST_IN_TREE;
}
@@ -165,8 +166,14 @@ btr_pcur_store_position(
rec = page_rec_get_next(rec);
if (rec_is_metadata(rec, *index)) {
+ ut_ad(!page_has_prev(page));
+ ut_d(const rec_t* p = rec);
rec = page_rec_get_next(rec);
- ut_ad(!page_rec_is_supremum(rec));
+ if (page_rec_is_supremum(rec)) {
+ ut_ad(page_has_next(page)
+ || rec_is_alter_metadata(p, *index));
+ goto before_first;
+ }
}
cursor->rel_pos = BTR_PCUR_BEFORE;
@@ -174,10 +181,25 @@ btr_pcur_store_position(
cursor->rel_pos = BTR_PCUR_ON;
}
- cursor->old_rec = dict_index_copy_rec_order_prefix(
- index, rec, &cursor->old_n_fields,
- &cursor->old_rec_buf, &cursor->buf_size);
+ if (index->is_ibuf()) {
+ ut_ad(!index->table->not_redundant());
+ cursor->old_n_fields = rec_get_n_fields_old(rec);
+ } else if (page_rec_is_leaf(rec)) {
+ cursor->old_n_fields = dict_index_get_n_unique_in_tree(index);
+ } else if (index->is_spatial()) {
+ ut_ad(dict_index_get_n_unique_in_tree_nonleaf(index)
+ == DICT_INDEX_SPATIAL_NODEPTR_SIZE);
+ /* For R-tree, we have to compare
+ the child page numbers as well. */
+ cursor->old_n_fields = DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1;
+ } else {
+ cursor->old_n_fields = dict_index_get_n_unique_in_tree(index);
+ }
+ cursor->old_rec = rec_copy_prefix_to_buf(rec, index,
+ cursor->old_n_fields,
+ &cursor->old_rec_buf,
+ &cursor->buf_size);
cursor->block_when_stored = block;
/* Function try to check if block is S/X latch. */
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index 22e997b60aa..7d8966d4109 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -450,14 +450,14 @@ btr_pessimistic_scrub(
mtr->release_block_at_savepoint(scrub_data->savepoint, block);
buf_block_t* get_block __attribute__((unused)) = btr_block_get(
- page_id_t(index->table->space->id, left_page_no),
+ page_id_t(index->table->space_id, left_page_no),
page_size, RW_X_LATCH, index, mtr);
/**
* Refetch block and re-initialize page
*/
block = btr_block_get(
- page_id_t(index->table->space->id, page_no),
+ page_id_t(index->table->space_id, page_no),
page_size, RW_X_LATCH, index, mtr);
page = buf_block_get_frame(block);
@@ -471,7 +471,7 @@ btr_pessimistic_scrub(
if (right_page_no != FIL_NULL) {
buf_block_t* get_block __attribute__((unused))= btr_block_get(
- page_id_t(index->table->space->id, right_page_no),
+ page_id_t(index->table->space_id, right_page_no),
page_size, RW_X_LATCH, index, mtr);
}
@@ -787,7 +787,7 @@ btr_scrub_page(
/* check that table/index still match now that they are loaded */
if (!scrub_data->current_table->space
- || scrub_data->current_table->space->id != scrub_data->space) {
+ || scrub_data->current_table->space_id != scrub_data->space) {
/* this is truncate table */
mtr_commit(mtr);
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 8bb838187bb..37a839727ec 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -660,7 +660,7 @@ btr_search_update_hash_ref(
return;
}
- ut_ad(block->page.id.space() == index->table->space->id);
+ ut_ad(block->page.id.space() == index->table->space_id);
ut_ad(index == cursor->index);
ut_ad(!dict_index_is_ibuf(index));
@@ -1356,7 +1356,7 @@ btr_search_build_page_hash_index(
rec_offs_init(offsets_);
ut_ad(ahi_latch == btr_get_search_latch(index));
ut_ad(index);
- ut_ad(block->page.id.space() == index->table->space->id);
+ ut_ad(block->page.id.space() == index->table->space_id);
ut_a(!dict_index_is_ibuf(index));
ut_ad(page_is_leaf(block->frame));
@@ -1673,7 +1673,7 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor)
return;
}
- ut_ad(block->page.id.space() == index->table->space->id);
+ ut_ad(block->page.id.space() == index->table->space_id);
ut_a(index == cursor->index);
ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0);
ut_a(!dict_index_is_ibuf(index));
@@ -1830,7 +1830,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch)
return;
}
- ut_ad(block->page.id.space() == index->table->space->id);
+ ut_ad(block->page.id.space() == index->table->space_id);
btr_search_check_free_space_in_heap(index);
table = btr_get_search_table(index);
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 770235ae85b..dd2e45791f6 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -31,23 +31,18 @@ The database buffer buf_pool
Created 11/5/1995 Heikki Tuuri
*******************************************************/
-#include "univ.i"
#include "mtr0types.h"
#include "mach0data.h"
#include "page0size.h"
#include "buf0buf.h"
+#include "buf0checksum.h"
#include <string.h>
-#ifdef UNIV_NONINL
-#include "buf0buf.ic"
-#endif
-
#ifndef UNIV_INNOCHECKSUM
#include "mem0mem.h"
#include "btr0btr.h"
#include "fil0fil.h"
#include "fil0crypt.h"
-#include "fsp0sysspace.h"
#include "buf0buddy.h"
#include "lock0lock.h"
#include "sync0rw.h"
@@ -62,22 +57,14 @@ Created 11/5/1995 Heikki Tuuri
#include "dict0dict.h"
#include "log0recv.h"
#include "srv0mon.h"
-#include "fsp0sysspace.h"
+#include "fil0pagecompress.h"
+#include "fsp0pagecompress.h"
#endif /* !UNIV_INNOCHECKSUM */
#include "page0zip.h"
#include "sync0sync.h"
#include "buf0dump.h"
-#include "ut0new.h"
-#include <new>
#include <map>
#include <sstream>
-#ifndef UNIV_INNOCHECKSUM
-#include "fil0pagecompress.h"
-#include "fsp0pagecompress.h"
-#endif
-#include "ha_prototypes.h"
-#include "ut0byte.h"
-#include <new>
#ifdef UNIV_LINUX
#include <stdlib.h>
@@ -530,10 +517,14 @@ decompress_with_slot:
+ dst_frame)) {
/* Verify encryption checksum before we even try to
decrypt. */
- if (!fil_space_verify_crypt_checksum(
- dst_frame, bpage->size, bpage->id.space(),
- bpage->id.page_no())) {
+ if (!fil_space_verify_crypt_checksum(dst_frame, bpage->size)) {
decrypt_failed:
+ ib::error() << "Encrypted page " << bpage->id
+ << " in file " << space->chain.start->name
+ << " looks corrupted; key_version="
+ << mach_read_from_4(
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ + dst_frame);
/* Mark page encrypted in case it should be. */
if (space->crypt_data->type
!= CRYPT_SCHEME_UNENCRYPTED) {
@@ -738,38 +729,18 @@ buf_block_alloc(
}
#endif /* !UNIV_INNOCHECKSUM */
-/** Checks if a page contains only zeroes.
-@param[in] read_buf database page
-@param[in] page_size page size
-@return true if page is filled with zeroes */
-bool
-buf_page_is_zeroes(
- const byte* read_buf,
- const page_size_t& page_size)
-{
- for (ulint i = 0; i < page_size.logical(); i++) {
- if (read_buf[i] != 0) {
- return(false);
- }
- }
- return(true);
-}
-
/** Checks if the page is in crc32 checksum format.
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] use_legacy_big_endian use legacy big endian algorithm
@return true if the page is in crc32 checksum format. */
bool
buf_page_is_checksum_valid_crc32(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2,
- bool use_legacy_big_endian)
+ ulint checksum_field2)
{
- const uint32_t crc32 = buf_calc_page_crc32(read_buf,
- use_legacy_big_endian);
+ const uint32_t crc32 = buf_calc_page_crc32(read_buf);
#ifdef UNIV_INNOCHECKSUM
if (log_file
@@ -783,25 +754,10 @@ buf_page_is_checksum_valid_crc32(
#endif /* UNIV_INNOCHECKSUM */
if (checksum_field1 != checksum_field2) {
- goto invalid;
+ return false;
}
- if (checksum_field1 == crc32) {
- return(true);
- } else {
- const uint32_t crc32_legacy = buf_calc_page_crc32(read_buf, true);
-
- if (checksum_field1 == crc32_legacy) {
- return(true);
- }
- }
-
-invalid:
- DBUG_LOG("checksum", "Page checksum crc32 not valid"
- << " field1 " << checksum_field1
- << " field2 " << checksum_field2
- << " crc32 " << crc32);
- return(false);
+ return checksum_field1 == crc32;
}
/** Checks if the page is in innodb checksum format.
@@ -947,18 +903,21 @@ buf_page_is_corrupted(
const void* space)
#endif
{
- size_t checksum_field1 = 0;
- size_t checksum_field2 = 0;
#ifndef UNIV_INNOCHECKSUM
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); );
#endif
+ size_t checksum_field1 = 0;
+ size_t checksum_field2 = 0;
+ uint32_t crc32 = 0;
+ bool crc32_inited = false;
+
ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE);
/* We can trust page type if page compression is set on tablespace
flags because page compression flag means file must have been
created with 10.1 (later than 5.5 code base). In 10.1 page
compressed tables do not contain post compression checksum and
- FIL_PAGE_END_LSN_OLD_CHKSUM field stored. Note that space can
+ FIL_PAGE_END_LSN_OLD_CHKSUM field stored. Note that space can
be null if we are in fil_check_first_page() and first page
is not compressed or encrypted. Page checksum is verified
after decompression (i.e. normally pages are already
@@ -979,13 +938,7 @@ buf_page_is_corrupted(
/* Stored log sequence numbers at the start and the end
of page do not match */
-#ifndef UNIV_INNOCHECKSUM
- ib::info() << "Log sequence number at the start "
- << mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
- << " and the end "
- << mach_read_from_4(read_buf + srv_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)
- << " do not match";
-#endif /* UNIV_INNOCHECKSUM */
+
return(true);
}
@@ -1046,73 +999,39 @@ buf_page_is_corrupted(
&& *reinterpret_cast<const ib_uint64_t*>(
read_buf + FIL_PAGE_LSN) == 0) {
- ulint i;
-
/* make sure that the page is really empty */
- for (i = 0; i < page_size.logical(); ++i) {
-
- /* The FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID has been
- repurposed for page compression. It can be
- set for uncompressed empty pages. */
-
- if ((i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
- || i >= FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)
- && read_buf[i] != 0) {
-
-#ifndef UNIV_INNOCHECKSUM
- ib::info() << "Checksum fields zero but page is not empty.";
-#endif
-
- break;
+ for (ulint i = 0; i < page_size.logical(); i++) {
+ if (read_buf[i] != 0) {
+ return(true);
}
}
#ifdef UNIV_INNOCHECKSUM
- if (i >= page_size.logical()) {
- if (log_file) {
- fprintf(log_file, "Page::%llu"
- " is empty and uncorrupted\n",
- cur_page_num);
- }
- return(false);
+ if (log_file) {
+ fprintf(log_file, "Page::%llu"
+ " is empty and uncorrupted\n",
+ cur_page_num);
}
-#else
- return(i < page_size.logical());
#endif /* UNIV_INNOCHECKSUM */
+ return(false);
}
-#ifndef UNIV_INNOCHECKSUM
- const page_id_t page_id(mach_read_from_4(
- read_buf + FIL_PAGE_SPACE_ID),
- mach_read_from_4(
- read_buf + FIL_PAGE_OFFSET));
-#endif /* UNIV_INNOCHECKSUM */
-
const srv_checksum_algorithm_t curr_algo =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
- bool legacy_checksum_checked = false;
-
switch (curr_algo) {
- case SRV_CHECKSUM_ALGORITHM_CRC32:
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
-
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, false)) {
- return(false);
- }
-
+ return !buf_page_is_checksum_valid_crc32(
+ read_buf, checksum_field1, checksum_field2);
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ return !buf_page_is_checksum_valid_innodb(
+ read_buf, checksum_field1, checksum_field2);
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ return !buf_page_is_checksum_valid_none(
+ read_buf, checksum_field1, checksum_field2);
+ case SRV_CHECKSUM_ALGORITHM_CRC32:
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
if (buf_page_is_checksum_valid_none(read_buf,
checksum_field1, checksum_field2)) {
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_NONE,
- page_id);
-#endif /* !UNIV_INNOCHECKSUM */
- }
-
#ifdef UNIV_INNOCHECKSUM
if (log_file) {
fprintf(log_file, "page::%llu;"
@@ -1130,173 +1049,93 @@ buf_page_is_corrupted(
checksum_field1);
}
#endif /* UNIV_INNOCHECKSUM */
-
- return(false);
+ return false;
}
- /* We need to check whether the stored checksum matches legacy
- big endian checksum or Innodb checksum. We optimize the order
- based on earlier results. if earlier we have found pages
- matching legacy big endian checksum, we try to match it first.
- Otherwise we check innodb checksum first. */
- if (legacy_big_endian_checksum) {
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, true)) {
+ /* Very old versions of InnoDB only stored 8 byte lsn to the
+ start and the end of the page. */
- return(false);
- }
- legacy_checksum_checked = true;
- }
+ /* Since innodb_checksum_algorithm is not strict_* allow
+ any of the algos to match for the old field */
- if (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2)) {
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_INNODB,
- page_id);
-#endif
- }
+ if (checksum_field2
+ != mach_read_from_4(read_buf + FIL_PAGE_LSN)
+ && checksum_field2 != BUF_NO_CHECKSUM_MAGIC) {
- return(false);
- }
-
- /* If legacy checksum is not checked, do it now. */
- if (!legacy_checksum_checked && buf_page_is_checksum_valid_crc32(
- read_buf, checksum_field1, checksum_field2, true)) {
-
- legacy_big_endian_checksum = true;
- return(false);
- }
-
-#ifdef UNIV_INNOCHECKSUM
- if (log_file) {
- fprintf(log_file, "Fail; page::%llu;"
- " invalid (fails crc32 checksum)\n",
- cur_page_num);
- }
-#endif /* UNIV_INNOCHECKSUM */
- return(true);
+ if (srv_checksum_algorithm
+ == SRV_CHECKSUM_ALGORITHM_CRC32) {
+ crc32 = buf_calc_page_crc32(read_buf);
+ crc32_inited = true;
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ if (checksum_field2 != crc32
+ && checksum_field2
+ != buf_calc_page_old_checksum(read_buf)) {
+ return true;
+ }
+ } else {
+ ut_ad(srv_checksum_algorithm
+ == SRV_CHECKSUM_ALGORITHM_INNODB);
- if (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2)) {
- return(false);
- }
+ if (checksum_field2
+ != buf_calc_page_old_checksum(read_buf)) {
+ crc32 = buf_calc_page_crc32(read_buf);
+ crc32_inited = true;
- if (buf_page_is_checksum_valid_none(read_buf,
- checksum_field1, checksum_field2)) {
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_NONE,
- page_id);
-#endif
- }
-#ifdef UNIV_INNOCHECKSUM
- if (log_file) {
- fprintf(log_file, "page::%llu;"
- " old style: calculated = %u;"
- " recorded = %zu;\n", cur_page_num,
- buf_calc_page_old_checksum(read_buf),
- checksum_field2);
- fprintf(log_file, "page::%llu;"
- " new style: calculated = %u;"
- " crc32 = %u; recorded = %zu;\n",
- cur_page_num,
- buf_calc_page_new_checksum(read_buf),
- buf_calc_page_crc32(read_buf),
- checksum_field1);
+ if (checksum_field2 != crc32) {
+ return true;
+ }
+ }
}
-#endif /* UNIV_INNOCHECKSUM */
-
- return(false);
}
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, false)
- || buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, true)) {
+ if (checksum_field1 == 0
+ || checksum_field1 == BUF_NO_CHECKSUM_MAGIC) {
+ } else if (srv_checksum_algorithm
+ == SRV_CHECKSUM_ALGORITHM_CRC32) {
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_CRC32,
- page_id);
-#endif
+ if (!crc32_inited) {
+ crc32 = buf_calc_page_crc32(read_buf);
+ crc32_inited = true;
}
- return(false);
- }
-
-#ifdef UNIV_INNOCHECKSUM
- if (log_file) {
- fprintf(log_file, "Fail; page::%llu;"
- " invalid (fails innodb checksum)\n",
- cur_page_num);
- }
-#endif /* UNIV_INNOCHECKSUM */
-
- return(true);
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ if (checksum_field1 != crc32
+ && checksum_field1
+ != buf_calc_page_new_checksum(read_buf)) {
+ return true;
+ }
+ } else {
+ ut_ad(srv_checksum_algorithm
+ == SRV_CHECKSUM_ALGORITHM_INNODB);
- if (buf_page_is_checksum_valid_none(read_buf,
- checksum_field1, checksum_field2)) {
- return(false);
- }
+ if (checksum_field1
+ != buf_calc_page_new_checksum(read_buf)) {
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, false)
- || buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, true)) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_CRC32,
- page_id);
-#endif /* !UNIV_INNOCHECKSUM */
- return(false);
- }
+ if (!crc32_inited) {
+ crc32 = buf_calc_page_crc32(read_buf);
+ crc32_inited = true;
+ }
- if (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2)) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_INNODB,
- page_id);
-#endif /* !UNIV_INNOCHECKSUM */
- return(false);
+ if (checksum_field1 != crc32) {
+ return true;
+ }
+ }
}
-#ifdef UNIV_INNOCHECKSUM
- if (log_file) {
- fprintf(log_file, "Fail; page::%llu;"
- " invalid (fails none checksum)\n",
- cur_page_num);
+ if (crc32_inited
+ && ((checksum_field1 == crc32
+ && checksum_field2 != crc32)
+ || (checksum_field1 != crc32
+ && checksum_field2 == crc32))) {
+ return true;
}
-#endif /* UNIV_INNOCHECKSUM */
-
- return(true);
+ break;
case SRV_CHECKSUM_ALGORITHM_NONE:
/* should have returned false earlier */
break;
- /* no default so the compiler will emit a warning if new enum
- is added and not handled here */
}
- ut_error;
- return(false);
+ return false;
}
#ifndef UNIV_INNOCHECKSUM
@@ -1379,10 +1218,6 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
<< page_zip_calc_checksum(
read_buf, page_size.physical(),
SRV_CHECKSUM_ALGORITHM_CRC32)
- << "/"
- << page_zip_calc_checksum(
- read_buf, page_size.physical(),
- SRV_CHECKSUM_ALGORITHM_CRC32, true)
<< ", "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_INNODB)
@@ -1408,9 +1243,6 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
} else {
const uint32_t crc32 = buf_calc_page_crc32(read_buf);
-
- const uint32_t crc32_legacy = buf_calc_page_crc32(read_buf,
- true);
ulint page_type = fil_page_get_type(read_buf);
ib::info() << "Uncompressed page, stored checksum in field1 "
@@ -1419,7 +1251,7 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
<< ", calculated checksums for field1: "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_CRC32) << " "
- << crc32 << "/" << crc32_legacy
+ << crc32
<< ", "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_INNODB) << " "
@@ -1436,7 +1268,7 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
<< ", calculated checksums for field2: "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_CRC32) << " "
- << crc32 << "/" << crc32_legacy
+ << crc32
<< ", "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_INNODB) << " "
@@ -1564,7 +1396,7 @@ pfs_register_buffer_block(
: NULL;
# ifdef UNIV_DEBUG
- rwlock = &block->debug_latch;
+ rwlock = block->debug_latch;
ut_a(!rwlock->pfs_psi);
rwlock->pfs_psi = (PSI_server)
? PSI_server->init_rwlock(buf_block_debug_latch_key,
@@ -1626,6 +1458,7 @@ buf_block_init(
page_zip_des_init(&block->page.zip);
mutex_create(LATCH_ID_BUF_BLOCK_MUTEX, &block->mutex);
+ ut_d(block->debug_latch = (rw_lock_t *) ut_malloc_nokey(sizeof(rw_lock_t)));
#if defined PFS_SKIP_BUFFER_MUTEX_RWLOCK || defined PFS_GROUP_BUFFER_SYNC
/* If PFS_SKIP_BUFFER_MUTEX_RWLOCK is defined, skip registration
@@ -1637,7 +1470,7 @@ buf_block_init(
rw_lock_create(PFS_NOT_INSTRUMENTED, &block->lock, SYNC_LEVEL_VARYING);
- ut_d(rw_lock_create(PFS_NOT_INSTRUMENTED, &block->debug_latch,
+ ut_d(rw_lock_create(PFS_NOT_INSTRUMENTED, block->debug_latch,
SYNC_LEVEL_VARYING));
#else /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
@@ -1645,7 +1478,7 @@ buf_block_init(
rw_lock_create(buf_block_lock_key, &block->lock, SYNC_LEVEL_VARYING);
ut_d(rw_lock_create(buf_block_debug_latch_key,
- &block->debug_latch, SYNC_LEVEL_VARYING));
+ block->debug_latch, SYNC_LEVEL_VARYING));
#endif /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
@@ -1904,6 +1737,16 @@ buf_pool_set_sizes(void)
buf_pool_mutex_exit_all();
}
+/** Free the synchronization objects of a buffer pool block descriptor
+@param[in,out] block buffer pool block descriptor */
+static void buf_block_free_mutexes(buf_block_t* block)
+{
+ mutex_free(&block->mutex);
+ rw_lock_free(&block->lock);
+ ut_d(rw_lock_free(block->debug_latch));
+ ut_d(ut_free(block->debug_latch));
+}
+
/********************************************************************//**
Initialize a buffer pool instance.
@return DB_SUCCESS if all goes well. */
@@ -1967,11 +1810,7 @@ buf_pool_init_instance(
buf_block_t* block = chunk->blocks;
for (i = chunk->size; i--; block++) {
- mutex_free(&block->mutex);
- rw_lock_free(&block->lock);
-
- ut_d(rw_lock_free(
- &block->debug_latch));
+ buf_block_free_mutexes(block);
}
buf_pool->allocator.deallocate_large(
@@ -2117,10 +1956,7 @@ buf_pool_free_instance(
buf_block_t* block = chunk->blocks;
for (ulint i = chunk->size; i--; block++) {
- mutex_free(&block->mutex);
- rw_lock_free(&block->lock);
-
- ut_d(rw_lock_free(&block->debug_latch));
+ buf_block_free_mutexes(block);
}
buf_pool->allocator.deallocate_large(
@@ -2994,11 +2830,7 @@ withdraw_retry:
for (ulint j = chunk->size;
j--; block++) {
- mutex_free(&block->mutex);
- rw_lock_free(&block->lock);
-
- ut_d(rw_lock_free(
- &block->debug_latch));
+ buf_block_free_mutexes(block);
}
buf_pool->allocator.deallocate_large(
@@ -3572,7 +3404,7 @@ page_found:
}
/* Add to an existing watch. */
- buf_block_fix(bpage);
+ bpage->fix();
return(NULL);
}
@@ -3712,7 +3544,7 @@ void buf_pool_watch_unset(const page_id_t page_id)
increments buf_fix_count. */
bpage = buf_page_hash_get_low(buf_pool, page_id);
- if (buf_block_unfix(bpage) == 0
+ if (bpage->unfix() == 0
&& buf_pool_watch_is_sentinel(buf_pool, bpage)) {
buf_pool_watch_remove(buf_pool, bpage);
}
@@ -3945,7 +3777,7 @@ err_exit:
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
- buf_block_fix(bpage);
+ bpage->fix();
block_mutex = &buf_pool->zip_mutex;
mutex_enter(block_mutex);
goto got_block;
@@ -4073,10 +3905,6 @@ buf_zip_decompress(
<< ", crc32: "
<< page_zip_calc_checksum(
frame, size, SRV_CHECKSUM_ALGORITHM_CRC32)
- << "/"
- << page_zip_calc_checksum(
- frame, size, SRV_CHECKSUM_ALGORITHM_CRC32,
- true)
<< " innodb: "
<< page_zip_calc_checksum(
frame, size, SRV_CHECKSUM_ALGORITHM_INNODB)
@@ -4468,10 +4296,10 @@ loop:
= buf_page_get_mutex(
&fix_block->page);
mutex_enter(fix_mutex);
- buf_block_fix(fix_block);
+ fix_block->fix();
mutex_exit(fix_mutex);
} else {
- buf_block_fix(fix_block);
+ fix_block->fix();
}
/* Now safe to release page_hash mutex */
@@ -4559,7 +4387,7 @@ loop:
<< ". The most probable cause"
" of this error may be that the"
" table has been corrupted."
- " See https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/";
+ " See https://mariadb.com/kb/en/library/innodb-recovery-modes/";
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -4578,10 +4406,10 @@ loop:
BPageMutex* fix_mutex = buf_page_get_mutex(
&fix_block->page);
mutex_enter(fix_mutex);
- buf_block_fix(fix_block);
+ fix_block->fix();
mutex_exit(fix_mutex);
} else {
- buf_block_fix(fix_block);
+ fix_block->fix();
}
/* Now safe to release page_hash mutex */
@@ -4604,7 +4432,7 @@ got_block:
/* The page is being read to buffer pool,
but we cannot wait around for the read to
complete. */
- buf_block_unfix(fix_block);
+ fix_block->unfix();
return(NULL);
}
@@ -4620,7 +4448,7 @@ got_block:
/* This suggests that the page is being flushed.
Avoid returning reference to this page.
Instead wait for the flush action to complete. */
- buf_block_unfix(fix_block);
+ fix_block->unfix();
os_thread_sleep(WAIT_FOR_WRITE);
goto loop;
}
@@ -4629,7 +4457,7 @@ got_block:
evict_from_pool:
ut_ad(!fix_block->page.oldest_modification);
buf_pool_mutex_enter(buf_pool);
- buf_block_unfix(fix_block);
+ fix_block->unfix();
if (!buf_LRU_free_page(&fix_block->page, true)) {
ut_ad(0);
@@ -4647,7 +4475,7 @@ evict_from_pool:
adaptive hash index. There cannot be an
adaptive hash index for a compressed-only
page, so do not bother decompressing the page. */
- buf_block_unfix(fix_block);
+ fix_block->unfix();
return(NULL);
}
@@ -4661,7 +4489,7 @@ evict_from_pool:
/* This condition often occurs when the buffer
is not buffer-fixed, but I/O-fixed by
buf_page_init_for_read(). */
- buf_block_unfix(fix_block);
+ fix_block->unfix();
/* The block is buffer-fixed or I/O-fixed.
Try again later. */
@@ -4690,7 +4518,7 @@ evict_from_pool:
/* Buffer-fixing prevents the page_hash from changing. */
ut_ad(bpage == buf_page_hash_get_low(buf_pool, page_id));
- buf_block_unfix(fix_block);
+ fix_block->unfix();
buf_page_mutex_enter(block);
mutex_enter(&buf_pool->zip_mutex);
@@ -4782,7 +4610,7 @@ evict_from_pool:
buf_page_mutex_exit(fix_block);
--buf_pool->n_pend_unzip;
- buf_block_unfix(fix_block);
+ fix_block->unfix();
buf_pool_mutex_exit(buf_pool);
rw_lock_x_unlock(&fix_block->lock);
@@ -4845,7 +4673,7 @@ evict_from_pool:
buf_pool_mutex_enter(buf_pool);
- buf_block_unfix(fix_block);
+ fix_block->unfix();
/* Now we are only holding the buf_pool->mutex,
not block->mutex or hash_lock. Blocks cannot be
@@ -4904,7 +4732,7 @@ evict_from_pool:
buf_page_mutex_exit(fix_block);
- buf_block_fix(fix_block);
+ fix_block->fix();
/* Failed to evict the page; change it directly */
@@ -4922,7 +4750,7 @@ evict_from_pool:
if (!fsp_is_system_temporary(page_id.space())) {
ibool ret;
ret = rw_lock_s_lock_nowait(
- &fix_block->debug_latch, file, line);
+ fix_block->debug_latch, file, line);
ut_a(ret);
}
#endif /* UNIV_DEBUG */
@@ -5405,7 +5233,7 @@ buf_page_init(
ut_a(buf_fix_count > 0);
- my_atomic_add32((int32*) &block->page.buf_fix_count, buf_fix_count);
+ block->page.buf_fix_count += buf_fix_count;
buf_pool_watch_remove(buf_pool, hash_page);
} else {
@@ -5646,7 +5474,7 @@ buf_page_init_for_read(
ut_a(buf_fix_count > 0);
- my_atomic_add32((int32*) &bpage->buf_fix_count, buf_fix_count);
+ bpage->buf_fix_count += buf_fix_count;
ut_ad(buf_pool_watch_is_sentinel(buf_pool, watch_page));
buf_pool_watch_remove(buf_pool, watch_page);
@@ -5989,18 +5817,14 @@ or decrypt/decompress just failed.
@retval DB_DECRYPTION_FAILED if page post encryption checksum matches but
after decryption normal page checksum does not match.
@retval DB_TABLESPACE_DELETED if accessed tablespace is not found */
-static
-dberr_t
-buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space)
+static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space)
{
ut_ad(space->pending_io());
byte* dst_frame = (bpage->zip.data) ? bpage->zip.data :
((buf_block_t*) bpage)->frame;
- bool still_encrypted = false;
dberr_t err = DB_SUCCESS;
bool corrupted = false;
- fil_space_crypt_t* crypt_data = space->crypt_data;
/* In buf_decrypt_after_read we have either decrypted the page if
page post encryption checksum matches and used key_id is found
@@ -6008,12 +5832,12 @@ buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space)
not decrypted and it could be either encrypted and corrupted
or corrupted or good page. If we decrypted, there page could
still be corrupted if used key does not match. */
- still_encrypted = crypt_data
- && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
+ const bool still_encrypted = mach_read_from_4(
+ dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
+ && space->crypt_data
+ && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
&& !bpage->encrypted
- && fil_space_verify_crypt_checksum(
- dst_frame, bpage->size,
- bpage->id.space(), bpage->id.page_no());
+ && fil_space_verify_crypt_checksum(dst_frame, bpage->size);
if (!still_encrypted) {
/* If traditional checksums match, we assume that page is
@@ -6115,10 +5939,10 @@ buf_page_io_complete(buf_page_t* bpage, bool dblwr, bool evict)
}
if (bpage->zip.data && uncompressed) {
- my_atomic_addlint(&buf_pool->n_pend_unzip, 1);
+ buf_pool->n_pend_unzip++;
ibool ok = buf_zip_decompress((buf_block_t*) bpage,
FALSE);
- my_atomic_addlint(&buf_pool->n_pend_unzip, ulint(-1));
+ buf_pool->n_pend_unzip--;
if (!ok) {
ib::info() << "Page "
diff --git a/storage/innobase/buf/buf0checksum.cc b/storage/innobase/buf/buf0checksum.cc
index 732a58ed85a..daff452de08 100644
--- a/storage/innobase/buf/buf0checksum.cc
+++ b/storage/innobase/buf/buf0checksum.cc
@@ -24,61 +24,40 @@ Buffer pool checksum functions, also linked from /extra/innochecksum.cc
Created Aug 11, 2011 Vasil Dimov
*******************************************************/
-#include "univ.i"
+#include "buf0checksum.h"
#include "fil0fil.h"
#include "ut0crc32.h"
#include "ut0rnd.h"
-#include "buf0checksum.h"
#ifndef UNIV_INNOCHECKSUM
#include "srv0srv.h"
#endif /* !UNIV_INNOCHECKSUM */
-#include "buf0types.h"
-
/** the macro MYSQL_SYSVAR_ENUM() requires "long unsigned int" and if we
use srv_checksum_algorithm_t here then we get a compiler error:
ha_innodb.cc:12251: error: cannot convert 'srv_checksum_algorithm_t*' to
'long unsigned int*' in initialization */
ulong srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_INNODB;
-/** set if we have found pages matching legacy big endian checksum */
-bool legacy_big_endian_checksum = false;
-/** Calculates the CRC32 checksum of a page. The value is stored to the page
+/** Calculate the CRC32 checksum of a page. The value is stored to the page
when it is written to a file and also checked for a match when reading from
-the file. When reading we allow both normal CRC32 and CRC-legacy-big-endian
-variants. Note that we must be careful to calculate the same value on 32-bit
-and 64-bit architectures.
+the file. Note that we must be careful to calculate the same value on all
+architectures.
@param[in] page buffer page (srv_page_size bytes)
-@param[in] use_legacy_big_endian if true then use big endian
-byteorder when converting byte strings to integers
-@return checksum */
-uint32_t
-buf_calc_page_crc32(
- const byte* page,
- bool use_legacy_big_endian /* = false */)
+@return CRC-32C */
+uint32_t buf_calc_page_crc32(const byte* page)
{
- /* Since the field FIL_PAGE_FILE_FLUSH_LSN, and in versions <= 4.1.x
- FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, are written outside the buffer pool
- to the first pages of data files, we have to skip them in the page
- checksum calculation.
- We must also skip the field FIL_PAGE_SPACE_OR_CHKSUM where the
- checksum is stored, and also the last 8 bytes of page because
- there we store the old formula checksum. */
-
- ut_crc32_func_t crc32_func = use_legacy_big_endian
- ? ut_crc32_legacy_big_endian
- : ut_crc32;
-
- const uint32_t c1 = crc32_func(
- page + FIL_PAGE_OFFSET,
- FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION - FIL_PAGE_OFFSET);
-
- const uint32_t c2 = crc32_func(
- page + FIL_PAGE_DATA,
- srv_page_size - FIL_PAGE_DATA - FIL_PAGE_END_LSN_OLD_CHKSUM);
-
- return(c1 ^ c2);
+ /* Note: innodb_checksum_algorithm=crc32 could and should have
+ included the entire page in the checksum, and CRC-32 values
+ should be combined with the CRC-32 function, not with
+ exclusive OR. We stick to the current algorithm in order to
+ remain compatible with old data files. */
+ return ut_crc32(page + FIL_PAGE_OFFSET,
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ - FIL_PAGE_OFFSET)
+ ^ ut_crc32(page + FIL_PAGE_DATA,
+ srv_page_size
+ - (FIL_PAGE_DATA + FIL_PAGE_END_LSN_OLD_CHKSUM));
}
/** Calculate a checksum which is stored to the page when it is written
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 8cf9be44ae9..0eaa746deb8 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -24,7 +24,6 @@ Doublwrite buffer module
Created 2011/12/19
*******************************************************/
-#include "ha_prototypes.h"
#include "buf0dblwr.h"
#include "buf0buf.h"
#include "buf0checksum.h"
@@ -336,6 +335,20 @@ too_small:
goto start_again;
}
+/** Check if a page is all zeroes.
+@param[in] read_buf database page
+@param[in] page_size page frame size
+@return whether the page is all zeroes */
+static bool buf_page_is_zeroes(const byte* read_buf, size_t page_size)
+{
+ for (ulint i = 0; i < page_size; i++) {
+ if (read_buf[i] != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
/**
At database startup initializes the doublewrite buffer memory structure if
we already have a doublewrite buffer created in the data files. If we are
@@ -568,7 +581,7 @@ buf_dblwr_process()
}
const page_size_t page_size(space->flags);
- ut_ad(!buf_page_is_zeroes(page, page_size));
+ ut_ad(!buf_page_is_zeroes(page, page_size.physical()));
/* We want to ensure that for partial reads the
unread portion of the page is NUL. */
@@ -592,7 +605,9 @@ buf_dblwr_process()
}
const bool is_all_zero = buf_page_is_zeroes(
- read_buf, page_size);
+ read_buf, page_size.physical());
+ const bool expect_encrypted = space->crypt_data
+ && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED;
if (is_all_zero) {
/* We will check if the copy in the
@@ -608,10 +623,13 @@ buf_dblwr_process()
goto bad;
}
- if (fil_space_verify_crypt_checksum(
- read_buf, page_size, space_id, page_no)
- || !buf_page_is_corrupted(
- true, read_buf, page_size, space)) {
+ if (expect_encrypted && mach_read_from_4(
+ read_buf
+ + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
+ ? fil_space_verify_crypt_checksum(read_buf,
+ page_size)
+ : !buf_page_is_corrupted(true, read_buf,
+ page_size, space)) {
/* The page is good; there is no need
to consult the doublewrite buffer. */
continue;
@@ -630,9 +648,11 @@ bad:
&& page_size.is_compressed())) {
goto bad_doublewrite;
}
- if (!fil_space_verify_crypt_checksum(page, page_size,
- space_id, page_no)
- && buf_page_is_corrupted(true, page, page_size, space)) {
+
+ if (expect_encrypted && mach_read_from_4(
+ page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
+ ? !fil_space_verify_crypt_checksum(page, page_size)
+ : buf_page_is_corrupted(true, page, page_size, space)) {
if (!is_all_zero) {
bad_doublewrite:
ib::warn() << "A doublewrite copy of page "
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 088741e8ce8..2747a6fa338 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -30,8 +30,6 @@ Created April 08, 2011 Vasil Dimov
#include "mysql/psi/mysql_stage.h"
#include "mysql/psi/psi.h"
-#include "univ.i"
-
#include "buf0buf.h"
#include "buf0dump.h"
#include "dict0dict.h"
@@ -824,7 +822,7 @@ DECLARE_THREAD(buf_dump_thread)(void*)
if (srv_buffer_pool_load_at_startup) {
#ifdef WITH_WSREP
- if (!wsrep_recovery) {
+ if (!get_wsrep_recovery()) {
#endif /* WITH_WSREP */
buf_load();
#ifdef WITH_WSREP
@@ -858,7 +856,7 @@ DECLARE_THREAD(buf_dump_thread)(void*)
"Dumping of buffer pool not started"
" as load was incomplete");
#ifdef WITH_WSREP
- } else if (wsrep_recovery) {
+ } else if (get_wsrep_recovery()) {
#endif /* WITH_WSREP */
} else {
buf_dump(FALSE/* do complete dump at shutdown */);
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index a130c998e75..ac8dd98dbe1 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -25,9 +25,8 @@ The database buffer buf_pool flush algorithm
Created 11/11/1995 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
+#include "univ.i"
#include <mysql/service_thd_wait.h>
-#include <my_dbug.h>
#include <sql_class.h>
#include "buf0flu.h"
@@ -46,7 +45,6 @@ Created 11/11/1995 Heikki Tuuri
#include "os0file.h"
#include "trx0sys.h"
#include "srv0mon.h"
-#include "fsp0sysspace.h"
#include "ut0stage.h"
#include "fil0pagecompress.h"
#ifdef UNIV_LINUX
@@ -429,137 +427,44 @@ buf_flush_insert_into_flush_list(
ut_ad(buf_page_mutex_own(block));
buf_flush_list_mutex_enter(buf_pool);
-
- ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
- || (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification
- <= lsn));
-
- /* If we are in the recovery then we need to update the flush
- red-black tree as well. */
- if (buf_pool->flush_rbt != NULL) {
- buf_flush_list_mutex_exit(buf_pool);
- buf_flush_insert_sorted_into_flush_list(buf_pool, block, lsn);
- return;
- }
-
- ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_ad(!block->page.in_flush_list);
-
ut_d(block->page.in_flush_list = TRUE);
+ ut_ad(!block->page.oldest_modification);
block->page.oldest_modification = lsn;
-
- UT_LIST_ADD_FIRST(buf_pool->flush_list, &block->page);
-
+ UNIV_MEM_ASSERT_RW(block->page.zip.data
+ ? block->page.zip.data : block->frame,
+ block->page.size.physical());
incr_flush_list_size_in_bytes(block, buf_pool);
-#ifdef UNIV_DEBUG_VALGRIND
- void* p;
-
- if (block->page.size.is_compressed()) {
- p = block->page.zip.data;
- } else {
- p = block->frame;
- }
-
- UNIV_MEM_ASSERT_RW(p, block->page.size.physical());
-#endif /* UNIV_DEBUG_VALGRIND */
-
-#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- ut_a(buf_flush_validate_skip(buf_pool));
-#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-
- buf_flush_list_mutex_exit(buf_pool);
-}
-
-/********************************************************************//**
-Inserts a modified block into the flush list in the right sorted position.
-This function is used by recovery, because there the modifications do not
-necessarily come in the order of lsn's. */
-void
-buf_flush_insert_sorted_into_flush_list(
-/*====================================*/
- buf_pool_t* buf_pool, /*!< in: buffer pool instance */
- buf_block_t* block, /*!< in/out: block which is modified */
- lsn_t lsn) /*!< in: oldest modification */
-{
- buf_page_t* prev_b;
- buf_page_t* b;
-
- ut_ad(srv_shutdown_state != SRV_SHUTDOWN_FLUSH_PHASE);
- ut_ad(!buf_pool_mutex_own(buf_pool));
- ut_ad(log_flush_order_mutex_own());
- ut_ad(buf_page_mutex_own(block));
- ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
-
- buf_flush_list_mutex_enter(buf_pool);
-
- /* The field in_LRU_list is protected by buf_pool->mutex, which
- we are not holding. However, while a block is in the flush
- list, it is dirty and cannot be discarded, not from the
- page_hash or from the LRU list. At most, the uncompressed
- page frame of a compressed block may be discarded or created
- (copying the block->page to or from a buf_page_t that is
- dynamically allocated from buf_buddy_alloc()). Because those
- transitions hold block->mutex and the flush list mutex (via
- buf_flush_relocate_on_flush_list()), there is no possibility
- of a race condition in the assertions below. */
- ut_ad(block->page.in_LRU_list);
- ut_ad(block->page.in_page_hash);
- /* buf_buddy_block_register() will take a block in the
- BUF_BLOCK_MEMORY state, not a file page. */
- ut_ad(!block->page.in_zip_hash);
-
- ut_ad(!block->page.in_flush_list);
- ut_d(block->page.in_flush_list = TRUE);
- block->page.oldest_modification = lsn;
-
-#ifdef UNIV_DEBUG_VALGRIND
- void* p;
-
- if (block->page.size.is_compressed()) {
- p = block->page.zip.data;
- } else {
- p = block->frame;
- }
-
- UNIV_MEM_ASSERT_RW(p, block->page.size.physical());
-#endif /* UNIV_DEBUG_VALGRIND */
-
- prev_b = NULL;
-
- /* For the most part when this function is called the flush_rbt
- should not be NULL. In a very rare boundary case it is possible
- that the flush_rbt has already been freed by the recovery thread
- before the last page was hooked up in the flush_list by the
- io-handler thread. In that case we'll just do a simple
- linear search in the else block. */
- if (buf_pool->flush_rbt != NULL) {
-
- prev_b = buf_flush_insert_in_flush_rbt(&block->page);
-
- } else {
-
- b = UT_LIST_GET_FIRST(buf_pool->flush_list);
-
- while (b != NULL && b->oldest_modification
- > block->page.oldest_modification) {
-
- ut_ad(b->in_flush_list);
- prev_b = b;
- b = UT_LIST_GET_NEXT(list, b);
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
+ ut_ad(srv_shutdown_state != SRV_SHUTDOWN_FLUSH_PHASE);
+ /* The field in_LRU_list is protected by buf_pool->mutex, which
+ we are not holding. However, while a block is in the flush
+ list, it is dirty and cannot be discarded, not from the
+ page_hash or from the LRU list. At most, the uncompressed
+ page frame of a compressed block may be discarded or created
+ (copying the block->page to or from a buf_page_t that is
+ dynamically allocated from buf_buddy_alloc()). Because those
+ transitions hold block->mutex and the flush list mutex (via
+ buf_flush_relocate_on_flush_list()), there is no possibility
+ of a race condition in the assertions below. */
+ ut_ad(block->page.in_LRU_list);
+ ut_ad(block->page.in_page_hash);
+ /* buf_buddy_block_register() will take a block in the
+ BUF_BLOCK_MEMORY state, not a file page. */
+ ut_ad(!block->page.in_zip_hash);
+
+ if (buf_page_t* prev_b =
+ buf_flush_insert_in_flush_rbt(&block->page)) {
+ UT_LIST_INSERT_AFTER(buf_pool->flush_list, prev_b, &block->page);
+ goto func_exit;
}
}
- if (prev_b == NULL) {
- UT_LIST_ADD_FIRST(buf_pool->flush_list, &block->page);
- } else {
- UT_LIST_INSERT_AFTER(buf_pool->flush_list, prev_b, &block->page);
- }
-
- incr_flush_list_size_in_bytes(block, buf_pool);
-
+ UT_LIST_ADD_FIRST(buf_pool->flush_list, &block->page);
+func_exit:
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- ut_a(buf_flush_validate_low(buf_pool));
+ ut_a(buf_flush_validate_skip(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
buf_flush_list_mutex_exit(buf_pool);
@@ -688,7 +593,7 @@ buf_flush_remove(
}
/* If the flush_rbt is active then delete from there as well. */
- if (buf_pool->flush_rbt != NULL) {
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
buf_flush_delete_from_flush_rbt(bpage);
}
@@ -756,7 +661,7 @@ buf_flush_relocate_on_flush_list(
/* If recovery is active we must swap the control blocks in
the flush_rbt as well. */
- if (buf_pool->flush_rbt != NULL) {
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
buf_flush_delete_from_flush_rbt(bpage);
prev_b = buf_flush_insert_in_flush_rbt(dpage);
}
@@ -3602,7 +3507,7 @@ buf_flush_validate_low(
/* If we are in recovery mode i.e.: flush_rbt != NULL
then each block in the flush_list must also be present
in the flush_rbt. */
- if (buf_pool->flush_rbt != NULL) {
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
rnode = rbt_first(buf_pool->flush_rbt);
}
@@ -3623,7 +3528,7 @@ buf_flush_validate_low(
|| buf_page_get_state(bpage) == BUF_BLOCK_REMOVE_HASH);
ut_a(om > 0);
- if (buf_pool->flush_rbt != NULL) {
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
buf_page_t** prpage;
ut_a(rnode != NULL);
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index a5ad0b91c85..9baa299910a 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -44,7 +44,6 @@ Created 11/5/1995 Heikki Tuuri
#include "log0recv.h"
#include "srv0srv.h"
#include "srv0mon.h"
-#include "lock0lock.h"
/** The number of blocks from the LRU_old pointer onward, including
the block pointed to, must be buf_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
@@ -2460,7 +2459,7 @@ buf_LRU_print_instance(
if (bpage->buf_fix_count) {
fprintf(stderr, "buffix count %u ",
- bpage->buf_fix_count);
+ uint32_t(bpage->buf_fix_count));
}
if (buf_page_get_io_fix(bpage)) {
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index d3e15f68589..9454b57f59e 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -24,7 +24,7 @@ The database buffer read
Created 11/5/1995 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
+#include "univ.i"
#include <mysql/service_thd_wait.h>
#include "buf0rea.h"
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index edc05a34130..9474b9bd18b 100644
--- a/storage/innobase/data/data0data.cc
+++ b/storage/innobase/data/data0data.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -24,8 +24,6 @@ SQL data field and tuple
Created 5/30/1994 Heikki Tuuri
*************************************************************************/
-#include "ha_prototypes.h"
-
#include "data0data.h"
#include "rem0rec.h"
#include "rem0cmp.h"
@@ -645,6 +643,7 @@ dtuple_convert_big_rec(
longest_i = index->first_user_field();
dfield = dtuple_get_nth_field(entry, longest_i);
local_len = BTR_EXTERN_FIELD_REF_SIZE;
+ ut_ad(!dfield_is_ext(dfield));
goto ext_write;
}
@@ -659,7 +658,7 @@ dtuple_convert_big_rec(
while (page_zip_rec_needs_ext(rec_get_converted_size(index, entry,
*n_ext),
- dict_table_is_comp(index->table),
+ index->table->not_redundant(),
dict_index_get_n_fields(index),
dict_table_page_size(index->table))) {
longest_i = 0;
diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc
index 7c0539b3537..84962d097aa 100644
--- a/storage/innobase/data/data0type.cc
+++ b/storage/innobase/data/data0type.cc
@@ -24,8 +24,6 @@ Data types
Created 1/16/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "data0type.h"
/** The DB_TRX_ID,DB_ROLL_PTR values for "no history is available" */
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index 5b176796644..7a9b8556c1a 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -24,8 +24,6 @@ Data dictionary creation and booting
Created 4/18/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "dict0boot.h"
#include "dict0crea.h"
#include "btr0btr.h"
@@ -66,52 +64,14 @@ dict_hdr_get_new_id(
(not assigned if NULL) */
index_id_t* index_id, /*!< out: index id
(not assigned if NULL) */
- ulint* space_id, /*!< out: space id
+ ulint* space_id) /*!< out: space id
(not assigned if NULL) */
- const dict_table_t* table, /*!< in: table */
- bool disable_redo) /*!< in: if true and table
- object is NULL
- then disable-redo */
{
dict_hdr_t* dict_hdr;
ib_id_t id;
mtr_t mtr;
mtr_start(&mtr);
- if (table) {
- if (table->is_temporary()) {
- mtr.set_log_mode(MTR_LOG_NO_REDO);
- }
- } else if (disable_redo) {
- /* In non-read-only mode we need to ensure that space-id header
- page is written to disk else if page is removed from buffer
- cache and re-loaded it would assign temporary tablespace id
- to another tablespace.
- This is not a case with read-only mode as there is no new object
- that is created except temporary tablespace. */
- mtr.set_log_mode(srv_read_only_mode
- ? MTR_LOG_NONE : MTR_LOG_NO_REDO);
- }
-
- /* Server started and let's say space-id = x
- - table created with file-per-table
- - space-id = x + 1
- - crash
- Case 1: If it was redo logged then we know that it will be
- restored to x + 1
- Case 2: if not redo-logged
- Header will have the old space-id = x
- This is OK because on restart there is no object with
- space id = x + 1
- Case 3:
- space-id = x (on start)
- space-id = x+1 (temp-table allocation) - no redo logging
- space-id = x+2 (non-temp-table allocation), this get's
- redo logged.
- If there is a crash there will be only 2 entries
- x (original) and x+2 (new) and disk hdr will be updated
- to reflect x + 2 entry.
- We cannot allocate the same space id to different objects. */
dict_hdr = dict_hdr_get(&mtr);
if (table_id) {
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index f288bb462b1..b1ddb7032ab 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -24,8 +24,6 @@ Database object creation
Created 1/8/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "dict0crea.h"
#include "btr0pcur.h"
#include "btr0btr.h"
@@ -43,8 +41,6 @@ Created 1/8/1996 Heikki Tuuri
#include "ut0vec.h"
#include "dict0priv.h"
#include "fts0priv.h"
-#include "fsp0space.h"
-#include "fsp0sysspace.h"
#include "srv0start.h"
/*****************************************************************//**
@@ -356,10 +352,12 @@ dict_build_table_def_step(
{
ut_ad(mutex_own(&dict_sys->mutex));
dict_table_t* table = node->table;
+ trx_t* trx = thr_get_trx(thr);
ut_ad(!table->is_temporary());
ut_ad(!table->space);
ut_ad(table->space_id == ULINT_UNDEFINED);
- dict_table_assign_new_id(table, thr_get_trx(thr));
+ dict_hdr_get_new_id(&table->id, NULL, NULL);
+ trx->table_id = table->id;
/* Always set this bit for all new created tables */
DICT_TF2_FLAG_SET(table, DICT_TF2_FTS_AUX_HEX_NAME);
@@ -372,8 +370,6 @@ dict_build_table_def_step(
ut_ad(DICT_TF_GET_ZIP_SSIZE(table->flags) == 0
|| dict_table_has_atomic_blobs(table));
- trx_t* trx = thr_get_trx(thr);
- ut_ad(trx->table_id);
mtr_t mtr;
trx_undo_t* undo = trx->rsegs.m_redo.undo;
if (undo && !undo->table_id
@@ -401,7 +397,7 @@ dict_build_table_def_step(
}
/* Get a new tablespace ID */
ulint space_id;
- dict_hdr_get_new_id(NULL, NULL, &space_id, table, false);
+ dict_hdr_get_new_id(NULL, NULL, &space_id);
DBUG_EXECUTE_IF(
"ib_create_table_fail_out_of_space_ids",
@@ -749,7 +745,7 @@ dict_build_index_def_step(
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|| dict_index_is_clust(index));
- dict_hdr_get_new_id(NULL, &index->id, NULL, table, false);
+ dict_hdr_get_new_id(NULL, &index->id, NULL);
/* Inherit the space id from the table; we store all indexes of a
table in the same tablespace */
@@ -789,7 +785,7 @@ dict_build_index_def(
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|| dict_index_is_clust(index));
- dict_hdr_get_new_id(NULL, &index->id, NULL, table, false);
+ dict_hdr_get_new_id(NULL, &index->id, NULL);
/* Note that the index was created by this transaction. */
index->trx_id = trx->id;
@@ -2380,15 +2376,3 @@ dict_delete_tablespace_and_datafiles(
return(err);
}
-
-/** Assign a new table ID and put it into the table cache and the transaction.
-@param[in,out] table Table that needs an ID
-@param[in,out] trx Transaction */
-void
-dict_table_assign_new_id(
- dict_table_t* table,
- trx_t* trx)
-{
- dict_hdr_get_new_id(&table->id, NULL, NULL, table, false);
- trx->table_id = table->id;
-}
diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc
index 69038d4cb77..6347a239812 100644
--- a/storage/innobase/dict/dict0defrag_bg.cc
+++ b/storage/innobase/dict/dict0defrag_bg.cc
@@ -27,11 +27,8 @@ Created 25/08/2016 Jan Lindström
#include "dict0stats.h"
#include "dict0stats_bg.h"
#include "dict0defrag_bg.h"
-#include "row0mysql.h"
+#include "btr0btr.h"
#include "srv0start.h"
-#include "ut0new.h"
-
-#include <vector>
static ib_mutex_t defrag_pool_mutex;
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 6a594855674..4ea5a5b30e9 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -60,7 +60,6 @@ ib_warn_row_too_big(const dict_table_t* table);
#include "dict0mem.h"
#include "dict0priv.h"
#include "dict0stats.h"
-#include "fsp0sysspace.h"
#include "fts0fts.h"
#include "fts0types.h"
#include "lock0lock.h"
@@ -81,7 +80,6 @@ ib_warn_row_too_big(const dict_table_t* table);
#include "srv0start.h"
#include "sync0sync.h"
#include "trx0undo.h"
-#include "ut0new.h"
#include <vector>
#include <algorithm>
@@ -408,6 +406,27 @@ dict_table_stats_unlock(
}
}
+
+/** Open a persistent table.
+@param[in] table_id persistent table identifier
+@param[in] ignore_err errors to ignore
+@param[in] cached_only whether to skip loading
+@return persistent table
+@retval NULL if not found */
+static dict_table_t* dict_table_open_on_id_low(
+ table_id_t table_id,
+ dict_err_ignore_t ignore_err,
+ bool cached_only)
+{
+ dict_table_t* table = dict_sys->get_table(table_id);
+
+ if (!table && !cached_only) {
+ table = dict_load_table_on_id(table_id, ignore_err);
+ }
+
+ return table;
+}
+
/**********************************************************************//**
Try to drop any indexes after an aborted index creation.
This can also be after a server kill during DROP INDEX. */
@@ -418,7 +437,7 @@ dict_table_try_drop_aborted(
dict_table_t* table, /*!< in: table, or NULL if it
needs to be looked up again */
table_id_t table_id, /*!< in: table identifier */
- int32 ref_count) /*!< in: expected table->n_ref_count */
+ uint32_t ref_count) /*!< in: expected table->n_ref_count */
{
trx_t* trx;
@@ -886,47 +905,29 @@ dict_index_get_nth_col_or_prefix_pos(
return(ULINT_UNDEFINED);
}
-/** Returns TRUE if the index contains a column or a prefix of that column.
-@param[in] index index
+/** Check if the index contains a column or a prefix of that column.
@param[in] n column number
@param[in] is_virtual whether it is a virtual col
-@return TRUE if contains the column or its prefix */
-bool
-dict_index_contains_col_or_prefix(
- const dict_index_t* index,
- ulint n,
- bool is_virtual)
+@return whether the index contains the column or its prefix */
+bool dict_index_t::contains_col_or_prefix(ulint n, bool is_virtual) const
{
- const dict_field_t* field;
- const dict_col_t* col;
- ulint pos;
- ulint n_fields;
+ ut_ad(magic_n == DICT_INDEX_MAGIC_N);
- ut_ad(index);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- if (dict_index_is_clust(index)) {
+ if (is_primary()) {
return(!is_virtual);
}
- if (is_virtual) {
- col = &dict_table_get_nth_v_col(index->table, n)->m_col;
- } else {
- col = dict_table_get_nth_col(index->table, n);
- }
-
- n_fields = dict_index_get_n_fields(index);
-
- for (pos = 0; pos < n_fields; pos++) {
- field = dict_index_get_nth_field(index, pos);
+ const dict_col_t* col = is_virtual
+ ? &dict_table_get_nth_v_col(table, n)->m_col
+ : dict_table_get_nth_col(table, n);
- if (col == field->col) {
-
- return(true);
+ for (ulint pos = 0; pos < n_fields; pos++) {
+ if (col == fields[pos].col) {
+ return true;
}
}
- return(false);
+ return false;
}
/********************************************************************//**
@@ -1086,20 +1087,19 @@ dict_init(void)
dict_operation_lock = static_cast<rw_lock_t*>(
ut_zalloc_nokey(sizeof(*dict_operation_lock)));
- dict_sys = static_cast<dict_sys_t*>(ut_zalloc_nokey(sizeof(*dict_sys)));
+ dict_sys = new (ut_zalloc_nokey(sizeof(*dict_sys))) dict_sys_t();
UT_LIST_INIT(dict_sys->table_LRU, &dict_table_t::table_LRU);
UT_LIST_INIT(dict_sys->table_non_LRU, &dict_table_t::table_LRU);
mutex_create(LATCH_ID_DICT_SYS, &dict_sys->mutex);
- dict_sys->table_hash = hash_create(
- buf_pool_get_curr_size()
- / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE));
+ const ulint hash_size = buf_pool_get_curr_size()
+ / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE);
- dict_sys->table_id_hash = hash_create(
- buf_pool_get_curr_size()
- / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE));
+ dict_sys->table_hash = hash_create(hash_size);
+ dict_sys->table_id_hash = hash_create(hash_size);
+ dict_sys->temp_id_hash = hash_create(hash_size);
rw_lock_create(dict_operation_lock_key,
dict_operation_lock, SYNC_DICT_OPERATION);
@@ -1259,8 +1259,7 @@ dict_table_add_system_columns(
}
/** Add the table definition to the data dictionary cache */
-void
-dict_table_t::add_to_cache()
+void dict_table_t::add_to_cache()
{
ut_ad(dict_lru_validate());
ut_ad(mutex_own(&dict_sys->mutex));
@@ -1268,7 +1267,6 @@ dict_table_t::add_to_cache()
cached = TRUE;
ulint fold = ut_fold_string(name.m_name);
- ulint id_fold = ut_fold_ull(id);
/* Look for a table with the same name: error if such exists */
{
@@ -1286,31 +1284,30 @@ dict_table_t::add_to_cache()
ut_ad(table2 == NULL);
#endif /* UNIV_DEBUG */
}
+ HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold,
+ this);
/* Look for a table with the same id: error if such exists */
+ hash_table_t* id_hash = is_temporary()
+ ? dict_sys->temp_id_hash : dict_sys->table_id_hash;
+ const ulint id_fold = ut_fold_ull(id);
{
dict_table_t* table2;
- HASH_SEARCH(id_hash, dict_sys->table_id_hash, id_fold,
+ HASH_SEARCH(id_hash, id_hash, id_fold,
dict_table_t*, table2, ut_ad(table2->cached),
table2->id == id);
ut_a(table2 == NULL);
#ifdef UNIV_DEBUG
/* Look for the same table pointer with a different id */
- HASH_SEARCH_ALL(id_hash, dict_sys->table_id_hash,
+ HASH_SEARCH_ALL(id_hash, id_hash,
dict_table_t*, table2, ut_ad(table2->cached),
table2 == this);
ut_ad(table2 == NULL);
#endif /* UNIV_DEBUG */
- }
-
- /* Add table to hash table of tables */
- HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold,
- this);
- /* Add table to hash table of tables based on table id */
- HASH_INSERT(dict_table_t, id_hash, dict_sys->table_id_hash, id_fold,
- this);
+ HASH_INSERT(dict_table_t, id_hash, id_hash, id_fold, this);
+ }
if (can_be_evicted) {
UT_LIST_ADD_FIRST(dict_sys->table_LRU, this);
@@ -1957,6 +1954,7 @@ dict_table_change_id_in_cache(
ut_ad(table);
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
+ ut_ad(!table->is_temporary());
/* Remove the table from the hash table of id's */
@@ -2014,8 +2012,10 @@ void dict_table_remove_from_cache(dict_table_t* table, bool lru, bool keep)
HASH_DELETE(dict_table_t, name_hash, dict_sys->table_hash,
ut_fold_string(table->name.m_name), table);
- HASH_DELETE(dict_table_t, id_hash, dict_sys->table_id_hash,
- ut_fold_ull(table->id), table);
+ hash_table_t* id_hash = table->is_temporary()
+ ? dict_sys->temp_id_hash : dict_sys->table_id_hash;
+ const ulint id_fold = ut_fold_ull(table->id);
+ HASH_DELETE(dict_table_t, id_hash, id_hash, id_fold, table);
/* Remove table from LRU or non-LRU list. */
if (table->can_be_evicted) {
@@ -5444,46 +5444,6 @@ dict_index_build_node_ptr(
return(tuple);
}
-/**********************************************************************//**
-Copies an initial segment of a physical record, long enough to specify an
-index entry uniquely.
-@return pointer to the prefix record */
-rec_t*
-dict_index_copy_rec_order_prefix(
-/*=============================*/
- const dict_index_t* index, /*!< in: index */
- const rec_t* rec, /*!< in: record for which to
- copy prefix */
- ulint* n_fields,/*!< out: number of fields copied */
- byte** buf, /*!< in/out: memory buffer for the
- copied prefix, or NULL */
- ulint* buf_size)/*!< in/out: buffer size */
-{
- ulint n;
-
- UNIV_PREFETCH_R(rec);
-
- if (dict_index_is_ibuf(index)) {
- ut_ad(!dict_table_is_comp(index->table));
- n = rec_get_n_fields_old(rec);
- } else {
- if (page_rec_is_leaf(rec)) {
- n = dict_index_get_n_unique_in_tree(index);
- } else if (dict_index_is_spatial(index)) {
- ut_ad(dict_index_get_n_unique_in_tree_nonleaf(index)
- == DICT_INDEX_SPATIAL_NODEPTR_SIZE);
- /* For R-tree, we have to compare
- the child page numbers as well. */
- n = DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1;
- } else {
- n = dict_index_get_n_unique_in_tree(index);
- }
- }
-
- *n_fields = n;
- return(rec_copy_prefix_to_buf(rec, index, n, buf, buf_size));
-}
-
/** Convert a physical record into a search tuple.
@param[in] rec index record (not necessarily in an index page)
@param[in] index index
@@ -6537,17 +6497,17 @@ dict_resize()
/* all table entries are in table_LRU and table_non_LRU lists */
hash_table_free(dict_sys->table_hash);
hash_table_free(dict_sys->table_id_hash);
+ hash_table_free(dict_sys->temp_id_hash);
- dict_sys->table_hash = hash_create(
- buf_pool_get_curr_size()
- / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE));
-
- dict_sys->table_id_hash = hash_create(
- buf_pool_get_curr_size()
- / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE));
+ const ulint hash_size = buf_pool_get_curr_size()
+ / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE);
+ dict_sys->table_hash = hash_create(hash_size);
+ dict_sys->table_id_hash = hash_create(hash_size);
+ dict_sys->temp_id_hash = hash_create(hash_size);
for (table = UT_LIST_GET_FIRST(dict_sys->table_LRU); table;
table = UT_LIST_GET_NEXT(table_LRU, table)) {
+ ut_ad(!table->is_temporary());
ulint fold = ut_fold_string(table->name.m_name);
ulint id_fold = ut_fold_ull(table->id);
@@ -6566,8 +6526,10 @@ dict_resize()
HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash,
fold, table);
- HASH_INSERT(dict_table_t, id_hash, dict_sys->table_id_hash,
- id_fold, table);
+ hash_table_t* id_hash = table->is_temporary()
+ ? dict_sys->temp_id_hash : dict_sys->table_id_hash;
+
+ HASH_INSERT(dict_table_t, id_hash, id_hash, id_fold, table);
}
mutex_exit(&dict_sys->mutex);
@@ -6590,7 +6552,7 @@ dict_close(void)
/* Free the hash elements. We don't remove them from the table
because we are going to destroy the table anyway. */
- for (ulint i = 0; i < hash_get_n_cells(dict_sys->table_id_hash); i++) {
+ for (ulint i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) {
dict_table_t* table;
table = static_cast<dict_table_t*>(
@@ -6611,6 +6573,7 @@ dict_close(void)
/* The elements are the same instance as in dict_sys->table_hash,
therefore we don't delete the individual elements. */
hash_table_free(dict_sys->table_id_hash);
+ hash_table_free(dict_sys->temp_id_hash);
mutex_exit(&dict_sys->mutex);
mutex_free(&dict_sys->mutex);
@@ -6840,6 +6803,7 @@ dict_index_zip_pad_update(
ulint fail_pct;
ut_ad(info);
+ ut_ad(info->pad % ZIP_PAD_INCR == 0);
total = info->success + info->failure;
@@ -6864,17 +6828,16 @@ dict_index_zip_pad_update(
if (fail_pct > zip_threshold) {
/* Compression failures are more then user defined
threshold. Increase the pad size to reduce chances of
- compression failures. */
- ut_ad(info->pad % ZIP_PAD_INCR == 0);
+ compression failures.
- /* Only do increment if it won't increase padding
+ Only do increment if it won't increase padding
beyond max pad size. */
if (info->pad + ZIP_PAD_INCR
< (srv_page_size * zip_pad_max) / 100) {
/* Use atomics even though we have the mutex.
This is to ensure that we are able to read
info->pad atomically. */
- my_atomic_addlint(&info->pad, ZIP_PAD_INCR);
+ info->pad += ZIP_PAD_INCR;
MONITOR_INC(MONITOR_PAD_INCREMENTS);
}
@@ -6892,11 +6855,10 @@ dict_index_zip_pad_update(
if (info->n_rounds >= ZIP_PAD_SUCCESSFUL_ROUND_LIMIT
&& info->pad > 0) {
- ut_ad(info->pad % ZIP_PAD_INCR == 0);
/* Use atomics even though we have the mutex.
This is to ensure that we are able to read
info->pad atomically. */
- my_atomic_addlint(&info->pad, ulint(-ZIP_PAD_INCR));
+ info->pad -= ZIP_PAD_INCR;
info->n_rounds = 0;
@@ -6969,7 +6931,7 @@ dict_index_zip_pad_optimal_page_size(
return(srv_page_size);
}
- pad = my_atomic_loadlint(&index->zip_pad.pad);
+ pad = index->zip_pad.pad;
ut_ad(pad < srv_page_size);
sz = srv_page_size - pad;
@@ -7011,32 +6973,16 @@ UNIV_INTERN
ulint
dict_sys_get_size()
{
- ulint size = 0;
-
- ut_ad(dict_sys);
-
- mutex_enter(&dict_sys->mutex);
-
- for(ulint i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) {
- dict_table_t* table;
-
- for (table = static_cast<dict_table_t*>(HASH_GET_FIRST(dict_sys->table_hash,i));
- table != NULL;
- table = static_cast<dict_table_t*>(HASH_GET_NEXT(name_hash, table))) {
- dict_index_t* index;
- size += mem_heap_get_size(table->heap) + strlen(table->name.m_name) +1;
-
- for(index = dict_table_get_first_index(table);
- index != NULL;
- index = dict_table_get_next_index(index)) {
- size += mem_heap_get_size(index->heap);
- }
- }
- }
-
- mutex_exit(&dict_sys->mutex);
-
- return (size);
+ /* No mutex; this is a very crude approximation anyway */
+ ulint size = UT_LIST_GET_LEN(dict_sys->table_LRU)
+ + UT_LIST_GET_LEN(dict_sys->table_non_LRU);
+ size *= sizeof(dict_table_t)
+ + sizeof(dict_index_t) * 2
+ + (sizeof(dict_col_t) + sizeof(dict_field_t)) * 10
+ + sizeof(dict_field_t) * 5 /* total number of key fields */
+ + 200; /* arbitrary, covering names and overhead */
+
+ return size;
}
/** Look for any dictionary objects that are found in the given tablespace.
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 1f1a6c0bc48..1540f7e53bc 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -25,8 +25,6 @@ from dictionary tables
Created 4/24/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "dict0load.h"
#include "mysql_version.h"
@@ -39,7 +37,6 @@ Created 4/24/1996 Heikki Tuuri
#include "dict0priv.h"
#include "dict0stats.h"
#include "fsp0file.h"
-#include "fsp0sysspace.h"
#include "fts0priv.h"
#include "mach0data.h"
#include "page0page.h"
@@ -3010,7 +3007,7 @@ err_exit:
}
if (err == DB_SUCCESS && cached && table->is_readable()) {
- if (table->space && !fil_space_get_size(table->space->id)) {
+ if (table->space && !fil_space_get_size(table->space_id)) {
table->corrupted = true;
table->file_unreadable = true;
} else if (table->supports_instant()) {
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index f5f61eff5b3..3d373bf37d8 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -34,7 +34,6 @@ Created 1/8/1996 Heikki Tuuri
#include "mach0data.h"
#include "dict0dict.h"
#include "fts0priv.h"
-#include "ut0crc32.h"
#include "lock0lock.h"
#include "sync0sync.h"
#include "row0row.h"
@@ -82,10 +81,6 @@ const char table_name_t::part_suffix[4]
= "#P#";
#endif
-/** An interger randomly initialized at startup used to make a temporary
-table name as unuique as possible. */
-static ib_uint32_t dict_temp_file_num;
-
/** Display an identifier.
@param[in,out] s output stream
@param[in] id_name SQL identifier (other than table name)
@@ -1112,35 +1107,15 @@ dict_mem_create_temporary_tablename(
ut_ad(dbend);
size_t dblen = size_t(dbend - dbtab) + 1;
- /* Increment a randomly initialized number for each temp file. */
- my_atomic_add32((int32*) &dict_temp_file_num, 1);
-
- size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20 + 1 + 10);
+ size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20);
name = static_cast<char*>(mem_heap_alloc(heap, size));
memcpy(name, dbtab, dblen);
snprintf(name + dblen, size - dblen,
- TEMP_FILE_PREFIX_INNODB UINT64PF "-" UINT32PF,
- id, dict_temp_file_num);
+ TEMP_FILE_PREFIX_INNODB UINT64PF, id);
return(name);
}
-/** Initialize dict memory variables */
-void
-dict_mem_init(void)
-{
- /* Initialize a randomly distributed temporary file number */
- ib_uint32_t now = static_cast<ib_uint32_t>(ut_time());
-
- const byte* buf = reinterpret_cast<const byte*>(&now);
-
- dict_temp_file_num = ut_crc32(buf, sizeof(now));
-
- DBUG_PRINT("dict_mem_init",
- ("Starting Temporary file number is " UINT32PF,
- dict_temp_file_num));
-}
-
/** Validate the search order in the foreign key set.
@param[in] fk_set the foreign key set to be validated
@return true if search order is fine in the set, false otherwise. */
@@ -1216,18 +1191,25 @@ inline void dict_index_t::reconstruct_fields()
n_nullable = 0;
ulint n_core_null = 0;
const bool comp = dict_table_is_comp(table);
- const auto* non_pk_col_map = table->instant->non_pk_col_map;
- for (unsigned i = n_first, o = i, j = 0; i < n_fields; ) {
+ const auto* field_map_it = table->instant->field_map;
+ for (unsigned i = n_first, j = 0; i < n_fields; ) {
dict_field_t& f = tfields[i++];
- auto c = *non_pk_col_map++;
- if (c & 1U << 15) {
+ auto c = *field_map_it++;
+ if (c.is_dropped()) {
f.col = &table->instant->dropped[j++];
- ut_ad(f.col->is_dropped());
+ DBUG_ASSERT(f.col->is_dropped());
f.fixed_len = dict_col_get_fixed_size(f.col, comp);
} else {
- f = fields[o++];
- f.col = dict_table_get_nth_col(table, c);
- f.name = f.col->name(*table);
+ DBUG_ASSERT(!c.is_not_null());
+ const auto old = std::find_if(
+ fields + n_first, fields + n_fields,
+ [c](const dict_field_t& o)
+ { return o.col->ind == c.ind(); });
+ ut_ad(old >= &fields[n_first]);
+ ut_ad(old < &fields[n_fields]);
+ DBUG_ASSERT(!old->prefix_len);
+ DBUG_ASSERT(old->col == &table->cols[c.ind()]);
+ f = *old;
}
f.col->clear_instant();
@@ -1263,23 +1245,22 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len)
return true;
}
- uint16_t* non_pk_col_map = static_cast<uint16_t*>(
+ field_map_element_t* field_map = static_cast<field_map_element_t*>(
mem_heap_alloc(heap,
- num_non_pk_fields * sizeof *non_pk_col_map));
+ num_non_pk_fields * sizeof *field_map));
unsigned n_dropped_cols = 0;
for (unsigned i = 0; i < num_non_pk_fields; i++) {
- non_pk_col_map[i] = mach_read_from_2(metadata);
+ auto c = field_map[i] = mach_read_from_2(metadata);
metadata += 2;
- if (non_pk_col_map[i] & 1U << 15) {
- if ((non_pk_col_map[i] & ~(3U << 14))
- > DICT_MAX_FIXED_COL_LEN + 1) {
+ if (field_map[i].is_dropped()) {
+ if (c.ind() > DICT_MAX_FIXED_COL_LEN + 1) {
return true;
}
n_dropped_cols++;
- } else if (non_pk_col_map[i] >= n_cols) {
+ } else if (c >= n_cols) {
return true;
}
}
@@ -1289,14 +1270,14 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len)
instant = new (mem_heap_alloc(heap, sizeof *instant)) dict_instant_t();
instant->n_dropped = n_dropped_cols;
instant->dropped = dropped_cols;
- instant->non_pk_col_map = non_pk_col_map;
+ instant->field_map = field_map;
dict_col_t* col = dropped_cols;
for (unsigned i = 0; i < num_non_pk_fields; i++) {
- if (non_pk_col_map[i] & 1U << 15) {
- auto fixed_len = non_pk_col_map[i] & ~(3U << 14);
+ if (field_map[i].is_dropped()) {
+ auto fixed_len = field_map[i].ind();
DBUG_ASSERT(fixed_len <= DICT_MAX_FIXED_COL_LEN + 1);
- (col++)->set_dropped(non_pk_col_map[i] & 1U << 14,
+ (col++)->set_dropped(field_map[i].is_not_null(),
fixed_len == 1,
fixed_len > 1 ? fixed_len - 1
: 0);
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index ed333caffe5..f236d2edadf 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -24,17 +24,13 @@ Code used for calculating and manipulating table statistics.
Created Jan 06, 2010 Vasil Dimov
*******************************************************/
-#include "univ.i"
-
+#include "dict0stats.h"
#include "ut0ut.h"
#include "ut0rnd.h"
#include "dyn0buf.h"
#include "row0sel.h"
#include "trx0trx.h"
#include "pars0pars.h"
-#include "dict0stats.h"
-#include "ha_prototypes.h"
-#include "ut0new.h"
#include <mysql_com.h>
#include "btr0btr.h"
@@ -1506,7 +1502,7 @@ dict_stats_analyze_index_below_cur(
offsets_rec = rec_get_offsets(rec, index, offsets1, false,
ULINT_UNDEFINED, &heap);
- page_id_t page_id(index->table->space->id,
+ page_id_t page_id(index->table->space_id,
btr_node_ptr_get_child_page_no(
rec, offsets_rec));
const page_size_t page_size(index->table->space->flags);
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc
index f15e98b8a4d..ae31b3d0e37 100644
--- a/storage/innobase/dict/dict0stats_bg.cc
+++ b/storage/innobase/dict/dict0stats_bg.cc
@@ -30,7 +30,6 @@ Created Apr 25, 2012 Vasil Dimov
#include "dict0defrag_bg.h"
#include "row0mysql.h"
#include "srv0start.h"
-#include "ut0new.h"
#include "fil0fil.h"
#ifdef WITH_WSREP
# include "mysql/service_wsrep.h"
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 86bad03f7fb..a30be6c5aed 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -23,23 +23,22 @@ Created Jonas Oreland Google
Modified Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/
-#include "fil0fil.h"
+#include "fil0crypt.h"
#include "mtr0types.h"
#include "mach0data.h"
-#include "page0size.h"
#include "page0zip.h"
-#ifndef UNIV_INNOCHECKSUM
-#include "fil0crypt.h"
+#include "buf0checksum.h"
+#ifdef UNIV_INNOCHECKSUM
+# include "buf0buf.h"
+#else
#include "srv0srv.h"
#include "srv0start.h"
-#include "log0recv.h"
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "ut0ut.h"
#include "btr0scrub.h"
#include "fsp0fsp.h"
#include "fil0pagecompress.h"
-#include "ha_prototypes.h" // IB_LOG_
#include <my_crypt.h>
/** Mutex for keys */
@@ -496,10 +495,12 @@ fil_parse_write_crypt_data(
uint len = mach_read_from_1(ptr);
ptr += 1;
- ut_a(type == CRYPT_SCHEME_UNENCRYPTED ||
- type == CRYPT_SCHEME_1); // only supported
+ if ((type != CRYPT_SCHEME_1 && type != CRYPT_SCHEME_UNENCRYPTED)
+ || len != CRYPT_SCHEME_1_IV_LEN) {
+ *err = DB_CORRUPTION;
+ return NULL;
+ }
- ut_a(len == CRYPT_SCHEME_1_IV_LEN); // only supported
uint min_key_version = mach_read_from_4(ptr);
ptr += 4;
@@ -518,6 +519,7 @@ fil_parse_write_crypt_data(
crypt_data->page0_offset = offset;
crypt_data->min_key_version = min_key_version;
crypt_data->encryption = encryption;
+ crypt_data->type = type;
memcpy(crypt_data->iv, ptr, len);
ptr += len;
@@ -616,8 +618,7 @@ fil_encrypt_buf(
// store the post-encryption checksum after the key-version
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4, checksum);
- ut_ad(fil_space_verify_crypt_checksum(dst_frame, page_size,
- space, offset));
+ ut_ad(fil_space_verify_crypt_checksum(dst_frame, page_size));
srv_stats.pages_encrypted.inc();
@@ -2365,7 +2366,7 @@ fil_space_crypt_close_tablespace(
{
fil_space_crypt_t* crypt_data = space->crypt_data;
- if (!crypt_data) {
+ if (!crypt_data || srv_n_fil_crypt_threads == 0) {
return;
}
@@ -2527,132 +2528,66 @@ encrypted, or corrupted.
@param[in,out] page page frame (checksum is temporarily modified)
@param[in] page_size page size
-@param[in] space tablespace identifier
-@param[in] offset page number
-@return true if page is encrypted AND OK, false otherwise */
-UNIV_INTERN
+@return whether the encrypted page is OK */
bool
-fil_space_verify_crypt_checksum(
- byte* page,
- const page_size_t& page_size,
- ulint space,
- ulint offset)
+fil_space_verify_crypt_checksum(const byte* page, const page_size_t& page_size)
{
- uint key_version = mach_read_from_4(page+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
-
- /* If page is not encrypted, return false */
- if (key_version == 0) {
- return false;
- }
-
- /* Read stored post encryption checksum. */
- uint32_t checksum = mach_read_from_4(
- page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
-
- /* Declare empty pages non-corrupted */
- if (checksum == 0
- && *reinterpret_cast<const ib_uint64_t*>(page + FIL_PAGE_LSN) == 0
- && buf_page_is_zeroes(page, page_size)) {
- return(true);
- }
+ ut_ad(mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION));
/* Compressed and encrypted pages do not have checksum. Assume not
corrupted. Page verification happens after decompression in
buf_page_io_complete() using buf_page_is_corrupted(). */
- if (mach_read_from_2(page+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
- return (true);
+ if (mach_read_from_2(page + FIL_PAGE_TYPE)
+ == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
+ return true;
}
- uint32 cchecksum1, cchecksum2;
-
- /* Calculate checksums */
- if (page_size.is_compressed()) {
- cchecksum1 = page_zip_calc_checksum(
- page, page_size.physical(),
- SRV_CHECKSUM_ALGORITHM_CRC32);
-
- cchecksum2 = (cchecksum1 == checksum)
- ? 0
- : page_zip_calc_checksum(
- page, page_size.physical(),
- SRV_CHECKSUM_ALGORITHM_INNODB);
- } else {
- cchecksum1 = buf_calc_page_crc32(page);
- cchecksum2 = (cchecksum1 == checksum)
- ? 0
- : buf_calc_page_new_checksum(page);
- }
+ /* Read stored post encryption checksum. */
+ const ib_uint32_t checksum = mach_read_from_4(
+ page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
/* If stored checksum matches one of the calculated checksums
page is not corrupted. */
- bool encrypted = (checksum == cchecksum1 || checksum == cchecksum2
- || checksum == BUF_NO_CHECKSUM_MAGIC);
-
- /* MySQL 5.6 and MariaDB 10.0 and 10.1 will write an LSN to the
- first page of each system tablespace file at
- FIL_PAGE_FILE_FLUSH_LSN offset. On other pages and in other files,
- the field might have been uninitialized until MySQL 5.5. In MySQL 5.7
- (and MariaDB Server 10.2.2) WL#7990 stopped writing the field for other
- than page 0 of the system tablespace.
-
- Starting from MariaDB 10.1 the field has been repurposed for
- encryption key_version.
-
- Starting with MySQL 5.7 (and MariaDB Server 10.2), the
- field has been repurposed for SPATIAL INDEX pages for
- FIL_RTREE_SPLIT_SEQ_NUM.
-
- Note that FIL_PAGE_FILE_FLUSH_LSN is not included in the InnoDB page
- checksum.
-
- Thus, FIL_PAGE_FILE_FLUSH_LSN could contain any value. While the
- field would usually be 0 for pages that are not encrypted, we cannot
- assume that a nonzero value means that the page is encrypted.
- Therefore we must validate the page both as encrypted and unencrypted
- when FIL_PAGE_FILE_FLUSH_LSN does not contain 0.
- */
+ switch (srv_checksum_algorithm_t(srv_checksum_algorithm)) {
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ if (page_size.is_compressed()) {
+ return checksum == page_zip_calc_checksum(
+ page, page_size.physical(),
+ SRV_CHECKSUM_ALGORITHM_CRC32);
+ }
- uint32_t checksum1 = mach_read_from_4(page + FIL_PAGE_SPACE_OR_CHKSUM);
- uint32_t checksum2;
+ return checksum == buf_calc_page_crc32(page);
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ /* Starting with MariaDB 10.1.25, 10.2.7, 10.3.1,
+ due to MDEV-12114, fil_crypt_calculate_checksum()
+ is only using CRC32 for the encrypted pages.
+ Due to this, we must treat "strict_none" as "none". */
+ case SRV_CHECKSUM_ALGORITHM_NONE:
+ return true;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ /* Starting with MariaDB 10.1.25, 10.2.7, 10.3.1,
+ due to MDEV-12114, fil_crypt_calculate_checksum()
+ is only using CRC32 for the encrypted pages.
+ Due to this, we must treat "strict_innodb" as "innodb". */
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_CRC32:
+ if (checksum == BUF_NO_CHECKSUM_MAGIC) {
+ return true;
+ }
+ if (page_size.is_compressed()) {
+ return checksum == page_zip_calc_checksum(
+ page, page_size.physical(),
+ SRV_CHECKSUM_ALGORITHM_CRC32)
+ || checksum == page_zip_calc_checksum(
+ page, page_size.physical(),
+ SRV_CHECKSUM_ALGORITHM_INNODB);
+ }
- bool valid;
+ return checksum == buf_calc_page_crc32(page)
+ || checksum == buf_calc_page_new_checksum(page);
+ }
- if (page_size.is_compressed()) {
- valid = checksum1 == cchecksum1;
- checksum2 = checksum1;
- } else {
- checksum2 = mach_read_from_4(
- page + srv_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM);
- valid = buf_page_is_checksum_valid_crc32(
- page, checksum1, checksum2, false
- /* FIXME: also try the original crc32 that was
- buggy on big-endian architectures? */)
- || buf_page_is_checksum_valid_innodb(
- page, checksum1, checksum2);
- }
-
- if (encrypted && valid) {
- /* If page is encrypted and traditional checksums match,
- page could be still encrypted, or not encrypted and valid or
- corrupted. */
-#ifdef UNIV_INNOCHECKSUM
- fprintf(log_file ? log_file : stderr,
- "Page " ULINTPF ":" ULINTPF " may be corrupted."
- " Post encryption checksum %u"
- " stored [%u:%u] key_version %u\n",
- space, offset, checksum, checksum1, checksum2,
- key_version);
-#else /* UNIV_INNOCHECKSUM */
- ib::error()
- << " Page " << space << ":" << offset
- << " may be corrupted."
- " Post encryption checksum " << checksum
- << " stored [" << checksum1 << ":" << checksum2
- << "] key_version " << key_version;
-#endif
- encrypted = false;
- }
-
- return(encrypted);
+ ut_ad(!"unhandled innodb_checksum_algorithm");
+ return false;
}
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index b32efedea2c..9abbc4a540a 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2018, MariaDB Corporation.
+Copyright (c) 2014, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -31,23 +31,19 @@ Created 10/25/1995 Heikki Tuuri
#include "buf0buf.h"
#include "dict0boot.h"
#include "dict0dict.h"
-#include "fsp0file.h"
+#include "dict0load.h"
#include "fsp0file.h"
#include "fsp0fsp.h"
-#include "fsp0space.h"
-#include "fsp0sysspace.h"
#include "hash0hash.h"
#include "log0log.h"
#include "log0recv.h"
#include "mach0data.h"
-#include "mem0mem.h"
#include "mtr0log.h"
#include "os0file.h"
#include "page0zip.h"
#include "row0mysql.h"
#include "srv0start.h"
#include "trx0purge.h"
-#include "ut0new.h"
#include "buf0lru.h"
#include "ibuf0ibuf.h"
#include "os0event.h"
@@ -169,9 +165,6 @@ ulint fil_n_pending_log_flushes = 0;
/** Number of pending tablespace flushes */
ulint fil_n_pending_tablespace_flushes = 0;
-/** Number of files currently open */
-ulint fil_n_file_opened = 0;
-
/** The tablespace memory cache. This variable is NULL before the module is
initialized. */
fil_system_t fil_system;
@@ -211,19 +204,11 @@ fil_validate_skip(void)
/*===================*/
{
/** The fil_validate() call skip counter. */
- static int fil_validate_count = FIL_VALIDATE_SKIP;
+ static Atomic_counter<uint32_t> fil_validate_count;
/* We want to reduce the call frequency of the costly fil_validate()
check in debug builds. */
- int count = my_atomic_add32_explicit(&fil_validate_count, -1,
- MY_MEMORY_ORDER_RELAXED);
- if (count > 0) {
- return(true);
- }
-
- my_atomic_store32_explicit(&fil_validate_count, FIL_VALIDATE_SKIP,
- MY_MEMORY_ORDER_RELAXED);
- return(fil_validate());
+ return (fil_validate_count++ % FIL_VALIDATE_SKIP) || fil_validate();
}
#endif /* UNIV_DEBUG */
@@ -424,7 +409,7 @@ fil_space_is_flushed(
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- if (node->modification_counter > node->flush_counter) {
+ if (node->needs_flush) {
ut_ad(!fil_buffering_disabled(space));
return(false);
@@ -437,43 +422,30 @@ fil_space_is_flushed(
/** Append a file to the chain of files of a space.
@param[in] name file name of a file that is not open
-@param[in] size file size in entire database blocks
-@param[in,out] space tablespace from fil_space_create()
-@param[in] is_raw whether this is a raw device or partition
-@param[in] atomic_write true if the file could use atomic write
+@param[in] handle file handle, or OS_FILE_CLOSED
+@param[in] size file size in entire database pages
+@param[in] is_raw whether this is a raw device
+@param[in] atomic_write true if atomic write could be enabled
@param[in] max_pages maximum number of pages in file,
-ULINT_MAX means the file size is unlimited.
-@return pointer to the file name
-@retval NULL if error */
-static
-fil_node_t*
-fil_node_create_low(
- const char* name,
- ulint size,
- fil_space_t* space,
- bool is_raw,
- bool atomic_write,
- ulint max_pages = ULINT_MAX)
+or ULINT_MAX for unlimited
+@return file object */
+fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle,
+ ulint size, bool is_raw, bool atomic_write,
+ ulint max_pages)
{
fil_node_t* node;
ut_ad(name != NULL);
ut_ad(fil_system.is_initialised());
- if (space == NULL) {
- return(NULL);
- }
-
node = reinterpret_cast<fil_node_t*>(ut_zalloc_nokey(sizeof(*node)));
- node->handle = OS_FILE_CLOSED;
+ node->handle = handle;
node->name = mem_strdup(name);
ut_a(!is_raw || srv_start_raw_disk_in_use);
- node->sync_event = os_event_create("fsync_event");
-
node->is_raw_disk = is_raw;
node->size = size;
@@ -483,55 +455,114 @@ fil_node_create_low(
node->init_size = size;
node->max_size = max_pages;
- mutex_enter(&fil_system.mutex);
-
- space->size += size;
-
- node->space = space;
+ node->space = this;
node->atomic_write = atomic_write;
- UT_LIST_ADD_LAST(space->chain, node);
+ mutex_enter(&fil_system.mutex);
+ this->size += size;
+ UT_LIST_ADD_LAST(chain, node);
+ if (node->is_open()) {
+ fil_system.n_open++;
+ }
mutex_exit(&fil_system.mutex);
- return(node);
+ return node;
}
-/** Appends a new file to the chain of files of a space. File must be closed.
-@param[in] name file name (file must be closed)
-@param[in] size file size in database blocks, rounded downwards to
- an integer
-@param[in,out] space space where to append
-@param[in] is_raw true if a raw device or a raw disk partition
-@param[in] atomic_write true if the file could use atomic write
-@param[in] max_pages maximum number of pages in file,
-ULINT_MAX means the file size is unlimited.
-@return pointer to the file name
-@retval NULL if error */
-char*
-fil_node_create(
- const char* name,
- ulint size,
- fil_space_t* space,
- bool is_raw,
- bool atomic_write,
- ulint max_pages)
+/** Read the first page of a data file.
+@param[in] first whether this is the very first read
+@return whether the page was found valid */
+bool fil_node_t::read_page0(bool first)
{
- fil_node_t* node;
+ ut_ad(mutex_own(&fil_system.mutex));
+ ut_a(space->purpose != FIL_TYPE_LOG);
+ const page_size_t page_size(space->flags);
+ const ulint psize = page_size.physical();
+
+ os_offset_t size_bytes = os_file_get_size(handle);
+ ut_a(size_bytes != (os_offset_t) -1);
+ const ulint min_size = FIL_IBD_FILE_INITIAL_SIZE * psize;
+
+ if (size_bytes < min_size) {
+ ib::error() << "The size of the file " << name
+ << " is only " << size_bytes
+ << " bytes, should be at least " << min_size;
+ return false;
+ }
+
+ byte* buf2 = static_cast<byte*>(ut_malloc_nokey(2 * psize));
+
+ /* Align the memory for file i/o if we might have O_DIRECT set */
+ byte* page = static_cast<byte*>(ut_align(buf2, psize));
+ IORequest request(IORequest::READ);
+ if (!os_file_read(request, handle, page, 0, psize)) {
+ ib::error() << "Unable to read first page of file " << name;
+ ut_free(buf2);
+ return false;
+ }
+ const ulint space_id = fsp_header_get_space_id(page);
+ ulint flags = fsp_header_get_flags(page);
+ const ulint size = fsp_header_get_field(page, FSP_SIZE);
+ const ulint free_limit = fsp_header_get_field(page, FSP_FREE_LIMIT);
+ const ulint free_len = flst_get_len(FSP_HEADER_OFFSET + FSP_FREE
+ + page);
+ /* Try to read crypt_data from page 0 if it is not yet read. */
+ if (!space->crypt_data) {
+ space->crypt_data = fil_space_read_crypt_data(page_size, page);
+ }
+ ut_free(buf2);
+
+ if (!fsp_flags_is_valid(flags, space->id)) {
+ ulint cflags = fsp_flags_convert_from_101(flags);
+ if (cflags == ULINT_UNDEFINED
+ || (cflags ^ space->flags) & ~FSP_FLAGS_MEM_MASK) {
+ ib::error()
+ << "Expected tablespace flags "
+ << ib::hex(space->flags)
+ << " but found " << ib::hex(flags)
+ << " in the file " << name;
+ return false;
+ }
+
+ flags = cflags;
+ }
+
+ if (UNIV_UNLIKELY(space_id != space->id)) {
+ ib::error() << "Expected tablespace id " << space->id
+ << " but found " << space_id
+ << " in the file " << name;
+ return false;
+ }
- node = fil_node_create_low(
- name, size, space, is_raw, atomic_write, max_pages);
+ ut_ad(space->free_limit == 0 || space->free_limit == free_limit);
+ ut_ad(space->free_len == 0 || space->free_len == free_len);
+ space->size_in_header = size;
+ space->free_limit = free_limit;
+ space->free_len = free_len;
- return(node == NULL ? NULL : node->name);
+ if (first) {
+ /* Truncate the size to a multiple of extent size. */
+ ulint mask = psize * FSP_EXTENT_SIZE - 1;
+
+ if (size_bytes <= mask) {
+ /* .ibd files start smaller than an
+ extent size. Do not truncate valid data. */
+ } else {
+ size_bytes &= ~os_offset_t(mask);
+ }
+
+ this->size = ulint(size_bytes / psize);
+ space->size += this->size;
+ }
+
+ return true;
}
/** Open a file node of a tablespace.
@param[in,out] node File node
@return false if the file can't be opened, otherwise true */
-static
-bool
-fil_node_open_file(
- fil_node_t* node)
+static bool fil_node_open_file(fil_node_t* node)
{
bool success;
bool read_only_mode;
@@ -558,9 +589,12 @@ fil_node_open_file(
from a file opened for async I/O! */
retry:
- node->handle = os_file_create_simple_no_error_handling(
- innodb_data_file_key, node->name, OS_FILE_OPEN,
- OS_FILE_READ_ONLY, read_only_mode, &success);
+ node->handle = os_file_create(
+ innodb_data_file_key, node->name,
+ node->is_raw_disk
+ ? OS_FILE_OPEN_RAW | OS_FILE_ON_ERROR_NO_EXIT
+ : OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
+ OS_FILE_AIO, OS_DATA_FILE, read_only_mode, &success);
if (!success) {
/* The following call prints an error message */
@@ -576,155 +610,52 @@ retry:
return(false);
}
- os_offset_t size_bytes = os_file_get_size(node->handle);
- ut_a(size_bytes != (os_offset_t) -1);
-
- ut_a(space->purpose != FIL_TYPE_LOG);
- const page_size_t page_size(space->flags);
- const ulint psize = page_size.physical();
- const ulint min_size = FIL_IBD_FILE_INITIAL_SIZE
- * psize;
-
- if (size_bytes < min_size) {
- ib::error() << "The size of the file " << node->name
- << " is only " << size_bytes
- << " bytes, should be at least " << min_size;
+ if (!node->read_page0(first_time_open)) {
os_file_close(node->handle);
node->handle = OS_FILE_CLOSED;
- return(false);
- }
-
- /* Read the first page of the tablespace */
-
- byte* buf2 = static_cast<byte*>(ut_malloc_nokey(2 * psize));
-
- /* Align the memory for file i/o if we might have O_DIRECT
- set */
- byte* page = static_cast<byte*>(ut_align(buf2, psize));
-
- IORequest request(IORequest::READ);
-
- success = os_file_read(
- request,
- node->handle, page, 0, psize);
-
- const ulint space_id
- = fsp_header_get_space_id(page);
- ulint flags = fsp_header_get_flags(page);
- const ulint size = fsp_header_get_field(
- page, FSP_SIZE);
- const ulint free_limit = fsp_header_get_field(
- page, FSP_FREE_LIMIT);
- const ulint free_len = flst_get_len(
- FSP_HEADER_OFFSET + FSP_FREE + page);
-
- /* Try to read crypt_data from page 0 if it is not yet
- read. */
- if (!space->crypt_data) {
- space->crypt_data = fil_space_read_crypt_data(
- page_size_t(space->flags), page);
- }
-
- ut_free(buf2);
- os_file_close(node->handle);
- node->handle = OS_FILE_CLOSED;
-
- if (!fsp_flags_is_valid(flags, space->id)) {
- ulint cflags = fsp_flags_convert_from_101(flags);
- if (cflags == ULINT_UNDEFINED
- || (cflags ^ space->flags) & ~FSP_FLAGS_MEM_MASK) {
- ib::error()
- << "Expected tablespace flags "
- << ib::hex(space->flags)
- << " but found " << ib::hex(flags)
- << " in the file " << node->name;
- return(false);
- }
-
- flags = cflags;
- }
-
- if (UNIV_UNLIKELY(space_id != space->id)) {
- ib::error()
- << "Expected tablespace id " << space->id
- << " but found " << space_id
- << " in the file" << node->name;
- return(false);
- }
-
- ut_ad(space->free_limit == 0
- || space->free_limit == free_limit);
- ut_ad(space->free_len == 0
- || space->free_len == free_len);
- space->size_in_header = size;
- space->free_limit = free_limit;
- space->free_len = free_len;
-
- if (first_time_open) {
- /* Truncate the size to a multiple of extent size. */
- ulint mask = psize * FSP_EXTENT_SIZE - 1;
-
- if (size_bytes <= mask) {
- /* .ibd files start smaller than an
- extent size. Do not truncate valid data. */
- } else {
- size_bytes &= ~os_offset_t(mask);
- }
-
- node->size = ulint(size_bytes / psize);
- space->size += node->size;
+ return false;
}
- }
-
- /* printf("Opening file %s\n", node->name); */
-
- /* Open the file for reading and writing, in Windows normally in the
- unbuffered async I/O mode, though global variables may make
- os_file_create() to fall back to the normal file I/O mode. */
-
- if (space->purpose == FIL_TYPE_LOG) {
+ } else if (space->purpose == FIL_TYPE_LOG) {
node->handle = os_file_create(
innodb_log_file_key, node->name, OS_FILE_OPEN,
OS_FILE_AIO, OS_LOG_FILE, read_only_mode, &success);
- } else if (node->is_raw_disk) {
- node->handle = os_file_create(
- innodb_data_file_key, node->name, OS_FILE_OPEN_RAW,
- OS_FILE_AIO, OS_DATA_FILE, read_only_mode, &success);
} else {
node->handle = os_file_create(
- innodb_data_file_key, node->name, OS_FILE_OPEN,
+ innodb_data_file_key, node->name,
+ node->is_raw_disk
+ ? OS_FILE_OPEN_RAW | OS_FILE_ON_ERROR_NO_EXIT
+ : OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_AIO, OS_DATA_FILE, read_only_mode, &success);
+ }
- if (first_time_open) {
- /*
- For the temporary tablespace and during the
- non-redo-logged adjustments in
- IMPORT TABLESPACE, we do not care about
- the atomicity of writes.
-
- Atomic writes is supported if the file can be used
- with atomic_writes (not log file), O_DIRECT is
- used (tested in ha_innodb.cc) and the file is
- device and file system that supports atomic writes
- for the given block size
- */
- space->atomic_write_supported
- = space->purpose == FIL_TYPE_TEMPORARY
- || space->purpose == FIL_TYPE_IMPORT
- || (node->atomic_write
- && srv_use_atomic_writes
- && my_test_if_atomic_write(
- node->handle,
- int(page_size_t(space->flags)
- .physical())));
- }
- }
+ if (space->purpose != FIL_TYPE_LOG) {
+ /*
+ For the temporary tablespace and during the
+ non-redo-logged adjustments in
+ IMPORT TABLESPACE, we do not care about
+ the atomicity of writes.
+
+ Atomic writes is supported if the file can be used
+ with atomic_writes (not log file), O_DIRECT is
+ used (tested in ha_innodb.cc) and the file is
+ device and file system that supports atomic writes
+ for the given block size
+ */
+ space->atomic_write_supported
+ = space->purpose == FIL_TYPE_TEMPORARY
+ || space->purpose == FIL_TYPE_IMPORT
+ || (node->atomic_write
+ && srv_use_atomic_writes
+ && my_test_if_atomic_write(
+ node->handle,
+ int(page_size_t(space->flags)
+ .physical())));
+ }
ut_a(success);
ut_a(node->is_open());
fil_system.n_open++;
- fil_n_file_opened++;
if (fil_space_belongs_in_lru(space)) {
@@ -745,7 +676,7 @@ void fil_node_t::close()
ut_a(n_pending == 0);
ut_a(n_pending_flushes == 0);
ut_a(!being_extended);
- ut_a(modification_counter == flush_counter
+ ut_a(!needs_flush
|| space->purpose == FIL_TYPE_TEMPORARY
|| srv_fast_shutdown == 2
|| !srv_was_started);
@@ -759,7 +690,6 @@ void fil_node_t::close()
ut_ad(!is_open());
ut_a(fil_system.n_open > 0);
fil_system.n_open--;
- fil_n_file_opened--;
if (fil_space_belongs_in_lru(space)) {
ut_a(UT_LIST_GET_LEN(fil_system.LRU) > 0);
@@ -795,7 +725,7 @@ fil_try_to_close_file_in_LRU(
node != NULL;
node = UT_LIST_GET_PREV(LRU, node)) {
- if (node->modification_counter == node->flush_counter
+ if (!node->needs_flush
&& node->n_pending_flushes == 0
&& !node->being_extended) {
@@ -815,11 +745,9 @@ fil_try_to_close_file_in_LRU(
<< node->n_pending_flushes;
}
- if (node->modification_counter != node->flush_counter) {
+ if (node->needs_flush) {
ib::warn() << "Cannot close file " << node->name
- << ", because modification count "
- << node->modification_counter <<
- " != flush count " << node->flush_counter;
+ << ", because is should be flushed first";
}
if (node->being_extended) {
@@ -832,10 +760,9 @@ fil_try_to_close_file_in_LRU(
}
/** Flush any writes cached by the file system.
-@param[in,out] space tablespace */
-static
-void
-fil_flush_low(fil_space_t* space)
+@param[in,out] space tablespace
+@param[in] metadata whether to update file system metadata */
+static void fil_flush_low(fil_space_t* space, bool metadata = false)
{
ut_ad(mutex_own(&fil_system.mutex));
ut_ad(space);
@@ -845,7 +772,7 @@ fil_flush_low(fil_space_t* space)
/* No need to flush. User has explicitly disabled
buffering. */
- ut_ad(!space->is_in_unflushed_spaces);
+ ut_ad(!space->is_in_unflushed_spaces());
ut_ad(fil_space_is_flushed(space));
ut_ad(space->n_pending_flushes == 0);
@@ -853,13 +780,12 @@ fil_flush_low(fil_space_t* space)
for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- ut_ad(node->modification_counter
- == node->flush_counter);
+ ut_ad(!node->needs_flush);
ut_ad(node->n_pending_flushes == 0);
}
#endif /* UNIV_DEBUG */
- return;
+ if (!metadata) return;
}
/* Prevent dropping of the space while we are flushing */
@@ -869,9 +795,7 @@ fil_flush_low(fil_space_t* space)
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- int64_t old_mod_counter = node->modification_counter;
-
- if (old_mod_counter <= node->flush_counter) {
+ if (!node->needs_flush) {
continue;
}
@@ -895,31 +819,10 @@ fil_flush_low(fil_space_t* space)
goto skip_flush;
}
#endif /* _WIN32 */
-retry:
- if (node->n_pending_flushes > 0) {
- /* We want to avoid calling os_file_flush() on
- the file twice at the same time, because we do
- not know what bugs OS's may contain in file
- i/o */
-
- int64_t sig_count = os_event_reset(node->sync_event);
-
- mutex_exit(&fil_system.mutex);
-
- os_event_wait_low(node->sync_event, sig_count);
-
- mutex_enter(&fil_system.mutex);
-
- if (node->flush_counter >= old_mod_counter) {
-
- goto skip_flush;
- }
-
- goto retry;
- }
ut_a(node->is_open());
node->n_pending_flushes++;
+ node->needs_flush = false;
mutex_exit(&fil_system.mutex);
@@ -927,18 +830,14 @@ retry:
mutex_enter(&fil_system.mutex);
- os_event_set(node->sync_event);
-
node->n_pending_flushes--;
+#ifdef _WIN32
skip_flush:
- if (node->flush_counter < old_mod_counter) {
- node->flush_counter = old_mod_counter;
-
- if (space->is_in_unflushed_spaces
+#endif /* _WIN32 */
+ if (!node->needs_flush) {
+ if (space->is_in_unflushed_spaces()
&& fil_space_is_flushed(space)) {
- space->is_in_unflushed_spaces = false;
-
UT_LIST_REMOVE(
fil_system.unflushed_spaces,
space);
@@ -1036,6 +935,7 @@ fil_space_extend_must_retry(
os_has_said_disk_full = *success;
if (*success) {
+ os_file_flush(node->handle);
last_page_no = size;
} else {
/* Let us measure the size of the file
@@ -1067,14 +967,14 @@ fil_space_extend_must_retry(
switch (space->id) {
case TRX_SYS_SPACE:
srv_sys_space.set_last_file_size(pages_in_MiB);
- fil_flush_low(space);
+ fil_flush_low(space, true);
return(false);
default:
ut_ad(space->purpose == FIL_TYPE_TABLESPACE
|| space->purpose == FIL_TYPE_IMPORT);
if (space->purpose == FIL_TYPE_TABLESPACE
&& !space->is_being_truncated) {
- fil_flush_low(space);
+ fil_flush_low(space, true);
}
return(false);
case SRV_TMP_SPACE_ID:
@@ -1232,19 +1132,16 @@ fil_node_close_to_free(
/* We fool the assertion in fil_node_t::close() to think
there are no unflushed modifications in the file */
- node->modification_counter = node->flush_counter;
- os_event_set(node->sync_event);
+ node->needs_flush = false;
if (fil_buffering_disabled(space)) {
- ut_ad(!space->is_in_unflushed_spaces);
+ ut_ad(!space->is_in_unflushed_spaces());
ut_ad(fil_space_is_flushed(space));
- } else if (space->is_in_unflushed_spaces
+ } else if (space->is_in_unflushed_spaces()
&& fil_space_is_flushed(space)) {
- space->is_in_unflushed_spaces = false;
-
UT_LIST_REMOVE(fil_system.unflushed_spaces, space);
}
@@ -1265,16 +1162,14 @@ fil_space_detach(
HASH_DELETE(fil_space_t, hash, fil_system.spaces, space->id, space);
- if (space->is_in_unflushed_spaces) {
+ if (space->is_in_unflushed_spaces()) {
ut_ad(!fil_buffering_disabled(space));
- space->is_in_unflushed_spaces = false;
UT_LIST_REMOVE(fil_system.unflushed_spaces, space);
}
- if (space->is_in_rotation_list) {
- space->is_in_rotation_list = false;
+ if (space->is_in_rotation_list()) {
UT_LIST_REMOVE(fil_system.rotation_list, space);
}
@@ -1320,7 +1215,6 @@ fil_space_free_low(
for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
node != NULL; ) {
ut_d(space->size -= node->size);
- os_event_destroy(node->sync_event);
ut_free(node->name);
fil_node_t* old_node = node;
node = UT_LIST_GET_NEXT(chain, node);
@@ -1394,7 +1288,7 @@ Error messages are issued to the server log.
@param[in] purpose tablespace purpose
@param[in,out] crypt_data encryption information
@param[in] mode encryption mode
-@return pointer to created tablespace, to be filled in with fil_node_create()
+@return pointer to created tablespace, to be filled in with fil_space_t::add()
@retval NULL on failure (such as when the same tablespace exists) */
fil_space_t*
fil_space_create(
@@ -1470,7 +1364,7 @@ fil_space_create(
if (space->purpose == FIL_TYPE_TEMPORARY) {
/* SysTablespace::open_or_create() would pass
- size!=0 to fil_node_create(), so first_time_open
+ size!=0 to fil_space_t::add(), so first_time_open
would not hold in fil_node_open_file(), and we
must assign this manually. We do not care about
the durability or atomicity of writes to the
@@ -1496,11 +1390,8 @@ fil_space_create(
/* Key rotation is not enabled, need to inform background
encryption threads. */
UT_LIST_ADD_LAST(fil_system.rotation_list, space);
- space->is_in_rotation_list = true;
mutex_exit(&fil_system.mutex);
- mutex_enter(&fil_crypt_threads_mutex);
os_event_set(fil_crypt_threads_event);
- mutex_exit(&fil_crypt_threads_mutex);
} else {
mutex_exit(&fil_system.mutex);
}
@@ -2365,7 +2256,7 @@ fil_check_pending_ops(const fil_space_t* space, ulint count)
return 0;
}
- if (ulint n_pending_ops = my_atomic_loadlint(&space->n_pending_ops)) {
+ if (ulint n_pending_ops = space->n_pending_ops) {
if (count > 5000) {
ib::warn() << "Trying to close/delete/truncate"
@@ -3223,17 +3114,17 @@ err_exit:
free(crypt_data);
*err = DB_ERROR;
} else {
- fil_node_t* node = fil_node_create_low(path, size, space,
- false, true);
+ fil_node_t* file = space->add(path, OS_FILE_CLOSED, size,
+ false, true);
mtr_t mtr;
mtr.start();
fil_op_write_log(
- MLOG_FILE_CREATE2, space_id, 0, node->name,
+ MLOG_FILE_CREATE2, space_id, 0, file->name,
NULL, space->flags & ~FSP_FLAGS_MEM_MASK, &mtr);
- fil_name_write(space, 0, node, &mtr);
+ fil_name_write(space, 0, file, &mtr);
mtr.commit();
- node->block_size = block_size;
+ file->block_size = block_size;
space->punch_hole = punch_hole;
*err = DB_SUCCESS;
@@ -3601,17 +3492,17 @@ skip_validate:
fil_space_t* space = fil_space_create(
tablename.m_name, id, flags, purpose, crypt_data);
+ if (!space) {
+ goto error;
+ }
/* We do not measure the size of the file, that is why
we pass the 0 below */
- if (fil_node_create_low(
- df_remote.is_open() ? df_remote.filepath() :
- df_dict.is_open() ? df_dict.filepath() :
- df_default.filepath(), 0, space, false,
- true) == NULL) {
- goto error;
- }
+ space->add(
+ df_remote.is_open() ? df_remote.filepath() :
+ df_dict.is_open() ? df_dict.filepath() :
+ df_default.filepath(), OS_FILE_CLOSED, 0, false, true);
if (validate && purpose != FIL_TYPE_IMPORT && !srv_read_only_mode) {
df_remote.close();
@@ -3960,9 +3851,7 @@ fil_ibd_load(
the rounding formula for extents and pages is somewhat complex; we
let fil_node_open() do that task. */
- if (!fil_node_create_low(file.filepath(), 0, space, false, false)) {
- ut_error;
- }
+ space->add(file.filepath(), OS_FILE_CLOSED, 0, false, false);
return(FIL_LOAD_OK);
}
@@ -4168,24 +4057,21 @@ fil_node_complete_io(fil_node_t* node, const IORequest& type)
ut_ad(!srv_read_only_mode
|| node->space->purpose == FIL_TYPE_TEMPORARY);
- ++fil_system.modification_counter;
-
- node->modification_counter = fil_system.modification_counter;
-
if (fil_buffering_disabled(node->space)) {
/* We don't need to keep track of unflushed
changes as user has explicitly disabled
buffering. */
- ut_ad(!node->space->is_in_unflushed_spaces);
- node->flush_counter = node->modification_counter;
-
- } else if (!node->space->is_in_unflushed_spaces) {
+ ut_ad(!node->space->is_in_unflushed_spaces());
+ ut_ad(node->needs_flush == false);
- node->space->is_in_unflushed_spaces = true;
+ } else {
+ node->needs_flush = true;
- UT_LIST_ADD_FIRST(
- fil_system.unflushed_spaces, node->space);
+ if (!node->space->is_in_unflushed_spaces()) {
+ UT_LIST_ADD_FIRST(fil_system.unflushed_spaces,
+ node->space);
+ }
}
}
@@ -4863,8 +4749,8 @@ fil_mtr_rename_log(
{
ut_ad(old_table->space != fil_system.temp_space);
ut_ad(new_table->space != fil_system.temp_space);
- ut_ad(old_table->space_id == old_table->space->id);
- ut_ad(new_table->space_id == new_table->space->id);
+ ut_ad(old_table->space->id == old_table->space_id);
+ ut_ad(new_table->space->id == new_table->space_id);
/* If neither table is file-per-table,
there will be no renaming of files. */
@@ -5188,8 +5074,7 @@ fil_space_remove_from_keyrotation(fil_space_t* space)
ut_ad(mutex_own(&fil_system.mutex));
ut_ad(space);
- if (space->is_in_rotation_list && !space->referenced()) {
- space->is_in_rotation_list = false;
+ if (!space->referenced() && space->is_in_rotation_list()) {
ut_a(UT_LIST_GET_LEN(fil_system.rotation_list) > 0);
UT_LIST_REMOVE(fil_system.rotation_list, space);
}
@@ -5330,3 +5215,21 @@ fil_space_set_punch_hole(
{
node->space->punch_hole = val;
}
+
+/** Checks that this tablespace in a list of unflushed tablespaces.
+@return true if in a list */
+bool fil_space_t::is_in_unflushed_spaces() const {
+ ut_ad(mutex_own(&fil_system.mutex));
+
+ return fil_system.unflushed_spaces.start == this
+ || unflushed_spaces.next || unflushed_spaces.prev;
+}
+
+/** Checks that this tablespace needs key rotation.
+@return true if in a rotation list */
+bool fil_space_t::is_in_rotation_list() const {
+ ut_ad(mutex_own(&fil_system.mutex));
+
+ return fil_system.rotation_list.start == this || rotation_list.next
+ || rotation_list.prev;
+}
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index ca5fc036c45..57bb736d230 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -47,7 +47,6 @@ Updated 14/02/2015
#include "page0zip.h"
#include "trx0sys.h"
#include "row0mysql.h"
-#include "ha_prototypes.h" // IB_LOG_
#include "buf0lru.h"
#include "ibuf0ibuf.h"
#include "sync0sync.h"
@@ -329,14 +328,14 @@ ulint fil_page_decompress(byte* tmp_buf, byte* buf)
case PAGE_ZLIB_ALGORITHM:
{
uLong len = srv_page_size;
- if (Z_OK != uncompress(tmp_buf, &len,
+ if (Z_OK == uncompress(tmp_buf, &len,
buf + header_len,
uLong(actual_size))
- && len != srv_page_size) {
- return 0;
+ && len == srv_page_size) {
+ break;
}
}
- break;
+ return 0;
#ifdef HAVE_LZ4
case PAGE_LZ4_ALGORITHM:
if (LZ4_decompress_safe(reinterpret_cast<const char*>(buf)
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 4611052ab48..3070f989c04 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -24,16 +24,11 @@ Tablespace data file implementation
Created 2013-7-26 by Kevin Lewis
*******************************************************/
-#include "ha_prototypes.h"
-
#include "fil0fil.h"
#include "fsp0types.h"
-#include "fsp0sysspace.h"
#include "os0file.h"
#include "page0page.h"
#include "srv0start.h"
-#include "ut0new.h"
-#include "fil0crypt.h"
/** Initialize the name, size and order of this datafile
@param[in] name tablespace name, will be copied
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 5c2d709e1bc..9e92646556c 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -24,8 +24,6 @@ File space management
Created 11/29/1995 Heikki Tuuri
***********************************************************************/
-#include "ha_prototypes.h"
-
#include "fsp0fsp.h"
#include "buf0buf.h"
#include "fil0fil.h"
@@ -41,7 +39,6 @@ Created 11/29/1995 Heikki Tuuri
#include "btr0sea.h"
#include "dict0boot.h"
#include "log0log.h"
-#include "fsp0sysspace.h"
#include "dict0mem.h"
#include "fsp0types.h"
@@ -624,7 +621,7 @@ fsp_space_modify_check(
case MTR_LOG_NO_REDO:
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|| space->purpose == FIL_TYPE_IMPORT
- || my_atomic_loadlint(&space->redo_skipped_count));
+ || space->redo_skipped_count);
return;
case MTR_LOG_ALL:
/* We may only write redo log for a persistent tablespace. */
diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc
index 9ca2786b935..88b34be4952 100644
--- a/storage/innobase/fsp/fsp0space.cc
+++ b/storage/innobase/fsp/fsp0space.cc
@@ -24,9 +24,6 @@ Shared tablespace implementation.
Created 2012-11-16 by Sunny Bains as srv/srv0space.cc
*******************************************************/
-#include "ha_prototypes.h"
-
-#include "fsp0space.h"
#include "fsp0sysspace.h"
#include "fsp0fsp.h"
#include "os0file.h"
@@ -126,18 +123,15 @@ Tablespace::open_or_create(bool is_temp)
is_temp
? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE,
NULL);
+ if (!space) {
+ return DB_ERROR;
+ }
}
ut_a(fil_validate());
- /* Create the tablespace node entry for this data file. */
- if (!fil_node_create(
- it->m_filepath, it->m_size, space, false,
- TRUE)) {
-
- err = DB_ERROR;
- break;
- }
+ space->add(it->m_filepath, OS_FILE_CLOSED, it->m_size,
+ false, true);
}
return(err);
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
index 2a120989532..aec2a3914b8 100644
--- a/storage/innobase/fsp/fsp0sysspace.cc
+++ b/storage/innobase/fsp/fsp0sysspace.cc
@@ -24,8 +24,6 @@ Created 2012-11-16 by Sunny Bains as srv/srv0space.cc
Refactored 2013-7-26 by Kevin Lewis
*******************************************************/
-#include "ha_prototypes.h"
-
#include "fsp0sysspace.h"
#include "srv0start.h"
#include "trx0sys.h"
@@ -33,7 +31,6 @@ Refactored 2013-7-26 by Kevin Lewis
#include "mem0mem.h"
#include "os0file.h"
#include "row0mysql.h"
-#include "ut0new.h"
/** The server header file is included to access opt_initialize global variable.
If server passes the option for create/open DB to SE, we should remove such
@@ -910,12 +907,18 @@ SysTablespace::open_or_create(
space = fil_system.temp_space = fil_space_create(
name(), SRV_TMP_SPACE_ID, flags(),
FIL_TYPE_TEMPORARY, NULL);
+ if (!space) {
+ return DB_ERROR;
+ }
} else {
ut_ad(!fil_system.sys_space);
ut_ad(space_id() == TRX_SYS_SPACE);
space = fil_system.sys_space = fil_space_create(
name(), TRX_SYS_SPACE, flags(),
FIL_TYPE_TABLESPACE, NULL);
+ if (!space) {
+ return DB_ERROR;
+ }
}
ut_a(fil_validate());
@@ -926,15 +929,8 @@ SysTablespace::open_or_create(
: m_last_file_size_max)
: it->m_size);
- /* Add the datafile to the fil_system cache. */
- if (!fil_node_create(
- it->m_filepath, it->m_size,
- space, it->m_type != SRV_NOT_RAW,
- TRUE, max_size)) {
-
- err = DB_ERROR;
- break;
- }
+ space->add(it->m_filepath, OS_FILE_CLOSED, it->m_size,
+ it->m_type != SRV_NOT_RAW, true, max_size);
}
return(err);
diff --git a/storage/innobase/fts/fts0ast.cc b/storage/innobase/fts/fts0ast.cc
index d6695cec5be..9a5eb2b49bb 100644
--- a/storage/innobase/fts/fts0ast.cc
+++ b/storage/innobase/fts/fts0ast.cc
@@ -24,8 +24,6 @@ Full Text Search parser helper file.
Created 2007/3/16 Sunny Bains.
***********************************************************************/
-#include "ha_prototypes.h"
-
#include "fts0ast.h"
#include "fts0pars.h"
#include "fts0fts.h"
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 3c372045e82..d5ce2f30ab4 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -22,8 +22,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
Full Text Search interface
***********************************************************************/
-#include "ha_prototypes.h"
-
#include "trx0roll.h"
#include "row0mysql.h"
#include "row0upd.h"
@@ -40,7 +38,6 @@ Full Text Search interface
#include "dict0stats.h"
#include "btr0pcur.h"
#include "sync0sync.h"
-#include "ut0new.h"
static const ulint FTS_MAX_ID_LEN = 32;
@@ -1513,8 +1510,8 @@ fts_rename_one_aux_table(
table_new_name_len - new_db_name_len);
fts_table_new_name[table_new_name_len] = 0;
- return(row_rename_table_for_mysql(
- fts_table_old_name, fts_table_new_name, trx, false));
+ return row_rename_table_for_mysql(
+ fts_table_old_name, fts_table_new_name, trx, false, false);
}
/****************************************************************//**
@@ -1744,7 +1741,7 @@ fts_create_in_mem_aux_table(
{
dict_table_t* new_table = dict_mem_table_create(
aux_table_name, NULL, n_cols, 0, table->flags,
- table->space->id == TRX_SYS_SPACE
+ table->space_id == TRX_SYS_SPACE
? 0 : table->space->purpose == FIL_TYPE_TEMPORARY
? DICT_TF2_TEMPORARY : DICT_TF2_USE_FILE_PER_TABLE);
@@ -1773,7 +1770,7 @@ fts_create_one_common_table(
const char* fts_suffix,
mem_heap_t* heap)
{
- dict_table_t* new_table = NULL;
+ dict_table_t* new_table;
dberr_t error;
bool is_config = strcmp(fts_suffix, "CONFIG") == 0;
@@ -1826,11 +1823,13 @@ fts_create_one_common_table(
}
if (error != DB_SUCCESS) {
- trx->error_state = error;
dict_mem_table_free(new_table);
new_table = NULL;
ib::warn() << "Failed to create FTS common table "
<< fts_table_name;
+ trx->error_state = DB_SUCCESS;
+ row_drop_table_for_mysql(fts_table_name, trx, SQLCOM_DROP_DB);
+ trx->error_state = error;
}
return(new_table);
}
@@ -1971,7 +1970,7 @@ fts_create_one_index_table(
mem_heap_t* heap)
{
dict_field_t* field;
- dict_table_t* new_table = NULL;
+ dict_table_t* new_table;
char table_name[MAX_FULL_NAME_LEN];
dberr_t error;
CHARSET_INFO* charset;
@@ -2035,11 +2034,13 @@ fts_create_one_index_table(
}
if (error != DB_SUCCESS) {
- trx->error_state = error;
dict_mem_table_free(new_table);
new_table = NULL;
ib::warn() << "Failed to create FTS index table "
<< table_name;
+ trx->error_state = DB_SUCCESS;
+ row_drop_table_for_mysql(table_name, trx, SQLCOM_DROP_DB);
+ trx->error_state = error;
}
return(new_table);
@@ -3242,15 +3243,10 @@ fts_fetch_doc_from_rec(
documents */
{
dict_index_t* index;
- dict_table_t* table;
const rec_t* clust_rec;
- ulint num_field;
const dict_field_t* ifield;
- const dict_col_t* col;
ulint clust_pos;
- ulint i;
ulint doc_len = 0;
- ulint processed_doc = 0;
st_mysql_ftparser* parser;
if (!get_doc) {
@@ -3258,19 +3254,15 @@ fts_fetch_doc_from_rec(
}
index = get_doc->index_cache->index;
- table = get_doc->index_cache->index->table;
parser = get_doc->index_cache->index->parser;
clust_rec = btr_pcur_get_rec(pcur);
ut_ad(!page_rec_is_comp(clust_rec)
|| rec_get_status(clust_rec) == REC_STATUS_ORDINARY);
- num_field = dict_index_get_n_fields(index);
-
- for (i = 0; i < num_field; i++) {
+ for (ulint i = 0; i < index->n_fields; i++) {
ifield = dict_index_get_nth_field(index, i);
- col = dict_field_get_col(ifield);
- clust_pos = dict_col_get_clust_pos(col, clust_index);
+ clust_pos = dict_col_get_clust_pos(ifield->col, clust_index);
if (!get_doc->index_cache->charset) {
get_doc->index_cache->charset = fts_get_charset(
@@ -3281,7 +3273,7 @@ fts_fetch_doc_from_rec(
doc->text.f_str =
btr_rec_copy_externally_stored_field(
clust_rec, offsets,
- dict_table_page_size(table),
+ btr_pcur_get_block(pcur)->page.size,
clust_pos, &doc->text.f_len,
static_cast<mem_heap_t*>(
doc->self_heap->arg));
@@ -3299,13 +3291,12 @@ fts_fetch_doc_from_rec(
continue;
}
- if (processed_doc == 0) {
+ if (!doc_len) {
fts_tokenize_document(doc, NULL, parser);
} else {
fts_tokenize_document_next(doc, doc_len, NULL, parser);
}
- processed_doc++;
doc_len += doc->text.f_len + 1;
}
}
@@ -3713,13 +3704,6 @@ fts_get_max_doc_id(
if (!page_is_empty(btr_pcur_get_page(&pcur))) {
const rec_t* rec = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
- mem_heap_t* heap = NULL;
- ulint len;
- const void* data;
-
- rec_offs_init(offsets_);
do {
rec = btr_pcur_get_rec(&pcur);
@@ -3729,18 +3713,11 @@ fts_get_max_doc_id(
}
} while (btr_pcur_move_to_prev(&pcur, &mtr));
- if (!rec) {
+ if (!rec || rec_is_metadata(rec, *index)) {
goto func_exit;
}
- ut_ad(!rec_is_metadata(rec, *index));
- offsets = rec_get_offsets(
- rec, index, offsets, true, ULINT_UNDEFINED, &heap);
-
- data = rec_get_nth_field(rec, offsets, 0, &len);
-
- doc_id = static_cast<doc_id_t>(fts_read_doc_id(
- static_cast<const byte*>(data)));
+ doc_id = fts_read_doc_id(rec);
}
func_exit:
@@ -5222,49 +5199,23 @@ fts_get_doc_id_from_row(
}
/** Extract the doc id from the record that belongs to index.
-@param[in] table table
-@param[in] rec record contains FTS_DOC_ID
+@param[in] rec record containing FTS_DOC_ID
@param[in] index index of rec
-@param[in] heap heap memory
+@param[in] offsets rec_get_offsets(rec,index)
@return doc id that was extracted from rec */
doc_id_t
fts_get_doc_id_from_rec(
- dict_table_t* table,
const rec_t* rec,
const dict_index_t* index,
- mem_heap_t* heap)
+ const ulint* offsets)
{
- ulint len;
- const byte* data;
- ulint col_no;
- doc_id_t doc_id = 0;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
- mem_heap_t* my_heap = heap;
-
- ut_a(table->fts->doc_col != ULINT_UNDEFINED);
-
- rec_offs_init(offsets_);
-
- offsets = rec_get_offsets(
- rec, index, offsets, true, ULINT_UNDEFINED, &my_heap);
-
- col_no = dict_col_get_index_pos(
- &table->cols[table->fts->doc_col], index);
-
- ut_ad(col_no != ULINT_UNDEFINED);
-
- data = rec_get_nth_field(rec, offsets, col_no, &len);
-
- ut_a(len == 8);
- ut_ad(8 == sizeof(doc_id));
- doc_id = static_cast<doc_id_t>(mach_read_from_8(data));
-
- if (my_heap && !heap) {
- mem_heap_free(my_heap);
- }
-
- return(doc_id);
+ ulint f = dict_col_get_index_pos(
+ &index->table->cols[index->table->fts->doc_col], index);
+ ulint len;
+ doc_id_t doc_id = mach_read_from_8(
+ rec_get_nth_field(rec, offsets, f, &len));
+ ut_ad(len == 8);
+ return doc_id;
}
/*********************************************************************//**
@@ -6232,7 +6183,7 @@ fts_rename_one_aux_table_to_hex_format(
}
error = row_rename_table_for_mysql(aux_table->name, new_name, trx,
- FALSE);
+ false, false);
if (error != DB_SUCCESS) {
ib::warn() << "Failed to rename aux table '"
@@ -6371,7 +6322,7 @@ fts_rename_aux_tables_to_hex_format_low(
DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS_AUX_HEX_NAME);
err = row_rename_table_for_mysql(table->name.m_name,
aux_table->name,
- trx_bg, FALSE);
+ trx_bg, false, false);
trx_bg->dict_operation_lock_mode = 0;
dict_table_close(table, TRUE, FALSE);
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index c523ac5270e..cf862cb8c6d 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -26,8 +26,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
***********************************************************************/
-#include "ha_prototypes.h"
-
#include "fts0fts.h"
#include "row0sel.h"
#include "que0types.h"
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 32e08c9c941..00f3b9aedf0 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -25,8 +25,6 @@ Created 2007/03/27 Sunny Bains
Completed 2011/7/10 Sunny and Jimmy Yang
*******************************************************/
-#include "ha_prototypes.h"
-
#include "dict0dict.h"
#include "ut0rbt.h"
#include "row0sel.h"
@@ -36,7 +34,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
#include "fts0pars.h"
#include "fts0types.h"
#include "fts0plugin.h"
-#include "ut0new.h"
#include <iomanip>
#include <vector>
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index 4bd3e1c232a..9c10108a3f3 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -737,7 +737,7 @@ rtr_adjust_upper_level(
new_prdt.op = 0;
lock_prdt_update_parent(block, new_block, &prdt, &new_prdt,
- index->table->space->id,
+ index->table->space_id,
page_cursor->block->page.id.page_no());
mem_heap_free(heap);
@@ -746,14 +746,15 @@ rtr_adjust_upper_level(
prev_page_no = btr_page_get_prev(page, mtr);
next_page_no = btr_page_get_next(page, mtr);
space = block->page.id.space();
- const page_size_t& page_size = dict_table_page_size(index->table);
+ ut_ad(block->page.size.equals_to(dict_table_page_size(index->table)));
/* Update page links of the level */
if (prev_page_no != FIL_NULL) {
page_id_t prev_page_id(space, prev_page_no);
buf_block_t* prev_block = btr_block_get(
- prev_page_id, page_size, RW_X_LATCH, index, mtr);
+ prev_page_id, block->page.size, RW_X_LATCH,
+ index, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(prev_block->frame) == page_is_comp(page));
ut_a(btr_page_get_next(prev_block->frame, mtr)
@@ -769,7 +770,8 @@ rtr_adjust_upper_level(
page_id_t next_page_id(space, next_page_no);
buf_block_t* next_block = btr_block_get(
- next_page_id, page_size, RW_X_LATCH, index, mtr);
+ next_page_id, block->page.size, RW_X_LATCH,
+ index, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_block->frame) == page_is_comp(page));
ut_a(btr_page_get_prev(next_block->frame, mtr)
@@ -1258,7 +1260,7 @@ after_insert:
/* Check any predicate locks need to be moved/copied to the
new page */
lock_prdt_update_split(new_block, &prdt, &new_prdt,
- cursor->index->table->space->id, page_no);
+ cursor->index->table->space_id, page_no);
/* Adjust the upper level. */
rtr_adjust_upper_level(cursor, flags, block, new_block,
@@ -1872,7 +1874,7 @@ rtr_estimate_n_rows_in_range(
mtr_s_lock(&index->lock, &mtr);
buf_block_t* block = btr_block_get(
- page_id_t(index->table->space->id, index->page),
+ page_id_t(index->table->space_id, index->page),
page_size_t(index->table->space->flags),
RW_S_LATCH, index, &mtr);
const page_t* page = buf_block_get_frame(block);
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 6fcc56170d0..a406acabf6e 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -268,7 +268,7 @@ rtr_pcur_getnext_from_path(
dberr_t err = DB_SUCCESS;
block = buf_page_get_gen(
- page_id_t(index->table->space->id,
+ page_id_t(index->table->space_id,
next_rec.page_no), page_size,
rw_latch, NULL, BUF_GET, __FILE__, __LINE__, mtr, &err);
@@ -298,7 +298,7 @@ rtr_pcur_getnext_from_path(
&& mode != PAGE_CUR_RTREE_LOCATE) {
ut_ad(rtr_info->thr);
lock_place_prdt_page_lock(
- index->table->space->id,
+ index->table->space_id,
next_page_no, index,
rtr_info->thr);
}
@@ -422,7 +422,7 @@ rtr_pcur_getnext_from_path(
btr_cur_latch_leaves(
block,
- page_id_t(index->table->space->id,
+ page_id_t(index->table->space_id,
block->page.id.page_no()),
page_size, BTR_MODIFY_TREE,
btr_cur, mtr);
@@ -772,7 +772,7 @@ rtr_page_get_father_node_ptr(
error << ". You should dump + drop + reimport the table to"
" fix the corruption. If the crash happens at"
" database startup, see "
- "https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/"
+ "https://mariadb.com/kb/en/library/innodb-recovery-modes/"
" about forcing"
" recovery. Then dump + drop + reimport.";
}
@@ -1360,7 +1360,7 @@ search_again:
dberr_t err = DB_SUCCESS;
block = buf_page_get_gen(
- page_id_t(index->table->space->id, page_no),
+ page_id_t(index->table->space_id, page_no),
page_size, RW_X_LATCH, NULL,
BUF_GET, __FILE__, __LINE__, mtr, &err);
@@ -1561,14 +1561,13 @@ rtr_copy_buf(
matches->block.n_fields = block->n_fields;
matches->block.left_side = block->left_side;
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- matches->block.n_pointers = block->n_pointers;
+ matches->block.n_pointers = 0;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
matches->block.curr_n_fields = block->curr_n_fields;
matches->block.curr_left_side = block->curr_left_side;
matches->block.index = block->index;
#endif /* BTR_CUR_HASH_ADAPT */
- ut_d(matches->block.debug_latch = block->debug_latch);
-
+ ut_d(matches->block.debug_latch = NULL);
}
/****************************************************************//**
diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc
index fa1a9bc5db9..b6fdab5968b 100644
--- a/storage/innobase/ha/ha0ha.cc
+++ b/storage/innobase/ha/ha0ha.cc
@@ -245,11 +245,8 @@ ha_insert_for_fold_func(
buf_block_t* prev_block = prev_node->block;
ut_a(prev_block->frame
== page_align(prev_node->data));
- ut_a(my_atomic_addlint(&prev_block->n_pointers,
- ulint(-1))
- < MAX_N_POINTERS);
- ut_a(my_atomic_addlint(&block->n_pointers, 1)
- < MAX_N_POINTERS);
+ ut_a(prev_block->n_pointers-- < MAX_N_POINTERS);
+ ut_a(block->n_pointers++ < MAX_N_POINTERS);
}
prev_node->block = block;
@@ -280,8 +277,7 @@ ha_insert_for_fold_func(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
if (table->adaptive) {
- ut_a(my_atomic_addlint(&block->n_pointers, 1)
- < MAX_N_POINTERS);
+ ut_a(block->n_pointers++ < MAX_N_POINTERS);
}
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -342,8 +338,7 @@ ha_delete_hash_node(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
if (table->adaptive) {
ut_a(del_node->block->frame = page_align(del_node->data));
- ut_a(my_atomic_addlint(&del_node->block->n_pointers, ulint(-1))
- < MAX_N_POINTERS);
+ ut_a(del_node->block->n_pointers-- < MAX_N_POINTERS);
}
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -385,11 +380,8 @@ ha_search_and_update_if_found_func(
if (node) {
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
if (table->adaptive) {
- ut_a(my_atomic_addlint(&node->block->n_pointers,
- ulint(-1))
- < MAX_N_POINTERS);
- ut_a(my_atomic_addlint(&new_block->n_pointers, 1)
- < MAX_N_POINTERS);
+ ut_a(node->block->n_pointers-- < MAX_N_POINTERS);
+ ut_a(new_block->n_pointers++ < MAX_N_POINTERS);
}
node->block = new_block;
diff --git a/storage/innobase/ha/ha0storage.cc b/storage/innobase/ha/ha0storage.cc
index cde4cc04cb7..a6960675adc 100644
--- a/storage/innobase/ha/ha0storage.cc
+++ b/storage/innobase/ha/ha0storage.cc
@@ -25,7 +25,6 @@ its own storage, avoiding duplicates.
Created September 22, 2007 Vasil Dimov
*******************************************************/
-#include "ha_prototypes.h"
#include "ha0storage.h"
#include "hash0hash.h"
#include "mem0mem.h"
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 0b4880b0205..46062850019 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -71,6 +71,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "buf0flu.h"
#include "buf0lru.h"
#include "dict0boot.h"
+#include "dict0load.h"
#include "btr0defragment.h"
#include "dict0crea.h"
#include "dict0dict.h"
@@ -78,8 +79,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "dict0stats_bg.h"
#include "fil0fil.h"
#include "fsp0fsp.h"
-#include "fsp0space.h"
-#include "fsp0sysspace.h"
#include "fts0fts.h"
#include "fts0plugin.h"
#include "fts0priv.h"
@@ -87,10 +86,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "log0crypt.h"
-#include "mem0mem.h"
#include "mtr0mtr.h"
#include "os0file.h"
-#include "os0thread.h"
#include "page0zip.h"
#include "pars0pars.h"
#include "rem0types.h"
@@ -134,6 +131,9 @@ void close_thread_tables(THD* thd);
#define tdc_size 400
#endif
+#include <mysql/plugin.h>
+#include <mysql/service_wsrep.h>
+
#include "ha_innodb.h"
#include "i_s.h"
#include "sync0sync.h"
@@ -141,31 +141,13 @@ void close_thread_tables(THD* thd);
#include <string>
#include <sstream>
-#include <mysql/plugin.h>
-#include <mysql/service_wsrep.h>
-
#ifdef WITH_WSREP
#include "dict0priv.h"
-#include "ut0byte.h"
#include <mysql/service_md5.h>
+#include "wsrep_sst.h"
extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
-static inline wsrep_ws_handle_t*
-wsrep_ws_handle(THD* thd, const trx_t* trx) {
- return wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd),
- (wsrep_trx_id_t)trx->id);
-}
-
-extern TC_LOG* tc_log;
-extern void wsrep_cleanup_transaction(THD *thd);
-static int
-wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
- my_bool signal);
-static void
-wsrep_fake_trx_id(handlerton* hton, THD *thd);
-static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid);
-static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid);
#endif /* WITH_WSREP */
/** to force correct commit order in binlog */
@@ -251,10 +233,10 @@ void set_my_errno(int err)
errno = err;
}
-static uint mysql_fields(const TABLE *table)
+static uint omits_virtual_cols(const TABLE_SHARE &share)
{
- return table->s->frm_version < FRM_VER_EXPRESSSIONS
- ? table->s->stored_fields : table->s->fields;
+ return share.frm_version < FRM_VER_EXPRESSSIONS &&
+ share.virtual_fields;
}
/** Checks whether the file name belongs to a partition of a table.
@@ -273,7 +255,7 @@ is_partition(
/** Signal to shut down InnoDB (NULL if shutdown was signaled, or if
running in innodb_read_only mode, srv_read_only_mode) */
-st_my_thread_var *srv_running;
+std::atomic <st_my_thread_var *> srv_running;
/** Service thread that waits for the server shutdown and stops purge threads.
Purge workers have THDs that are needed to calculate virtual columns.
This THDs must be destroyed rather early in the server shutdown sequence.
@@ -293,23 +275,20 @@ thd_destructor_proxy(void *)
mysql_cond_init(PSI_NOT_INSTRUMENTED, &thd_destructor_cond, 0);
st_my_thread_var *myvar= _my_thread_var();
+ myvar->current_mutex = &thd_destructor_mutex;
+ myvar->current_cond = &thd_destructor_cond;
+
THD *thd= create_thd();
thd_proc_info(thd, "InnoDB shutdown handler");
- myvar->current_mutex = &thd_destructor_mutex;
- myvar->current_cond = &thd_destructor_cond;
mysql_mutex_lock(&thd_destructor_mutex);
- my_atomic_storeptr_explicit(reinterpret_cast<void**>(&srv_running),
- myvar,
- MY_MEMORY_ORDER_RELAXED);
+ srv_running.store(myvar, std::memory_order_relaxed);
/* wait until the server wakes the THD to abort and die */
- while (!srv_running->abort)
+ while (!myvar->abort)
mysql_cond_wait(&thd_destructor_cond, &thd_destructor_mutex);
mysql_mutex_unlock(&thd_destructor_mutex);
- my_atomic_storeptr_explicit(reinterpret_cast<void**>(&srv_running),
- NULL,
- MY_MEMORY_ORDER_RELAXED);
+ srv_running.store(NULL, std::memory_order_relaxed);
while (srv_fast_shutdown == 0 &&
(trx_sys.any_active_transactions() ||
@@ -1849,8 +1828,13 @@ thd_to_trx_id(
{
return(thd_to_trx(thd)->id);
}
-#endif /* WITH_WSREP */
+static int
+wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
+ my_bool signal);
+static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid);
+static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid);
+#endif /* WITH_WSREP */
/********************************************************************//**
Increments innobase_active_counter and every INNOBASE_WAKE_INTERVALth
time calls srv_active_wake_master_thread. This function should be used
@@ -2914,8 +2898,9 @@ ha_innobase::ha_innobase(
| HA_CAN_EXPORT
| HA_CAN_RTREEKEYS
| HA_CAN_TABLES_WITHOUT_ROLLBACK
+ | HA_CAN_ONLINE_BACKUPS
| HA_CONCURRENT_OPTIMIZE
- | (srv_force_primary_key ? HA_WANTS_PRIMARY_KEY : 0)
+ | (srv_force_primary_key ? HA_REQUIRE_PRIMARY_KEY : 0)
),
m_start_of_scan(),
m_mysql_has_locked()
@@ -4161,13 +4146,12 @@ static int innodb_init(void* p)
innobase_hton->show_status = innobase_show_status;
innobase_hton->flags =
HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS
- | HTON_NATIVE_SYS_VERSIONING;
+ | HTON_NATIVE_SYS_VERSIONING | HTON_WSREP_REPLICATION;
#ifdef WITH_WSREP
innobase_hton->abort_transaction=wsrep_abort_transaction;
innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint;
innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint;
- innobase_hton->fake_trx_id=wsrep_fake_trx_id;
#endif /* WITH_WSREP */
innobase_hton->tablefile_extensions = ha_innobase_exts;
@@ -4259,9 +4243,7 @@ static int innodb_init(void* p)
mysql_thread_create(thd_destructor_thread_key,
&thd_destructor_thread,
NULL, thd_destructor_proxy, NULL);
- while (!my_atomic_loadptr_explicit(reinterpret_cast<void**>
- (&srv_running),
- MY_MEMORY_ORDER_RELAXED))
+ while (!srv_running.load(std::memory_order_relaxed))
os_thread_sleep(20);
}
@@ -4341,17 +4323,15 @@ innobase_end(handlerton*, ha_panic_function)
}
}
- st_my_thread_var* running = reinterpret_cast<st_my_thread_var*>(
- my_atomic_loadptr_explicit(
- reinterpret_cast<void**>(&srv_running),
- MY_MEMORY_ORDER_RELAXED));
- if (!abort_loop && running) {
- // may be UNINSTALL PLUGIN statement
- running->abort = 1;
- mysql_cond_broadcast(running->current_cond);
- }
-
- if (!srv_read_only_mode) {
+ if (auto r = srv_running.load(std::memory_order_relaxed)) {
+ ut_ad(!srv_read_only_mode);
+ if (!abort_loop) {
+ // may be UNINSTALL PLUGIN statement
+ mysql_mutex_lock(r->current_mutex);
+ r->abort = 1;
+ mysql_cond_broadcast(r->current_cond);
+ mysql_mutex_unlock(r->current_mutex);
+ }
pthread_join(thd_destructor_thread, NULL);
}
@@ -4506,6 +4486,14 @@ innobase_commit_ordered_2(
trx->flush_log_later = true;
}
+#ifdef WITH_WSREP
+ /* If the transaction is not run in 2pc, we must assign wsrep
+ XID here in order to get it written in rollback segment. */
+ if (wsrep_on(thd)) {
+ thd_get_xid(thd, (MYSQL_XID*)trx->xid);
+ }
+#endif /* WITH_WSREP */
+
innobase_commit_low(trx);
if (!read_only) {
@@ -4708,6 +4696,15 @@ innobase_rollback(
dberr_t error;
+#ifdef WITH_WSREP
+ /* If trx was assigned wsrep XID in prepare phase and the
+ trx is being rolled back due to BF abort, clear XID in order
+ to avoid writing it to rollback segment out of order. The XID
+ will be reassigned when the transaction is replayed. */
+ if (wsrep_is_wsrep_xid(trx->xid)) {
+ trx->xid->null();
+ }
+#endif /* WITH_WSREP */
if (rollback_trx
|| !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
@@ -5113,7 +5110,7 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels)
{
DBUG_ENTER("innobase_kill_query");
#ifdef WITH_WSREP
- if (wsrep_thd_get_conflict_state(thd) != NO_CONFLICT) {
+ if (wsrep_on(thd) && wsrep_thd_is_aborting(thd)) {
/* if victim has been signaled by BF thread and/or aborting
is already progressing, following query aborting is not necessary
any more.
@@ -5443,6 +5440,26 @@ normalize_table_name_c_low(
}
}
+create_table_info_t::create_table_info_t(
+ THD* thd,
+ TABLE* form,
+ HA_CREATE_INFO* create_info,
+ char* table_name,
+ char* remote_path,
+ bool file_per_table,
+ trx_t* trx)
+ : m_thd(thd),
+ m_trx(trx),
+ m_form(form),
+ m_default_row_format(innodb_default_row_format),
+ m_create_info(create_info),
+ m_table_name(table_name), m_table(NULL),
+ m_drop_before_rollback(false),
+ m_remote_path(remote_path),
+ m_innodb_file_per_table(file_per_table)
+{
+}
+
/** Normalizes a table name string.
A normalized name consists of the database name catenated to '/'
and table name. For example: test/mytable.
@@ -6052,6 +6069,14 @@ initialize_auto_increment(dict_table_t* table, const Field* field)
int
ha_innobase::open(const char* name, int, uint)
{
+ /* TODO: If trx_rollback_recovered(bool all=false) is ever
+ removed, the first-time open() must hold (or acquire and release)
+ a table lock that conflicts with trx_resurrect_table_locks(),
+ to ensure that any recovered incomplete ALTER TABLE will have been
+ rolled back. Otherwise, dict_table_t::instant could be cleared by
+ the rollback invoking dict_index_t::clear_instant_alter() while
+ open table handles exist in client connections. */
+
dict_table_t* ib_table;
char norm_name[FN_REFLEN];
dict_err_ignore_t ignore_err = DICT_ERR_IGNORE_NONE;
@@ -6090,12 +6115,13 @@ no_such_table:
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
- size_t n_fields = mysql_fields(table);
+ size_t n_fields = omits_virtual_cols(*table_share)
+ ? table_share->stored_fields : table_share->fields;
size_t n_cols = dict_table_get_n_user_cols(ib_table)
+ dict_table_get_n_v_cols(ib_table)
- !!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID);
- if (n_cols != n_fields) {
+ if (UNIV_UNLIKELY(n_cols != n_fields)) {
ib::warn() << "Table " << norm_name << " contains "
<< n_cols << " user"
" defined columns in InnoDB, but " << n_fields
@@ -7233,19 +7259,19 @@ static
const Field*
build_template_needs_field(
/*=======================*/
- ibool index_contains, /*!< in:
- dict_index_contains_col_or_prefix(
- index, i) */
- ibool read_just_key, /*!< in: TRUE when MySQL calls
+ bool index_contains, /*!< in:
+ dict_index_t::contains_col_or_prefix(
+ i) */
+ bool read_just_key, /*!< in: TRUE when MySQL calls
ha_innobase::extra with the
argument HA_EXTRA_KEYREAD; it is enough
to read just columns defined in
the index (i.e., no read of the
clustered index record necessary) */
- ibool fetch_all_in_key,
+ bool fetch_all_in_key,
/*!< in: true=fetch all fields in
the index */
- ibool fetch_primary_key_cols,
+ bool fetch_primary_key_cols,
/*!< in: true=fetch the
primary key columns */
dict_index_t* index, /*!< in: InnoDB index to use */
@@ -7255,6 +7281,10 @@ build_template_needs_field(
{
const Field* field = table->field[i];
+ if (innobase_is_v_fld(field) && omits_virtual_cols(*table->s)) {
+ return NULL;
+ }
+
if (!index_contains) {
if (read_just_key) {
/* If this is a 'key read', we do not need
@@ -7279,7 +7309,6 @@ build_template_needs_field(
if (fetch_primary_key_cols
&& dict_table_col_in_clustered_key(index->table, i - num_v)) {
/* This field is needed in the query */
-
return(field);
}
@@ -7303,11 +7332,11 @@ build_template_needs_field_in_icp(
bool is_virtual)
/*!< in: a virtual column or not */
{
- ut_ad(contains == dict_index_contains_col_or_prefix(index, i, is_virtual));
+ ut_ad(contains == index->contains_col_or_prefix(i, is_virtual));
return(index == prebuilt->index
? contains
- : dict_index_contains_col_or_prefix(prebuilt->index, i, is_virtual));
+ : prebuilt->index->contains_col_or_prefix(i, is_virtual));
}
/**************************************************************//**
@@ -7332,17 +7361,11 @@ build_template_field(
templ = prebuilt->mysql_template + prebuilt->n_template++;
UNIV_MEM_INVALID(templ, sizeof *templ);
-
- if (innobase_is_v_fld(field)) {
- templ->is_virtual = true;
- col = &dict_table_get_nth_v_col(index->table, v_no)->m_col;
- } else {
- templ->is_virtual = false;
- col = dict_table_get_nth_col(index->table, i);
- }
+ templ->is_virtual = innobase_is_v_fld(field);
if (!templ->is_virtual) {
templ->col_no = i;
+ col = dict_table_get_nth_col(index->table, i);
templ->clust_rec_field_no = dict_col_get_clust_pos(
col, clust_index);
/* If clustered index record field is not found, lets print out
@@ -7381,7 +7404,7 @@ build_template_field(
<< table->field[j]->field_name.str;
}
- ib::error() << "Clustered record field for column " << i
+ ib::fatal() << "Clustered record field for column " << i
<< " not found table n_user_defined "
<< clust_index->n_user_defined_cols
<< " index n_user_defined "
@@ -7398,8 +7421,6 @@ build_template_field(
<< table->s->stored_fields
<< " query "
<< innobase_get_stmt_unsafe(current_thd, &size);
-
- ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED);
}
templ->rec_field_is_prefix = FALSE;
templ->rec_prefix_field_no = ULINT_UNDEFINED;
@@ -7417,6 +7438,8 @@ build_template_field(
&templ->rec_prefix_field_no);
}
} else {
+ ut_ad(!omits_virtual_cols(*table->s));
+ col = &dict_table_get_nth_v_col(index->table, v_no)->m_col;
templ->clust_rec_field_no = v_no;
templ->rec_prefix_field_no = ULINT_UNDEFINED;
@@ -7500,10 +7523,8 @@ ha_innobase::build_template(
{
dict_index_t* index;
dict_index_t* clust_index;
- ulint n_fields;
ibool fetch_all_in_key = FALSE;
ibool fetch_primary_key_cols = FALSE;
- ulint i;
if (m_prebuilt->select_lock_type == LOCK_X || m_prebuilt->table->no_rollback()) {
/* We always retrieve the whole clustered index record if we
@@ -7565,7 +7586,8 @@ ha_innobase::build_template(
m_prebuilt->pk_filter = NULL;
}
- n_fields = (ulint) mysql_fields(table);
+ const bool skip_virtual = omits_virtual_cols(*table_share);
+ const ulint n_fields = table_share->fields;
if (!m_prebuilt->mysql_template) {
m_prebuilt->mysql_template = (mysql_row_templ_t*)
@@ -7585,26 +7607,25 @@ ha_innobase::build_template(
/* Note that in InnoDB, i is the column number in the table.
MySQL calls columns 'fields'. */
+ ulint num_v = 0;
+
if ((active_index != MAX_KEY
&& active_index == pushed_idx_cond_keyno) ||
(pushed_rowid_filter && rowid_filter_is_active)) {
- ulint num_v = 0;
-
/* Push down an index condition or an end_range check. */
- for (i = 0; i < n_fields; i++) {
- ibool index_contains;
-
- if (innobase_is_v_fld(table->field[i])) {
- index_contains = dict_index_contains_col_or_prefix(
- index, num_v, true);
- if (index_contains)
- {
- m_prebuilt->n_template = 0;
- goto no_icp;
- }
- } else {
- index_contains = dict_index_contains_col_or_prefix(
- index, i - num_v, false);
+ for (ulint i = 0; i < n_fields; i++) {
+ const Field* field = table->field[i];
+ const bool is_v = innobase_is_v_fld(field);
+ if (is_v && skip_virtual) {
+ num_v++;
+ continue;
+ }
+ bool index_contains = index->contains_col_or_prefix(
+ is_v ? num_v : i - num_v, is_v);
+ if (is_v && index_contains) {
+ m_prebuilt->n_template = 0;
+ num_v = 0;
+ goto no_icp;
}
/* Test if an end_range or an index condition
@@ -7622,17 +7643,10 @@ ha_innobase::build_template(
the subset
field->part_of_key.is_set(active_index)
which would be acceptable if end_range==NULL. */
- bool is_v = innobase_is_v_fld(table->field[i]);
if (build_template_needs_field_in_icp(
index, m_prebuilt, index_contains,
is_v ? num_v : i - num_v, is_v)) {
- /* Needed in ICP */
- const Field* field;
- mysql_row_templ_t* templ;
-
- if (whole_row) {
- field = table->field[i];
- } else {
+ if (!whole_row) {
field = build_template_needs_field(
index_contains,
m_prebuilt->read_just_key,
@@ -7640,15 +7654,16 @@ ha_innobase::build_template(
fetch_primary_key_cols,
index, table, i, num_v);
if (!field) {
- if (innobase_is_v_fld(
- table->field[i])) {
+ if (is_v) {
num_v++;
}
continue;
}
}
- templ = build_template_field(
+ ut_ad(!is_v);
+
+ mysql_row_templ_t* templ= build_template_field(
m_prebuilt, clust_index, index,
table, field, i - num_v, 0);
@@ -7723,7 +7738,8 @@ ha_innobase::build_template(
< m_prebuilt->index->n_uniq);
*/
}
- if (innobase_is_v_fld(table->field[i])) {
+
+ if (is_v) {
num_v++;
}
}
@@ -7735,29 +7751,23 @@ ha_innobase::build_template(
/* Include the fields that are not needed in index condition
pushdown. */
- for (i = 0; i < n_fields; i++) {
+ for (ulint i = 0; i < n_fields; i++) {
mysql_row_templ_t* templ;
- ibool index_contains;
-
- if (innobase_is_v_fld(table->field[i])) {
- index_contains = dict_index_contains_col_or_prefix(
- index, num_v, true);
- } else {
- index_contains = dict_index_contains_col_or_prefix(
- index, i - num_v, false);
+ const Field* field = table->field[i];
+ const bool is_v = innobase_is_v_fld(field);
+ if (is_v && skip_virtual) {
+ num_v++;
+ continue;
}
- bool is_v = innobase_is_v_fld(table->field[i]);
+ bool index_contains = index->contains_col_or_prefix(
+ is_v ? num_v : i - num_v, is_v);
if (!build_template_needs_field_in_icp(
index, m_prebuilt, index_contains,
is_v ? num_v : i - num_v, is_v)) {
/* Not needed in ICP */
- const Field* field;
-
- if (whole_row) {
- field = table->field[i];
- } else {
+ if (!whole_row) {
field = build_template_needs_field(
index_contains,
m_prebuilt->read_just_key,
@@ -7765,7 +7775,7 @@ ha_innobase::build_template(
fetch_primary_key_cols,
index, table, i, num_v);
if (!field) {
- if (innobase_is_v_fld(table->field[i])) {
+ if (is_v) {
num_v++;
}
continue;
@@ -7775,8 +7785,9 @@ ha_innobase::build_template(
templ = build_template_field(
m_prebuilt, clust_index, index,
table, field, i - num_v, num_v);
+ ut_ad(templ->is_virtual == (ulint)is_v);
- if (templ->is_virtual) {
+ if (is_v) {
num_v++;
}
}
@@ -7787,24 +7798,29 @@ ha_innobase::build_template(
} else {
no_icp:
mysql_row_templ_t* templ;
- ulint num_v = 0;
/* No index condition pushdown */
m_prebuilt->idx_cond = NULL;
+ ut_ad(num_v == 0);
- for (i = 0; i < n_fields; i++) {
- const Field* field;
+ for (ulint i = 0; i < n_fields; i++) {
+ const Field* field = table->field[i];
+ const bool is_v = innobase_is_v_fld(field);
if (whole_row) {
+ if (is_v && skip_virtual) {
+ num_v++;
+ continue;
+ }
/* Even this is whole_row, if the seach is
on a virtual column, and read_just_key is
set, and field is not in this index, we
will not try to fill the value since they
are not stored in such index nor in the
cluster index. */
- if (innobase_is_v_fld(table->field[i])
+ if (is_v
&& m_prebuilt->read_just_key
- && !dict_index_contains_col_or_prefix(
- m_prebuilt->index, num_v, true))
+ && !m_prebuilt->index->contains_col_or_prefix(
+ num_v, true))
{
/* Turn off ROW_MYSQL_WHOLE_ROW */
m_prebuilt->template_type =
@@ -7812,23 +7828,15 @@ no_icp:
num_v++;
continue;
}
-
- field = table->field[i];
} else {
- ibool contain;
-
- if (!innobase_is_v_fld(table->field[i])) {
- contain = dict_index_contains_col_or_prefix(
- index, i - num_v,
- false);
- } else if (dict_index_is_clust(index)) {
+ if (is_v && index->is_primary()) {
num_v++;
continue;
- } else {
- contain = dict_index_contains_col_or_prefix(
- index, num_v, true);
}
+ bool contain = index->contains_col_or_prefix(
+ is_v ? num_v: i - num_v, is_v);
+
field = build_template_needs_field(
contain,
m_prebuilt->read_just_key,
@@ -7836,7 +7844,7 @@ no_icp:
fetch_primary_key_cols,
index, table, i, num_v);
if (!field) {
- if (innobase_is_v_fld(table->field[i])) {
+ if (is_v) {
num_v++;
}
continue;
@@ -7846,7 +7854,8 @@ no_icp:
templ = build_template_field(
m_prebuilt, clust_index, index,
table, field, i - num_v, num_v);
- if (templ->is_virtual) {
+ ut_ad(templ->is_virtual == (ulint)is_v);
+ if (is_v) {
num_v++;
}
}
@@ -7855,8 +7864,7 @@ no_icp:
if (index != clust_index && m_prebuilt->need_to_access_clustered) {
/* Change rec_field_no's to correspond to the clustered index
record */
- for (i = 0; i < m_prebuilt->n_template; i++) {
-
+ for (ulint i = 0; i < m_prebuilt->n_template; i++) {
mysql_row_templ_t* templ
= &m_prebuilt->mysql_template[i];
@@ -8110,9 +8118,9 @@ ha_innobase::write_row(
wsrep_thd_query(m_user_thd) :
(char *)"void");
error= DB_SUCCESS;
- wsrep_thd_set_conflict_state(
- m_user_thd, MUST_ABORT);
- innobase_srv_conc_exit_innodb(m_prebuilt);
+ wsrep_thd_self_abort(m_user_thd);
+ innobase_srv_conc_exit_innodb(
+ m_prebuilt);
/* jump straight to func exit over
* later wsrep hooks */
goto func_exit;
@@ -8182,10 +8190,14 @@ report_error:
#ifdef WITH_WSREP
if (!error_result
&& wsrep_on(m_user_thd)
- && wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE
+ && wsrep_thd_is_local(m_user_thd)
&& !wsrep_consistency_check(m_user_thd)
- && !wsrep_thd_ignore_table(m_user_thd)) {
- if (wsrep_append_keys(m_user_thd, false, record, NULL)) {
+ && (thd_sql_command(m_user_thd) != SQLCOM_CREATE_TABLE)
+ && (thd_sql_command(m_user_thd) != SQLCOM_LOAD ||
+ thd_binlog_format(m_user_thd) == BINLOG_FORMAT_ROW)) {
+ if (wsrep_append_keys(m_user_thd, WSREP_SERVICE_KEY_EXCLUSIVE,
+ record,
+ NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
@@ -8284,13 +8296,12 @@ calc_row_difference(
ulint n_changed = 0;
dfield_t dfield;
dict_index_t* clust_index;
- uint i;
ibool changes_fts_column = FALSE;
ibool changes_fts_doc_col = FALSE;
trx_t* const trx = prebuilt->trx;
doc_id_t doc_id = FTS_NULL_DOC_ID;
ulint num_v = 0;
- uint n_fields = mysql_fields(table);
+ const bool skip_virtual = omits_virtual_cols(*table->s);
ut_ad(!srv_read_only_mode);
@@ -8300,16 +8311,15 @@ calc_row_difference(
/* We use upd_buff to convert changed fields */
buf = (byte*) upd_buff;
- for (i = 0; i < n_fields; i++) {
+ for (uint i = 0; i < table->s->fields; i++) {
field = table->field[i];
- bool is_virtual = innobase_is_v_fld(field);
- dict_col_t* col;
-
- if (is_virtual) {
- col = &prebuilt->table->v_cols[num_v].m_col;
- } else {
- col = &prebuilt->table->cols[i - num_v];
+ const bool is_virtual = innobase_is_v_fld(field);
+ if (is_virtual && skip_virtual) {
+ continue;
}
+ dict_col_t* col = is_virtual
+ ? &prebuilt->table->v_cols[num_v].m_col
+ : &prebuilt->table->cols[i - num_v];
o_ptr = (const byte*) old_row + get_field_offset(table, field);
n_ptr = (const byte*) new_row + get_field_offset(table, field);
@@ -8665,33 +8675,25 @@ wsrep_calc_row_hash(
dictionary */
row_prebuilt_t* prebuilt) /*!< in: InnoDB prebuilt struct */
{
- Field* field;
- enum_field_types field_mysql_type;
- uint n_fields;
ulint len;
const byte* ptr;
- ulint col_type;
- uint i;
void *ctx = alloca(my_md5_context_size());
my_md5_init(ctx);
- n_fields = mysql_fields(table);
-
- for (i = 0; i < n_fields; i++) {
+ for (uint i = 0; i < table->s->fields; i++) {
byte null_byte=0;
byte true_byte=1;
- field = table->field[i];
+ const Field* field = table->field[i];
+ if (innobase_is_v_fld(field)) {
+ continue;
+ }
ptr = (const byte*) row + get_field_offset(table, field);
len = field->pack_length();
- field_mysql_type = field->type();
-
- col_type = prebuilt->table->cols[i].mtype;
-
- switch (col_type) {
+ switch (prebuilt->table->cols[i].mtype) {
case DATA_BLOB:
ptr = row_mysql_read_blob_ref(&len, ptr, len);
@@ -8701,7 +8703,7 @@ wsrep_calc_row_hash(
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_VARMYSQL:
- if (field_mysql_type == MYSQL_TYPE_VARCHAR) {
+ if (field->type() == MYSQL_TYPE_VARCHAR) {
/* This is a >= 5.0.3 type true VARCHAR where
the real payload data length is stored in
1 or 2 bytes */
@@ -8881,13 +8883,17 @@ func_exit:
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS &&
- wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE &&
- wsrep_on(m_user_thd) &&
- !wsrep_thd_ignore_table(m_user_thd)) {
+ if (error == DB_SUCCESS
+ && wsrep_on(m_user_thd)
+ && wsrep_thd_is_local(m_user_thd)) {
+
DBUG_PRINT("wsrep", ("update row key"));
- if (wsrep_append_keys(m_user_thd, false, old_row, new_row)) {
+ if (wsrep_append_keys(m_user_thd,
+ wsrep_protocol_version >= 4
+ ? WSREP_SERVICE_KEY_UPDATE
+ : WSREP_SERVICE_KEY_EXCLUSIVE,
+ old_row, new_row)){
WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED");
DBUG_PRINT("wsrep", ("row key failed"));
err = HA_ERR_INTERNAL_ERROR;
@@ -8947,11 +8953,14 @@ ha_innobase::delete_row(
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS &&
- wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE &&
- wsrep_on(m_user_thd) &&
- !wsrep_thd_ignore_table(m_user_thd)) {
- if (wsrep_append_keys(m_user_thd, false, record, NULL)) {
+ if (error == DB_SUCCESS
+ && wsrep_on(m_user_thd)
+ && wsrep_thd_is_local(m_user_thd)
+ && !wsrep_thd_ignore_table(m_user_thd)) {
+
+ if (wsrep_append_keys(m_user_thd, WSREP_SERVICE_KEY_EXCLUSIVE,
+ record,
+ NULL)) {
DBUG_PRINT("wsrep", ("delete fail"));
error = (dberr_t) HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
@@ -9374,7 +9383,6 @@ ha_innobase::innobase_get_index(
if (keynr != MAX_KEY && table->s->keys > 0) {
key = &table->key_info[keynr];
index = dict_table_get_index_on_name(ib_table, key->name.str);
- ut_ad(index);
} else {
index = dict_table_get_first_index(ib_table);
}
@@ -10135,6 +10143,22 @@ wsrep_dict_foreign_find_index(
ibool check_charsets,
ulint check_null);
+inline
+const char*
+wsrep_key_type_to_str(Wsrep_service_key_type type)
+{
+ switch (type) {
+ case WSREP_SERVICE_KEY_SHARED:
+ return "shared";
+ case WSREP_SERVICE_KEY_REFERENCE:
+ return "reference";
+ case WSREP_SERVICE_KEY_UPDATE:
+ return "update";
+ case WSREP_SERVICE_KEY_EXCLUSIVE:
+ return "exclusive";
+ };
+ return "unknown";
+}
extern dberr_t
wsrep_append_foreign_key(
@@ -10144,17 +10168,17 @@ wsrep_append_foreign_key(
const rec_t* rec, /*!<in: clustered index record */
dict_index_t* index, /*!<in: clustered index */
ibool referenced, /*!<in: is check for referenced table */
- ibool shared) /*!<in: is shared access */
+ Wsrep_service_key_type key_type) /*!< in: access type of this key
+ (shared, exclusive, reference...) */
{
ut_a(trx);
THD* thd = (THD*)trx->mysql_thd;
ulint rcode = DB_SUCCESS;
char cache_key[513] = {'\0'};
int cache_key_len=0;
- bool const copy = true;
if (!wsrep_on(trx->mysql_thd) ||
- wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
+ wsrep_thd_is_local(trx->mysql_thd) == false) {
return DB_SUCCESS;
}
@@ -10244,8 +10268,8 @@ wsrep_append_foreign_key(
if (rcode != DB_SUCCESS) {
WSREP_ERROR(
"FK key set failed: " ULINTPF
- " (" ULINTPF " " ULINTPF "), index: %s %s, %s",
- rcode, referenced, shared,
+ " (" ULINTPF "%s), index: %s %s, %s",
+ rcode, referenced, wsrep_key_type_to_str(key_type),
(index) ? index->name() : "void index",
(index && index->table) ? index->table->name.m_name :
"void table",
@@ -10264,7 +10288,7 @@ wsrep_append_foreign_key(
#ifdef WSREP_DEBUG_PRINT
ulint j;
fprintf(stderr, "FK parent key, table: %s %s len: %lu ",
- cache_key, (shared) ? "shared" : "exclusive", len+1);
+ cache_key, wsrep_key_type_to_str(key_type), len+1);
for (j=0; j<len+1; j++) {
fprintf(stderr, " %hhX, ", key[j]);
}
@@ -10283,7 +10307,8 @@ wsrep_append_foreign_key(
wsrep_buf_t wkey_part[3];
wsrep_key_t wkey = {wkey_part, 3};
- if (!wsrep_prepare_key(
+ if (!wsrep_prepare_key_for_innodb(
+ thd,
(const uchar*)cache_key,
cache_key_len + 1,
(const uchar*)key, len+1,
@@ -10294,17 +10319,7 @@ wsrep_append_foreign_key(
wsrep_thd_query(thd) : "void");
return DB_ERROR;
}
-
- wsrep_t *wsrep= get_wsrep();
-
- rcode = (int)wsrep->append_key(
- wsrep,
- wsrep_ws_handle(thd, trx),
- &wkey,
- 1,
- shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE,
- copy);
-
+ rcode = wsrep_thd_append_key(thd, &wkey, 1, key_type);
if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: " ULINTPF, rcode));
WSREP_ERROR("Appending cascaded fk row key failed: %s, "
@@ -10325,16 +10340,19 @@ wsrep_append_key(
TABLE_SHARE *table_share,
const char* key,
uint16_t key_len,
- bool shared
+ Wsrep_service_key_type key_type /*!< in: access type of this key
+ (shared, exclusive, semi...) */
)
{
DBUG_ENTER("wsrep_append_key");
- bool const copy = true;
+ DBUG_PRINT("enter",
+ ("thd: %lu trx: %lld", thd_get_thread_id(thd),
+ (long long)trx->id));
#ifdef WSREP_DEBUG_PRINT
- fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ",
- (shared) ? "Shared" : "Exclusive",
- thd_get_thread_id(thd), (long long)trx->id, key_len,
- table_share->table_name.str, wsrep_thd_query(thd));
+ fprintf(stderr, "%s conn %lu, trx " TRX_ID_FMT ", keylen %d, key %s.%s\n",
+ wsrep_key_type_to_str(key_type),
+ thd_get_thread_id(thd), trx->id, key_len,
+ table_share->table_name.str, key);
for (int i=0; i<key_len; i++) {
fprintf(stderr, "%hhX, ", key[i]);
}
@@ -10343,7 +10361,8 @@ wsrep_append_key(
wsrep_buf_t wkey_part[3];
wsrep_key_t wkey = {wkey_part, 3};
- if (!wsrep_prepare_key(
+ if (!wsrep_prepare_key_for_innodb(
+ thd,
(const uchar*)table_share->table_cache_key.str,
table_share->table_cache_key.length,
(const uchar*)key, key_len,
@@ -10355,15 +10374,7 @@ wsrep_append_key(
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
- wsrep_t *wsrep= get_wsrep();
-
- int rcode = (int)wsrep->append_key(
- wsrep,
- wsrep_ws_handle(thd, trx),
- &wkey,
- 1,
- shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE,
- copy);
+ int rcode = wsrep_thd_append_key(thd, &wkey, 1, key_type);
if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
WSREP_WARN("Appending row key failed: %s, %d",
@@ -10404,16 +10415,30 @@ int
ha_innobase::wsrep_append_keys(
/*===========================*/
THD *thd,
- bool shared,
+ Wsrep_service_key_type key_type, /*!< in: access type of this row
+ operation:
+ (shared, exclusive, reference...) */
const uchar* record0, /* in: row in MySQL format */
const uchar* record1) /* in: row in MySQL format */
{
+ /* Sanity check: newly inserted records should always be passed with
+ EXCLUSIVE key type, all the rest are expected to carry a pre-image
+ */
+ ut_a(record1 != NULL || key_type == WSREP_SERVICE_KEY_EXCLUSIVE);
+
int rcode;
DBUG_ENTER("wsrep_append_keys");
bool key_appended = false;
trx_t *trx = thd_to_trx(thd);
+#ifdef WSREP_DEBUG_PRINT
+ fprintf(stderr, "%s conn %lu, trx " TRX_ID_FMT ", table %s\nSQL: %s\n",
+ wsrep_key_type_to_str(key_type),
+ thd_get_thread_id(thd), trx->id,
+ table_share->table_name.str, wsrep_thd_query(thd));
+#endif
+
if (table_share && table_share->tmp_table != NO_TMP_TABLE) {
WSREP_DEBUG("skipping tmp table DML: THD: %lu tmp: %d SQL: %s",
thd_get_thread_id(thd),
@@ -10436,7 +10461,7 @@ ha_innobase::wsrep_append_keys(
if (!is_null) {
rcode = wsrep_append_key(
thd, trx, table_share, keyval,
- len, shared);
+ len, key_type);
if (rcode) {
DBUG_RETURN(rcode);
@@ -10454,68 +10479,91 @@ ha_innobase::wsrep_append_keys(
KEY* key_info = table->key_info + i;
if (key_info->flags & HA_NOSAME) {
hasPK = true;
+ break;
}
}
for (i=0; i<table->s->keys; ++i) {
- uint len;
- char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- char keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- char* key0 = &keyval0[1];
- char* key1 = &keyval1[1];
KEY* key_info = table->key_info + i;
- ibool is_null;
dict_index_t* idx = innobase_get_index(i);
dict_table_t* tab = (idx) ? idx->table : NULL;
+ /* keyval[] shall contain an ordinal number at byte 0
+ and the actual key data shall be written at byte 1.
+ Hence the total data length is the key length + 1 */
+ char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
+ char keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
keyval0[0] = (char)i;
keyval1[0] = (char)i;
+ char* key0 = &keyval0[1];
+ char* key1 = &keyval1[1];
if (!tab) {
WSREP_WARN("MariaDB-InnoDB key mismatch %s %s",
table->s->table_name.str,
key_info->name.str);
}
- /* !hasPK == table with no PK, must append all non-unique keys */
+ /* !hasPK == table with no PK,
+ must append all non-unique keys */
if (!hasPK || key_info->flags & HA_NOSAME ||
((tab &&
referenced_by_foreign_key2(tab, idx)) ||
(!tab && referenced_by_foreign_key()))) {
- len = wsrep_store_key_val_for_row(
+ ibool is_null0;
+ uint len0 = wsrep_store_key_val_for_row(
thd, table, i, key0,
WSREP_MAX_SUPPORTED_KEY_LENGTH,
- record0, &is_null);
- if (!is_null) {
- rcode = wsrep_append_key(
- thd, trx, table_share,
- keyval0, len+1, shared);
-
- if (rcode) {
- DBUG_RETURN(rcode);
- }
-
- if (key_info->flags & HA_NOSAME || shared)
- key_appended = true;
- } else {
- WSREP_DEBUG("NULL key skipped: %s",
- wsrep_thd_query(thd));
- }
+ record0, &is_null0);
if (record1) {
- len = wsrep_store_key_val_for_row(
+ ibool is_null1;
+ uint len1 = wsrep_store_key_val_for_row(
thd, table, i, key1,
WSREP_MAX_SUPPORTED_KEY_LENGTH,
- record1, &is_null);
+ record1, &is_null1);
+
+ if (is_null0 != is_null1 ||
+ len0 != len1 ||
+ memcmp(key0, key1, len0)) {
+ /* This key has chaged. If it
+ is unique, this is an exclusive
+ operation -> upgrade key type */
+ if (key_info->flags & HA_NOSAME) {
+ key_type = WSREP_SERVICE_KEY_EXCLUSIVE;
+ }
- if (!is_null && memcmp(key0, key1, len)) {
- rcode = wsrep_append_key(
+ if (!is_null1) {
+ rcode = wsrep_append_key(
thd, trx, table_share,
- keyval1, len+1, shared);
- if (rcode) DBUG_RETURN(rcode);
+ keyval1,
+ /* for len1+1 see keyval1
+ initialization comment */
+ len1+1, key_type);
+ if (rcode)
+ DBUG_RETURN(rcode);
+ }
}
}
+
+ if (!is_null0) {
+ rcode = wsrep_append_key(
+ thd, trx, table_share,
+ /* for len0+1 see keyval0
+ initialization comment */
+ keyval0, len0+1, key_type);
+ if (rcode)
+ DBUG_RETURN(rcode);
+
+ if (key_info->flags & HA_NOSAME ||
+ key_type == WSREP_SERVICE_KEY_SHARED||
+ key_type == WSREP_SERVICE_KEY_REFERENCE)
+ key_appended = true;
+ } else {
+ WSREP_DEBUG("NULL key skipped: %s",
+ wsrep_thd_query(thd));
+ }
}
}
}
@@ -10529,7 +10577,7 @@ ha_innobase::wsrep_append_keys(
if ((rcode = wsrep_append_key(thd, trx, table_share,
(const char*) digest, 16,
- shared))) {
+ key_type))) {
DBUG_RETURN(rcode);
}
@@ -10538,7 +10586,7 @@ ha_innobase::wsrep_append_keys(
digest, record1, table, m_prebuilt);
if ((rcode = wsrep_append_key(thd, trx, table_share,
(const char*) digest,
- 16, shared))) {
+ 16, key_type))) {
DBUG_RETURN(rcode);
}
}
@@ -10603,9 +10651,9 @@ create_table_check_doc_id_col(
ULINT_UNDEFINED if column is of the
wrong type/name/size */
{
- uint n_fields = mysql_fields(form);
+ ut_ad(!omits_virtual_cols(*form->s));
- for (ulint i = 0; i < n_fields; i++) {
+ for (ulint i = 0; i < form->s->fields; i++) {
const Field* field;
ulint col_type;
ulint col_len;
@@ -10798,6 +10846,7 @@ create_table_info_t::create_table_def()
DBUG_PRINT("enter", ("table_name: %s", m_table_name));
DBUG_ASSERT(m_trx->mysql_thd == m_thd);
+ DBUG_ASSERT(!m_drop_before_rollback);
/* MySQL does the name length check. But we do additional check
on the name length here */
@@ -11046,9 +11095,8 @@ err_col:
dict_table_add_system_columns(table, heap);
if (table->is_temporary()) {
- /* Get a new table ID. FIXME: Make this a private
- sequence, not shared with persistent tables! */
- dict_table_assign_new_id(table, m_trx);
+ m_trx->table_id = table->id
+ = dict_sys->get_temporary_table_id();
ut_ad(dict_tf_get_rec_format(table->flags)
!= REC_FORMAT_COMPRESSED);
table->space_id = SRV_TMP_SPACE_ID;
@@ -11060,6 +11108,7 @@ err_col:
table, m_trx,
(fil_encryption_t)options->encryption,
(uint32_t)options->encryption_key_id);
+ m_drop_before_rollback = (err == DB_SUCCESS);
}
DBUG_EXECUTE_IF("ib_crash_during_create_for_encryption",
@@ -11075,9 +11124,6 @@ err_col:
case DB_SUCCESS:
ut_ad(table);
m_table = table;
- if (m_flags2 & DICT_TF2_FTS) {
- fts_optimize_add_table(table);
- }
DBUG_RETURN(0);
default:
break;
@@ -11096,7 +11142,8 @@ err_col:
: ER_TABLESPACE_EXISTS, MYF(0), display_name);
}
- DBUG_RETURN(convert_error_code_to_mysql(err, m_flags, m_thd));}
+ DBUG_RETURN(convert_error_code_to_mysql(err, m_flags, m_thd));
+}
/*****************************************************************//**
Creates an index in an InnoDB database. */
@@ -11301,7 +11348,7 @@ create_table_info_t::create_option_data_directory_is_valid()
}
/* Do not use DATA DIRECTORY with TEMPORARY TABLE. */
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
+ if (m_create_info->tmp_table()) {
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -11330,8 +11377,7 @@ create_table_info_t::create_options_are_invalid()
const char* ret = NULL;
enum row_type row_format = m_create_info->row_type;
- const bool is_temp
- = m_create_info->options & HA_LEX_CREATE_TMP_TABLE;
+ const bool is_temp = m_create_info->tmp_table();
ut_ad(m_thd != NULL);
@@ -11479,7 +11525,7 @@ Check engine specific table options not handled by SQL-parser.
const char*
create_table_info_t::check_table_options()
{
- enum row_type row_format = m_form->s->row_type;
+ enum row_type row_format = m_create_info->row_type;
ha_table_option_struct *options= m_form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
bool should_encrypt = (encrypt == FIL_ENCRYPTION_ON);
@@ -11526,7 +11572,16 @@ create_table_info_t::check_table_options()
return "PAGE_COMPRESSED";
}
- if (row_format == ROW_TYPE_REDUNDANT) {
+ switch (row_format) {
+ default:
+ break;
+ case ROW_TYPE_DEFAULT:
+ if (m_default_row_format
+ != DEFAULT_ROW_FORMAT_REDUNDANT) {
+ break;
+ }
+ /* fall through */
+ case ROW_TYPE_REDUNDANT:
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
@@ -11688,7 +11743,7 @@ create_table_info_t::parse_table_name(
if (m_innodb_file_per_table
&& !mysqld_embedded
- && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
+ && !m_create_info->tmp_table()) {
if ((name[1] == ':')
|| (name[0] == '\\' && name[1] == '\\')) {
@@ -11732,9 +11787,9 @@ create_table_info_t::parse_table_name(
/** Determine InnoDB table flags.
If strict_mode=OFF, this will adjust the flags to what should be assumed.
-@retval true if successful, false if error */
-bool
-create_table_info_t::innobase_table_flags()
+@retval true on success
+@retval false on error */
+bool create_table_info_t::innobase_table_flags()
{
DBUG_ENTER("innobase_table_flags");
@@ -11742,11 +11797,9 @@ create_table_info_t::innobase_table_flags()
ulint zip_ssize = 0;
enum row_type row_type;
rec_format_t innodb_row_format =
- get_row_format(innodb_default_row_format);
- const bool is_temp
- = m_create_info->options & HA_LEX_CREATE_TMP_TABLE;
- bool zip_allowed
- = !is_temp;
+ get_row_format(m_default_row_format);
+ const bool is_temp = m_create_info->tmp_table();
+ bool zip_allowed = !is_temp;
const ulint zip_ssize_max =
ut_min(static_cast<ulint>(UNIV_PAGE_SSIZE_MAX),
@@ -11843,7 +11896,7 @@ index_bad:
}
}
- row_type = m_form->s->row_type;
+ row_type = m_create_info->row_type;
if (zip_ssize && zip_allowed) {
/* if ROW_FORMAT is set to default,
@@ -12146,9 +12199,8 @@ create_table_info_t::set_tablespace_type(
/* Ignore the current innodb-file-per-table setting if we are
creating a temporary table. */
- m_use_file_per_table =
- m_allow_file_per_table
- && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE);
+ m_use_file_per_table = m_allow_file_per_table
+ && !m_create_info->tmp_table();
/* DATA DIRECTORY must have m_use_file_per_table but cannot be
used with TEMPORARY tables. */
@@ -12179,8 +12231,6 @@ create_table_info_t::initialize()
DBUG_RETURN(HA_ERR_WRONG_INDEX);
}
- ut_ad(m_form->s->row_type == m_create_info->row_type);
-
/* Get the transaction associated with the current thd, or create one
if not yet created */
@@ -12224,8 +12274,6 @@ int create_table_info_t::prepare_create_table(const char* name, bool strict)
ut_ad(m_thd != NULL);
ut_ad(m_create_info != NULL);
- ut_ad(m_form->s->row_type == m_create_info->row_type);
-
set_tablespace_type(false);
normalize_table_name(m_table_name, name);
@@ -12267,8 +12315,6 @@ int create_table_info_t::create_table(bool create_fk)
int error;
int primary_key_no;
uint i;
- const char* stmt;
- size_t stmt_len;
DBUG_ENTER("create_table");
@@ -12286,6 +12332,9 @@ int create_table_info_t::create_table(bool create_fk)
DBUG_RETURN(error);
}
+ DBUG_ASSERT(m_drop_before_rollback
+ == !(m_flags2 & DICT_TF2_TEMPORARY));
+
/* Create the keys */
if (m_form->s->keys == 0 || primary_key_no == -1) {
@@ -12344,8 +12393,7 @@ int create_table_info_t::create_table(bool create_fk)
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
FTS_DOC_ID_INDEX_NAME);
- error = -1;
- DBUG_RETURN(error);
+ DBUG_RETURN(-1);
case FTS_EXIST_DOC_ID_INDEX:
case FTS_NOT_EXIST_DOC_ID_INDEX:
break;
@@ -12358,10 +12406,6 @@ int create_table_info_t::create_table(bool create_fk)
error = convert_error_code_to_mysql(err, 0, NULL);
if (error) {
- row_drop_table_for_mysql(m_table_name, m_trx,
- SQLCOM_DROP_DB);
- trx_rollback_to_savepoint(m_trx, NULL);
- m_trx->error_state = DB_SUCCESS;
DBUG_RETURN(error);
}
}
@@ -12383,15 +12427,28 @@ int create_table_info_t::create_table(bool create_fk)
dict_table_get_all_fts_indexes(m_table, fts->indexes);
}
- stmt = innobase_get_stmt_unsafe(m_thd, &stmt_len);
-
- if (stmt) {
- dberr_t err = row_table_add_foreign_constraints(
- create_fk ? m_trx : NULL, stmt, stmt_len, m_table_name,
- m_create_info->options & HA_LEX_CREATE_TMP_TABLE);
+ size_t stmt_len;
+ if (const char* stmt = innobase_get_stmt_unsafe(m_thd, &stmt_len)) {
+ dberr_t err = create_fk
+ ? dict_create_foreign_constraints(
+ m_trx, stmt, stmt_len, m_table_name,
+ m_flags2 & DICT_TF2_TEMPORARY)
+ : DB_SUCCESS;
+ if (err == DB_SUCCESS) {
+ /* Check that also referencing constraints are ok */
+ dict_names_t fk_tables;
+ err = dict_load_foreigns(m_table_name, NULL,
+ false, true,
+ DICT_ERR_IGNORE_NONE,
+ fk_tables);
+ while (err == DB_SUCCESS && !fk_tables.empty()) {
+ dict_load_table(fk_tables.front(), true,
+ DICT_ERR_IGNORE_NONE);
+ fk_tables.pop_front();
+ }
+ }
switch (err) {
-
case DB_PARENT_NO_INDEX:
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
@@ -12424,10 +12481,9 @@ int create_table_info_t::create_table(bool create_fk)
break;
}
- error = convert_error_code_to_mysql(err, m_flags, NULL);
-
- if (error) {
- DBUG_RETURN(error);
+ if (err != DB_SUCCESS) {
+ DBUG_RETURN(convert_error_code_to_mysql(
+ err, m_flags, NULL));
}
}
@@ -12476,6 +12532,10 @@ create_table_info_t::create_table_update_dict()
trx_free(m_trx);
DBUG_RETURN(-1);
}
+
+ mutex_enter(&dict_sys->mutex);
+ fts_optimize_add_table(innobase_table);
+ mutex_exit(&dict_sys->mutex);
}
if (const Field* ai = m_form->found_next_number_field) {
@@ -12585,14 +12645,21 @@ ha_innobase::create(
}
if ((error = info.create_table(own_trx))) {
- row_drop_table_for_mysql(norm_name, trx, SQLCOM_DROP_TABLE,
- true);
+ /* Drop the being-created table before rollback,
+ so that rollback can possibly rename back a table
+ that could have been renamed before the failed creation. */
+ if (info.drop_before_rollback()) {
+ trx->error_state = DB_SUCCESS;
+ row_drop_table_for_mysql(info.table_name(),
+ trx, SQLCOM_TRUNCATE, true,
+ false);
+ }
trx_rollback_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
if (own_trx) {
trx_free(trx);
- DBUG_RETURN(error);
}
+ DBUG_RETURN(error);
}
innobase_commit_low(trx);
@@ -12937,16 +13004,25 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom)
int ha_innobase::delete_table(const char* name)
{
enum_sql_command sqlcom = enum_sql_command(thd_sql_command(ha_thd()));
-
- if (sqlcom == SQLCOM_TRUNCATE
- && thd_killed(ha_thd())
- && (m_prebuilt == NULL || m_prebuilt->table->is_temporary())) {
- sqlcom = SQLCOM_DROP_TABLE;
- }
-
- /* SQLCOM_TRUNCATE will be passed via ha_innobase::truncate() only. */
- DBUG_ASSERT(sqlcom != SQLCOM_TRUNCATE);
- return delete_table(name, sqlcom);
+ /* SQLCOM_TRUNCATE should be passed via ha_innobase::truncate() only.
+
+ On client disconnect, when dropping temporary tables, the
+ previous sqlcom would not be overwritten. In such a case, we
+ will have thd_kill_level() != NOT_KILLED, !m_prebuilt can
+ hold, and sqlcom could be anything, including TRUNCATE.
+
+ The sqlcom only matters for persistent tables; no persistent
+ metadata or FOREIGN KEY metadata is kept for temporary
+ tables. Therefore, we relax the assertion. If there is a bug
+ that slips through this assertion due to !m_prebuilt, the
+ worst impact should be that on DROP TABLE of a persistent
+ table, FOREIGN KEY constraints will be ignored and their
+ metadata will not be removed. */
+ DBUG_ASSERT(sqlcom != SQLCOM_TRUNCATE
+ || (thd_kill_level(ha_thd()) != THD_IS_NOT_KILLED
+ && (!m_prebuilt
+ || m_prebuilt->table->is_temporary())));
+ return delete_table(name, sqlcom);
}
/** Remove all tables in the named database inside InnoDB.
@@ -13025,6 +13101,7 @@ innobase_drop_database(
@param[in] from old table name
@param[in] to new table name
@param[in] commit whether to commit trx
+@param[in] use_fk whether to parse and enforce FOREIGN KEY constraints
@return DB_SUCCESS or error code */
inline
dberr_t
@@ -13032,7 +13109,8 @@ innobase_rename_table(
trx_t* trx,
const char* from,
const char* to,
- bool commit = true)
+ bool commit,
+ bool use_fk)
{
dberr_t error;
char norm_to[FN_REFLEN];
@@ -13087,7 +13165,8 @@ innobase_rename_table(
goto func_exit;
}
- error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit);
+ error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit,
+ use_fk);
if (error != DB_SUCCESS) {
if (error == DB_TABLE_NOT_FOUND
@@ -13112,7 +13191,8 @@ innobase_rename_table(
#endif /* _WIN32 */
trx_start_if_not_started(trx, true);
error = row_rename_table_for_mysql(
- par_case_name, norm_to, trx, TRUE);
+ par_case_name, norm_to, trx,
+ true, false);
}
}
@@ -13168,7 +13248,7 @@ int ha_innobase::truncate()
dict_table_t* ib_table = m_prebuilt->table;
const time_t update_time = ib_table->update_time;
const ulint stored_lock = m_prebuilt->stored_select_lock_type;
- memset(&info, 0, sizeof info);
+ info.init();
update_create_info_from_table(&info, table);
if (ib_table->is_temporary()) {
@@ -13193,14 +13273,31 @@ int ha_innobase::truncate()
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
row_mysql_lock_data_dictionary(trx);
int err = convert_error_code_to_mysql(
- innobase_rename_table(trx, ib_table->name.m_name, temp_name, false),
+ innobase_rename_table(trx, ib_table->name.m_name, temp_name,
+ false, false),
ib_table->flags, m_user_thd);
if (err) {
trx_rollback_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
} else {
+ switch (dict_tf_get_rec_format(ib_table->flags)) {
+ case REC_FORMAT_REDUNDANT:
+ info.row_type = ROW_TYPE_REDUNDANT;
+ break;
+ case REC_FORMAT_COMPACT:
+ info.row_type = ROW_TYPE_COMPACT;
+ break;
+ case REC_FORMAT_COMPRESSED:
+ info.row_type = ROW_TYPE_COMPRESSED;
+ break;
+ case REC_FORMAT_DYNAMIC:
+ info.row_type = ROW_TYPE_DYNAMIC;
+ break;
+ }
+
err = create(name, table, &info,
- dict_table_is_file_per_table(ib_table), trx);
+ ib_table->is_temporary()
+ || dict_table_is_file_per_table(ib_table), trx);
}
trx_free(trx);
@@ -13246,7 +13343,7 @@ ha_innobase::rename_table(
++trx->will_lock;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- dberr_t error = innobase_rename_table(trx, from, to);
+ dberr_t error = innobase_rename_table(trx, from, to, true, true);
DEBUG_SYNC(thd, "after_innobase_rename_table");
@@ -14386,20 +14483,9 @@ ha_innobase::check(
if (!(check_opt->flags & T_QUICK)
&& !index->is_corrupted()) {
- /* Enlarge the fatal lock wait timeout during
- CHECK TABLE. */
- my_atomic_addlong(
- &srv_fatal_semaphore_wait_threshold,
- SRV_SEMAPHORE_WAIT_EXTENSION);
dberr_t err = btr_validate_index(
- index, m_prebuilt->trx, false);
-
- /* Restore the fatal lock wait timeout after
- CHECK TABLE. */
- my_atomic_addlong(
- &srv_fatal_semaphore_wait_threshold,
- -SRV_SEMAPHORE_WAIT_EXTENSION);
+ index, m_prebuilt->trx);
if (err != DB_SUCCESS) {
is_ok = false;
@@ -15381,8 +15467,7 @@ ha_innobase::external_lock(
if (!skip) {
#ifdef WITH_WSREP
- if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
- {
+ if (!wsrep_on(thd) || wsrep_thd_is_local(m_user_thd)) {
#endif /* WITH_WSREP */
my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
" InnoDB is limited to row-logging when"
@@ -16896,6 +16981,14 @@ innobase_rollback_by_xid(
}
if (trx_t* trx = trx_get_trx_by_xid(xid)) {
+#ifdef WITH_WSREP
+ /* If a wsrep transaction is being rolled back during
+ the recovery, we must clear the xid in order to avoid
+ writing serialisation history for rolled back transaction. */
+ if (wsrep_is_wsrep_xid(trx->xid)) {
+ trx->xid->null();
+ }
+#endif /* WITH_WSREP */
int ret = innobase_rollback_trx(trx);
trx_deregister_from_2pc(trx);
ut_ad(!trx->will_lock);
@@ -17102,9 +17195,7 @@ fast_shutdown_validate(
uint new_val = *reinterpret_cast<uint*>(save);
if (srv_fast_shutdown && !new_val
- && !my_atomic_loadptr_explicit(reinterpret_cast<void**>
- (&srv_running),
- MY_MEMORY_ORDER_RELAXED)) {
+ && !srv_running.load(std::memory_order_relaxed)) {
return(1);
}
@@ -18498,123 +18589,32 @@ wsrep_innobase_kill_one_trx(
bf_trx ? bf_trx->id : 0);
DBUG_RETURN(1);
}
-
WSREP_LOG_CONFLICT(bf_thd, thd, TRUE);
-
+ wsrep_thd_LOCK(thd);
WSREP_DEBUG("BF kill (" ULINTPF ", seqno: " INT64PF
"), victim: (%lu) trx: " TRX_ID_FMT,
signal, bf_seqno,
thd_get_thread_id(thd),
victim_trx->id);
- WSREP_DEBUG("Aborting query: %s conf %d trx: %" PRId64,
+ WSREP_DEBUG("Aborting query: %s conf %s trx: %lld",
(thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void",
- wsrep_thd_conflict_state(thd, FALSE),
- wsrep_thd_ws_handle(thd)->trx_id);
-
- wsrep_thd_LOCK(thd);
- DBUG_EXECUTE_IF("sync.wsrep_after_BF_victim_lock",
- {
- const char act[]=
- "now "
- "wait_for signal.wsrep_after_BF_victim_lock";
- DBUG_ASSERT(!debug_sync_set_action(bf_thd,
- STRING_WITH_LEN(act)));
- };);
-
-
- if (wsrep_thd_query_state(thd) == QUERY_EXITING) {
- WSREP_DEBUG("kill trx EXITING for " TRX_ID_FMT,
- victim_trx->id);
- wsrep_thd_UNLOCK(thd);
- DBUG_RETURN(0);
- }
-
- if (wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
- WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %d",
- victim_trx->id,
- wsrep_thd_get_conflict_state(thd));
- }
-
- switch (wsrep_thd_get_conflict_state(thd)) {
- case NO_CONFLICT:
- wsrep_thd_set_conflict_state(thd, MUST_ABORT);
- break;
- case MUST_ABORT:
- WSREP_DEBUG("victim " TRX_ID_FMT " in MUST ABORT state",
- victim_trx->id);
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
- DBUG_RETURN(0);
- break;
- case ABORTED:
- case ABORTING: // fall through
- default:
- WSREP_DEBUG("victim " TRX_ID_FMT " in state %d",
- victim_trx->id, wsrep_thd_get_conflict_state(thd));
- wsrep_thd_UNLOCK(thd);
- DBUG_RETURN(0);
- break;
- }
-
- switch (wsrep_thd_query_state(thd)) {
- case QUERY_COMMITTING:
- enum wsrep_status rcode;
-
- WSREP_DEBUG("kill query for: %ld",
- thd_get_thread_id(thd));
- WSREP_DEBUG("kill trx QUERY_COMMITTING for " TRX_ID_FMT,
- victim_trx->id);
-
- if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
- wsrep_abort_slave_trx(bf_seqno,
- wsrep_thd_trx_seqno(thd));
- } else {
- wsrep_t *wsrep= get_wsrep();
- rcode = wsrep->abort_pre_commit(
- wsrep, bf_seqno,
- (wsrep_trx_id_t)wsrep_thd_ws_handle(thd)->trx_id
- );
-
- switch (rcode) {
- case WSREP_WARNING:
- WSREP_DEBUG("cancel commit warning: "
- TRX_ID_FMT,
- victim_trx->id);
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
- DBUG_RETURN(1);
- break;
- case WSREP_OK:
- break;
- default:
- WSREP_ERROR(
- "cancel commit bad exit: %d "
- TRX_ID_FMT,
- rcode, victim_trx->id);
- /* unable to interrupt, must abort */
- /* note: kill_mysql() will block, if we cannot.
- * kill the lock holder first.
- */
- abort();
- break;
- }
- }
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
- break;
- case QUERY_EXEC:
- /* it is possible that victim trx is itself waiting for some
- * other lock. We need to cancel this waiting
- */
- WSREP_DEBUG("kill trx QUERY_EXEC for " TRX_ID_FMT,
- victim_trx->id);
-
- victim_trx->lock.was_chosen_as_deadlock_victim= TRUE;
-
+ wsrep_thd_transaction_state_str(thd),
+ wsrep_thd_transaction_id(thd));
+
+ /*
+ * we mark with was_chosen_as_deadlock_victim transaction,
+ * which is already marked as BF victim
+ * lock_sys is held until this vicitm has aborted
+ */
+ victim_trx->lock.was_chosen_as_wsrep_victim = TRUE;
+
+ wsrep_thd_UNLOCK(thd);
+ if (wsrep_thd_bf_abort(bf_thd, thd, signal))
+ {
if (victim_trx->lock.wait_lock) {
- WSREP_DEBUG("victim has wait flag: %ld",
- thd_get_thread_id(thd));
+ WSREP_DEBUG("victim has wait flag: %lu",
+ thd_get_thread_id(thd));
lock_t* wait_lock = victim_trx->lock.wait_lock;
if (wait_lock) {
@@ -18622,67 +18622,7 @@ wsrep_innobase_kill_one_trx(
victim_trx->lock.was_chosen_as_deadlock_victim= TRUE;
lock_cancel_waiting_and_release(wait_lock);
}
-
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
- } else {
- /* abort currently executing query */
- DBUG_PRINT("wsrep",("sending KILL_QUERY to: %lu",
- thd_get_thread_id(thd)));
- WSREP_DEBUG("kill query for: %ld",
- thd_get_thread_id(thd));
- /* Note that innobase_kill_query will take lock_mutex
- and trx_mutex */
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
-
- /* for BF thd, we need to prevent him from committing */
- if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
- wsrep_abort_slave_trx(bf_seqno,
- wsrep_thd_trx_seqno(thd));
- }
- }
- break;
- case QUERY_IDLE:
- {
- WSREP_DEBUG("kill IDLE for " TRX_ID_FMT, victim_trx->id);
-
- if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
- WSREP_DEBUG("kill BF IDLE, seqno: %lld",
- (long long)wsrep_thd_trx_seqno(thd));
- wsrep_thd_UNLOCK(thd);
- wsrep_abort_slave_trx(bf_seqno,
- wsrep_thd_trx_seqno(thd));
- DBUG_RETURN(0);
- }
- /* This will lock thd from proceeding after net_read() */
- wsrep_thd_set_conflict_state(thd, ABORTING);
-
- wsrep_lock_rollback();
-
- if (wsrep_aborting_thd_contains(thd)) {
- WSREP_WARN("duplicate thd aborter %lu",
- (ulong) thd_get_thread_id(thd));
- } else {
- wsrep_aborting_thd_enqueue(thd);
- DBUG_PRINT("wsrep",("enqueuing trx abort for %lu",
- thd_get_thread_id(thd)));
- WSREP_DEBUG("enqueuing trx abort for (%lu)",
- thd_get_thread_id(thd));
}
-
- DBUG_PRINT("wsrep",("signalling wsrep rollbacker"));
- WSREP_DEBUG("signaling aborter");
- wsrep_unlock_rollback();
- wsrep_thd_UNLOCK(thd);
-
- break;
- }
- default:
- WSREP_WARN("bad wsrep query state: %d",
- wsrep_thd_query_state(thd));
- wsrep_thd_UNLOCK(thd);
- break;
}
DBUG_RETURN(0);
@@ -18702,26 +18642,22 @@ wsrep_abort_transaction(
trx_t* victim_trx = thd_to_trx(victim_thd);
trx_t* bf_trx = (bf_thd) ? thd_to_trx(bf_thd) : NULL;
- WSREP_DEBUG("abort transaction: BF: %s victim: %s victim conf: %d",
+ WSREP_DEBUG("abort transaction: BF: %s victim: %s victim conf: %s",
wsrep_thd_query(bf_thd),
wsrep_thd_query(victim_thd),
- wsrep_thd_conflict_state(victim_thd, FALSE));
+ wsrep_thd_transaction_state_str(victim_thd));
if (victim_trx) {
lock_mutex_enter();
trx_mutex_enter(victim_trx);
- int rcode = wsrep_innobase_kill_one_trx(bf_thd, bf_trx,
- victim_trx, signal);
- lock_mutex_exit();
+ int rcode= wsrep_innobase_kill_one_trx(bf_thd, bf_trx,
+ victim_trx, signal);
trx_mutex_exit(victim_trx);
+ lock_mutex_exit();
wsrep_srv_conc_cancel_wait(victim_trx);
DBUG_RETURN(rcode);
} else {
- WSREP_DEBUG("victim does not have transaction");
- wsrep_thd_LOCK(victim_thd);
- wsrep_thd_set_conflict_state(victim_thd, MUST_ABORT);
- wsrep_thd_UNLOCK(victim_thd);
- wsrep_thd_awake(victim_thd, signal);
+ wsrep_thd_bf_abort(bf_thd, victim_thd, signal);
}
DBUG_RETURN(-1);
@@ -18757,15 +18693,6 @@ innobase_wsrep_get_checkpoint(
trx_rseg_read_wsrep_checkpoint(*xid);
return 0;
}
-
-static void wsrep_fake_trx_id(handlerton *, THD *thd)
-{
- trx_id_t trx_id = trx_sys.get_new_trx_id();
- WSREP_DEBUG("innodb fake trx id: " TRX_ID_FMT " thd: %s",
- trx_id, wsrep_thd_query(thd));
- wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id);
-}
-
#endif /* WITH_WSREP */
/* plugin options */
@@ -21041,7 +20968,7 @@ const char* BUG_REPORT_MSG =
const char* FORCE_RECOVERY_MSG =
"Please refer to "
- "https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/"
+ "https://mariadb.com/kb/en/library/innodb-recovery-modes/"
" for information about forcing recovery.";
const char* ERROR_CREATING_MSG =
@@ -21059,7 +20986,7 @@ const char* SET_TRANSACTION_MSG =
"Please refer to https://mariadb.com/kb/en/library/set-transaction/";
const char* INNODB_PARAMETERS_MSG =
- "Please refer to https://mariadb.com/kb/en/library/xtradbinnodb-server-system-variables/";
+ "Please refer to https://mariadb.com/kb/en/library/innodb-system-variables/";
/**********************************************************************
Converts an identifier from my_charset_filename to UTF-8 charset.
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index d6c1154ba8f..bdda410ea19 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -16,6 +16,10 @@ this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
+#ifdef WITH_WSREP
+#include "wsrep_api.h"
+#include <mysql/service_wsrep.h>
+#endif /* WITH_WSREP */
/* The InnoDB handler: the interface between MySQL and InnoDB. */
@@ -450,8 +454,11 @@ protected:
dict_index_t* innobase_get_index(uint keynr);
#ifdef WITH_WSREP
- int wsrep_append_keys(THD *thd, bool shared,
- const uchar* record0, const uchar* record1);
+ int wsrep_append_keys(
+ THD *thd,
+ Wsrep_service_key_type key_type,
+ const uchar* record0,
+ const uchar* record1);
#endif
/** Builds a 'template' to the prebuilt struct.
@@ -577,23 +584,7 @@ thd_get_work_part_info(
struct trx_t;
#ifdef WITH_WSREP
#include <mysql/service_wsrep.h>
-//extern "C" int wsrep_trx_order_before(void *thd1, void *thd2);
-
-extern "C" bool wsrep_thd_is_wsrep_on(THD *thd);
-
-
-extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode);
-extern "C" void wsrep_thd_set_query_state(
- THD *thd, enum wsrep_query_state state);
-
-extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id);
-
-extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd);
-extern "C" time_t wsrep_thd_query_start(THD *thd);
-extern "C" query_id_t wsrep_thd_query_id(THD *thd);
-extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd);
-extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id);
-#endif
+#endif /* WITH_WSREP */
extern const struct _ft_vft ft_vft_result;
@@ -627,10 +618,6 @@ innobase_index_name_is_reserved(
be created. */
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
-#ifdef WITH_WSREP
-//extern "C" int wsrep_trx_is_aborting(void *thd_ptr);
-#endif
-
/** Parse hint for table and its indexes, and update the information
in dictionary.
@param[in] thd Connection thread
@@ -657,15 +644,7 @@ public:
char* table_name,
char* remote_path,
bool file_per_table,
- trx_t* trx = NULL)
- :m_thd(thd),
- m_trx(trx),
- m_form(form),
- m_create_info(create_info),
- m_table_name(table_name), m_table(NULL),
- m_remote_path(remote_path),
- m_innodb_file_per_table(file_per_table)
- {}
+ trx_t* trx = NULL);
/** Initialize the object. */
int initialize();
@@ -735,6 +714,9 @@ public:
const char* table_name() const
{ return(m_table_name); }
+ /** @return whether the table needs to be dropped on rollback */
+ bool drop_before_rollback() const { return m_drop_before_rollback; }
+
THD* thd() const
{ return(m_thd); }
@@ -771,6 +753,9 @@ private:
/** Information on table columns and indexes. */
const TABLE* m_form;
+ /** Value of innodb_default_row_format */
+ const ulong m_default_row_format;
+
/** Create options. */
HA_CREATE_INFO* m_create_info;
@@ -778,6 +763,8 @@ private:
char* m_table_name;
/** Table */
dict_table_t* m_table;
+ /** Whether the table needs to be dropped before rollback */
+ bool m_drop_before_rollback;
/** Remote path (DATA DIRECTORY) or zero length-string */
char* m_remote_path;
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index fdfb9192cfd..a3e2349b10d 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -23,7 +23,7 @@ Smart ALTER TABLE
*******************************************************/
/* Include necessary SQL headers */
-#include "ha_prototypes.h"
+#include "univ.i"
#include <debug_sync.h>
#include <log.h>
#include <sql_lex.h>
@@ -38,7 +38,6 @@ Smart ALTER TABLE
#include "dict0priv.h"
#include "dict0stats.h"
#include "dict0stats_bg.h"
-#include "fsp0sysspace.h"
#include "log0log.h"
#include "rem0types.h"
#include "row0log.h"
@@ -56,7 +55,6 @@ Smart ALTER TABLE
#include "pars0pars.h"
#include "row0sel.h"
#include "ha_innodb.h"
-#include "ut0new.h"
#include "ut0stage.h"
static const char *MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN=
@@ -138,6 +136,87 @@ static const alter_table_operations INNOBASE_ALTER_INSTANT
| ALTER_COLUMN_UNVERSIONED
| ALTER_DROP_VIRTUAL_COLUMN;
+/** Acquire a page latch on the possible metadata record,
+to prevent concurrent invocation of dict_index_t::clear_instant_alter()
+by purge when the table turns out to be empty.
+@param[in,out] index clustered index
+@param[in,out] mtr mini-transaction */
+static void instant_metadata_lock(dict_index_t& index, mtr_t& mtr)
+{
+ DBUG_ASSERT(index.is_primary());
+
+ if (!index.is_instant()) {
+ /* dict_index_t::clear_instant_alter() cannot be called.
+ No need for a latch. */
+ return;
+ }
+
+ btr_cur_t btr_cur;
+ btr_cur_open_at_index_side(true, &index, BTR_SEARCH_LEAF,
+ &btr_cur, 0, &mtr);
+ ut_ad(page_cur_is_before_first(btr_cur_get_page_cur(&btr_cur)));
+ ut_ad(page_is_leaf(btr_cur_get_page(&btr_cur)));
+ ut_ad(!page_has_prev(btr_cur_get_page(&btr_cur)));
+ ut_ad(!buf_block_get_page_zip(btr_cur_get_block(&btr_cur)));
+}
+
+/** Initialize instant->field_map.
+@tparam replace_dropped whether to point clustered index fields
+to instant->dropped[]
+@param[in] table table definition to copy from */
+template<bool replace_dropped>
+inline void dict_table_t::init_instant(const dict_table_t& table)
+{
+ const dict_index_t& oindex __attribute__((unused))= *table.indexes.start;
+ dict_index_t& index = *indexes.start;
+ const unsigned u = index.first_user_field();
+ DBUG_ASSERT(u == oindex.first_user_field());
+ DBUG_ASSERT(index.n_fields >= oindex.n_fields);
+
+ field_map_element_t* field_map_it = static_cast<field_map_element_t*>(
+ mem_heap_zalloc(heap, (index.n_fields - u)
+ * sizeof *field_map_it));
+ instant->field_map = field_map_it;
+
+ ut_d(unsigned n_drop = 0);
+ ut_d(unsigned n_nullable = 0);
+ for (unsigned i = u; i < index.n_fields; i++) {
+ auto& f = index.fields[i];
+ DBUG_ASSERT(dict_col_get_fixed_size(f.col, not_redundant())
+ <= DICT_MAX_FIXED_COL_LEN);
+ ut_d(n_nullable += f.col->is_nullable());
+
+ if (!f.col->is_dropped()) {
+ (*field_map_it++).set_ind(f.col->ind);
+ continue;
+ }
+
+ auto fixed_len = dict_col_get_fixed_size(
+ f.col, not_redundant());
+ field_map_it->set_dropped();
+ if (!f.col->is_nullable()) {
+ field_map_it->set_not_null();
+ }
+ field_map_it->set_ind(fixed_len
+ ? uint16_t(fixed_len + 1)
+ : DATA_BIG_COL(f.col));
+ field_map_it++;
+ ut_ad(f.col >= table.instant->dropped);
+ ut_ad(f.col < table.instant->dropped
+ + table.instant->n_dropped);
+ ut_d(n_drop++);
+ if (replace_dropped) {
+ size_t d = f.col - table.instant->dropped;
+ ut_ad(f.col == &table.instant->dropped[d]);
+ ut_ad(d <= instant->n_dropped);
+ f.col = &instant->dropped[d];
+ }
+ }
+ ut_ad(n_drop == n_dropped());
+ ut_ad(field_map_it == &instant->field_map[index.n_fields - u]);
+ ut_ad(index.n_nullable == n_nullable);
+}
+
/** Set is_instant() before instant_column().
@param[in] old previous table definition
@param[in] col_map map from old.cols[] and old.v_cols[] to this
@@ -150,13 +229,26 @@ inline void dict_table_t::prepare_instant(const dict_table_t& old,
DBUG_ASSERT(n_dropped() == 0);
DBUG_ASSERT(old.n_cols == old.n_def);
DBUG_ASSERT(n_cols == n_def);
-
- const dict_index_t& oindex = *old.indexes.start;
+ DBUG_ASSERT(old.supports_instant());
+ DBUG_ASSERT(!persistent_autoinc
+ || persistent_autoinc == old.persistent_autoinc);
+ /* supports_instant() does not necessarily hold here,
+ in case ROW_FORMAT=COMPRESSED according to the
+ MariaDB data dictionary, and ALTER_OPTIONS was not set.
+ If that is the case, the instant ALTER TABLE would keep
+ the InnoDB table in its current format. */
+
+ dict_index_t& oindex = *old.indexes.start;
dict_index_t& index = *indexes.start;
first_alter_pos = 0;
- for (unsigned i = 0; i + DATA_N_SYS_COLS < old.n_cols;
- i++) {
+ mtr_t mtr;
+ mtr.start();
+ /* Protect oindex.n_core_fields and others, so that
+ purge cannot invoke dict_index_t::clear_instant_alter(). */
+ instant_metadata_lock(oindex, mtr);
+
+ for (unsigned i = 0; i + DATA_N_SYS_COLS < old.n_cols; i++) {
if (col_map[i] != i) {
first_alter_pos = 1 + i;
goto add_metadata;
@@ -165,8 +257,20 @@ inline void dict_table_t::prepare_instant(const dict_table_t& old,
if (!old.instant) {
/* Columns were not dropped or reordered.
- Therefore columns must have been added at the end. */
- DBUG_ASSERT(index.n_fields > oindex.n_fields);
+ Therefore columns must have been added at the end,
+ or modified instantly in place. */
+ DBUG_ASSERT(index.n_fields >= oindex.n_fields);
+ DBUG_ASSERT(index.n_fields > oindex.n_fields
+ || !not_redundant());
+#ifdef UNIV_DEBUG
+ if (index.n_fields == oindex.n_fields) {
+ ut_ad(!not_redundant());
+ for (unsigned i = index.n_fields; i--; ) {
+ ut_ad(index.fields[i].col->same_format(
+ *oindex.fields[i].col));
+ }
+ }
+#endif
set_core_fields:
index.n_core_fields = oindex.n_core_fields;
index.n_core_null_bytes = oindex.n_core_null_bytes;
@@ -198,9 +302,7 @@ add_metadata:
instant->dropped = NULL;
}
- unsigned d = n_old_drop;
-
- for (unsigned i = 0; i < old.n_cols; i++) {
+ for (unsigned i = 0, d = n_old_drop; i < old.n_cols; i++) {
if (col_map[i] == ULINT_UNDEFINED) {
(new (&instant->dropped[d++])
dict_col_t(old.cols[i]))->set_dropped();
@@ -211,13 +313,11 @@ add_metadata:
DBUG_ASSERT(instant->dropped[i].is_dropped());
}
#endif
- DBUG_ASSERT(d == n_drop);
const uint n_fields = index.n_fields + n_dropped();
DBUG_ASSERT(n_fields >= oindex.n_fields);
dict_field_t* fields = static_cast<dict_field_t*>(
mem_heap_zalloc(heap, n_fields * sizeof *fields));
- d = n_old_drop;
uint i = 0, j = 0, n_nullable = 0;
ut_d(uint core_null = 0);
for (; i < oindex.n_fields; i++) {
@@ -279,21 +379,27 @@ found_j:
}
/* This column is being dropped. */
+ unsigned d = n_old_drop;
+ for (unsigned c = 0; c < f.col->ind; c++) {
+ d += col_map[c] == ULINT_UNDEFINED;
+ }
DBUG_ASSERT(d < n_drop);
- f.col = &instant->dropped[d++];
+ f.col = &instant->dropped[d];
f.name = NULL;
if (f.col->is_nullable()) {
goto found_nullable;
}
}
- ut_ad(UT_BITS_IN_BYTES(core_null) == oindex.n_core_null_bytes);
+ /* The n_core_null_bytes only matters for
+ ROW_FORMAT=COMPACT and ROW_FORMAT=DYNAMIC tables. */
+ ut_ad(UT_BITS_IN_BYTES(core_null) == oindex.n_core_null_bytes
+ || !not_redundant());
DBUG_ASSERT(i >= oindex.n_core_fields);
DBUG_ASSERT(j <= i);
DBUG_ASSERT(n_fields - (i - j) == index.n_fields);
std::sort(index.fields + j, index.fields + index.n_fields,
[](const dict_field_t& a, const dict_field_t& b)
{ return a.col->ind < b.col->ind; });
- DBUG_ASSERT(d == n_drop);
for (; i < n_fields; i++) {
fields[i] = index.fields[j++];
n_nullable += fields[i].col->is_nullable();
@@ -314,9 +420,9 @@ found_j:
DBUG_ASSERT(n_dropped() >= old.n_dropped());
DBUG_ASSERT(index.n_core_fields == oindex.n_core_fields);
DBUG_ASSERT(index.n_core_null_bytes == oindex.n_core_null_bytes);
+ mtr.commit();
}
-
/** Adjust index metadata for instant ADD/DROP/reorder COLUMN.
@param[in] clustered index definition after instant ALTER TABLE */
inline void dict_index_t::instant_add_field(const dict_index_t& instant)
@@ -334,8 +440,15 @@ inline void dict_index_t::instant_add_field(const dict_index_t& instant)
DBUG_ASSERT(n_uniq == instant.n_uniq);
DBUG_ASSERT(instant.n_fields >= n_fields);
DBUG_ASSERT(instant.n_nullable >= n_nullable);
- DBUG_ASSERT(instant.n_core_fields == n_core_fields);
- DBUG_ASSERT(instant.n_core_null_bytes == n_core_null_bytes);
+ /* dict_table_t::prepare_instant() initialized n_core_fields
+ to be equal. However, after that purge could have emptied the
+ table and invoked dict_index_t::clear_instant_alter(). */
+ DBUG_ASSERT(instant.n_core_fields <= n_core_fields);
+ DBUG_ASSERT(instant.n_core_null_bytes <= n_core_null_bytes);
+ DBUG_ASSERT(instant.n_core_fields == n_core_fields
+ || (!is_instant() && instant.is_instant()));
+ DBUG_ASSERT(instant.n_core_null_bytes == n_core_null_bytes
+ || (!is_instant() && instant.is_instant()));
/* instant will have all fields (including ones for columns
that have been or are being instantly dropped) in the same position
@@ -343,8 +456,14 @@ inline void dict_index_t::instant_add_field(const dict_index_t& instant)
#ifndef DBUG_OFF
for (unsigned i = 0; i < n_fields; i++) {
DBUG_ASSERT(fields[i].same(instant.fields[i]));
+ DBUG_ASSERT(instant.fields[i].col->same_format(*fields[i]
+ .col));
+ /* Instant conversion from NULL to NOT NULL is not allowed. */
+ DBUG_ASSERT(!fields[i].col->is_nullable()
+ || instant.fields[i].col->is_nullable());
DBUG_ASSERT(fields[i].col->is_nullable()
- == instant.fields[i].col->is_nullable());
+ == instant.fields[i].col->is_nullable()
+ || !table->not_redundant());
}
#endif
n_fields = instant.n_fields;
@@ -377,8 +496,9 @@ inline void dict_index_t::instant_add_field(const dict_index_t& instant)
/** Adjust table metadata for instant ADD/DROP/reorder COLUMN.
@param[in] table altered table (with dropped columns)
-@param[in] col_map mapping from cols[] and v_cols[] to table */
-inline void dict_table_t::instant_column(const dict_table_t& table,
+@param[in] col_map mapping from cols[] and v_cols[] to table
+@return whether the metadata record must be updated */
+inline bool dict_table_t::instant_column(const dict_table_t& table,
const ulint* col_map)
{
DBUG_ASSERT(!table.cached);
@@ -389,6 +509,8 @@ inline void dict_table_t::instant_column(const dict_table_t& table,
DBUG_ASSERT(n_v_def == n_v_cols);
DBUG_ASSERT(table.n_v_def == table.n_v_cols);
DBUG_ASSERT(table.n_cols + table.n_dropped() >= n_cols + n_dropped());
+ DBUG_ASSERT(!table.persistent_autoinc
+ || persistent_autoinc == table.persistent_autoinc);
ut_ad(mutex_own(&dict_sys->mutex));
{
@@ -411,6 +533,18 @@ inline void dict_table_t::instant_column(const dict_table_t& table,
if (const dict_col_t* o = find(old_cols, col_map, n_cols, i)) {
c.def_val = o->def_val;
+ DBUG_ASSERT(!((c.prtype ^ o->prtype)
+ & ~(DATA_NOT_NULL | DATA_VERSIONED)));
+ DBUG_ASSERT(c.mtype == o->mtype);
+ DBUG_ASSERT(c.len >= o->len);
+
+ if (o->vers_sys_start()) {
+ ut_ad(o->ind == vers_start);
+ vers_start = i;
+ } else if (o->vers_sys_end()) {
+ ut_ad(o->ind == vers_end);
+ vers_end = i;
+ }
continue;
}
@@ -482,14 +616,16 @@ inline void dict_table_t::instant_column(const dict_table_t& table,
}
dict_index_t* index = dict_table_get_first_index(this);
-
- index->instant_add_field(*dict_table_get_first_index(&table));
+ bool metadata_changed;
+ {
+ const dict_index_t& i = *dict_table_get_first_index(&table);
+ metadata_changed = i.n_fields > index->n_fields;
+ ut_ad(i.n_fields >= index->n_fields);
+ index->instant_add_field(i);
+ }
if (instant || table.instant) {
- const unsigned u = index->first_user_field();
- uint16_t* non_pk_col_map = static_cast<uint16_t*>(
- mem_heap_alloc(heap, (index->n_fields - u)
- * sizeof *non_pk_col_map));
+ const auto old_instant = instant;
/* FIXME: add instant->heap, and transfer ownership here */
if (!instant) {
instant = new (mem_heap_zalloc(heap, sizeof *instant))
@@ -508,38 +644,19 @@ dup_dropped:
* sizeof *instant->dropped);
}
- instant->non_pk_col_map = non_pk_col_map;
- ut_d(unsigned n_drop = 0);
- for (unsigned i = u; i < index->n_fields; i++) {
- dict_field_t* field = &index->fields[i];
- DBUG_ASSERT(dict_col_get_fixed_size(
- field->col,
- flags & DICT_TF_COMPACT)
- <= DICT_MAX_FIXED_COL_LEN);
- if (!field->col->is_dropped()) {
- *non_pk_col_map++ = field->col->ind;
- continue;
- }
+ const field_map_element_t* field_map = old_instant
+ ? old_instant->field_map : NULL;
- ulint fixed_len = dict_col_get_fixed_size(
- field->col, flags & DICT_TF_COMPACT);
- *non_pk_col_map++ = 1U << 15
- | uint16_t(!field->col->is_nullable()) << 14
- | (fixed_len
- ? uint16_t(fixed_len + 1)
- : field->col->len > 255);
- ut_ad(field->col >= table.instant->dropped);
- ut_ad(field->col < table.instant->dropped
- + table.instant->n_dropped);
- ut_d(n_drop++);
- size_t d = field->col - table.instant->dropped;
- ut_ad(field->col == &table.instant->dropped[d]);
- ut_ad(d <= instant->n_dropped);
- field->col = &instant->dropped[d];
+ init_instant<true>(table);
+
+ if (!metadata_changed) {
+ metadata_changed = !field_map
+ || memcmp(field_map,
+ instant->field_map,
+ (index->n_fields
+ - index->first_user_field())
+ * sizeof *field_map);
}
- ut_ad(n_drop == n_dropped());
- ut_ad(non_pk_col_map
- == &instant->non_pk_col_map[index->n_fields - u]);
}
while ((index = dict_table_get_next_index(index)) != NULL) {
@@ -587,6 +704,7 @@ dup_dropped:
n_cols = table.n_cols;
n_v_cols = table.n_v_cols;
+ return metadata_changed;
}
/** Find the old column number for the given new column position.
@@ -609,6 +727,7 @@ static ulint find_old_col_no(const ulint* col_map, ulint pos, ulint n)
@param[in] old_instant original instant structure
@param[in] old_fields original fields
@param[in] old_n_fields original number of fields
+@param[in] old_n_core_fields original number of core fields
@param[in] old_n_v_cols original n_v_cols
@param[in] old_v_cols original v_cols
@param[in] old_v_col_names original v_col_names
@@ -620,20 +739,27 @@ inline void dict_table_t::rollback_instant(
dict_instant_t* old_instant,
dict_field_t* old_fields,
unsigned old_n_fields,
+ unsigned old_n_core_fields,
unsigned old_n_v_cols,
dict_v_col_t* old_v_cols,
const char* old_v_col_names,
const ulint* col_map)
{
ut_ad(mutex_own(&dict_sys->mutex));
+ ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
dict_index_t* index = indexes.start;
+ mtr_t mtr;
+ mtr.start();
+ /* Prevent concurrent execution of dict_index_t::clear_instant_alter()
+ by acquiring a latch on the leftmost leaf page. */
+ instant_metadata_lock(*index, mtr);
/* index->is_instant() does not necessarily hold here, because
the table may have been emptied */
DBUG_ASSERT(old_n_cols >= DATA_N_SYS_COLS);
DBUG_ASSERT(n_cols == n_def);
DBUG_ASSERT(index->n_def == index->n_fields);
- DBUG_ASSERT(index->n_core_fields <= old_n_fields);
DBUG_ASSERT(index->n_core_fields <= index->n_fields);
+ DBUG_ASSERT(old_n_core_fields <= old_n_fields);
DBUG_ASSERT(instant || !old_instant);
instant = old_instant;
@@ -650,12 +776,17 @@ inline void dict_table_t::rollback_instant(
UT_DELETE(v_cols[i].v_indexes);
}
+ index->n_core_fields = (index->n_fields == index->n_core_fields)
+ ? old_n_fields
+ : old_n_core_fields;
index->n_def = index->n_fields = old_n_fields;
+ index->n_core_null_bytes = UT_BITS_IN_BYTES(
+ index->get_n_nullable(index->n_core_fields));
const dict_col_t* const new_cols = cols;
- const dict_col_t* const new_cols_end = cols + n_cols;
+ const dict_col_t* const new_cols_end __attribute__((unused)) = cols + n_cols;
const dict_v_col_t* const new_v_cols = v_cols;
- const dict_v_col_t* const new_v_cols_end = v_cols + n_v_cols;
+ const dict_v_col_t* const new_v_cols_end __attribute__((unused))= v_cols + n_v_cols;
cols = old_cols;
col_names = old_col_names;
@@ -665,7 +796,18 @@ inline void dict_table_t::rollback_instant(
n_v_def = n_v_cols = old_n_v_cols;
n_t_def = n_t_cols = n_cols + n_v_cols;
+ if (versioned()) {
+ for (unsigned i = 0; i < n_cols; ++i) {
+ if (cols[i].vers_sys_start()) {
+ vers_start = i;
+ } else if (cols[i].vers_sys_end()) {
+ vers_end = i;
+ }
+ }
+ }
+
index->fields = old_fields;
+ mtr.commit();
while ((index = dict_table_get_next_index(index)) != NULL) {
if (index->to_be_dropped) {
@@ -783,6 +925,8 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
dict_field_t* const old_fields;
/** size of old_fields */
const unsigned old_n_fields;
+ /** original old_table->n_core_fields */
+ const unsigned old_n_core_fields;
/** original number of virtual columns in the table */
const unsigned old_n_v_cols;
/** original virtual columns of the table */
@@ -850,6 +994,8 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
old_instant(prebuilt_arg->table->instant),
old_fields(prebuilt_arg->table->indexes.start->fields),
old_n_fields(prebuilt_arg->table->indexes.start->n_fields),
+ old_n_core_fields(prebuilt_arg->table->indexes.start
+ ->n_core_fields),
old_n_v_cols(prebuilt_arg->table->n_v_cols),
old_v_cols(prebuilt_arg->table->v_cols),
old_v_col_names(prebuilt_arg->table->v_col_names),
@@ -923,6 +1069,16 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
first_alter_pos);
}
+ /** Adjust table metadata for instant ADD/DROP/reorder COLUMN.
+ @return whether the metadata record must be updated */
+ bool instant_column()
+ {
+ DBUG_ASSERT(is_instant());
+ DBUG_ASSERT(old_n_fields
+ == old_table->indexes.start->n_fields);
+ return old_table->instant_column(*instant_table, col_map);
+ }
+
/** Revert prepare_instant() if the transaction is rolled back. */
void rollback_instant()
{
@@ -931,6 +1087,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
old_cols, old_col_names,
old_instant,
old_fields, old_n_fields,
+ old_n_core_fields,
old_n_v_cols, old_v_cols,
old_v_col_names,
col_map);
@@ -943,6 +1100,40 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
return instant_table;
}
+ /** Create an index table where indexes are ordered as follows:
+
+ IF a new primary key is defined for the table THEN
+
+ 1) New primary key
+ 2) The remaining keys in key_info
+
+ ELSE
+
+ 1) All new indexes in the order they arrive from MySQL
+
+ ENDIF
+
+ @return key definitions */
+ MY_ATTRIBUTE((nonnull, warn_unused_result, malloc))
+ inline index_def_t*
+ create_key_defs(
+ const Alter_inplace_info* ha_alter_info,
+ /*!< in: alter operation */
+ const TABLE* altered_table,
+ /*!< in: MySQL table that is being altered */
+ ulint& n_fts_add,
+ /*!< out: number of FTS indexes to be created */
+ ulint& fts_doc_id_col,
+ /*!< in: The column number for Doc ID */
+ bool& add_fts_doc_id,
+ /*!< in: whether we need to add new DOC ID
+ column for FTS index */
+ bool& add_fts_doc_idx,
+ /*!< in: whether we need to add new DOC ID
+ index for FTS index */
+ const TABLE* table);
+ /*!< in: MySQL table that is being altered */
+
private:
// Disable copying
ha_innobase_inplace_ctx(const ha_innobase_inplace_ctx&);
@@ -1050,20 +1241,18 @@ my_error_innodb(
/** Determine if fulltext indexes exist in a given table.
@param table MySQL table
-@return whether fulltext indexes exist on the table */
-static
-bool
-innobase_fulltext_exist(
-/*====================*/
- const TABLE* table)
+@return number of fulltext indexes */
+static uint innobase_fulltext_exist(const TABLE* table)
{
+ uint count = 0;
+
for (uint i = 0; i < table->s->keys; i++) {
if (table->key_info[i].flags & HA_FULLTEXT) {
- return(true);
+ count++;
}
}
- return(false);
+ return count;
}
/** Determine whether indexed virtual columns exist in a table.
@@ -1265,13 +1454,15 @@ check_v_col_in_order(
/** Determine if an instant operation is possible for altering columns.
@param[in] ib_table InnoDB table definition
@param[in] ha_alter_info the ALTER TABLE operation
-@param[in] table table definition before ALTER TABLE */
+@param[in] table table definition before ALTER TABLE
+@param[in] table table definition after ALTER TABLE */
static
bool
instant_alter_column_possible(
const dict_table_t& ib_table,
const Alter_inplace_info* ha_alter_info,
- const TABLE* table)
+ const TABLE* table,
+ const TABLE* altered_table)
{
if (!ib_table.supports_instant()) {
return false;
@@ -1309,11 +1500,26 @@ instant_alter_column_possible(
return false;
}
- if (!(ha_alter_info->handler_flags
- & (ALTER_ADD_STORED_BASE_COLUMN
- | ALTER_DROP_STORED_COLUMN
- | ALTER_STORED_COLUMN_ORDER))) {
- return false;
+ static constexpr alter_table_operations avoid_rebuild
+ = ALTER_ADD_STORED_BASE_COLUMN
+ | ALTER_DROP_STORED_COLUMN
+ | ALTER_STORED_COLUMN_ORDER
+ | ALTER_COLUMN_NULLABLE;
+
+ if (!(ha_alter_info->handler_flags & avoid_rebuild)) {
+ alter_table_operations flags = ha_alter_info->handler_flags
+ & ~avoid_rebuild;
+ /* None of the flags are set that we can handle
+ specially to avoid rebuild. In this case, we can
+ allow ALGORITHM=INSTANT, except if some requested
+ operation requires that the table be rebuilt. */
+ if (flags & INNOBASE_ALTER_REBUILD) {
+ return false;
+ }
+ if ((flags & ALTER_OPTIONS)
+ && alter_options_need_rebuild(ha_alter_info, table)) {
+ return false;
+ }
}
/* At the moment, we disallow ADD [UNIQUE] INDEX together with
@@ -1337,12 +1543,50 @@ instant_alter_column_possible(
& ((INNOBASE_ALTER_REBUILD | INNOBASE_ONLINE_CREATE)
& ~ALTER_DROP_STORED_COLUMN
& ~ALTER_STORED_COLUMN_ORDER
- & ~ALTER_ADD_STORED_BASE_COLUMN & ~ALTER_OPTIONS)) {
+ & ~ALTER_ADD_STORED_BASE_COLUMN
+ & ~ALTER_COLUMN_NULLABLE
+ & ~ALTER_OPTIONS)) {
+ return false;
+ }
+
+ if ((ha_alter_info->handler_flags & ALTER_OPTIONS)
+ && alter_options_need_rebuild(ha_alter_info, table)) {
return false;
}
- return !(ha_alter_info->handler_flags & ALTER_OPTIONS)
- || !alter_options_need_rebuild(ha_alter_info, table);
+ if (ha_alter_info->handler_flags & ALTER_COLUMN_NULLABLE) {
+ if (ib_table.not_redundant()) {
+ return false;
+ }
+
+ const dict_index_t* pk = ib_table.indexes.start;
+ Field** af = altered_table->field;
+ Field** const end = altered_table->field
+ + altered_table->s->fields;
+ for (unsigned c = 0; af < end; af++) {
+ if (!(*af)->stored_in_db()) {
+ continue;
+ }
+
+ const dict_col_t* col = dict_table_get_nth_col(
+ &ib_table, c++);
+
+ if (!col->ord_part || col->is_nullable()
+ || !(*af)->real_maybe_null()) {
+ continue;
+ }
+
+ /* The column would be changed from NOT NULL.
+ Ensure that it is not a clustered index key. */
+ for (auto i = pk->n_uniq; i--; ) {
+ if (pk->fields[i].col == col) {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
}
/** Check whether the non-const default value for the field
@@ -1560,11 +1804,14 @@ ha_innobase::check_if_supported_inplace_alter(
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
+ const char* reason_rebuild = NULL;
+
switch (ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE) {
case ALTER_OPTIONS:
if (alter_options_need_rebuild(ha_alter_info, table)) {
- ha_alter_info->unsupported_reason = my_get_err_msg(
+ reason_rebuild = my_get_err_msg(
ER_ALTER_OPERATION_TABLE_OPTIONS_NEED_REBUILD);
+ ha_alter_info->unsupported_reason = reason_rebuild;
break;
}
/* fall through */
@@ -1650,7 +1897,7 @@ ha_innobase::check_if_supported_inplace_alter(
}
const bool supports_instant = instant_alter_column_possible(
- *m_prebuilt->table, ha_alter_info, table);
+ *m_prebuilt->table, ha_alter_info, table, altered_table);
bool add_drop_v_cols = false;
/* If there is add or drop virtual columns, we will support operations
@@ -1699,8 +1946,9 @@ ha_innobase::check_if_supported_inplace_alter(
}
/* We should be able to do the operation in-place.
- See if we can do it online (LOCK=NONE). */
- bool online = true;
+ See if we can do it online (LOCK=NONE) or without rebuild. */
+ bool online = true, need_rebuild = false;
+ const uint fulltext_indexes = innobase_fulltext_exist(altered_table);
List_iterator_fast<Create_field> cf_it(
ha_alter_info->alter_info->create_list);
@@ -1761,8 +2009,7 @@ ha_innobase::check_if_supported_inplace_alter(
/* We cannot replace a hidden FTS_DOC_ID
with a user-visible FTS_DOC_ID. */
- if (m_prebuilt->table->fts
- && innobase_fulltext_exist(altered_table)
+ if (fulltext_indexes && m_prebuilt->table->fts
&& !my_strcasecmp(
system_charset_info,
key_part->field->field_name.str,
@@ -1778,8 +2025,8 @@ ha_innobase::check_if_supported_inplace_alter(
& AUTO_INCREMENT_FLAG));
if (key_part->field->flags & AUTO_INCREMENT_FLAG) {
- /* We cannot assign an AUTO_INCREMENT
- column values during online ALTER. */
+ /* We cannot assign AUTO_INCREMENT values
+ during online or instant ALTER. */
DBUG_ASSERT(key_part->field == altered_table
-> found_next_number_field);
@@ -1789,6 +2036,7 @@ ha_innobase::check_if_supported_inplace_alter(
}
online = false;
+ need_rebuild = true;
}
if (innobase_is_v_fld(key_part->field)) {
@@ -1821,7 +2069,7 @@ ha_innobase::check_if_supported_inplace_alter(
|| (m_prebuilt->table->fts->doc_col
< dict_table_get_n_user_cols(m_prebuilt->table)));
- if (m_prebuilt->table->fts && innobase_fulltext_exist(altered_table)) {
+ if (fulltext_indexes && m_prebuilt->table->fts) {
/* FULLTEXT indexes are supposed to remain. */
/* Disallow DROP INDEX FTS_DOC_ID_INDEX */
@@ -1866,7 +2114,8 @@ ha_innobase::check_if_supported_inplace_alter(
cf_it.rewind();
Field **af = altered_table->field;
bool fts_need_rebuild = false;
- const bool need_rebuild = innobase_need_rebuild(ha_alter_info, table);
+ need_rebuild = need_rebuild
+ || innobase_need_rebuild(ha_alter_info, table);
while (Create_field* cf = cf_it++) {
DBUG_ASSERT(cf->field
@@ -1918,8 +2167,7 @@ ha_innobase::check_if_supported_inplace_alter(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL);
} else if (!is_non_const_value(*af)
&& set_default_value(*af)) {
- if (m_prebuilt->table->fts
- && innobase_fulltext_exist(altered_table)
+ if (fulltext_indexes > 1
&& !my_strcasecmp(system_charset_info,
(*af)->field_name.str,
FTS_DOC_ID_COL_NAME)) {
@@ -1938,48 +2186,40 @@ next_column:
af++;
}
- if (supports_instant
- || !(ha_alter_info->handler_flags
- & ~(INNOBASE_ALTER_INSTANT | INNOBASE_INPLACE_IGNORE))) {
+ if (supports_instant) {
DBUG_RETURN(HA_ALTER_INPLACE_INSTANT);
}
- if (!online) {
- /* We already determined that only a non-locking
- operation is possible. */
- } else if ((need_rebuild || (ha_alter_info->handler_flags
- & ALTER_ADD_PK_INDEX))
- && (innobase_fulltext_exist(altered_table)
- || innobase_spatial_exist(altered_table)
- || innobase_indexed_virtual_exist(altered_table))) {
- /* Refuse to rebuild the table online, if
- FULLTEXT OR SPATIAL indexes are to survive the rebuild. */
- online = false;
+ if (need_rebuild
+ && (fulltext_indexes
+ || innobase_spatial_exist(altered_table)
+ || innobase_indexed_virtual_exist(altered_table))) {
/* If the table already contains fulltext indexes,
refuse to rebuild the table natively altogether. */
- if (m_prebuilt->table->fts) {
+ if (fulltext_indexes > 1) {
cannot_create_many_fulltext_index:
ha_alter_info->unsupported_reason =
my_get_err_msg(ER_INNODB_FT_LIMIT);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
- if (ha_alter_info->online
- && !ha_alter_info->unsupported_reason) {
-
- if (innobase_spatial_exist(altered_table)) {
- ha_alter_info->unsupported_reason = my_get_err_msg(
- ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
- } else if (!innobase_fulltext_exist(altered_table)) {
- /* MDEV-14341 FIXME: Remove this limitation. */
- ha_alter_info->unsupported_reason =
- "online rebuild with indexed virtual columns";
- } else {
- ha_alter_info->unsupported_reason = my_get_err_msg(
- ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
- }
+ if (!online || !ha_alter_info->online
+ || ha_alter_info->unsupported_reason != reason_rebuild) {
+ /* Either LOCK=NONE was not requested, or we already
+ gave specific reason to refuse it. */
+ } else if (fulltext_indexes) {
+ ha_alter_info->unsupported_reason = my_get_err_msg(
+ ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
+ } else if (innobase_spatial_exist(altered_table)) {
+ ha_alter_info->unsupported_reason = my_get_err_msg(
+ ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
+ } else {
+ /* MDEV-14341 FIXME: Remove this limitation. */
+ ha_alter_info->unsupported_reason =
+ "online rebuild with indexed virtual columns";
}
+ online = false;
}
if (ha_alter_info->handler_flags
@@ -3392,8 +3632,7 @@ innobase_fts_check_doc_id_index_in_def(
return(FTS_NOT_EXIST_DOC_ID_INDEX);
}
-/*******************************************************************//**
-Create an index table where indexes are ordered as follows:
+/** Create an index table where indexes are ordered as follows:
IF a new primary key is defined for the table THEN
@@ -3407,23 +3646,15 @@ ELSE
ENDIF
@return key definitions */
-static MY_ATTRIBUTE((nonnull, warn_unused_result, malloc))
-index_def_t*
-innobase_create_key_defs(
-/*=====================*/
- mem_heap_t* heap,
- /*!< in/out: memory heap where space for key
- definitions are allocated */
+MY_ATTRIBUTE((nonnull, warn_unused_result, malloc))
+inline index_def_t*
+ha_innobase_inplace_ctx::create_key_defs(
const Alter_inplace_info* ha_alter_info,
/*!< in: alter operation */
const TABLE* altered_table,
/*!< in: MySQL table that is being altered */
- ulint& n_add,
- /*!< in/out: number of indexes to be created */
ulint& n_fts_add,
/*!< out: number of FTS indexes to be created */
- bool got_default_clust,
- /*!< in: whether the table lacks a primary key */
ulint& fts_doc_id_col,
/*!< in: The column number for Doc ID */
bool& add_fts_doc_id,
@@ -3435,6 +3666,9 @@ innobase_create_key_defs(
const TABLE* table)
/*!< in: MySQL table that is being altered */
{
+ ulint& n_add = num_to_add_index;
+ const bool got_default_clust = new_table->indexes.start->is_gen_clust();
+
index_def_t* indexdef;
index_def_t* indexdefs;
bool new_primary;
@@ -3443,7 +3677,7 @@ innobase_create_key_defs(
const KEY*const key_info
= ha_alter_info->key_info_buffer;
- DBUG_ENTER("innobase_create_key_defs");
+ DBUG_ENTER("ha_innobase_inplace_ctx::create_key_defs");
DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_idx);
DBUG_ASSERT(ha_alter_info->index_add_count == n_add);
@@ -3926,7 +4160,7 @@ innobase_build_col_map(
Alter_inplace_info* ha_alter_info,
const TABLE* altered_table,
const TABLE* table,
- const dict_table_t* new_table,
+ dict_table_t* new_table,
const dict_table_t* old_table,
dtuple_t* defaults,
mem_heap_t* heap)
@@ -4000,6 +4234,14 @@ innobase_build_col_map(
}
col_map[old_i - num_old_v] = i;
+ if (old_table->versioned()
+ && altered_table->versioned()) {
+ if (old_i == old_table->vers_start) {
+ new_table->vers_start = i + num_v;
+ } else if (old_i == old_table->vers_end) {
+ new_table->vers_end = i + num_v;
+ }
+ }
goto found_col;
}
}
@@ -4732,6 +4974,7 @@ static bool innobase_insert_sys_virtual(
@param[in] prtype precise type
@param[in] len fixed length in bytes, or 0
@param[in] n_base number of base columns of virtual columns, or 0
+@param[in] update whether to update instead of inserting
@retval false on success
@retval true on failure (my_error() will have been called) */
static bool innodb_insert_sys_columns(
@@ -4742,7 +4985,8 @@ static bool innodb_insert_sys_columns(
ulint prtype,
ulint len,
ulint n_base,
- trx_t* trx)
+ trx_t* trx,
+ bool update = false)
{
pars_info_t* info = pars_info_create();
pars_info_add_ull_literal(info, "id", table_id);
@@ -4753,6 +4997,24 @@ static bool innodb_insert_sys_columns(
pars_info_add_int4_literal(info, "len", len);
pars_info_add_int4_literal(info, "base", n_base);
+ if (update) {
+ if (DB_SUCCESS != que_eval_sql(
+ info,
+ "PROCEDURE UPD_COL () IS\n"
+ "BEGIN\n"
+ "UPDATE SYS_COLUMNS SET\n"
+ "NAME=:name, MTYPE=:mtype, PRTYPE=:prtype, "
+ "LEN=:len, PREC=:base\n"
+ "WHERE TABLE_ID=:id AND POS=:pos;\n"
+ "END;\n", FALSE, trx)) {
+ my_error(ER_INTERNAL_ERROR, MYF(0),
+ "InnoDB: Updating SYS_COLUMNS failed");
+ return true;
+ }
+
+ return false;
+ }
+
if (DB_SUCCESS != que_eval_sql(
info,
"PROCEDURE ADD_COL () IS\n"
@@ -4853,25 +5115,6 @@ innobase_add_virtual_try(
return false;
}
-/** Add the newly added column in the sys_column system table.
-@param[in] table_id table id
-@param[in] pos position of the column
-@param[in] field_name field name
-@param[in] type data type
-@retval true Failure
-@retval false Success. */
-static bool innobase_instant_add_col(
- table_id_t table_id,
- ulint pos,
- const char* field_name,
- const dtype_t& type,
- trx_t* trx)
-{
- return innodb_insert_sys_columns(table_id, pos, field_name,
- type.mtype, type.prtype, type.len, 0,
- trx);
-}
-
/** Delete metadata from SYS_COLUMNS and SYS_VIRTUAL.
@param[in] id table id
@param[in] pos first SYS_COLUMNS.POS
@@ -5132,7 +5375,7 @@ void dict_table_t::serialise_columns(mem_heap_t* heap, dfield_t* field) const
data += 4;
for (ulint i = n_fixed; i < index.n_fields; i++) {
- mach_write_to_2(data, instant->non_pk_col_map[i - n_fixed]);
+ mach_write_to_2(data, instant->field_map[i - n_fixed]);
data += 2;
}
}
@@ -5239,13 +5482,24 @@ static bool innobase_instant_try(
dict_table_t* user_table = ctx->old_table;
dict_index_t* index = dict_table_get_first_index(user_table);
- uint n_old_fields = index->n_fields;
+ mtr_t mtr;
+ mtr.start();
+ /* Prevent purge from calling dict_index_t::clear_instant_alter(),
+ to protect index->n_core_fields, index->table->instant and others
+ from changing during ctx->instant_column(). */
+ instant_metadata_lock(*index, mtr);
+ const unsigned n_old_fields = index->n_fields;
const dict_col_t* old_cols = user_table->cols;
DBUG_ASSERT(user_table->n_cols == ctx->old_n_cols);
- user_table->instant_column(*ctx->instant_table, ctx->col_map);
+ const bool metadata_changed = ctx->instant_column();
DBUG_ASSERT(index->n_fields >= n_old_fields);
+ /* Release the page latch. Between this and the next
+ btr_pcur_open_at_index_side(), data fields such as
+ index->n_core_fields and index->table->instant could change,
+ but we would handle that in empty_table: below. */
+ mtr.commit();
/* The table may have been emptied and may have lost its
'instantness' during this ALTER TABLE. */
@@ -5325,12 +5579,18 @@ static bool innobase_instant_try(
If it is NULL, the column was added by this ALTER TABLE. */
ut_ad(!new_field->field == !old);
- if (old && (!ctx->first_alter_pos
- || i < ctx->first_alter_pos - 1)) {
+ bool update = old && (!ctx->first_alter_pos
+ || i < ctx->first_alter_pos - 1);
+ DBUG_ASSERT(!old || col->same_format(*old));
+ if (update
+ && old->prtype == d->type.prtype) {
/* The record is already present in SYS_COLUMNS. */
- } else if (innobase_instant_add_col(user_table->id, i,
- (*af)->field_name.str,
- d->type, trx)) {
+ } else if (innodb_insert_sys_columns(user_table->id, i,
+ (*af)->field_name.str,
+ d->type.mtype,
+ d->type.prtype,
+ d->type.len, 0, trx,
+ update)) {
return true;
}
@@ -5393,7 +5653,6 @@ add_all_virtual:
memset(roll_ptr, 0, sizeof roll_ptr);
dtuple_t* entry = index->instant_metadata(*row, ctx->heap);
- mtr_t mtr;
mtr.start();
index->set_modified(mtr);
btr_pcur_t pcur;
@@ -5410,7 +5669,7 @@ add_all_virtual:
que_thr_t* thr = pars_complete_graph_for_exec(
NULL, trx, ctx->heap, NULL);
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
if (rec_is_metadata(rec, *index)) {
ut_ad(page_rec_is_user_rec(rec));
if (!page_has_next(block->frame)
@@ -5418,6 +5677,10 @@ add_all_virtual:
goto empty_table;
}
+ if (!metadata_changed) {
+ goto func_exit;
+ }
+
/* Ensure that the root page is in the correct format. */
buf_block_t* root = btr_root_block_get(index, RW_X_LATCH,
&mtr);
@@ -5494,14 +5757,16 @@ add_all_virtual:
empty_table:
/* The table is empty. */
ut_ad(page_is_root(block->frame));
+ /* MDEV-17383: free metadata BLOBs! */
btr_page_empty(block, NULL, index, 0, &mtr);
index->clear_instant_alter();
- err = DB_SUCCESS;
+ goto func_exit;
+ } else if (!user_table->is_instant()) {
+ ut_ad(!user_table->not_redundant());
goto func_exit;
}
/* Convert the table to the instant ALTER TABLE format. */
- ut_ad(user_table->is_instant());
mtr.commit();
mtr.start();
index->set_modified(mtr);
@@ -5763,11 +6028,9 @@ prepare_inplace_alter_table_dict(
const char* path = thd_innodb_tmpdir(
ctx->prebuilt->trx->mysql_thd);
- index_defs = innobase_create_key_defs(
- ctx->heap, ha_alter_info, altered_table, ctx->num_to_add_index,
+ index_defs = ctx->create_key_defs(
+ ha_alter_info, altered_table,
num_fts_index,
- dict_index_is_auto_gen_clust(dict_table_get_first_index(
- ctx->new_table)),
fts_doc_id_col, add_fts_doc_id, add_fts_doc_id_idx,
old_table);
@@ -5850,8 +6113,10 @@ new_clustered_failed:
user_table, ctx->trx);
if (ctx->need_rebuild()) {
- ut_ad(!ctx->new_table->cached);
- dict_mem_table_free(ctx->new_table);
+ if (ctx->new_table) {
+ ut_ad(!ctx->new_table->cached);
+ dict_mem_table_free(ctx->new_table);
+ }
ctx->new_table = ctx->old_table;
}
@@ -6128,8 +6393,11 @@ new_clustered_failed:
== !!new_clustered);
}
+ DBUG_ASSERT(!ctx->need_rebuild()
+ || !ctx->new_table->persistent_autoinc);
+
if (ctx->need_rebuild() && instant_alter_column_possible(
- *user_table, ha_alter_info, old_table)
+ *user_table, ha_alter_info, old_table, altered_table)
#if 1 // MDEV-17459: adjust fts_fetch_doc_from_rec() and friends; remove this
&& !innobase_fulltext_exist(altered_table)
#endif
@@ -6256,6 +6524,11 @@ new_clustered_failed:
ctx->new_table, i),
FTS_DOC_ID_COL_NAME)));
+ if (altered_table->found_next_number_field) {
+ ctx->new_table->persistent_autoinc
+ = ctx->old_table->persistent_autoinc;
+ }
+
ctx->prepare_instant();
}
@@ -6327,7 +6600,7 @@ new_clustered_failed:
break;
case DB_TABLESPACE_EXISTS:
my_error(ER_TABLESPACE_EXISTS, MYF(0),
- ctx->new_table->name.m_name);
+ altered_table->s->table_name.str);
goto new_table_failed;
case DB_DUPLICATE_KEY:
my_error(HA_ERR_TABLE_EXIST, MYF(0),
@@ -6335,12 +6608,13 @@ new_clustered_failed:
goto new_table_failed;
case DB_UNSUPPORTED:
my_error(ER_UNSUPPORTED_EXTENSION, MYF(0),
- ctx->new_table->name.m_name);
+ altered_table->s->table_name.str);
goto new_table_failed;
default:
my_error_innodb(error, table_name, flags);
new_table_failed:
DBUG_ASSERT(ctx->trx != ctx->prebuilt->trx);
+ ctx->new_table = NULL;
goto new_clustered_failed;
}
@@ -6387,7 +6661,6 @@ new_table_failed:
ut_ad(new_clust_index->n_core_null_bytes
== UT_BITS_IN_BYTES(new_clust_index->n_nullable));
- DBUG_ASSERT(!ctx->new_table->persistent_autoinc);
if (const Field* ai = altered_table->found_next_number_field) {
const unsigned col_no = innodb_col_no(ai);
@@ -7270,9 +7543,8 @@ check_if_ok_to_rename:
/* Check each index's column length to make sure they do not
exceed limit */
- for (ulint i = 0; i < ha_alter_info->index_add_count; i++) {
- const KEY* key = &ha_alter_info->key_info_buffer[
- ha_alter_info->index_add_buffer[i]];
+ for (ulint i = 0; i < ha_alter_info->key_count; i++) {
+ const KEY* key = &ha_alter_info->key_info_buffer[i];
if (key->flags & HA_FULLTEXT) {
/* The column length does not matter for
@@ -8520,6 +8792,14 @@ err_exit:
index != NULL;
index = dict_table_get_next_index(index)) {
+ bool has_prefixes = false;
+ for (size_t i = 0; i < dict_index_get_n_fields(index); i++) {
+ if (dict_index_get_nth_field(index, i)->prefix_len) {
+ has_prefixes = true;
+ break;
+ }
+ }
+
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
const dict_field_t& f = index->fields[i];
DBUG_ASSERT(!f.name == f.col->is_dropped());
@@ -8531,26 +8811,19 @@ err_exit:
info = pars_info_create();
+ ulint pos = has_prefixes ? i << 16 | f.prefix_len : i;
+
pars_info_add_ull_literal(info, "indexid", index->id);
- pars_info_add_int4_literal(info, "nth", i);
+ pars_info_add_int4_literal(info, "nth", pos);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
info,
"PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n"
"BEGIN\n"
-
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
"WHERE INDEX_ID=:indexid\n"
"AND POS=:nth;\n"
-
- /* Try again, in case there is a prefix_len
- encoded in SYS_FIELDS.POS */
-
- "UPDATE SYS_FIELDS SET COL_NAME=:new\n"
- "WHERE INDEX_ID=:indexid\n"
- "AND POS>=65536*:nth AND POS<65536*(:nth+1);\n"
-
"END;\n",
FALSE, trx);
@@ -10067,8 +10340,8 @@ commit_cache_norebuild(
}
if (ha_alter_info->handler_flags & ALTER_DROP_STORED_COLUMN) {
- dict_index_t* index = dict_table_get_first_index(
- ctx->new_table);
+ const dict_index_t* index = ctx->new_table->indexes.start;
+
for (const dict_field_t* f = index->fields,
* const end = f + index->n_fields;
f != end; f++) {
@@ -10082,6 +10355,10 @@ commit_cache_norebuild(
}
}
}
+
+ if (!ctx->instant_table->persistent_autoinc) {
+ ctx->new_table->persistent_autoinc = 0;
+ }
}
if (ha_alter_info->handler_flags & ALTER_COLUMN_UNVERSIONED) {
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index f0df1bc9839..cedb6e05782 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -25,10 +25,9 @@ Created July 18, 2007 Vasil Dimov
Modified Dec 29, 2014 Jan Lindström (Added sys_semaphore_waits)
*******************************************************/
-#include "ha_prototypes.h"
+#include "univ.i"
#include <mysql_version.h>
#include <field.h>
-#include "univ.i"
#include <sql_acl.h>
#include <sql_show.h>
@@ -58,8 +57,6 @@ Modified Dec 29, 2014 Jan Lindström (Added sys_semaphore_waits)
#include "sync0arr.h"
#include "fil0fil.h"
#include "fil0crypt.h"
-#include "fsp0sysspace.h"
-#include "ut0new.h"
#include "dict0crea.h"
/** structure associates a name string with a file page type and/or buffer
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 47abdceb308..1c90e8dd5c8 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -24,8 +24,6 @@ Insert buffer
Created 7/19/1997 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "ibuf0ibuf.h"
#include "sync0sync.h"
#include "btr0sea.h"
@@ -55,7 +53,6 @@ my_bool srv_ibuf_disable_background_merge;
#include "log0recv.h"
#include "que0que.h"
#include "srv0start.h" /* srv_shutdown_state */
-#include "fsp0sysspace.h"
#include "rem0cmp.h"
/* STRUCTURE OF AN INSERT BUFFER RECORD
@@ -1430,32 +1427,26 @@ ibuf_rec_get_counter(
}
}
-/****************************************************************//**
-Add accumulated operation counts to a permanent array. Both arrays must be
-of size IBUF_OP_COUNT. */
-static
-void
-ibuf_add_ops(
-/*=========*/
- ulint* arr, /*!< in/out: array to modify */
- const ulint* ops) /*!< in: operation counts */
+/**
+ Add accumulated operation counts to a permanent array.
+ Both arrays must be of size IBUF_OP_COUNT.
+*/
+static void ibuf_add_ops(Atomic_counter<ulint> *out, const ulint *in)
{
- ulint i;
-
- for (i = 0; i < IBUF_OP_COUNT; i++) {
- my_atomic_addlint(&arr[i], ops[i]);
- }
+ for (auto i = 0; i < IBUF_OP_COUNT; i++)
+ out[i]+= in[i];
}
+
/****************************************************************//**
Print operation counts. The array must be of size IBUF_OP_COUNT. */
static
void
ibuf_print_ops(
/*===========*/
- const ulint* ops, /*!< in: operation counts */
- FILE* file) /*!< in: file where to print */
+ const Atomic_counter<ulint>* ops, /*!< in: operation counts */
+ FILE* file) /*!< in: file where to print */
{
static const char* op_names[] = {
"insert",
@@ -1468,7 +1459,7 @@ ibuf_print_ops(
for (i = 0; i < IBUF_OP_COUNT; i++) {
fprintf(file, "%s " ULINTPF "%s", op_names[i],
- ops[i], (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
+ ulint{ops[i]}, (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
}
putc('\n', file);
@@ -3372,7 +3363,7 @@ ibuf_insert_low(
ut_ad(!dict_index_is_spatial(index));
ut_ad(dtuple_check_typed(entry));
ut_ad(!no_counter || op == IBUF_OP_INSERT);
- ut_ad(page_id.space() == index->table->space->id);
+ ut_ad(page_id.space() == index->table->space_id);
ut_a(op < IBUF_OP_COUNT);
do_merge = FALSE;
@@ -4763,7 +4754,7 @@ reset_bit:
btr_pcur_close(&pcur);
mem_heap_free(heap);
- my_atomic_addlint(&ibuf->n_merges, 1);
+ ibuf->n_merges++;
ibuf_add_ops(ibuf->n_merged_ops, mops);
ibuf_add_ops(ibuf->n_discarded_ops, dops);
@@ -4900,7 +4891,7 @@ ibuf_print(
ibuf->size,
ibuf->free_list_len,
ibuf->seg_size,
- ibuf->n_merges);
+ ulint{ibuf->n_merges});
fputs("merged operations:\n ", file);
ibuf_print_ops(ibuf->n_merged_ops, file);
@@ -4927,6 +4918,20 @@ ibuf_print(
mutex_exit(&ibuf_mutex);
}
+/** Check if a page is all zeroes.
+@param[in] read_buf database page
+@param[in] size page size
+@return whether the page is all zeroes */
+static bool buf_page_is_zeroes(const byte* read_buf, const page_size_t& size)
+{
+ for (ulint i = 0; i < size.physical(); i++) {
+ if (read_buf[i] != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
/** Check the insert buffer bitmaps on IMPORT TABLESPACE.
@param[in] trx transaction
@param[in,out] space tablespace being imported
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index 484bba20a4e..42d7cb3d32b 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -28,12 +28,9 @@ Created 6/2/1994 Heikki Tuuri
#ifndef btr0btr_h
#define btr0btr_h
-#include "univ.i"
-
#include "dict0dict.h"
#include "data0data.h"
#include "page0cur.h"
-#include "mtr0mtr.h"
#include "btr0types.h"
#include "gis0type.h"
@@ -175,24 +172,19 @@ record is in spatial index */
| BTR_LATCH_FOR_DELETE \
| BTR_MODIFY_EXTERNAL)))
-/**************************************************************//**
-Report that an index page is corrupted. */
-void
-btr_corruption_report(
-/*==================*/
- const buf_block_t* block, /*!< in: corrupted block */
- const dict_index_t* index) /*!< in: index tree */
- ATTRIBUTE_COLD __attribute__((nonnull));
+/** Report that an index page is corrupted.
+@param[in] buffer block
+@param[in] index tree */
+ATTRIBUTE_COLD ATTRIBUTE_NORETURN __attribute__((nonnull))
+void btr_corruption_report(const buf_block_t* block,const dict_index_t* index);
/** Assert that a B-tree page is not corrupted.
@param block buffer block containing a B-tree page
@param index the B-tree index */
-#define btr_assert_not_corrupted(block, index) \
- if ((ibool) !!page_is_comp(buf_block_get_frame(block)) \
- != dict_table_is_comp((index)->table)) { \
- btr_corruption_report(block, index); \
- ut_error; \
- }
+#define btr_assert_not_corrupted(block, index) \
+ if (!!page_is_comp(buf_block_get_frame(block)) \
+ != index->table->not_redundant()) \
+ btr_corruption_report(block, index)
/**************************************************************//**
Gets the root node of a tree and sx-latches it for segment access.
@@ -812,8 +804,7 @@ dberr_t
btr_validate_index(
/*===============*/
dict_index_t* index, /*!< in: index */
- const trx_t* trx, /*!< in: transaction or 0 */
- bool lockout)/*!< in: true if X-latch index is intended */
+ const trx_t* trx) /*!< in: transaction or 0 */
MY_ATTRIBUTE((warn_unused_result));
/*************************************************************//**
@@ -861,5 +852,6 @@ btr_lift_page_up(
/****************************************************************
Global variable controlling if scrubbing should be performed */
extern my_bool srv_immediate_scrub_data_uncompressed;
+extern Atomic_counter<uint32_t> btr_validate_index_running;
#endif
diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h
index 5047dce38b4..4e25d12d786 100644
--- a/storage/innobase/include/btr0bulk.h
+++ b/storage/innobase/include/btr0bulk.h
@@ -28,7 +28,6 @@ Created 03/11/2014 Shaohua Wang
#include "dict0dict.h"
#include "page0cur.h"
-#include "ut0new.h"
#include <vector>
@@ -287,8 +286,7 @@ public:
{
#ifdef UNIV_DEBUG
if (m_flush_observer)
- my_atomic_addlint(&m_index->table->space->redo_skipped_count,
- 1);
+ m_index->table->space->redo_skipped_count++;
#endif /* UNIV_DEBUG */
}
@@ -297,8 +295,7 @@ public:
{
#ifdef UNIV_DEBUG
if (m_flush_observer)
- my_atomic_addlint(&m_index->table->space->redo_skipped_count,
- ulint(-1));
+ m_index->table->space->redo_skipped_count--;
#endif /* UNIV_DEBUG */
}
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index f8afa03ce3f..358f394c5b4 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -27,12 +27,11 @@ Created 10/16/1994 Heikki Tuuri
#ifndef btr0cur_h
#define btr0cur_h
-#include "univ.i"
-#include "my_base.h"
#include "dict0dict.h"
#include "page0cur.h"
#include "btr0types.h"
#include "gis0type.h"
+#include "my_base.h"
/** Mode flags for btr_cur operations; these can be ORed */
enum {
diff --git a/storage/innobase/include/btr0defragment.h b/storage/innobase/include/btr0defragment.h
index 9c78ec412a2..8965889b7e9 100644
--- a/storage/innobase/include/btr0defragment.h
+++ b/storage/innobase/include/btr0defragment.h
@@ -26,9 +26,9 @@ this program; if not, write to the Free Software Foundation, Inc.,
#define BTR_DEFRAGMENT_MAX_N_PAGES 32
/** stats in btr_defragment */
-extern ulint btr_defragment_compression_failures;
-extern ulint btr_defragment_failures;
-extern ulint btr_defragment_count;
+extern Atomic_counter<ulint> btr_defragment_compression_failures;
+extern Atomic_counter<ulint> btr_defragment_failures;
+extern Atomic_counter<ulint> btr_defragment_count;
/** Item in the work queue for btr_degrament_thread. */
struct btr_defragment_item_t
diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h
index 747ad676e33..b69d07811f3 100644
--- a/storage/innobase/include/btr0pcur.h
+++ b/storage/innobase/include/btr0pcur.h
@@ -27,14 +27,9 @@ Created 2/23/1996 Heikki Tuuri
#ifndef btr0pcur_h
#define btr0pcur_h
-#include "univ.i"
#include "dict0dict.h"
-#include "data0data.h"
-#include "mtr0mtr.h"
-#include "page0cur.h"
#include "btr0cur.h"
#include "btr0btr.h"
-#include "btr0types.h"
#include "gis0rtree.h"
/* Relative positions for a stored cursor position */
diff --git a/storage/innobase/include/btr0scrub.h b/storage/innobase/include/btr0scrub.h
index 8029cc91005..feaf61784d0 100644
--- a/storage/innobase/include/btr0scrub.h
+++ b/storage/innobase/include/btr0scrub.h
@@ -3,13 +3,7 @@
#ifndef btr0scrub_h
#define btr0scrub_h
-#include "univ.i"
-
#include "dict0dict.h"
-#include "data0data.h"
-#include "page0cur.h"
-#include "mtr0mtr.h"
-#include "btr0types.h"
/**
* enum describing page allocation status
diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
index f0174a2610c..0c8b152d413 100644
--- a/storage/innobase/include/btr0sea.h
+++ b/storage/innobase/include/btr0sea.h
@@ -27,12 +27,7 @@ Created 2/17/1996 Heikki Tuuri
#ifndef btr0sea_h
#define btr0sea_h
-#include "univ.i"
-
-#include "rem0rec.h"
#include "dict0dict.h"
-#include "btr0types.h"
-#include "mtr0mtr.h"
#ifdef BTR_CUR_HASH_ADAPT
#include "ha0ha.h"
diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h
index 615ad5e5ae0..fa59275dbff 100644
--- a/storage/innobase/include/btr0types.h
+++ b/storage/innobase/include/btr0types.h
@@ -27,12 +27,9 @@ Created 2/17/1996 Heikki Tuuri
#ifndef btr0types_h
#define btr0types_h
-#include "univ.i"
-
-#include "rem0types.h"
#include "page0types.h"
-#include "sync0rw.h"
#include "page0size.h"
+#include "rem0types.h"
/** Persistent cursor */
struct btr_pcur_t;
diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h
index 8befc038f23..ed275ab1870 100644
--- a/storage/innobase/include/buf0buddy.h
+++ b/storage/innobase/include/buf0buddy.h
@@ -26,12 +26,6 @@ Created December 2006 by Marko Makela
#ifndef buf0buddy_h
#define buf0buddy_h
-#ifdef UNIV_MATERIALIZE
-# undef UNIV_INLINE
-# define UNIV_INLINE
-#endif
-
-#include "univ.i"
#include "buf0types.h"
/**********************************************************************//**
diff --git a/storage/innobase/include/buf0buddy.ic b/storage/innobase/include/buf0buddy.ic
index d166ab8441c..7eb739a99db 100644
--- a/storage/innobase/include/buf0buddy.ic
+++ b/storage/innobase/include/buf0buddy.ic
@@ -23,11 +23,6 @@ Binary buddy allocator for compressed pages
Created December 2006 by Marko Makela
*******************************************************/
-#ifdef UNIV_MATERIALIZE
-# undef UNIV_INLINE
-# define UNIV_INLINE
-#endif
-
#include "buf0buf.h"
#include "buf0buddy.h"
@@ -132,8 +127,3 @@ buf_buddy_free(
buf_buddy_free_low(buf_pool, buf, buf_buddy_get_slot(size));
}
-
-#ifdef UNIV_MATERIALIZE
-# undef UNIV_INLINE
-# define UNIV_INLINE UNIV_INLINE_ORIGINAL
-#endif
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 8ca9ddd28fe..e888cd64a0a 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -41,7 +41,6 @@ Created 11/5/1995 Heikki Tuuri
#include "os0proc.h"
#include "log0log.h"
#include "srv0srv.h"
-#include "my_atomic.h"
#include <ostream>
// Forward declaration
@@ -666,37 +665,6 @@ buf_block_buf_fix_inc_func(
buf_block_t* block) /*!< in/out: block to bufferfix */
MY_ATTRIBUTE((nonnull));
-/** Increments the bufferfix count.
-@param[in,out] bpage block to bufferfix
-@return the count */
-UNIV_INLINE
-ulint
-buf_block_fix(
- buf_page_t* bpage);
-
-/** Increments the bufferfix count.
-@param[in,out] block block to bufferfix
-@return the count */
-UNIV_INLINE
-ulint
-buf_block_fix(
- buf_block_t* block);
-
-/** Decrements the bufferfix count.
-@param[in,out] bpage block to bufferunfix
-@return the remaining buffer-fix count */
-UNIV_INLINE
-ulint
-buf_block_unfix(
- buf_page_t* bpage);
-/** Decrements the bufferfix count.
-@param[in,out] block block to bufferunfix
-@return the remaining buffer-fix count */
-UNIV_INLINE
-ulint
-buf_block_unfix(
- buf_block_t* block);
-
# ifdef UNIV_DEBUG
/** Increments the bufferfix count.
@param[in,out] b block to bufferfix
@@ -716,14 +684,12 @@ buf_block_unfix(
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] use_legacy_big_endian use legacy big endian algorithm
@return true if the page is in crc32 checksum format. */
bool
buf_page_is_checksum_valid_crc32(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2,
- bool use_legacy_big_endian)
+ ulint checksum_field2)
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
/** Checks if the page is in innodb checksum format.
@@ -750,15 +716,6 @@ buf_page_is_checksum_valid_none(
ulint checksum_field2)
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
-/** Checks if a page contains only zeroes.
-@param[in] read_buf database page
-@param[in] page_size page size
-@return true if page is filled with zeroes */
-bool
-buf_page_is_zeroes(
- const byte* read_buf,
- const page_size_t& page_size);
-
/** Check if a page is corrupt.
@param[in] check_lsn whether the LSN should be checked
@param[in] read_buf database page
@@ -777,9 +734,7 @@ buf_page_is_corrupted(
#endif
MY_ATTRIBUTE((warn_unused_result));
-
#ifndef UNIV_INNOCHECKSUM
-
/**********************************************************************//**
Gets the space id, page offset, and byte offset within page of a
pointer pointing to a buffer frame containing a file page. */
@@ -1452,10 +1407,9 @@ buf_page_encrypt_before_write(
NOTE! The definition appears here only for other modules of this
directory (buf) to see it. Do not use from outside! */
-typedef struct {
-private:
- int32 reserved; /*!< true if this slot is reserved
- */
+class buf_tmp_buffer_t {
+ /** whether this slot is reserved */
+ std::atomic<bool> reserved;
public:
byte* crypt_buf; /*!< for encryption the data needs to be
copied to a separate buffer before it's
@@ -1471,18 +1425,16 @@ public:
/** Release the slot */
void release()
{
- my_atomic_store32_explicit(&reserved, false,
- MY_MEMORY_ORDER_RELAXED);
+ reserved.store(false, std::memory_order_relaxed);
}
/** Acquire the slot
@return whether the slot was acquired */
bool acquire()
{
- return !my_atomic_fas32_explicit(&reserved, true,
- MY_MEMORY_ORDER_RELAXED);
+ return !reserved.exchange(true, std::memory_order_relaxed);
}
-} buf_tmp_buffer_t;
+};
/** The common buffer control block structure
for compressed and uncompressed frames */
@@ -1502,12 +1454,15 @@ public:
/** Page id. Protected by buf_pool mutex. */
page_id_t id;
+ buf_page_t* hash; /*!< node used in chaining to
+ buf_pool->page_hash or
+ buf_pool->zip_hash */
/** Page size. Protected by buf_pool mutex. */
page_size_t size;
/** Count of how manyfold this block is currently bufferfixed. */
- ib_uint32_t buf_fix_count;
+ Atomic_counter<uint32_t> buf_fix_count;
/** type of pending I/O operation; also protected by
buf_pool->mutex for writes only */
@@ -1549,9 +1504,6 @@ public:
buf_tmp_buffer_t* slot; /*!< Slot for temporary memory
used for encryption/compression
or NULL */
- buf_page_t* hash; /*!< node used in chaining to
- buf_pool->page_hash or
- buf_pool->zip_hash */
#ifdef UNIV_DEBUG
ibool in_page_hash; /*!< TRUE if in buf_pool->page_hash */
ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */
@@ -1662,6 +1614,14 @@ public:
protected by buf_pool->zip_mutex
or buf_block_t::mutex. */
# endif /* UNIV_DEBUG */
+
+ void fix() { buf_fix_count++; }
+ uint32_t unfix()
+ {
+ uint32_t count= buf_fix_count--;
+ ut_ad(count != 0);
+ return count - 1;
+ }
};
/** The buffer control block structure */
@@ -1768,20 +1728,20 @@ struct buf_block_t{
/* @{ */
# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- ulint n_pointers; /*!< used in debugging: the number of
+ Atomic_counter<ulint>
+ n_pointers; /*!< used in debugging: the number of
pointers in the adaptive hash index
pointing to this frame;
protected by atomic memory access
or btr_search_own_all(). */
# define assert_block_ahi_empty(block) \
- ut_a(my_atomic_addlint(&(block)->n_pointers, 0) == 0)
+ ut_a((block)->n_pointers == 0)
# define assert_block_ahi_empty_on_init(block) do { \
UNIV_MEM_VALID(&(block)->n_pointers, sizeof (block)->n_pointers); \
assert_block_ahi_empty(block); \
} while (0)
# define assert_block_ahi_valid(block) \
- ut_a((block)->index \
- || my_atomic_loadlint(&(block)->n_pointers) == 0)
+ ut_a((block)->index || (block)->n_pointers == 0)
# else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
# define assert_block_ahi_empty(block) /* nothing */
# define assert_block_ahi_empty_on_init(block) /* nothing */
@@ -1813,7 +1773,7 @@ struct buf_block_t{
# ifdef UNIV_DEBUG
/** @name Debug fields */
/* @{ */
- rw_lock_t debug_latch; /*!< in the debug version, each thread
+ rw_lock_t* debug_latch; /*!< in the debug version, each thread
which bufferfixes the block acquires
an s-latch here; so we can use the
debug utilities in sync0rw */
@@ -1825,6 +1785,9 @@ struct buf_block_t{
and accessed; we introduce this new
mutex in InnoDB-5.1 to relieve
contention on the buffer pool mutex */
+
+ void fix() { page.fix(); }
+ uint32_t unfix() { return page.unfix(); }
};
/** Check if a buf_block_t object is in a valid state
@@ -2099,7 +2062,8 @@ struct buf_pool_t{
indexed by block->frame */
ulint n_pend_reads; /*!< number of pending read
operations */
- ulint n_pend_unzip; /*!< number of pending decompressions */
+ Atomic_counter<ulint>
+ n_pend_unzip; /*!< number of pending decompressions */
time_t last_printout_time;
/*!< when buf_print_io was last time
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 7ca08449c8c..2169eedd015 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -35,9 +35,7 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0flu.h"
#include "buf0lru.h"
#include "buf0rea.h"
-#include "sync0debug.h"
#include "fsp0types.h"
-#include "ut0new.h"
/** A chunk of buffers. The buffer pool is allocated in chunks. */
struct buf_chunk_t{
@@ -947,28 +945,6 @@ buf_block_get_modify_clock(
return(block->modify_clock);
}
-/** Increments the bufferfix count.
-@param[in,out] bpage block to bufferfix
-@return the count */
-UNIV_INLINE
-ulint
-buf_block_fix(
- buf_page_t* bpage)
-{
- return uint32(my_atomic_add32((int32*) &bpage->buf_fix_count, 1) + 1);
-}
-
-/** Increments the bufferfix count.
-@param[in,out] block block to bufferfix
-@return the count */
-UNIV_INLINE
-ulint
-buf_block_fix(
- buf_block_t* block)
-{
- return(buf_block_fix(&block->page));
-}
-
/*******************************************************************//**
Increments the bufferfix count. */
UNIV_INLINE
@@ -987,37 +963,12 @@ buf_block_buf_fix_inc_func(
threaded. */
if (!fsp_is_system_temporary(block->page.id.space())) {
ibool ret;
- ret = rw_lock_s_lock_nowait(&block->debug_latch, file, line);
+ ret = rw_lock_s_lock_nowait(block->debug_latch, file, line);
ut_a(ret);
}
#endif /* UNIV_DEBUG */
- buf_block_fix(block);
-}
-
-/** Decrements the bufferfix count.
-@param[in,out] bpage block to bufferunfix
-@return the remaining buffer-fix count */
-UNIV_INLINE
-ulint
-buf_block_unfix(
- buf_page_t* bpage)
-{
- uint32 count = uint32(my_atomic_add32((int32*) &bpage->buf_fix_count,
- -1));
- ut_ad(count != 0);
- return count - 1;
-}
-
-/** Decrements the bufferfix count.
-@param[in,out] block block to bufferunfix
-@return the remaining buffer-fix count */
-UNIV_INLINE
-ulint
-buf_block_unfix(
- buf_block_t* block)
-{
- return(buf_block_unfix(&block->page));
+ block->fix();
}
/*******************************************************************//**
@@ -1028,14 +979,14 @@ buf_block_buf_fix_dec(
/*==================*/
buf_block_t* block) /*!< in/out: block to bufferunfix */
{
- buf_block_unfix(block);
+ block->unfix();
#ifdef UNIV_DEBUG
/* No debug latch is acquired if block belongs to system temporary.
Debug latch is not of much help if access to block is single
threaded. */
if (!fsp_is_system_temporary(block->page.id.space())) {
- rw_lock_s_unlock(&block->debug_latch);
+ rw_lock_s_unlock(block->debug_latch);
}
#endif /* UNIV_DEBUG */
}
@@ -1278,14 +1229,14 @@ buf_page_release_zip(
is single threaded. */
buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
if (!fsp_is_system_temporary(block->page.id.space())) {
- rw_lock_s_unlock(&block->debug_latch);
+ rw_lock_s_unlock(block->debug_latch);
}
}
#endif /* UNIV_DEBUG */
/* Fall through */
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
- buf_block_unfix(reinterpret_cast<buf_block_t*>(bpage));
+ reinterpret_cast<buf_block_t*>(bpage)->unfix();
return;
case BUF_BLOCK_POOL_WATCH:
@@ -1314,7 +1265,7 @@ buf_page_release_latch(
temporary. Debug latch is not of much help if access to block
is single threaded. */
if (!fsp_is_system_temporary(block->page.id.space())) {
- rw_lock_s_unlock(&block->debug_latch);
+ rw_lock_s_unlock(block->debug_latch);
}
#endif /* UNIV_DEBUG */
diff --git a/storage/innobase/include/buf0checksum.h b/storage/innobase/include/buf0checksum.h
index dc0dbafa4c4..6b2e4c86990 100644
--- a/storage/innobase/include/buf0checksum.h
+++ b/storage/innobase/include/buf0checksum.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -27,23 +27,15 @@ Created Aug 11, 2011 Vasil Dimov
#ifndef buf0checksum_h
#define buf0checksum_h
-#include "univ.i"
-
#include "buf0types.h"
/** Calculate the CRC32 checksum of a page. The value is stored to the page
when it is written to a file and also checked for a match when reading from
-the file. When reading we allow both normal CRC32 and CRC-legacy-big-endian
-variants. Note that we must be careful to calculate the same value on 32-bit
-and 64-bit architectures.
+the file. Note that we must be careful to calculate the same value on all
+architectures.
@param[in] page buffer page (srv_page_size bytes)
-@param[in] use_legacy_big_endian if true then use big endian
-byteorder when converting byte strings to integers
-@return checksum */
-uint32_t
-buf_calc_page_crc32(
- const byte* page,
- bool use_legacy_big_endian = false);
+@return CRC-32C */
+uint32_t buf_calc_page_crc32(const byte* page);
/** Calculate a checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value on
@@ -71,6 +63,5 @@ const char*
buf_checksum_algorithm_name(srv_checksum_algorithm_t algo);
extern ulong srv_checksum_algorithm;
-extern bool legacy_big_endian_checksum;
#endif /* buf0checksum_h */
diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h
index 5d2e5e9fdf7..0f0cc53ba1b 100644
--- a/storage/innobase/include/buf0dblwr.h
+++ b/storage/innobase/include/buf0dblwr.h
@@ -27,7 +27,6 @@ Created 2011/12/19 Inaam Rana
#ifndef buf0dblwr_h
#define buf0dblwr_h
-#include "univ.i"
#include "ut0byte.h"
#include "log0log.h"
#include "buf0types.h"
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index 741cb1dbca3..625f9357771 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -27,7 +27,6 @@ Created 11/5/1995 Heikki Tuuri
#ifndef buf0flu_h
#define buf0flu_h
-#include "univ.i"
#include "ut0byte.h"
#include "log0log.h"
#include "buf0types.h"
@@ -192,18 +191,6 @@ buf_flush_note_modification(
lsn_t end_lsn, /*!< in: end lsn of the last mtr in the
set of mtr's */
FlushObserver* observer); /*!< in: flush observer */
-
-/********************************************************************//**
-This function should be called when recovery has modified a buffer page. */
-UNIV_INLINE
-void
-buf_flush_recv_note_modification(
-/*=============================*/
- buf_block_t* block, /*!< in: block which is modified */
- lsn_t start_lsn, /*!< in: start lsn of the first mtr in a
- set of mtr's */
- lsn_t end_lsn); /*!< in: end lsn of the last mtr in the
- set of mtr's */
/********************************************************************//**
Returns TRUE if the file page block is immediately suitable for replacement,
i.e., transition FILE_PAGE => NOT_USED allowed.
diff --git a/storage/innobase/include/buf0flu.ic b/storage/innobase/include/buf0flu.ic
index 5a682ed121a..0652d108ca2 100644
--- a/storage/innobase/include/buf0flu.ic
+++ b/storage/innobase/include/buf0flu.ic
@@ -38,17 +38,6 @@ buf_flush_insert_into_flush_list(
lsn_t lsn); /*!< in: oldest modification */
/********************************************************************//**
-Inserts a modified block into the flush list in the right sorted position.
-This function is used by recovery, because there the modifications do not
-necessarily come in the order of lsn's. */
-void
-buf_flush_insert_sorted_into_flush_list(
-/*====================================*/
- buf_pool_t* buf_pool, /*!< buffer pool instance */
- buf_block_t* block, /*!< in/out: block which is modified */
- lsn_t lsn); /*!< in: oldest modification */
-
-/********************************************************************//**
This function should be called at a mini-transaction commit, if a page was
modified in it. Puts the block to the list of modified blocks, if it is not
already in it. */
@@ -63,24 +52,11 @@ buf_flush_note_modification(
modified this block */
FlushObserver* observer) /*!< in: flush observer */
{
-#ifdef UNIV_DEBUG
- {
- /* Allow write to proceed to shared temporary tablespace
- in read-only mode. */
- ut_ad(!srv_read_only_mode
- || fsp_is_system_temporary(block->page.id.space()));
- ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
- ut_ad(block->page.buf_fix_count > 0);
-
- buf_pool_t* buf_pool = buf_pool_from_block(block);
-
- ut_ad(!buf_pool_mutex_own(buf_pool));
- ut_ad(!buf_flush_list_mutex_own(buf_pool));
- }
-#endif /* UNIV_DEBUG */
-
mutex_enter(&block->mutex);
-
+ ut_ad(!srv_read_only_mode
+ || fsp_is_system_temporary(block->page.id.space()));
+ ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
+ ut_ad(block->page.buf_fix_count > 0);
ut_ad(block->page.newest_modification <= end_lsn);
block->page.newest_modification = end_lsn;
@@ -98,52 +74,7 @@ buf_flush_note_modification(
ut_ad(block->page.oldest_modification <= start_lsn);
}
- buf_page_mutex_exit(block);
+ mutex_exit(&block->mutex);
srv_stats.buf_pool_write_requests.inc();
}
-
-/********************************************************************//**
-This function should be called when recovery has modified a buffer page. */
-UNIV_INLINE
-void
-buf_flush_recv_note_modification(
-/*=============================*/
- buf_block_t* block, /*!< in: block which is modified */
- lsn_t start_lsn, /*!< in: start lsn of the first mtr in a
- set of mtr's */
- lsn_t end_lsn) /*!< in: end lsn of the last mtr in the
- set of mtr's */
-{
-#ifdef UNIV_DEBUG
- {
- ut_ad(!srv_read_only_mode);
- ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
- ut_ad(block->page.buf_fix_count > 0);
-
- buf_pool_t* buf_pool = buf_pool_from_block(block);
-
- ut_ad(!buf_pool_mutex_own(buf_pool));
- ut_ad(!buf_flush_list_mutex_own(buf_pool));
-
- ut_ad(start_lsn != 0);
- ut_ad(block->page.newest_modification <= end_lsn);
- }
-#endif /* UNIV_DEBUG */
-
- buf_page_mutex_enter(block);
-
- block->page.newest_modification = end_lsn;
-
- if (!block->page.oldest_modification) {
- buf_pool_t* buf_pool = buf_pool_from_block(block);
-
- buf_flush_insert_sorted_into_flush_list(
- buf_pool, block, start_lsn);
- } else {
- ut_ad(block->page.oldest_modification <= start_lsn);
- }
-
- buf_page_mutex_exit(block);
-
-}
diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
index d3e953ad9c7..81a257b0371 100644
--- a/storage/innobase/include/buf0lru.h
+++ b/storage/innobase/include/buf0lru.h
@@ -27,7 +27,6 @@ Created 11/5/1995 Heikki Tuuri
#ifndef buf0lru_h
#define buf0lru_h
-#include "univ.i"
#include "ut0byte.h"
#include "buf0types.h"
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index a7c43e01467..c32b0d3637e 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -27,9 +27,7 @@ Created 11/5/1995 Heikki Tuuri
#ifndef buf0rea_h
#define buf0rea_h
-#include "univ.i"
#include "buf0buf.h"
-#include "buf0types.h"
/** High-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h
index a120cd358ab..8505505270b 100644
--- a/storage/innobase/include/data0data.h
+++ b/storage/innobase/include/data0data.h
@@ -27,8 +27,6 @@ Created 5/30/1994 Heikki Tuuri
#ifndef data0data_h
#define data0data_h
-#include "univ.i"
-
#include "data0types.h"
#include "data0type.h"
#include "mem0mem.h"
diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h
index 25aced44b2e..d9d4b3d69d5 100644
--- a/storage/innobase/include/dict0boot.h
+++ b/storage/innobase/include/dict0boot.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -26,13 +27,10 @@ Created 4/18/1996 Heikki Tuuri
#ifndef dict0boot_h
#define dict0boot_h
-#include "univ.i"
-
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "ut0byte.h"
#include "buf0buf.h"
-#include "fsp0fsp.h"
#include "dict0dict.h"
typedef byte dict_hdr_t;
@@ -53,12 +51,8 @@ dict_hdr_get_new_id(
(not assigned if NULL) */
index_id_t* index_id, /*!< out: index id
(not assigned if NULL) */
- ulint* space_id, /*!< out: space id
+ ulint* space_id); /*!< out: space id
(not assigned if NULL) */
- const dict_table_t* table, /*!< in: table */
- bool disable_redo); /*!< in: if true and table
- object is NULL
- then disable-redo */
/**********************************************************************//**
Writes the current value of the row id counter to the dictionary header file
page. */
@@ -127,13 +121,6 @@ dict_is_sys_table(
/* The following is a secondary index on SYS_TABLES */
#define DICT_TABLE_IDS_ID 5
-#define DICT_HDR_FIRST_ID 10 /* the ids for tables etc. start
- from this number, except for basic
- system tables and their above defined
- indexes; ibuf tables and indexes are
- assigned as the id the number
- DICT_IBUF_ID_MIN plus the space id */
-
/* The offset of the dictionary header on the page */
#define DICT_HDR FSEG_PAGE_DATA
diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h
index dc48aa59809..8c941d494c1 100644
--- a/storage/innobase/include/dict0crea.h
+++ b/storage/innobase/include/dict0crea.h
@@ -27,14 +27,11 @@ Created 1/8/1996 Heikki Tuuri
#ifndef dict0crea_h
#define dict0crea_h
-#include "univ.i"
-#include "dict0types.h"
#include "dict0dict.h"
#include "que0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
#include "fil0crypt.h"
-#include "fsp0space.h"
/*********************************************************************//**
Creates a table create graph.
@@ -70,14 +67,6 @@ dict_create_table_step(
/*===================*/
que_thr_t* thr); /*!< in: query thread */
-/** Assign a new table ID and put it into the table cache and the transaction.
-@param[in,out] table Table that needs an ID
-@param[in,out] trx Transaction */
-void
-dict_table_assign_new_id(
- dict_table_t* table,
- trx_t* trx);
-
/***********************************************************//**
Creates an index. This is a high-level function used in SQL execution
graphs.
diff --git a/storage/innobase/include/dict0defrag_bg.h b/storage/innobase/include/dict0defrag_bg.h
index ddef139853c..fe75c6a21d1 100644
--- a/storage/innobase/include/dict0defrag_bg.h
+++ b/storage/innobase/include/dict0defrag_bg.h
@@ -27,12 +27,9 @@ Created 25/08/2016 Jan Lindström
#ifndef dict0defrag_bg_h
#define dict0defrag_bg_h
-#include "univ.i"
-
-#include "dict0types.h"
#include "os0event.h"
#include "os0thread.h"
-
+#include "dict0types.h"
/** Indices whose defrag stats need to be saved to persistent storage.*/
struct defrag_pool_item_t {
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 6a098591256..e602a81ed27 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -28,30 +28,17 @@ Created 1/8/1996 Heikki Tuuri
#ifndef dict0dict_h
#define dict0dict_h
-#include "univ.i"
#include "data0data.h"
-#include "data0type.h"
#include "dict0mem.h"
-#include "dict0types.h"
#include "fsp0fsp.h"
-#include "fsp0sysspace.h"
-#include "hash0hash.h"
-#include "mem0mem.h"
-#include "rem0types.h"
-#include "row0types.h"
-#include "trx0types.h"
-#include "ut0byte.h"
-#include "ut0mem.h"
-#include "ut0new.h"
-#include "ut0rnd.h"
#include <deque>
-#include "fsp0fsp.h"
-#include "dict0pagecompress.h"
extern bool innodb_table_stats_not_found;
extern bool innodb_index_stats_not_found;
-#include "sync0rw.h"
+/** the first table or index ID for other than hard-coded system tables */
+#define DICT_HDR_FIRST_ID 10
+
/********************************************************************//**
Get the database name length in a table name.
@return database name length */
@@ -689,65 +676,14 @@ do { \
dict_table_skip_corrupt_index(index); \
} while (0)
-/********************************************************************//**
-Check whether the index is the clustered index.
-@return nonzero for clustered index, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_clust(
-/*================*/
- const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Check if index is auto-generated clustered index.
-@param[in] index index
-
-@return true if index is auto-generated clustered index. */
-UNIV_INLINE
-bool
-dict_index_is_auto_gen_clust(
- const dict_index_t* index);
-
-/********************************************************************//**
-Check whether the index is unique.
-@return nonzero for unique index, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_unique(
-/*=================*/
- const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((warn_unused_result));
-/********************************************************************//**
-Check whether the index is a Spatial Index.
-@return nonzero for Spatial Index, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_spatial(
-/*==================*/
- const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((warn_unused_result));
-
+#define dict_index_is_clust(index) (index)->is_clust()
+#define dict_index_is_auto_gen_clust(index) (index)->is_gen_clust()
+#define dict_index_is_unique(index) (index)->is_unique()
+#define dict_index_is_spatial(index) (index)->is_spatial()
+#define dict_index_is_ibuf(index) (index)->is_ibuf()
+#define dict_index_is_sec_or_ibuf(index) !(index)->is_primary()
#define dict_index_has_virtual(index) (index)->has_virtual()
-/********************************************************************//**
-Check whether the index is the insert buffer tree.
-@return nonzero for insert buffer, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_ibuf(
-/*===============*/
- const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((warn_unused_result));
-/********************************************************************//**
-Check whether the index is a secondary index or the insert buffer tree.
-@return nonzero for insert buffer, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_sec_or_ibuf(
-/*======================*/
- const dict_index_t* index) /*!< in: index */
- MY_ATTRIBUTE((warn_unused_result));
-
/** Get all the FTS indexes on a table.
@param[in] table table
@param[out] indexes all FTS indexes on this table
@@ -904,15 +840,8 @@ dict_index_get_min_size(
/*====================*/
const dict_index_t* index) /*!< in: index */
MY_ATTRIBUTE((nonnull, warn_unused_result));
-/********************************************************************//**
-Check whether the table uses the compact page format.
-@return TRUE if table uses the compact page format */
-UNIV_INLINE
-bool
-dict_table_is_comp(
-/*===============*/
- const dict_table_t* table) /*!< in: table */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+
+#define dict_table_is_comp(table) (table)->not_redundant()
/** Determine if a table uses atomic BLOBs (no locally stored prefix).
@param[in] table InnoDB table
@@ -1226,21 +1155,6 @@ dict_index_get_nth_col_or_prefix_pos(
ulint* prefix_col_pos) /*!< out: col num if prefix
*/
__attribute__((warn_unused_result));
-
-/********************************************************************//**
-Returns TRUE if the index contains a column or a prefix of that column.
-@param[in] index index
-@param[in] n column number
-@param[in] is_virtual whether it is a virtual col
-@return TRUE if contains the column or its prefix */
-bool
-dict_index_contains_col_or_prefix(
-/*==============================*/
- const dict_index_t* index, /*!< in: index */
- ulint n, /*!< in: column number */
- bool is_virtual)
- /*!< in: whether it is a virtual col */
- MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
Looks for a matching field in an index. The column has to be the same. The
column in index must be complete, or must contain a prefix longer than the
@@ -1265,16 +1179,6 @@ dict_table_get_nth_col_pos(
ulint n, /*!< in: column number */
ulint* prefix_col_pos) /*!< out: col num if prefix */
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
-/********************************************************************//**
-Returns the position of a system column in an index.
-@return position, ULINT_UNDEFINED if not contained */
-UNIV_INLINE
-ulint
-dict_index_get_sys_col_pos(
-/*=======================*/
- const dict_index_t* index, /*!< in: index */
- ulint type) /*!< in: DATA_ROW_ID, ... */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
/*******************************************************************//**
Adds a column to index. */
void
@@ -1372,21 +1276,6 @@ dict_index_build_node_ptr(
ulint level) /*!< in: level of rec in tree:
0 means leaf level */
MY_ATTRIBUTE((nonnull, warn_unused_result));
-/**********************************************************************//**
-Copies an initial segment of a physical record, long enough to specify an
-index entry uniquely.
-@return pointer to the prefix record */
-rec_t*
-dict_index_copy_rec_order_prefix(
-/*=============================*/
- const dict_index_t* index, /*!< in: index */
- const rec_t* rec, /*!< in: record for which to
- copy prefix */
- ulint* n_fields,/*!< out: number of fields copied */
- byte** buf, /*!< in/out: memory buffer for the
- copied prefix, or NULL */
- ulint* buf_size)/*!< in/out: buffer size */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Convert a physical record into a search tuple.
@param[in] rec index record (not necessarily in an index page)
@param[in] index index
@@ -1642,8 +1531,10 @@ struct dict_sys_t{
the log records */
hash_table_t* table_hash; /*!< hash table of the tables, based
on name */
- hash_table_t* table_id_hash; /*!< hash table of the tables, based
- on id */
+ /** hash table of persistent table IDs */
+ hash_table_t* table_id_hash;
+ /** hash table of temporary table IDs */
+ hash_table_t* temp_id_hash;
dict_table_t* sys_tables; /*!< SYS_TABLES table */
dict_table_t* sys_columns; /*!< SYS_COLUMNS table */
dict_table_t* sys_indexes; /*!< SYS_INDEXES table */
@@ -1657,6 +1548,52 @@ struct dict_sys_t{
UT_LIST_BASE_NODE_T(dict_table_t)
table_non_LRU; /*!< List of tables that can't be
evicted from the cache */
+
+ /** @return a new temporary table ID */
+ table_id_t get_temporary_table_id() {
+ return temp_table_id.fetch_add(1, std::memory_order_relaxed);
+ }
+
+ /** Look up a temporary table.
+ @param id temporary table ID
+ @return temporary table
+ @retval NULL if the table does not exist
+ (should only happen during the rollback of CREATE...SELECT) */
+ dict_table_t* get_temporary_table(table_id_t id)
+ {
+ ut_ad(mutex_own(&mutex));
+ dict_table_t* table;
+ ulint fold = ut_fold_ull(id);
+ HASH_SEARCH(id_hash, temp_id_hash, fold, dict_table_t*, table,
+ ut_ad(table->cached), table->id == id);
+ if (UNIV_LIKELY(table != NULL)) {
+ DBUG_ASSERT(table->is_temporary());
+ DBUG_ASSERT(table->id >= DICT_HDR_FIRST_ID);
+ table->acquire();
+ }
+ return table;
+ }
+
+ /** Look up a persistent table.
+ @param id table ID
+ @return table
+ @retval NULL if not cached */
+ dict_table_t* get_table(table_id_t id)
+ {
+ ut_ad(mutex_own(&mutex));
+ dict_table_t* table;
+ ulint fold = ut_fold_ull(id);
+ HASH_SEARCH(id_hash, table_id_hash, fold, dict_table_t*, table,
+ ut_ad(table->cached), table->id == id);
+ DBUG_ASSERT(!table || !table->is_temporary());
+ return table;
+ }
+
+ dict_sys_t() : temp_table_id(DICT_HDR_FIRST_ID) {}
+
+private:
+ /** the sequence of temporary table IDs */
+ std::atomic<table_id_t> temp_table_id;
};
/** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index 6dcc40db70a..b970eaf0861 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -24,13 +24,8 @@ Data dictionary system
Created 1/8/1996 Heikki Tuuri
***********************************************************************/
-#include "data0type.h"
-#include "dict0load.h"
-#include "rem0types.h"
-#include "fsp0fsp.h"
-#include "srv0srv.h"
-#include "sync0rw.h"
#include "fsp0sysspace.h"
+#include "dict0pagecompress.h"
/*********************************************************************//**
Gets the minimum number of bytes per character.
@@ -261,89 +256,6 @@ dict_table_get_next_index(
#endif /* UNIV_DEBUG */
/********************************************************************//**
-Check whether the index is the clustered index.
-@return nonzero for clustered index, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_clust(
-/*================*/
- const dict_index_t* index) /*!< in: index */
-{
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- return(index->type & DICT_CLUSTERED);
-}
-
-/** Check if index is auto-generated clustered index.
-@param[in] index index
-
-@return true if index is auto-generated clustered index. */
-UNIV_INLINE
-bool
-dict_index_is_auto_gen_clust(
- const dict_index_t* index)
-{
- return(index->type == DICT_CLUSTERED);
-}
-
-/********************************************************************//**
-Check whether the index is unique.
-@return nonzero for unique index, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_unique(
-/*=================*/
- const dict_index_t* index) /*!< in: index */
-{
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- return(index->type & DICT_UNIQUE);
-}
-
-/********************************************************************//**
-Check whether the index is a Spatial Index.
-@return nonzero for Spatial Index, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_spatial(
-/*==================*/
- const dict_index_t* index) /*!< in: index */
-{
- ut_ad(index);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- return ulint(UNIV_EXPECT(index->type & DICT_SPATIAL, 0));
-}
-
-/********************************************************************//**
-Check whether the index is the insert buffer tree.
-@return nonzero for insert buffer, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_ibuf(
-/*===============*/
- const dict_index_t* index) /*!< in: index */
-{
- ut_ad(index);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- return(index->type & DICT_IBUF);
-}
-
-/********************************************************************//**
-Check whether the index is a secondary index or the insert buffer tree.
-@return nonzero for insert buffer, zero for other indexes */
-UNIV_INLINE
-ulint
-dict_index_is_sec_or_ibuf(
-/*======================*/
- const dict_index_t* index) /*!< in: index */
-{
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-
- return((index->type & (DICT_CLUSTERED | DICT_IBUF)) != DICT_CLUSTERED);
-}
-
-/********************************************************************//**
Gets the number of user-defined non-virtual columns in a table in the
dictionary cache.
@return number of user-defined (e.g., not ROW_ID) non-virtual
@@ -532,19 +444,6 @@ dict_table_get_sys_col_no(
return unsigned(table->n_cols) + (sys - DATA_N_SYS_COLS);
}
-/********************************************************************//**
-Check whether the table uses the compact page format.
-@return TRUE if table uses the compact page format */
-UNIV_INLINE
-bool
-dict_table_is_comp(
-/*===============*/
- const dict_table_t* table) /*!< in: table */
-{
- ut_ad(table);
- return (table->flags & DICT_TF_COMPACT) != 0;
-}
-
/************************************************************************
Check if the table has an FTS index. */
UNIV_INLINE
@@ -692,31 +591,30 @@ dict_tf_set(
bool page_compressed,
ulint page_compression_level)
{
+ *flags = use_data_dir ? 1 << DICT_TF_POS_DATA_DIR : 0;
+
switch (format) {
case REC_FORMAT_REDUNDANT:
- *flags = 0;
ut_ad(zip_ssize == 0);
- break;
+ /* no other options are allowed */
+ ut_ad(!page_compressed);
+ return;
case REC_FORMAT_COMPACT:
- *flags = DICT_TF_COMPACT;
+ *flags |= DICT_TF_COMPACT;
ut_ad(zip_ssize == 0);
break;
case REC_FORMAT_COMPRESSED:
- *flags = DICT_TF_COMPACT
+ *flags |= DICT_TF_COMPACT
| (1 << DICT_TF_POS_ATOMIC_BLOBS)
| (zip_ssize << DICT_TF_POS_ZIP_SSIZE);
break;
case REC_FORMAT_DYNAMIC:
- *flags = DICT_TF_COMPACT
+ *flags |= DICT_TF_COMPACT
| (1 << DICT_TF_POS_ATOMIC_BLOBS);
ut_ad(zip_ssize == 0);
break;
}
- if (use_data_dir) {
- *flags |= (1 << DICT_TF_POS_DATA_DIR);
- }
-
if (page_compressed) {
*flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS)
| (1 << DICT_TF_POS_PAGE_COMPRESSION)
@@ -1021,31 +919,6 @@ dict_index_get_nth_field(
}
#endif /* UNIV_DEBUG */
-/********************************************************************//**
-Returns the position of a system column in an index.
-@return position, ULINT_UNDEFINED if not contained */
-UNIV_INLINE
-ulint
-dict_index_get_sys_col_pos(
-/*=======================*/
- const dict_index_t* index, /*!< in: index */
- ulint type) /*!< in: DATA_ROW_ID, ... */
-{
- ut_ad(index);
- ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- ut_ad(!dict_index_is_ibuf(index));
-
- if (dict_index_is_clust(index)) {
-
- return(dict_col_get_clust_pos(
- dict_table_get_sys_col(index->table, type),
- index));
- }
-
- return(dict_index_get_nth_col_pos(
- index, dict_table_get_sys_col_no(index->table, type), NULL));
-}
-
/*********************************************************************//**
Gets the field column.
@return field->col, pointer to the table column */
@@ -1280,9 +1153,7 @@ dict_table_is_fts_column(
index = (dict_index_t*) ib_vector_getp(indexes, i);
- if (dict_index_contains_col_or_prefix(
- index, col_no, is_virtual)) {
-
+ if (index->contains_col_or_prefix(col_no, is_virtual)) {
return(i);
}
}
@@ -1408,7 +1279,7 @@ void
dict_table_t::acquire()
{
ut_ad(mutex_own(&dict_sys->mutex));
- my_atomic_add32_explicit(&n_ref_count, 1, MY_MEMORY_ORDER_RELAXED);
+ n_ref_count++;
}
/** Release the table handle.
@@ -1417,8 +1288,7 @@ inline
bool
dict_table_t::release()
{
- int32 n = my_atomic_add32_explicit(
- &n_ref_count, -1, MY_MEMORY_ORDER_RELAXED);
+ auto n = n_ref_count--;
ut_ad(n > 0);
return n == 1;
}
diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h
index 9b798353afd..cddfbc68cb7 100644
--- a/storage/innobase/include/dict0load.h
+++ b/storage/innobase/include/dict0load.h
@@ -28,13 +28,11 @@ Created 4/24/1996 Heikki Tuuri
#ifndef dict0load_h
#define dict0load_h
-#include "univ.i"
#include "dict0types.h"
#include "trx0types.h"
#include "ut0byte.h"
#include "mem0mem.h"
#include "btr0types.h"
-#include "ut0new.h"
#include <deque>
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 1521fb74970..5f6cd3d13c5 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -28,8 +28,6 @@ Created 1/8/1996 Heikki Tuuri
#ifndef dict0mem_h
#define dict0mem_h
-#include "univ.i"
-#include "dict0types.h"
#include "data0type.h"
#include "mem0mem.h"
#include "row0types.h"
@@ -47,9 +45,9 @@ Created 1/8/1996 Heikki Tuuri
#include "buf0buf.h"
#include "gis0type.h"
#include "os0once.h"
-#include "ut0new.h"
#include "fil0fil.h"
#include "fil0crypt.h"
+#include <sql_const.h>
#include <set>
#include <algorithm>
#include <iterator>
@@ -497,10 +495,6 @@ dict_mem_create_temporary_tablename(
const char* dbtab,
table_id_t id);
-/** Initialize dict memory variables */
-void
-dict_mem_init(void);
-
/** SQL identifier name wrapper for pretty-printing */
class id_name_t
{
@@ -620,7 +614,8 @@ public:
ut_ad(mtype == DATA_INT || mtype == DATA_FIXBINARY);
return mtype == DATA_INT;
}
- /** @return whether this is system versioned */
+ /** @return whether this user column (not row_start, row_end)
+ has System Versioning property */
bool is_versioned() const { return !(~prtype & DATA_VERSIONED); }
/** @return whether this is the system version start */
bool vers_sys_start() const
@@ -686,6 +681,20 @@ public:
def_val.len = UNIV_SQL_DEFAULT;
def_val.data = NULL;
}
+
+ /** Determine if the columns have the same format
+ except for is_nullable() and is_versioned().
+ @param[in] other column to compare to
+ @return whether the columns have the same format */
+ bool same_format(const dict_col_t& other) const
+ {
+ return mtype == other.mtype
+ && len >= other.len
+ && mbminlen == other.mbminlen
+ && mbmaxlen == other.mbmaxlen
+ && !((prtype ^ other.prtype)
+ & ~(DATA_NOT_NULL | DATA_VERSIONED));
+ }
};
/** Index information put in a list of virtual column structure. Index
@@ -720,8 +729,7 @@ struct dict_v_col_t{
ulint v_pos;
/** Virtual index list, and column position in the index,
- the allocated memory is not from table->heap, nor it is
- tracked by dict_sys->size */
+ the allocated memory is not from table->heap */
dict_v_idx_list* v_indexes;
};
@@ -860,7 +868,8 @@ an uncompressed page should be left as padding to avoid compression
failures. This estimate is based on a self-adapting heuristic. */
struct zip_pad_info_t {
SysMutex* mutex; /*!< mutex protecting the info */
- ulint pad; /*!< number of bytes used as pad */
+ Atomic_counter<ulint>
+ pad; /*!< number of bytes used as pad */
ulint success;/*!< successful compression ops during
current round */
ulint failure;/*!< failed compression ops during
@@ -1085,15 +1094,37 @@ struct dict_index_t {
return DICT_CLUSTERED == (type & (DICT_CLUSTERED | DICT_IBUF));
}
+ /** @return whether this is a generated clustered index */
+ bool is_gen_clust() const { return type == DICT_CLUSTERED; }
+
+ /** @return whether this is a clustered index */
+ bool is_clust() const { return type & DICT_CLUSTERED; }
+
+ /** @return whether this is a unique index */
+ bool is_unique() const { return type & DICT_UNIQUE; }
+
+ /** @return whether this is a spatial index */
+ bool is_spatial() const { return UNIV_UNLIKELY(type & DICT_SPATIAL); }
+
+ /** @return whether this is the change buffer */
+ bool is_ibuf() const { return UNIV_UNLIKELY(type & DICT_IBUF); }
+
/** @return whether the index includes virtual columns */
bool has_virtual() const { return type & DICT_VIRTUAL; }
+ /** @return the position of DB_TRX_ID */
+ unsigned db_trx_id() const {
+ DBUG_ASSERT(is_primary());
+ DBUG_ASSERT(n_uniq);
+ DBUG_ASSERT(n_uniq <= MAX_REF_PARTS);
+ return n_uniq;
+ }
+ /** @return the position of DB_ROLL_PTR */
+ unsigned db_roll_ptr() const { return db_trx_id() + 1; }
+
/** @return the offset of the metadata BLOB field,
or the first user field after the PRIMARY KEY,DB_TRX_ID,DB_ROLL_PTR */
- unsigned first_user_field() const {
- ut_ad(is_primary());
- return n_uniq + 2;
- }
+ unsigned first_user_field() const { return db_trx_id() + 2; }
/** @return whether the index is corrupted */
inline bool is_corrupted() const;
@@ -1171,6 +1202,13 @@ struct dict_index_t {
/** Reconstruct the clustered index fields. */
inline void reconstruct_fields();
+
+ /** Check if the index contains a column or a prefix of that column.
+ @param[in] n column number
+ @param[in] is_virtual whether it is a virtual col
+ @return whether the index contains the column or its prefix */
+ bool contains_col_or_prefix(ulint n, bool is_virtual) const
+ MY_ATTRIBUTE((warn_unused_result));
};
/** Detach a column from an index.
@@ -1505,6 +1543,52 @@ struct dict_vcol_templ_t {
dict_vcol_templ_t() : vtempl(0), mysql_table_query_id(~0ULL) {}
};
+/** Metadata on clustered index fields starting from first_user_field() */
+class field_map_element_t
+{
+ /** Number of bits for representing a column number */
+ static constexpr uint16_t IND_BITS = 10;
+
+ /** Set if the column of the field has been instantly dropped */
+ static constexpr uint16_t DROPPED = 1U << (IND_BITS + 5);
+
+ /** Set if the column was dropped and originally declared NOT NULL */
+ static constexpr uint16_t NOT_NULL = 1U << (IND_BITS + 4);
+
+ /** Column index (if !(data & DROPPED)): table->cols[data & IND],
+ or field length (if (data & DROPPED)):
+ (data & IND) = 0 if variable-length with max_len < 256 bytes;
+ (data & IND) = 1 if variable-length with max_len > 255 bytes;
+ (data & IND) = 1 + L otherwise, with L=fixed length of the column */
+ static constexpr uint16_t IND = (1U << IND_BITS) - 1;
+
+ /** Field metadata */
+ uint16_t data;
+
+ void clear_not_null() { data &= ~NOT_NULL; }
+public:
+ bool is_dropped() const { return data & DROPPED; }
+ void set_dropped() { data |= DROPPED; }
+ bool is_not_null() const { return data & NOT_NULL; }
+ void set_not_null() { ut_ad(is_dropped()); data |= NOT_NULL; }
+ uint16_t ind() const { return data & IND; }
+ void set_ind(uint16_t i)
+ {
+ DBUG_ASSERT(i <= IND);
+ DBUG_ASSERT(!ind());
+ data |= i;
+ }
+ field_map_element_t& operator= (uint16_t value)
+ {
+ data = value;
+ return *this;
+ }
+ operator uint16_t() { return data; }
+};
+
+static_assert(sizeof(field_map_element_t) == 2,
+ "Size mismatch for a persistent data item!");
+
/** Instantly dropped or reordered columns */
struct dict_instant_t
{
@@ -1512,8 +1596,9 @@ struct dict_instant_t
unsigned n_dropped;
/** Dropped columns */
dict_col_t* dropped;
- /** Mapping the non-pk field to column of the table. */
- uint16_t* non_pk_col_map;
+ /** Map of clustered index non-PK fields[i - first_user_field()]
+ to table columns */
+ field_map_element_t* field_map;
};
/** These are used when MySQL FRM and InnoDB data dictionary are
@@ -1534,11 +1619,7 @@ struct dict_table_t {
/** Get reference count.
@return current value of n_ref_count */
- inline int32 get_ref_count()
- {
- return my_atomic_load32_explicit(&n_ref_count,
- MY_MEMORY_ORDER_RELAXED);
- }
+ inline uint32_t get_ref_count() const { return n_ref_count; }
/** Acquire the table handle. */
inline void acquire();
@@ -1558,6 +1639,9 @@ struct dict_table_t {
return flags2 & DICT_TF2_TEMPORARY;
}
+ /** @return whether the table is not in ROW_FORMAT=REDUNDANT */
+ bool not_redundant() const { return flags & DICT_TF_COMPACT; }
+
/** @return whether this table is readable
@retval true normally
@retval false if this is a single-table tablespace
@@ -1626,8 +1710,9 @@ struct dict_table_t {
/** Adjust table metadata for instant ADD/DROP/reorder COLUMN.
@param[in] table table on which prepare_instant() was invoked
- @param[in] col_map mapping from cols[] and v_cols[] to table */
- inline void instant_column(const dict_table_t& table,
+ @param[in] col_map mapping from cols[] and v_cols[] to table
+ @return whether the metadata record must be updated */
+ inline bool instant_column(const dict_table_t& table,
const ulint* col_map);
/** Roll back instant_column().
@@ -1637,6 +1722,7 @@ struct dict_table_t {
@param[in] old_instant original instant structure
@param[in] old_fields original fields
@param[in] old_n_fields original number of fields
+ @param[in] old_n_core_fields original number of core fields
@param[in] old_n_v_cols original n_v_cols
@param[in] old_v_cols original v_cols
@param[in] old_v_col_names original v_col_names
@@ -1648,6 +1734,7 @@ struct dict_table_t {
dict_instant_t* old_instant,
dict_field_t* old_fields,
unsigned old_n_fields,
+ unsigned old_n_core_fields,
unsigned old_n_v_cols,
dict_v_col_t* old_v_cols,
const char* old_v_col_names,
@@ -1665,36 +1752,39 @@ struct dict_table_t {
void inc_fk_checks()
{
#ifdef UNIV_DEBUG
- lint fk_checks= (lint)
+ int32_t fk_checks=
#endif
- my_atomic_addlint(&n_foreign_key_checks_running, 1);
+ n_foreign_key_checks_running++;
ut_ad(fk_checks >= 0);
}
void dec_fk_checks()
{
#ifdef UNIV_DEBUG
- lint fk_checks= (lint)
+ int32_t fk_checks=
#endif
- my_atomic_addlint(&n_foreign_key_checks_running, ulint(-1));
+ n_foreign_key_checks_running--;
ut_ad(fk_checks > 0);
}
+private:
+ /** Initialize instant->field_map.
+ @tparam replace_dropped whether to point clustered index fields
+ to instant->dropped[]
+ @param[in] table table definition to copy from */
+ template<bool replace_dropped = false>
+ inline void init_instant(const dict_table_t& table);
+public:
/** Id of the table. */
table_id_t id;
-
- /** Memory heap. If you allocate from this heap after the table has
- been created then be sure to account the allocation into
- dict_sys->size. When closing the table we do something like
- dict_sys->size -= mem_heap_get_size(table->heap) and if that is going
- to become negative then we would assert. Something like this should do:
- old_size = mem_heap_get_size()
- mem_heap_alloc()
- new_size = mem_heap_get_size()
- dict_sys->size += new_size - old_size. */
- mem_heap_t* heap;
-
+ /** Hash chain node. */
+ hash_node_t id_hash;
/** Table name. */
table_name_t name;
+ /** Hash chain node. */
+ hash_node_t name_hash;
+
+ /** Memory heap */
+ mem_heap_t* heap;
/** NULL or the directory path specified by DATA DIRECTORY. */
char* data_dir_path;
@@ -1816,12 +1906,6 @@ struct dict_table_t {
/*!< !DICT_FRM_CONSISTENT==0 if data
dictionary information and
MySQL FRM information mismatch. */
- /** Hash chain node. */
- hash_node_t name_hash;
-
- /** Hash chain node. */
- hash_node_t id_hash;
-
/** The FTS_DOC_ID_INDEX, or NULL if no fulltext indexes exist */
dict_index_t* fts_doc_id_index;
@@ -1846,7 +1930,7 @@ struct dict_table_t {
/** Count of how many foreign key check operations are currently being
performed on the table. We cannot drop the table while there are
foreign key checks running on it. */
- ulint n_foreign_key_checks_running;
+ Atomic_counter<int32_t> n_foreign_key_checks_running;
/** Transactions whose view low limit is greater than this number are
not allowed to store to the MySQL query cache or retrieve from it.
@@ -2046,7 +2130,7 @@ private:
/** Count of how many handles are opened to this table. Dropping of the
table is NOT allowed until this count gets to zero. MySQL does NOT
itself check the number of open handles at DROP. */
- int32 n_ref_count;
+ Atomic_counter<uint32_t> n_ref_count;
public:
/** List of locks on the table. Protected by lock_sys.mutex. */
@@ -2125,40 +2209,37 @@ inline void dict_index_t::clear_instant_alter()
DBUG_ASSERT(!fields[i].col->is_nullable());
}
#endif
+ const dict_col_t* ai_col = table->persistent_autoinc
+ ? fields[table->persistent_autoinc - 1].col
+ : NULL;
+ dict_field_t* const begin = &fields[first_user_field()];
dict_field_t* end = &fields[n_fields];
- for (dict_field_t* d = &fields[first_user_field()]; d < end; d++) {
+ for (dict_field_t* d = begin; d < end; ) {
/* Move fields for dropped columns to the end. */
- while (d->col->is_dropped()) {
+ if (!d->col->is_dropped()) {
+ d++;
+ } else {
if (d->col->is_nullable()) {
n_nullable--;
}
std::swap(*d, *--end);
-
- if (d == end) {
- goto done;
- }
- }
-
- /* Ensure that the surviving fields are sorted by
- ascending order of columns. */
- const unsigned c = d->col->ind;
-
- for (dict_field_t* s = d + 1; s < end; s++) {
- if (s->col->ind < c) {
- std::swap(*d, *s);
- break;
- }
}
}
-done:
DBUG_ASSERT(&fields[n_fields - table->n_dropped()] == end);
-
n_core_fields = n_fields = n_def = end - fields;
n_core_null_bytes = UT_BITS_IN_BYTES(n_nullable);
+ std::sort(begin, end, [](const dict_field_t& a, const dict_field_t& b)
+ { return a.col->ind < b.col->ind; });
table->instant = NULL;
+ if (ai_col) {
+ auto a = std::find_if(begin, end,
+ [ai_col](const dict_field_t& f)
+ { return f.col == ai_col; });
+ table->persistent_autoinc = (a == end) ? 0 : 1 + (a - fields);
+ }
}
/** @return whether the column was instantly dropped
diff --git a/storage/innobase/include/dict0priv.h b/storage/innobase/include/dict0priv.h
index 593c27125a2..8eda44bd3f2 100644
--- a/storage/innobase/include/dict0priv.h
+++ b/storage/innobase/include/dict0priv.h
@@ -26,8 +26,6 @@ Created Fri 2 Jul 2010 13:30:38 EST - Sunny Bains
#ifndef dict0priv_h
#define dict0priv_h
-#include "univ.i"
-
/**********************************************************************//**
Gets a table; loads it to the dictionary cache if necessary. A low-level
function. Note: Not to be called from outside dict0*c functions.
@@ -47,18 +45,6 @@ dict_table_check_if_in_cache_low(
/*=============================*/
const char* table_name); /*!< in: table name */
-/**********************************************************************//**
-Returns a table object based on table id.
-@return table, NULL if does not exist */
-UNIV_INLINE
-dict_table_t*
-dict_table_open_on_id_low(
-/*=====================*/
- table_id_t table_id, /*!< in: table id */
- dict_err_ignore_t ignore_err, /*!< in: errors to ignore
- when loading the table */
- ibool open_only_if_in_cache);
-
#include "dict0priv.ic"
#endif /* dict0priv.h */
diff --git a/storage/innobase/include/dict0priv.ic b/storage/innobase/include/dict0priv.ic
index fb7af2772fc..6d7fbf07394 100644
--- a/storage/innobase/include/dict0priv.ic
+++ b/storage/innobase/include/dict0priv.ic
@@ -25,7 +25,6 @@ Created Wed 13 Oct 2010 16:10:14 EST Sunny Bains
#include "dict0dict.h"
#include "dict0load.h"
-#include "dict0priv.h"
/**********************************************************************//**
Gets a table; loads it to the dictionary cache if necessary. A low-level
@@ -64,40 +63,6 @@ dict_table_get_low(
}
/**********************************************************************//**
-Returns a table object based on table id.
-@return table, NULL if does not exist */
-UNIV_INLINE
-dict_table_t*
-dict_table_open_on_id_low(
-/*======================*/
- table_id_t table_id, /*!< in: table id */
- dict_err_ignore_t ignore_err, /*!< in: errors to ignore
- when loading the table */
- ibool open_only_if_in_cache)
-{
- dict_table_t* table;
- ulint fold;
-
- ut_ad(mutex_own(&dict_sys->mutex));
-
- /* Look for the table name in the hash table */
- fold = ut_fold_ull(table_id);
-
- HASH_SEARCH(id_hash, dict_sys->table_id_hash, fold,
- dict_table_t*, table, ut_ad(table->cached),
- table->id == table_id);
- if (table == NULL && !open_only_if_in_cache) {
- table = dict_load_table_on_id(table_id, ignore_err);
- }
-
- ut_ad(!table || table->cached);
-
- /* TODO: should get the type information from MySQL */
-
- return(table);
-}
-
-/**********************************************************************//**
Checks if a table is in the dictionary cache.
@return table, NULL if not found */
UNIV_INLINE
diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h
index 407e0221110..95507dca36c 100644
--- a/storage/innobase/include/dict0stats.h
+++ b/storage/innobase/include/dict0stats.h
@@ -27,8 +27,6 @@ Created Jan 06, 2010 Vasil Dimov
#ifndef dict0stats_h
#define dict0stats_h
-#include "univ.i"
-
#include "dict0types.h"
#include "trx0types.h"
diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic
index 0d187ed90c7..4edc7860363 100644
--- a/storage/innobase/include/dict0stats.ic
+++ b/storage/innobase/include/dict0stats.ic
@@ -25,7 +25,6 @@ Created Jan 23, 2012 Vasil Dimov
*******************************************************/
#include "dict0dict.h"
-#include "dict0types.h"
#include "srv0srv.h"
/*********************************************************************//**
diff --git a/storage/innobase/include/dict0stats_bg.h b/storage/innobase/include/dict0stats_bg.h
index d66afdd4b25..8387e3265b2 100644
--- a/storage/innobase/include/dict0stats_bg.h
+++ b/storage/innobase/include/dict0stats_bg.h
@@ -27,8 +27,6 @@ Created Apr 26, 2012 Vasil Dimov
#ifndef dict0stats_bg_h
#define dict0stats_bg_h
-#include "univ.i"
-
#include "dict0types.h"
#include "os0event.h"
#include "os0thread.h"
diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h
index 4b6c808b47c..0954851bca4 100644
--- a/storage/innobase/include/dyn0buf.h
+++ b/storage/innobase/include/dyn0buf.h
@@ -27,10 +27,9 @@ Created 2013-03-16 Sunny Bains
#ifndef dyn0buf_h
#define dyn0buf_h
-#include "univ.i"
-#include "ut0lst.h"
#include "mem0mem.h"
#include "dyn0types.h"
+#include "ut0lst.h"
/** Class that manages dynamic buffers. It uses a UT_LIST of
mtr_buf_t::block_t instances. We don't use STL containers in
diff --git a/storage/innobase/include/eval0eval.h b/storage/innobase/include/eval0eval.h
index 2e20c634c3b..348d71af8f4 100644
--- a/storage/innobase/include/eval0eval.h
+++ b/storage/innobase/include/eval0eval.h
@@ -27,7 +27,6 @@ Created 12/29/1997 Heikki Tuuri
#ifndef eval0eval_h
#define eval0eval_h
-#include "univ.i"
#include "que0types.h"
#include "pars0sym.h"
#include "pars0pars.h"
diff --git a/storage/innobase/include/eval0proc.h b/storage/innobase/include/eval0proc.h
index b359bf06ce0..4bab9b7bc34 100644
--- a/storage/innobase/include/eval0proc.h
+++ b/storage/innobase/include/eval0proc.h
@@ -26,7 +26,6 @@ Created 1/20/1998 Heikki Tuuri
#ifndef eval0proc_h
#define eval0proc_h
-#include "univ.i"
#include "que0types.h"
#include "pars0sym.h"
#include "pars0pars.h"
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index 5238213135f..e520f189d63 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (c) 2015, 2017, MariaDB Corporation.
+Copyright (c) 2015, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -26,11 +26,9 @@ Created 04/01/2015 Jan Lindström
#ifndef fil0crypt_h
#define fil0crypt_h
-#ifndef UNIV_INNOCHECKSUM
#include "os0event.h"
#include "my_crypt.h"
#include "fil0fil.h"
-#endif /*! UNIV_INNOCHECKSUM */
/**
* Magic pattern in start of crypt data on page 0
@@ -488,16 +486,9 @@ encrypted, or corrupted.
@param[in,out] page page frame (checksum is temporarily modified)
@param[in] page_size page size
-@param[in] space tablespace identifier
-@param[in] offset page number
@return true if page is encrypted AND OK, false otherwise */
-UNIV_INTERN
bool
-fil_space_verify_crypt_checksum(
- byte* page,
- const page_size_t& page_size,
- ulint space,
- ulint offset)
+fil_space_verify_crypt_checksum(const byte* page, const page_size_t& page_size)
MY_ATTRIBUTE((warn_unused_result));
#endif /* fil0crypt_h */
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index e0af39bdee8..c7278368368 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -26,14 +26,13 @@ Created 10/25/1995 Heikki Tuuri
#ifndef fil0fil_h
#define fil0fil_h
-#include "univ.i"
+
+#include "page0size.h"
#ifndef UNIV_INNOCHECKSUM
#include "log0recv.h"
#include "dict0types.h"
-#include "page0size.h"
-#include "ibuf0types.h"
// Forward declaration
extern my_bool srv_use_doublewrite_buf;
@@ -74,8 +73,9 @@ struct fil_node_t;
/** Tablespace or log data space */
struct fil_space_t {
- char* name; /*!< Tablespace name */
ulint id; /*!< space id */
+ hash_node_t hash; /*!< hash chain node */
+ char* name; /*!< Tablespace name */
lsn_t max_lsn;
/*!< LSN of the most recent
fil_names_write_if_was_clean().
@@ -98,11 +98,9 @@ struct fil_space_t {
/** whether undo tablespace truncation is in progress */
bool is_being_truncated;
#ifdef UNIV_DEBUG
- ulint redo_skipped_count;
- /*!< reference count for operations who want
- to skip redo log in the file space in order
- to make fsp_space_modify_check pass.
- Uses my_atomic_loadlint() and friends. */
+ /** reference count for operations who want to skip redo log in the
+ file space in order to make fsp_space_modify_check pass. */
+ Atomic_counter<ulint> redo_skipped_count;
#endif
fil_type_t purpose;/*!< purpose */
UT_LIST_BASE_NODE_T(fil_node_t) chain;
@@ -136,17 +134,15 @@ struct fil_space_t {
dropped. An example is change buffer merge.
The tablespace cannot be dropped while this is nonzero,
or while fil_node_t::n_pending is nonzero.
- Protected by fil_system.mutex and my_atomic_loadlint() and friends. */
- ulint n_pending_ops;
+ Protected by fil_system.mutex and std::atomic. */
+ std::atomic<ulint> n_pending_ops;
/** Number of pending block read or write operations
(when a write is imminent or a read has recently completed).
The tablespace object cannot be freed while this is nonzero,
but it can be detached from fil_system.
Note that fil_node_t::n_pending tracks actual pending I/O requests.
- Protected by fil_system.mutex and my_atomic_loadlint() and friends. */
- ulint n_pending_ios;
- hash_node_t hash; /*!< hash chain node */
- hash_node_t name_hash;/*!< hash chain the name_hash table */
+ Protected by fil_system.mutex and std::atomic. */
+ std::atomic<ulint> n_pending_ios;
rw_lock_t latch; /*!< latch protecting the file space storage
allocation */
UT_LIST_NODE_T(fil_space_t) unflushed_spaces;
@@ -155,15 +151,16 @@ struct fil_space_t {
UT_LIST_NODE_T(fil_space_t) named_spaces;
/*!< list of spaces for which MLOG_FILE_NAME
records have been issued */
- bool is_in_unflushed_spaces;
- /*!< true if this space is currently in
- unflushed_spaces */
+ /** Checks that this tablespace in a list of unflushed tablespaces.
+ @return true if in a list */
+ bool is_in_unflushed_spaces() const;
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
/** other tablespaces needing key rotation */
UT_LIST_NODE_T(fil_space_t) rotation_list;
- /** whether this tablespace needs key rotation */
- bool is_in_rotation_list;
+ /** Checks that this tablespace needs key rotation.
+ @return true if in a rotation list */
+ bool is_in_rotation_list() const;
/** MariaDB encryption data */
fil_space_crypt_t* crypt_data;
@@ -187,6 +184,19 @@ struct fil_space_t {
&& srv_use_doublewrite_buf && buf_dblwr;
}
+ /** Append a file to the chain of files of a space.
+ @param[in] name file name of a file that is not open
+ @param[in] handle file handle, or OS_FILE_CLOSED
+ @param[in] size file size in entire database pages
+ @param[in] is_raw whether this is a raw device
+ @param[in] atomic_write true if atomic write could be enabled
+ @param[in] max_pages maximum number of pages in file,
+ or ULINT_MAX for unlimited
+ @return file object */
+ fil_node_t* add(const char* name, pfs_os_file_t handle,
+ ulint size, bool is_raw, bool atomic_write,
+ ulint max_pages = ULINT_MAX);
+
/** Try to reserve free extents.
@param[in] n_free_now current number of free extents
@param[in] n_to_reserve number of extents to reserve
@@ -234,36 +244,18 @@ struct fil_space_t {
void close();
/** Acquire a tablespace reference. */
- void acquire() { my_atomic_addlint(&n_pending_ops, 1); }
+ void acquire() { n_pending_ops++; }
/** Release a tablespace reference. */
- void release()
- {
- ut_ad(referenced());
- my_atomic_addlint(&n_pending_ops, ulint(-1));
- }
+ void release() { ut_ad(referenced()); n_pending_ops--; }
/** @return whether references are being held */
- bool referenced() { return my_atomic_loadlint(&n_pending_ops); }
- /** @return whether references are being held */
- bool referenced() const
- {
- return const_cast<fil_space_t*>(this)->referenced();
- }
+ bool referenced() const { return n_pending_ops; }
/** Acquire a tablespace reference for I/O. */
- void acquire_for_io() { my_atomic_addlint(&n_pending_ios, 1); }
+ void acquire_for_io() { n_pending_ios++; }
/** Release a tablespace reference for I/O. */
- void release_for_io()
- {
- ut_ad(pending_io());
- my_atomic_addlint(&n_pending_ios, ulint(-1));
- }
+ void release_for_io() { ut_ad(pending_io()); n_pending_ios--; }
/** @return whether I/O is pending */
- bool pending_io() { return my_atomic_loadlint(&n_pending_ios); }
- /** @return whether I/O is pending */
- bool pending_io() const
- {
- return const_cast<fil_space_t*>(this)->pending_io();
- }
+ bool pending_io() const { return n_pending_ios; }
};
/** Value of fil_space_t::magic_n */
@@ -277,10 +269,6 @@ struct fil_node_t {
char* name;
/** file handle (valid if is_open) */
pfs_os_file_t handle;
- /** event that groups and serializes calls to fsync;
- os_event_set() and os_event_reset() are protected by
- fil_system.mutex */
- os_event_t sync_event;
/** whether the file actually is a raw device or disk partition */
bool is_raw_disk;
/** size of the file in database pages (0 if not known yet);
@@ -298,10 +286,8 @@ struct fil_node_t {
ulint n_pending_flushes;
/** whether the file is currently being extended */
bool being_extended;
- /** number of writes to the file since the system was started */
- int64_t modification_counter;
- /** the modification_counter of the latest flush to disk */
- int64_t flush_counter;
+ /** whether this file had writes after lasy fsync() */
+ bool needs_flush;
/** link to other files in this tablespace */
UT_LIST_NODE_T(fil_node_t) chain;
/** link to the fil_system.LRU list (keeping track of open files) */
@@ -322,6 +308,11 @@ struct fil_node_t {
return(handle != OS_FILE_CLOSED);
}
+ /** Read the first page of a data file.
+ @param[in] first whether this is the very first read
+ @return whether the page was found valid */
+ bool read_page0(bool first);
+
/** Close the file handle. */
void close();
};
@@ -352,6 +343,8 @@ of the address is FIL_NULL, the address is considered undefined. */
typedef byte fil_faddr_t; /*!< 'type' definition in C: an address
stored in a file page is a string of bytes */
+#else
+# include "univ.i"
#endif /* !UNIV_INNOCHECKSUM */
/** Initial size of a single-table tablespace in pages */
@@ -511,6 +504,8 @@ enum fil_encryption_t {
FIL_ENCRYPTION_OFF
};
+#ifndef UNIV_INNOCHECKSUM
+
/** The number of fsyncs done to the log */
extern ulint fil_n_log_flushes;
@@ -519,11 +514,6 @@ extern ulint fil_n_pending_log_flushes;
/** Number of pending tablespace flushes */
extern ulint fil_n_pending_tablespace_flushes;
-/** Number of files currently open */
-extern ulint fil_n_file_opened;
-
-#ifndef UNIV_INNOCHECKSUM
-
/** Look up a tablespace.
The caller should hold an InnoDB table lock or a MDL that prevents
the tablespace from being dropped during the operation,
@@ -594,10 +584,8 @@ public:
tablespaces whose files contain
unflushed writes; those spaces have
at least one file node where
- modification_counter > flush_counter */
+ needs_flush == true */
ulint n_open; /*!< number of files currently open */
- int64_t modification_counter;/*!< when we write to a file we
- increment this by one */
ulint max_assigned_id;/*!< maximum space id in the existing
tables, or assigned during the time
mysqld has been up; at an InnoDB
@@ -636,26 +624,6 @@ fil_space_get_latch(
ulint id,
ulint* flags);
-/** Append a file to the chain of files of a space.
-@param[in] name file name of a file that is not open
-@param[in] size file size in entire database blocks
-@param[in,out] space tablespace from fil_space_create()
-@param[in] is_raw whether this is a raw device or partition
-@param[in] atomic_write true if atomic write could be enabled
-@param[in] max_pages maximum number of pages in file,
-ULINT_MAX means the file size is unlimited.
-@return pointer to the file name
-@retval NULL if error */
-char*
-fil_node_create(
- const char* name,
- ulint size,
- fil_space_t* space,
- bool is_raw,
- bool atomic_write,
- ulint max_pages = ULINT_MAX)
- MY_ATTRIBUTE((warn_unused_result));
-
/** Create a space memory object and put it to the fil_system hash table.
Error messages are issued to the server log.
@param[in] name tablespace name
@@ -664,7 +632,7 @@ Error messages are issued to the server log.
@param[in] purpose tablespace purpose
@param[in,out] crypt_data encryption information
@param[in] mode encryption mode
-@return pointer to created tablespace, to be filled in with fil_node_create()
+@return pointer to created tablespace, to be filled in with fil_space_t::add()
@retval NULL on failure (such as when the same tablespace exists) */
fil_space_t*
fil_space_create(
diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h
index 794d44373e8..72810a25191 100644
--- a/storage/innobase/include/fsp0file.h
+++ b/storage/innobase/include/fsp0file.h
@@ -27,12 +27,9 @@ Created 2013-7-26 by Kevin Lewis
#ifndef fsp0file_h
#define fsp0file_h
-#include "ha_prototypes.h"
-#include "log0log.h"
#include "mem0mem.h"
#include "os0file.h"
-#include "fil0crypt.h"
-#include <vector>
+#include "fil0fil.h"
/** Types of raw partitions in innodb_data_file_path */
enum device_t {
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 33dce63d5e1..9b502f1f546 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -27,21 +27,17 @@ Created 12/18/1995 Heikki Tuuri
#ifndef fsp0fsp_h
#define fsp0fsp_h
-#include "univ.i"
-
#include "fsp0types.h"
+#include "fut0lst.h"
+#include "ut0byte.h"
#ifndef UNIV_INNOCHECKSUM
-
-#include "fsp0space.h"
-#include "fut0lst.h"
#include "mtr0mtr.h"
#include "page0types.h"
#include "rem0types.h"
-#include "ut0byte.h"
-
+#else
+# include "mach0data.h"
#endif /* !UNIV_INNOCHECKSUM */
-#include "fsp0types.h"
/** @return the PAGE_SSIZE flags for the current innodb_page_size */
#define FSP_FLAGS_PAGE_SSIZE() \
diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h
index 9f869fda158..88e5bb583de 100644
--- a/storage/innobase/include/fsp0space.h
+++ b/storage/innobase/include/fsp0space.h
@@ -27,11 +27,9 @@ Created 2013-7-26 by Kevin Lewis
#ifndef fsp0space_h
#define fsp0space_h
-#include "univ.i"
#include "fsp0file.h"
#include "fsp0fsp.h"
#include "fsp0types.h"
-#include "ut0new.h"
#include <vector>
diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h
index 80b006f2dd7..0a05e323193 100644
--- a/storage/innobase/include/fsp0sysspace.h
+++ b/storage/innobase/include/fsp0sysspace.h
@@ -26,7 +26,6 @@ Created 2013-7-26 by Kevin Lewis
#ifndef fsp0sysspace_h
#define fsp0sysspace_h
-#include "univ.i"
#include "fsp0space.h"
/** If the last data file is auto-extended, we add this many pages to it
diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h
index f7a5befa6ae..d99ca14fe9a 100644
--- a/storage/innobase/include/fsp0types.h
+++ b/storage/innobase/include/fsp0types.h
@@ -27,15 +27,12 @@ Created May 26, 2009 Vasil Dimov
#ifndef fsp0types_h
#define fsp0types_h
-#ifndef UNIV_INNOCHECKSUM
-
/** The fil_space_t::id of the redo log. All persistent tablespaces
have a smaller fil_space_t::id. */
#define SRV_LOG_SPACE_FIRST_ID 0xFFFFFFF0U
/** The fil_space_t::id of the innodb_temporary tablespace. */
#define SRV_TMP_SPACE_ID 0xFFFFFFFEU
-#include "univ.i"
#include "ut0byte.h"
/** @name Flags for inserting records in order
@@ -49,7 +46,6 @@ fseg_alloc_free_page) */
#define FSP_NO_DIR ((byte)113) /*!< no order */
/* @} */
-#endif /* !UNIV_INNOCHECKSUM */
/** File space extent size in pages
page size | file space extent size
----------+-----------------------
@@ -72,7 +68,6 @@ page size | file space extent size
offset */
#define FSEG_PAGE_DATA FIL_PAGE_DATA
-#ifndef UNIV_INNOCHECKSUM
/** @name File segment header
The file segment header points to the inode describing the file segment. */
/* @{ */
@@ -87,6 +82,7 @@ typedef byte fseg_header_t;
header, in bytes */
/* @} */
+#ifndef UNIV_INNOCHECKSUM
#ifdef UNIV_DEBUG
struct mtr_t;
diff --git a/storage/innobase/include/fts0ast.h b/storage/innobase/include/fts0ast.h
index 2a2b25c36bd..0b55d458036 100644
--- a/storage/innobase/include/fts0ast.h
+++ b/storage/innobase/include/fts0ast.h
@@ -27,7 +27,6 @@ Created 2007/03/16/03 Sunny Bains
#ifndef INNOBASE_FST0AST_H
#define INNOBASE_FST0AST_H
-#include "ha_prototypes.h"
#include "mem0mem.h"
#ifdef UNIV_PFS_MEMORY
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 9a4805e6eba..9a10375759c 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2017, MariaDB Corporation.
+Copyright (c) 2016, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -27,12 +27,8 @@ Created 2011/09/02 Sunny Bains
#ifndef fts0fts_h
#define fts0fts_h
-#include "ha_prototypes.h"
-
#include "data0type.h"
#include "data0types.h"
-#include "dict0types.h"
-#include "hash0hash.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "row0types.h"
@@ -614,17 +610,15 @@ fts_get_doc_id_from_row(
want to extract.*/
/** Extract the doc id from the record that belongs to index.
-@param[in] table table
-@param[in] rec record contains FTS_DOC_ID
+@param[in] rec record containing FTS_DOC_ID
@param[in] index index of rec
-@param[in] heap heap memory
+@param[in] offsets rec_get_offsets(rec,index)
@return doc id that was extracted from rec */
doc_id_t
fts_get_doc_id_from_rec(
- dict_table_t* table,
- const rec_t* rec,
- const dict_index_t* index,
- mem_heap_t* heap);
+ const rec_t* rec,
+ const dict_index_t* index,
+ const ulint* offsets);
/** Add new fts doc id to the update vector.
@param[in] table the table that contains the FTS index.
diff --git a/storage/innobase/include/fts0plugin.h b/storage/innobase/include/fts0plugin.h
index 9bc9b6b9dd7..1e822ec3415 100644
--- a/storage/innobase/include/fts0plugin.h
+++ b/storage/innobase/include/fts0plugin.h
@@ -26,7 +26,7 @@ Created 2013/06/04 Shaohua Wang
#ifndef INNOBASE_FTS0PLUGIN_H
#define INNOBASE_FTS0PLUGIN_H
-#include "ha_prototypes.h"
+#include "univ.i"
extern struct st_mysql_ftparser fts_default_parser;
diff --git a/storage/innobase/include/fts0priv.h b/storage/innobase/include/fts0priv.h
index d045c9d3c72..85331cbd31e 100644
--- a/storage/innobase/include/fts0priv.h
+++ b/storage/innobase/include/fts0priv.h
@@ -27,7 +27,6 @@ Created 2011/09/02 Sunny Bains
#ifndef INNOBASE_FTS0PRIV_H
#define INNOBASE_FTS0PRIV_H
-#include "univ.i"
#include "dict0dict.h"
#include "pars0pars.h"
#include "que0que.h"
diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h
index 0bcb8d5a1d3..88d2d2bd0f2 100644
--- a/storage/innobase/include/fts0types.h
+++ b/storage/innobase/include/fts0types.h
@@ -27,7 +27,6 @@ Created 2007-03-27 Sunny Bains
#ifndef INNOBASE_FTS0TYPES_H
#define INNOBASE_FTS0TYPES_H
-#include "univ.i"
#include "fts0fts.h"
#include "fut0fut.h"
#include "pars0pars.h"
diff --git a/storage/innobase/include/fts0types.ic b/storage/innobase/include/fts0types.ic
index 487e7c33b63..1091e48a467 100644
--- a/storage/innobase/include/fts0types.ic
+++ b/storage/innobase/include/fts0types.ic
@@ -27,9 +27,6 @@ Created 2007-03-27 Sunny Bains
#ifndef INNOBASE_FTS0TYPES_IC
#define INNOBASE_FTS0TYPES_IC
-#include "rem0cmp.h"
-#include "ha_prototypes.h"
-
/******************************************************************//**
Duplicate a string.
@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
@@ -111,19 +108,21 @@ innobase_strnxfrm(
@param[in] cs charset
@retval true if the charset is cjk
@retval false if not. */
-UNIV_INLINE
-bool
-fts_is_charset_cjk(
- const CHARSET_INFO* cs)
+inline bool fts_is_charset_cjk(const CHARSET_INFO* cs)
{
- return cs == &my_charset_gb2312_chinese_ci
- || cs == &my_charset_gbk_chinese_ci
- || cs == &my_charset_big5_chinese_ci
- || cs == &my_charset_ujis_japanese_ci
- || cs == &my_charset_sjis_japanese_ci
- || cs == &my_charset_cp932_japanese_ci
- || cs == &my_charset_eucjpms_japanese_ci
- || cs == &my_charset_euckr_korean_ci;
+ switch (cs->number) {
+ case 24: /* my_charset_gb2312_chinese_ci */
+ case 28: /* my_charset_gbk_chinese_ci */
+ case 1: /* my_charset_big5_chinese_ci */
+ case 12: /* my_charset_ujis_japanese_ci */
+ case 13: /* my_charset_sjis_japanese_ci */
+ case 95: /* my_charset_cp932_japanese_ci */
+ case 97: /* my_charset_eucjpms_japanese_ci */
+ case 19: /* my_charset_euckr_korean_ci */
+ return true;
+ default:
+ return false;
+ }
}
/** Select the FTS auxiliary index for the given character by range.
diff --git a/storage/innobase/include/fut0fut.h b/storage/innobase/include/fut0fut.h
index 82882444291..d8072708089 100644
--- a/storage/innobase/include/fut0fut.h
+++ b/storage/innobase/include/fut0fut.h
@@ -27,9 +27,6 @@ Created 12/13/1995 Heikki Tuuri
#ifndef fut0fut_h
#define fut0fut_h
-#include "univ.i"
-
-#include "fil0fil.h"
#include "mtr0mtr.h"
/** Gets a pointer to a file address and latches the page.
diff --git a/storage/innobase/include/fut0lst.h b/storage/innobase/include/fut0lst.h
index d38b450085c..9d7a8ff640f 100644
--- a/storage/innobase/include/fut0lst.h
+++ b/storage/innobase/include/fut0lst.h
@@ -27,8 +27,9 @@ Created 11/28/1995 Heikki Tuuri
#ifndef fut0lst_h
#define fut0lst_h
-#ifndef UNIV_INNOCHECKSUM
-
+#ifdef UNIV_INNOCHECKSUM
+# include "fil0fil.h"
+#else
#include "fut0fut.h"
#include "mtr0log.h"
@@ -39,10 +40,10 @@ applied to these types! */
typedef byte flst_base_node_t;
typedef byte flst_node_t;
-/* The physical size of a list base node in bytes */
-#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE)
#endif /* !UNIV_INNOCHECKSUM */
+/* The physical size of a list base node in bytes */
+#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE)
/* The physical size of a list node in bytes */
#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE)
@@ -124,7 +125,7 @@ flst_remove(
@param[in] base base node
@return length */
UNIV_INLINE
-ulint
+uint32_t
flst_get_len(
const flst_base_node_t* base);
/********************************************************************//**
diff --git a/storage/innobase/include/fut0lst.ic b/storage/innobase/include/fut0lst.ic
index 3a978b8f75a..5ec1e359f9c 100644
--- a/storage/innobase/include/fut0lst.ic
+++ b/storage/innobase/include/fut0lst.ic
@@ -91,7 +91,7 @@ flst_init(
@param[in] base base node
@return length */
UNIV_INLINE
-ulint
+uint32_t
flst_get_len(
const flst_base_node_t* base)
{
diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h
index 461d2816653..7bfee9b06e5 100644
--- a/storage/innobase/include/gis0rtree.h
+++ b/storage/innobase/include/gis0rtree.h
@@ -27,24 +27,6 @@ Created 2013/03/27 Jimmy Yang and Allen Lai
#ifndef gis0rtree_h
#define gis0rtree_h
-#include "univ.i"
-#include "my_base.h"
-
-#include "data0type.h"
-#include "data0types.h"
-#include "dict0types.h"
-#include "hash0hash.h"
-#include "mem0mem.h"
-#include "page0page.h"
-#include "rem0types.h"
-#include "row0types.h"
-#include "trx0types.h"
-#include "ut0vec.h"
-#include "ut0wqueue.h"
-#include "que0types.h"
-#include "gis0geo.h"
-#include "gis0type.h"
-#include "btr0types.h"
#include "btr0cur.h"
/* Whether MBR 'a' contains 'b' */
diff --git a/storage/innobase/include/gis0type.h b/storage/innobase/include/gis0type.h
index 14c098f9608..52add38b811 100644
--- a/storage/innobase/include/gis0type.h
+++ b/storage/innobase/include/gis0type.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -26,22 +27,12 @@ Created 2013/03/27 Jimmy Yang
#ifndef gis0type_h
#define gis0type_h
-#include "univ.i"
-
#include "buf0buf.h"
#include "data0type.h"
#include "data0types.h"
#include "dict0types.h"
-#include "hash0hash.h"
-#include "mem0mem.h"
-#include "rem0types.h"
-#include "row0types.h"
-#include "trx0types.h"
#include "ut0vec.h"
-#include "ut0wqueue.h"
-#include "que0types.h"
#include "gis0geo.h"
-#include "ut0new.h"
#include <vector>
#include <list>
diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h
index f5be654f490..060d36b2de1 100644
--- a/storage/innobase/include/ha0ha.h
+++ b/storage/innobase/include/ha0ha.h
@@ -27,8 +27,6 @@ Created 8/18/1994 Heikki Tuuri
#ifndef ha0ha_h
#define ha0ha_h
-#include "univ.i"
-
#include "hash0hash.h"
#include "page0types.h"
#include "buf0types.h"
diff --git a/storage/innobase/include/ha0storage.ic b/storage/innobase/include/ha0storage.ic
index e841925d320..ebd788deda8 100644
--- a/storage/innobase/include/ha0storage.ic
+++ b/storage/innobase/include/ha0storage.ic
@@ -25,8 +25,6 @@ its own storage, avoiding duplicates.
Created September 24, 2007 Vasil Dimov
*******************************************************/
-#include "univ.i"
-#include "ha0storage.h"
#include "hash0hash.h"
#include "mem0mem.h"
diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h
index cbb6da488b5..6afdf337aff 100644
--- a/storage/innobase/include/hash0hash.h
+++ b/storage/innobase/include/hash0hash.h
@@ -27,7 +27,6 @@ Created 5/20/1997 Heikki Tuuri
#ifndef hash0hash_h
#define hash0hash_h
-#include "univ.i"
#include "mem0mem.h"
#include "sync0rw.h"
diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h
index eaf391be09b..f4ba8a81275 100644
--- a/storage/innobase/include/ib0mutex.h
+++ b/storage/innobase/include/ib0mutex.h
@@ -35,7 +35,7 @@ Created 2013-03-26 Sunny Bains.
#include "sync0arr.h"
/** OS mutex for tracking lock/unlock for debugging */
-template <template <typename> class Policy = NoPolicy>
+template <template <typename> class Policy>
struct OSTrackMutex {
typedef Policy<OSTrackMutex> MutexPolicy;
@@ -152,7 +152,7 @@ private:
#include <sys/syscall.h>
/** Mutex implementation that used the Linux futex. */
-template <template <typename> class Policy = NoPolicy>
+template <template <typename> class Policy>
struct TTASFutexMutex {
typedef Policy<TTASFutexMutex> MutexPolicy;
@@ -167,21 +167,24 @@ struct TTASFutexMutex {
~TTASFutexMutex()
{
- ut_a(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(m_lock_word.load(std::memory_order_relaxed)
+ == MUTEX_STATE_UNLOCKED);
}
/** Called when the mutex is "created". Note: Not from the constructor
but when the mutex is initialised. */
void init(latch_id_t, const char*, uint32_t) UNIV_NOTHROW
{
- ut_a(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(m_lock_word.load(std::memory_order_relaxed)
+ == MUTEX_STATE_UNLOCKED);
}
/** Destroy the mutex. */
void destroy() UNIV_NOTHROW
{
/* The destructor can be called at shutdown. */
- ut_a(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(m_lock_word.load(std::memory_order_relaxed)
+ == MUTEX_STATE_UNLOCKED);
}
/** Acquire the mutex.
@@ -202,9 +205,8 @@ struct TTASFutexMutex {
}
for (n_waits= 0;; n_waits++) {
- if (my_atomic_fas32_explicit(&m_lock_word,
- MUTEX_STATE_WAITERS,
- MY_MEMORY_ORDER_ACQUIRE)
+ if (m_lock_word.exchange(MUTEX_STATE_WAITERS,
+ std::memory_order_acquire)
== MUTEX_STATE_UNLOCKED) {
break;
}
@@ -220,9 +222,8 @@ struct TTASFutexMutex {
/** Release the mutex. */
void exit() UNIV_NOTHROW
{
- if (my_atomic_fas32_explicit(&m_lock_word,
- MUTEX_STATE_UNLOCKED,
- MY_MEMORY_ORDER_RELEASE)
+ if (m_lock_word.exchange(MUTEX_STATE_UNLOCKED,
+ std::memory_order_release)
== MUTEX_STATE_WAITERS) {
syscall(SYS_futex, &m_lock_word, FUTEX_WAKE_PRIVATE,
1, 0, 0, 0);
@@ -234,10 +235,11 @@ struct TTASFutexMutex {
bool try_lock() UNIV_NOTHROW
{
int32 oldval = MUTEX_STATE_UNLOCKED;
- return(my_atomic_cas32_strong_explicit(&m_lock_word, &oldval,
- MUTEX_STATE_LOCKED,
- MY_MEMORY_ORDER_ACQUIRE,
- MY_MEMORY_ORDER_RELAXED));
+ return m_lock_word.compare_exchange_strong(
+ oldval,
+ MUTEX_STATE_LOCKED,
+ std::memory_order_acquire,
+ std::memory_order_relaxed);
}
/** @return non-const version of the policy */
@@ -257,12 +259,12 @@ private:
/** lock_word is the target of the atomic test-and-set instruction
when atomic operations are enabled. */
- int32 m_lock_word;
+ std::atomic<int32> m_lock_word;
};
#endif /* HAVE_IB_LINUX_FUTEX */
-template <template <typename> class Policy = NoPolicy>
+template <template <typename> class Policy>
struct TTASMutex {
typedef Policy<TTASMutex> MutexPolicy;
@@ -277,40 +279,45 @@ struct TTASMutex {
~TTASMutex()
{
- ut_ad(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(m_lock_word.load(std::memory_order_relaxed)
+ == MUTEX_STATE_UNLOCKED);
}
/** Called when the mutex is "created". Note: Not from the constructor
but when the mutex is initialised. */
void init(latch_id_t) UNIV_NOTHROW
{
- ut_ad(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(m_lock_word.load(std::memory_order_relaxed)
+ == MUTEX_STATE_UNLOCKED);
}
/** Destroy the mutex. */
void destroy() UNIV_NOTHROW
{
/* The destructor can be called at shutdown. */
- ut_ad(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(m_lock_word.load(std::memory_order_relaxed)
+ == MUTEX_STATE_UNLOCKED);
}
/** Try and lock the mutex.
@return true on success */
bool try_lock() UNIV_NOTHROW
{
- int32 oldval = MUTEX_STATE_UNLOCKED;
- return(my_atomic_cas32_strong_explicit(&m_lock_word, &oldval,
- MUTEX_STATE_LOCKED,
- MY_MEMORY_ORDER_ACQUIRE,
- MY_MEMORY_ORDER_RELAXED));
+ uint32_t oldval = MUTEX_STATE_UNLOCKED;
+ return m_lock_word.compare_exchange_strong(
+ oldval,
+ MUTEX_STATE_LOCKED,
+ std::memory_order_acquire,
+ std::memory_order_relaxed);
}
/** Release the mutex. */
void exit() UNIV_NOTHROW
{
- ut_ad(m_lock_word == MUTEX_STATE_LOCKED);
- my_atomic_store32_explicit(&m_lock_word, MUTEX_STATE_UNLOCKED,
- MY_MEMORY_ORDER_RELEASE);
+ ut_ad(m_lock_word.load(std::memory_order_relaxed)
+ == MUTEX_STATE_LOCKED);
+ m_lock_word.store(MUTEX_STATE_UNLOCKED,
+ std::memory_order_release);
}
/** Acquire the mutex.
@@ -353,12 +360,11 @@ private:
/** Policy data */
MutexPolicy m_policy;
- /** lock_word is the target of the atomic test-and-set instruction
- when atomic operations are enabled. */
- int32 m_lock_word;
+ /** mutex state */
+ std::atomic<uint32_t> m_lock_word;
};
-template <template <typename> class Policy = NoPolicy>
+template <template <typename> class Policy>
struct TTASEventMutex {
typedef Policy<TTASEventMutex> MutexPolicy;
@@ -376,7 +382,7 @@ struct TTASEventMutex {
~TTASEventMutex()
UNIV_NOTHROW
{
- ut_ad(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(state() == MUTEX_STATE_UNLOCKED);
}
/** Called when the mutex is "created". Note: Not from the constructor
@@ -385,7 +391,7 @@ struct TTASEventMutex {
void init(latch_id_t id, const char*, uint32_t) UNIV_NOTHROW
{
ut_a(m_event == 0);
- ut_a(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(state() == MUTEX_STATE_UNLOCKED);
m_event = os_event_create(sync_latch_get_name(id));
}
@@ -396,7 +402,7 @@ struct TTASEventMutex {
void destroy()
UNIV_NOTHROW
{
- ut_ad(m_lock_word == MUTEX_STATE_UNLOCKED);
+ ut_ad(state() == MUTEX_STATE_UNLOCKED);
/* We have to free the event before InnoDB shuts down. */
os_event_destroy(m_event);
@@ -408,20 +414,20 @@ struct TTASEventMutex {
bool try_lock()
UNIV_NOTHROW
{
- int32 oldval = MUTEX_STATE_UNLOCKED;
- return(my_atomic_cas32_strong_explicit(&m_lock_word, &oldval,
- MUTEX_STATE_LOCKED,
- MY_MEMORY_ORDER_ACQUIRE,
- MY_MEMORY_ORDER_RELAXED));
+ uint32_t oldval = MUTEX_STATE_UNLOCKED;
+ return m_lock_word.compare_exchange_strong(
+ oldval,
+ MUTEX_STATE_LOCKED,
+ std::memory_order_acquire,
+ std::memory_order_relaxed);
}
/** Release the mutex. */
void exit()
UNIV_NOTHROW
{
- if (my_atomic_fas32_explicit(&m_lock_word,
- MUTEX_STATE_UNLOCKED,
- MY_MEMORY_ORDER_RELEASE)
+ if (m_lock_word.exchange(MUTEX_STATE_UNLOCKED,
+ std::memory_order_release)
== MUTEX_STATE_WAITERS) {
os_event_set(m_event);
sync_array_object_signalled();
@@ -459,11 +465,12 @@ struct TTASEventMutex {
: SYNC_MUTEX,
filename, line, &cell);
- int32 oldval = MUTEX_STATE_LOCKED;
- my_atomic_cas32_strong_explicit(&m_lock_word, &oldval,
- MUTEX_STATE_WAITERS,
- MY_MEMORY_ORDER_RELAXED,
- MY_MEMORY_ORDER_RELAXED);
+ uint32_t oldval = MUTEX_STATE_LOCKED;
+ m_lock_word.compare_exchange_strong(
+ oldval,
+ MUTEX_STATE_WAITERS,
+ std::memory_order_relaxed,
+ std::memory_order_relaxed);
if (oldval == MUTEX_STATE_UNLOCKED) {
sync_array_free_cell(sync_arr, cell);
@@ -482,9 +489,7 @@ struct TTASEventMutex {
int32 state() const
UNIV_NOTHROW
{
- return(my_atomic_load32_explicit(const_cast<int32*>
- (&m_lock_word),
- MY_MEMORY_ORDER_RELAXED));
+ return m_lock_word.load(std::memory_order_relaxed);
}
/** The event that the mutex will wait in sync0arr.cc
@@ -514,9 +519,8 @@ private:
TTASEventMutex(const TTASEventMutex&);
TTASEventMutex& operator=(const TTASEventMutex&);
- /** lock_word is the target of the atomic test-and-set instruction
- when atomic operations are enabled. */
- int32 m_lock_word;
+ /** mutex state */
+ std::atomic<uint32_t> m_lock_word;
/** Used by sync0arr.cc for the wait queue */
os_event_t m_event;
@@ -530,7 +534,6 @@ with the Performance Schema instrumentation. */
template <typename MutexImpl>
struct PolicyMutex
{
- typedef MutexImpl MutexType;
typedef typename MutexImpl::MutexPolicy Policy;
PolicyMutex() UNIV_NOTHROW : m_impl()
@@ -561,7 +564,7 @@ struct PolicyMutex
pfs_exit();
#endif /* UNIV_PFS_MUTEX */
- policy().release(m_impl);
+ ut_d(policy().context.release(m_impl));
m_impl.exit();
}
@@ -587,11 +590,11 @@ struct PolicyMutex
locker = pfs_begin_lock(&state, name, line);
#endif /* UNIV_PFS_MUTEX */
- policy().enter(m_impl, name, line);
+ ut_d(policy().context.enter(m_impl, name, line));
m_impl.enter(n_spins, n_delay, name, line);
- policy().locked(m_impl, name, line);
+ ut_d(policy().context.locked(m_impl, name, line));
#ifdef UNIV_PFS_MUTEX
pfs_end(locker, 0);
#endif /* UNIV_PFS_MUTEX */
@@ -620,9 +623,9 @@ struct PolicyMutex
if (ret == 0) {
- policy().enter(m_impl, name, line);
+ ut_d(policy().context.enter(m_impl, name, line));
- policy().locked(m_impl, name, line);
+ ut_d(policy().context.locked(m_impl, name, line));
}
#ifdef UNIV_PFS_MUTEX
@@ -636,7 +639,7 @@ struct PolicyMutex
/** @return true if the thread owns the mutex. */
bool is_owned() const UNIV_NOTHROW
{
- return(policy().is_owned());
+ return(policy().context.is_owned());
}
#endif /* UNIV_DEBUG */
@@ -658,6 +661,7 @@ struct PolicyMutex
m_impl.init(id, filename, line);
policy().init(m_impl, id, filename, line);
+ ut_d(policy().context.init(id));
}
/** Free resources (if any) */
@@ -668,6 +672,7 @@ struct PolicyMutex
#endif /* UNIV_PFS_MUTEX */
m_impl.destroy();
policy().destroy();
+ ut_d(policy().context.destroy());
}
/** Required for os_event_t */
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index 95a302b1439..72b9e291fca 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -27,8 +27,6 @@ Created 7/19/1997 Heikki Tuuri
#ifndef ibuf0ibuf_h
#define ibuf0ibuf_h
-#include "univ.i"
-
#include "mtr0mtr.h"
#include "dict0mem.h"
#include "fsp0fsp.h"
diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic
index f6ff6f2a7fd..e35b8a252a7 100644
--- a/storage/innobase/include/ibuf0ibuf.ic
+++ b/storage/innobase/include/ibuf0ibuf.ic
@@ -78,11 +78,12 @@ struct ibuf_t{
ulint height; /*!< tree height */
dict_index_t* index; /*!< insert buffer index */
- ulint n_merges; /*!< number of pages merged */
- ulint n_merged_ops[IBUF_OP_COUNT];
+ /** number of pages merged */
+ Atomic_counter<ulint> n_merges;
+ Atomic_counter<ulint> n_merged_ops[IBUF_OP_COUNT];
/*!< number of operations of each type
merged to index pages */
- ulint n_discarded_ops[IBUF_OP_COUNT];
+ Atomic_counter<ulint> n_discarded_ops[IBUF_OP_COUNT];
/*!< number of operations of each type
discarded without merging due to the
tablespace being deleted or the
diff --git a/storage/innobase/include/lock0iter.h b/storage/innobase/include/lock0iter.h
index ca97d22556a..7b475116857 100644
--- a/storage/innobase/include/lock0iter.h
+++ b/storage/innobase/include/lock0iter.h
@@ -26,7 +26,6 @@ Created July 16, 2007 Vasil Dimov
#ifndef lock0iter_h
#define lock0iter_h
-#include "univ.i"
#include "lock0types.h"
struct lock_queue_iterator_t {
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index 0f6fe158264..701c79b8727 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -27,12 +27,10 @@ Created 5/7/1996 Heikki Tuuri
#ifndef lock0lock_h
#define lock0lock_h
-#include "univ.i"
#include "buf0types.h"
#include "trx0types.h"
#include "mtr0types.h"
#include "rem0types.h"
-#include "dict0types.h"
#include "que0types.h"
#include "lock0types.h"
#include "hash0hash.h"
diff --git a/storage/innobase/include/lock0prdt.h b/storage/innobase/include/lock0prdt.h
index 9eb38ff8975..629cd05122a 100644
--- a/storage/innobase/include/lock0prdt.h
+++ b/storage/innobase/include/lock0prdt.h
@@ -26,7 +26,6 @@ Created 9/7/2013 Jimmy Yang
#ifndef lock0prdt_h
#define lock0prdt_h
-#include "univ.i"
#include "lock0lock.h"
/* Predicate lock data */
diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h
index d9377e97d40..ab88f065809 100644
--- a/storage/innobase/include/lock0priv.h
+++ b/storage/innobase/include/lock0priv.h
@@ -34,7 +34,6 @@ those functions in lock/ */
#error Do not include lock0priv.h outside of the lock/ module
#endif
-#include "univ.i"
#include "hash0hash.h"
#include "trx0trx.h"
diff --git a/storage/innobase/include/lock0types.h b/storage/innobase/include/lock0types.h
index 1aac5d20a59..6157f095c5b 100644
--- a/storage/innobase/include/lock0types.h
+++ b/storage/innobase/include/lock0types.h
@@ -24,6 +24,7 @@ The transaction lock system global types
Created 5/7/1996 Heikki Tuuri
*******************************************************/
+#include "dict0types.h"
#include "ut0lst.h"
#ifndef lock0types_h
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
index 7cf0e839ef7..3f0d149d5f1 100644
--- a/storage/innobase/include/log0log.h
+++ b/storage/innobase/include/log0log.h
@@ -34,7 +34,6 @@ Created 12/9/1995 Heikki Tuuri
#ifndef log0log_h
#define log0log_h
-#include "univ.i"
#include "dyn0buf.h"
#include "sync0rw.h"
#include "log0types.h"
@@ -565,11 +564,6 @@ struct log_t{
/** the byte offset of the above lsn */
lsn_t lsn_offset;
- /** unaligned buffers */
- byte* file_header_bufs_ptr;
- /** buffers for each file header in the group */
- byte* file_header_bufs[SRV_N_LOG_FILES_MAX];
-
/** used only in recovery: recovery scan succeeded up to this
lsn in this log group */
lsn_t scanned_lsn;
@@ -604,10 +598,7 @@ struct log_t{
/** Close the redo log buffer. */
void close()
{
- ut_free(file_header_bufs_ptr);
n_files = 0;
- file_header_bufs_ptr = NULL;
- memset(file_header_bufs, 0, sizeof file_header_bufs);
}
} log;
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index c18da743288..5fe00d65f2c 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -27,13 +27,11 @@ Created 9/20/1997 Heikki Tuuri
#ifndef log0recv_h
#define log0recv_h
-#include "univ.i"
#include "ut0byte.h"
#include "buf0types.h"
#include "hash0hash.h"
#include "log0log.h"
#include "mtr0types.h"
-#include "ut0new.h"
#include <list>
#include <vector>
diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h
index 684a3155a16..96e8d629021 100644
--- a/storage/innobase/include/mach0data.h
+++ b/storage/innobase/include/mach0data.h
@@ -28,11 +28,11 @@ Created 11/28/1995 Heikki Tuuri
#ifndef mach0data_h
#define mach0data_h
-#ifndef UNIV_INNOCHECKSUM
-
#include "univ.i"
#include "mtr0types.h"
+#ifndef UNIV_INNOCHECKSUM
+
/* The data and all fields are always stored in a database file
in the same format: ascii, big-endian, ... .
All data in the files MUST be accessed using the functions in this
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
index 2cdb307ea96..a2d676e7f2a 100644
--- a/storage/innobase/include/mem0mem.h
+++ b/storage/innobase/include/mem0mem.h
@@ -27,9 +27,7 @@ Created 6/9/1994 Heikki Tuuri
#ifndef mem0mem_h
#define mem0mem_h
-#include "univ.i"
#include "ut0mem.h"
-#include "ut0byte.h"
#include "ut0rnd.h"
#include "mach0data.h"
@@ -418,104 +416,4 @@ struct mem_block_info_t {
UNIV_MEM_ALIGNMENT)
#include "mem0mem.ic"
-
-/** A C++ wrapper class to the mem_heap_t routines, so that it can be used
-as an STL allocator */
-template<typename T>
-class mem_heap_allocator
-{
-public:
- typedef T value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T* pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
-
- mem_heap_allocator(mem_heap_t* heap) : m_heap(heap) { }
-
- mem_heap_allocator(const mem_heap_allocator& other)
- :
- m_heap(other.m_heap)
- {
- // Do nothing
- }
-
- template <typename U>
- mem_heap_allocator (const mem_heap_allocator<U>& other)
- :
- m_heap(other.m_heap)
- {
- // Do nothing
- }
-
- ~mem_heap_allocator() { m_heap = 0; }
-
- size_type max_size() const
- {
- return(ULONG_MAX / sizeof(T));
- }
-
- /** This function returns a pointer to the first element of a newly
- allocated array large enough to contain n objects of type T; only the
- memory is allocated, and the objects are not constructed. Moreover,
- an optional pointer argument (that points to an object already
- allocated by mem_heap_allocator) can be used as a hint to the
- implementation about where the new memory should be allocated in
- order to improve locality. */
- pointer allocate(size_type n)
- {
- return(reinterpret_cast<pointer>(
- mem_heap_alloc(m_heap, n * sizeof(T))));
- }
- pointer allocate(size_type n, const_pointer) { return allocate(n); }
-
- void deallocate(pointer, size_type) {}
-
- pointer address (reference r) const { return(&r); }
-
- const_pointer address (const_reference r) const { return(&r); }
-
- void construct(pointer p, const_reference t)
- {
- new (reinterpret_cast<void*>(p)) T(t);
- }
-
- void destroy(pointer p)
- {
- (reinterpret_cast<T*>(p))->~T();
- }
-
- /** Allocators are required to supply the below template class member
- which enables the possibility of obtaining a related allocator,
- parametrized in terms of a different type. For example, given an
- allocator type IntAllocator for objects of type int, a related
- allocator type for objects of type long could be obtained using
- IntAllocator::rebind<long>::other */
- template <typename U>
- struct rebind
- {
- typedef mem_heap_allocator<U> other;
- };
-
-private:
- mem_heap_t* m_heap;
- template <typename U> friend class mem_heap_allocator;
-};
-
-template <class T>
-bool operator== (const mem_heap_allocator<T>& left,
- const mem_heap_allocator<T>& right)
-{
- return(left.heap == right.heap);
-}
-
-template <class T>
-bool operator!= (const mem_heap_allocator<T>& left,
- const mem_heap_allocator<T>& right)
-{
- return(left.heap != right.heap);
-}
-
#endif
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index 405b7338b51..8a8d141ce11 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -24,8 +24,6 @@ The memory management
Created 6/8/1994 Heikki Tuuri
*************************************************************************/
-#include "ut0new.h"
-
#ifdef UNIV_DEBUG
# define mem_heap_create_block(heap, n, type, file_name, line) \
mem_heap_create_block_func(heap, n, file_name, line, type)
diff --git a/storage/innobase/include/mtr0log.h b/storage/innobase/include/mtr0log.h
index 01502aa104d..4cb7ea4eb64 100644
--- a/storage/innobase/include/mtr0log.h
+++ b/storage/innobase/include/mtr0log.h
@@ -27,7 +27,6 @@ Created 12/7/1995 Heikki Tuuri
#ifndef mtr0log_h
#define mtr0log_h
-#include "univ.i"
#include "mtr0mtr.h"
#include "dyn0buf.h"
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index c1281af2b30..fe4c36f0010 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -28,7 +28,6 @@ Created 11/26/1995 Heikki Tuuri
#ifndef mtr0mtr_h
#define mtr0mtr_h
-#include "univ.i"
#include "fil0fil.h"
#include "dyn0buf.h"
diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic
index 82f552f22ce..5213f90d966 100644
--- a/storage/innobase/include/mtr0mtr.ic
+++ b/storage/innobase/include/mtr0mtr.ic
@@ -170,7 +170,7 @@ mtr_t::release_block_at_savepoint(
ut_a(slot->object == block);
- buf_block_unfix(reinterpret_cast<buf_block_t*>(block));
+ reinterpret_cast<buf_block_t*>(block)->unfix();
buf_page_release_latch(block, slot->type);
diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
index 895f82cf2d8..533afb88e3d 100644
--- a/storage/innobase/include/os0file.ic
+++ b/storage/innobase/include/os0file.ic
@@ -24,8 +24,6 @@ The interface to the operating system file io
Created 2/20/2010 Jimmy Yang
*******************************************************/
-#include "univ.i"
-
#ifdef UNIV_PFS_IO
/** NOTE! Please use the corresponding macro os_file_create_simple(),
not directly this function!
diff --git a/storage/innobase/include/os0proc.h b/storage/innobase/include/os0proc.h
index a73ba5a9e84..823da83c63e 100644
--- a/storage/innobase/include/os0proc.h
+++ b/storage/innobase/include/os0proc.h
@@ -40,7 +40,7 @@ typedef unsigned long int os_process_id_t;
/** The total amount of memory currently allocated from the operating
system with os_mem_alloc_large(). */
-extern ulint os_total_large_mem_allocated;
+extern Atomic_counter<ulint> os_total_large_mem_allocated;
/** Whether to use large pages in the buffer pool */
extern my_bool os_use_large_pages;
diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h
index b6838c919a0..e1a1dac6826 100644
--- a/storage/innobase/include/os0thread.h
+++ b/storage/innobase/include/os0thread.h
@@ -73,7 +73,7 @@ typedef unsigned int mysql_pfs_key_t;
#endif /* HAVE_PSI_INTERFACE */
/** Number of threads active. */
-extern ulint os_thread_count;
+extern Atomic_counter<ulint> os_thread_count;
/***************************************************************//**
Compares two thread ids for equality.
diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h
index d98dfa5ec07..3ab310f97f2 100644
--- a/storage/innobase/include/page0cur.h
+++ b/storage/innobase/include/page0cur.h
@@ -27,8 +27,6 @@ Created 10/4/1994 Heikki Tuuri
#ifndef page0cur_h
#define page0cur_h
-#include "univ.i"
-
#include "buf0types.h"
#include "page0page.h"
#include "rem0rec.h"
@@ -36,7 +34,6 @@ Created 10/4/1994 Heikki Tuuri
#include "mtr0mtr.h"
#include "gis0type.h"
-
#ifdef UNIV_DEBUG
/*********************************************************//**
Gets pointer to the page frame where the cursor is positioned.
diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic
index 1ba85d93fb4..b5812560093 100644
--- a/storage/innobase/include/page0cur.ic
+++ b/storage/innobase/include/page0cur.ic
@@ -24,12 +24,7 @@ The page cursor
Created 10/4/1994 Heikki Tuuri
*************************************************************************/
-#include "page0page.h"
-#include "buf0types.h"
-
#ifdef UNIV_DEBUG
-# include "rem0cmp.h"
-
/*********************************************************//**
Gets pointer to the page frame where the cursor is positioned.
@return page */
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 157df6d2713..bc6ab0cb848 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -26,31 +26,24 @@ Created 2/2/1994 Heikki Tuuri
#ifndef page0page_h
#define page0page_h
-#include "univ.i"
-
#include "page0types.h"
-#ifndef UNIV_INNOCHECKSUM
+#include "fsp0fsp.h"
#include "fil0fil.h"
#include "buf0buf.h"
-#include "data0data.h"
-#include "dict0dict.h"
#include "rem0rec.h"
-#endif /* !UNIV_INNOCHECKSUM*/
-#include "fsp0fsp.h"
#ifndef UNIV_INNOCHECKSUM
+#include "dict0dict.h"
+#include "data0data.h"
#include "mtr0mtr.h"
-#ifdef UNIV_MATERIALIZE
-#undef UNIV_INLINE
-#define UNIV_INLINE
-#endif
-
/* PAGE HEADER
===========
Index page header starts at the first offset left free by the FIL-module */
typedef byte page_header_t;
+#else
+# include "mach0data.h"
#endif /* !UNIV_INNOCHECKSUM */
#define PAGE_HEADER FSEG_PAGE_DATA /* index page header starts at this
@@ -1342,22 +1335,6 @@ const rec_t*
page_find_rec_max_not_deleted(
const page_t* page);
-/** Issue a warning when the checksum that is stored in the page is valid,
-but different than the global setting innodb_checksum_algorithm.
-@param[in] current_algo current checksum algorithm
-@param[in] page_checksum page valid checksum
-@param[in] page_id page identifier */
-void
-page_warn_strict_checksum(
- srv_checksum_algorithm_t curr_algo,
- srv_checksum_algorithm_t page_checksum,
- const page_id_t page_id);
-
-#ifdef UNIV_MATERIALIZE
-#undef UNIV_INLINE
-#define UNIV_INLINE UNIV_INLINE_ORIGINAL
-#endif
-
#endif /* !UNIV_INNOCHECKSUM */
#include "page0page.ic"
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 7567853667c..ad0ea913af9 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -29,18 +29,10 @@ Created 2/2/1994 Heikki Tuuri
#ifndef UNIV_INNOCHECKSUM
#include "mach0data.h"
-#ifdef UNIV_DEBUG
-# include "log0recv.h"
-#endif /* !UNIV_DEBUG */
#include "rem0cmp.h"
#include "mtr0log.h"
#include "page0zip.h"
-#ifdef UNIV_MATERIALIZE
-#undef UNIV_INLINE
-#define UNIV_INLINE
-#endif
-
/*************************************************************//**
Returns the max trx id field value. */
UNIV_INLINE
@@ -1100,9 +1092,4 @@ page_get_instant(const page_t* page)
}
#endif /* !UNIV_INNOCHECKSUM */
-#ifdef UNIV_MATERIALIZE
-#undef UNIV_INLINE
-#define UNIV_INLINE UNIV_INLINE_ORIGINAL
-#endif
-
#endif
diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h
index 7c5d3189a97..08d072822bf 100644
--- a/storage/innobase/include/page0size.h
+++ b/storage/innobase/include/page0size.h
@@ -27,7 +27,6 @@ Created Nov 14, 2013 Vasil Dimov
#ifndef page0size_t
#define page0size_t
-#include "univ.i"
#include "fsp0types.h"
#define FIELD_REF_SIZE 20U
diff --git a/storage/innobase/include/page0types.h b/storage/innobase/include/page0types.h
index 2fe433db959..0913a50fee2 100644
--- a/storage/innobase/include/page0types.h
+++ b/storage/innobase/include/page0types.h
@@ -26,10 +26,8 @@ Created 2/2/1994 Heikki Tuuri
#ifndef page0types_h
#define page0types_h
-#include "univ.i"
#include "dict0types.h"
#include "mtr0types.h"
-#include "ut0new.h"
#include <map>
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index cd999ab6891..1e11897482f 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -28,28 +28,11 @@ Created June 2005 by Marko Makela
#ifndef page0zip_h
#define page0zip_h
-#ifdef UNIV_MATERIALIZE
-# undef UNIV_INLINE
-# define UNIV_INLINE
-#endif
-
-#ifdef UNIV_INNOCHECKSUM
-#include "univ.i"
-#include "buf0buf.h"
-#include "ut0crc32.h"
-#include "buf0checksum.h"
-#include "mach0data.h"
-#include "zlib.h"
-#endif /* UNIV_INNOCHECKSUM */
+#include "buf0types.h"
#ifndef UNIV_INNOCHECKSUM
#include "mtr0types.h"
#include "page0types.h"
-#endif /* !UNIV_INNOCHECKSUM */
-
-#include "buf0types.h"
-
-#ifndef UNIV_INNOCHECKSUM
#include "dict0types.h"
#include "srv0srv.h"
#include "trx0types.h"
@@ -510,16 +493,12 @@ page_zip_parse_compress(
@param[in] data compressed page
@param[in] size size of compressed page
@param[in] algo algorithm to use
-@param[in] use_legacy_big_endian only used if algo is
-SRV_CHECKSUM_ALGORITHM_CRC32 or SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 - if true
-then use big endian byteorder when converting byte strings to integers.
@return page checksum */
uint32_t
page_zip_calc_checksum(
const void* data,
ulint size,
- srv_checksum_algorithm_t algo,
- bool use_legacy_big_endian = false);
+ srv_checksum_algorithm_t algo);
/**********************************************************************//**
Verify a compressed page's checksum.
@@ -564,11 +543,6 @@ void
page_zip_reset_stat_per_index();
/*===========================*/
-#ifdef UNIV_MATERIALIZE
-# undef UNIV_INLINE
-# define UNIV_INLINE UNIV_INLINE_ORIGINAL
-#endif
-
#include "page0zip.ic"
#endif /* !UNIV_INNOCHECKSUM */
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index eefe7c8f0f7..10a311089dc 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -25,11 +25,6 @@ Compressed page interface
Created June 2005 by Marko Makela
*******************************************************/
-#ifdef UNIV_MATERIALIZE
-# undef UNIV_INLINE
-# define UNIV_INLINE
-#endif
-
#include "page0zip.h"
#include "mtr0log.h"
#include "page0page.h"
@@ -437,8 +432,3 @@ page_zip_reset_stat_per_index()
mutex_exit(&page_zip_stat_per_index_mutex);
}
-
-#ifdef UNIV_MATERIALIZE
-# undef UNIV_INLINE
-# define UNIV_INLINE UNIV_INLINE_ORIGINAL
-#endif
diff --git a/storage/innobase/include/pars0opt.h b/storage/innobase/include/pars0opt.h
index d9debcf325e..3d5468b8a5e 100644
--- a/storage/innobase/include/pars0opt.h
+++ b/storage/innobase/include/pars0opt.h
@@ -27,10 +27,8 @@ Created 12/21/1997 Heikki Tuuri
#ifndef pars0opt_h
#define pars0opt_h
-#include "univ.i"
#include "que0types.h"
#include "pars0sym.h"
-#include "dict0types.h"
#include "row0sel.h"
/*******************************************************************//**
diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h
index 487ba8c147f..fba42be413f 100644
--- a/storage/innobase/include/pars0pars.h
+++ b/storage/innobase/include/pars0pars.h
@@ -27,7 +27,6 @@ Created 11/19/1996 Heikki Tuuri
#ifndef pars0pars_h
#define pars0pars_h
-#include "univ.i"
#include "que0types.h"
#include "pars0types.h"
#include "row0types.h"
diff --git a/storage/innobase/include/pars0sym.h b/storage/innobase/include/pars0sym.h
index 920087b96c2..c9a5bb5fac2 100644
--- a/storage/innobase/include/pars0sym.h
+++ b/storage/innobase/include/pars0sym.h
@@ -27,9 +27,7 @@ Created 12/15/1997 Heikki Tuuri
#ifndef pars0sym_h
#define pars0sym_h
-#include "univ.i"
#include "que0types.h"
-#include "dict0types.h"
#include "pars0types.h"
#include "row0types.h"
diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h
index ca06f5b09ba..ffca9034b38 100644
--- a/storage/innobase/include/que0que.h
+++ b/storage/innobase/include/que0que.h
@@ -27,9 +27,7 @@ Created 5/27/1996 Heikki Tuuri
#ifndef que0que_h
#define que0que_h
-#include "univ.i"
#include "data0data.h"
-#include "dict0types.h"
#include "trx0trx.h"
#include "trx0roll.h"
#include "srv0srv.h"
diff --git a/storage/innobase/include/que0types.h b/storage/innobase/include/que0types.h
index 0f11cad301a..017e5df9a6f 100644
--- a/storage/innobase/include/que0types.h
+++ b/storage/innobase/include/que0types.h
@@ -27,7 +27,6 @@ Created 5/27/1996 Heikki Tuuri
#define que0types_h
#include "data0data.h"
-#include "dict0types.h"
/* Pseudotype for all graph nodes */
typedef void que_node_t;
diff --git a/storage/innobase/include/read0types.h b/storage/innobase/include/read0types.h
index eade82714c5..5cd8e1740a7 100644
--- a/storage/innobase/include/read0types.h
+++ b/storage/innobase/include/read0types.h
@@ -27,10 +27,9 @@ Created 2/16/1997 Heikki Tuuri
#ifndef read0types_h
#define read0types_h
-#include <algorithm>
#include "dict0mem.h"
-
#include "trx0types.h"
+#include <algorithm>
/** View is not visible to purge thread. */
@@ -67,7 +66,14 @@ class ReadView
Close view:
READ_VIEW_STATE_OPEN -> READ_VIEW_STATE_CLOSED
*/
- int32_t m_state;
+ std::atomic<uint32_t> m_state;
+
+
+ /** m_state getter for ReadView owner thread */
+ uint32_t state() const
+ {
+ return m_state.load(std::memory_order_relaxed);
+ }
public:
@@ -135,35 +141,36 @@ loop:
Closes the view.
View becomes not visible to purge thread.
+
+ This method is intended to be called by ReadView owner thread, thus
+ m_state cannot change.
*/
void close()
{
- ut_ad(m_state == READ_VIEW_STATE_CLOSED ||
- m_state == READ_VIEW_STATE_OPEN);
- if (m_state == READ_VIEW_STATE_OPEN)
- my_atomic_store32_explicit(&m_state, READ_VIEW_STATE_CLOSED,
- MY_MEMORY_ORDER_RELAXED);
+ ut_ad(state() == READ_VIEW_STATE_CLOSED ||
+ state() == READ_VIEW_STATE_OPEN);
+ m_state.store(READ_VIEW_STATE_CLOSED, std::memory_order_relaxed);
}
/** m_state getter for trx_sys::clone_oldest_view() trx_sys::size(). */
- int32_t get_state() const
+ uint32_t get_state() const
{
- return my_atomic_load32_explicit(const_cast<int32*>(&m_state),
- MY_MEMORY_ORDER_ACQUIRE);
+ return m_state.load(std::memory_order_acquire);
}
/**
Returns true if view is open.
- Only used by view owner thread, thus we can omit atomic operations.
+ This method is intended to be called by ReadView owner thread, thus
+ m_state cannot change.
*/
bool is_open() const
{
- ut_ad(m_state == READ_VIEW_STATE_OPEN ||
- m_state == READ_VIEW_STATE_CLOSED);
- return m_state == READ_VIEW_STATE_OPEN;
+ ut_ad(state() == READ_VIEW_STATE_OPEN ||
+ state() == READ_VIEW_STATE_CLOSED);
+ return state() == READ_VIEW_STATE_OPEN;
}
diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h
index 216e3a7655b..e7030915292 100644
--- a/storage/innobase/include/rem0cmp.h
+++ b/storage/innobase/include/rem0cmp.h
@@ -27,12 +27,10 @@ Created 7/1/1994 Heikki Tuuri
#ifndef rem0cmp_h
#define rem0cmp_h
-#include "ha_prototypes.h"
#include "data0data.h"
#include "data0type.h"
-#include "dict0dict.h"
-#include "rem0rec.h"
-#include <my_sys.h>
+#include "rem0types.h"
+#include "page0types.h"
/*************************************************************//**
Returns TRUE if two columns are equal for comparison purposes.
diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic
index bf913b93bfb..290c1455f27 100644
--- a/storage/innobase/include/rem0cmp.ic
+++ b/storage/innobase/include/rem0cmp.ic
@@ -24,6 +24,7 @@ Created 7/1/1994 Heikki Tuuri
************************************************************************/
#include <mysql_com.h>
+#include <my_sys.h>
/** Compare two data fields.
@param[in] dfield1 data field; must have type field set
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index 5cdd3ab49a0..fdcae3818bc 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -28,7 +28,6 @@ Created 5/30/1994 Heikki Tuuri
#define rem0rec_h
#ifndef UNIV_INNOCHECKSUM
-#include "univ.i"
#include "data0data.h"
#include "rem0types.h"
#include "mtr0types.h"
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index 58ac3b73be5..f86643ddd62 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -1389,6 +1389,7 @@ rec_get_converted_size(
} else if (index->table->id == DICT_INDEXES_ID) {
/* The column SYS_INDEXES.MERGE_THRESHOLD was
instantly added in MariaDB 10.2.2 (MySQL 5.7). */
+ ut_ad(!index->table->is_temporary());
ut_ad(index->n_fields == DICT_NUM_FIELDS__SYS_INDEXES);
ut_ad(dtuple->n_fields == DICT_NUM_FIELDS__SYS_INDEXES
|| dtuple->n_fields
diff --git a/storage/innobase/include/row0ext.h b/storage/innobase/include/row0ext.h
index 050bc37850b..fe4bd710156 100644
--- a/storage/innobase/include/row0ext.h
+++ b/storage/innobase/include/row0ext.h
@@ -26,12 +26,11 @@ Created September 2006 Marko Makela
#ifndef row0ext_h
#define row0ext_h
-#include "univ.i"
-#include "row0types.h"
#include "data0types.h"
#include "mem0mem.h"
#include "dict0types.h"
#include "page0size.h"
+#include "row0types.h"
/********************************************************************//**
Creates a cache of column prefixes of externally stored columns.
diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h
index 3ae5d5bc175..0c2ffdb46ea 100644
--- a/storage/innobase/include/row0ftsort.h
+++ b/storage/innobase/include/row0ftsort.h
@@ -27,16 +27,11 @@ Created 10/13/2010 Jimmy Yang
#ifndef row0ftsort_h
#define row0ftsort_h
-#include "univ.i"
#include "data0data.h"
-#include "dict0types.h"
-#include "row0mysql.h"
#include "fts0fts.h"
-#include "fts0types.h"
#include "fts0priv.h"
#include "row0merge.h"
#include "btr0bulk.h"
-#include "os0thread.h"
/** This structure defineds information the scan thread will fetch
and put to the linked list for parallel tokenization/sort threads
diff --git a/storage/innobase/include/row0import.h b/storage/innobase/include/row0import.h
index 5eb5425b983..94df1a61341 100644
--- a/storage/innobase/include/row0import.h
+++ b/storage/innobase/include/row0import.h
@@ -27,7 +27,6 @@ Created 2012-02-08 by Sunny Bains
#ifndef row0import_h
#define row0import_h
-#include "univ.i"
#include "dict0types.h"
// Forward declarations
diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h
index 6d3dc64211f..8ad955e8ed5 100644
--- a/storage/innobase/include/row0ins.h
+++ b/storage/innobase/include/row0ins.h
@@ -27,10 +27,8 @@ Created 4/20/1996 Heikki Tuuri
#ifndef row0ins_h
#define row0ins_h
-#include "univ.i"
#include "data0data.h"
#include "que0types.h"
-#include "dict0types.h"
#include "trx0types.h"
#include "row0types.h"
diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h
index 723cf310f95..334c67fb434 100644
--- a/storage/innobase/include/row0log.h
+++ b/storage/innobase/include/row0log.h
@@ -27,18 +27,16 @@ Created 2011-05-26 Marko Makela
#ifndef row0log_h
#define row0log_h
-#include "univ.i"
+#include "que0types.h"
#include "mtr0types.h"
#include "row0types.h"
#include "rem0types.h"
#include "data0types.h"
-#include "dict0types.h"
#include "trx0types.h"
-#include "que0types.h"
class ut_stage_alter_t;
-extern ulint onlineddl_rowlog_rows;
+extern Atomic_counter<ulint> onlineddl_rowlog_rows;
extern ulint onlineddl_rowlog_pct_used;
extern ulint onlineddl_pct_progress;
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index ad4005239c3..7d49f0ee346 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -27,11 +27,8 @@ Created 13/06/2005 Jan Lindstrom
#ifndef row0merge_h
#define row0merge_h
-#include "univ.i"
-#include "data0data.h"
-#include "dict0types.h"
-#include "trx0types.h"
#include "que0types.h"
+#include "trx0types.h"
#include "mtr0mtr.h"
#include "rem0types.h"
#include "rem0rec.h"
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index c5c96818d04..1b732952b3f 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -28,21 +28,17 @@ Created 9/17/2000 Heikki Tuuri
#ifndef row0mysql_h
#define row0mysql_h
-#include "ha_prototypes.h"
-#include "sql_list.h"
-#include "sql_cmd.h"
-
-#include "data0data.h"
#include "que0types.h"
-#include "dict0types.h"
#include "trx0types.h"
#include "row0types.h"
-#include "btr0pcur.h"
-#include "trx0types.h"
-#include "fil0crypt.h"
+#include "btr0types.h"
+#include "lock0types.h"
+#include "fil0fil.h"
+#include "fts0fts.h"
+#include "gis0type.h"
-// Forward declaration
-struct SysIndexCallback;
+#include "sql_list.h"
+#include "sql_cmd.h"
extern ibool row_rollback_on_timeout;
@@ -374,9 +370,8 @@ row_create_table_for_mysql(
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
-Does an index creation operation for MySQL. TODO: currently failure
-to create an index results in dropping the whole table! This is no problem
-currently as all indexes must be created at the same time as the table.
+Create an index when creating a table.
+On failure, the caller must drop the table!
@return error number or DB_SUCCESS */
dberr_t
row_create_index_for_mysql(
@@ -392,35 +387,6 @@ row_create_index_for_mysql(
large. */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
-Scans a table create SQL string and adds to the data dictionary
-the foreign key constraints declared in the string. This function
-should be called after the indexes for a table have been created.
-Each foreign key constraint must be accompanied with indexes in
-bot participating tables. The indexes are allowed to contain more
-fields than mentioned in the constraint.
-
-@param[in] trx transaction (NULL if not adding to dictionary)
-@param[in] sql_string table create statement where
- foreign keys are declared like:
- FOREIGN KEY (a, b) REFERENCES table2(c, d),
- table2 can be written also with the database
- name before it: test.table2; the default
- database id the database of parameter name
-@param[in] sql_length length of sql_string
-@param[in] name table full name in normalized form
-@param[in] reject_fks whether to fail with DB_CANNOT_ADD_CONSTRAINT
- if any foreign keys are found
-@return error code or DB_SUCCESS */
-dberr_t
-row_table_add_foreign_constraints(
- trx_t* trx,
- const char* sql_string,
- size_t sql_length,
- const char* name,
- bool reject_fks)
- MY_ATTRIBUTE((warn_unused_result));
-
-/*********************************************************************//**
The master thread in srv0srv.cc calls this regularly to drop tables which
we must drop in background after queries to them have ended. Such lazy
dropping of tables is needed in ALTER TABLE on Unix.
@@ -517,7 +483,9 @@ row_rename_table_for_mysql(
const char* old_name, /*!< in: old table name */
const char* new_name, /*!< in: new table name */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: whether to commit trx */
+ bool commit, /*!< in: whether to commit trx */
+ bool use_fk) /*!< in: whether to parse and enforce
+ FOREIGN KEY constraints */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h
index a7ddef4fe8a..25cd43979bf 100644
--- a/storage/innobase/include/row0purge.h
+++ b/storage/innobase/include/row0purge.h
@@ -27,13 +27,10 @@ Created 3/14/1997 Heikki Tuuri
#ifndef row0purge_h
#define row0purge_h
-#include "univ.i"
-#include "data0data.h"
+#include "que0types.h"
#include "btr0types.h"
#include "btr0pcur.h"
-#include "dict0types.h"
#include "trx0types.h"
-#include "que0types.h"
#include "row0types.h"
#include "ut0vec.h"
#include "row0mysql.h"
diff --git a/storage/innobase/include/row0quiesce.h b/storage/innobase/include/row0quiesce.h
index 4519e2487ce..de267f17405 100644
--- a/storage/innobase/include/row0quiesce.h
+++ b/storage/innobase/include/row0quiesce.h
@@ -28,7 +28,6 @@ Created 2012-02-08 by Sunny Bains
#ifndef row0quiesce_h
#define row0quiesce_h
-#include "univ.i"
#include "dict0types.h"
struct trx_t;
diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h
index b46ca6eb3bc..932accc46b0 100644
--- a/storage/innobase/include/row0row.h
+++ b/storage/innobase/include/row0row.h
@@ -27,12 +27,9 @@ Created 4/20/1996 Heikki Tuuri
#ifndef row0row_h
#define row0row_h
-#include "univ.i"
-#include "data0data.h"
-#include "dict0types.h"
+#include "que0types.h"
#include "ibuf0ibuf.h"
#include "trx0types.h"
-#include "que0types.h"
#include "mtr0mtr.h"
#include "rem0types.h"
#include "row0types.h"
@@ -418,7 +415,7 @@ row_mtr_start(mtr_t* mtr, dict_index_t* index, bool pessimistic)
{
mtr->start();
- switch (index->table->space->id) {
+ switch (index->table->space_id) {
case IBUF_SPACE_ID:
if (pessimistic
&& !(index->type & (DICT_UNIQUE | DICT_SPATIAL))) {
diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.ic
index e1a3b5f6a1a..c9db1d2a37e 100644
--- a/storage/innobase/include/row0row.ic
+++ b/storage/innobase/include/row0row.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -39,16 +39,12 @@ row_get_trx_id_offset(
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: record offsets */
{
- ulint pos;
ulint offset;
ulint len;
- ut_ad(dict_index_is_clust(index));
ut_ad(rec_offs_validate(NULL, index, offsets));
- pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
-
- offset = rec_get_nth_field_offs(offsets, pos, &len);
+ offset = rec_get_nth_field_offs(offsets, index->db_trx_id(), &len);
ut_ad(len == DATA_TRX_ID_LEN);
diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h
index ef0ccbbda9f..1e58686dfcb 100644
--- a/storage/innobase/include/row0sel.h
+++ b/storage/innobase/include/row0sel.h
@@ -27,10 +27,8 @@ Created 12/19/1997 Heikki Tuuri
#ifndef row0sel_h
#define row0sel_h
-#include "univ.i"
#include "data0data.h"
#include "que0types.h"
-#include "dict0types.h"
#include "trx0types.h"
#include "read0types.h"
#include "row0types.h"
diff --git a/storage/innobase/include/row0uins.h b/storage/innobase/include/row0uins.h
index 15e6c33e55e..3d349287bc3 100644
--- a/storage/innobase/include/row0uins.h
+++ b/storage/innobase/include/row0uins.h
@@ -27,9 +27,7 @@ Created 2/25/1997 Heikki Tuuri
#ifndef row0uins_h
#define row0uins_h
-#include "univ.i"
#include "data0data.h"
-#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "row0types.h"
diff --git a/storage/innobase/include/row0umod.h b/storage/innobase/include/row0umod.h
index ef2dd491efd..59d53f60783 100644
--- a/storage/innobase/include/row0umod.h
+++ b/storage/innobase/include/row0umod.h
@@ -27,9 +27,7 @@ Created 2/27/1997 Heikki Tuuri
#ifndef row0umod_h
#define row0umod_h
-#include "univ.i"
#include "data0data.h"
-#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "row0types.h"
diff --git a/storage/innobase/include/row0undo.h b/storage/innobase/include/row0undo.h
index f7cec643b33..6aa7ebaa339 100644
--- a/storage/innobase/include/row0undo.h
+++ b/storage/innobase/include/row0undo.h
@@ -27,13 +27,9 @@ Created 1/8/1997 Heikki Tuuri
#ifndef row0undo_h
#define row0undo_h
-#include "univ.i"
-#include "mtr0mtr.h"
#include "trx0sys.h"
#include "btr0types.h"
#include "btr0pcur.h"
-#include "dict0types.h"
-#include "trx0types.h"
#include "que0types.h"
#include "row0types.h"
@@ -86,17 +82,20 @@ that index record. */
enum undo_exec {
UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next
undo log record */
- UNDO_NODE_INSERT, /*!< undo a fresh insert of a
- row to a table */
- UNDO_NODE_MODIFY /*!< undo a modify operation
- (DELETE or UPDATE) on a row
- of a table */
+ /** rollback an insert into persistent table */
+ UNDO_INSERT_PERSISTENT,
+ /** rollback an update (or delete) in a persistent table */
+ UNDO_UPDATE_PERSISTENT,
+ /** rollback an insert into temporary table */
+ UNDO_INSERT_TEMPORARY,
+ /** rollback an update (or delete) in a temporary table */
+ UNDO_UPDATE_TEMPORARY,
};
/** Undo node structure */
struct undo_node_t{
que_common_t common; /*!< node type: QUE_NODE_UNDO */
- enum undo_exec state; /*!< node execution state */
+ undo_exec state; /*!< rollback execution state */
trx_t* trx; /*!< trx for which undo is done */
roll_ptr_t roll_ptr;/*!< roll pointer to undo log record */
trx_undo_rec_t* undo_rec;/*!< undo log record */
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index db8035cd8b8..d411e0efdc2 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -30,7 +30,6 @@ Created 12/27/1996 Heikki Tuuri
#include "data0data.h"
#include "row0types.h"
#include "btr0types.h"
-#include "dict0types.h"
#include "trx0types.h"
#include "btr0pcur.h"
#include "que0types.h"
@@ -101,19 +100,6 @@ upd_get_field_by_field_no(
bool is_virtual) /*!< in: if it is a virtual column */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
-Writes into the redo log the values of trx id and roll ptr and enough info
-to determine their positions within a clustered index record.
-@return new pointer to mlog */
-byte*
-row_upd_write_sys_vals_to_log(
-/*==========================*/
- dict_index_t* index, /*!< in: clustered index */
- trx_id_t trx_id, /*!< in: transaction id */
- roll_ptr_t roll_ptr,/*!< in: roll ptr of the undo log record */
- byte* log_ptr,/*!< pointer to a buffer of size > 20 opened
- in mlog */
- mtr_t* mtr); /*!< in: mtr */
-/*********************************************************************//**
Updates the trx id and roll ptr field in a clustered index record when
a row is updated or marked deleted. */
UNIV_INLINE
@@ -128,18 +114,6 @@ row_upd_rec_sys_fields(
const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr);/*!< in: DB_ROLL_PTR to the undo log */
/*********************************************************************//**
-Sets the trx id or roll ptr field of a clustered index entry. */
-void
-row_upd_index_entry_sys_field(
-/*==========================*/
- dtuple_t* entry, /*!< in/out: index entry, where the memory
- buffers for sys fields are already allocated:
- the function just copies the new values to
- them */
- dict_index_t* index, /*!< in: clustered index */
- ulint type, /*!< in: DATA_TRX_ID or DATA_ROLL_PTR */
- ib_uint64_t val); /*!< in: value to write */
-/*********************************************************************//**
Creates an update node for a query graph.
@return own: update node */
upd_node_t*
@@ -220,6 +194,7 @@ the equal ordering fields. NOTE: we compare the fields as binary strings!
@param[in] heap memory heap from which allocated
@param[in,out] mysql_table NULL, or mysql table object when
user thread invokes dml
+@param[out] error error number in case of failure
@return own: update vector of differing fields, excluding roll ptr and
trx id */
upd_t*
@@ -231,8 +206,9 @@ row_upd_build_difference_binary(
bool no_sys,
trx_t* trx,
mem_heap_t* heap,
- TABLE* mysql_table)
- MY_ATTRIBUTE((nonnull(1,2,3,7), warn_unused_result));
+ TABLE* mysql_table,
+ dberr_t* error)
+ MY_ATTRIBUTE((nonnull(1,2,3,7,9), warn_unused_result));
/** Apply an update vector to an index entry.
@param[in,out] entry index entry to be updated; the clustered index record
must be covered by a lock or a page latch to prevent
diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.ic
index 5e43a272388..403c39250cb 100644
--- a/storage/innobase/include/row0upd.ic
+++ b/storage/innobase/include/row0upd.ic
@@ -167,13 +167,13 @@ row_upd_rec_sys_fields(
const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr)/*!< in: DB_ROLL_PTR to the undo log */
{
- ut_ad(dict_index_is_clust(index));
+ ut_ad(index->is_primary());
ut_ad(rec_offs_validate(rec, index, offsets));
- if (page_zip) {
- ulint pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
+ if (UNIV_LIKELY_NULL(page_zip)) {
page_zip_write_trx_id_and_roll_ptr(page_zip, rec, offsets,
- pos, trx->id, roll_ptr);
+ index->db_trx_id(),
+ trx->id, roll_ptr);
} else {
ulint offset = index->trx_id_offset;
diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h
index 9869a3acf95..dd438c366a8 100644
--- a/storage/innobase/include/row0vers.h
+++ b/storage/innobase/include/row0vers.h
@@ -27,9 +27,7 @@ Created 2/6/1997 Heikki Tuuri
#ifndef row0vers_h
#define row0vers_h
-#include "univ.i"
#include "data0data.h"
-#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "rem0types.h"
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index 0433ed5dcfd..4c66da51bc2 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -299,7 +299,6 @@ enum monitor_id_t {
MONITOR_TRX_COMMIT_UNDO,
MONITOR_TRX_ROLLBACK,
MONITOR_TRX_ROLLBACK_SAVEPOINT,
- MONITOR_TRX_ROLLBACK_ACTIVE,
MONITOR_TRX_ACTIVE,
MONITOR_RSEG_HISTORY_LEN,
MONITOR_NUM_UNDO_SLOT_USED,
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 25a71ffbafe..a905b652c29 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -42,20 +42,16 @@ Created 10/10/1995 Heikki Tuuri
#ifndef srv0srv_h
#define srv0srv_h
-#include "my_global.h"
-
-#include "mysql/psi/mysql_stage.h"
-#include "mysql/psi/psi.h"
-
-#include "univ.i"
+#include "log0log.h"
#include "os0event.h"
#include "que0types.h"
#include "trx0types.h"
#include "srv0conc.h"
-#include "buf0checksum.h"
-#include "ut0counter.h"
#include "fil0fil.h"
+#include "mysql/psi/mysql_stage.h"
+#include "mysql/psi/psi.h"
+
/** Global counters used inside InnoDB. */
struct srv_stats_t
{
@@ -147,7 +143,8 @@ struct srv_stats_t
ulint_ctr_1_t n_lock_wait_count;
/** Number of threads currently waiting on database locks */
- simple_atomic_counter<> n_lock_wait_current_count;
+ MY_ALIGNED(CACHE_LINE_SIZE) Atomic_counter<ulint>
+ n_lock_wait_current_count;
/** Number of rows read. */
ulint_ctr_64_t n_rows_read;
@@ -451,7 +448,7 @@ extern uint srv_fast_shutdown; /*!< If this is 1, do not do a
/** Signal to shut down InnoDB (NULL if shutdown was signaled, or if
running in innodb_read_only mode, srv_read_only_mode) */
-extern st_my_thread_var *srv_running;
+extern std::atomic<st_my_thread_var *> srv_running;
extern ibool srv_innodb_status;
@@ -538,7 +535,6 @@ extern uint srv_sys_space_size_debug;
extern bool srv_log_files_created;
#endif /* UNIV_DEBUG */
-#define SRV_SEMAPHORE_WAIT_EXTENSION 7200
extern ulint srv_dml_needed_delay;
#define SRV_MAX_N_IO_THREADS 130
@@ -972,7 +968,7 @@ struct export_var_t{
ulint innodb_system_rows_inserted; /*!< srv_n_system_rows_inserted */
ulint innodb_system_rows_updated; /*!< srv_n_system_rows_updated */
ulint innodb_system_rows_deleted; /*!< srv_n_system_rows_deleted*/
- ulint innodb_num_open_files; /*!< fil_n_file_opened */
+ ulint innodb_num_open_files; /*!< fil_system_t::n_open */
ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
ulint innodb_available_undo_logs; /*!< srv_available_undo_logs
*/
diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
index ee263f6c1f6..c2665a360cc 100644
--- a/storage/innobase/include/srv0start.h
+++ b/storage/innobase/include/srv0start.h
@@ -27,7 +27,6 @@ Created 10/10/1995 Heikki Tuuri
#ifndef srv0start_h
#define srv0start_h
-#include "univ.i"
#include "log0log.h"
#include "ut0byte.h"
diff --git a/storage/innobase/include/sync0arr.h b/storage/innobase/include/sync0arr.h
index b3180c1779d..2fefd4ed7c3 100644
--- a/storage/innobase/include/sync0arr.h
+++ b/storage/innobase/include/sync0arr.h
@@ -28,7 +28,6 @@ Created 9/5/1995 Heikki Tuuri
#define sync0arr_h
#include "univ.i"
-#include "os0thread.h"
/** Synchronization wait array cell */
struct sync_cell_t;
diff --git a/storage/innobase/include/sync0debug.h b/storage/innobase/include/sync0debug.h
index ecc742918f0..ccd5b9c2321 100644
--- a/storage/innobase/include/sync0debug.h
+++ b/storage/innobase/include/sync0debug.h
@@ -34,7 +34,6 @@ Created 2012-08-21 Sunny Bains
#define sync0debug_h
#include "univ.i"
-#include "sync0types.h"
/** Initializes the synchronization data structures. */
void
diff --git a/storage/innobase/include/sync0policy.h b/storage/innobase/include/sync0policy.h
index daa08a91e1e..090f83f46e2 100644
--- a/storage/innobase/include/sync0policy.h
+++ b/storage/innobase/include/sync0policy.h
@@ -27,252 +27,179 @@ Created 2012-08-21 Sunny Bains.
#ifndef sync0policy_h
#define sync0policy_h
-#include "univ.i"
#include "ut0rnd.h"
#include "os0thread.h"
-#include "sync0types.h"
#include "srv0mon.h"
+#include "sync0debug.h"
#ifdef UNIV_DEBUG
-# define MUTEX_MAGIC_N 979585UL
-
-template <typename Mutex>
-class MutexDebug {
-public:
-
- /** For passing context to SyncDebug */
- struct Context : public latch_t {
-
- /** Constructor */
- Context()
- :
- m_mutex(),
- m_filename(),
- m_line(),
- m_thread_id(ULINT_UNDEFINED)
- {
- /* No op */
- }
-
- /** Create the context for SyncDebug
- @param[in] id ID of the latch to track */
- Context(latch_id_t id)
- :
- latch_t(id)
- {
- ut_ad(id != LATCH_ID_NONE);
- }
-
- /** Set to locked state
- @param[in] mutex The mutex to acquire
- @param[in] filename File name from where to acquire
- @param[in] line Line number in filename */
- void locked(
- const Mutex* mutex,
- const char* filename,
- unsigned line)
- UNIV_NOTHROW
- {
- m_mutex = mutex;
-
- my_atomic_storelint(&m_thread_id,
- ulint(os_thread_get_curr_id()));
-
- m_filename = filename;
-
- m_line = line;
- }
-
- /** Reset to unlock state */
- void release()
- UNIV_NOTHROW
- {
- m_mutex = NULL;
-
- my_atomic_storelint(&m_thread_id, ULINT_UNDEFINED);
-
- m_filename = NULL;
-
- m_line = 0;
- }
-
- /** Print information about the latch
- @return the string representation */
- virtual std::string to_string() const
- UNIV_NOTHROW
- {
- std::ostringstream msg;
-
- msg << m_mutex->policy().to_string();
-
- if (m_thread_id != ULINT_UNDEFINED) {
-
- msg << " addr: " << m_mutex
- << " acquired: " << locked_from().c_str();
-
- } else {
- msg << "Not locked";
- }
-
- return(msg.str());
- }
-
- /** @return the name of the file and line number in the file
- from where the mutex was acquired "filename:line" */
- virtual std::string locked_from() const
- {
- std::ostringstream msg;
-
- msg << sync_basename(m_filename) << ":" << m_line;
-
- return(std::string(msg.str()));
- }
-
- /** Mutex to check for lock order violation */
- const Mutex* m_mutex;
-
- /** Filename from where enter was called */
- const char* m_filename;
-
- /** Line mumber in filename */
- unsigned m_line;
-
- /** Thread ID of the thread that own(ed) the mutex */
- ulint m_thread_id;
- };
-
- /** Constructor. */
- MutexDebug()
- :
- m_magic_n(),
- m_context()
- UNIV_NOTHROW
- {
- /* No op */
- }
-
- /* Destructor */
- virtual ~MutexDebug() { }
-
- /** Mutex is being destroyed. */
- void destroy() UNIV_NOTHROW
- {
- ut_ad((ulint)my_atomic_loadlint(&m_context.m_thread_id) == ULINT_UNDEFINED);
-
- m_magic_n = 0;
-
- m_context.m_thread_id = 0;
- }
-
- /** Called when the mutex is "created". Note: Not from the constructor
- but when the mutex is initialised.
- @param[in] id Mutex ID */
- void init(latch_id_t id) UNIV_NOTHROW;
-
- /** Called when an attempt is made to lock the mutex
- @param[in] mutex Mutex instance to be locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called */
- void enter(
- const Mutex* mutex,
- const char* filename,
- unsigned line)
- UNIV_NOTHROW;
-
- /** Called when the mutex is locked
- @param[in] mutex Mutex instance that was locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called */
- void locked(
- const Mutex* mutex,
- const char* filename,
- unsigned line)
- UNIV_NOTHROW;
-
- /** Called when the mutex is released
- @param[in] mutx Mutex that was released */
- void release(const Mutex* mutex)
- UNIV_NOTHROW;
-
- /** @return true if thread owns the mutex */
- bool is_owned() const UNIV_NOTHROW
- {
- return(os_thread_eq(
- (os_thread_id_t)my_atomic_loadlint(&m_context.m_thread_id),
- os_thread_get_curr_id()));
- }
-
- /** @return the name of the file from the mutex was acquired */
- const char* get_enter_filename() const
- UNIV_NOTHROW
- {
- return(m_context.m_filename);
- }
-
- /** @return the name of the file from the mutex was acquired */
- unsigned get_enter_line() const
- UNIV_NOTHROW
- {
- return(m_context.m_line);
- }
-
- /** @return id of the thread that was trying to acquire the mutex */
- os_thread_id_t get_thread_id() const
- UNIV_NOTHROW
- {
- return((os_thread_id_t)my_atomic_loadlint(&m_context.m_thread_id));
- }
+template <typename Mutex> class MutexDebug: public latch_t
+{
+ /** Mutex to check for lock order violation */
+ const Mutex *m_mutex;
+ /** Filename from where enter was called */
+ const char *m_filename;
+ /** Line mumber in filename */
+ unsigned m_line;
+ /** Thread ID of the thread that owns the mutex */
+ os_thread_id_t m_thread_id;
+ /** Mutex protecting the above members */
+ mutable OSMutex m_debug_mutex;
+
+
+ void set(const Mutex *mutex, const char *filename, unsigned line,
+ os_thread_id_t thread_id)
+ {
+ m_debug_mutex.enter();
+ m_mutex= mutex;
+ m_filename= filename;
+ m_line= line;
+ m_thread_id= thread_id;
+ m_debug_mutex.exit();
+ }
+
+
+ const MutexDebug get() const
+ {
+ MutexDebug ret;
+ m_debug_mutex.enter();
+ ret.m_mutex= m_mutex;
+ ret.m_filename= m_filename;
+ ret.m_line= m_line;
+ ret.m_thread_id= m_thread_id;
+ m_debug_mutex.exit();
+ return ret;
+ }
+
+
+ /**
+ Called either when mutex is locked or destroyed. Thus members are protected
+ from concurrent modification.
+ */
+ void assert_clean_context()
+ {
+ ut_ad(!m_mutex);
+ ut_ad(!m_filename);
+ ut_ad(!m_line);
+ ut_ad(m_thread_id == os_thread_id_t(ULINT_UNDEFINED));
+ }
- /** Magic number to check for memory corruption. */
- ulint m_magic_n;
- /** Latch state of the mutex owner */
- Context m_context;
+public:
+ /**
+ Called when the mutex is "created". Note: Not from the constructor
+ but when the mutex is initialised.
+ @param[in] id Mutex ID
+ */
+ void init(latch_id_t id)
+ {
+ ut_ad(id != LATCH_ID_NONE);
+ m_id= id;
+ m_debug_mutex.init();
+ set(0, 0, 0, os_thread_id_t(ULINT_UNDEFINED));
+ }
+
+
+ /** Mutex is being destroyed. */
+ void destroy()
+ {
+ assert_clean_context();
+ m_debug_mutex.destroy();
+ }
+
+
+ /**
+ Called when an attempt is made to lock the mutex
+ @param[in] mutex Mutex instance to be locked
+ @param[in] filename Filename from where it was called
+ @param[in] line Line number from where it was called
+ */
+ void enter(const Mutex &mutex, const char *filename, unsigned line)
+ {
+ MutexDebug context;
+ ut_ad(!is_owned());
+ context.init(m_id);
+ context.set(&mutex, filename, line, os_thread_get_curr_id());
+ /* Check for latch order violation. */
+ sync_check_lock_validate(&context);
+ context.set(0, 0, 0, os_thread_id_t(ULINT_UNDEFINED));
+ context.destroy();
+ }
+
+
+ /**
+ Called when the mutex is locked
+ @param[in] mutex Mutex instance that was locked
+ @param[in] filename Filename from where it was called
+ @param[in] line Line number from where it was called
+ */
+ void locked(const Mutex &mutex, const char *filename, unsigned line)
+ {
+ assert_clean_context();
+ set(&mutex, filename, line, os_thread_get_curr_id());
+ sync_check_lock_granted(this);
+ }
+
+
+ /**
+ Called when the mutex is released
+ @param[in] mutex Mutex that was released
+ */
+ void release(const Mutex &mutex)
+ {
+ ut_ad(is_owned());
+ set(0, 0, 0, os_thread_id_t(ULINT_UNDEFINED));
+ sync_check_unlock(this);
+ }
+
+
+ /** @return true if thread owns the mutex */
+ bool is_owned() const
+ {
+ return os_thread_eq(get_thread_id(), os_thread_get_curr_id());
+ }
+
+
+ /** @return the name of the file from the mutex was acquired */
+ const char* get_enter_filename() const { return get().m_filename; }
+
+
+ /** @return the name of the file from the mutex was acquired */
+ unsigned get_enter_line() const { return get().m_line; }
+
+
+ /** @return id of the thread that was trying to acquire the mutex */
+ os_thread_id_t get_thread_id() const { return get().m_thread_id; }
+
+
+ /**
+ Print information about the latch
+ @return the string representation
+ */
+ virtual std::string to_string() const
+ {
+ std::ostringstream msg;
+ const MutexDebug ctx= get();
+
+ msg << m_mutex->policy().to_string();
+ if (ctx.m_mutex)
+ msg << " addr: " << ctx.m_mutex << " acquired: "
+ << sync_basename(ctx.get_enter_filename()) << ":"
+ << ctx.get_enter_line();
+ else
+ msg << "Not locked";
+
+ return(msg.str());
+ }
};
#endif /* UNIV_DEBUG */
-/* Do nothing */
-template <typename Mutex>
-struct NoPolicy {
- /** Default constructor. */
- NoPolicy() { }
-
- void init(const Mutex&, latch_id_t, const char*, uint32_t)
- UNIV_NOTHROW { }
- void destroy() UNIV_NOTHROW { }
- void enter(const Mutex&, const char*, unsigned) UNIV_NOTHROW { }
- void add(uint32_t, uint32_t) UNIV_NOTHROW { }
- void locked(const Mutex&, const char*, ulint) UNIV_NOTHROW { }
- void release(const Mutex&) UNIV_NOTHROW { }
- std::string to_string() const { return(""); };
- latch_id_t get_id() const;
-};
-
/** Collect the metrics per mutex instance, no aggregation. */
template <typename Mutex>
struct GenericPolicy
-#ifdef UNIV_DEBUG
-: public MutexDebug<Mutex>
-#endif /* UNIV_DEBUG */
{
public:
- typedef Mutex MutexType;
-
- /** Constructor. */
- GenericPolicy()
- UNIV_NOTHROW
- :
-#ifdef UNIV_DEBUG
- MutexDebug<MutexType>(),
-#endif /* UNIV_DEBUG */
- m_count(),
- m_id()
- { }
-
- /** Destructor */
- ~GenericPolicy() { }
-
/** Called when the mutex is "created". Note: Not from the constructor
but when the mutex is initialised.
@param[in] id Mutex ID
@@ -294,8 +221,6 @@ public:
meta.get_counter()->single_register(&m_count);
sync_file_created_register(this, filename, uint16_t(line));
-
- ut_d(MutexDebug<MutexType>::init(m_id));
}
/** Called when the mutex is destroyed. */
@@ -307,8 +232,6 @@ public:
meta.get_counter()->single_deregister(&m_count);
sync_file_created_deregister(this);
-
- ut_d(MutexDebug<MutexType>::destroy());
}
/** Called after a successful mutex acquire.
@@ -334,40 +257,6 @@ public:
++m_count.m_calls;
}
- /** Called when an attempt is made to lock the mutex
- @param[in] mutex Mutex instance to be locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called */
- void enter(
- const MutexType& mutex,
- const char* filename,
- unsigned line)
- UNIV_NOTHROW
- {
- ut_d(MutexDebug<MutexType>::enter(&mutex, filename, line));
- }
-
- /** Called when the mutex is locked
- @param[in] mutex Mutex instance that is locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called */
- void locked(
- const MutexType& mutex,
- const char* filename,
- unsigned line)
- UNIV_NOTHROW
- {
- ut_d(MutexDebug<MutexType>::locked(&mutex, filename, line));
- }
-
- /** Called when the mutex is released
- @param[in] mutex Mutex instance that is released */
- void release(const MutexType& mutex)
- UNIV_NOTHROW
- {
- ut_d(MutexDebug<MutexType>::release(&mutex));
- }
-
/** Print the information about the latch
@return the string representation */
std::string print() const
@@ -380,14 +269,18 @@ public:
return(m_id);
}
- /** @return the string representation */
- std::string to_string() const;
-private:
- typedef latch_meta_t::CounterType Counter;
+ /** @return the string representation */
+ std::string to_string() const
+ { return sync_mutex_to_string(get_id(), sync_file_created_get(this)); }
- /** The user visible counters, registered with the meta-data. */
- Counter::Count m_count;
+#ifdef UNIV_DEBUG
+ MutexDebug<Mutex> context;
+#endif
+
+private:
+ /** The user visible counters, registered with the meta-data. */
+ latch_meta_t::CounterType::Count m_count;
/** Latch meta data ID */
latch_id_t m_id;
@@ -397,29 +290,8 @@ private:
too many of them to count individually. */
template <typename Mutex>
class BlockMutexPolicy
-#ifdef UNIV_DEBUG
-: public MutexDebug<Mutex>
-#endif /* UNIV_DEBUG */
{
public:
- typedef Mutex MutexType;
- typedef typename latch_meta_t::CounterType::Count Count;
-
- /** Default constructor. */
- BlockMutexPolicy()
- :
-#ifdef UNIV_DEBUG
- MutexDebug<MutexType>(),
-#endif /* UNIV_DEBUG */
- m_count(),
- m_id()
- {
- /* Do nothing */
- }
-
- /** Destructor */
- ~BlockMutexPolicy() { }
-
/** Called when the mutex is "created". Note: Not from the constructor
but when the mutex is initialised.
@param[in] id Mutex ID */
@@ -438,8 +310,6 @@ public:
ut_ad(meta.get_id() == id);
m_count = meta.get_counter()->sum_register();
-
- ut_d(MutexDebug<MutexType>::init(m_id));
}
/** Called when the mutex is destroyed. */
@@ -447,7 +317,6 @@ public:
UNIV_NOTHROW
{
m_count = NULL;
- ut_d(MutexDebug<MutexType>::destroy());
}
/** Called after a successful mutex acquire.
@@ -471,40 +340,6 @@ public:
++m_count->m_calls;
}
- /** Called when the mutex is locked
- @param[in] mutex Mutex instance that is locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called */
- void locked(
- const MutexType& mutex,
- const char* filename,
- unsigned line)
- UNIV_NOTHROW
- {
- ut_d(MutexDebug<MutexType>::locked(&mutex, filename, line));
- }
-
- /** Called when the mutex is released
- @param[in] mutex Mutex instance that is released */
- void release(const MutexType& mutex)
- UNIV_NOTHROW
- {
- ut_d(MutexDebug<MutexType>::release(&mutex));
- }
-
- /** Called when an attempt is made to lock the mutex
- @param[in] mutex Mutex instance to be locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called */
- void enter(
- const MutexType& mutex,
- const char* filename,
- unsigned line)
- UNIV_NOTHROW
- {
- ut_d(MutexDebug<MutexType>::enter(&mutex, filename, line));
- }
-
/** Print the information about the latch
@return the string representation */
std::string print() const
@@ -516,19 +351,26 @@ public:
return(m_id);
}
- /** @return the string representation */
- std::string to_string() const;
-private:
- typedef latch_meta_t::CounterType Counter;
+ /**
+ I don't think it makes sense to keep track of the file name
+ and line number for each block mutex. Too much of overhead. Use the
+ latch id to figure out the location from the source.
+
+ @return the string representation
+ */
+ std::string to_string() const
+ { return(sync_mutex_to_string(get_id(), "buf0buf.cc:0")); }
+
+#ifdef UNIV_DEBUG
+ MutexDebug<Mutex> context;
+#endif
- /** The user visible counters, registered with the meta-data. */
- Counter::Count* m_count;
+private:
+ /** The user visible counters, registered with the meta-data. */
+ latch_meta_t::CounterType::Count *m_count;
/** Latch meta data ID */
latch_id_t m_id;
};
-
-#include "sync0policy.ic"
-
#endif /* sync0policy_h */
diff --git a/storage/innobase/include/sync0policy.ic b/storage/innobase/include/sync0policy.ic
deleted file mode 100644
index a28e3c382b4..00000000000
--- a/storage/innobase/include/sync0policy.ic
+++ /dev/null
@@ -1,101 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-*****************************************************************************/
-
-/******************************************************************//**
-@file include/sync0policy.ic
-Policy for mutexes.
-
-Created 2012-08-21 Sunny Bains.
-***********************************************************************/
-
-#include "sync0debug.h"
-
-template <typename Mutex>
-std::string GenericPolicy<Mutex>::to_string() const
-{
- return(sync_mutex_to_string(get_id(), sync_file_created_get(this)));
-}
-
-template <typename Mutex>
-std::string BlockMutexPolicy<Mutex>::to_string() const
-{
- /* I don't think it makes sense to keep track of the file name
- and line number for each block mutex. Too much of overhead. Use the
- latch id to figure out the location from the source. */
- return(sync_mutex_to_string(get_id(), "buf0buf.cc:0"));
-}
-
-#ifdef UNIV_DEBUG
-
-template <typename Mutex>
-void MutexDebug<Mutex>::init(latch_id_t id)
- UNIV_NOTHROW
-{
- m_context.m_id = id;
-
- m_context.release();
-
- m_magic_n = MUTEX_MAGIC_N;
-}
-
-template <typename Mutex>
-void MutexDebug<Mutex>::enter(
- const Mutex* mutex,
- const char* name,
- unsigned line)
- UNIV_NOTHROW
-{
- ut_ad(!is_owned());
-
- Context context(m_context.get_id());
-
- context.locked(mutex, name, line);
-
- /* Check for latch order violation. */
-
- sync_check_lock_validate(&context);
-}
-
-template <typename Mutex>
-void MutexDebug<Mutex>::locked(
- const Mutex* mutex,
- const char* name,
- unsigned line)
- UNIV_NOTHROW
-{
- ut_ad(!is_owned());
- ut_ad(m_context.m_thread_id == ULINT_UNDEFINED);
-
- m_context.locked(mutex, name, line);
-
- sync_check_lock_granted(&m_context);
-}
-
-template <typename Mutex>
-void MutexDebug<Mutex>::release(const Mutex*)
- UNIV_NOTHROW
-{
- ut_ad(is_owned());
-
- m_context.release();
-
- sync_check_unlock(&m_context);
-}
-
-#endif /* UNIV_DEBUG */
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index b61553fc380..4f23e81185c 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -34,8 +34,6 @@ Created 9/11/1995 Heikki Tuuri
#ifndef sync0rw_h
#define sync0rw_h
-#include "univ.i"
-#include "ut0counter.h"
#include "os0event.h"
#include "ut0mutex.h"
@@ -571,10 +569,10 @@ struct rw_lock_t
#endif /* UNIV_DEBUG */
{
/** Holds the state of the lock. */
- int32_t lock_word;
+ std::atomic<int32_t> lock_word;
/** 1: there are waiters */
- int32_t waiters;
+ std::atomic<int32_t> waiters;
/** number of granted SX locks. */
volatile ulint sx_recursive;
@@ -644,7 +642,6 @@ struct rw_lock_t
}
virtual std::string to_string() const;
- virtual std::string locked_from() const;
/** For checking memory corruption. */
ulint magic_n;
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index f0c33ecbeda..3add168edc8 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -77,8 +77,7 @@ rw_lock_get_writer(
/*===============*/
const rw_lock_t* lock) /*!< in: rw-lock */
{
- int32_t lock_word = my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word),
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_word = lock->lock_word.load(std::memory_order_relaxed);
ut_ad(lock_word <= X_LOCK_DECR);
if (lock_word > X_LOCK_HALF_DECR) {
@@ -110,8 +109,7 @@ rw_lock_get_reader_count(
/*=====================*/
const rw_lock_t* lock) /*!< in: rw-lock */
{
- int32_t lock_word = my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word),
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_word = lock->lock_word.load(std::memory_order_relaxed);
ut_ad(lock_word <= X_LOCK_DECR);
if (lock_word > X_LOCK_HALF_DECR) {
@@ -147,8 +145,7 @@ rw_lock_get_x_lock_count(
/*=====================*/
const rw_lock_t* lock) /*!< in: rw-lock */
{
- int32_t lock_copy = my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word),
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_copy = lock->lock_word.load(std::memory_order_relaxed);
ut_ad(lock_copy <= X_LOCK_DECR);
if (lock_copy == 0 || lock_copy == -X_LOCK_HALF_DECR) {
@@ -181,8 +178,7 @@ rw_lock_get_sx_lock_count(
const rw_lock_t* lock) /*!< in: rw-lock */
{
#ifdef UNIV_DEBUG
- int32_t lock_copy = my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word),
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_copy = lock->lock_word.load(std::memory_order_relaxed);
ut_ad(lock_copy <= X_LOCK_DECR);
@@ -213,14 +209,15 @@ rw_lock_lock_word_decr(
int32_t amount, /*!< in: amount to decrement */
int32_t threshold) /*!< in: threshold of judgement */
{
- int32_t lock_copy = my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_copy = lock->lock_word.load(std::memory_order_relaxed);
+
while (lock_copy > threshold) {
- if (my_atomic_cas32_strong_explicit(&lock->lock_word,
- &lock_copy,
- lock_copy - amount,
- MY_MEMORY_ORDER_ACQUIRE,
- MY_MEMORY_ORDER_RELAXED)) {
+ if (lock->lock_word.compare_exchange_strong(
+ lock_copy,
+ lock_copy - amount,
+ std::memory_order_acquire,
+ std::memory_order_relaxed)) {
+
return(true);
}
}
@@ -304,9 +301,9 @@ rw_lock_x_lock_func_nowait(
{
int32_t oldval = X_LOCK_DECR;
- if (my_atomic_cas32_strong_explicit(&lock->lock_word, &oldval, 0,
- MY_MEMORY_ORDER_ACQUIRE,
- MY_MEMORY_ORDER_RELAXED)) {
+ if (lock->lock_word.compare_exchange_strong(oldval, 0,
+ std::memory_order_acquire,
+ std::memory_order_relaxed)) {
lock->writer_thread = os_thread_get_curr_id();
} else if (os_thread_eq(lock->writer_thread, os_thread_get_curr_id())) {
@@ -316,12 +313,12 @@ rw_lock_x_lock_func_nowait(
observe consistent values. */
if (oldval == 0 || oldval == -X_LOCK_HALF_DECR) {
/* There are 1 x-locks */
- my_atomic_add32_explicit(&lock->lock_word, -X_LOCK_DECR,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_sub(X_LOCK_DECR,
+ std::memory_order_relaxed);
} else if (oldval <= -X_LOCK_DECR) {
/* There are 2 or more x-locks */
- my_atomic_add32_explicit(&lock->lock_word, -1,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_sub(1,
+ std::memory_order_relaxed);
/* Watch for too many recursive locks */
ut_ad(oldval < 1);
} else {
@@ -356,8 +353,7 @@ rw_lock_s_unlock_func(
rw_lock_t* lock) /*!< in/out: rw-lock */
{
#ifdef UNIV_DEBUG
- int32_t dbg_lock_word = my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED);
+ auto dbg_lock_word = lock->lock_word.load(std::memory_order_relaxed);
ut_ad(dbg_lock_word > -X_LOCK_DECR);
ut_ad(dbg_lock_word != 0);
ut_ad(dbg_lock_word < X_LOCK_DECR);
@@ -366,8 +362,8 @@ rw_lock_s_unlock_func(
ut_d(rw_lock_remove_debug_info(lock, pass, RW_LOCK_S));
/* Increment lock_word to indicate 1 less reader */
- int32_t lock_word = my_atomic_add32_explicit(&lock->lock_word, 1,
- MY_MEMORY_ORDER_RELEASE) + 1;
+ auto lock_word = lock->lock_word.fetch_add(
+ 1, std::memory_order_release) + 1;
if (lock_word == 0 || lock_word == -X_LOCK_HALF_DECR) {
/* wait_ex waiter exists. It may not be asleep, but we signal
@@ -393,8 +389,7 @@ rw_lock_x_unlock_func(
#endif /* UNIV_DEBUG */
rw_lock_t* lock) /*!< in/out: rw-lock */
{
- int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_word = lock->lock_word.load(std::memory_order_relaxed);
ut_ad(lock_word == 0 || lock_word == -X_LOCK_HALF_DECR
|| lock_word <= -X_LOCK_DECR);
@@ -411,31 +406,29 @@ rw_lock_x_unlock_func(
ACQ_REL due to...
RELEASE: we release rw-lock
ACQUIRE: we want waiters to be loaded after lock_word is stored */
- my_atomic_add32_explicit(&lock->lock_word, X_LOCK_DECR,
- MY_MEMORY_ORDER_ACQ_REL);
+ lock->lock_word.fetch_add(X_LOCK_DECR,
+ std::memory_order_acq_rel);
/* This no longer has an X-lock but it may still have
an SX-lock. So it is now free for S-locks by other threads.
We need to signal read/write waiters.
We do not need to signal wait_ex waiters, since they cannot
exist when there is a writer. */
- if (my_atomic_load32_explicit(&lock->waiters,
- MY_MEMORY_ORDER_RELAXED)) {
- my_atomic_store32_explicit(&lock->waiters, 0,
- MY_MEMORY_ORDER_RELAXED);
+ if (lock->waiters.load(std::memory_order_relaxed)) {
+ lock->waiters.store(0, std::memory_order_relaxed);
os_event_set(lock->event);
sync_array_object_signalled();
}
} else if (lock_word == -X_LOCK_DECR
|| lock_word == -(X_LOCK_DECR + X_LOCK_HALF_DECR)) {
/* There are 2 x-locks */
- my_atomic_add32_explicit(&lock->lock_word, X_LOCK_DECR,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_add(X_LOCK_DECR,
+ std::memory_order_relaxed);
} else {
/* There are more than 2 x-locks. */
ut_ad(lock_word < -X_LOCK_DECR);
- my_atomic_add32_explicit(&lock->lock_word, 1,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_add(1,
+ std::memory_order_relaxed);
}
ut_ad(rw_lock_validate(lock));
@@ -461,8 +454,8 @@ rw_lock_sx_unlock_func(
ut_d(rw_lock_remove_debug_info(lock, pass, RW_LOCK_SX));
if (lock->sx_recursive == 0) {
- int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_word =
+ lock->lock_word.load(std::memory_order_relaxed);
/* Last caller in a possible recursive chain. */
if (lock_word > 0) {
lock->writer_thread = 0;
@@ -472,17 +465,15 @@ rw_lock_sx_unlock_func(
ACQ_REL due to...
RELEASE: we release rw-lock
ACQUIRE: we want waiters to be loaded after lock_word is stored */
- my_atomic_add32_explicit(&lock->lock_word, X_LOCK_HALF_DECR,
- MY_MEMORY_ORDER_ACQ_REL);
+ lock->lock_word.fetch_add(X_LOCK_HALF_DECR,
+ std::memory_order_acq_rel);
/* Lock is now free. May have to signal read/write
waiters. We do not need to signal wait_ex waiters,
since they cannot exist when there is an sx-lock
holder. */
- if (my_atomic_load32_explicit(&lock->waiters,
- MY_MEMORY_ORDER_RELAXED)) {
- my_atomic_store32_explicit(&lock->waiters, 0,
- MY_MEMORY_ORDER_RELAXED);
+ if (lock->waiters.load(std::memory_order_relaxed)) {
+ lock->waiters.store(0, std::memory_order_relaxed);
os_event_set(lock->event);
sync_array_object_signalled();
}
@@ -490,8 +481,8 @@ rw_lock_sx_unlock_func(
/* still has x-lock */
ut_ad(lock_word == -X_LOCK_HALF_DECR ||
lock_word <= -(X_LOCK_DECR + X_LOCK_HALF_DECR));
- my_atomic_add32_explicit(&lock->lock_word, X_LOCK_HALF_DECR,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_add(X_LOCK_HALF_DECR,
+ std::memory_order_relaxed);
}
}
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index ffa682b46db..5af2cbfe6c5 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -35,7 +35,6 @@ Created 9/5/1995 Heikki Tuuri
#define sync0sync_h
#include "univ.i"
-#include "ut0counter.h"
#if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index 773c610d30e..5fa7691e771 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -28,11 +28,9 @@ Created 9/5/1995 Heikki Tuuri
#define sync0types_h
#include <vector>
-#include <iostream>
#include <my_atomic.h>
#include "ut0new.h"
-#include "ut0counter.h"
#ifdef _WIN32
/** Native mutex */
@@ -1001,9 +999,6 @@ struct latch_t {
@return the string representation */
virtual std::string to_string() const = 0;
- /** @return "filename:line" from where the latch was last locked */
- virtual std::string locked_from() const = 0;
-
/** @return the latch level */
latch_level_t get_level() const
UNIV_NOTHROW
@@ -1119,51 +1114,6 @@ enum rw_lock_flag_t {
#endif /* UNIV_INNOCHECKSUM */
-static inline ulint my_atomic_addlint(ulint *A, ulint B)
-{
-#ifdef _WIN64
- return ulint(my_atomic_add64((volatile int64*)A, B));
-#else
- return ulint(my_atomic_addlong(A, B));
-#endif
-}
-
-static inline ulint my_atomic_loadlint(const ulint *A)
-{
-#ifdef _WIN64
- return ulint(my_atomic_load64((volatile int64*)A));
-#else
- return ulint(my_atomic_loadlong(A));
-#endif
-}
-
-static inline lint my_atomic_addlint(volatile lint *A, lint B)
-{
-#ifdef _WIN64
- return my_atomic_add64((volatile int64*)A, B);
-#else
- return my_atomic_addlong(A, B);
-#endif
-}
-
-static inline lint my_atomic_loadlint(const lint *A)
-{
-#ifdef _WIN64
- return lint(my_atomic_load64((volatile int64*)A));
-#else
- return my_atomic_loadlong(A);
-#endif
-}
-
-static inline void my_atomic_storelint(ulint *A, ulint B)
-{
-#ifdef _WIN64
- my_atomic_store64((volatile int64*)A, B);
-#else
- my_atomic_storelong(A, B);
-#endif
-}
-
/** Simple non-atomic counter aligned to CACHE_LINE_SIZE
@tparam Type the integer type of the counter */
template <typename Type>
@@ -1186,28 +1136,4 @@ private:
/** The counter */
Type m_counter;
};
-
-/** Simple atomic counter aligned to CACHE_LINE_SIZE
-@tparam Type lint or ulint */
-template <typename Type = ulint>
-struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) simple_atomic_counter
-{
- /** Increment the counter */
- Type inc() { return add(1); }
- /** Decrement the counter */
- Type dec() { return add(Type(~0)); }
-
- /** Add to the counter
- @param[in] i amount to be added
- @return the value of the counter before adding */
- Type add(Type i) { return my_atomic_addlint(&m_counter, i); }
-
- /** @return the value of the counter (non-atomic access)! */
- operator Type() const { return m_counter; }
-
-private:
- /** The counter */
- Type m_counter;
-};
-
#endif /* sync0types_h */
diff --git a/storage/innobase/include/trx0i_s.h b/storage/innobase/include/trx0i_s.h
index ee7da7b74dc..b1145f33586 100644
--- a/storage/innobase/include/trx0i_s.h
+++ b/storage/innobase/include/trx0i_s.h
@@ -29,7 +29,6 @@ Created July 17, 2007 Vasil Dimov
#ifndef trx0i_s_h
#define trx0i_s_h
-#include "univ.i"
#include "trx0types.h"
#include "dict0types.h"
diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h
index b2f1797b706..2299a648a88 100644
--- a/storage/innobase/include/trx0purge.h
+++ b/storage/innobase/include/trx0purge.h
@@ -30,6 +30,8 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0rseg.h"
#include "que0types.h"
+#include <queue>
+
/** A dummy undo record used as a return value when we have a whole undo log
which needs no purge */
extern trx_undo_rec_t trx_purge_dummy_rec;
@@ -145,22 +147,19 @@ public:
MY_ALIGNED(CACHE_LINE_SIZE)
rw_lock_t latch;
private:
- /** whether purge is enabled; protected by latch and my_atomic */
- int32_t m_enabled;
+ /** whether purge is enabled; protected by latch and std::atomic */
+ std::atomic<bool> m_enabled;
/** number of pending stop() calls without resume() */
- int32_t m_paused;
+ Atomic_counter<int32_t> m_paused;
public:
que_t* query; /*!< The query graph which will do the
parallelized purge operation */
MY_ALIGNED(CACHE_LINE_SIZE)
ReadView view; /*!< The purge will not remove undo logs
which are >= this view (purge view) */
- /** Total number of tasks submitted by srv_purge_coordinator_thread.
- Not accessed by other threads. */
- ulint n_submitted;
- /** Number of completed tasks. Accessed by srv_purge_coordinator
- and srv_worker_thread by my_atomic. */
- ulint n_completed;
+ /** Number of not completed tasks. Accessed by srv_purge_coordinator
+ and srv_worker_thread by std::atomic. */
+ std::atomic<ulint> n_tasks;
/** Iterator to the undo log records of committed transactions */
struct iterator
@@ -230,7 +229,7 @@ public:
uninitialised. Real initialisation happens in create().
*/
- purge_sys_t() : event(NULL), m_enabled(false) {}
+ purge_sys_t() : event(NULL), m_enabled(false), n_tasks(0) {}
/** Create the instance */
@@ -240,39 +239,24 @@ public:
void close();
/** @return whether purge is enabled */
- bool enabled()
- {
- return my_atomic_load32_explicit(&m_enabled, MY_MEMORY_ORDER_RELAXED);
- }
- /** @return whether purge is enabled */
- bool enabled_latched()
- {
- ut_ad(rw_lock_own_flagged(&latch, RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
- return bool(m_enabled);
- }
+ bool enabled() { return m_enabled.load(std::memory_order_relaxed); }
/** @return whether the purge coordinator is paused */
bool paused()
- { return my_atomic_load32_explicit(&m_paused, MY_MEMORY_ORDER_RELAXED); }
- /** @return whether the purge coordinator is paused */
- bool paused_latched()
- {
- ut_ad(rw_lock_own_flagged(&latch, RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
- return m_paused != 0;
- }
+ { return m_paused != 0; }
/** Enable purge at startup. Not protected by latch; the main thread
will wait for purge_sys.enabled() in srv_start() */
void coordinator_startup()
{
ut_ad(!enabled());
- my_atomic_store32_explicit(&m_enabled, true, MY_MEMORY_ORDER_RELAXED);
+ m_enabled.store(true, std::memory_order_relaxed);
}
/** Disable purge at shutdown */
void coordinator_shutdown()
{
ut_ad(enabled());
- my_atomic_store32_explicit(&m_enabled, false, MY_MEMORY_ORDER_RELAXED);
+ m_enabled.store(false, std::memory_order_relaxed);
}
/** @return whether the purge coordinator thread is active */
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index 776757b32ec..bf8835f189f 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -27,12 +27,9 @@ Created 3/26/1996 Heikki Tuuri
#ifndef trx0rec_h
#define trx0rec_h
-#include "univ.i"
#include "trx0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
-#include "dict0types.h"
-#include "data0data.h"
#include "rem0types.h"
#include "page0types.h"
#include "row0log.h"
diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h
index af5ed73f04b..93432cde74e 100644
--- a/storage/innobase/include/trx0roll.h
+++ b/storage/innobase/include/trx0roll.h
@@ -27,9 +27,7 @@ Created 3/26/1996 Heikki Tuuri
#ifndef trx0roll_h
#define trx0roll_h
-#include "univ.i"
#include "trx0trx.h"
-#include "trx0types.h"
#include "mtr0mtr.h"
#include "trx0sys.h"
@@ -53,16 +51,6 @@ trx_savept_take(
/*============*/
trx_t* trx); /*!< in: transaction */
-/** Get the last undo log record of a transaction (for rollback).
-@param[in,out] trx transaction
-@param[out] roll_ptr DB_ROLL_PTR to the undo record
-@param[in,out] heap memory heap for allocation
-@return undo log record copied to heap
-@retval NULL if none left or the roll_limit (savepoint) was reached */
-trx_undo_rec_t*
-trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap)
- MY_ATTRIBUTE((nonnull, warn_unused_result));
-
/** Report progress when rolling back a row of a recovered transaction. */
void trx_roll_report_progress();
/*******************************************************************//**
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index f7e6d01c9bc..92f24d036ae 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -27,8 +27,6 @@ Created 3/26/1996 Heikki Tuuri
#ifndef trx0sys_h
#define trx0sys_h
-#include "univ.i"
-
#include "buf0buf.h"
#include "fil0fil.h"
#include "trx0types.h"
@@ -371,7 +369,7 @@ struct rw_trx_hash_element_t
trx_id_t id; /* lf_hash_init() relies on this to be first in the struct */
- trx_id_t no;
+ Atomic_counter<trx_id_t> no;
trx_t *trx;
ib_mutex_t mutex;
};
@@ -706,11 +704,7 @@ public:
because it may change even before this method returns.
*/
- uint32_t size()
- {
- return uint32_t(my_atomic_load32_explicit(&hash.count,
- MY_MEMORY_ORDER_RELAXED));
- }
+ uint32_t size() { return uint32_t(lf_hash_size(&hash)); }
/**
@@ -792,7 +786,7 @@ class trx_sys_t
The smallest number not yet assigned as a transaction id or transaction
number. Accessed and updated with atomic operations.
*/
- MY_ALIGNED(CACHE_LINE_SIZE) trx_id_t m_max_trx_id;
+ MY_ALIGNED(CACHE_LINE_SIZE) Atomic_counter<trx_id_t> m_max_trx_id;
/**
@@ -803,17 +797,17 @@ class trx_sys_t
@sa assign_new_trx_no()
@sa snapshot_ids()
*/
- MY_ALIGNED(CACHE_LINE_SIZE) trx_id_t m_rw_trx_hash_version;
+ MY_ALIGNED(CACHE_LINE_SIZE) std::atomic<trx_id_t> m_rw_trx_hash_version;
+ bool m_initialised;
+
+public:
/**
TRX_RSEG_HISTORY list length (number of committed transactions to purge)
*/
- MY_ALIGNED(CACHE_LINE_SIZE) int32 rseg_history_len;
-
- bool m_initialised;
+ MY_ALIGNED(CACHE_LINE_SIZE) Atomic_counter<uint32_t> rseg_history_len;
-public:
/** Mutex protecting trx_list. */
MY_ALIGNED(CACHE_LINE_SIZE) mutable TrxSysMutex mutex;
@@ -889,9 +883,7 @@ public:
trx_id_t get_max_trx_id()
{
- return static_cast<trx_id_t>
- (my_atomic_load64_explicit(reinterpret_cast<int64*>(&m_max_trx_id),
- MY_MEMORY_ORDER_RELAXED));
+ return m_max_trx_id;
}
@@ -933,9 +925,7 @@ public:
void assign_new_trx_no(trx_t *trx)
{
trx->no= get_new_trx_id_no_refresh();
- my_atomic_store64_explicit(reinterpret_cast<int64*>
- (&trx->rw_trx_hash_element->no),
- trx->no, MY_MEMORY_ORDER_RELAXED);
+ trx->rw_trx_hash_element->no= trx->no;
refresh_rw_trx_hash_version();
}
@@ -986,7 +976,8 @@ public:
/** Initialiser for m_max_trx_id and m_rw_trx_hash_version. */
void init_max_trx_id(trx_id_t value)
{
- m_max_trx_id= m_rw_trx_hash_version= value;
+ m_max_trx_id= value;
+ m_rw_trx_hash_version.store(value, std::memory_order_relaxed);
}
@@ -1108,22 +1099,6 @@ public:
return count;
}
- /** @return number of committed transactions waiting for purge */
- ulint history_size() const
- {
- return uint32(my_atomic_load32(&const_cast<trx_sys_t*>(this)
- ->rseg_history_len));
- }
- /** Add to the TRX_RSEG_HISTORY length (on database startup). */
- void history_add(int32 len)
- {
- my_atomic_add32(&rseg_history_len, len);
- }
- /** Register a committed transaction. */
- void history_insert() { history_add(1); }
- /** Note that a committed transaction was purged. */
- void history_remove() { history_add(-1); }
-
private:
static my_bool get_min_trx_id_callback(rw_trx_hash_element_t *element,
trx_id_t *id)
@@ -1154,8 +1129,7 @@ private:
{
if (element->id < arg->m_id)
{
- trx_id_t no= static_cast<trx_id_t>(my_atomic_load64_explicit(
- reinterpret_cast<int64*>(&element->no), MY_MEMORY_ORDER_RELAXED));
+ trx_id_t no= element->no;
arg->m_ids->push_back(element->id);
if (no < arg->m_no)
arg->m_no= no;
@@ -1167,18 +1141,14 @@ private:
/** Getter for m_rw_trx_hash_version, must issue ACQUIRE memory barrier. */
trx_id_t get_rw_trx_hash_version()
{
- return static_cast<trx_id_t>
- (my_atomic_load64_explicit(reinterpret_cast<int64*>
- (&m_rw_trx_hash_version),
- MY_MEMORY_ORDER_ACQUIRE));
+ return m_rw_trx_hash_version.load(std::memory_order_acquire);
}
/** Increments m_rw_trx_hash_version, must issue RELEASE memory barrier. */
void refresh_rw_trx_hash_version()
{
- my_atomic_add64_explicit(reinterpret_cast<int64*>(&m_rw_trx_hash_version),
- 1, MY_MEMORY_ORDER_RELEASE);
+ m_rw_trx_hash_version.fetch_add(1, std::memory_order_release);
}
@@ -1197,8 +1167,7 @@ private:
trx_id_t get_new_trx_id_no_refresh()
{
- return static_cast<trx_id_t>(my_atomic_add64_explicit(
- reinterpret_cast<int64*>(&m_max_trx_id), 1, MY_MEMORY_ORDER_RELAXED));
+ return m_max_trx_id++;
}
};
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index cb878fa5b19..8bf64c28441 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -27,15 +27,8 @@ Created 3/26/1996 Heikki Tuuri
#ifndef trx0trx_h
#define trx0trx_h
-#include <set>
-
-#include "ha_prototypes.h"
-
-#include "dict0types.h"
#include "trx0types.h"
-
#include "lock0types.h"
-#include "log0log.h"
#include "que0types.h"
#include "mem0mem.h"
#include "trx0xa.h"
@@ -43,6 +36,9 @@ Created 3/26/1996 Heikki Tuuri
#include "fts0fts.h"
#include "read0types.h"
+#include <vector>
+#include <set>
+
// Forward declaration
struct mtr_t;
@@ -581,6 +577,11 @@ struct trx_lock_t {
lock_sys.mutex. Otherwise, this may
only be modified by the thread that is
serving the running transaction. */
+#ifdef WITH_WSREP
+ bool was_chosen_as_wsrep_victim;
+ /*!< high priority wsrep thread has
+ marked this trx to abort */
+#endif /* WITH_WSREP */
/** Pre-allocated record locks */
struct {
@@ -777,7 +778,7 @@ private:
that it is no longer "active".
*/
- int32_t n_ref;
+ Atomic_counter<int32_t> n_ref;
public:
@@ -1123,16 +1124,16 @@ public:
bool is_referenced()
{
- return my_atomic_load32_explicit(&n_ref, MY_MEMORY_ORDER_RELAXED) > 0;
+ return n_ref > 0;
}
void reference()
{
#ifdef UNIV_DEBUG
- int32_t old_n_ref=
+ auto old_n_ref=
#endif
- my_atomic_add32_explicit(&n_ref, 1, MY_MEMORY_ORDER_RELAXED);
+ n_ref++;
ut_ad(old_n_ref >= 0);
}
@@ -1140,9 +1141,9 @@ public:
void release_reference()
{
#ifdef UNIV_DEBUG
- int32_t old_n_ref=
+ auto old_n_ref=
#endif
- my_atomic_add32_explicit(&n_ref, -1, MY_MEMORY_ORDER_RELAXED);
+ n_ref--;
ut_ad(old_n_ref > 0);
}
diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h
index abc92a6edec..252d93796ee 100644
--- a/storage/innobase/include/trx0types.h
+++ b/storage/innobase/include/trx0types.h
@@ -29,9 +29,7 @@ Created 3/26/1996 Heikki Tuuri
#include "ut0byte.h"
#include "ut0mutex.h"
-#include "ut0new.h"
-#include <queue>
#include <vector>
/** printf(3) format used for printing DB_TRX_ID and other system fields */
diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h
index 60b0517db0d..f3c52fff7b5 100644
--- a/storage/innobase/include/trx0undo.h
+++ b/storage/innobase/include/trx0undo.h
@@ -79,27 +79,22 @@ trx_undo_trx_id_is_insert(
/*======================*/
const byte* trx_id) /*!< in: DB_TRX_ID, followed by DB_ROLL_PTR */
MY_ATTRIBUTE((warn_unused_result));
-/*****************************************************************//**
-Writes a roll ptr to an index page. In case that the size changes in
-some future version, this function should be used instead of
-mach_write_... */
-UNIV_INLINE
-void
-trx_write_roll_ptr(
-/*===============*/
- byte* ptr, /*!< in: pointer to memory where
- written */
- roll_ptr_t roll_ptr); /*!< in: roll ptr */
-/*****************************************************************//**
-Reads a roll ptr from an index page. In case that the roll ptr size
-changes in some future version, this function should be used instead of
-mach_read_...
+/** Write DB_ROLL_PTR.
+@param[out] ptr buffer
+@param[in] roll_ptr DB_ROLL_PTR value */
+inline void trx_write_roll_ptr(byte* ptr, roll_ptr_t roll_ptr)
+{
+ compile_time_assert(DATA_ROLL_PTR_LEN == 7);
+ mach_write_to_7(ptr, roll_ptr);
+}
+/** Read DB_ROLL_PTR.
+@param[in] ptr buffer
@return roll ptr */
-UNIV_INLINE
-roll_ptr_t
-trx_read_roll_ptr(
-/*==============*/
- const byte* ptr); /*!< in: pointer to memory from where to read */
+inline roll_ptr_t trx_read_roll_ptr(const byte* ptr)
+{
+ compile_time_assert(DATA_ROLL_PTR_LEN == 7);
+ return mach_read_from_7(ptr);
+}
/** Gets an undo log page and x-latches it.
@param[in] page_id page id
@@ -185,9 +180,7 @@ trx_undo_free_last_page(trx_undo_t* undo, mtr_t* mtr)
@param[in,out] undo undo log
@param[in] limit all undo logs after this limit will be discarded
@param[in] is_temp whether this is temporary undo log */
-void
-trx_undo_truncate_end(trx_undo_t* undo, undo_no_t limit, bool is_temp)
- MY_ATTRIBUTE((nonnull));
+void trx_undo_truncate_end(trx_undo_t& undo, undo_no_t limit, bool is_temp);
/** Truncate the head of an undo log.
NOTE that only whole pages are freed; the header page is not
diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic
index ac8af61be09..f6106ffddfa 100644
--- a/storage/innobase/include/trx0undo.ic
+++ b/storage/innobase/include/trx0undo.ic
@@ -103,37 +103,6 @@ trx_undo_trx_id_is_insert(
return bool(trx_id[DATA_TRX_ID_LEN] >> 7);
}
-/*****************************************************************//**
-Writes a roll ptr to an index page. In case that the size changes in
-some future version, this function should be used instead of
-mach_write_... */
-UNIV_INLINE
-void
-trx_write_roll_ptr(
-/*===============*/
- byte* ptr, /*!< in: pointer to memory where
- written */
- roll_ptr_t roll_ptr) /*!< in: roll ptr */
-{
- compile_time_assert(DATA_ROLL_PTR_LEN == 7);
- mach_write_to_7(ptr, roll_ptr);
-}
-
-/*****************************************************************//**
-Reads a roll ptr from an index page. In case that the roll ptr size
-changes in some future version, this function should be used instead of
-mach_read_...
-@return roll ptr */
-UNIV_INLINE
-roll_ptr_t
-trx_read_roll_ptr(
-/*==============*/
- const byte* ptr) /*!< in: pointer to memory from where to read */
-{
- compile_time_assert(DATA_ROLL_PTR_LEN == 7);
- return(mach_read_from_7(ptr));
-}
-
/** Gets an undo log page and x-latches it.
@param[in] page_id page id
@param[in,out] mtr mini-transaction
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index a3b50950393..503b6feab30 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -39,10 +39,6 @@ Created 1/20/1994 Heikki Tuuri
#define _IB_TO_STR(s) #s
#define IB_TO_STR(s) _IB_TO_STR(s)
-#define INNODB_VERSION_MAJOR 5
-#define INNODB_VERSION_MINOR 7
-#define INNODB_VERSION_BUGFIX 24
-
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
calculated in make_version_string() in sql/sql_show.cc like this:
@@ -83,6 +79,7 @@ used throughout InnoDB but do not include too much themselves. They
support cross-platform development and expose comonly used SQL names. */
#include <my_global.h>
+#include "my_counter.h"
/* JAN: TODO: missing 5.7 header */
#ifdef HAVE_MY_THREAD_H
@@ -590,12 +587,14 @@ typedef void* os_thread_ret_t;
#include "ut0ut.h"
#include "sync0types.h"
+#include <my_valgrind.h>
+/* define UNIV macros in terms of my_valgrind.h */
+#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size)
+#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size)
+#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size)
#ifdef UNIV_DEBUG_VALGRIND
# include <valgrind/memcheck.h>
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size)
-# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
-# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size)
-# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
# define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
@@ -630,9 +629,6 @@ typedef void* os_thread_ret_t;
} while (0)
#else
# define UNIV_MEM_VALID(addr, size) do {} while(0)
-# define UNIV_MEM_INVALID(addr, size) do {} while(0)
-# define UNIV_MEM_FREE(addr, size) do {} while(0)
-# define UNIV_MEM_ALLOC(addr, size) do {} while(0)
# define UNIV_MEM_DESC(addr, size) do {} while(0)
# define UNIV_MEM_UNDESC(b) do {} while(0)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)
diff --git a/storage/innobase/include/ut0counter.h b/storage/innobase/include/ut0counter.h
index e1a1d5614fe..1fc2c297e8d 100644
--- a/storage/innobase/include/ut0counter.h
+++ b/storage/innobase/include/ut0counter.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -28,10 +28,8 @@ Created 2012/04/12 by Sunny Bains
#ifndef ut0counter_h
#define ut0counter_h
-#include <my_rdtsc.h>
-#include "univ.i"
#include "os0thread.h"
-#include <atomic>
+#include "my_rdtsc.h"
/** CPU cache line size */
#ifdef CPU_LEVEL1_DCACHE_LINESIZE
@@ -108,14 +106,14 @@ struct ib_counter_t {
private:
/** Atomic which occupies whole CPU cache line */
- struct MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_element_t {
+ union ib_counter_element_t {
std::atomic<Type> value;
- byte padding[CACHE_LINE_SIZE - sizeof(value)];
+ byte padding[CACHE_LINE_SIZE];
};
static_assert(sizeof(ib_counter_element_t) == CACHE_LINE_SIZE, "");
/** Array of counter elements */
- ib_counter_element_t m_counter[N];
+ MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_element_t m_counter[N];
};
#endif /* ut0counter_h */
diff --git a/storage/innobase/include/ut0crc32.h b/storage/innobase/include/ut0crc32.h
index 32ad066f85a..8c04ae0dcc6 100644
--- a/storage/innobase/include/ut0crc32.h
+++ b/storage/innobase/include/ut0crc32.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -47,10 +47,6 @@ typedef uint32_t (*ut_crc32_func_t)(const byte* ptr, ulint len);
/** Pointer to CRC32 calculation function. */
extern ut_crc32_func_t ut_crc32;
-/** CRC32 calculation function, which uses big-endian byte order
-when converting byte strings to integers internally. */
-extern uint32_t ut_crc32_legacy_big_endian(const byte* buf, ulint len);
-
/** Text description of CRC32 implementation */
extern const char* ut_crc32_implementation;
diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h
index 6672be62617..0c8328449db 100644
--- a/storage/innobase/include/ut0dbg.h
+++ b/storage/innobase/include/ut0dbg.h
@@ -35,8 +35,6 @@ Created 1/30/1994 Heikki Tuuri
/* Do not include univ.i because univ.i includes this. */
-#include "os0thread.h"
-
/*************************************************************//**
Report a failed assertion. */
ATTRIBUTE_NORETURN ATTRIBUTE_COLD __attribute__((nonnull(2)))
diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h
index 9e94216f47b..c2c05767e07 100644
--- a/storage/innobase/include/ut0mem.h
+++ b/storage/innobase/include/ut0mem.h
@@ -26,7 +26,6 @@ Created 5/30/1994 Heikki Tuuri
#ifndef ut0mem_h
#define ut0mem_h
-#include "univ.i"
#include "os0event.h"
#include "ut0mutex.h"
diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h
index dc387dadbdc..3155151c73a 100644
--- a/storage/innobase/include/ut0mutex.h
+++ b/storage/innobase/include/ut0mutex.h
@@ -29,12 +29,8 @@ Created 2012-03-24 Sunny Bains.
#ifndef ut0mutex_h
#define ut0mutex_h
-extern uint srv_spin_wait_delay;
-extern ulong srv_n_spin_wait_rounds;
-
#include "sync0policy.h"
#include "ib0mutex.h"
-#include <set>
/** Create a typedef using the MutexType<PolicyType>
@param[in] M Mutex type
@@ -42,8 +38,6 @@ extern ulong srv_n_spin_wait_rounds;
@param[in] T The resulting typedef alias */
#define UT_MUTEX_TYPE(M, P, T) typedef PolicyMutex<M<P> > T;
-typedef OSMutex EventMutex;
-
# ifdef HAVE_IB_LINUX_FUTEX
UT_MUTEX_TYPE(TTASFutexMutex, GenericPolicy, FutexMutex);
UT_MUTEX_TYPE(TTASFutexMutex, BlockMutexPolicy, BlockFutexMutex);
diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h
index 5dcb25271c5..b79d03f1b0b 100644
--- a/storage/innobase/include/ut0new.h
+++ b/storage/innobase/include/ut0new.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -140,8 +140,6 @@ InnoDB:
#include "mysql/psi/psi_memory.h" /* PSI_memory_key, PSI_memory_info */
-#include "univ.i"
-
#include "os0proc.h" /* os_mem_alloc_large() */
#include "os0thread.h" /* os_thread_sleep() */
#include "ut0ut.h" /* ut_strcmp_functor, ut_basename_noext() */
diff --git a/storage/innobase/include/ut0rbt.h b/storage/innobase/include/ut0rbt.h
index 2fea7187a65..829c9363473 100644
--- a/storage/innobase/include/ut0rbt.h
+++ b/storage/innobase/include/ut0rbt.h
@@ -26,7 +26,6 @@ Created 2007-03-20 Sunny Bains
#define INNOBASE_UT0RBT_H
#if !defined(IB_RBT_TESTING)
-#include "univ.i"
#include "ut0mem.h"
#else
#include <stdio.h>
diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h
index 5baf8684d23..280ee772589 100644
--- a/storage/innobase/include/ut0rnd.h
+++ b/storage/innobase/include/ut0rnd.h
@@ -26,12 +26,9 @@ Created 1/20/1994 Heikki Tuuri
#ifndef ut0rnd_h
#define ut0rnd_h
-#include "univ.i"
-
-#ifndef UNIV_INNOCHECKSUM
-
#include "ut0byte.h"
+#ifndef UNIV_INNOCHECKSUM
/** The 'character code' for end of field or string (used
in folding records */
#define UT_END_OF_FIELD 257
diff --git a/storage/innobase/include/ut0sort.h b/storage/innobase/include/ut0sort.h
index 75648b5c317..5b132f2bfbd 100644
--- a/storage/innobase/include/ut0sort.h
+++ b/storage/innobase/include/ut0sort.h
@@ -26,8 +26,6 @@ Created 11/9/1995 Heikki Tuuri
#ifndef ut0sort_h
#define ut0sort_h
-#include "univ.i"
-
/* This module gives a macro definition of the body of
a standard sort function for an array of elements of any
type. The comparison function is given as a parameter to
diff --git a/storage/innobase/include/ut0stage.h b/storage/innobase/include/ut0stage.h
index 4b96fad3c21..e2e840afbc5 100644
--- a/storage/innobase/include/ut0stage.h
+++ b/storage/innobase/include/ut0stage.h
@@ -35,8 +35,6 @@ Created Nov 12, 2014 Vasil Dimov
#include "mysql/psi/mysql_stage.h" /* mysql_stage_inc_work_completed */
#include "mysql/psi/psi.h" /* HAVE_PSI_STAGE_INTERFACE, PSI_stage_progress */
-#include "univ.i"
-
#include "dict0mem.h" /* dict_index_t */
#include "row0log.h" /* row_log_estimate_work() */
#include "srv0srv.h" /* ut_stage_alter_t */
diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h
index 1614d3ead6d..6ca661378b1 100644
--- a/storage/innobase/include/ut0ut.h
+++ b/storage/innobase/include/ut0ut.h
@@ -45,7 +45,6 @@ Created 1/20/1994 Heikki Tuuri
#include <stdarg.h>
#include <string>
-#include <my_atomic.h>
/** Index name prefix in fast index creation, as a string constant */
#define TEMP_INDEX_PREFIX_STR "\377"
@@ -175,12 +174,6 @@ ut_2_power_up(
ulint n) /*!< in: number != 0 */
MY_ATTRIBUTE((const));
-/** Determine how many bytes (groups of 8 bits) are needed to
-store the given number of bits.
-@param b in: bits
-@return number of bytes (octets) needed to represent b */
-#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
-
/**********************************************************//**
Returns system time. We do not specify the format of the time returned:
the only way to manipulate it is to use the function ut_difftime.
@@ -239,6 +232,12 @@ ut_difftime(
#endif /* !UNIV_INNOCHECKSUM */
+/** Determine how many bytes (groups of 8 bits) are needed to
+store the given number of bits.
+@param b in: bits
+@return number of bytes (octets) needed to represent b */
+#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
+
/** Determines if a number is zero or a power of two.
@param[in] n number
@return nonzero if n is zero or a power of two; zero otherwise */
diff --git a/storage/innobase/include/ut0vec.h b/storage/innobase/include/ut0vec.h
index 13b561a3a4f..c23b1844349 100644
--- a/storage/innobase/include/ut0vec.h
+++ b/storage/innobase/include/ut0vec.h
@@ -26,7 +26,6 @@ Created 4/6/2006 Osku Salerma
#ifndef IB_VECTOR_H
#define IB_VECTOR_H
-#include "univ.i"
#include "mem0mem.h"
struct ib_alloc_t;
diff --git a/storage/innobase/include/ut0vec.ic b/storage/innobase/include/ut0vec.ic
index 17f4df579b6..bf774c84683 100644
--- a/storage/innobase/include/ut0vec.ic
+++ b/storage/innobase/include/ut0vec.ic
@@ -23,8 +23,6 @@ A vector of pointers to data items
Created 4/6/2006 Osku Salerma
************************************************************************/
-#include "ut0new.h"
-
#define IB_VEC_OFFSET(v, i) (vec->sizeof_value * i)
/********************************************************************
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index a728dd08c0d..85ae3bbc025 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -25,6 +25,7 @@ INCLUDE(lzma.cmake)
INCLUDE(bzip2.cmake)
INCLUDE(snappy.cmake)
INCLUDE(numa)
+INCLUDE(TestBigEndian)
MYSQL_CHECK_LZ4()
MYSQL_CHECK_LZO()
@@ -32,6 +33,7 @@ MYSQL_CHECK_LZMA()
MYSQL_CHECK_BZIP2()
MYSQL_CHECK_SNAPPY()
MYSQL_CHECK_NUMA()
+TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
diff --git a/storage/innobase/lock/lock0iter.cc b/storage/innobase/lock/lock0iter.cc
index db30bcf1ca6..071031748b7 100644
--- a/storage/innobase/lock/lock0iter.cc
+++ b/storage/innobase/lock/lock0iter.cc
@@ -26,7 +26,6 @@ Created July 16, 2007 Vasil Dimov
#define LOCK_MODULE_IMPLEMENTATION
-#include "univ.i"
#include "dict0mem.h"
#include "lock0iter.h"
#include "lock0lock.h"
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 5dc437dbcd7..a8877ab8a33 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2018, MariaDB Corporation.
+Copyright (c) 2014, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -26,8 +26,7 @@ Created 5/7/1996 Heikki Tuuri
#define LOCK_MODULE_IMPLEMENTATION
-
-#include "ha_prototypes.h"
+#include "univ.i"
#include <mysql/service_thd_error_context.h>
#include <sql_class.h>
@@ -37,11 +36,8 @@ Created 5/7/1996 Heikki Tuuri
#include "dict0mem.h"
#include "trx0purge.h"
#include "trx0sys.h"
-#include "srv0mon.h"
#include "ut0vec.h"
-#include "btr0btr.h"
-#include "dict0boot.h"
-#include "ut0new.h"
+#include "btr0cur.h"
#include "row0sel.h"
#include "row0mysql.h"
#include "row0vers.h"
@@ -766,9 +762,7 @@ lock_rec_has_to_wait(
<< wsrep_thd_query(lock2->trx->mysql_thd);
}
- if (wsrep_trx_order_before(trx->mysql_thd,
- lock2->trx->mysql_thd)
- && (type_mode & LOCK_MODE_MASK) == LOCK_X
+ if ((type_mode & LOCK_MODE_MASK) == LOCK_X
&& (lock2->type_mode & LOCK_MODE_MASK) == LOCK_X) {
if (for_locking || wsrep_debug) {
/* exclusive lock conflicts are not
@@ -778,12 +772,11 @@ lock_rec_has_to_wait(
<< type_mode
<< " supremum: " << lock_is_on_supremum
<< "conflicts states: my "
- << wsrep_thd_conflict_state(
- trx->mysql_thd, FALSE)
+ << wsrep_thd_transaction_state_str(
+ trx->mysql_thd)
<< " locked "
- << wsrep_thd_conflict_state(
- lock2->trx->mysql_thd,
- FALSE);
+ << wsrep_thd_transaction_state_str(
+ lock2->trx->mysql_thd);
lock_rec_print(stderr, lock2);
ib::info() << " SQL1: "
<< wsrep_thd_query(trx->mysql_thd)
@@ -1102,11 +1095,14 @@ wsrep_kill_victim(
return;
}
- my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
+ if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
+ return;
+ }
+
my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
- if ((bf_this && !bf_other) ||
- (bf_this && bf_other && wsrep_trx_order_before(
+ if ((!bf_other) ||
+ (wsrep_thd_order_before(
trx->mysql_thd, lock->trx->mysql_thd))) {
if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
@@ -1117,11 +1113,7 @@ wsrep_kill_victim(
is in the queue*/
} else if (lock->trx != trx) {
if (wsrep_log_conflicts) {
- if (bf_this) {
- ib::info() << "*** Priority TRANSACTION:";
- } else {
- ib::info() << "*** Victim TRANSACTION:";
- }
+ ib::info() << "*** Priority TRANSACTION:";
trx_print_latched(stderr, trx, 3000);
@@ -1430,7 +1422,7 @@ lock_rec_create_low(
lock_t *prev = NULL;
while (hash && wsrep_thd_is_BF(hash->trx->mysql_thd, TRUE)
- && wsrep_trx_order_before(hash->trx->mysql_thd,
+ && wsrep_thd_order_before(hash->trx->mysql_thd,
trx->mysql_thd)) {
prev = hash;
hash = (lock_t *)hash->hash;
@@ -1844,15 +1836,15 @@ lock_rec_add_to_queue(
ib::info() << "WSREP BF lock conflict for my lock:\n BF:" <<
((wsrep_thd_is_BF(trx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<
- wsrep_thd_exec_mode(trx->mysql_thd) << " conflict: " <<
- wsrep_thd_conflict_state(trx->mysql_thd, false) << " seqno: " <<
+ wsrep_thd_client_state_str(trx->mysql_thd) << " conflict: " <<
+ wsrep_thd_transaction_state_str(trx->mysql_thd) << " seqno: " <<
wsrep_thd_trx_seqno(trx->mysql_thd) << " SQL: " <<
wsrep_thd_query(trx->mysql_thd);
trx_t* otrx = other_lock->trx;
ib::info() << "WSREP other lock:\n BF:" <<
((wsrep_thd_is_BF(otrx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<
- wsrep_thd_exec_mode(otrx->mysql_thd) << " conflict: " <<
- wsrep_thd_conflict_state(otrx->mysql_thd, false) << " seqno: " <<
+ wsrep_thd_client_state_str(otrx->mysql_thd) << " conflict: " <<
+ wsrep_thd_transaction_state_str(otrx->mysql_thd) << " seqno: " <<
wsrep_thd_trx_seqno(otrx->mysql_thd) << " SQL: " <<
wsrep_thd_query(otrx->mysql_thd);
}
@@ -3289,48 +3281,55 @@ lock_update_discard(
lock_mutex_enter();
- if (!lock_rec_get_first_on_page(lock_sys.rec_hash, block)
- && (!lock_rec_get_first_on_page(lock_sys.prdt_hash, block))) {
- /* No locks exist on page, nothing to do */
+ if (lock_rec_get_first_on_page(lock_sys.rec_hash, block)) {
+ ut_ad(!lock_rec_get_first_on_page(lock_sys.prdt_hash, block));
+ ut_ad(!lock_rec_get_first_on_page(lock_sys.prdt_page_hash,
+ block));
+ /* Inherit all the locks on the page to the record and
+ reset all the locks on the page */
- lock_mutex_exit();
-
- return;
- }
+ if (page_is_comp(page)) {
+ rec = page + PAGE_NEW_INFIMUM;
- /* Inherit all the locks on the page to the record and reset all
- the locks on the page */
+ do {
+ heap_no = rec_get_heap_no_new(rec);
- if (page_is_comp(page)) {
- rec = page + PAGE_NEW_INFIMUM;
-
- do {
- heap_no = rec_get_heap_no_new(rec);
+ lock_rec_inherit_to_gap(heir_block, block,
+ heir_heap_no, heap_no);
- lock_rec_inherit_to_gap(heir_block, block,
- heir_heap_no, heap_no);
+ lock_rec_reset_and_release_wait(
+ block, heap_no);
- lock_rec_reset_and_release_wait(block, heap_no);
+ rec = page + rec_get_next_offs(rec, TRUE);
+ } while (heap_no != PAGE_HEAP_NO_SUPREMUM);
+ } else {
+ rec = page + PAGE_OLD_INFIMUM;
- rec = page + rec_get_next_offs(rec, TRUE);
- } while (heap_no != PAGE_HEAP_NO_SUPREMUM);
- } else {
- rec = page + PAGE_OLD_INFIMUM;
+ do {
+ heap_no = rec_get_heap_no_old(rec);
- do {
- heap_no = rec_get_heap_no_old(rec);
+ lock_rec_inherit_to_gap(heir_block, block,
+ heir_heap_no, heap_no);
- lock_rec_inherit_to_gap(heir_block, block,
- heir_heap_no, heap_no);
+ lock_rec_reset_and_release_wait(
+ block, heap_no);
- lock_rec_reset_and_release_wait(block, heap_no);
+ rec = page + rec_get_next_offs(rec, FALSE);
+ } while (heap_no != PAGE_HEAP_NO_SUPREMUM);
+ }
- rec = page + rec_get_next_offs(rec, FALSE);
- } while (heap_no != PAGE_HEAP_NO_SUPREMUM);
+ lock_rec_free_all_from_discard_page_low(
+ block->page.id.space(), block->page.id.page_no(),
+ lock_sys.rec_hash);
+ } else {
+ lock_rec_free_all_from_discard_page_low(
+ block->page.id.space(), block->page.id.page_no(),
+ lock_sys.prdt_hash);
+ lock_rec_free_all_from_discard_page_low(
+ block->page.id.space(), block->page.id.page_no(),
+ lock_sys.prdt_page_hash);
}
- lock_rec_free_all_from_discard_page(block);
-
lock_mutex_exit();
}
@@ -4250,6 +4249,7 @@ lock_check_dict_lock(
const lock_t* lock) /*!< in: lock to check */
{
if (lock_get_type_low(lock) == LOCK_REC) {
+ ut_ad(!lock->index->table->is_temporary());
/* Check if the transcation locked a record
in a system table in X mode. It should have set
@@ -4263,9 +4263,8 @@ lock_check_dict_lock(
} else {
ut_ad(lock_get_type_low(lock) & LOCK_TABLE);
- const dict_table_t* table;
-
- table = lock->un_member.tab_lock.table;
+ const dict_table_t* table = lock->un_member.tab_lock.table;
+ ut_ad(!table->is_temporary());
/* Check if the transcation locked a system table
in IX mode. It should have set the dict_op code
@@ -4604,14 +4603,14 @@ lock_print_info_summary(
fprintf(file,
"Purge done for trx's n:o < " TRX_ID_FMT
" undo n:o < " TRX_ID_FMT " state: %s\n"
- "History list length " ULINTPF "\n",
+ "History list length %u\n",
purge_sys.tail.trx_no(),
purge_sys.tail.undo_no,
purge_sys.enabled()
? (purge_sys.running() ? "running"
: purge_sys.paused() ? "stopped" : "running but idle")
: "disabled",
- trx_sys.history_size());
+ uint32_t{trx_sys.rseg_history_len});
#ifdef PRINT_NUM_OF_LOCK_STRUCTS
fprintf(file,
@@ -4909,6 +4908,8 @@ lock_rec_queue_validate(
goto func_exit;
}
+ ut_ad(page_rec_is_leaf(rec));
+
if (index == NULL) {
/* Nothing we can do */
@@ -4944,8 +4945,8 @@ lock_rec_queue_validate(
if (!lock_get_wait(other_lock) ) {
ib::info() << "WSREP impl BF lock conflict for my impl lock:\n BF:" <<
((wsrep_thd_is_BF(impl_trx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<
- wsrep_thd_exec_mode(impl_trx->mysql_thd) << " conflict: " <<
- wsrep_thd_conflict_state(impl_trx->mysql_thd, false) << " seqno: " <<
+ wsrep_thd_client_state_str(impl_trx->mysql_thd) << " conflict: " <<
+ wsrep_thd_transaction_state_str(impl_trx->mysql_thd) << " seqno: " <<
wsrep_thd_trx_seqno(impl_trx->mysql_thd) << " SQL: " <<
wsrep_thd_query(impl_trx->mysql_thd);
@@ -4953,8 +4954,8 @@ lock_rec_queue_validate(
ib::info() << "WSREP other lock:\n BF:" <<
((wsrep_thd_is_BF(otrx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<
- wsrep_thd_exec_mode(otrx->mysql_thd) << " conflict: " <<
- wsrep_thd_conflict_state(otrx->mysql_thd, false) << " seqno: " <<
+ wsrep_thd_client_state_str(otrx->mysql_thd) << " conflict: " <<
+ wsrep_thd_transaction_state_str(otrx->mysql_thd) << " seqno: " <<
wsrep_thd_trx_seqno(otrx->mysql_thd) << " SQL: " <<
wsrep_thd_query(otrx->mysql_thd);
}
@@ -5071,11 +5072,13 @@ loop:
if (!sync_check_find(SYNC_FSP))
for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) {
- if (i == 1 || lock_rec_get_nth_bit(lock, i)) {
+ if (i == PAGE_HEAP_NO_SUPREMUM
+ || lock_rec_get_nth_bit(lock, i)) {
rec = page_find_rec_with_heap_no(block->frame, i);
ut_a(rec);
- ut_ad(page_rec_is_leaf(rec));
+ ut_ad(!lock_rec_get_nth_bit(lock, i)
+ || page_rec_is_leaf(rec));
offsets = rec_get_offsets(rec, lock->index, offsets,
true, ULINT_UNDEFINED,
&heap);
@@ -5294,7 +5297,7 @@ lock_rec_insert_check_and_lock(
{
ut_ad(block->frame == page_align(rec));
ut_ad(!dict_index_is_online_ddl(index)
- || dict_index_is_clust(index)
+ || index->is_primary()
|| (flags & BTR_CREATE_FLAG));
ut_ad(mtr->is_named_space(index->table->space));
ut_ad(page_rec_is_leaf(rec));
@@ -5305,6 +5308,7 @@ lock_rec_insert_check_and_lock(
}
ut_ad(!index->table->is_temporary());
+ ut_ad(page_is_leaf(block->frame));
dberr_t err;
lock_t* lock;
@@ -6124,10 +6128,8 @@ lock_get_table_id(
/*==============*/
const lock_t* lock) /*!< in: lock */
{
- dict_table_t* table;
-
- table = lock_get_table(lock);
-
+ dict_table_t* table = lock_get_table(lock);
+ ut_ad(!table->is_temporary());
return(table->id);
}
@@ -6389,6 +6391,12 @@ lock_trx_handle_wait(
/*=================*/
trx_t* trx) /*!< in/out: trx lock state */
{
+#ifdef WITH_WSREP
+ /* We already own mutexes */
+ if (trx->lock.was_chosen_as_wsrep_victim) {
+ return lock_trx_handle_wait_low(trx);
+ }
+#endif /* WITH_WSREP */
lock_mutex_enter();
trx_mutex_enter(trx);
dberr_t err = lock_trx_handle_wait_low(trx);
@@ -6986,6 +6994,11 @@ DeadlockChecker::trx_rollback()
trx_t* trx = m_wait_lock->trx;
print("*** WE ROLL BACK TRANSACTION (1)\n");
+#ifdef WITH_WSREP
+ if (wsrep_on(trx->mysql_thd)) {
+ wsrep_handle_SR_rollback(m_start->mysql_thd, trx->mysql_thd);
+ }
+#endif
trx_mutex_enter(trx);
diff --git a/storage/innobase/lock/lock0prdt.cc b/storage/innobase/lock/lock0prdt.cc
index bac9a788076..6ee97ee3ec7 100644
--- a/storage/innobase/lock/lock0prdt.cc
+++ b/storage/innobase/lock/lock0prdt.cc
@@ -29,17 +29,8 @@ Created 9/7/2013 Jimmy Yang
#include "lock0lock.h"
#include "lock0priv.h"
#include "lock0prdt.h"
-#include "ha_prototypes.h"
-#include "trx0purge.h"
#include "dict0mem.h"
-#include "dict0boot.h"
-#include "trx0sys.h"
-#include "srv0mon.h"
-#include "ut0vec.h"
-#include "btr0btr.h"
-#include "dict0boot.h"
#include "que0que.h"
-#include <set>
/*********************************************************************//**
Get a minimum bounding box from a Predicate
diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc
index 4a3adaa4757..8869290901c 100644
--- a/storage/innobase/lock/lock0wait.cc
+++ b/storage/innobase/lock/lock0wait.cc
@@ -26,7 +26,7 @@ Created 25/5/2010 Sunny Bains
#define LOCK_MODULE_IMPLEMENTATION
-#include "ha_prototypes.h"
+#include "univ.i"
#include <mysql/service_thd_wait.h>
#include <mysql/service_wsrep.h>
@@ -285,7 +285,7 @@ lock_wait_suspend_thread(
if (thr->lock_state == QUE_THR_LOCK_ROW) {
srv_stats.n_lock_wait_count.inc();
- srv_stats.n_lock_wait_current_count.inc();
+ srv_stats.n_lock_wait_current_count++;
if (ut_usectime(&sec, &ms) == -1) {
start_time = -1;
@@ -398,7 +398,7 @@ lock_wait_suspend_thread(
thd_storage_lock_wait(trx->mysql_thd, diff_time);
}
- srv_stats.n_lock_wait_current_count.dec();
+ srv_stats.n_lock_wait_current_count--;
DBUG_EXECUTE_IF("lock_instrument_slow_query_log",
os_thread_sleep(1000););
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 204f0a6917d..720bb94f012 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -31,7 +31,7 @@ Database log
Created 12/9/1995 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
+#include "univ.i"
#include <debug_sync.h>
#include <my_service_manager.h>
@@ -670,16 +670,6 @@ void log_t::files::create(ulint n_files)
file_size= srv_log_file_size;
lsn= LOG_START_LSN;
lsn_offset= LOG_FILE_HDR_SIZE;
-
- byte* ptr= static_cast<byte*>(ut_zalloc_nokey(LOG_FILE_HDR_SIZE * n_files
- + OS_FILE_LOG_BLOCK_SIZE));
- file_header_bufs_ptr= ptr;
- ptr= static_cast<byte*>(ut_align(ptr, OS_FILE_LOG_BLOCK_SIZE));
-
- memset(file_header_bufs, 0, sizeof file_header_bufs);
-
- for (ulint i = 0; i < n_files; i++, ptr += LOG_FILE_HDR_SIZE)
- file_header_bufs[i] = ptr;
}
/******************************************************//**
@@ -692,7 +682,6 @@ log_file_header_flush(
lsn_t start_lsn) /*!< in: log file data starts at this
lsn */
{
- byte* buf;
lsn_t dest_offset;
ut_ad(log_write_mutex_own());
@@ -701,9 +690,10 @@ log_file_header_flush(
ut_ad(log_sys.log.format == LOG_HEADER_FORMAT_10_4
|| log_sys.log.format == LOG_HEADER_FORMAT_ENC_10_4);
- buf = log_sys.log.file_header_bufs[nth_file];
+ // man 2 open suggests this buffer to be aligned by 512 for O_DIRECT
+ MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE)
+ byte buf[OS_FILE_LOG_BLOCK_SIZE] = {0};
- memset(buf, 0, OS_FILE_LOG_BLOCK_SIZE);
mach_write_to_4(buf + LOG_HEADER_FORMAT, log_sys.log.format);
mach_write_to_4(buf + LOG_HEADER_SUBFORMAT, log_sys.log.subformat);
mach_write_to_8(buf + LOG_HEADER_START_LSN, start_lsn);
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 76ed715e8d8..26f747a5037 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -25,7 +25,7 @@ Recovery
Created 9/20/1997 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
+#include "univ.i"
#include <vector>
#include <map>
@@ -52,8 +52,6 @@ Created 9/20/1997 Heikki Tuuri
#include "trx0undo.h"
#include "trx0rec.h"
#include "fil0fil.h"
-#include "fsp0sysspace.h"
-#include "ut0new.h"
#include "buf0rea.h"
#include "srv0srv.h"
#include "srv0start.h"
@@ -229,9 +227,8 @@ static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn)
hash_cell_t* const cell = hash_get_nth_cell(
recv_sys->addr_hash, i);
for (recv_addr_t* addr = static_cast<recv_addr_t*>(cell->node),
- *prev = NULL, *next;
- addr;
- prev = addr, addr = next) {
+ *next;
+ addr; addr = next) {
next = static_cast<recv_addr_t*>(addr->addr_hash);
if (addr->space != space_id || addr->page_no < pages) {
@@ -253,22 +250,6 @@ static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn)
}
recv = n;
}
-
- if (UT_LIST_GET_LEN(addr->rec_list)) {
- DBUG_PRINT("ib_log",
- ("preserving " ULINTPF
- " records for page %u:%u",
- UT_LIST_GET_LEN(addr->rec_list),
- addr->space, addr->page_no));
- } else {
- ut_ad(recv_sys->n_addrs);
- --recv_sys->n_addrs;
- if (addr == cell->node) {
- cell->node = next;
- } else {
- prev->addr_hash = next;
- }
- }
}
}
if (fil_space_t* space = fil_space_get(space_id)) {
@@ -1944,7 +1925,7 @@ recv_recover_page(bool just_read_in, buf_block_t* block)
if (start_lsn) {
log_flush_order_mutex_enter();
- buf_flush_recv_note_modification(block, start_lsn, end_lsn);
+ buf_flush_note_modification(block, start_lsn, end_lsn, NULL);
log_flush_order_mutex_exit();
}
@@ -2024,8 +2005,7 @@ static ulint recv_read_in_area(const page_id_t page_id)
/** Apply the hash table of stored log records to persistent data pages.
@param[in] last_batch whether the change buffer merge will be
performed as part of the operation */
-void
-recv_apply_hashed_log_recs(bool last_batch)
+void recv_apply_hashed_log_recs(bool last_batch)
{
ut_ad(srv_operation == SRV_OPERATION_NORMAL
|| srv_operation == SRV_OPERATION_RESTORE
@@ -2090,7 +2070,8 @@ recv_apply_hashed_log_recs(bool last_batch)
recv_addr = static_cast<recv_addr_t*>(
HASH_GET_NEXT(addr_hash, recv_addr))) {
- if (recv_addr->state == RECV_DISCARDED) {
+ if (recv_addr->state == RECV_DISCARDED
+ || !UT_LIST_GET_LEN(recv_addr->rec_list)) {
ut_a(recv_sys->n_addrs);
recv_sys->n_addrs--;
continue;
diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc
index 09f0765d7dc..1d3519501da 100644
--- a/storage/innobase/mem/mem0mem.cc
+++ b/storage/innobase/mem/mem0mem.cc
@@ -24,8 +24,6 @@ The memory management
Created 6/9/1994 Heikki Tuuri
*************************************************************************/
-#include "ha_prototypes.h"
-
#include "mem0mem.h"
#include "buf0buf.h"
#include "srv0srv.h"
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 3084ba387fb..13934546448 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -191,7 +191,7 @@ memo_slot_release(mtr_memo_slot_t* slot)
block = reinterpret_cast<buf_block_t*>(slot->object);
- buf_block_unfix(block);
+ block->unfix();
buf_page_release_latch(block, slot->type);
break;
}
@@ -228,7 +228,7 @@ memo_block_unfix(mtr_memo_slot_t* slot)
case MTR_MEMO_PAGE_S_FIX:
case MTR_MEMO_PAGE_X_FIX:
case MTR_MEMO_PAGE_SX_FIX: {
- buf_block_unfix(reinterpret_cast<buf_block_t*>(slot->object));
+ reinterpret_cast<buf_block_t*>(slot->object)->unfix();
break;
}
@@ -677,7 +677,7 @@ mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line)
ut_ad(get_log_mode() != MTR_LOG_NO_REDO
|| space->purpose == FIL_TYPE_TEMPORARY
|| space->purpose == FIL_TYPE_IMPORT
- || my_atomic_loadlint(&space->redo_skipped_count) > 0);
+ || space->redo_skipped_count > 0);
}
ut_ad(space);
diff --git a/storage/innobase/os/os0event.cc b/storage/innobase/os/os0event.cc
index 73067bf7fe7..c350c7b81dd 100644
--- a/storage/innobase/os/os0event.cc
+++ b/storage/innobase/os/os0event.cc
@@ -25,16 +25,12 @@ Created 2012-09-23 Sunny Bains
#include "os0event.h"
#include "ut0mutex.h"
-#include "ha_prototypes.h"
-#include "ut0new.h"
#ifdef _WIN32
#include <windows.h>
#include <synchapi.h>
#endif /* _WIN32 */
-#include <list>
-
#ifdef _WIN32
/** Native condition variable. */
typedef CONDITION_VARIABLE os_cond_t;
@@ -43,9 +39,6 @@ typedef CONDITION_VARIABLE os_cond_t;
typedef pthread_cond_t os_cond_t;
#endif /* _WIN32 */
-typedef std::list<os_event_t, ut_allocator<os_event_t> > os_event_list_t;
-typedef os_event_list_t::iterator event_iter_t;
-
/** InnoDB condition variable. */
struct os_event {
os_event() UNIV_NOTHROW;
@@ -125,7 +118,10 @@ struct os_event {
/** @return true if the event is in the signalled state. */
bool is_set() const UNIV_NOTHROW
{
- return(m_set);
+ mutex.enter();
+ bool is_set = m_set;
+ mutex.exit();
+ return is_set;
}
private:
@@ -223,16 +219,13 @@ private:
int64_t signal_count; /*!< this is incremented
each time the event becomes
signaled */
- EventMutex mutex; /*!< this mutex protects
+ mutable OSMutex mutex; /*!< this mutex protects
the next fields */
os_cond_t cond_var; /*!< condition variable is
used in waiting for the event */
-public:
- event_iter_t event_iter; /*!< For O(1) removal from
- list */
protected:
// Disable copying
os_event(const os_event&);
@@ -530,8 +523,6 @@ os_event_destroy(
os_event_t& event) /*!< in/own: event to free */
{
- if (event != NULL) {
- UT_DELETE(event);
- event = NULL;
- }
+ UT_DELETE(event);
+ event = NULL;
}
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 5d0f3f4fc9c..f7a436ed68e 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -34,11 +34,8 @@ Created 10/21/1995 Heikki Tuuri
*******************************************************/
#ifndef UNIV_INNOCHECKSUM
-
-#include "ha_prototypes.h"
-#include "sql_const.h"
-
#include "os0file.h"
+#include "sql_const.h"
#ifdef UNIV_LINUX
#include <sys/types.h>
@@ -48,9 +45,6 @@ Created 10/21/1995 Heikki Tuuri
#include "srv0srv.h"
#include "srv0start.h"
#include "fil0fil.h"
-#include "fil0crypt.h"
-#include "fsp0fsp.h"
-#include "fil0pagecompress.h"
#include "srv0srv.h"
#ifdef HAVE_LINUX_UNISTD_H
#include "unistd.h"
@@ -1090,22 +1084,8 @@ os_aio_validate_skip()
/** Try os_aio_validate() every this many times */
# define OS_AIO_VALIDATE_SKIP 13
- /** The os_aio_validate() call skip counter.
- Use a signed type because of the race condition below. */
- static int os_aio_validate_count = OS_AIO_VALIDATE_SKIP;
-
- /* There is a race condition below, but it does not matter,
- because this call is only for heuristic purposes. We want to
- reduce the call frequency of the costly os_aio_validate()
- check in debug builds. */
- --os_aio_validate_count;
-
- if (os_aio_validate_count > 0) {
- return(true);
- }
-
- os_aio_validate_count = OS_AIO_VALIDATE_SKIP;
- return(os_aio_validate());
+ static Atomic_counter<uint32_t> os_aio_validate_count;
+ return (os_aio_validate_count++ % OS_AIO_VALIDATE_SKIP) || os_aio_validate();
}
#endif /* UNIV_DEBUG */
@@ -1775,6 +1755,8 @@ LinuxAIOHandler::resubmit(Slot* slot)
slot->n_bytes = 0;
slot->io_already_done = false;
+ compile_time_assert(sizeof(off_t) >= sizeof(os_offset_t));
+
struct iocb* iocb = &slot->control;
if (slot->type.is_read()) {
@@ -1784,7 +1766,7 @@ LinuxAIOHandler::resubmit(Slot* slot)
slot->file,
slot->ptr,
slot->len,
- static_cast<off_t>(slot->offset));
+ slot->offset);
} else {
ut_a(slot->type.is_write());
@@ -1794,7 +1776,7 @@ LinuxAIOHandler::resubmit(Slot* slot)
slot->file,
slot->ptr,
slot->len,
- static_cast<off_t>(slot->offset));
+ slot->offset);
}
iocb->data = slot;
@@ -6273,7 +6255,7 @@ AIO::reserve_slot(
#ifdef _WIN32
slot->len = static_cast<DWORD>(len);
#else
- slot->len = static_cast<ulint>(len);
+ slot->len = len;
#endif /* _WIN32 */
slot->type = type;
slot->buf = static_cast<byte*>(buf);
diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc
index 22966690ab0..7b8e4bde442 100644
--- a/storage/innobase/os/os0proc.cc
+++ b/storage/innobase/os/os0proc.cc
@@ -24,12 +24,7 @@ process control primitives
Created 9/30/1995 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
-#include "os0proc.h"
-#include "srv0srv.h"
-#include "ut0mem.h"
-#include "ut0byte.h"
+#include "univ.i"
/* FreeBSD for example has only MAP_ANON, Linux has MAP_ANONYMOUS and
MAP_ANON but MAP_ANON is marked as deprecated */
@@ -41,7 +36,7 @@ MAP_ANON but MAP_ANON is marked as deprecated */
/** The total amount of memory currently allocated from the operating
system with os_mem_alloc_large(). */
-ulint os_total_large_mem_allocated = 0;
+Atomic_counter<ulint> os_total_large_mem_allocated;
/** Whether to use large pages in the buffer pool */
my_bool os_use_large_pages;
@@ -105,9 +100,7 @@ os_mem_alloc_large(
if (ptr) {
*n = size;
- my_atomic_addlint(
- &os_total_large_mem_allocated, size);
-
+ os_total_large_mem_allocated += size;
UNIV_MEM_ALLOC(ptr, size);
return(ptr);
}
@@ -132,8 +125,7 @@ skip:
ib::info() << "VirtualAlloc(" << size << " bytes) failed;"
" Windows error " << GetLastError();
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, size);
+ os_total_large_mem_allocated += size;
UNIV_MEM_ALLOC(ptr, size);
}
#else
@@ -148,8 +140,7 @@ skip:
" errno " << errno;
ptr = NULL;
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, size);
+ os_total_large_mem_allocated += size;
UNIV_MEM_ALLOC(ptr, size);
}
#endif
@@ -168,9 +159,7 @@ os_mem_free_large(
#if defined HAVE_LINUX_LARGE_PAGES && defined UNIV_LINUX
if (os_use_large_pages && os_large_page_size && !shmdt(ptr)) {
- my_atomic_addlint(
- &os_total_large_mem_allocated, -size);
- UNIV_MEM_FREE(ptr, size);
+ os_total_large_mem_allocated -= size;
return;
}
#endif /* HAVE_LINUX_LARGE_PAGES && UNIV_LINUX */
@@ -181,9 +170,7 @@ os_mem_free_large(
ib::error() << "VirtualFree(" << ptr << ", " << size
<< ") failed; Windows error " << GetLastError();
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, -lint(size));
- UNIV_MEM_FREE(ptr, size);
+ os_total_large_mem_allocated -= size;
}
#elif !defined OS_MAP_ANON
ut_free(ptr);
@@ -196,9 +183,7 @@ os_mem_free_large(
ib::error() << "munmap(" << ptr << ", " << size << ") failed;"
" errno " << errno;
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, -size);
- UNIV_MEM_FREE(ptr, size);
+ os_total_large_mem_allocated -= size;
}
#endif
}
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index bbb24fae3b8..28ba46c9f92 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -24,16 +24,11 @@ The interface to the operating system thread control primitives
Created 9/8/1995 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
-#include "os0thread.h"
-#include "ut0new.h"
+#include "univ.i"
#include "srv0srv.h"
-#include "os0event.h"
-#include <map>
/** Number of threads active. */
-ulint os_thread_count;
+Atomic_counter<ulint> os_thread_count;
/***************************************************************//**
Compares two thread ids for equality.
@@ -123,7 +118,7 @@ os_thread_create_func(
CloseHandle(handle);
- my_atomic_addlint(&os_thread_count, 1);
+ os_thread_count++;
return((os_thread_t)new_thread_id);
#else /* _WIN32 else */
@@ -132,7 +127,7 @@ os_thread_create_func(
pthread_attr_init(&attr);
- my_atomic_addlint(&os_thread_count, 1);
+ os_thread_count++;
int ret = pthread_create(&new_thread_id, &attr, func, arg);
@@ -187,7 +182,7 @@ os_thread_exit(bool detach)
pfs_delete_thread();
#endif
- my_atomic_addlint(&os_thread_count, ulint(-1));
+ os_thread_count--;
#ifdef _WIN32
ExitThread(0);
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index a797e3688ec..25b2d202168 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -25,8 +25,6 @@ The page cursor
Created 10/4/1994 Heikki Tuuri
*************************************************************************/
-#include "ha_prototypes.h"
-
#include "page0cur.h"
#include "page0zip.h"
#include "btr0btr.h"
@@ -1787,17 +1785,11 @@ too_small:
columns of free_rec, in case it will not be
overwritten by insert_rec. */
- ulint trx_id_col;
ulint trx_id_offs;
ulint len;
- trx_id_col = dict_index_get_sys_col_pos(index,
- DATA_TRX_ID);
- ut_ad(trx_id_col > 0);
- ut_ad(trx_id_col != ULINT_UNDEFINED);
-
- trx_id_offs = rec_get_nth_field_offs(foffsets,
- trx_id_col, &len);
+ trx_id_offs = rec_get_nth_field_offs(
+ foffsets, index->db_trx_id(), &len);
ut_ad(len == DATA_TRX_ID_LEN);
if (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN + trx_id_offs
@@ -1813,7 +1805,7 @@ too_small:
ut_ad(free_rec + trx_id_offs + DATA_TRX_ID_LEN
== rec_get_nth_field(free_rec, foffsets,
- trx_id_col + 1, &len));
+ index->db_roll_ptr(), &len));
ut_ad(len == DATA_ROLL_PTR_LEN);
}
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 717f4a79507..b93773197c9 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -29,6 +29,7 @@ Created 2/2/1994 Heikki Tuuri
#include "page0cur.h"
#include "page0zip.h"
#include "buf0buf.h"
+#include "buf0checksum.h"
#include "btr0btr.h"
#include "srv0srv.h"
#include "lock0lock.h"
@@ -235,7 +236,7 @@ page_set_autoinc(
mtr, block, MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX));
ut_ad(index->is_primary());
ut_ad(index->page == block->page.id.page_no());
- ut_ad(index->table->space->id == block->page.id.space());
+ ut_ad(index->table->space_id == block->page.id.space());
byte* field = PAGE_HEADER + PAGE_ROOT_AUTO_INC
+ buf_block_get_frame(block);
@@ -2816,42 +2817,3 @@ page_find_rec_max_not_deleted(
}
return(prev_rec);
}
-
-/** Issue a warning when the checksum that is stored in the page is valid,
-but different than the global setting innodb_checksum_algorithm.
-@param[in] current_algo current checksum algorithm
-@param[in] page_checksum page valid checksum
-@param[in] page_id page identifier */
-void
-page_warn_strict_checksum(
- srv_checksum_algorithm_t curr_algo,
- srv_checksum_algorithm_t page_checksum,
- const page_id_t page_id)
-{
- srv_checksum_algorithm_t curr_algo_nonstrict;
- switch (curr_algo) {
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_CRC32;
- break;
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_INNODB;
- break;
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_NONE;
- break;
- default:
- ut_error;
- }
-
- ib::warn() << "innodb_checksum_algorithm is set to \""
- << buf_checksum_algorithm_name(curr_algo) << "\""
- << " but the page " << page_id << " contains a valid checksum \""
- << buf_checksum_algorithm_name(page_checksum) << "\". "
- << " Accepting the page as valid. Change"
- << " innodb_checksum_algorithm to \""
- << buf_checksum_algorithm_name(curr_algo_nonstrict)
- << "\" to silently accept such pages or rewrite all pages"
- << " so that they contain \""
- << buf_checksum_algorithm_name(curr_algo_nonstrict)
- << "\" checksum.";
-}
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 4b1ab637c13..96f5603853b 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -25,33 +25,31 @@ Compressed page interface
Created June 2005 by Marko Makela
*******************************************************/
-#include "page0size.h"
#include "page0zip.h"
+#include "page0size.h"
+#include "page0page.h"
+#include "buf0checksum.h"
/** A BLOB field reference full of zero, for use in assertions and tests.
Initially, BLOB field references are set to zero, in
dtuple_convert_big_rec(). */
const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, };
+#include "ut0crc32.h"
+#include "zlib.h"
+
#ifndef UNIV_INNOCHECKSUM
-#include "page0page.h"
#include "mtr0log.h"
#include "dict0dict.h"
#include "btr0cur.h"
-#include "page0types.h"
#include "log0recv.h"
#include "row0row.h"
-#include "zlib.h"
-#include "buf0buf.h"
-#include "buf0types.h"
-#include "buf0checksum.h"
#include "btr0sea.h"
#include "dict0boot.h"
#include "lock0lock.h"
#include "srv0srv.h"
#include "buf0lru.h"
#include "srv0mon.h"
-#include "ut0crc32.h"
#include <map>
#include <algorithm>
@@ -1411,10 +1409,7 @@ page_zip_compress(
/* Dense page directory and uncompressed columns, if any */
if (page_is_leaf(page)) {
if (dict_index_is_clust(index)) {
- trx_id_col = dict_index_get_sys_col_pos(
- index, DATA_TRX_ID);
- ut_ad(trx_id_col > 0);
- ut_ad(trx_id_col != ULINT_UNDEFINED);
+ trx_id_col = index->db_trx_id();
slot_size = PAGE_ZIP_DIR_SLOT_SIZE
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN;
@@ -1422,8 +1417,6 @@ page_zip_compress(
} else {
/* Signal the absence of trx_id
in page_zip_fields_encode() */
- ut_ad(dict_index_get_sys_col_pos(
- index, DATA_TRX_ID) == ULINT_UNDEFINED);
trx_id_col = 0;
slot_size = PAGE_ZIP_DIR_SLOT_SIZE;
}
@@ -3730,29 +3723,25 @@ page_zip_write_rec(
ulint len;
if (dict_index_is_clust(index)) {
- ulint trx_id_col;
-
- trx_id_col = dict_index_get_sys_col_pos(index,
- DATA_TRX_ID);
- ut_ad(trx_id_col != ULINT_UNDEFINED);
-
/* Store separately trx_id, roll_ptr and
the BTR_EXTERN_FIELD_REF of each BLOB column. */
if (rec_offs_any_extern(offsets)) {
data = page_zip_write_rec_ext(
page_zip, page,
rec, index, offsets, create,
- trx_id_col, heap_no, storage, data);
+ index->db_trx_id(), heap_no,
+ storage, data);
} else {
/* Locate trx_id and roll_ptr. */
const byte* src
= rec_get_nth_field(rec, offsets,
- trx_id_col, &len);
+ index->db_trx_id(),
+ &len);
ut_ad(len == DATA_TRX_ID_LEN);
ut_ad(src + DATA_TRX_ID_LEN
== rec_get_nth_field(
rec, offsets,
- trx_id_col + 1, &len));
+ index->db_roll_ptr(), &len));
ut_ad(len == DATA_ROLL_PTR_LEN);
/* Log the preceding fields. */
@@ -3780,8 +3769,6 @@ page_zip_write_rec(
} else {
/* Leaf page of a secondary index:
no externally stored columns */
- ut_ad(dict_index_get_sys_col_pos(index, DATA_TRX_ID)
- == ULINT_UNDEFINED);
ut_ad(!rec_offs_any_extern(offsets));
/* Log the entire record. */
@@ -4938,18 +4925,12 @@ corrupt:
@param[in] data compressed page
@param[in] size size of compressed page
@param[in] algo algorithm to use
-@param[in] use_legacy_big_endian only used if algo is
-SRV_CHECKSUM_ALGORITHM_CRC32 or SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 - if true
-then use big endian byteorder when converting byte strings to integers.
-SRV_CHECKSUM_ALGORITHM_CRC32 or SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 - if true
-then use big endian byteorder when converting byte strings to integers.
@return page checksum */
uint32_t
page_zip_calc_checksum(
const void* data,
ulint size,
- srv_checksum_algorithm_t algo,
- bool use_legacy_big_endian /* = false */)
+ srv_checksum_algorithm_t algo)
{
uLong adler;
const Bytef* s = static_cast<const byte*>(data);
@@ -4960,25 +4941,12 @@ page_zip_calc_checksum(
switch (algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- {
- ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
-
- ut_crc32_func_t crc32_func = use_legacy_big_endian
- ? ut_crc32_legacy_big_endian
- : ut_crc32;
-
- const uint32_t crc32
- = crc32_func(
- s + FIL_PAGE_OFFSET,
- FIL_PAGE_LSN - FIL_PAGE_OFFSET)
- ^ crc32_func(
- s + FIL_PAGE_TYPE, 2)
- ^ crc32_func(
- s + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
- size - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
-
- return(crc32);
- }
+ ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ return ut_crc32(s + FIL_PAGE_OFFSET,
+ FIL_PAGE_LSN - FIL_PAGE_OFFSET)
+ ^ ut_crc32(s + FIL_PAGE_TYPE, 2)
+ ^ ut_crc32(s + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
+ size - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
case SRV_CHECKSUM_ALGORITHM_INNODB:
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
@@ -5013,19 +4981,8 @@ page_zip_verify_checksum(
const void* data, /*!< in: compressed page */
ulint size) /*!< in: size of compressed page */
{
- ib_uint32_t stored;
- ib_uint32_t calc;
-
- stored = static_cast<ib_uint32_t>(mach_read_from_4(
- static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
-
- ulint page_no MY_ATTRIBUTE((unused)) =
- mach_read_from_4(static_cast<const unsigned char*>
- (data) + FIL_PAGE_OFFSET);
- ulint space_id MY_ATTRIBUTE((unused)) =
- mach_read_from_4(static_cast<const unsigned char*>
- (data) + FIL_PAGE_SPACE_ID);
- const page_id_t page_id(space_id, page_no);
+ const uint32_t stored = mach_read_from_4(
+ static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM);
compile_time_assert(!(FIL_PAGE_LSN % 8));
@@ -5067,8 +5024,7 @@ page_zip_verify_checksum(
return(TRUE);
}
- calc = static_cast<ib_uint32_t>(page_zip_calc_checksum(
- data, size, curr_algo));
+ uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);
#ifdef UNIV_INNOCHECKSUM
if (log_file) {
@@ -5101,149 +5057,28 @@ page_zip_verify_checksum(
return(TRUE);
}
- bool legacy_checksum_checked = false;
-
switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- case SRV_CHECKSUM_ALGORITHM_CRC32: {
-
- if (stored == BUF_NO_CHECKSUM_MAGIC) {
-#ifndef UNIV_INNOCHECKSUM
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_NONE,
- page_id);
- }
-#endif /* UNIV_INNOCHECKSUM */
-
- return(TRUE);
- }
-
- /* We need to check whether the stored checksum matches legacy
- big endian checksum or Innodb checksum. We optimize the order
- based on earlier results. if earlier we have found pages
- matching legacy big endian checksum, we try to match it first.
- Otherwise we check innodb checksum first. */
- if (legacy_big_endian_checksum) {
- const uint32_t calculated =
- page_zip_calc_checksum(data, size, curr_algo, true);
- if (stored == calculated) {
-
- return(TRUE);
- }
- legacy_checksum_checked = true;
- }
-
- uint32_t calculated =
- page_zip_calc_checksum(data, size, SRV_CHECKSUM_ALGORITHM_INNODB);
-
- if (stored == calculated) {
-
-#ifndef UNIV_INNOCHECKSUM
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_INNODB,
- page_id);
- }
-#endif /* UNIV_INNOCHECKSUM */
-
- return(TRUE);
- }
-
- calculated = page_zip_calc_checksum(
- data, size, curr_algo, true);
-
- /* If legacy checksum is not checked, do it now. */
- if ((legacy_checksum_checked
- && stored == calculated)) {
- legacy_big_endian_checksum = true;
- return(TRUE);
- }
-
- break;
- }
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- case SRV_CHECKSUM_ALGORITHM_INNODB: {
-
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ return FALSE;
+ case SRV_CHECKSUM_ALGORITHM_CRC32:
if (stored == BUF_NO_CHECKSUM_MAGIC) {
-#ifndef UNIV_INNOCHECKSUM
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_NONE,
- page_id);
- }
-#endif /* UNIV_INNOCHECKSUM */
-
- return(TRUE);
- }
-
- const uint32_t calculated = page_zip_calc_checksum(
- data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
- uint32_t calculated1;
-
- if (stored == calculated
- || stored == (calculated1 =
- page_zip_calc_checksum(data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true))
- ) {
-#ifndef UNIV_INNOCHECKSUM
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_CRC32,
- page_id);
- }
-#endif /* UNIV_INNOCHECKSUM */
return(TRUE);
}
- break;
- }
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: {
-
- uint32_t calculated = page_zip_calc_checksum(
- data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
- const uint32_t calculated1 = page_zip_calc_checksum(
- data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true);
-
- if (stored == calculated
- || stored == calculated1) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_CRC32,
- page_id);
-#endif /* UNIV_INNOCHECKSUM */
- return(TRUE);
- }
-
- calculated = page_zip_calc_checksum(
+ return stored == page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_INNODB);
-
- if (stored == calculated) {
-
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_INNODB,
- page_id);
-#endif /* UNIV_INNOCHECKSUM */
- return(TRUE);
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ return TRUE;
}
- break;
- }
+ return stored == page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
case SRV_CHECKSUM_ALGORITHM_NONE:
- ut_error;
- /* no default so the compiler will emit a warning if new enum
- is added and not handled here */
+ return TRUE;
}
- return(FALSE);
+ return FALSE;
}
diff --git a/storage/innobase/pars/pars0opt.cc b/storage/innobase/pars/pars0opt.cc
index 0d60dc7bade..28ab2ccd505 100644
--- a/storage/innobase/pars/pars0opt.cc
+++ b/storage/innobase/pars/pars0opt.cc
@@ -33,7 +33,6 @@ Created 12/21/1997 Heikki Tuuri
#include "que0que.h"
#include "pars0grm.h"
#include "pars0pars.h"
-#include "lock0lock.h"
#define OPT_EQUAL 1 /* comparison by = */
#define OPT_COMPARISON 2 /* comparison by <, >, <=, or >= */
diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc
index 8a30e611eb4..33dc9ebf602 100644
--- a/storage/innobase/pars/pars0pars.cc
+++ b/storage/innobase/pars/pars0pars.cc
@@ -27,8 +27,6 @@ Created 11/19/1996 Heikki Tuuri
/* Historical note: Innobase executed its first SQL string (CREATE TABLE)
on 1/27/1998 */
-#include "ha_prototypes.h"
-
#include "pars0pars.h"
#include "row0sel.h"
#include "row0ins.h"
@@ -43,7 +41,6 @@ on 1/27/1998 */
#include "data0type.h"
#include "trx0trx.h"
#include "trx0roll.h"
-#include "lock0lock.h"
#include "eval0eval.h"
/* Global variable used while parsing a single procedure or query : the code is
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index ebcd7bd450e..ef40c3479a0 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -24,8 +24,6 @@ Query graph
Created 5/27/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "que0que.h"
#include "trx0trx.h"
#include "trx0roll.h"
@@ -37,9 +35,6 @@ Created 5/27/1996 Heikki Tuuri
#include "dict0crea.h"
#include "log0log.h"
#include "eval0proc.h"
-#include "lock0lock.h"
-#include "eval0eval.h"
-#include "pars0types.h"
#define QUE_MAX_LOOPS_WITHOUT_CHECK 16
diff --git a/storage/innobase/read/read0read.cc b/storage/innobase/read/read0read.cc
index 470c8ec63f1..df2406fb0e4 100644
--- a/storage/innobase/read/read0read.cc
+++ b/storage/innobase/read/read0read.cc
@@ -200,7 +200,7 @@ inline void ReadView::snapshot(trx_t *trx)
void ReadView::open(trx_t *trx)
{
ut_ad(this == &trx->read_view);
- switch (m_state)
+ switch (state())
{
case READ_VIEW_STATE_OPEN:
ut_ad(!srv_read_only_mode);
@@ -254,8 +254,7 @@ void ReadView::open(trx_t *trx)
*/
mutex_enter(&trx_sys.mutex);
mutex_exit(&trx_sys.mutex);
- my_atomic_store32_explicit(&m_state, READ_VIEW_STATE_SNAPSHOT,
- MY_MEMORY_ORDER_RELAXED);
+ m_state.store(READ_VIEW_STATE_SNAPSHOT, std::memory_order_relaxed);
break;
default:
ut_ad(0);
@@ -264,8 +263,7 @@ void ReadView::open(trx_t *trx)
snapshot(trx);
reopen:
m_creator_trx_id= trx->id;
- my_atomic_store32_explicit(&m_state, READ_VIEW_STATE_OPEN,
- MY_MEMORY_ORDER_RELEASE);
+ m_state.store(READ_VIEW_STATE_OPEN, std::memory_order_release);
}
@@ -284,7 +282,7 @@ void trx_sys_t::clone_oldest_view()
for (const trx_t *trx= UT_LIST_GET_FIRST(trx_list); trx;
trx= UT_LIST_GET_NEXT(trx_list, trx))
{
- int32_t state;
+ uint32_t state;
while ((state= trx->read_view.get_state()) == READ_VIEW_STATE_SNAPSHOT)
ut_delay(1);
diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc
index 34f71c86bbe..623d0bd1aa9 100644
--- a/storage/innobase/rem/rem0cmp.cc
+++ b/storage/innobase/rem/rem0cmp.cc
@@ -23,17 +23,11 @@ Comparison services for records
Created 7/1/1994 Heikki Tuuri
************************************************************************/
-#include "ha_prototypes.h"
-
#include "rem0cmp.h"
+#include "rem0rec.h"
+#include "page0page.h"
+#include "dict0mem.h"
#include "handler0alter.h"
-#include "srv0srv.h"
-
-#include <gstream.h>
-#include <spatial.h>
-#include <gis0geo.h>
-#include <page0cur.h>
-#include <algorithm>
/* ALPHABETICAL ORDER
==================
@@ -794,20 +788,23 @@ cmp_dtuple_rec_with_match_bytes(
ulint* matched_fields,
ulint* matched_bytes)
{
- ulint n_cmp = dtuple_get_n_fields_cmp(dtuple);
- ulint cur_field; /* current field number */
- ulint cur_bytes;
- int ret; /* return value */
-
ut_ad(dtuple_check_typed(dtuple));
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!(REC_INFO_MIN_REC_FLAG
& dtuple_get_info_bits(dtuple)));
- ut_ad(!(REC_INFO_MIN_REC_FLAG
- & rec_get_info_bits(rec, rec_offs_comp(offsets))));
- cur_field = *matched_fields;
- cur_bytes = *matched_bytes;
+ if (UNIV_UNLIKELY(REC_INFO_MIN_REC_FLAG
+ & rec_get_info_bits(rec, rec_offs_comp(offsets)))) {
+ ut_ad(page_rec_is_first(rec, page_align(rec)));
+ ut_ad(!page_has_prev(page_align(rec)));
+ ut_ad(rec_is_metadata(rec, *index));
+ return 1;
+ }
+
+ ulint cur_field = *matched_fields;
+ ulint cur_bytes = *matched_bytes;
+ ulint n_cmp = dtuple_get_n_fields_cmp(dtuple);
+ int ret;
ut_ad(n_cmp <= dtuple_get_n_fields(dtuple));
ut_ad(cur_field <= n_cmp);
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index c473bb8ff64..19764318c1a 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -26,16 +26,9 @@ Created 5/30/1994 Heikki Tuuri
#include "rem0rec.h"
#include "page0page.h"
-#include "mtr0mtr.h"
#include "mtr0log.h"
#include "fts0fts.h"
-#ifdef WITH_WSREP
-#include <ha_prototypes.h>
-#endif /* WITH_WSREP */
-#include "gis0geo.h"
#include "trx0sys.h"
-#include "mach0data.h"
-#include "btr0cur.h"
/* PHYSICAL RECORD (OLD STYLE)
===========================
@@ -2641,8 +2634,6 @@ rec_get_trx_id(
const rec_t* rec,
const dict_index_t* index)
{
- ulint trx_id_col
- = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
const byte* trx_id;
ulint len;
mem_heap_t* heap = NULL;
@@ -2650,15 +2641,10 @@ rec_get_trx_id(
rec_offs_init(offsets_);
ulint* offsets = offsets_;
- ut_ad(trx_id_col <= MAX_REF_PARTS);
- ut_ad(dict_index_is_clust(index));
- ut_ad(trx_id_col > 0);
- ut_ad(trx_id_col != ULINT_UNDEFINED);
-
offsets = rec_get_offsets(rec, index, offsets, true,
- trx_id_col + 1, &heap);
+ index->db_trx_id() + 1, &heap);
- trx_id = rec_get_nth_field(rec, offsets, trx_id_col, &len);
+ trx_id = rec_get_nth_field(rec, offsets, index->db_trx_id(), &len);
ut_ad(len == DATA_TRX_ID_LEN);
@@ -2682,6 +2668,8 @@ rec_offs_make_nth_extern(
rec_offs_base(offsets)[1 + n] |= REC_OFFS_EXTERNAL;
}
#ifdef WITH_WSREP
+# include "ha_prototypes.h"
+
int
wsrep_rec_get_foreign_key(
byte *buf, /* out: extracted key */
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index a351a1ae01b..19b6dfd0763 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -24,16 +24,11 @@ Create Full Text Index with (parallel) merge sort
Created 10/13/2010 Jimmy Yang
*******************************************************/
-#include "ha_prototypes.h"
-
-#include "dict0dict.h"
-#include "row0merge.h"
-#include "pars0pars.h"
#include "row0ftsort.h"
+#include "dict0dict.h"
#include "row0merge.h"
#include "row0row.h"
#include "btr0cur.h"
-#include "btr0bulk.h"
#include "fts0plugin.h"
#include "log0crypt.h"
@@ -905,12 +900,12 @@ loop:
merge_file[t_ctx.buf_used]->offset++,
block[t_ctx.buf_used],
crypt_block[t_ctx.buf_used],
- table->space->id)) {
+ table->space_id)) {
error = DB_TEMP_FILE_WRITE_FAIL;
goto func_exit;
}
- UNIV_MEM_INVALID(block[t_ctx.buf_used][0], srv_sort_buf_size);
+ UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size);
buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]);
mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0;
@@ -999,17 +994,16 @@ exit:
merge_file[i]->offset++,
block[i],
crypt_block[i],
- table->space->id)) {
+ table->space_id)) {
error = DB_TEMP_FILE_WRITE_FAIL;
goto func_exit;
}
- UNIV_MEM_INVALID(block[i][0],
- srv_sort_buf_size);
+ UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
if (crypt_block[i]) {
- UNIV_MEM_INVALID(crypt_block[i][0],
- srv_sort_buf_size);
+ UNIV_MEM_INVALID(crypt_block[i],
+ srv_sort_buf_size);
}
}
@@ -1037,7 +1031,7 @@ exit:
psort_info->psort_common->dup,
merge_file[i], block[i], &tmpfd[i],
false, 0.0/* pct_progress */, 0.0/* pct_cost */,
- crypt_block[i], table->space->id);
+ crypt_block[i], table->space_id);
if (error != DB_SUCCESS) {
os_file_close(tmpfd[i]);
@@ -1584,9 +1578,6 @@ row_fts_merge_insert(
dict_table_t* aux_table;
dict_index_t* aux_index;
trx_t* trx;
- byte trx_id_buf[6];
- roll_ptr_t roll_ptr = 0;
- dfield_t* field;
ut_ad(index);
ut_ad(table);
@@ -1697,17 +1688,14 @@ row_fts_merge_insert(
dict_index_get_n_fields(aux_index));
/* Set TRX_ID and ROLL_PTR */
- trx_write_trx_id(trx_id_buf, trx->id);
- field = dtuple_get_nth_field(ins_ctx.tuple, 2);
- dfield_set_data(field, &trx_id_buf, 6);
+ dfield_set_data(dtuple_get_nth_field(ins_ctx.tuple, 2),
+ &reset_trx_id, DATA_TRX_ID_LEN);
+ dfield_set_data(dtuple_get_nth_field(ins_ctx.tuple, 3),
+ &reset_trx_id[DATA_TRX_ID_LEN], DATA_ROLL_PTR_LEN);
- field = dtuple_get_nth_field(ins_ctx.tuple, 3);
- dfield_set_data(field, &roll_ptr, 7);
+ ut_d(ins_ctx.aux_index_id = id);
-#ifdef UNIV_DEBUG
- ins_ctx.aux_index_id = id;
-#endif
- const ulint space = table->space->id;
+ const ulint space = table->space_id;
for (i = 0; i < fts_sort_pll_degree; i++) {
if (psort_info[i].merge_file[id]->n_rec == 0) {
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 8a861d1bf4c..4e9f16a502f 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -24,13 +24,11 @@ Import a tablespace to a running instance.
Created 2012-02-08 by Sunny Bains.
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0import.h"
#include "btr0pcur.h"
-#include "btr0sea.h"
#include "que0que.h"
#include "dict0boot.h"
+#include "dict0load.h"
#include "ibuf0ibuf.h"
#include "pars0pars.h"
#include "row0sel.h"
@@ -39,7 +37,6 @@ Created 2012-02-08 by Sunny Bains.
#include "row0quiesce.h"
#include "fil0pagecompress.h"
#include "trx0undo.h"
-#include "ut0new.h"
#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
#endif
@@ -2053,7 +2050,7 @@ row_import_discard_changes(
table->file_unreadable = true;
if (table->space) {
- fil_close_tablespace(trx, table->space->id);
+ fil_close_tablespace(trx, table->space_id);
table->space = NULL;
}
}
@@ -2227,17 +2224,15 @@ row_import_adjust_root_pages_of_secondary_indexes(
}
/*****************************************************************//**
-Ensure that dict_sys->row_id exceeds SELECT MAX(DB_ROW_ID).
-@return error code */
-static MY_ATTRIBUTE((nonnull, warn_unused_result))
-dberr_t
+Ensure that dict_sys->row_id exceeds SELECT MAX(DB_ROW_ID). */
+MY_ATTRIBUTE((nonnull)) static
+void
row_import_set_sys_max_row_id(
/*==========================*/
row_prebuilt_t* prebuilt, /*!< in/out: prebuilt from
handler */
const dict_table_t* table) /*!< in: table to import */
{
- dberr_t err;
const rec_t* rec;
mtr_t mtr;
btr_pcur_t pcur;
@@ -2245,7 +2240,8 @@ row_import_set_sys_max_row_id(
dict_index_t* index;
index = dict_table_get_first_index(table);
- ut_a(dict_index_is_clust(index));
+ ut_ad(index->is_primary());
+ ut_ad(dict_index_is_auto_gen_clust(index));
mtr_start(&mtr);
@@ -2266,57 +2262,17 @@ row_import_set_sys_max_row_id(
/* Check for empty table. */
if (page_rec_is_infimum(rec)) {
/* The table is empty. */
- err = DB_SUCCESS;
} else if (rec_is_metadata(rec, *index)) {
/* The clustered index contains the metadata record only,
that is, the table is empty. */
- err = DB_SUCCESS;
} else {
- ulint len;
- const byte* field;
- mem_heap_t* heap = NULL;
- ulint offsets_[1 + REC_OFFS_HEADER_SIZE];
- ulint* offsets;
-
- rec_offs_init(offsets_);
-
- offsets = rec_get_offsets(
- rec, index, offsets_, true, ULINT_UNDEFINED, &heap);
-
- field = rec_get_nth_field(
- rec, offsets,
- dict_index_get_sys_col_pos(index, DATA_ROW_ID),
- &len);
-
- if (len == DATA_ROW_ID_LEN) {
- row_id = mach_read_from_6(field);
- err = DB_SUCCESS;
- } else {
- err = DB_CORRUPTION;
- }
-
- if (heap != NULL) {
- mem_heap_free(heap);
- }
+ row_id = mach_read_from_6(rec);
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
- DBUG_EXECUTE_IF("ib_import_set_max_rowid_failure",
- err = DB_CORRUPTION;);
-
- if (err != DB_SUCCESS) {
- ib_errf(prebuilt->trx->mysql_thd,
- IB_LOG_LEVEL_WARN,
- ER_INNODB_INDEX_CORRUPT,
- "Index `%s` corruption detected, invalid DB_ROW_ID"
- " in index.", index->name());
-
- return(err);
-
- } else if (row_id > 0) {
-
+ if (row_id) {
/* Update the system row id if the imported index row id is
greater than the max system row id. */
@@ -2329,8 +2285,6 @@ row_import_set_sys_max_row_id(
mutex_exit(&dict_sys->mutex);
}
-
- return(DB_SUCCESS);
}
/*****************************************************************//**
@@ -3436,9 +3390,7 @@ not_encrypted:
}
} else {
if (!fil_space_verify_crypt_checksum(
- src, callback.get_page_size(),
- block->page.id.space(),
- block->page.id.page_no())) {
+ src, callback.get_page_size())) {
goto page_corrupted;
}
@@ -4076,12 +4028,7 @@ row_import_for_mysql(
any DB_ROW_ID stored in the table. */
if (prebuilt->clust_index_was_generated) {
-
- err = row_import_set_sys_max_row_id(prebuilt, table);
-
- if (err != DB_SUCCESS) {
- return(row_import_error(prebuilt, trx, err));
- }
+ row_import_set_sys_max_row_id(prebuilt, table);
}
ib::info() << "Phase III - Flush changes to disk";
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 777d69cf127..682989ac701 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -24,11 +24,8 @@ Insert into a table
Created 4/20/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0ins.h"
#include "dict0dict.h"
-#include "dict0boot.h"
#include "trx0rec.h"
#include "trx0undo.h"
#include "btr0btr.h"
@@ -38,7 +35,6 @@ Created 4/20/1996 Heikki Tuuri
#include "que0que.h"
#include "row0upd.h"
#include "row0sel.h"
-#include "row0row.h"
#include "row0log.h"
#include "rem0cmp.h"
#include "lock0lock.h"
@@ -48,8 +44,9 @@ Created 4/20/1996 Heikki Tuuri
#include "buf0lru.h"
#include "fts0fts.h"
#include "fts0types.h"
-#include "m_string.h"
-#include "gis0geo.h"
+#ifdef WITH_WSREP
+#include "wsrep_mysqld.h"
+#endif /* WITH_WSREP */
/*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there
@@ -334,7 +331,7 @@ row_ins_clust_index_entry_by_modify(
{
const rec_t* rec;
upd_t* update;
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
btr_cur_t* cursor = btr_pcur_get_btr_cur(pcur);
TABLE* mysql_table = NULL;
ut_ad(dict_index_is_clust(cursor->index));
@@ -357,7 +354,11 @@ row_ins_clust_index_entry_by_modify(
update = row_upd_build_difference_binary(
cursor->index, entry, rec, NULL, true,
- thr_get_trx(thr), heap, mysql_table);
+ thr_get_trx(thr), heap, mysql_table, &err);
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
+
if (mode != BTR_MODIFY_TREE) {
ut_ad((mode & ulint(~BTR_ALREADY_S_LATCHED))
== BTR_MODIFY_LEAF);
@@ -968,11 +969,11 @@ row_ins_foreign_fill_virtual(
if (innobase_allocate_row_for_vcol(thd, index, &v_heap,
&mysql_table,
- &record, &vcol_storage))
- {
+ &record, &vcol_storage)) {
+ if (v_heap) mem_heap_free(v_heap);
*err = DB_OUT_OF_MEMORY;
- goto func_exit;
- }
+ goto func_exit;
+ }
for (ulint i = 0; i < n_v_fld; i++) {
@@ -1049,7 +1050,7 @@ dberr_t wsrep_append_foreign_key(trx_t *trx,
const rec_t* clust_rec,
dict_index_t* clust_index,
ibool referenced,
- ibool shared);
+ Wsrep_service_key_type key_type);
#endif /* WITH_WSREP */
/*********************************************************************//**
@@ -1276,8 +1277,10 @@ row_ins_foreign_check_on_constraint(
}
if (table->fts) {
- doc_id = fts_get_doc_id_from_rec(table, clust_rec,
- clust_index, tmp_heap);
+ doc_id = fts_get_doc_id_from_rec(
+ clust_rec, clust_index,
+ rec_get_offsets(clust_rec, clust_index, NULL, true,
+ ULINT_UNDEFINED, &tmp_heap));
}
if (node->is_delete
@@ -1434,7 +1437,7 @@ row_ins_foreign_check_on_constraint(
#ifdef WITH_WSREP
err = wsrep_append_foreign_key(trx, foreign, clust_rec, clust_index,
- FALSE, FALSE);
+ FALSE, WSREP_SERVICE_KEY_EXCLUSIVE);
if (err != DB_SUCCESS) {
fprintf(stderr,
"WSREP: foreign key append failed: %d\n", err);
@@ -1815,7 +1818,10 @@ row_ins_check_foreign_constraint(
rec,
check_index,
check_ref,
- (upd_node) ? TRUE : FALSE);
+ (upd_node != NULL
+ && wsrep_protocol_version < 4)
+ ? WSREP_SERVICE_KEY_SHARED
+ : WSREP_SERVICE_KEY_REFERENCE);
#endif /* WITH_WSREP */
goto end_scan;
} else if (foreign->type != 0) {
@@ -2597,25 +2603,32 @@ row_ins_clust_index_entry_low(
} else {
index->set_modified(mtr);
- if (mode == BTR_MODIFY_LEAF
- && dict_index_is_online_ddl(index)) {
- mode = BTR_MODIFY_LEAF_ALREADY_S_LATCHED;
- mtr_s_lock(dict_index_get_lock(index), &mtr);
- }
+ if (UNIV_UNLIKELY(entry->is_metadata())) {
+ ut_ad(index->is_instant());
+ ut_ad(!dict_index_is_online_ddl(index));
+ ut_ad(mode == BTR_MODIFY_TREE);
+ } else {
+ if (mode == BTR_MODIFY_LEAF
+ && dict_index_is_online_ddl(index)) {
+ mode = BTR_MODIFY_LEAF_ALREADY_S_LATCHED;
+ mtr_s_lock(dict_index_get_lock(index), &mtr);
+ }
- if (unsigned ai = index->table->persistent_autoinc) {
- /* Prepare to persist the AUTO_INCREMENT value
- from the index entry to PAGE_ROOT_AUTO_INC. */
- const dfield_t* dfield = dtuple_get_nth_field(
- entry, ai - 1);
- auto_inc = dfield_is_null(dfield)
- ? 0
- : row_parse_int(static_cast<const byte*>(
+ if (unsigned ai = index->table->persistent_autoinc) {
+ /* Prepare to persist the AUTO_INCREMENT value
+ from the index entry to PAGE_ROOT_AUTO_INC. */
+ const dfield_t* dfield = dtuple_get_nth_field(
+ entry, ai - 1);
+ if (!dfield_is_null(dfield)) {
+ auto_inc = row_parse_int(
+ static_cast<const byte*>(
dfield->data),
dfield->len,
dfield->type.mtype,
dfield->type.prtype
& DATA_UNSIGNED);
+ }
+ }
}
}
@@ -3225,9 +3238,27 @@ row_ins_clust_index_entry(
n_uniq = dict_index_is_unique(index) ? index->n_uniq : 0;
+#ifdef WITH_WSREP
+ const bool skip_locking
+ = wsrep_thd_skip_locking(thr_get_trx(thr)->mysql_thd);
+ ulint flags = index->table->no_rollback() ? BTR_NO_ROLLBACK
+ : (index->table->is_temporary() || skip_locking)
+ ? BTR_NO_LOCKING_FLAG : 0;
+#ifdef UNIV_DEBUG
+ if (skip_locking && strcmp(wsrep_get_sr_table_name(),
+ index->table->name.m_name)) {
+ WSREP_ERROR("Record locking is disabled in this thread, "
+ "but the table being modified is not "
+ "`%s`: `%s`.", wsrep_get_sr_table_name(),
+ index->table->name.m_name);
+ ut_error;
+ }
+#endif /* UNIV_DEBUG */
+#else
ulint flags = index->table->no_rollback() ? BTR_NO_ROLLBACK
: index->table->is_temporary()
? BTR_NO_LOCKING_FLAG : 0;
+#endif /* WITH_WSREP */
const ulint orig_n_fields = entry->n_fields;
/* Try first optimistic descent to the B-tree */
@@ -3459,8 +3490,9 @@ row_ins_index_entry_set_vals(
field->type.prtype = DATA_BINARY_TYPE;
} else {
ut_ad(col->len <= sizeof field_ref_zero);
+ ut_ad(ind_field->fixed_len <= col->len);
dfield_set_data(field, field_ref_zero,
- col->len);
+ ind_field->fixed_len);
field->type.prtype = DATA_NOT_NULL;
}
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 07772fc5468..09df80f789d 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -35,7 +35,6 @@ Created 2011-05-26 Marko Makela
#include "que0que.h"
#include "srv0mon.h"
#include "handler0alter.h"
-#include "ut0new.h"
#include "ut0stage.h"
#include "trx0rec.h"
@@ -43,7 +42,7 @@ Created 2011-05-26 Marko Makela
#include <algorithm>
#include <map>
-ulint onlineddl_rowlog_rows;
+Atomic_counter<ulint> onlineddl_rowlog_rows;
ulint onlineddl_rowlog_pct_used;
ulint onlineddl_pct_progress;
@@ -436,7 +435,7 @@ row_log_online_op(
if (!log_tmp_block_encrypt(
buf, srv_sort_buf_size,
log->crypt_tail, byte_offset,
- index->table->space->id)) {
+ index->table->space_id)) {
log->error = DB_DECRYPTION_FAILED;
goto write_failed;
}
@@ -574,7 +573,7 @@ row_log_table_close_func(
if (!log_tmp_block_encrypt(
log->tail.block, srv_sort_buf_size,
log->crypt_tail, byte_offset,
- index->table->space->id)) {
+ index->table->space_id)) {
log->error = DB_DECRYPTION_FAILED;
goto err_exit;
}
@@ -606,7 +605,7 @@ write_failed:
err_exit:
mutex_exit(&log->mutex);
- my_atomic_addlint(&onlineddl_rowlog_rows, 1);
+ onlineddl_rowlog_rows++;
/* 10000 means 100.00%, 4525 means 45.25% */
onlineddl_rowlog_pct_used = static_cast<ulint>((log->tail.total * 10000) / srv_online_max_size);
}
@@ -1244,19 +1243,16 @@ row_log_table_get_pk(
ulint trx_id_offs = index->trx_id_offset;
if (!trx_id_offs) {
- ulint pos = dict_index_get_sys_col_pos(
- index, DATA_TRX_ID);
ulint len;
- ut_ad(pos > 0);
if (!offsets) {
offsets = rec_get_offsets(
rec, index, NULL, true,
- pos + 1, heap);
+ index->db_trx_id() + 1, heap);
}
trx_id_offs = rec_get_nth_field_offs(
- offsets, pos, &len);
+ offsets, index->db_trx_id(), &len);
ut_ad(len == DATA_TRX_ID_LEN);
}
@@ -2238,7 +2234,10 @@ func_exit_committed:
row, NULL, index, heap, ROW_BUILD_NORMAL);
upd_t* update = row_upd_build_difference_binary(
index, entry, btr_pcur_get_rec(&pcur), cur_offsets,
- false, NULL, heap, dup->table);
+ false, NULL, heap, dup->table, &error);
+ if (error != DB_SUCCESS) {
+ goto func_exit;
+ }
if (!update->n_fields) {
/* Nothing to do. */
@@ -2875,7 +2874,7 @@ all_done:
if (!log_tmp_block_decrypt(
buf, srv_sort_buf_size,
index->online_log->crypt_head,
- ofs, index->table->space->id)) {
+ ofs, index->table->space_id)) {
error = DB_DECRYPTION_FAILED;
goto func_exit;
}
@@ -3779,7 +3778,7 @@ all_done:
if (!log_tmp_block_decrypt(
buf, srv_sort_buf_size,
index->online_log->crypt_head,
- ofs, index->table->space->id)) {
+ ofs, index->table->space_id)) {
error = DB_DECRYPTION_FAILED;
goto func_exit;
}
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index fa369566d9a..50d70b22a5a 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -30,8 +30,6 @@ Completed by Sunny Bains and Marko Makela
#include <math.h>
-#include "ha_prototypes.h"
-
#include "row0merge.h"
#include "row0ext.h"
#include "row0log.h"
@@ -49,8 +47,6 @@ Completed by Sunny Bains and Marko Makela
#include "row0vers.h"
#include "handler0alter.h"
#include "btr0bulk.h"
-#include "fsp0sysspace.h"
-#include "ut0new.h"
#include "ut0stage.h"
#include "fil0crypt.h"
@@ -119,14 +115,12 @@ public:
@param[in,out] row_heap memory heap
@param[in] pcur cluster index scanning cursor
@param[in,out] scan_mtr mini-transaction for pcur
- @param[out] mtr_committed whether scan_mtr got committed
@return DB_SUCCESS if successful, else error number */
- dberr_t insert(
+ inline dberr_t insert(
trx_id_t trx_id,
mem_heap_t* row_heap,
btr_pcur_t* pcur,
- mtr_t* scan_mtr,
- bool* mtr_committed)
+ mtr_t* scan_mtr)
{
big_rec_t* big_rec;
rec_t* rec;
@@ -154,11 +148,10 @@ public:
ut_ad(dtuple);
if (log_sys.check_flush_or_checkpoint) {
- if (!(*mtr_committed)) {
+ if (scan_mtr->is_active()) {
btr_pcur_move_to_prev_on_page(pcur);
btr_pcur_store_position(pcur, scan_mtr);
- mtr_commit(scan_mtr);
- *mtr_committed = true;
+ scan_mtr->commit();
}
log_free_check();
@@ -1593,7 +1586,6 @@ row_mtuple_cmp(
@param[in,out] sp_heap heap for tuples
@param[in,out] pcur cluster index cursor
@param[in,out] mtr mini transaction
-@param[in,out] mtr_committed whether scan_mtr got committed
@return DB_SUCCESS or error number */
static
dberr_t
@@ -1604,8 +1596,7 @@ row_merge_spatial_rows(
mem_heap_t* row_heap,
mem_heap_t* sp_heap,
btr_pcur_t* pcur,
- mtr_t* mtr,
- bool* mtr_committed)
+ mtr_t* mtr)
{
dberr_t err = DB_SUCCESS;
@@ -1616,9 +1607,7 @@ row_merge_spatial_rows(
ut_ad(sp_heap != NULL);
for (ulint j = 0; j < num_spatial; j++) {
- err = sp_tuples[j]->insert(
- trx_id, row_heap,
- pcur, mtr, mtr_committed);
+ err = sp_tuples[j]->insert(trx_id, row_heap, pcur, mtr);
if (err != DB_SUCCESS) {
return(err);
@@ -1722,7 +1711,7 @@ row_merge_read_clustered_index(
bool allow_not_null)
{
dict_index_t* clust_index; /* Clustered index */
- mem_heap_t* row_heap; /* Heap memory to create
+ mem_heap_t* row_heap = NULL;/* Heap memory to create
clustered index tuples */
row_merge_buf_t** merge_buf; /* Temporary list for records*/
mem_heap_t* v_heap = NULL; /* Heap memory to process large
@@ -1937,6 +1926,13 @@ row_merge_read_clustered_index(
/* Scan the clustered index. */
for (;;) {
+ /* Do not continue if table pages are still encrypted */
+ if (!old_table->is_readable() || !new_table->is_readable()) {
+ err = DB_DECRYPTION_FAILED;
+ trx->error_key_num = 0;
+ goto func_exit;
+ }
+
const rec_t* rec;
trx_id_t rec_trx_id;
ulint* offsets;
@@ -1946,16 +1942,6 @@ row_merge_read_clustered_index(
mem_heap_empty(row_heap);
- /* Do not continue if table pages are still encrypted */
- if (!old_table->is_readable() ||
- !new_table->is_readable()) {
- err = DB_DECRYPTION_FAILED;
- trx->error_key_num = 0;
- goto func_exit;
- }
-
- mem_heap_empty(row_heap);
-
page_cur_move_to_next(cur);
stage->n_pk_recs_inc();
@@ -1979,23 +1965,20 @@ row_merge_read_clustered_index(
}
/* Insert the cached spatial index rows. */
- bool mtr_committed = false;
-
err = row_merge_spatial_rows(
trx->id, sp_tuples, num_spatial,
- row_heap, sp_heap, &pcur,
- &mtr, &mtr_committed);
+ row_heap, sp_heap, &pcur, &mtr);
if (err != DB_SUCCESS) {
goto func_exit;
}
- if (mtr_committed) {
+ if (!mtr.is_active()) {
goto scan_next;
}
- if (my_atomic_load32_explicit(&clust_index->lock.waiters,
- MY_MEMORY_ORDER_RELAXED)) {
+ if (clust_index->lock.waiters.load(
+ std::memory_order_relaxed)) {
/* There are waiters on the clustered
index tree lock, likely the purge
thread. Store and restore the cursor
@@ -2033,7 +2016,9 @@ end_of_index:
row = NULL;
mtr_commit(&mtr);
mem_heap_free(row_heap);
+ row_heap = NULL;
ut_free(nonnull);
+ nonnull = NULL;
goto write_buffers;
}
} else {
@@ -2479,8 +2464,6 @@ write_buffers:
/* Temporary File is not used.
so insert sorted block to the index */
if (row != NULL) {
- bool mtr_committed = false;
-
/* We have to do insert the
cached spatial index rows, since
after the mtr_commit, the cluster
@@ -2491,8 +2474,7 @@ write_buffers:
trx->id, sp_tuples,
num_spatial,
row_heap, sp_heap,
- &pcur, &mtr,
- &mtr_committed);
+ &pcur, &mtr);
if (err != DB_SUCCESS) {
goto func_exit;
@@ -2507,13 +2489,13 @@ write_buffers:
current row will be invalid, and
we must reread it on the next
loop iteration. */
- if (!mtr_committed) {
+ if (mtr.is_active()) {
btr_pcur_move_to_prev_on_page(
&pcur);
btr_pcur_store_position(
&pcur, &mtr);
- mtr_commit(&mtr);
+ mtr.commit();
}
}
@@ -2542,7 +2524,7 @@ write_buffers:
curr_progress,
pct_cost,
crypt_block,
- new_table->space->id);
+ new_table->space_id);
if (row == NULL) {
err = clust_btr_bulk->finish(
@@ -2653,7 +2635,7 @@ write_buffers:
curr_progress,
pct_cost,
crypt_block,
- new_table->space->id);
+ new_table->space_id);
err = btr_bulk.finish(err);
@@ -2670,7 +2652,7 @@ write_buffers:
buf->n_tuples, path)) {
err = DB_OUT_OF_MEMORY;
trx->error_key_num = i;
- goto func_exit;
+ break;
}
/* Ensure that duplicates in the
@@ -2687,7 +2669,7 @@ write_buffers:
if (!row_merge_write(
file->fd, file->offset++,
block, crypt_block,
- new_table->space->id)) {
+ new_table->space_id)) {
err = DB_TEMP_FILE_WRITE_FAIL;
trx->error_key_num = i;
break;
@@ -2752,12 +2734,12 @@ write_buffers:
}
func_exit:
- /* row_merge_spatial_rows may have committed
- the mtr before an error occurs. */
if (mtr.is_active()) {
mtr_commit(&mtr);
}
- mem_heap_free(row_heap);
+ if (row_heap) {
+ mem_heap_free(row_heap);
+ }
ut_free(nonnull);
all_done:
@@ -4307,7 +4289,7 @@ row_make_new_pathname(
dict_table_t* table, /*!< in: table to be renamed */
const char* new_name) /*!< in: new name */
{
- ut_ad(!is_system_tablespace(table->space->id));
+ ut_ad(!is_system_tablespace(table->space_id));
return os_file_make_new_pathname(table->space->chain.start->name,
new_name);
}
@@ -4542,7 +4524,7 @@ row_merge_write_redo(
log_ptr = mlog_open(&mtr, 11 + 8);
log_ptr = mlog_write_initial_log_record_low(
MLOG_INDEX_LOAD,
- index->table->space->id, index->page, log_ptr, &mtr);
+ index->table->space_id, index->page, log_ptr, &mtr);
mach_write_to_8(log_ptr, index->id);
mlog_close(&mtr, log_ptr + 8);
mtr.commit();
@@ -4900,7 +4882,7 @@ wait_again:
trx, &dup, &merge_files[i],
block, &tmpfd, true,
pct_progress, pct_cost,
- crypt_block, new_table->space->id,
+ crypt_block, new_table->space_id,
stage);
pct_progress += pct_cost;
@@ -4943,7 +4925,7 @@ wait_again:
merge_files[i].fd, block, NULL,
&btr_bulk,
merge_files[i].n_rec, pct_progress, pct_cost,
- crypt_block, new_table->space->id,
+ crypt_block, new_table->space_id,
stage);
error = btr_bulk.finish(error);
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 01bc344588a..28c6a1abf21 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -25,7 +25,7 @@ Contains also create table and other data dictionary operations.
Created 9/17/2000 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
+#include "univ.i"
#include <debug_sync.h>
#include <gstream.h>
#include <spatial.h>
@@ -34,7 +34,6 @@ Created 9/17/2000 Heikki Tuuri
#include "btr0sea.h"
#include "dict0boot.h"
#include "dict0crea.h"
-#include <sql_const.h>
#include "dict0dict.h"
#include "dict0load.h"
#include "dict0priv.h"
@@ -45,7 +44,6 @@ Created 9/17/2000 Heikki Tuuri
#include "fil0fil.h"
#include "fil0crypt.h"
#include "fsp0file.h"
-#include "fsp0sysspace.h"
#include "fts0fts.h"
#include "fts0types.h"
#include "ibuf0ibuf.h"
@@ -67,7 +65,6 @@ Created 9/17/2000 Heikki Tuuri
#include "srv0start.h"
#include "row0ext.h"
#include "srv0start.h"
-#include "ut0new.h"
#include <algorithm>
#include <deque>
@@ -2466,7 +2463,7 @@ err_exit:
/* We already have .ibd file here. it should be deleted. */
if (dict_table_is_file_per_table(table)
- && fil_delete_tablespace(table->space->id) != DB_SUCCESS) {
+ && fil_delete_tablespace(table->space_id) != DB_SUCCESS) {
ib::error() << "Cannot delete the file of table "
<< table->name;
}
@@ -2489,9 +2486,8 @@ err_exit:
}
/*********************************************************************//**
-Does an index creation operation for MySQL. TODO: currently failure
-to create an index results in dropping the whole table! This is no problem
-currently as all indexes must be created at the same time as the table.
+Create an index when creating a table.
+On failure, the caller must drop the table!
@return error number or DB_SUCCESS */
dberr_t
row_create_index_for_mysql(
@@ -2514,16 +2510,9 @@ row_create_index_for_mysql(
ulint len;
dict_table_t* table = index->table;
- trx->op_info = "creating index";
-
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
-
- if (!table->is_temporary()) {
- trx_start_if_not_started_xa(trx, true);
- }
-
for (i = 0; i < index->n_def; i++) {
/* Check that prefix_len and actual length
< DICT_MAX_INDEX_COL_LEN */
@@ -2541,19 +2530,19 @@ row_create_index_for_mysql(
/* Column or prefix length exceeds maximum column length */
if (len > (ulint) DICT_MAX_FIELD_LEN_BY_FORMAT(table)) {
- err = DB_TOO_BIG_INDEX_COL;
-
dict_mem_index_free(index);
- goto error_handling;
+ return DB_TOO_BIG_INDEX_COL;
}
}
- trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
+ trx->op_info = "creating index";
/* For temp-table we avoid insertion into SYSTEM TABLES to
maintain performance and so we have separate path that directly
just updates dictonary cache. */
if (!table->is_temporary()) {
+ trx_start_if_not_started_xa(trx, true);
+ trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
/* Note that the space id where we store the index is
inherited from the table in dict_build_index_def_step()
in dict0crea.cc. */
@@ -2600,110 +2589,12 @@ row_create_index_for_mysql(
}
}
- if (err != DB_SUCCESS) {
-error_handling:
- /* We have special error handling here */
-
- trx->error_state = DB_SUCCESS;
-
- if (trx_is_started(trx)) {
- row_drop_table_for_mysql(table->name.m_name, trx,
- SQLCOM_DROP_TABLE, true);
- trx_rollback_to_savepoint(trx, NULL);
- ut_ad(!trx_is_started(trx));
- }
-
- trx->error_state = DB_SUCCESS;
- }
-
trx->op_info = "";
return(err);
}
/*********************************************************************//**
-Scans a table create SQL string and adds to the data dictionary
-the foreign key constraints declared in the string. This function
-should be called after the indexes for a table have been created.
-Each foreign key constraint must be accompanied with indexes in
-bot participating tables. The indexes are allowed to contain more
-fields than mentioned in the constraint.
-
-@param[in] trx transaction (NULL if not adding to dictionary)
-@param[in] sql_string table create statement where
- foreign keys are declared like:
- FOREIGN KEY (a, b) REFERENCES table2(c, d),
- table2 can be written also with the database
- name before it: test.table2; the default
- database id the database of parameter name
-@param[in] sql_length length of sql_string
-@param[in] name table full name in normalized form
-@param[in] reject_fks whether to fail with DB_CANNOT_ADD_CONSTRAINT
- if any foreign keys are found
-@return error code or DB_SUCCESS */
-dberr_t
-row_table_add_foreign_constraints(
- trx_t* trx,
- const char* sql_string,
- size_t sql_length,
- const char* name,
- bool reject_fks)
-{
- dberr_t err;
-
- DBUG_ENTER("row_table_add_foreign_constraints");
-
- ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
- ut_a(sql_string);
-
- if (trx) {
- err = dict_create_foreign_constraints(
- trx, sql_string, sql_length, name, reject_fks);
-
- DBUG_EXECUTE_IF("ib_table_add_foreign_fail",
- err = DB_DUPLICATE_KEY;);
-
- DEBUG_SYNC_C("table_add_foreign_constraints");
- } else {
- err = DB_SUCCESS;
- }
-
- if (err == DB_SUCCESS) {
- /* Check that also referencing constraints are ok */
- dict_names_t fk_tables;
- err = dict_load_foreigns(name, NULL, false, true,
- DICT_ERR_IGNORE_NONE, fk_tables);
-
- while (err == DB_SUCCESS && !fk_tables.empty()) {
- dict_load_table(fk_tables.front(), true,
- DICT_ERR_IGNORE_NONE);
- fk_tables.pop_front();
- }
- }
-
- if (err != DB_SUCCESS && trx) {
- /* We have special error handling here */
-
- trx->error_state = DB_SUCCESS;
-
- if (trx_is_started(trx)) {
- /* FIXME: Introduce an undo log record for
- creating tablespaces and data files, so that
- they would be deleted on rollback. */
- row_drop_table_for_mysql(name, trx, SQLCOM_DROP_TABLE,
- true);
- trx_rollback_to_savepoint(trx, NULL);
- ut_ad(!trx_is_started(trx));
- }
-
- trx->error_state = DB_SUCCESS;
- }
-
- DBUG_RETURN(err);
-}
-
-/*********************************************************************//**
Drops a table for MySQL as a background operation. MySQL relies on Unix
in ALTER TABLE to the fact that the table handler does not remove the
table before all handles to it has been removed. Furhermore, the MySQL's
@@ -2951,11 +2842,15 @@ row_mysql_table_id_reassign(
dberr_t err;
pars_info_t* info = pars_info_create();
- dict_hdr_get_new_id(new_id, NULL, NULL, table, false);
+ dict_hdr_get_new_id(new_id, NULL, NULL);
pars_info_add_ull_literal(info, "old_id", table->id);
pars_info_add_ull_literal(info, "new_id", *new_id);
+ /* Note: This cannot be rolled back. Rollback would see the
+ UPDATE SYS_INDEXES as two operations: DELETE and INSERT.
+ It would invoke btr_free_if_exists() when rolling back the
+ INSERT, effectively dropping all indexes of the table. */
err = que_eval_sql(
info,
"PROCEDURE RENUMBER_TABLE_PROC () IS\n"
@@ -3244,6 +3139,12 @@ row_discard_tablespace_for_mysql(
err = row_discard_tablespace_foreign_key_checks(trx, table);
if (err == DB_SUCCESS) {
+ /* Note: This cannot be rolled back.
+ Rollback would see the UPDATE SYS_INDEXES
+ as two operations: DELETE and INSERT.
+ It would invoke btr_free_if_exists()
+ when rolling back the INSERT, effectively
+ dropping all indexes of the table. */
err = row_discard_tablespace(trx, table);
}
}
@@ -3414,6 +3315,7 @@ row_drop_table_for_mysql(
pars_info_t* info = NULL;
mem_heap_t* heap = NULL;
+
DBUG_ENTER("row_drop_table_for_mysql");
DBUG_PRINT("row_drop_table_for_mysql", ("table: '%s'", name));
@@ -3444,10 +3346,16 @@ row_drop_table_for_mysql(
| DICT_ERR_IGNORE_CORRUPT));
if (!table) {
- err = DB_TABLE_NOT_FOUND;
- goto funct_exit_all_freed;
+ if (locked_dictionary) {
+ row_mysql_unlock_data_dictionary(trx);
+ }
+ trx->op_info = "";
+ DBUG_RETURN(DB_TABLE_NOT_FOUND);
}
+ const bool is_temp_name = strstr(table->name.m_name,
+ "/" TEMP_FILE_PREFIX);
+
if (table->is_temporary()) {
ut_ad(table->space == fil_system.temp_space);
for (dict_index_t* index = dict_table_get_first_index(table);
@@ -3503,7 +3411,6 @@ row_drop_table_for_mysql(
/* make sure background stats thread is not running on the table */
ut_ad(!(table->stats_bg_flag & BG_STAT_IN_PROGRESS));
-
if (!table->no_rollback()) {
if (table->space != fil_system.sys_space) {
#ifdef BTR_CUR_HASH_ADAPT
@@ -3518,8 +3425,11 @@ row_drop_table_for_mysql(
calling btr_search_drop_page_hash_index() while we
hold the InnoDB dictionary lock, we will drop any
adaptive hash index entries upfront. */
+ bool immune = is_temp_name
+ || strstr(table->name.m_name, "/FTS");
+
while (buf_LRU_drop_page_hash_for_tablespace(table)) {
- if (trx_is_interrupted(trx)
+ if ((!immune && trx_is_interrupted(trx))
|| srv_shutdown_state
!= SRV_SHUTDOWN_NONE) {
err = DB_INTERRUPTED;
@@ -3610,7 +3520,6 @@ row_drop_table_for_mysql(
}
}
-
DBUG_EXECUTE_IF("row_drop_table_add_to_background", goto defer;);
/* TODO: could we replace the counter n_foreign_key_checks_running
@@ -3621,7 +3530,7 @@ row_drop_table_for_mysql(
if (table->n_foreign_key_checks_running > 0) {
defer:
- if (!strstr(table->name.m_name, "/" TEMP_FILE_PREFIX)) {
+ if (!is_temp_name) {
heap = mem_heap_create(FN_REFLEN);
const char* tmp_name
= dict_mem_create_temporary_tablename(
@@ -3629,7 +3538,8 @@ defer:
ib::info() << "Deferring DROP TABLE " << table->name
<< "; renaming to " << tmp_name;
err = row_rename_table_for_mysql(
- table->name.m_name, tmp_name, trx, false);
+ table->name.m_name, tmp_name, trx,
+ false, false);
} else {
err = DB_SUCCESS;
}
@@ -3801,7 +3711,7 @@ do_drop:
&& dict_table_get_low("SYS_DATAFILES")) {
info = pars_info_create();
pars_info_add_int4_literal(info, "id",
- lint(table->space->id));
+ lint(table->space_id));
err = que_eval_sql(
info,
"PROCEDURE DROP_SPACE_PROC () IS\n"
@@ -4254,7 +4164,9 @@ row_rename_table_for_mysql(
const char* old_name, /*!< in: old table name */
const char* new_name, /*!< in: new table name */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: whether to commit trx */
+ bool commit, /*!< in: whether to commit trx */
+ bool use_fk) /*!< in: whether to parse and enforce
+ FOREIGN KEY constraints */
{
dict_table_t* table = NULL;
ibool dict_locked = FALSE;
@@ -4358,7 +4270,7 @@ row_rename_table_for_mysql(
goto funct_exit;
- } else if (!old_is_tmp && new_is_tmp) {
+ } else if (use_fk && !old_is_tmp && new_is_tmp) {
/* MySQL is doing an ALTER TABLE command and it renames the
original table to a temporary table name. We want to preserve
the original foreign key constraint definitions despite the
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 40488f458b2..f0652ed3d54 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -127,33 +127,32 @@ row_purge_remove_clust_if_poss_low(
purge_node_t* node, /*!< in/out: row purge node */
ulint mode) /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
{
- dict_index_t* index;
- bool success = true;
- mtr_t mtr;
- rec_t* rec;
- mem_heap_t* heap = NULL;
- ulint* offsets;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- rec_offs_init(offsets_);
-
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S)
|| node->vcol_info.is_used());
- index = dict_table_get_first_index(node->table);
+ dict_index_t* index = dict_table_get_first_index(node->table);
log_free_check();
- mtr_start(&mtr);
- index->set_modified(mtr);
+
+ mtr_t mtr;
+ mtr.start();
if (!row_purge_reposition_pcur(mode, node, &mtr)) {
/* The record was already removed. */
- goto func_exit;
+ mtr.commit();
+ return true;
}
- rec = btr_pcur_get_rec(&node->pcur);
+ ut_d(const bool was_instant = !!index->table->instant);
+ index->set_modified(mtr);
- offsets = rec_get_offsets(
+ rec_t* rec = btr_pcur_get_rec(&node->pcur);
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs_init(offsets_);
+ mem_heap_t* heap = NULL;
+ ulint* offsets = rec_get_offsets(
rec, index, offsets_, true, ULINT_UNDEFINED, &heap);
+ bool success = true;
if (node->roll_ptr != row_get_rec_roll_ptr(rec, index, offsets)) {
/* Someone else has modified the record later: do not remove */
@@ -186,6 +185,10 @@ row_purge_remove_clust_if_poss_low(
}
}
+ /* Prove that dict_index_t::clear_instant_alter() was
+ not called with index->table->instant != NULL. */
+ ut_ad(!was_instant || index->table->instant);
+
func_exit:
if (heap) {
mem_heap_free(heap);
diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc
index 074e023795c..d77cc1e33dc 100644
--- a/storage/innobase/row/row0quiesce.cc
+++ b/storage/innobase/row/row0quiesce.cc
@@ -24,14 +24,11 @@ Quiesce a tablespace.
Created 2012-02-08 by Sunny Bains.
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0quiesce.h"
#include "row0mysql.h"
#include "ibuf0ibuf.h"
#include "srv0start.h"
#include "trx0purge.h"
-#include "fsp0sysspace.h"
#ifdef HAVE_MY_AES_H
#include <my_aes.h>
@@ -144,7 +141,7 @@ row_quiesce_write_indexes(
mach_write_to_8(ptr, index->id);
ptr += sizeof(index_id_t);
- mach_write_to_4(ptr, table->space->id);
+ mach_write_to_4(ptr, table->space_id);
ptr += sizeof(ib_uint32_t);
mach_write_to_4(ptr, index->page);
@@ -528,7 +525,7 @@ row_quiesce_table_start(
}
for (ulint count = 0;
- ibuf_merge_space(table->space->id) != 0
+ ibuf_merge_space(table->space_id) != 0
&& !trx_is_interrupted(trx);
++count) {
if (!(count % 20)) {
@@ -540,7 +537,7 @@ row_quiesce_table_start(
if (!trx_is_interrupted(trx)) {
{
FlushObserver observer(table->space, trx, NULL);
- buf_LRU_flush_or_remove_pages(table->space->id,
+ buf_LRU_flush_or_remove_pages(table->space_id,
&observer);
}
@@ -640,7 +637,7 @@ row_quiesce_set_state(
ER_CANNOT_DISCARD_TEMPORARY_TABLE);
return(DB_UNSUPPORTED);
- } else if (table->space->id == TRX_SYS_SPACE) {
+ } else if (table->space_id == TRX_SYS_SPACE) {
char table_name[MAX_FULL_NAME_LEN + 1];
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc
index f5261e63e9a..3c03f8277ae 100644
--- a/storage/innobase/row/row0row.cc
+++ b/storage/innobase/row/row0row.cc
@@ -24,8 +24,6 @@ General row routines
Created 4/20/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0row.h"
#include "data0type.h"
#include "dict0dict.h"
@@ -727,6 +725,7 @@ row_rec_to_index_entry_impl(
ut_ad(heap != NULL);
ut_ad(index != NULL);
ut_ad(!mblob || index->is_primary());
+ ut_ad(!mblob || !index->table->is_temporary());
ut_ad(!mblob || !dict_index_is_spatial(index));
compile_time_assert(!mblob || metadata);
compile_time_assert(mblob <= 2);
@@ -761,7 +760,8 @@ row_rec_to_index_entry_impl(
|| rec_len == dict_index_get_n_fields(index) + uint(mblob == 1)
/* a record for older SYS_INDEXES table
(missing merge_threshold column) is acceptable. */
- || (index->table->id == DICT_INDEXES_ID
+ || (!index->table->is_temporary()
+ && index->table->id == DICT_INDEXES_ID
&& rec_len == dict_index_get_n_fields(index) - 1));
ulint i;
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 73c21d938ae..9471027b1b2 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -53,9 +53,10 @@ Created 12/19/1997 Heikki Tuuri
#include "row0mysql.h"
#include "buf0lru.h"
#include "srv0srv.h"
-#include "ha_prototypes.h"
#include "srv0mon.h"
-#include "ut0new.h"
+#ifdef WITH_WSREP
+#include "mysql/service_wsrep.h" /* For wsrep_thd_skip_locking */
+#endif
/* Maximum number of rows to prefetch; MySQL interface has another parameter */
#define SEL_MAX_N_PREFETCH 16
@@ -256,9 +257,9 @@ row_sel_sec_rec_is_for_clust_rec(
clust_field = static_cast<byte*>(vfield->data);
} else {
clust_pos = dict_col_get_clust_pos(col, clust_index);
- ut_ad(!rec_offs_nth_default(clust_offs, clust_pos));
- clust_field = rec_get_nth_field(
- clust_rec, clust_offs, clust_pos, &clust_len);
+ clust_field = rec_get_nth_cfield(
+ clust_rec, clust_index, clust_offs,
+ clust_pos, &clust_len);
}
sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len);
@@ -1133,7 +1134,7 @@ re_scan:
btr_pcur_get_page(pcur));
cur_block = buf_page_get_gen(
- page_id_t(index->table->space->id, page_no),
+ page_id_t(index->table->space_id, page_no),
page_size_t(index->table->space->flags),
RW_X_LATCH, NULL, BUF_GET,
__FILE__, __LINE__, mtr, &err);
@@ -2695,44 +2696,6 @@ row_sel_convert_mysql_key_to_innobase(
}
/**************************************************************//**
-Stores the row id to the prebuilt struct. */
-static
-void
-row_sel_store_row_id_to_prebuilt(
-/*=============================*/
- row_prebuilt_t* prebuilt, /*!< in/out: prebuilt */
- const rec_t* index_rec, /*!< in: record */
- const dict_index_t* index, /*!< in: index of the record */
- const ulint* offsets) /*!< in: rec_get_offsets
- (index_rec, index) */
-{
- const byte* data;
- ulint len;
-
- ut_ad(rec_offs_validate(index_rec, index, offsets));
-
- data = rec_get_nth_field(
- index_rec, offsets,
- dict_index_get_sys_col_pos(index, DATA_ROW_ID), &len);
-
- if (UNIV_UNLIKELY(len != DATA_ROW_ID_LEN)) {
-
- ib::error() << "Row id field is wrong length " << len << " in"
- " index " << index->name
- << " of table " << index->table->name
- << ", Field number "
- << dict_index_get_sys_col_pos(index, DATA_ROW_ID)
- << ", record:";
-
- rec_print_new(stderr, index_rec, offsets);
- putc('\n', stderr);
- ut_error;
- }
-
- ut_memcpy(prebuilt->row_id, data, len);
-}
-
-/**************************************************************//**
Stores a non-SQL-NULL field in the MySQL format. The counterpart of this
function is row_mysql_store_col_in_innobase_format() in row0mysql.cc. */
void
@@ -2910,15 +2873,6 @@ row_sel_field_store_in_mysql_format_func(
}
}
-#ifdef UNIV_DEBUG
-/** Convert a field from Innobase format to MySQL format. */
-# define row_sel_store_mysql_field(m,p,r,i,o,f,t) \
- row_sel_store_mysql_field_func(m,p,r,i,o,f,t)
-#else /* UNIV_DEBUG */
-/** Convert a field from Innobase format to MySQL format. */
-# define row_sel_store_mysql_field(m,p,r,i,o,f,t) \
- row_sel_store_mysql_field_func(m,p,r,o,f,t)
-#endif /* UNIV_DEBUG */
/** Convert a field in the Innobase format to a field in the MySQL format.
@param[out] mysql_rec record in the MySQL format
@param[in,out] prebuilt prebuilt struct
@@ -2933,13 +2887,11 @@ row_sel_field_store_in_mysql_format_func(
*/
static MY_ATTRIBUTE((warn_unused_result))
ibool
-row_sel_store_mysql_field_func(
+row_sel_store_mysql_field(
byte* mysql_rec,
row_prebuilt_t* prebuilt,
const rec_t* rec,
-#ifdef UNIV_DEBUG
const dict_index_t* index,
-#endif
const ulint* offsets,
ulint field_no,
const mysql_row_templ_t*templ)
@@ -3012,17 +2964,7 @@ row_sel_store_mysql_field_func(
} else {
/* The field is stored in the index record, or
in the metadata for instant ADD COLUMN. */
-
- if (rec_offs_nth_default(offsets, field_no)) {
- ut_ad(dict_index_is_clust(index));
- ut_ad(index->is_instant());
- const dict_index_t* clust_index
- = dict_table_get_first_index(prebuilt->table);
- ut_ad(index == clust_index);
- data = clust_index->instant_field_value(field_no,&len);
- } else {
- data = rec_get_nth_field(rec, offsets, field_no, &len);
- }
+ data = rec_get_nth_cfield(rec, index, offsets, field_no, &len);
if (len == UNIV_SQL_NULL) {
/* MySQL assumes that the field for an SQL
@@ -3214,7 +3156,7 @@ row_sel_store_mysql_rec(
if (dict_index_is_clust(index)
|| prebuilt->fts_doc_id_in_read_set) {
prebuilt->fts_doc_id = fts_get_doc_id_from_rec(
- prebuilt->table, rec, index, NULL);
+ rec, index, offsets);
}
}
@@ -3366,7 +3308,7 @@ row_sel_get_clust_rec_for_mysql(
and is it not unsafe to use RW_NO_LATCH here? */
buf_block_t* block = buf_page_get_gen(
btr_pcur_get_block(prebuilt->pcur)->page.id,
- dict_table_page_size(sec_index->table),
+ btr_pcur_get_block(prebuilt->pcur)->page.size,
RW_NO_LATCH, NULL, BUF_GET,
__FILE__, __LINE__, mtr, &err);
mem_heap_t* heap = mem_heap_create(256);
@@ -4521,6 +4463,13 @@ row_search_mvcc(
set_also_gap_locks = FALSE;
}
+#ifdef WITH_WSREP
+ else if (wsrep_thd_skip_locking(trx->mysql_thd)) {
+ ut_ad(!strcmp(wsrep_get_sr_table_name(),
+ prebuilt->table->name.m_name));
+ set_also_gap_locks = FALSE;
+ }
+#endif /* WITH_WSREP */
/* Note that if the search mode was GE or G, then the cursor
naturally moves upward (in fetch next) in alphabetical order,
@@ -5512,11 +5461,19 @@ use_covering_index:
}
}
- if (prebuilt->clust_index_was_generated) {
- row_sel_store_row_id_to_prebuilt(
- prebuilt, result_rec,
- result_rec == rec ? index : clust_index,
- offsets);
+ if (!prebuilt->clust_index_was_generated) {
+ } else if (result_rec != rec || index->is_primary()) {
+ memcpy(prebuilt->row_id, result_rec, DATA_ROW_ID_LEN);
+ } else {
+ ulint len;
+ const byte* data = rec_get_nth_field(
+ result_rec, offsets, index->n_fields - 1,
+ &len);
+ ut_ad(dict_index_get_nth_col(index,
+ index->n_fields - 1)
+ ->prtype == (DATA_ROW_ID | DATA_NOT_NULL));
+ ut_ad(len == DATA_ROW_ID_LEN);
+ memcpy(prebuilt->row_id, data, DATA_ROW_ID_LEN);
}
}
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index 3a1690782ff..0fdb740db04 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -65,7 +65,6 @@ row_undo_ins_remove_clust_rec(
/*==========================*/
undo_node_t* node) /*!< in: undo node */
{
- btr_cur_t* btr_cur;
ibool success;
dberr_t err;
ulint n_tries = 0;
@@ -73,15 +72,27 @@ row_undo_ins_remove_clust_rec(
dict_index_t* index = node->pcur.btr_cur.index;
bool online;
- ut_ad(dict_index_is_clust(index));
+ ut_ad(index->is_primary());
ut_ad(node->trx->in_rollback);
mtr.start();
if (index->table->is_temporary()) {
ut_ad(node->rec_type == TRX_UNDO_INSERT_REC);
mtr.set_log_mode(MTR_LOG_NO_REDO);
+ ut_ad(!dict_index_is_online_ddl(index));
+ ut_ad(index->table->id >= DICT_HDR_FIRST_ID);
+ online = false;
} else {
index->set_modified(mtr);
+ online = dict_index_is_online_ddl(index);
+ if (online) {
+ ut_ad(node->rec_type == TRX_UNDO_INSERT_REC);
+ ut_ad(node->trx->dict_operation_lock_mode
+ != RW_X_LATCH);
+ ut_ad(node->table->id != DICT_INDEXES_ID);
+ ut_ad(node->table->id != DICT_COLUMNS_ID);
+ mtr_s_lock(dict_index_get_lock(index), &mtr);
+ }
}
/* This is similar to row_undo_mod_clust(). The DDL thread may
@@ -90,79 +101,69 @@ row_undo_ins_remove_clust_rec(
purged. However, we can log the removal out of sync with the
B-tree modification. */
- online = dict_index_is_online_ddl(index);
- if (online) {
- ut_ad(node->trx->dict_operation_lock_mode
- != RW_X_LATCH);
- ut_ad(node->table->id != DICT_INDEXES_ID);
- mtr_s_lock(dict_index_get_lock(index), &mtr);
- }
-
success = btr_pcur_restore_position(
online
? BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED
- : BTR_MODIFY_LEAF, &node->pcur, &mtr);
+ : (node->rec_type == TRX_UNDO_INSERT_METADATA)
+ ? BTR_MODIFY_TREE : BTR_MODIFY_LEAF, &node->pcur, &mtr);
ut_a(success);
- btr_cur = btr_pcur_get_btr_cur(&node->pcur);
+ rec_t* rec = btr_pcur_get_rec(&node->pcur);
- ut_ad(rec_get_trx_id(btr_cur_get_rec(btr_cur), btr_cur->index)
- == node->trx->id);
- ut_ad(!rec_get_deleted_flag(
- btr_cur_get_rec(btr_cur),
- dict_table_is_comp(btr_cur->index->table)));
+ ut_ad(rec_get_trx_id(rec, index) == node->trx->id);
+ ut_ad(!rec_get_deleted_flag(rec, index->table->not_redundant())
+ || rec_is_alter_metadata(rec, index->table->not_redundant()));
+ ut_ad(rec_is_metadata(rec, index->table->not_redundant())
+ == (node->rec_type == TRX_UNDO_INSERT_METADATA));
if (online && dict_index_is_online_ddl(index)) {
- const rec_t* rec = btr_cur_get_rec(btr_cur);
mem_heap_t* heap = NULL;
const ulint* offsets = rec_get_offsets(
rec, index, NULL, true, ULINT_UNDEFINED, &heap);
row_log_table_delete(rec, index, offsets, NULL);
mem_heap_free(heap);
- }
-
- switch (node->table->id) {
- case DICT_INDEXES_ID:
- ut_ad(!online);
- ut_ad(node->trx->dict_operation_lock_mode == RW_X_LATCH);
- ut_ad(node->rec_type == TRX_UNDO_INSERT_REC);
-
- dict_drop_index_tree(
- btr_pcur_get_rec(&node->pcur), &(node->pcur), &mtr);
-
- mtr.commit();
+ } else {
+ switch (node->table->id) {
+ case DICT_INDEXES_ID:
+ ut_ad(!online);
+ ut_ad(node->trx->dict_operation_lock_mode
+ == RW_X_LATCH);
+ ut_ad(node->rec_type == TRX_UNDO_INSERT_REC);
- mtr.start();
+ dict_drop_index_tree(rec, &node->pcur, &mtr);
+ mtr.commit();
- success = btr_pcur_restore_position(
- BTR_MODIFY_LEAF, &node->pcur, &mtr);
- ut_a(success);
- break;
- case DICT_COLUMNS_ID:
- /* This is rolling back an INSERT into SYS_COLUMNS.
- If it was part of an instant ALTER TABLE operation, we
- must evict the table definition, so that it can be
- reloaded after the dictionary operation has been
- completed. At this point, any corresponding operation
- to the metadata record will have been rolled back. */
- ut_ad(!online);
- ut_ad(node->trx->dict_operation_lock_mode == RW_X_LATCH);
- ut_ad(node->rec_type == TRX_UNDO_INSERT_REC);
- const rec_t* rec = btr_pcur_get_rec(&node->pcur);
- if (rec_get_n_fields_old(rec)
- != DICT_NUM_FIELDS__SYS_COLUMNS) {
- break;
- }
- ulint len;
- const byte* data = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_COLUMNS__TABLE_ID, &len);
- if (len != 8) {
+ mtr.start();
+ success = btr_pcur_restore_position(
+ BTR_MODIFY_LEAF, &node->pcur, &mtr);
+ ut_a(success);
break;
+ case DICT_COLUMNS_ID:
+ /* This is rolling back an INSERT into SYS_COLUMNS.
+ If it was part of an instant ALTER TABLE operation, we
+ must evict the table definition, so that it can be
+ reloaded after the dictionary operation has been
+ completed. At this point, any corresponding operation
+ to the metadata record will have been rolled back. */
+ ut_ad(!online);
+ ut_ad(node->trx->dict_operation_lock_mode
+ == RW_X_LATCH);
+ ut_ad(node->rec_type == TRX_UNDO_INSERT_REC);
+ if (rec_get_n_fields_old(rec)
+ != DICT_NUM_FIELDS__SYS_COLUMNS) {
+ break;
+ }
+ ulint len;
+ const byte* data = rec_get_nth_field_old(
+ rec, DICT_FLD__SYS_COLUMNS__TABLE_ID, &len);
+ if (len != 8) {
+ break;
+ }
+ node->trx->evict_table(mach_read_from_8(data));
}
- node->trx->evict_table(mach_read_from_8(data));
}
- if (btr_cur_optimistic_delete(btr_cur, 0, &mtr)) {
+ if (btr_cur_optimistic_delete(&node->pcur.btr_cur, 0, &mtr)) {
err = DB_SUCCESS;
goto func_exit;
}
@@ -182,7 +183,8 @@ retry:
&node->pcur, &mtr);
ut_a(success);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, 0, true, &mtr);
+ btr_cur_pessimistic_delete(&err, FALSE, &node->pcur.btr_cur, 0, true,
+ &mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@@ -201,29 +203,34 @@ retry:
}
func_exit:
- btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_INSERT_METADATA) {
/* When rolling back the very first instant ADD COLUMN
operation, reset the root page to the basic state. */
ut_ad(!index->table->is_temporary());
- mtr.start();
if (page_t* root = btr_root_get(index, &mtr)) {
byte* page_type = root + FIL_PAGE_TYPE;
ut_ad(mach_read_from_2(page_type)
== FIL_PAGE_TYPE_INSTANT
|| mach_read_from_2(page_type)
== FIL_PAGE_INDEX);
- index->set_modified(mtr);
mlog_write_ulint(page_type, FIL_PAGE_INDEX,
MLOG_2BYTES, &mtr);
byte* instant = PAGE_INSTANT + PAGE_HEADER + root;
mlog_write_ulint(instant,
page_ptr_get_direction(instant + 1),
MLOG_2BYTES, &mtr);
+ rec_t* infimum = page_get_infimum_rec(root);
+ rec_t* supremum = page_get_supremum_rec(root);
+ static const byte str[8 + 8] = "supremuminfimum";
+ if (memcmp(infimum, str + 8, 8)
+ || memcmp(supremum, str, 8)) {
+ mlog_write_string(infimum, str + 8, 8, &mtr);
+ mlog_write_string(supremum, str, 8, &mtr);
+ }
}
- mtr.commit();
}
+ btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
return(err);
}
@@ -363,14 +370,10 @@ retry:
return(err);
}
-/***********************************************************//**
-Parses the row reference and other info in a fresh insert undo record. */
-static
-void
-row_undo_ins_parse_undo_rec(
-/*========================*/
- undo_node_t* node, /*!< in/out: row undo node */
- ibool dict_locked) /*!< in: TRUE if own dict_sys->mutex */
+/** Parse an insert undo record.
+@param[in,out] node row rollback state
+@param[in] dict_locked whether the data dictionary cache is locked */
+static bool row_undo_ins_parse_undo_rec(undo_node_t* node, bool dict_locked)
{
dict_index_t* clust_index;
byte* ptr;
@@ -379,18 +382,28 @@ row_undo_ins_parse_undo_rec(
ulint dummy;
bool dummy_extern;
- ut_ad(node);
+ ut_ad(node->state == UNDO_INSERT_PERSISTENT
+ || node->state == UNDO_INSERT_TEMPORARY);
+ ut_ad(node->trx->in_rollback);
+ ut_ad(trx_undo_roll_ptr_is_insert(node->roll_ptr));
ptr = trx_undo_rec_get_pars(node->undo_rec, &node->rec_type, &dummy,
&dummy_extern, &undo_no, &table_id);
node->update = NULL;
- node->table = dict_table_open_on_id(
- table_id, dict_locked, DICT_TABLE_OP_NORMAL);
+ if (node->state == UNDO_INSERT_PERSISTENT) {
+ node->table = dict_table_open_on_id(table_id, dict_locked,
+ DICT_TABLE_OP_NORMAL);
+ } else if (!dict_locked) {
+ mutex_enter(&dict_sys->mutex);
+ node->table = dict_sys->get_temporary_table(table_id);
+ mutex_exit(&dict_sys->mutex);
+ } else {
+ node->table = dict_sys->get_temporary_table(table_id);
+ }
- /* Skip the UNDO if we can't find the table or the .ibd file. */
- if (UNIV_UNLIKELY(node->table == NULL)) {
- return;
+ if (!node->table) {
+ return false;
}
switch (node->rec_type) {
@@ -404,7 +417,7 @@ row_undo_ins_parse_undo_rec(
dict_table_t* table = node->table;
ut_ad(!table->is_temporary());
ut_ad(dict_table_is_file_per_table(table)
- == !is_system_tablespace(table->space->id));
+ == !is_system_tablespace(table->space_id));
size_t len = mach_read_from_2(node->undo_rec)
+ size_t(node->undo_rec - ptr) - 2;
ptr[len] = 0;
@@ -429,6 +442,7 @@ close_table:
connection, instead of doing this rollback. */
dict_table_close(node->table, dict_locked, FALSE);
node->table = NULL;
+ return false;
} else {
ut_ad(!node->table->skip_alter_undo);
clust_index = dict_table_get_first_index(node->table);
@@ -460,6 +474,8 @@ close_table:
goto close_table;
}
}
+
+ return true;
}
/***************************************************************//**
@@ -536,18 +552,10 @@ row_undo_ins(
que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
- ibool dict_locked;
-
- ut_ad(node->state == UNDO_NODE_INSERT);
- ut_ad(node->trx->in_rollback);
- ut_ad(trx_undo_roll_ptr_is_insert(node->roll_ptr));
+ bool dict_locked = node->trx->dict_operation_lock_mode == RW_X_LATCH;
- dict_locked = node->trx->dict_operation_lock_mode == RW_X_LATCH;
-
- row_undo_ins_parse_undo_rec(node, dict_locked);
-
- if (node->table == NULL) {
- return(DB_SUCCESS);
+ if (!row_undo_ins_parse_undo_rec(node, dict_locked)) {
+ return DB_SUCCESS;
}
/* Iterate over all the indexes and undo the insert.*/
@@ -570,26 +578,19 @@ row_undo_ins(
break;
}
- /* fall through */
- case TRX_UNDO_INSERT_METADATA:
log_free_check();
if (node->table->id == DICT_INDEXES_ID) {
- ut_ad(node->rec_type == TRX_UNDO_INSERT_REC);
-
+ ut_ad(!node->table->is_temporary());
if (!dict_locked) {
mutex_enter(&dict_sys->mutex);
}
- }
-
- // FIXME: We need to update the dict_index_t::space and
- // page number fields too.
- err = row_undo_ins_remove_clust_rec(node);
-
- if (node->table->id == DICT_INDEXES_ID
- && !dict_locked) {
-
- mutex_exit(&dict_sys->mutex);
+ err = row_undo_ins_remove_clust_rec(node);
+ if (!dict_locked) {
+ mutex_exit(&dict_sys->mutex);
+ }
+ } else {
+ err = row_undo_ins_remove_clust_rec(node);
}
if (err == DB_SUCCESS && node->table->stat_initialized) {
@@ -609,6 +610,12 @@ row_undo_ins(
node->table, node->trx->mysql_thd);
}
}
+ break;
+
+ case TRX_UNDO_INSERT_METADATA:
+ log_free_check();
+ ut_ad(!node->table->is_temporary());
+ err = row_undo_ins_remove_clust_rec(node);
}
dict_table_close(node->table, dict_locked, FALSE);
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 8b68b277719..7ff64929080 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -24,8 +24,6 @@ Undo modify of a row
Created 2/27/1997 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0umod.h"
#include "dict0dict.h"
#include "dict0stats.h"
@@ -453,6 +451,9 @@ row_undo_mod_clust(
ulint trx_id_offset = index->trx_id_offset;
ulint trx_id_pos = index->n_uniq ? index->n_uniq : 1;
+ /* Reserve enough offsets for the PRIMARY KEY and
+ 2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */
+ ulint offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
if (trx_id_offset) {
} else if (rec_is_metadata(rec, *index)) {
ut_ad(!buf_block_get_page_zip(btr_pcur_get_block(
@@ -462,11 +463,6 @@ row_undo_mod_clust(
}
} else {
ut_ad(index->n_uniq <= MAX_REF_PARTS);
- /* Reserve enough offsets for the PRIMARY KEY and
- 2 columns so that we can access
- DB_TRX_ID, DB_ROLL_PTR. */
- ulint offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS
- + 2];
rec_offs_init(offsets_);
offsets = rec_get_offsets(
rec, index, offsets_, true, trx_id_pos + 2,
@@ -502,8 +498,6 @@ mtr_commit_exit:
btr_pcur_commit_specify_mtr(pcur, &mtr);
func_exit:
- node->state = UNDO_NODE_FETCH_NEXT;
-
if (offsets_heap) {
mem_heap_free(offsets_heap);
}
@@ -1205,14 +1199,10 @@ row_undo_mod_upd_exist_sec(
return(err);
}
-/***********************************************************//**
-Parses the row reference and other info in a modify undo log record. */
-static MY_ATTRIBUTE((nonnull))
-void
-row_undo_mod_parse_undo_rec(
-/*========================*/
- undo_node_t* node, /*!< in: row undo node */
- ibool dict_locked) /*!< in: TRUE if own dict_sys->mutex */
+/** Parse an update undo record.
+@param[in,out] node row rollback state
+@param[in] dict_locked whether the data dictionary cache is locked */
+static bool row_undo_mod_parse_undo_rec(undo_node_t* node, bool dict_locked)
{
dict_index_t* clust_index;
byte* ptr;
@@ -1225,19 +1215,28 @@ row_undo_mod_parse_undo_rec(
ulint cmpl_info;
bool dummy_extern;
+ ut_ad(node->state == UNDO_UPDATE_PERSISTENT
+ || node->state == UNDO_UPDATE_TEMPORARY);
+ ut_ad(node->trx->in_rollback);
+ ut_ad(!trx_undo_roll_ptr_is_insert(node->roll_ptr));
+
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info,
&dummy_extern, &undo_no, &table_id);
node->rec_type = type;
- node->table = dict_table_open_on_id(
- table_id, dict_locked, DICT_TABLE_OP_NORMAL);
-
- /* TODO: other fixes associated with DROP TABLE + rollback in the
- same table by another user */
+ if (node->state == UNDO_UPDATE_PERSISTENT) {
+ node->table = dict_table_open_on_id(table_id, dict_locked,
+ DICT_TABLE_OP_NORMAL);
+ } else if (!dict_locked) {
+ mutex_enter(&dict_sys->mutex);
+ node->table = dict_sys->get_temporary_table(table_id);
+ mutex_exit(&dict_sys->mutex);
+ } else {
+ node->table = dict_sys->get_temporary_table(table_id);
+ }
- if (node->table == NULL) {
- /* Table was dropped */
- return;
+ if (!node->table) {
+ return false;
}
ut_ad(!node->table->skip_alter_undo);
@@ -1255,7 +1254,7 @@ close_table:
connection, instead of doing this rollback. */
dict_table_close(node->table, dict_locked, FALSE);
node->table = NULL;
- return;
+ return false;
}
clust_index = dict_table_get_first_index(node->table);
@@ -1326,6 +1325,8 @@ close_table:
(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)
? NULL : ptr);
}
+
+ return true;
}
/***********************************************************//**
@@ -1338,27 +1339,12 @@ row_undo_mod(
que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
- ibool dict_locked;
-
- ut_ad(node != NULL);
- ut_ad(thr != NULL);
- ut_ad(node->state == UNDO_NODE_MODIFY);
- ut_ad(node->trx->in_rollback);
- ut_ad(!trx_undo_roll_ptr_is_insert(node->roll_ptr));
-
- dict_locked = thr_get_trx(thr)->dict_operation_lock_mode == RW_X_LATCH;
-
ut_ad(thr_get_trx(thr) == node->trx);
+ const bool dict_locked = node->trx->dict_operation_lock_mode
+ == RW_X_LATCH;
- row_undo_mod_parse_undo_rec(node, dict_locked);
-
- if (node->table == NULL) {
- /* It is already undone, or will be undone by another query
- thread, or table was dropped */
-
- node->state = UNDO_NODE_FETCH_NEXT;
-
- return(DB_SUCCESS);
+ if (!row_undo_mod_parse_undo_rec(node, dict_locked)) {
+ return DB_SUCCESS;
}
node->index = dict_table_get_first_index(node->table);
diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc
index e18f5a24982..2b8187171f9 100644
--- a/storage/innobase/row/row0undo.cc
+++ b/storage/innobase/row/row0undo.cc
@@ -24,8 +24,6 @@ Row undo
Created 1/8/1997 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0undo.h"
#include "fsp0fsp.h"
#include "mach0data.h"
@@ -219,7 +217,8 @@ row_undo_search_clust_to_pcur(
log, first mark them DATA_MISSING. So we will know if the
value gets updated */
if (node->table->n_v_cols
- && node->state != UNDO_NODE_INSERT
+ && (node->state == UNDO_UPDATE_PERSISTENT
+ || node->state == UNDO_UPDATE_TEMPORARY)
&& !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
for (ulint i = 0;
i < dict_table_get_n_v_cols(node->table); i++) {
@@ -255,6 +254,149 @@ func_exit:
return(found);
}
+/** Try to truncate the undo logs.
+@param[in,out] trx transaction */
+static void row_undo_try_truncate(trx_t* trx)
+{
+ if (trx_undo_t* undo = trx->rsegs.m_redo.undo) {
+ ut_ad(undo->rseg == trx->rsegs.m_redo.rseg);
+ trx_undo_truncate_end(*undo, trx->undo_no, false);
+ }
+
+ if (trx_undo_t* undo = trx->rsegs.m_noredo.undo) {
+ ut_ad(undo->rseg == trx->rsegs.m_noredo.rseg);
+ trx_undo_truncate_end(*undo, trx->undo_no, true);
+ }
+}
+
+/** Get the latest undo log record for rollback.
+@param[in,out] node rollback context
+@return whether an undo log record was fetched */
+static bool row_undo_rec_get(undo_node_t* node)
+{
+ trx_t* trx = node->trx;
+
+ if (trx->pages_undone) {
+ trx->pages_undone = 0;
+ row_undo_try_truncate(trx);
+ }
+
+ trx_undo_t* undo = NULL;
+ trx_undo_t* insert = trx->rsegs.m_redo.old_insert;
+ trx_undo_t* update = trx->rsegs.m_redo.undo;
+ trx_undo_t* temp = trx->rsegs.m_noredo.undo;
+ const undo_no_t limit = trx->roll_limit;
+
+ ut_ad(!insert || !update || insert->empty() || update->empty()
+ || insert->top_undo_no != update->top_undo_no);
+ ut_ad(!insert || !temp || insert->empty() || temp->empty()
+ || insert->top_undo_no != temp->top_undo_no);
+ ut_ad(!update || !temp || update->empty() || temp->empty()
+ || update->top_undo_no != temp->top_undo_no);
+
+ if (UNIV_LIKELY_NULL(insert)
+ && !insert->empty() && limit <= insert->top_undo_no) {
+ undo = insert;
+ }
+
+ if (update && !update->empty() && update->top_undo_no >= limit) {
+ if (!undo) {
+ undo = update;
+ } else if (undo->top_undo_no < update->top_undo_no) {
+ undo = update;
+ }
+ }
+
+ if (temp && !temp->empty() && temp->top_undo_no >= limit) {
+ if (!undo) {
+ undo = temp;
+ } else if (undo->top_undo_no < temp->top_undo_no) {
+ undo = temp;
+ }
+ }
+
+ if (undo == NULL) {
+ row_undo_try_truncate(trx);
+ /* Mark any ROLLBACK TO SAVEPOINT completed, so that
+ if the transaction object is committed and reused
+ later, we will default to a full ROLLBACK. */
+ trx->roll_limit = 0;
+ trx->in_rollback = false;
+ return false;
+ }
+
+ ut_ad(!undo->empty());
+ ut_ad(limit <= undo->top_undo_no);
+
+ node->roll_ptr = trx_undo_build_roll_ptr(
+ false, undo->rseg->id, undo->top_page_no, undo->top_offset);
+
+ mtr_t mtr;
+ mtr.start();
+
+ page_t* undo_page = trx_undo_page_get_s_latched(
+ page_id_t(undo->rseg->space->id, undo->top_page_no), &mtr);
+
+ ulint offset = undo->top_offset;
+
+ trx_undo_rec_t* prev_rec = trx_undo_get_prev_rec(
+ undo_page + offset, undo->hdr_page_no, undo->hdr_offset,
+ true, &mtr);
+
+ if (prev_rec == NULL) {
+ undo->top_undo_no = IB_ID_MAX;
+ ut_ad(undo->empty());
+ } else {
+ page_t* prev_rec_page = page_align(prev_rec);
+
+ if (prev_rec_page != undo_page) {
+
+ trx->pages_undone++;
+ }
+
+ undo->top_page_no = page_get_page_no(prev_rec_page);
+ undo->top_offset = ulint(prev_rec - prev_rec_page);
+ undo->top_undo_no = trx_undo_rec_get_undo_no(prev_rec);
+ ut_ad(!undo->empty());
+ }
+
+ {
+ const trx_undo_rec_t* undo_rec = undo_page + offset;
+ node->undo_rec = trx_undo_rec_copy(undo_rec, node->heap);
+ }
+
+ mtr.commit();
+
+ switch (trx_undo_rec_get_type(node->undo_rec)) {
+ case TRX_UNDO_INSERT_METADATA:
+ /* This record type was introduced in MDEV-11369
+ instant ADD COLUMN, which was implemented after
+ MDEV-12288 removed the insert_undo log. There is no
+ instant ADD COLUMN for temporary tables. Therefore,
+ this record can only be present in the main undo log. */
+ ut_ad(undo == update);
+ /* fall through */
+ case TRX_UNDO_RENAME_TABLE:
+ ut_ad(undo == insert || undo == update);
+ /* fall through */
+ case TRX_UNDO_INSERT_REC:
+ ut_ad(undo == insert || undo == update || undo == temp);
+ node->roll_ptr |= 1ULL << ROLL_PTR_INSERT_FLAG_POS;
+ node->state = undo == temp
+ ? UNDO_INSERT_TEMPORARY : UNDO_INSERT_PERSISTENT;
+ break;
+ default:
+ ut_ad(undo == update || undo == temp);
+ node->state = undo == temp
+ ? UNDO_UPDATE_TEMPORARY : UNDO_UPDATE_PERSISTENT;
+ break;
+ }
+
+ trx->undo_no = node->undo_no = trx_undo_rec_get_undo_no(
+ node->undo_rec);
+ return true;
+}
+
/***********************************************************//**
Fetches an undo log record and does the undo for the recorded operation.
If none left, or a partial rollback completed, returns control to the
@@ -267,23 +409,12 @@ row_undo(
undo_node_t* node, /*!< in: row undo node */
que_thr_t* thr) /*!< in: query thread */
{
- trx_t* trx = node->trx;
- ut_ad(trx->in_rollback);
-
- if (node->state == UNDO_NODE_FETCH_NEXT) {
-
- node->undo_rec = trx_roll_pop_top_rec_of_trx(
- trx, &node->roll_ptr, node->heap);
-
- if (!node->undo_rec) {
- /* Rollback completed for this query thread */
- thr->run_node = que_node_get_parent(node);
- return(DB_SUCCESS);
- }
+ ut_ad(node->trx->in_rollback);
- node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec);
- node->state = trx_undo_roll_ptr_is_insert(node->roll_ptr)
- ? UNDO_NODE_INSERT : UNDO_NODE_MODIFY;
+ if (node->state == UNDO_NODE_FETCH_NEXT && !row_undo_rec_get(node)) {
+ /* Rollback completed for this query thread */
+ thr->run_node = que_node_get_parent(node);
+ return DB_SUCCESS;
}
/* Prevent DROP TABLE etc. while we are rolling back this row.
@@ -291,31 +422,33 @@ row_undo(
then we already have dict_operation_lock locked in x-mode. Do not
try to lock again, because that would cause a hang. */
+ trx_t* trx = node->trx;
const bool locked_data_dict = (trx->dict_operation_lock_mode == 0);
if (locked_data_dict) {
-
row_mysql_freeze_data_dictionary(trx);
}
dberr_t err;
- if (node->state == UNDO_NODE_INSERT) {
-
+ switch (node->state) {
+ case UNDO_INSERT_PERSISTENT:
+ case UNDO_INSERT_TEMPORARY:
err = row_undo_ins(node, thr);
-
- node->state = UNDO_NODE_FETCH_NEXT;
- } else {
- ut_ad(node->state == UNDO_NODE_MODIFY);
+ break;
+ case UNDO_UPDATE_PERSISTENT:
+ case UNDO_UPDATE_TEMPORARY:
err = row_undo_mod(node, thr);
+ break;
+ case UNDO_NODE_FETCH_NEXT:
+ ut_ad(!"wrong state");
}
if (locked_data_dict) {
-
row_mysql_unfreeze_data_dictionary(trx);
}
- /* Do some cleanup */
+ node->state = UNDO_NODE_FETCH_NEXT;
btr_pcur_close(&(node->pcur));
mem_heap_empty(node->heap);
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index f9567de3c1f..e8ee3aeac30 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -24,8 +24,6 @@ Update of a row
Created 12/27/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0upd.h"
#include "dict0dict.h"
#include "dict0mem.h"
@@ -497,39 +495,6 @@ row_upd_rec_sys_fields_in_recovery(
}
}
-/*********************************************************************//**
-Sets the trx id or roll ptr field of a clustered index entry. */
-void
-row_upd_index_entry_sys_field(
-/*==========================*/
- dtuple_t* entry, /*!< in/out: index entry, where the memory
- buffers for sys fields are already allocated:
- the function just copies the new values to
- them */
- dict_index_t* index, /*!< in: clustered index */
- ulint type, /*!< in: DATA_TRX_ID or DATA_ROLL_PTR */
- ib_uint64_t val) /*!< in: value to write */
-{
- dfield_t* dfield;
- byte* field;
- ulint pos;
-
- ut_ad(dict_index_is_clust(index));
-
- pos = dict_index_get_sys_col_pos(index, type);
-
- dfield = dtuple_get_nth_field(entry, pos);
- field = static_cast<byte*>(dfield_get_data(dfield));
-
- if (type == DATA_TRX_ID) {
- ut_ad(val > 0);
- trx_write_trx_id(field, val);
- } else {
- ut_ad(type == DATA_ROLL_PTR);
- trx_write_roll_ptr(field, val);
- }
-}
-
/***********************************************************//**
Returns TRUE if row update changes size of some field in index or if some
field to be updated is stored externally in rec or update.
@@ -733,35 +698,6 @@ row_upd_rec_in_place(
}
/*********************************************************************//**
-Writes into the redo log the values of trx id and roll ptr and enough info
-to determine their positions within a clustered index record.
-@return new pointer to mlog */
-byte*
-row_upd_write_sys_vals_to_log(
-/*==========================*/
- dict_index_t* index, /*!< in: clustered index */
- trx_id_t trx_id, /*!< in: transaction id */
- roll_ptr_t roll_ptr,/*!< in: roll ptr of the undo log record */
- byte* log_ptr,/*!< pointer to a buffer of size > 20 opened
- in mlog */
- mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in: mtr */
-{
- ut_ad(dict_index_is_clust(index));
- ut_ad(mtr);
-
- log_ptr += mach_write_compressed(log_ptr,
- dict_index_get_sys_col_pos(
- index, DATA_TRX_ID));
-
- trx_write_roll_ptr(log_ptr, roll_ptr);
- log_ptr += DATA_ROLL_PTR_LEN;
-
- log_ptr += mach_u64_write_compressed(log_ptr, trx_id);
-
- return(log_ptr);
-}
-
-/*********************************************************************//**
Parses the log data of system field values.
@return log data end or NULL */
byte*
@@ -1036,8 +972,9 @@ the equal ordering fields. NOTE: we compare the fields as binary strings!
@param[in] heap memory heap from which allocated
@param[in] mysql_table NULL, or mysql table object when
user thread invokes dml
+@param[out] error error number in case of failure
@return own: update vector of differing fields, excluding roll ptr and
-trx id */
+trx id,if error is not equal to DB_SUCCESS, return NULL */
upd_t*
row_upd_build_difference_binary(
dict_index_t* index,
@@ -1047,7 +984,8 @@ row_upd_build_difference_binary(
bool no_sys,
trx_t* trx,
mem_heap_t* heap,
- TABLE* mysql_table)
+ TABLE* mysql_table,
+ dberr_t* error)
{
upd_field_t* upd_field;
dfield_t* dfield;
@@ -1055,7 +993,6 @@ row_upd_build_difference_binary(
ulint len;
upd_t* update;
ulint n_diff;
- ulint trx_id_pos;
ulint i;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint n_fld = dtuple_get_n_fields(entry);
@@ -1070,10 +1007,6 @@ row_upd_build_difference_binary(
n_diff = 0;
- trx_id_pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
- ut_ad(dict_index_get_sys_col_pos(index, DATA_ROLL_PTR)
- == trx_id_pos + 1);
-
if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets_, true,
ULINT_UNDEFINED, &heap);
@@ -1088,16 +1021,9 @@ row_upd_build_difference_binary(
/* NOTE: we compare the fields as binary strings!
(No collation) */
- if (no_sys) {
- /* TRX_ID */
- if (i == trx_id_pos) {
- continue;
- }
-
- /* DB_ROLL_PTR */
- if (i == trx_id_pos + 1) {
- continue;
- }
+ if (no_sys && (i == index->db_trx_id()
+ || i == index->db_roll_ptr())) {
+ continue;
}
if (!dfield_is_ext(dfield)
@@ -1158,6 +1084,11 @@ row_upd_build_difference_binary(
update->old_vrow, col, index,
&v_heap, heap, NULL, thd, mysql_table, record,
NULL, NULL, NULL);
+ if (vfield == NULL) {
+ if (v_heap) mem_heap_free(v_heap);
+ *error = DB_COMPUTE_VALUE_FAILED;
+ return(NULL);
+ }
if (!dfield_data_is_binary_equal(
dfield, vfield->len,
@@ -2379,7 +2310,7 @@ row_upd_sec_index_entry(
mtr.start();
- switch (index->table->space->id) {
+ switch (index->table->space_id) {
case SRV_TMP_SPACE_ID:
mtr.set_log_mode(MTR_LOG_NO_REDO);
flags = BTR_NO_LOCKING_FLAG;
@@ -2498,7 +2429,7 @@ row_upd_sec_index_entry(
#ifdef UNIV_DEBUG
mtr_commit(&mtr);
mtr_start(&mtr);
- ut_ad(btr_validate_index(index, 0, false));
+ ut_ad(btr_validate_index(index, 0));
ut_ad(0);
#endif /* UNIV_DEBUG */
break;
@@ -2534,7 +2465,7 @@ row_upd_sec_index_entry(
err = DB_SUCCESS;
break;
case DB_DEADLOCK:
- if (wsrep_debug) {
+ if (wsrep_get_debug()) {
ib::warn() << "WSREP: sec index FK check fail for deadlock"
<< " index " << index->name
<< " table " << index->table->name;
@@ -2761,7 +2692,11 @@ row_upd_clust_rec_by_insert(
if (index->is_instant()) entry->trim(*index);
ut_ad(dtuple_get_info_bits(entry) == 0);
- row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id);
+ {
+ dfield_t* t = dtuple_get_nth_field(entry, index->db_trx_id());
+ ut_ad(t->len == DATA_TRX_ID_LEN);
+ trx_write_trx_id(static_cast<byte*>(t->data), trx->id);
+ }
switch (node->state) {
default:
@@ -2845,7 +2780,7 @@ check_fk:
err = DB_SUCCESS;
break;
case DB_DEADLOCK:
- if (wsrep_debug) {
+ if (wsrep_get_debug()) {
ib::warn() << "WSREP: sec index FK check fail for deadlock"
<< " index " << index->name
<< " table " << index->table->name;
@@ -3074,7 +3009,7 @@ row_upd_del_mark_clust_rec(
err = DB_SUCCESS;
break;
case DB_DEADLOCK:
- if (wsrep_debug) {
+ if (wsrep_get_debug()) {
ib::warn() << "WSREP: sec index FK check fail for deadlock"
<< " index " << index->name
<< " table " << index->table->name;
@@ -3259,6 +3194,7 @@ row_upd_clust_step(
if (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE) {
+ node->index = NULL;
err = row_upd_clust_rec(
flags, node, index, offsets, &heap, thr, &mtr);
goto exit_func;
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index fac01fe26cc..f31ae1573cf 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -24,8 +24,6 @@ Row versions
Created 2/6/1997 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "row0vers.h"
#include "dict0dict.h"
#include "dict0boot.h"
diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc
index d26e61253cd..b2b464e31fa 100644
--- a/storage/innobase/srv/srv0conc.cc
+++ b/storage/innobase/srv/srv0conc.cc
@@ -38,13 +38,11 @@ InnoDB concurrency manager
Created 2011/04/18 Sunny Bains
*******************************************************/
-#include "ha_prototypes.h"
-#include <mysql/service_thd_wait.h>
-
#include "srv0srv.h"
#include "trx0trx.h"
#include "row0mysql.h"
#include "dict0dict.h"
+#include <mysql/service_thd_wait.h>
#include <mysql/service_wsrep.h>
/** Number of times a thread is allowed to enter InnoDB within the same
@@ -69,14 +67,12 @@ ulong srv_thread_concurrency = 0;
/** Variables tracking the active and waiting threads. */
struct srv_conc_t {
- char pad[CACHE_LINE_SIZE - (sizeof(ulint) + sizeof(lint))];
-
/** Number of transactions that have declared_to_be_inside_innodb */
- ulint n_active;
+ MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) Atomic_counter<ulint> n_active;
/** Number of OS threads waiting in the FIFO for permission to
enter InnoDB */
- ulint n_waiting;
+ MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) Atomic_counter<ulint> n_waiting;
};
/* Control variables for tracking concurrency. */
@@ -123,8 +119,8 @@ srv_conc_enter_innodb_with_atomics(
ulint sleep_in_us;
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
- wsrep_trx_is_aborting(trx->mysql_thd)) {
- if (wsrep_debug) {
+ wsrep_thd_is_aborting(trx->mysql_thd)) {
+ if (wsrep_get_debug()) {
ib::info() <<
"srv_conc_enter due to MUST_ABORT";
}
@@ -135,8 +131,7 @@ srv_conc_enter_innodb_with_atomics(
if (srv_thread_concurrency == 0) {
if (notified_mysql) {
- my_atomic_addlint(&srv_conc.n_waiting,
- ulint(-1));
+ srv_conc.n_waiting--;
thd_wait_end(trx->mysql_thd);
}
@@ -144,19 +139,14 @@ srv_conc_enter_innodb_with_atomics(
}
if (srv_conc.n_active < srv_thread_concurrency) {
- ulint n_active;
/* Check if there are any free tickets. */
- n_active = my_atomic_addlint(
- &srv_conc.n_active, 1) + 1;
-
- if (n_active <= srv_thread_concurrency) {
+ if (srv_conc.n_active++ < srv_thread_concurrency) {
srv_enter_innodb_with_tickets(trx);
if (notified_mysql) {
- my_atomic_addlint(&srv_conc.n_waiting,
- ulint(-1));
+ srv_conc.n_waiting--;
thd_wait_end(trx->mysql_thd);
}
@@ -178,11 +168,11 @@ srv_conc_enter_innodb_with_atomics(
/* Since there were no free seats, we relinquish
the overbooked ticket. */
- my_atomic_addlint(&srv_conc.n_active, ulint(-1));
+ srv_conc.n_active--;
}
if (!notified_mysql) {
- my_atomic_addlint(&srv_conc.n_waiting, 1);
+ srv_conc.n_waiting++;
thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
@@ -226,7 +216,7 @@ srv_conc_exit_innodb_with_atomics(
trx->n_tickets_to_enter_innodb = 0;
trx->declared_to_be_inside_innodb = FALSE;
- my_atomic_addlint(&srv_conc.n_active, ulint(-1));
+ srv_conc.n_active--;
}
/*********************************************************************//**
@@ -260,7 +250,7 @@ srv_conc_force_enter_innodb(
return;
}
- (void) my_atomic_addlint(&srv_conc.n_active, 1);
+ srv_conc.n_active++;
trx->n_tickets_to_enter_innodb = 1;
trx->declared_to_be_inside_innodb = TRUE;
@@ -318,14 +308,14 @@ wsrep_srv_conc_cancel_wait(
srv_conc_enter_innodb_with_atomics(). No need to cancel here,
thr will wake up after os_sleep and let to enter innodb
*/
- if (wsrep_debug) {
+ if (wsrep_get_debug()) {
ib::info() << "WSREP: conc slot cancel, no atomics";
}
#else
// JAN: TODO: MySQL 5.7
//os_fast_mutex_lock(&srv_conc_mutex);
if (trx->wsrep_event) {
- if (wsrep_debug) {
+ if (wsrep_get_debug()) {
ib::info() << "WSREP: conc slot cancel";
}
os_event_set(trx->wsrep_event);
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 9215a46cb51..4d796d9453a 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -796,11 +796,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_SAVEPOINT},
- {"trx_rollback_active", "transaction",
- "Number of resurrected active transactions rolled back",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_ACTIVE},
-
{"trx_active_transactions", "transaction",
"Number of active transactions",
MONITOR_NONE,
@@ -1959,7 +1954,7 @@ srv_mon_process_existing_counter(
break;
case MONITOR_RSEG_HISTORY_LEN:
- value = trx_sys.history_size();
+ value = trx_sys.rseg_history_len;
break;
case MONITOR_RSEG_CUR_SIZE:
@@ -1967,7 +1962,7 @@ srv_mon_process_existing_counter(
break;
case MONITOR_OVLD_N_FILE_OPENED:
- value = fil_n_file_opened;
+ value = fil_system.n_open;
break;
case MONITOR_OVLD_IBUF_MERGE_INSERT:
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 94e5954c884..34638dfda25 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -46,14 +46,11 @@ Created 10/8/1995 Heikki Tuuri
// #include "mysql/psi/mysql_stage.h"
// #include "mysql/psi/psi.h"
-#include "ha_prototypes.h"
-
#include "btr0sea.h"
#include "buf0flu.h"
#include "buf0lru.h"
#include "dict0boot.h"
#include "dict0load.h"
-#include "fsp0sysspace.h"
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "log0recv.h"
@@ -79,10 +76,6 @@ Created 10/8/1995 Heikki Tuuri
#include <my_service_manager.h>
-#ifdef WITH_WSREP
-extern int wsrep_debug;
-extern int wsrep_trx_is_aborting(void *thd_ptr);
-#endif
/* The following is the maximum allowed duration of a lock wait. */
UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT;
@@ -500,10 +493,6 @@ UNIV_INTERN ulong srv_buf_dump_status_frequency;
mutex_enter(&srv_sys.mutex); \
} while (0)
-/** Test if the system mutex is owned. */
-#define srv_sys_mutex_own() (mutex_own(&srv_sys.mutex) \
- && !srv_read_only_mode)
-
/** Release the system mutex. */
#define srv_sys_mutex_exit() do { \
mutex_exit(&srv_sys.mutex); \
@@ -599,11 +588,12 @@ struct srv_sys_t{
sys_threads[]->event are
covered by srv_sys_t::mutex */
- ulint n_threads_active[SRV_MASTER + 1];
+ Atomic_counter<ulint>
+ n_threads_active[SRV_MASTER + 1];
/*!< number of threads active
in a thread class; protected
- by both my_atomic_addlint()
- and mutex */
+ by both std::atomic and
+ mutex */
srv_stats_t::ulint_ctr_1_t
activity_count; /*!< For tracking server
@@ -615,7 +605,7 @@ static srv_sys_t srv_sys;
/** @return whether the purge coordinator thread is active */
bool purge_sys_t::running()
{
- return my_atomic_loadlint(&srv_sys.n_threads_active[SRV_PURGE]);
+ return srv_sys.n_threads_active[SRV_PURGE];
}
/** Event to signal srv_monitor_thread. Not protected by a mutex.
@@ -814,7 +804,7 @@ srv_reserve_slot(
ut_ad(srv_slot_get_type(slot) == type);
- my_atomic_addlint(&srv_sys.n_threads_active[type], 1);
+ srv_sys.n_threads_active[type]++;
srv_sys_mutex_exit();
@@ -831,7 +821,7 @@ srv_suspend_thread_low(
srv_slot_t* slot) /*!< in/out: thread slot */
{
ut_ad(!srv_read_only_mode);
- ut_ad(srv_sys_mutex_own());
+ ut_ad(mutex_own(&srv_sys.mutex));
ut_ad(slot->in_use);
@@ -861,8 +851,7 @@ srv_suspend_thread_low(
ut_a(!slot->suspended);
slot->suspended = TRUE;
- if (lint(my_atomic_addlint(&srv_sys.n_threads_active[type], ulint(-1)))
- < 0) {
+ if (srv_sys.n_threads_active[type]-- == 0) {
ut_error;
}
@@ -919,7 +908,7 @@ srv_resume_thread(srv_slot_t* slot, int64_t sig_count = 0, bool wait = true,
ut_ad(slot->suspended);
slot->suspended = FALSE;
- my_atomic_addlint(&srv_sys.n_threads_active[slot->type], 1);
+ srv_sys.n_threads_active[slot->type]++;
srv_sys_mutex_exit();
return(timeout);
}
@@ -1073,8 +1062,6 @@ srv_init()
trx_i_s_cache_init(trx_i_s_cache);
ut_crc32_init();
-
- dict_mem_init();
}
/*********************************************************************//**
@@ -1332,7 +1319,7 @@ srv_printf_innodb_monitor(
fprintf(file,
"Total large memory allocated " ULINTPF "\n"
"Dictionary memory allocated " ULINTPF "\n",
- os_total_large_mem_allocated,
+ ulint{os_total_large_mem_allocated},
dict_sys_get_size());
buf_print_io(file);
@@ -1581,7 +1568,7 @@ srv_export_innodb_status(void)
export_vars.innodb_system_rows_deleted =
srv_stats.n_system_rows_deleted;
- export_vars.innodb_num_open_files = fil_n_file_opened;
+ export_vars.innodb_num_open_files = fil_system.n_open;
export_vars.innodb_truncated_status_writes =
srv_truncated_status_writes;
@@ -1912,11 +1899,11 @@ void
srv_active_wake_master_thread_low()
{
ut_ad(!srv_read_only_mode);
- ut_ad(!srv_sys_mutex_own());
+ ut_ad(!mutex_own(&srv_sys.mutex));
srv_inc_activity_count();
- if (my_atomic_loadlint(&srv_sys.n_threads_active[SRV_MASTER]) == 0) {
+ if (srv_sys.n_threads_active[SRV_MASTER] == 0) {
srv_slot_t* slot;
srv_sys_mutex_enter();
@@ -1938,11 +1925,12 @@ srv_active_wake_master_thread_low()
void
srv_wake_purge_thread_if_not_active()
{
- ut_ad(!srv_sys_mutex_own());
+ ut_ad(!srv_read_only_mode);
+ ut_ad(!mutex_own(&srv_sys.mutex));
if (purge_sys.enabled() && !purge_sys.paused()
- && !my_atomic_loadlint(&srv_sys.n_threads_active[SRV_PURGE])
- && trx_sys.history_size()) {
+ && !srv_sys.n_threads_active[SRV_PURGE]
+ && trx_sys.rseg_history_len) {
srv_release_threads(SRV_PURGE, 1);
}
@@ -2415,8 +2403,7 @@ static bool srv_purge_should_exit()
return(true);
}
/* Slow shutdown was requested. */
- ulint history_size = trx_sys.history_size();
-
+ uint32_t history_size = trx_sys.rseg_history_len;
if (history_size) {
#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
static ib_time_t progress_time;
@@ -2425,7 +2412,7 @@ static bool srv_purge_should_exit()
progress_time = time;
service_manager_extend_timeout(
INNODB_EXTEND_TIMEOUT_INTERVAL,
- "InnoDB: to purge " ULINTPF " transactions",
+ "InnoDB: to purge %u transactions",
history_size);
}
#endif
@@ -2450,7 +2437,7 @@ static bool srv_task_execute()
UT_LIST_REMOVE(srv_sys.tasks, thr);
mutex_exit(&srv_sys.tasks_mutex);
que_run_threads(thr);
- my_atomic_addlint(&purge_sys.n_completed, 1);
+ purge_sys.n_tasks.fetch_sub(1, std::memory_order_release);
return true;
}
@@ -2486,7 +2473,7 @@ DECLARE_THREAD(srv_worker_thread)(
slot = srv_reserve_slot(SRV_WORKER);
ut_a(srv_n_purge_threads > 1);
- ut_a(ulong(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER]))
+ ut_a(ulong(srv_sys.n_threads_active[SRV_WORKER])
< srv_n_purge_threads);
/* We need to ensure that the worker threads exit after the
@@ -2528,14 +2515,14 @@ DECLARE_THREAD(srv_worker_thread)(
@param[in,out] n_total_purged total number of purged pages
@return length of history list before the last purge batch. */
static
-ulint
+uint32_t
srv_do_purge(ulint* n_total_purged)
{
ulint n_pages_purged;
static ulint count = 0;
static ulint n_use_threads = 0;
- static ulint rseg_history_len = 0;
+ static uint32_t rseg_history_len = 0;
ulint old_activity_count = srv_get_activity_count();
const ulint n_threads = srv_n_purge_threads;
@@ -2553,7 +2540,7 @@ srv_do_purge(ulint* n_total_purged)
}
do {
- if (trx_sys.history_size() > rseg_history_len
+ if (trx_sys.rseg_history_len > rseg_history_len
|| (srv_max_purge_lag > 0
&& rseg_history_len > srv_max_purge_lag)) {
@@ -2582,7 +2569,7 @@ srv_do_purge(ulint* n_total_purged)
ut_a(n_use_threads <= n_threads);
/* Take a snapshot of the history list before purge. */
- if (!(rseg_history_len = trx_sys.history_size())) {
+ if (!(rseg_history_len = trx_sys.rseg_history_len)) {
break;
}
@@ -2606,7 +2593,7 @@ srv_purge_coordinator_suspend(
/*==========================*/
srv_slot_t* slot, /*!< in/out: Purge coordinator
thread slot */
- ulint rseg_history_len) /*!< in: history list length
+ uint32_t rseg_history_len) /*!< in: history list length
before last purge */
{
ut_ad(!srv_read_only_mode);
@@ -2623,7 +2610,7 @@ srv_purge_coordinator_suspend(
/* We don't wait right away on the the non-timed wait because
we want to signal the thread that wants to suspend purge. */
const bool wait = stop
- || rseg_history_len <= trx_sys.history_size();
+ || rseg_history_len <= trx_sys.rseg_history_len;
const bool timeout = srv_resume_thread(
slot, sig_count, wait,
stop ? 0 : SRV_PURGE_MAX_TIMEOUT);
@@ -2633,12 +2620,12 @@ srv_purge_coordinator_suspend(
rw_lock_x_lock(&purge_sys.latch);
stop = srv_shutdown_state == SRV_SHUTDOWN_NONE
- && purge_sys.paused_latched();
+ && purge_sys.paused();
if (!stop) {
if (timeout
&& rseg_history_len < 5000
- && rseg_history_len == trx_sys.history_size()) {
+ && rseg_history_len == trx_sys.rseg_history_len) {
/* No new records were added since the
wait started. Simply wait for new
records. The magic number 5000 is an
@@ -2691,7 +2678,7 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
slot = srv_reserve_slot(SRV_PURGE);
- ulint rseg_history_len = trx_sys.history_size();
+ uint32_t rseg_history_len = trx_sys.rseg_history_len;
do {
/* If there are no records to purge or the last
@@ -2815,9 +2802,7 @@ srv_purge_wakeup()
srv_release_threads(SRV_WORKER, n_workers);
}
- } while (!my_atomic_loadptr_explicit(reinterpret_cast<void**>
- (&srv_running),
- MY_MEMORY_ORDER_RELAXED)
+ } while (!srv_running.load(std::memory_order_relaxed)
&& (srv_sys.n_threads_active[SRV_WORKER]
|| srv_sys.n_threads_active[SRV_PURGE]));
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 03c91167484..108e9182f00 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -41,8 +41,6 @@ Created 2/16/1996 Heikki Tuuri
#include "my_global.h"
-#include "ha_prototypes.h"
-
#include "mysqld.h"
#include "mysql/psi/mysql_stage.h"
#include "mysql/psi/psi.h"
@@ -76,7 +74,6 @@ Created 2/16/1996 Heikki Tuuri
#include "srv0start.h"
#include "srv0srv.h"
#include "btr0defragment.h"
-#include "fsp0sysspace.h"
#include "mysql/service_wsrep.h" /* wsrep_recovery */
#include "trx0rseg.h"
#include "os0proc.h"
@@ -104,7 +101,6 @@ Created 2/16/1996 Heikki Tuuri
#include "zlib.h"
#include "ut0crc32.h"
#include "btr0scrub.h"
-#include "ut0new.h"
/** Log sequence number immediately after startup */
lsn_t srv_start_lsn;
@@ -466,23 +462,16 @@ create_log_files(
const ulint size = ulint(srv_log_file_size >> srv_page_size_shift);
- logfile0 = fil_node_create(
- logfilename, size, log_space, false, false);
+ logfile0 = log_space->add(logfilename, OS_FILE_CLOSED, size,
+ false, false)->name;
ut_a(logfile0);
for (unsigned i = 1; i < srv_n_log_files; i++) {
sprintf(logfilename + dirnamelen, "ib_logfile%u", i);
- if (!fil_node_create(logfilename, size,
- log_space, false, false)) {
-
- ib::error()
- << "Cannot create file node for log file "
- << logfilename;
-
- return(DB_ERROR);
- }
+ log_space->add(logfilename, OS_FILE_CLOSED, size,
+ false, false);
}
log_sys.log.create(srv_n_log_files);
@@ -630,83 +619,68 @@ srv_undo_tablespace_create(
return(err);
}
-/*********************************************************************//**
-Open an undo tablespace.
-@return DB_SUCCESS or error code */
-static
-dberr_t
-srv_undo_tablespace_open(
-/*=====================*/
- const char* name, /*!< in: tablespace file name */
- ulint space_id) /*!< in: tablespace id */
+
+/** Open an undo tablespace.
+@param[in] name tablespace file name
+@param[in] space_id tablespace ID
+@param[in] create_new_db whether undo tablespaces are being created
+@return whether the tablespace was opened */
+static bool srv_undo_tablespace_open(const char* name, ulint space_id,
+ bool create_new_db)
{
pfs_os_file_t fh;
- bool ret;
- dberr_t err = DB_ERROR;
+ bool success;
char undo_name[sizeof "innodb_undo000"];
snprintf(undo_name, sizeof(undo_name),
"innodb_undo%03u", static_cast<unsigned>(space_id));
- if (!srv_file_check_mode(name)) {
- ib::error() << "UNDO tablespaces must be " <<
- (srv_read_only_mode ? "writable" : "readable") << "!";
-
- return(DB_ERROR);
- }
-
fh = os_file_create(
- innodb_data_file_key, name,
- OS_FILE_OPEN_RETRY
- | OS_FILE_ON_ERROR_NO_EXIT
- | OS_FILE_ON_ERROR_SILENT,
- OS_FILE_NORMAL,
- OS_DATA_FILE,
- srv_read_only_mode,
- &ret);
-
- /* If the file open was successful then load the tablespace. */
-
- if (ret) {
- os_offset_t size;
- fil_space_t* space;
-
- size = os_file_get_size(fh);
- ut_a(size != (os_offset_t) -1);
+ innodb_data_file_key, name, OS_FILE_OPEN
+ | OS_FILE_ON_ERROR_NO_EXIT | OS_FILE_ON_ERROR_SILENT,
+ OS_FILE_AIO, OS_DATA_FILE, srv_read_only_mode, &success);
+ if (!success) {
+ return false;
+ }
- ret = os_file_close(fh);
- ut_a(ret);
+ os_offset_t size = os_file_get_size(fh);
+ ut_a(size != os_offset_t(-1));
- /* Load the tablespace into InnoDB's internal
- data structures. */
+ /* Load the tablespace into InnoDB's internal data structures. */
- /* We set the biggest space id to the undo tablespace
- because InnoDB hasn't opened any other tablespace apart
- from the system tablespace. */
+ /* We set the biggest space id to the undo tablespace
+ because InnoDB hasn't opened any other tablespace apart
+ from the system tablespace. */
- fil_set_max_space_id_if_bigger(space_id);
+ fil_set_max_space_id_if_bigger(space_id);
- space = fil_space_create(
- undo_name, space_id, FSP_FLAGS_PAGE_SSIZE(),
- FIL_TYPE_TABLESPACE, NULL);
+ fil_space_t* space = fil_space_create(
+ undo_name, space_id, FSP_FLAGS_PAGE_SSIZE(),
+ FIL_TYPE_TABLESPACE, NULL);
- ut_a(fil_validate());
- ut_a(space);
+ ut_a(fil_validate());
+ ut_a(space);
- os_offset_t n_pages = size >> srv_page_size_shift;
+ fil_node_t* file = space->add(name, fh, 0, false, true);
- /* On 32-bit platforms, ulint is 32 bits and os_offset_t
- is 64 bits. It is OK to cast the n_pages to ulint because
- the unit has been scaled to pages and page number is always
- 32 bits. */
- if (fil_node_create(
- name, (ulint) n_pages, space, false, TRUE)) {
+ mutex_enter(&fil_system.mutex);
- err = DB_SUCCESS;
+ if (create_new_db) {
+ space->size = file->size = ulint(size >> srv_page_size_shift);
+ space->size_in_header = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES;
+ } else {
+ success = file->read_page0(true);
+ if (!success) {
+ os_file_close(file->handle);
+ file->handle = OS_FILE_CLOSED;
+ ut_a(fil_system.n_open > 0);
+ fil_system.n_open--;
}
}
- return(err);
+ mutex_exit(&fil_system.mutex);
+
+ return success;
}
/** Check if undo tablespaces and redo log files exist before creating a
@@ -892,12 +866,11 @@ srv_undo_tablespaces_init(bool create_new_db)
ut_a(undo_tablespace_ids[i] != 0);
ut_a(undo_tablespace_ids[i] != ULINT_UNDEFINED);
- err = srv_undo_tablespace_open(name, undo_tablespace_ids[i]);
-
- if (err != DB_SUCCESS) {
+ if (!srv_undo_tablespace_open(name, undo_tablespace_ids[i],
+ create_new_db)) {
ib::error() << "Unable to open undo tablespace '"
<< name << "'.";
- return(err);
+ return DB_ERROR;
}
prev_space_id = undo_tablespace_ids[i];
@@ -922,9 +895,8 @@ srv_undo_tablespaces_init(bool create_new_db)
name, sizeof(name),
"%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, i);
- err = srv_undo_tablespace_open(name, i);
-
- if (err != DB_SUCCESS) {
+ if (!srv_undo_tablespace_open(name, i, create_new_db)) {
+ err = DB_ERROR;
break;
}
@@ -1654,6 +1626,10 @@ dberr_t srv_start(bool create_new_db)
break;
}
+ if (stat_info.type != OS_FILE_TYPE_FILE) {
+ break;
+ }
+
if (!srv_file_check_mode(logfilename)) {
return(srv_init_abort(DB_ERROR));
}
@@ -1763,10 +1739,8 @@ dberr_t srv_start(bool create_new_db)
for (unsigned j = 0; j < srv_n_log_files_found; j++) {
sprintf(logfilename + dirnamelen, "ib_logfile%u", j);
- if (!fil_node_create(logfilename, size,
- log_space, false, false)) {
- return(srv_init_abort(DB_ERROR));
- }
+ log_space->add(logfilename, OS_FILE_CLOSED, size,
+ false, false);
}
log_sys.log.create(srv_n_log_files_found);
@@ -2358,7 +2332,7 @@ files_checked:
Create the dump/load thread only when not running with
--wsrep-recover.
*/
- if (!wsrep_recovery) {
+ if (!get_wsrep_recovery()) {
#endif /* WITH_WSREP */
/* Create the buffer pool dump/load thread */
@@ -2446,9 +2420,7 @@ void srv_shutdown_bg_undo_sources()
/** Shut down InnoDB. */
void innodb_shutdown()
{
- ut_ad(!my_atomic_loadptr_explicit(reinterpret_cast<void**>
- (&srv_running),
- MY_MEMORY_ORDER_RELAXED));
+ ut_ad(!srv_running.load(std::memory_order_relaxed));
ut_ad(!srv_undo_sources);
switch (srv_operation) {
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index 7c0c6503b21..9221a643213 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -31,7 +31,6 @@ The wait array used in synchronization primitives
Created 9/5/1995 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
#include "sync0arr.h"
#include <mysqld_error.h>
#include <mysql/plugin.h>
@@ -46,13 +45,8 @@ Created 9/5/1995 Heikki Tuuri
#include <sql_plugin.h>
#include <innodb_priv.h>
-#include "sync0sync.h"
#include "lock0lock.h"
#include "sync0rw.h"
-#include "sync0debug.h"
-#include "os0event.h"
-#include "os0file.h"
-#include "srv0srv.h"
/*
WAIT ARRAY
@@ -82,8 +76,8 @@ keep the global wait array for the sake of diagnostics and also to avoid
infinite wait The error_monitor thread scans the global wait array to signal
any waiting threads who have missed the signal. */
-typedef SyncArrayMutex::MutexType WaitMutex;
-typedef BlockSyncArrayMutex::MutexType BlockWaitMutex;
+typedef TTASEventMutex<GenericPolicy> WaitMutex;
+typedef TTASEventMutex<BlockMutexPolicy> BlockWaitMutex;
/** The latch types that use the sync array. */
union sync_object_t {
@@ -505,7 +499,7 @@ sync_array_cell_print(
WaitMutex* mutex = cell->latch.mutex;
const WaitMutex::MutexPolicy& policy = mutex->policy();
#ifdef UNIV_DEBUG
- const char* name = policy.get_enter_filename();
+ const char* name = policy.context.get_enter_filename();
if (name == NULL) {
/* The mutex might have been released. */
name = "NULL";
@@ -524,7 +518,7 @@ sync_array_cell_print(
mutex->state()
#ifdef UNIV_DEBUG
,name,
- policy.get_enter_line()
+ policy.context.get_enter_line()
#endif /* UNIV_DEBUG */
);
}
@@ -534,7 +528,7 @@ sync_array_cell_print(
const BlockWaitMutex::MutexPolicy& policy =
mutex->policy();
#ifdef UNIV_DEBUG
- const char* name = policy.get_enter_filename();
+ const char* name = policy.context.get_enter_filename();
if (name == NULL) {
/* The mutex might have been released. */
name = "NULL";
@@ -552,7 +546,7 @@ sync_array_cell_print(
(ulong) mutex->state()
#ifdef UNIV_DEBUG
,name,
- (ulong) policy.get_enter_line()
+ (ulong) policy.context.get_enter_line()
#endif /* UNIV_DEBUG */
);
} else if (type == RW_LOCK_X
@@ -597,8 +591,8 @@ sync_array_cell_print(
#endif
"\n",
rw_lock_get_reader_count(rwlock),
- my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED),
- my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED),
+ rwlock->waiters.load(std::memory_order_relaxed),
+ rwlock->lock_word.load(std::memory_order_relaxed),
innobase_basename(rwlock->last_x_file_name),
rwlock->last_x_line
#if 0 /* JAN: TODO: FIX LATER */
@@ -744,7 +738,7 @@ sync_array_detect_deadlock(
const WaitMutex::MutexPolicy& policy = mutex->policy();
if (mutex->state() != MUTEX_STATE_UNLOCKED) {
- thread = policy.get_thread_id();
+ thread = policy.context.get_thread_id();
/* Note that mutex->thread_id above may be
also OS_THREAD_ID_UNDEFINED, because the
@@ -759,7 +753,7 @@ sync_array_detect_deadlock(
if (ret) {
const char* name;
- name = policy.get_enter_filename();
+ name = policy.context.get_enter_filename();
if (name == NULL) {
/* The mutex might have been
@@ -771,7 +765,7 @@ sync_array_detect_deadlock(
<< "Mutex " << mutex << " owned by"
" thread " << os_thread_pf(thread)
<< " file " << name << " line "
- << policy.get_enter_line();
+ << policy.context.get_enter_line();
sync_array_cell_print(stderr, cell);
@@ -791,7 +785,7 @@ sync_array_detect_deadlock(
mutex->policy();
if (mutex->state() != MUTEX_STATE_UNLOCKED) {
- thread = policy.get_thread_id();
+ thread = policy.context.get_thread_id();
/* Note that mutex->thread_id above may be
also OS_THREAD_ID_UNDEFINED, because the
@@ -806,7 +800,7 @@ sync_array_detect_deadlock(
if (ret) {
const char* name;
- name = policy.get_enter_filename();
+ name = policy.context.get_enter_filename();
if (name == NULL) {
/* The mutex might have been
@@ -818,7 +812,7 @@ sync_array_detect_deadlock(
<< "Mutex " << mutex << " owned by"
" thread " << os_thread_pf(thread)
<< " file " << name << " line "
- << policy.get_enter_line();
+ << policy.context.get_enter_line();
return(true);
@@ -976,7 +970,7 @@ sync_array_print_long_waits_low(
ulint i;
/* For huge tables, skip the check during CHECK TABLE etc... */
- if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) {
+ if (btr_validate_index_running) {
return(false);
}
@@ -1385,9 +1379,9 @@ sync_arr_fill_sys_semphore_waits_table(
//fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull();
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_READERS], rw_lock_get_reader_count(rwlock)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG],
- my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED)));
+ rwlock->waiters.load(std::memory_order_relaxed)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD],
- my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED)));
+ rwlock->lock_word.load(std::memory_order_relaxed)));
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(rwlock->last_x_file_name)));
OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(rwlock->last_x_line, true));
fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index c652e6d85f2..8fa4e6c5bd2 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -32,12 +32,9 @@ Created 2012-08-21 Sunny Bains
#include "sync0sync.h"
#include "sync0debug.h"
-
-#include "ut0new.h"
#include "srv0start.h"
#include "fil0fil.h"
-#include <map>
#include <vector>
#include <string>
#include <algorithm>
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index 787d6d8501d..0f78136c71c 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -32,15 +32,6 @@ Created 9/11/1995 Heikki Tuuri
*******************************************************/
#include "sync0rw.h"
-#include "ha_prototypes.h"
-
-#include "os0thread.h"
-#include "mem0mem.h"
-#include "srv0srv.h"
-#include "os0event.h"
-#include "srv0mon.h"
-#include "sync0debug.h"
-#include "ha_prototypes.h"
#include "my_cpu.h"
#include <my_sys.h>
@@ -214,8 +205,8 @@ rw_lock_create_func(
/* If this is the very first time a synchronization object is
created, then the following call initializes the sync system. */
- lock->lock_word = X_LOCK_DECR;
- lock->waiters = 0;
+ lock->lock_word.store(X_LOCK_DECR, std::memory_order_relaxed);
+ lock->waiters.store(0, std::memory_order_relaxed);
lock->sx_recursive = 0;
lock->writer_thread= 0;
@@ -266,8 +257,7 @@ rw_lock_free_func(
rw_lock_t* lock) /*!< in/out: rw-lock */
{
ut_ad(rw_lock_validate(lock));
- ut_a(my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED) == X_LOCK_DECR);
+ ut_a(lock->lock_word.load(std::memory_order_relaxed) == X_LOCK_DECR);
mutex_enter(&rw_lock_list_mutex);
@@ -315,8 +305,7 @@ lock_loop:
/* Spin waiting for the writer field to become free */
HMT_low();
while (i < srv_n_spin_wait_rounds &&
- my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED) <= 0) {
+ lock->lock_word.load(std::memory_order_relaxed) <= 0) {
ut_delay(srv_spin_wait_delay);
i++;
}
@@ -356,7 +345,7 @@ lock_loop:
/* Set waiters before checking lock_word to ensure wake-up
signal is sent. This may lead to some unnecessary signals. */
- my_atomic_fas32_explicit(&lock->waiters, 1, MY_MEMORY_ORDER_ACQUIRE);
+ lock->waiters.exchange(1, std::memory_order_acquire);
if (rw_lock_s_lock_low(lock, pass, file_name, line)) {
@@ -434,10 +423,10 @@ rw_lock_x_lock_wait_func(
sync_array_t* sync_arr;
int64_t count_os_wait = 0;
- ut_ad(my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) <= threshold);
+ ut_ad(lock->lock_word.load(std::memory_order_relaxed) <= threshold);
HMT_low();
- while (my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) < threshold) {
+ while (lock->lock_word.load(std::memory_order_relaxed) < threshold) {
ut_delay(srv_spin_wait_delay);
if (i < srv_n_spin_wait_rounds) {
@@ -456,7 +445,7 @@ rw_lock_x_lock_wait_func(
i = 0;
/* Check lock_word to ensure wake-up isn't missed.*/
- if (my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) < threshold) {
+ if (lock->lock_word.load(std::memory_order_relaxed) < threshold) {
++count_os_wait;
@@ -546,18 +535,17 @@ rw_lock_x_lock_low(
file_name, line);
} else {
- int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_word = lock->lock_word.load(std::memory_order_relaxed);
/* At least one X lock by this thread already
exists. Add another. */
if (lock_word == 0
|| lock_word == -X_LOCK_HALF_DECR) {
- my_atomic_add32_explicit(&lock->lock_word, -X_LOCK_DECR,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_sub(X_LOCK_DECR,
+ std::memory_order_relaxed);
} else {
ut_ad(lock_word <= -X_LOCK_DECR);
- my_atomic_add32_explicit(&lock->lock_word, -1,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_sub(1,
+ std::memory_order_relaxed);
}
}
@@ -629,10 +617,10 @@ rw_lock_sx_lock_low(
read and write to the lock_word. */
#ifdef UNIV_DEBUG
- int32_t lock_word =
+ auto lock_word =
#endif
- my_atomic_add32_explicit(&lock->lock_word, -X_LOCK_HALF_DECR,
- MY_MEMORY_ORDER_RELAXED);
+ lock->lock_word.fetch_sub(X_LOCK_HALF_DECR,
+ std::memory_order_relaxed);
ut_ad((lock_word == 0)
|| ((lock_word <= -X_LOCK_DECR)
@@ -700,7 +688,7 @@ lock_loop:
/* Spin waiting for the lock_word to become free */
HMT_low();
while (i < srv_n_spin_wait_rounds
- && my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) <= X_LOCK_HALF_DECR) {
+ && lock->lock_word.load(std::memory_order_relaxed) <= X_LOCK_HALF_DECR) {
ut_delay(srv_spin_wait_delay);
i++;
}
@@ -725,7 +713,7 @@ lock_loop:
/* Waiters must be set before checking lock_word, to ensure signal
is sent. This could lead to a few unnecessary wake-up signals. */
- my_atomic_fas32_explicit(&lock->waiters, 1, MY_MEMORY_ORDER_ACQUIRE);
+ lock->waiters.exchange(1, std::memory_order_acquire);
if (rw_lock_x_lock_low(lock, pass, file_name, line)) {
sync_array_free_cell(sync_arr, cell);
@@ -801,7 +789,7 @@ lock_loop:
/* Spin waiting for the lock_word to become free */
while (i < srv_n_spin_wait_rounds
- && my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) <= X_LOCK_HALF_DECR) {
+ && lock->lock_word.load(std::memory_order_relaxed) <= X_LOCK_HALF_DECR) {
ut_delay(srv_spin_wait_delay);
i++;
}
@@ -825,7 +813,7 @@ lock_loop:
/* Waiters must be set before checking lock_word, to ensure signal
is sent. This could lead to a few unnecessary wake-up signals. */
- my_atomic_fas32_explicit(&lock->waiters, 1, MY_MEMORY_ORDER_ACQUIRE);
+ lock->waiters.exchange(1, std::memory_order_acquire);
if (rw_lock_sx_lock_low(lock, pass, file_name, line)) {
@@ -868,12 +856,10 @@ rw_lock_validate(
ut_ad(lock);
- lock_word = my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word),
- MY_MEMORY_ORDER_RELAXED);
+ lock_word = lock->lock_word.load(std::memory_order_relaxed);
ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
- ut_ad(my_atomic_load32_explicit(const_cast<int32_t*>(&lock->waiters),
- MY_MEMORY_ORDER_RELAXED) < 2);
+ ut_ad(lock->waiters.load(std::memory_order_relaxed) < 2);
ut_ad(lock_word > -(2 * X_LOCK_DECR));
ut_ad(lock_word <= X_LOCK_DECR);
@@ -936,8 +922,7 @@ rw_lock_add_debug_info(
rw_lock_debug_mutex_exit();
if (pass == 0 && lock_type != RW_LOCK_X_WAIT) {
- int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word,
- MY_MEMORY_ORDER_RELAXED);
+ auto lock_word = lock->lock_word.load(std::memory_order_relaxed);
/* Recursive x while holding SX
(lock_type == RW_LOCK_X && lock_word == -X_LOCK_HALF_DECR)
@@ -1103,11 +1088,11 @@ rw_lock_list_print_info(
count++;
- if (my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word), MY_MEMORY_ORDER_RELAXED) != X_LOCK_DECR) {
+ if (lock->lock_word.load(std::memory_order_relaxed) != X_LOCK_DECR) {
fprintf(file, "RW-LOCK: %p ", (void*) lock);
- if (int32_t waiters= my_atomic_load32_explicit(const_cast<int32_t*>(&lock->waiters), MY_MEMORY_ORDER_RELAXED)) {
+ if (int32_t waiters= lock->waiters.load(std::memory_order_relaxed)) {
fprintf(file, " (%d waiters)\n", waiters);
} else {
putc('\n', file);
@@ -1171,10 +1156,10 @@ rw_lock_debug_print(
fprintf(f, "\n");
}
-/** Print where it was locked from
+/** Print the rw-lock information.
@return the string representation */
std::string
-rw_lock_t::locked_from() const
+rw_lock_t::to_string() const
{
/* Note: For X locks it can be locked form multiple places because
the same thread can call X lock recursively. */
@@ -1184,6 +1169,11 @@ rw_lock_t::locked_from() const
ut_ad(rw_lock_validate(this));
+ msg << "RW-LATCH: "
+ << "thread id " << os_thread_pf(os_thread_get_curr_id())
+ << " addr: " << this
+ << " Locked from: ";
+
rw_lock_debug_mutex_enter();
for (rw_lock_debug_t* info = UT_LIST_GET_FIRST(debug_list);
@@ -1206,19 +1196,4 @@ rw_lock_t::locked_from() const
return(msg.str());
}
-
-/** Print the rw-lock information.
-@return the string representation */
-std::string
-rw_lock_t::to_string() const
-{
- std::ostringstream msg;
-
- msg << "RW-LATCH: "
- << "thread id " << os_thread_pf(os_thread_get_curr_id())
- << " addr: " << this
- << " Locked from: " << locked_from().c_str();
-
- return(msg.str());
-}
#endif /* UNIV_DEBUG */
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index a64290fda4a..3873e8532e7 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -30,7 +30,6 @@ Mutex, the basic synchronization primitive
Created 9/5/1995 Heikki Tuuri
*******************************************************/
-#include "univ.i"
#include "sync0rw.h"
#include "sync0sync.h"
diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc
index 663f39d8b7e..965faaba478 100644
--- a/storage/innobase/trx/trx0i_s.cc
+++ b/storage/innobase/trx/trx0i_s.cc
@@ -29,16 +29,7 @@ table cache" for later retrieval.
Created July 17, 2007 Vasil Dimov
*******************************************************/
-/* Found during the build of 5.5.3 on Linux 2.4 and early 2.6 kernels:
- The includes "univ.i" -> "my_global.h" cause a different path
- to be taken further down with pthread functions and types,
- so they must come first.
- From the symptoms, this is related to bug#46587 in the MySQL bug DB.
-*/
-
-#include "ha_prototypes.h"
-#include <sql_class.h>
-
+#include "trx0i_s.h"
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
@@ -52,10 +43,7 @@ Created July 17, 2007 Vasil Dimov
#include "srv0srv.h"
#include "sync0rw.h"
#include "sync0sync.h"
-#include "trx0i_s.h"
#include "trx0sys.h"
-#include "trx0trx.h"
-#include "ut0mem.h"
#include "que0que.h"
#include "trx0purge.h"
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 0802805e281..4a5204f299b 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -24,8 +24,6 @@ Purge old versions
Created 3/26/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "trx0purge.h"
#include "fsp0fsp.h"
#include "fut0fut.h"
@@ -36,7 +34,6 @@ Created 3/26/1996 Heikki Tuuri
#include "row0purge.h"
#include "row0upd.h"
#include "srv0mon.h"
-#include "fsp0sysspace.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "sync0sync.h"
@@ -167,8 +164,6 @@ void purge_sys_t::create()
ut_ad(event);
m_paused= 0;
query= purge_graph_build();
- n_submitted= 0;
- n_completed= 0;
next_stored= false;
rseg= NULL;
page_no= 0;
@@ -187,7 +182,8 @@ void purge_sys_t::close()
ut_ad(this == &purge_sys);
if (!event) return;
- m_enabled= false;
+ ut_ad(!enabled());
+ ut_ad(n_tasks.load(std::memory_order_relaxed) == 0);
trx_t* trx = query->trx;
que_graph_free(query);
ut_ad(!trx->id);
@@ -318,7 +314,7 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
rseg->needs_purge = true;
}
- trx_sys.history_insert();
+ trx_sys.rseg_history_len++;
if (undo->state == TRX_UNDO_CACHED) {
UT_LIST_ADD_FIRST(rseg->undo_cached, undo);
@@ -344,7 +340,7 @@ trx_purge_remove_log_hdr(
{
flst_remove(rseg_hdr + TRX_RSEG_HISTORY,
log_hdr + TRX_UNDO_HISTORY_NODE, mtr);
- trx_sys.history_remove();
+ trx_sys.rseg_history_len--;
}
/** Free an undo log segment, and remove the header from the history list.
@@ -783,7 +779,7 @@ not_free:
os_offset_t(size) << srv_page_size_shift,
true);
- /* This is only executed by the srv_coordinator_thread. */
+ /* This is only executed by srv_purge_coordinator_thread. */
export_vars.innodb_undo_truncations++;
/* TODO: PUNCH_HOLE the garbage (with write-ahead logging) */
@@ -1243,7 +1239,7 @@ trx_purge_dml_delay(void)
if (srv_max_purge_lag > 0) {
float ratio;
- ratio = float(trx_sys.history_size()) / srv_max_purge_lag;
+ ratio = float(trx_sys.rseg_history_len) / srv_max_purge_lag;
if (ratio > 1.0) {
/* If the history list length exceeds the
@@ -1269,8 +1265,7 @@ void
trx_purge_wait_for_workers_to_complete()
{
/* Ensure that the work queue empties out. */
- while (my_atomic_loadlint(&purge_sys.n_completed)
- != purge_sys.n_submitted) {
+ while (purge_sys.n_tasks.load(std::memory_order_acquire)) {
if (srv_get_task_queue_length() > 0) {
srv_release_threads(SRV_WORKER, 1);
@@ -1301,9 +1296,8 @@ trx_purge(
srv_dml_needed_delay = trx_purge_dml_delay();
- /* The number of tasks submitted should be completed. */
- ut_a(purge_sys.n_submitted
- == my_atomic_loadlint(&purge_sys.n_completed));
+ /* All submitted tasks should be completed. */
+ ut_ad(purge_sys.n_tasks.load(std::memory_order_relaxed) == 0);
rw_lock_x_lock(&purge_sys.latch);
trx_sys.clone_oldest_view();
@@ -1317,7 +1311,7 @@ trx_purge(
/* Fetch the UNDO recs that need to be purged. */
n_pages_handled = trx_purge_attach_undo_recs(n_purge_threads);
- purge_sys.n_submitted += n_purge_threads;
+ purge_sys.n_tasks.store(n_purge_threads - 1, std::memory_order_relaxed);
/* Submit tasks to workers queue if using multi-threaded purge. */
for (ulint i = n_purge_threads; --i; ) {
@@ -1330,14 +1324,9 @@ trx_purge(
que_run_threads(thr);
- my_atomic_addlint(&purge_sys.n_completed, 1);
-
- if (n_purge_threads > 1) {
- trx_purge_wait_for_workers_to_complete();
- }
+ trx_purge_wait_for_workers_to_complete();
- ut_a(purge_sys.n_submitted
- == my_atomic_loadlint(&purge_sys.n_completed));
+ ut_ad(purge_sys.n_tasks.load(std::memory_order_relaxed) == 0);
if (truncate) {
trx_purge_truncate_history();
@@ -1354,7 +1343,7 @@ void purge_sys_t::stop()
{
rw_lock_x_lock(&latch);
- if (!enabled_latched())
+ if (!enabled())
{
/* Shutdown must have been initiated during FLUSH TABLES FOR EXPORT. */
ut_ad(!srv_undo_sources);
@@ -1364,7 +1353,7 @@ void purge_sys_t::stop()
ut_ad(srv_n_purge_threads > 0);
- if (0 == my_atomic_add32_explicit(&m_paused, 1, MY_MEMORY_ORDER_RELAXED))
+ if (m_paused++ == 0)
{
/* We need to wakeup the purge thread in case it is suspended, so
that it can acknowledge the state change. */
@@ -1398,8 +1387,7 @@ void purge_sys_t::resume()
return;
}
- int32_t paused= my_atomic_add32_explicit(&m_paused, -1,
- MY_MEMORY_ORDER_RELAXED);
+ int32_t paused= m_paused--;
ut_a(paused);
if (paused == 1)
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index a2f08fdb074..595c2a15fb3 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -37,7 +37,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0purge.h"
#include "trx0rseg.h"
#include "row0row.h"
-#include "fsp0sysspace.h"
#include "row0mysql.h"
/** The search tuple corresponding to TRX_UNDO_INSERT_METADATA. */
@@ -954,9 +953,7 @@ trx_undo_page_report_modify(
*ptr++ = (byte) rec_get_info_bits(rec, dict_table_is_comp(table));
/* Store the values of the system columns */
- field = rec_get_nth_field(rec, offsets,
- dict_index_get_sys_col_pos(
- index, DATA_TRX_ID), &flen);
+ field = rec_get_nth_field(rec, offsets, index->db_trx_id(), &flen);
ut_ad(flen == DATA_TRX_ID_LEN);
trx_id = trx_read_trx_id(field);
@@ -970,9 +967,7 @@ trx_undo_page_report_modify(
}
ptr += mach_u64_write_compressed(ptr, trx_id);
- field = rec_get_nth_field(rec, offsets,
- dict_index_get_sys_col_pos(
- index, DATA_ROLL_PTR), &flen);
+ field = rec_get_nth_field(rec, offsets, index->db_roll_ptr(), &flen);
ut_ad(flen == DATA_ROLL_PTR_LEN);
ut_ad(memcmp(field, field_ref_zero, DATA_ROLL_PTR_LEN));
@@ -1340,6 +1335,8 @@ store_len:
table, col);
ut_a(prefix_len < sizeof ext_buf);
+ const page_size_t& page_size
+ = dict_table_page_size(table);
/* If there is a spatial index on it,
log its MBR */
@@ -1348,9 +1345,7 @@ store_len:
col->mtype));
trx_undo_get_mbr_from_ext(
- mbr,
- dict_table_page_size(
- table),
+ mbr, page_size,
field, &flen);
}
@@ -1359,7 +1354,7 @@ store_len:
flen < REC_ANTELOPE_MAX_INDEX_COL_LEN
&& !ignore_prefix
? ext_buf : NULL, prefix_len,
- dict_table_page_size(table),
+ page_size,
&field, &flen,
spatial_status);
} else {
@@ -1553,7 +1548,6 @@ trx_undo_update_rec_get_update(
upd_t* update;
ulint n_fields;
byte* buf;
- ulint i;
bool first_v_col = true;
bool is_undo_log = true;
ulint n_skip_field = 0;
@@ -1566,7 +1560,7 @@ trx_undo_update_rec_get_update(
n_fields = 0;
}
- update = upd_create(n_fields + 2, heap);
+ *upd = update = upd_create(n_fields + 2, heap);
update->info_bits = info_bits;
@@ -1578,9 +1572,7 @@ trx_undo_update_rec_get_update(
mach_write_to_6(buf, trx_id);
- upd_field_set_field_no(upd_field,
- dict_index_get_sys_col_pos(index, DATA_TRX_ID),
- index);
+ upd_field_set_field_no(upd_field, index->db_trx_id(), index);
dfield_set_data(&(upd_field->new_val), buf, DATA_TRX_ID_LEN);
upd_field = upd_get_nth_field(update, n_fields + 1);
@@ -1589,15 +1581,12 @@ trx_undo_update_rec_get_update(
trx_write_roll_ptr(buf, roll_ptr);
- upd_field_set_field_no(
- upd_field, dict_index_get_sys_col_pos(index, DATA_ROLL_PTR),
- index);
+ upd_field_set_field_no(upd_field, index->db_roll_ptr(), index);
dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN);
/* Store then the updated ordinary columns to the update vector */
- for (i = 0; i < n_fields; i++) {
-
+ for (ulint i = 0; i < n_fields; i++) {
const byte* field;
ulint len;
ulint orig_len;
@@ -1630,23 +1619,53 @@ trx_undo_update_rec_get_update(
upd_field_set_v_field_no(upd_field, field_no, index);
} else if (UNIV_UNLIKELY((update->info_bits
& ~REC_INFO_DELETED_FLAG)
- == REC_INFO_MIN_REC_FLAG)
- && index->is_instant()) {
+ == REC_INFO_MIN_REC_FLAG)) {
+ ut_ad(type == TRX_UNDO_UPD_EXIST_REC);
const ulint uf = index->first_user_field();
ut_ad(field_no >= uf);
if (update->info_bits != REC_INFO_MIN_REC_FLAG) {
+ /* Generic instant ALTER TABLE */
if (field_no == uf) {
upd_field->new_val.type
.metadata_blob_init();
+ } else if (field_no >= index->n_fields) {
+ /* This is reachable during
+ purge if the table was emptied
+ and converted to the canonical
+ format on a later ALTER TABLE.
+ In this case,
+ row_purge_upd_exist_or_extern()
+ would only be interested in
+ freeing any BLOBs that were
+ updated, that is, the metadata
+ BLOB above. Other BLOBs in
+ the metadata record are never
+ updated; they are for the
+ initial DEFAULT values of the
+ instantly added columns, and
+ they will never change.
+
+ Note: if the table becomes
+ empty during ROLLBACK or is
+ empty during subsequent ALTER
+ TABLE, and btr_page_empty() is
+ called to re-create the root
+ page without the metadata
+ record, in that case we should
+ only free the latest version
+ of BLOBs in the record,
+ which purge would never touch. */
+ field_no = REC_MAX_N_FIELDS;
+ n_skip_field++;
} else {
- ut_ad(field_no > uf);
dict_col_copy_type(
dict_index_get_nth_col(
index, field_no - 1),
&upd_field->new_val.type);
}
} else {
+ /* Instant ADD COLUMN...LAST */
dict_col_copy_type(
dict_index_get_nth_col(index,
field_no),
@@ -1710,31 +1729,23 @@ trx_undo_update_rec_get_update(
}
}
- /* In rare scenario, we could have skipped virtual column (as they
- are dropped. We will regenerate a update vector and skip them */
- if (n_skip_field > 0) {
- ulint n = 0;
- ut_ad(n_skip_field <= n_fields);
+ /* We may have to skip dropped indexed virtual columns.
+ Also, we may have to trim the update vector of a metadata record
+ if dict_index_t::clear_instant_alter() was invoked on the table
+ later, and the number of fields no longer matches. */
- upd_t* new_update = upd_create(
- n_fields + 2 - n_skip_field, heap);
+ if (n_skip_field) {
+ upd_field_t* d = upd_get_nth_field(update, 0);
+ const upd_field_t* const end = d + n_fields + 2;
- for (i = 0; i < n_fields + 2; i++) {
- upd_field = upd_get_nth_field(update, i);
-
- if (upd_field->field_no == REC_MAX_N_FIELDS) {
- continue;
+ for (const upd_field_t* s = d; s != end; s++) {
+ if (s->field_no != REC_MAX_N_FIELDS) {
+ *d++ = *s;
}
-
- upd_field_t* new_upd_field
- = upd_get_nth_field(new_update, n);
- *new_upd_field = *upd_field;
- n++;
}
- ut_ad(n == n_fields + 2 - n_skip_field);
- *upd = new_update;
- } else {
- *upd = update;
+
+ ut_ad(d + n_skip_field == end);
+ update->n_fields = d - upd_get_nth_field(update, 0);
}
return(const_cast<byte*>(ptr));
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index f7f6dff4380..22b72a14304 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -24,12 +24,9 @@ Transaction rollback
Created 3/26/1996 Heikki Tuuri
*******************************************************/
-#include "my_config.h"
-#include <my_service_manager.h>
-
-#include "ha_prototypes.h"
#include "trx0roll.h"
+#include <my_service_manager.h>
#include <mysql/service_wsrep.h>
#include "fsp0fsp.h"
@@ -46,11 +43,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0sys.h"
#include "trx0trx.h"
#include "trx0undo.h"
-#include "ha_prototypes.h"
-
-/** This many pages must be undone before a truncate is tried within
-rollback */
-static const ulint TRX_ROLL_TRUNC_THRESHOLD = 1;
/** true if trx_rollback_all_recovered() thread is active */
bool trx_rollback_is_active;
@@ -186,6 +178,11 @@ trx_rollback_to_savepoint(
partial rollback requested, or NULL for
complete rollback */
{
+#ifdef WITH_WSREP
+ if (savept == NULL && wsrep_on(trx->mysql_thd)) {
+ wsrep_handle_SR_rollback(NULL, trx->mysql_thd);
+ }
+#endif /* WITH_WSREP */
ut_ad(!trx_mutex_own(trx));
trx_start_if_not_started_xa(trx, true);
@@ -454,12 +451,8 @@ trx_rollback_to_savepoint_for_mysql_low(
trx_mark_sql_stat_end(trx);
trx->op_info = "";
-
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- trx->lock.was_chosen_as_deadlock_victim) {
- trx->lock.was_chosen_as_deadlock_victim = FALSE;
- }
+ trx->lock.was_chosen_as_wsrep_victim = FALSE;
#endif
return(err);
}
@@ -878,175 +871,6 @@ DECLARE_THREAD(trx_rollback_all_recovered)(void*)
OS_THREAD_DUMMY_RETURN;
}
-/** Try to truncate the undo logs.
-@param[in,out] trx transaction */
-static
-void
-trx_roll_try_truncate(trx_t* trx)
-{
- trx->pages_undone = 0;
-
- undo_no_t undo_no = trx->undo_no;
-
- if (trx_undo_t* undo = trx->rsegs.m_redo.undo) {
- ut_ad(undo->rseg == trx->rsegs.m_redo.rseg);
- mutex_enter(&undo->rseg->mutex);
- trx_undo_truncate_end(undo, undo_no, false);
- mutex_exit(&undo->rseg->mutex);
- }
-
- if (trx_undo_t* undo = trx->rsegs.m_noredo.undo) {
- ut_ad(undo->rseg == trx->rsegs.m_noredo.rseg);
- mutex_enter(&undo->rseg->mutex);
- trx_undo_truncate_end(undo, undo_no, true);
- mutex_exit(&undo->rseg->mutex);
- }
-
-#ifdef WITH_WSREP_OUT
- if (wsrep_on(trx->mysql_thd)) {
- trx->lock.was_chosen_as_deadlock_victim = FALSE;
- }
-#endif /* WITH_WSREP */
-}
-
-/***********************************************************************//**
-Pops the topmost undo log record in a single undo log and updates the info
-about the topmost record in the undo log memory struct.
-@return undo log record, the page s-latched */
-static
-trx_undo_rec_t*
-trx_roll_pop_top_rec(
-/*=================*/
- trx_t* trx, /*!< in: transaction */
- trx_undo_t* undo, /*!< in: undo log */
- mtr_t* mtr) /*!< in: mtr */
-{
- page_t* undo_page = trx_undo_page_get_s_latched(
- page_id_t(undo->rseg->space->id, undo->top_page_no), mtr);
-
- ulint offset = undo->top_offset;
-
- trx_undo_rec_t* prev_rec = trx_undo_get_prev_rec(
- undo_page + offset, undo->hdr_page_no, undo->hdr_offset,
- true, mtr);
-
- if (prev_rec == NULL) {
- undo->top_undo_no = IB_ID_MAX;
- ut_ad(undo->empty());
- } else {
- page_t* prev_rec_page = page_align(prev_rec);
-
- if (prev_rec_page != undo_page) {
-
- trx->pages_undone++;
- }
-
- undo->top_page_no = page_get_page_no(prev_rec_page);
- undo->top_offset = ulint(prev_rec - prev_rec_page);
- undo->top_undo_no = trx_undo_rec_get_undo_no(prev_rec);
- ut_ad(!undo->empty());
- }
-
- return(undo_page + offset);
-}
-
-/** Get the last undo log record of a transaction (for rollback).
-@param[in,out] trx transaction
-@param[out] roll_ptr DB_ROLL_PTR to the undo record
-@param[in,out] heap memory heap for allocation
-@return undo log record copied to heap
-@retval NULL if none left or the roll_limit (savepoint) was reached */
-trx_undo_rec_t*
-trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap)
-{
- if (trx->pages_undone >= TRX_ROLL_TRUNC_THRESHOLD) {
- trx_roll_try_truncate(trx);
- }
-
- trx_undo_t* undo = NULL;
- trx_undo_t* insert = trx->rsegs.m_redo.old_insert;
- trx_undo_t* update = trx->rsegs.m_redo.undo;
- trx_undo_t* temp = trx->rsegs.m_noredo.undo;
- const undo_no_t limit = trx->roll_limit;
-
- ut_ad(!insert || !update || insert->empty() || update->empty()
- || insert->top_undo_no != update->top_undo_no);
- ut_ad(!insert || !temp || insert->empty() || temp->empty()
- || insert->top_undo_no != temp->top_undo_no);
- ut_ad(!update || !temp || update->empty() || temp->empty()
- || update->top_undo_no != temp->top_undo_no);
-
- if (UNIV_LIKELY_NULL(insert)
- && !insert->empty() && limit <= insert->top_undo_no) {
- undo = insert;
- }
-
- if (update && !update->empty() && update->top_undo_no >= limit) {
- if (!undo) {
- undo = update;
- } else if (undo->top_undo_no < update->top_undo_no) {
- undo = update;
- }
- }
-
- if (temp && !temp->empty() && temp->top_undo_no >= limit) {
- if (!undo) {
- undo = temp;
- } else if (undo->top_undo_no < temp->top_undo_no) {
- undo = temp;
- }
- }
-
- if (undo == NULL) {
- trx_roll_try_truncate(trx);
- /* Mark any ROLLBACK TO SAVEPOINT completed, so that
- if the transaction object is committed and reused
- later, we will default to a full ROLLBACK. */
- trx->roll_limit = 0;
- trx->in_rollback = false;
- return(NULL);
- }
-
- ut_ad(!undo->empty());
- ut_ad(limit <= undo->top_undo_no);
-
- *roll_ptr = trx_undo_build_roll_ptr(
- false, undo->rseg->id, undo->top_page_no, undo->top_offset);
-
- mtr_t mtr;
- mtr.start();
-
- trx_undo_rec_t* undo_rec = trx_roll_pop_top_rec(trx, undo, &mtr);
- const undo_no_t undo_no = trx_undo_rec_get_undo_no(undo_rec);
- switch (trx_undo_rec_get_type(undo_rec)) {
- case TRX_UNDO_INSERT_METADATA:
- /* This record type was introduced in MDEV-11369
- instant ADD COLUMN, which was implemented after
- MDEV-12288 removed the insert_undo log. There is no
- instant ADD COLUMN for temporary tables. Therefore,
- this record can only be present in the main undo log. */
- ut_ad(undo == update);
- /* fall through */
- case TRX_UNDO_RENAME_TABLE:
- ut_ad(undo == insert || undo == update);
- /* fall through */
- case TRX_UNDO_INSERT_REC:
- ut_ad(undo == insert || undo == update || undo == temp);
- *roll_ptr |= 1ULL << ROLL_PTR_INSERT_FLAG_POS;
- break;
- default:
- ut_ad(undo == update || undo == temp);
- break;
- }
-
- trx->undo_no = undo_no;
-
- trx_undo_rec_t* undo_rec_copy = trx_undo_rec_copy(undo_rec, heap);
- mtr.commit();
-
- return(undo_rec_copy);
-}
-
/****************************************************************//**
Builds an undo 'query' graph for a transaction. The actual rollback is
performed by executing this query graph like a query subprocedure call.
diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc
index bfa49b88d1d..239df440c2b 100644
--- a/storage/innobase/trx/trx0rseg.cc
+++ b/storage/innobase/trx/trx0rseg.cc
@@ -30,7 +30,6 @@ Created 3/26/1996 Heikki Tuuri
#include "srv0srv.h"
#include "trx0purge.h"
#include "srv0mon.h"
-#include "fsp0sysspace.h"
#include <algorithm>
@@ -44,6 +43,33 @@ static long long wsrep_seqno = -1;
/** The latest known WSREP XID UUID */
static unsigned char wsrep_uuid[16];
+/** Write the WSREP XID information into rollback segment header.
+@param[in,out] rseg_header rollback segment header
+@param[in] xid WSREP XID
+@param[in,out] mtr mini transaction */
+static void
+trx_rseg_write_wsrep_checkpoint(
+ trx_rsegf_t* rseg_header,
+ const XID* xid,
+ mtr_t* mtr)
+{
+ mlog_write_ulint(TRX_RSEG_WSREP_XID_FORMAT + rseg_header,
+ uint32_t(xid->formatID),
+ MLOG_4BYTES, mtr);
+
+ mlog_write_ulint(TRX_RSEG_WSREP_XID_GTRID_LEN + rseg_header,
+ uint32_t(xid->gtrid_length),
+ MLOG_4BYTES, mtr);
+
+ mlog_write_ulint(TRX_RSEG_WSREP_XID_BQUAL_LEN + rseg_header,
+ uint32_t(xid->bqual_length),
+ MLOG_4BYTES, mtr);
+
+ mlog_write_string(TRX_RSEG_WSREP_XID_DATA + rseg_header,
+ reinterpret_cast<const byte*>(xid->data),
+ XIDDATASIZE, mtr);
+}
+
/** Update the WSREP XID information in rollback segment header.
@param[in,out] rseg_header rollback segment header
@param[in] xid WSREP XID
@@ -61,29 +87,15 @@ trx_rseg_update_wsrep_checkpoint(
long long xid_seqno = wsrep_xid_seqno(xid);
const byte* xid_uuid = wsrep_xid_uuid(xid);
- if (!memcmp(xid_uuid, wsrep_uuid, sizeof wsrep_uuid)) {
+ if (xid_seqno != -1
+ && !memcmp(xid_uuid, wsrep_uuid, sizeof wsrep_uuid)) {
ut_ad(xid_seqno > wsrep_seqno);
} else {
memcpy(wsrep_uuid, xid_uuid, sizeof wsrep_uuid);
}
wsrep_seqno = xid_seqno;
#endif /* UNIV_DEBUG */
-
- mlog_write_ulint(TRX_RSEG_WSREP_XID_FORMAT + rseg_header,
- uint32_t(xid->formatID),
- MLOG_4BYTES, mtr);
-
- mlog_write_ulint(TRX_RSEG_WSREP_XID_GTRID_LEN + rseg_header,
- uint32_t(xid->gtrid_length),
- MLOG_4BYTES, mtr);
-
- mlog_write_ulint(TRX_RSEG_WSREP_XID_BQUAL_LEN + rseg_header,
- uint32_t(xid->bqual_length),
- MLOG_4BYTES, mtr);
-
- mlog_write_string(TRX_RSEG_WSREP_XID_DATA + rseg_header,
- reinterpret_cast<const byte*>(xid->data),
- XIDDATASIZE, mtr);
+ trx_rseg_write_wsrep_checkpoint(rseg_header, xid, mtr);
}
/** Update WSREP checkpoint XID in first rollback segment header
@@ -98,6 +110,13 @@ void trx_rseg_update_wsrep_checkpoint(const XID* xid)
mtr_t mtr;
mtr.start();
+ const byte* xid_uuid = wsrep_xid_uuid(xid);
+ /* We must make check against wsrep_uuid here, the
+ trx_rseg_update_wsrep_checkpoint() writes over wsrep_uuid with
+ xid contents in debug mode and the memcmp() will never give nonzero
+ result. */
+ const bool must_clear_rsegs = memcmp(wsrep_uuid, xid_uuid,
+ sizeof wsrep_uuid);
const trx_rseg_t* rseg = trx_sys.rseg_array[0];
trx_rsegf_t* rseg_header = trx_rsegf_get(rseg->space, rseg->page_no,
@@ -108,10 +127,11 @@ void trx_rseg_update_wsrep_checkpoint(const XID* xid)
trx_rseg_update_wsrep_checkpoint(rseg_header, xid, &mtr);
- const byte* xid_uuid = wsrep_xid_uuid(xid);
- if (memcmp(wsrep_uuid, xid_uuid, sizeof wsrep_uuid)) {
+ if (must_clear_rsegs) {
+ XID null_xid;
+ memset(&null_xid, 0, sizeof null_xid);
+ null_xid.null();
memcpy(wsrep_uuid, xid_uuid, sizeof wsrep_uuid);
-
/* Because the UUID part of the WSREP XID differed
from current_xid_uuid, the WSREP group UUID was
changed, and we must reset the XID in all rollback
@@ -119,10 +139,12 @@ void trx_rseg_update_wsrep_checkpoint(const XID* xid)
for (ulint rseg_id = 1; rseg_id < TRX_SYS_N_RSEGS; ++rseg_id) {
if (const trx_rseg_t* rseg =
trx_sys.rseg_array[rseg_id]) {
- trx_rseg_update_wsrep_checkpoint(
+ trx_rseg_write_wsrep_checkpoint(
trx_rsegf_get(rseg->space,
- rseg->page_no, &mtr),
- xid, &mtr);
+ rseg->page_no,
+ &mtr),
+ &null_xid,
+ &mtr);
}
}
}
@@ -469,8 +491,8 @@ trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr)
rseg->curr_size = mach_read_from_4(rseg_header + TRX_RSEG_HISTORY_SIZE)
+ 1 + trx_undo_lists_init(rseg, max_trx_id, rseg_header);
- if (ulint len = flst_get_len(rseg_header + TRX_RSEG_HISTORY)) {
- trx_sys.history_add(int32(len));
+ if (auto len = flst_get_len(rseg_header + TRX_RSEG_HISTORY)) {
+ trx_sys.rseg_history_len += len;
fil_addr_t node_addr = trx_purge_get_log_from_hist(
flst_get_last(rseg_header + TRX_RSEG_HISTORY, mtr));
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 003a2e70f93..6a19332a6b6 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -24,10 +24,8 @@ Transaction system
Created 3/26/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
-#include "mysqld.h"
#include "trx0sys.h"
+#include "mysqld.h"
#include "sql_error.h"
#include "fsp0fsp.h"
@@ -42,9 +40,6 @@ Created 3/26/1996 Heikki Tuuri
#include "log0log.h"
#include "log0recv.h"
#include "os0file.h"
-#include "fsp0sysspace.h"
-
-#include <mysql/service_wsrep.h>
/** The transaction system */
trx_sys_t trx_sys;
@@ -217,7 +212,7 @@ trx_sys_t::create()
m_initialised = true;
mutex_create(LATCH_ID_TRX_SYS, &mutex);
UT_LIST_INIT(trx_list, &trx_t::trx_list);
- my_atomic_store32(&rseg_history_len, 0);
+ rseg_history_len= 0;
rw_trx_hash.init();
}
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 0177623f908..7be760c6221 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -24,8 +24,6 @@ The transaction
Created 3/26/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "trx0trx.h"
#ifdef WITH_WSREP
@@ -41,7 +39,6 @@ Created 3/26/1996 Heikki Tuuri
#include "que0que.h"
#include "srv0mon.h"
#include "srv0srv.h"
-#include "fsp0sysspace.h"
#include "srv0start.h"
#include "trx0purge.h"
#include "trx0rec.h"
@@ -49,7 +46,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0rseg.h"
#include "trx0undo.h"
#include "trx0xa.h"
-#include "ut0new.h"
#include "ut0pool.h"
#include "ut0vec.h"
@@ -788,9 +784,7 @@ trx_lists_init_at_db_start()
evenly distributed between 0 and innodb_undo_logs-1
@return persistent rollback segment
@retval NULL if innodb_read_only */
-static
-trx_rseg_t*
-trx_assign_rseg_low()
+static trx_rseg_t* trx_assign_rseg_low()
{
if (srv_read_only_mode) {
ut_ad(srv_undo_logs == ULONG_UNDEFINED);
@@ -841,8 +835,8 @@ trx_assign_rseg_low()
ut_ad(rseg->is_persistent());
if (rseg->space != fil_system.sys_space) {
- ut_ad(srv_undo_tablespaces > 1);
- if (rseg->skip_allocation) {
+ if (rseg->skip_allocation
+ || !srv_undo_tablespaces) {
continue;
}
} else if (trx_rseg_t* next
@@ -1447,11 +1441,8 @@ trx_commit_in_memory(
trx_mutex_enter(trx);
trx->dict_operation = TRX_DICT_OP_NONE;
-
#ifdef WITH_WSREP
- if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) {
- trx->lock.was_chosen_as_deadlock_victim = FALSE;
- }
+ trx->lock.was_chosen_as_wsrep_victim = FALSE;
#endif
DBUG_LOG("trx", "Commit in memory: " << trx);
@@ -1464,7 +1455,9 @@ trx_commit_in_memory(
trx_mutex_exit(trx);
ut_a(trx->error_state == DB_SUCCESS);
- srv_wake_purge_thread_if_not_active();
+ if (!srv_read_only_mode) {
+ srv_wake_purge_thread_if_not_active();
+ }
}
/** Commit a transaction and a mini-transaction.
@@ -2154,6 +2147,12 @@ static my_bool trx_get_trx_by_xid_callback(rw_trx_hash_element_t *element,
if (trx->is_recovered && trx_state_eq(trx, TRX_STATE_PREPARED) &&
arg->xid->eq(reinterpret_cast<XID*>(trx->xid)))
{
+#ifdef WITH_WSREP
+ /* The commit of a prepared recovered Galera
+ transaction needs a valid trx->xid for
+ invoking trx_sys_update_wsrep_checkpoint(). */
+ if (!wsrep_is_wsrep_xid(trx->xid))
+#endif /* WITH_WSREP */
/* Invalidate the XID, so that subsequent calls will not find it. */
trx->xid->null();
arg->trx= trx;
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index 0c31299486b..e084b0b67bf 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -24,8 +24,6 @@ Transaction undo log
Created 3/26/1996 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
#include "trx0undo.h"
#include "fsp0fsp.h"
#include "mach0data.h"
@@ -36,7 +34,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0purge.h"
#include "trx0rec.h"
#include "trx0rseg.h"
-#include "trx0trx.h"
/* How should the old versions in the history list be managed?
----------------------------------------------------------
@@ -891,54 +888,55 @@ trx_undo_free_last_page(trx_undo_t* undo, mtr_t* mtr)
@param[in,out] undo undo log
@param[in] limit all undo logs after this limit will be discarded
@param[in] is_temp whether this is temporary undo log */
-void
-trx_undo_truncate_end(trx_undo_t* undo, undo_no_t limit, bool is_temp)
+void trx_undo_truncate_end(trx_undo_t& undo, undo_no_t limit, bool is_temp)
{
- ut_ad(mutex_own(&undo->rseg->mutex));
- ut_ad(is_temp == !undo->rseg->is_persistent());
+ mtr_t mtr;
+ ut_ad(is_temp == !undo.rseg->is_persistent());
for (;;) {
- mtr_t mtr;
mtr.start();
if (is_temp) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
}
trx_undo_rec_t* trunc_here = NULL;
+ mutex_enter(&undo.rseg->mutex);
page_t* undo_page = trx_undo_page_get(
- page_id_t(undo->rseg->space->id, undo->last_page_no),
+ page_id_t(undo.rseg->space->id, undo.last_page_no),
&mtr);
trx_undo_rec_t* rec = trx_undo_page_get_last_rec(
- undo_page, undo->hdr_page_no, undo->hdr_offset);
+ undo_page, undo.hdr_page_no, undo.hdr_offset);
while (rec) {
- if (trx_undo_rec_get_undo_no(rec) >= limit) {
- /* Truncate at least this record off, maybe
- more */
- trunc_here = rec;
- } else {
- goto function_exit;
+ if (trx_undo_rec_get_undo_no(rec) < limit) {
+ goto func_exit;
}
+ /* Truncate at least this record off, maybe more */
+ trunc_here = rec;
rec = trx_undo_page_get_prev_rec(rec,
- undo->hdr_page_no,
- undo->hdr_offset);
+ undo.hdr_page_no,
+ undo.hdr_offset);
}
- if (undo->last_page_no == undo->hdr_page_no) {
-function_exit:
- if (trunc_here) {
- mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE,
- ulint(trunc_here - undo_page),
- MLOG_2BYTES, &mtr);
- }
-
+ if (undo.last_page_no != undo.hdr_page_no) {
+ trx_undo_free_last_page(&undo, &mtr);
+ mutex_exit(&undo.rseg->mutex);
mtr.commit();
- return;
+ continue;
+ }
+
+func_exit:
+ mutex_exit(&undo.rseg->mutex);
+
+ if (trunc_here) {
+ mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR
+ + TRX_UNDO_PAGE_FREE,
+ ulint(trunc_here - undo_page),
+ MLOG_2BYTES, &mtr);
}
- trx_undo_free_last_page(undo, &mtr);
mtr.commit();
+ return;
}
}
diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc
index 284ea859013..3eef9329b57 100644
--- a/storage/innobase/ut/ut0crc32.cc
+++ b/storage/innobase/ut/ut0crc32.cc
@@ -2,7 +2,7 @@
Copyright (c) 2009, 2010 Facebook, Inc. All Rights Reserved.
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -83,7 +83,6 @@ mysys/my_perf.c, contributed by Facebook under the following license.
#include "my_config.h"
#include <string.h>
-#include "univ.i"
#include "ut0crc32.h"
#ifdef _MSC_VER
@@ -470,32 +469,6 @@ ut_crc32_64_sw(
*len -= 8;
}
-/** Calculate CRC32 over 64-bit byte string using a software implementation.
-The byte string is converted to a 64-bit integer using big endian byte order.
-@param[in,out] crc crc32 checksum so far when this function is called,
-when the function ends it will contain the new checksum
-@param[in,out] data data to be checksummed, the pointer will be advanced
-with 8 bytes
-@param[in,out] len remaining bytes, it will be decremented with 8 */
-inline
-void
-ut_crc32_64_legacy_big_endian_sw(
- uint32_t* crc,
- const byte** data,
- ulint* len)
-{
- uint64_t data_int = *reinterpret_cast<const uint64_t*>(*data);
-
-#ifndef WORDS_BIGENDIAN
- data_int = ut_crc32_swap_byteorder(data_int);
-#endif /* WORDS_BIGENDIAN */
-
- *crc = ut_crc32_64_low_sw(*crc, data_int);
-
- *data += 8;
- *len -= 8;
-}
-
/** Calculates CRC32 in software, without using CPU instructions.
@param[in] buf data over which to calculate CRC32
@param[in] len data length
@@ -546,58 +519,6 @@ ut_crc32_sw(
return(~crc);
}
-/** Calculates CRC32 in software, without using CPU instructions.
-This function uses big endian byte ordering when converting byte sequence to
-integers.
-@param[in] buf data over which to calculate CRC32
-@param[in] len data length
-@return CRC-32C (polynomial 0x11EDC6F41) */
-uint32_t
-ut_crc32_legacy_big_endian(
- const byte* buf,
- ulint len)
-{
- uint32_t crc = 0xFFFFFFFFU;
-
- ut_a(ut_crc32_slice8_table_initialized);
-
- /* Calculate byte-by-byte up to an 8-byte aligned address. After
- this consume the input 8-bytes at a time. */
- while (len > 0 && (reinterpret_cast<uintptr_t>(buf) & 7) != 0) {
- ut_crc32_8_sw(&crc, &buf, &len);
- }
-
- while (len >= 128) {
- /* This call is repeated 16 times. 16 * 8 = 128. */
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- }
-
- while (len >= 8) {
- ut_crc32_64_legacy_big_endian_sw(&crc, &buf, &len);
- }
-
- while (len > 0) {
- ut_crc32_8_sw(&crc, &buf, &len);
- }
-
- return(~crc);
-}
-
/********************************************************************//**
Initializes the data structures used by ut_crc32*(). Does not do any
allocations, would not hurt if called twice, but would be pointless. */
diff --git a/storage/innobase/ut/ut0dbg.cc b/storage/innobase/ut/ut0dbg.cc
index 7df189ac560..05b27060a9b 100644
--- a/storage/innobase/ut/ut0dbg.cc
+++ b/storage/innobase/ut/ut0dbg.cc
@@ -24,8 +24,7 @@ Debug utilities for Innobase.
Created 1/30/1994 Heikki Tuuri
**********************************************************************/
-#include "ha_prototypes.h"
-
+#include "univ.i"
#include "ut0dbg.h"
/*************************************************************//**
@@ -53,7 +52,7 @@ ut_dbg_assertion_failed(
" or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
- "InnoDB: https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/\n"
+ "InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/\n"
"InnoDB: about forcing recovery.\n", stderr);
fflush(stderr);
diff --git a/storage/innobase/ut/ut0new.cc b/storage/innobase/ut/ut0new.cc
index 3a17b5ebf30..cdba09974ad 100644
--- a/storage/innobase/ut/ut0new.cc
+++ b/storage/innobase/ut/ut0new.cc
@@ -25,8 +25,6 @@ Created May 26, 2014 Vasil Dimov
#include "univ.i"
-#include "ut0new.h"
-
/** Maximum number of retries to allocate memory. */
const size_t alloc_max_retries = 60;
diff --git a/storage/innobase/ut/ut0rbt.cc b/storage/innobase/ut/ut0rbt.cc
index cb8e4f2df20..0da924fed43 100644
--- a/storage/innobase/ut/ut0rbt.cc
+++ b/storage/innobase/ut/ut0rbt.cc
@@ -23,9 +23,6 @@ Red-Black tree implementation
Created 2007-03-20 Sunny Bains
***********************************************************************/
-#include "univ.i"
-
-#include "ut0new.h"
#include "ut0rbt.h"
/**********************************************************************//**
diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt
index 77dfb201413..6ed370653d5 100644
--- a/storage/maria/CMakeLists.txt
+++ b/storage/maria/CMakeLists.txt
@@ -47,7 +47,7 @@ SET(ARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
ma_checkpoint.c ma_recovery.c ma_commit.c ma_pagecrc.c
ha_maria.h maria_def.h ma_recovery_util.c ma_servicethread.c
ma_norec.c
- ma_crypt.c
+ ma_crypt.c ma_backup.c
)
IF(APPLE)
@@ -98,7 +98,12 @@ IF(WITH_UNIT_TESTS)
ADD_EXECUTABLE(ma_sp_test ma_sp_test.c)
TARGET_LINK_LIBRARIES(ma_sp_test aria)
+
+ ADD_EXECUTABLE(test_ma_backup test_ma_backup.c)
+ TARGET_LINK_LIBRARIES(test_ma_backup aria)
+
ADD_SUBDIRECTORY(unittest)
+
ENDIF()
IF (MSVC)
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 6fe00e52081..30f8724aebd 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1261,6 +1261,14 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
int_table_flags |= HA_HAS_NEW_CHECKSUM;
/*
+ We can only do online backup on transactional tables with checksum.
+ Checksums are needed to avoid half writes.
+ */
+ if (file->s->options & HA_OPTION_PAGE_CHECKSUM &&
+ file->s->base.born_transactional)
+ int_table_flags |= HA_CAN_ONLINE_BACKUPS;
+
+ /*
For static size rows, tell MariaDB that we will access all bytes
in the record when writing it. This signals MariaDB to initalize
the full row to ensure we don't get any errors from valgrind and
@@ -3443,6 +3451,21 @@ int maria_checkpoint_state(handlerton *hton, bool disabled)
}
+/*
+ Handle backup calls
+*/
+
+void maria_prepare_for_backup()
+{
+ translog_disable_purge();
+}
+
+void maria_end_backup()
+{
+ translog_enable_purge();
+}
+
+
#define SHOW_MSG_LEN (FN_REFLEN + 20)
/**
@@ -3643,6 +3666,9 @@ static int ha_maria_init(void *p)
#endif
maria_hton->flush_logs= maria_flush_logs;
maria_hton->show_status= maria_show_status;
+ maria_hton->prepare_for_backup= maria_prepare_for_backup;
+ maria_hton->end_backup= maria_end_backup;
+
/* TODO: decide if we support Maria being used for log tables */
maria_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
bzero(maria_log_pagecache, sizeof(*maria_log_pagecache));
@@ -3662,7 +3688,8 @@ static int ha_maria_init(void *p)
TRANSLOG_DEFAULT_FLAGS, 0) ||
maria_recovery_from_log() ||
((force_start_after_recovery_failures != 0 ||
- maria_recovery_changed_data) && mark_recovery_success()) ||
+ maria_recovery_changed_data || recovery_failures) &&
+ mark_recovery_success()) ||
ma_checkpoint_init(checkpoint_interval);
maria_multi_threaded= maria_in_ha_maria= TRUE;
maria_create_trn_hook= maria_create_trn_for_mysql;
diff --git a/storage/maria/ma_backup.c b/storage/maria/ma_backup.c
new file mode 100644
index 00000000000..8f20209c48a
--- /dev/null
+++ b/storage/maria/ma_backup.c
@@ -0,0 +1,281 @@
+/* Copyright (C) 2018 MariaDB corporation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+/* Code for doing backups of Aria tables */
+
+#include "maria_def.h"
+#include "ma_blockrec.h" /* PAGE_SUFFIX_SIZE */
+#include "ma_checkpoint.h"
+#include <aria_backup.h>
+
+static uchar *_ma_base_info_read(uchar *ptr, MARIA_BASE_INFO *base);
+
+/**
+ @brief Get capabilites for an Aria table
+
+ @param kfile key file (.MAI)
+ @param cap Capabilities are stored here
+
+ @return 0 ok
+ @return X errno
+*/
+
+int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap)
+{
+ MARIA_SHARE share;
+ int error= 0;
+ uint head_length= sizeof(share.state.header), base_pos;
+ uint aligned_bit_blocks;
+ size_t info_length;
+ uchar *disc_cache;
+ DBUG_ENTER("aria_get_capabilities");
+
+ bzero(cap, sizeof(*cap));
+ if (my_pread(kfile,share.state.header.file_version, head_length, 0,
+ MYF(MY_NABP)))
+ DBUG_RETURN(HA_ERR_NOT_A_TABLE);
+
+ if (memcmp(share.state.header.file_version, maria_file_magic, 4))
+ DBUG_RETURN(HA_ERR_NOT_A_TABLE);
+
+ share.options= mi_uint2korr(share.state.header.options);
+
+ info_length= mi_uint2korr(share.state.header.header_length);
+ base_pos= mi_uint2korr(share.state.header.base_pos);
+
+ /*
+ Allocate space for header information and for data that is too
+ big to keep on stack
+ */
+ if (!(disc_cache= my_malloc(info_length, MYF(MY_WME))))
+ DBUG_RETURN(ENOMEM);
+
+ if (my_pread(kfile, disc_cache, info_length, 0L, MYF(MY_NABP)))
+ {
+ error= my_errno;
+ goto err;
+ }
+ _ma_base_info_read(disc_cache + base_pos, &share.base);
+ cap->transactional= share.base.born_transactional;
+ cap->checksum= MY_TEST(share.options & HA_OPTION_PAGE_CHECKSUM);
+ cap->online_backup_safe= cap->transactional && cap->checksum;
+ cap->header_size= share.base.keystart;
+ cap->keypage_header= ((share.base.born_transactional ?
+ LSN_STORE_SIZE + TRANSID_SIZE :
+ 0) + KEYPAGE_KEYID_SIZE + KEYPAGE_FLAG_SIZE +
+ KEYPAGE_USED_SIZE);
+ cap->block_size= share.base.block_size;
+
+ if (share.state.header.data_file_type == BLOCK_RECORD)
+ {
+ /* Calulate how man pages the row bitmap covers. From _ma_bitmap_init() */
+ aligned_bit_blocks= (cap->block_size - PAGE_SUFFIX_SIZE) / 6;
+ /*
+ In each 6 bytes, we have 6*8/3 = 16 pages covered
+ The +1 is to add the bitmap page, as this doesn't have to be covered
+ */
+ cap->bitmap_pages_covered= aligned_bit_blocks * 16 + 1;
+ }
+
+ /* Do a check that that we got things right */
+ if (share.state.header.data_file_type != BLOCK_RECORD &&
+ cap->online_backup_safe)
+ error= HA_ERR_NOT_A_TABLE;
+
+err:
+ my_free(disc_cache);
+ DBUG_RETURN(error);
+} /* maria_get_capabilities */
+
+
+/*
+ This is a copy of my_base_info_read from ma_open().
+ The base information will never change (something may be added
+ last, but not relevant for maria_get_capabilities), so it's safe to
+ copy it here.
+
+ The copy is done to avoid linking in the fill Aria library just
+ because maria_backup uses maria_get_capabilities()
+*/
+
+
+static uchar *_ma_base_info_read(uchar *ptr, MARIA_BASE_INFO *base)
+{
+ bmove(base->uuid, ptr, MY_UUID_SIZE); ptr+= MY_UUID_SIZE;
+ base->keystart= mi_sizekorr(ptr); ptr+= 8;
+ base->max_data_file_length= mi_sizekorr(ptr); ptr+= 8;
+ base->max_key_file_length= mi_sizekorr(ptr); ptr+= 8;
+ base->records= (ha_rows) mi_sizekorr(ptr); ptr+= 8;
+ base->reloc= (ha_rows) mi_sizekorr(ptr); ptr+= 8;
+ base->mean_row_length= mi_uint4korr(ptr); ptr+= 4;
+ base->reclength= mi_uint4korr(ptr); ptr+= 4;
+ base->pack_reclength= mi_uint4korr(ptr); ptr+= 4;
+ base->min_pack_length= mi_uint4korr(ptr); ptr+= 4;
+ base->max_pack_length= mi_uint4korr(ptr); ptr+= 4;
+ base->min_block_length= mi_uint4korr(ptr); ptr+= 4;
+ base->fields= mi_uint2korr(ptr); ptr+= 2;
+ base->fixed_not_null_fields= mi_uint2korr(ptr); ptr+= 2;
+ base->fixed_not_null_fields_length= mi_uint2korr(ptr);ptr+= 2;
+ base->max_field_lengths= mi_uint2korr(ptr); ptr+= 2;
+ base->pack_fields= mi_uint2korr(ptr); ptr+= 2;
+ base->extra_options= mi_uint2korr(ptr); ptr+= 2;
+ base->null_bytes= mi_uint2korr(ptr); ptr+= 2;
+ base->original_null_bytes= mi_uint2korr(ptr); ptr+= 2;
+ base->field_offsets= mi_uint2korr(ptr); ptr+= 2;
+ base->language= mi_uint2korr(ptr); ptr+= 2;
+ base->block_size= mi_uint2korr(ptr); ptr+= 2;
+
+ base->rec_reflength= *ptr++;
+ base->key_reflength= *ptr++;
+ base->keys= *ptr++;
+ base->auto_key= *ptr++;
+ base->born_transactional= *ptr++;
+ ptr++;
+ base->pack_bytes= mi_uint2korr(ptr); ptr+= 2;
+ base->blobs= mi_uint2korr(ptr); ptr+= 2;
+ base->max_key_block_length= mi_uint2korr(ptr); ptr+= 2;
+ base->max_key_length= mi_uint2korr(ptr); ptr+= 2;
+ base->extra_alloc_bytes= mi_uint2korr(ptr); ptr+= 2;
+ base->extra_alloc_procent= *ptr++;
+ ptr+= 16;
+ return ptr;
+}
+
+
+/**
+ @brief Copy an index block with re-read if checksum doesn't match
+
+ @param dfile data file (.MAD)
+ @param cap aria capabilities from aria_get_capabilities
+ @param block block number to read (0, 1, 2, 3...)
+ @param buffer read data to this buffer
+ @param bytes_read number of bytes actually read (in case of end of file)
+
+ @return 0 ok
+ @return HA_ERR_END_OF_FILE ; End of file
+ @return # error number
+*/
+
+#define MAX_RETRY 10
+
+int aria_read_index(File kfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
+ uchar *buffer)
+{
+ MARIA_SHARE share;
+ int retry= 0;
+ DBUG_ENTER("aria_read_index");
+
+ share.keypage_header= cap->keypage_header;
+ share.block_size= cap->block_size;
+ do
+ {
+ int error;
+ size_t length;
+ if ((length= my_pread(kfile, buffer, cap->block_size,
+ block * cap->block_size, MYF(0))) != cap->block_size)
+ {
+ if (length == 0)
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ if (length == (size_t) -1)
+ DBUG_RETURN(my_errno ? my_errno : -1);
+ /* Assume we got a half read; Do a re-read */
+ }
+ /* If not transactional or key file header, there are no checksums */
+ if (!cap->online_backup_safe ||
+ block < cap->header_size/ cap->block_size)
+ DBUG_RETURN(length == cap->block_size ? 0 : HA_ERR_CRASHED);
+
+ if (length == cap->block_size)
+ {
+ length= _ma_get_page_used(&share, buffer);
+ if (length > cap->block_size - CRC_SIZE)
+ DBUG_RETURN(HA_ERR_CRASHED);
+ error= maria_page_crc_check(buffer, block, &share,
+ MARIA_NO_CRC_NORMAL_PAGE,
+ (int) length);
+ if (error != HA_ERR_WRONG_CRC)
+ DBUG_RETURN(error);
+ }
+ my_sleep(100000); /* Sleep 0.1 seconds */
+ } while (retry < MAX_RETRY);
+ DBUG_RETURN(HA_ERR_WRONG_CRC);
+}
+
+
+/**
+ @brief Copy a data block with re-read if checksum doesn't match
+
+ @param dfile data file (.MAD)
+ @param cap aria capabilities from aria_get_capabilities
+ @param block block number to read (0, 1, 2, 3...)
+ @param buffer read data to this buffer
+ @param bytes_read number of bytes actually read (in case of end of file)
+
+ @return 0 ok
+ @return HA_ERR_END_OF_FILE ; End of file
+ @return # error number
+*/
+
+int aria_read_data(File dfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
+ uchar *buffer, size_t *bytes_read)
+{
+ MARIA_SHARE share;
+ int retry= 0;
+ DBUG_ENTER("aria_read_data");
+
+ share.keypage_header= cap->keypage_header;
+ share.block_size= cap->block_size;
+
+ if (!cap->online_backup_safe)
+ {
+ *bytes_read= my_pread(dfile, buffer, cap->block_size,
+ block * cap->block_size, MY_WME);
+ if (*bytes_read == 0)
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ DBUG_RETURN(*bytes_read > 0 ? 0 : (my_errno ? my_errno : -1));
+ }
+
+ *bytes_read= cap->block_size;
+ do
+ {
+ int error;
+ size_t length;
+ if ((length= my_pread(dfile, buffer, cap->block_size,
+ block * cap->block_size, MYF(0))) != cap->block_size)
+ {
+ if (length == 0)
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ if (length == (size_t) -1)
+ DBUG_RETURN(my_errno ? my_errno : -1);
+ }
+
+ /* If not transactional or key file header, there are no checksums */
+ if (!cap->online_backup_safe)
+ DBUG_RETURN(length == cap->block_size ? 0 : HA_ERR_CRASHED);
+
+ if (length == cap->block_size)
+ {
+ error= maria_page_crc_check(buffer, block, &share,
+ ((block % cap->bitmap_pages_covered) == 0 ?
+ MARIA_NO_CRC_BITMAP_PAGE :
+ MARIA_NO_CRC_NORMAL_PAGE),
+ share.block_size - CRC_SIZE);
+ if (error != HA_ERR_WRONG_CRC)
+ DBUG_RETURN(error);
+ }
+ my_sleep(100000); /* Sleep 0.1 seconds */
+ } while (retry < MAX_RETRY);
+ DBUG_RETURN(HA_ERR_WRONG_CRC);
+}
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 4eab0e07315..998bb984452 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -167,6 +167,9 @@ int maria_chk_status(HA_CHECK *param, MARIA_HA *info)
{
MARIA_SHARE *share= info->s;
+ /* Protection for HA_EXTRA_FLUSH */
+ mysql_mutex_lock(&share->intern_lock);
+
if (maria_is_crashed_on_repair(info))
_ma_check_print_warning(param,
"Table is marked as crashed and last repair failed");
@@ -189,6 +192,9 @@ int maria_chk_status(HA_CHECK *param, MARIA_HA *info)
if (param->testflag & T_UPDATE_STATE)
param->warning_printed=save;
}
+
+ mysql_mutex_unlock(&share->intern_lock);
+
if (share->state.create_trid > param->max_trid)
{
param->wrong_trd_printed= 1; /* Force should run zerofill */
diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c
index 3c536d2c46f..d55b12bbd9f 100644
--- a/storage/maria/ma_control_file.c
+++ b/storage/maria/ma_control_file.c
@@ -608,4 +608,124 @@ my_bool ma_control_file_inited(void)
return (control_file_fd >= 0);
}
+/**
+ Print content of aria_log_control file
+*/
+
+my_bool print_aria_log_control()
+{
+ uchar buffer[CF_MAX_SIZE];
+ char name[FN_REFLEN], uuid_str[MY_UUID_STRING_LENGTH+1];
+ const char *errmsg;
+ uint new_cf_create_time_size, new_cf_changeable_size;
+ my_off_t file_size;
+ ulong logno;
+ ulonglong trid,checkpoint_lsn;
+ int open_flags= O_BINARY | /*O_DIRECT |*/ O_RDWR | O_CLOEXEC;
+ int error= CONTROL_FILE_UNKNOWN_ERROR;
+ uint recovery_fails;
+ File file;
+ DBUG_ENTER("ma_control_file_open");
+
+ if (fn_format(name, CONTROL_FILE_BASE_NAME,
+ maria_data_root, "", MYF(MY_WME)) == NullS)
+ DBUG_RETURN(CONTROL_FILE_UNKNOWN_ERROR);
+
+ if ((file= mysql_file_open(key_file_control, name,
+ open_flags, MYF(MY_WME))) < 0)
+ {
+ errmsg= "Can't open file";
+ goto err;
+ }
+
+ file_size= mysql_file_seek(file, 0, SEEK_END, MYF(MY_WME));
+ if (file_size == MY_FILEPOS_ERROR)
+ {
+ errmsg= "Can't read size";
+ goto err;
+ }
+ if (file_size < CF_MIN_SIZE)
+ {
+ /*
+ Given that normally we write only a sector and it's atomic, the only
+ possibility for a file to be of too short size is if we crashed at the
+ very first startup, between file creation and file write. Quite unlikely
+ (and can be made even more unlikely by doing this: create a temp file,
+ write it, and then rename it to be the control file).
+ What's more likely is if someone forgot to restore the control file,
+ just did a "touch control" to try to get Maria to start, or if the
+ disk/filesystem has a problem.
+ So let's be rigid.
+ */
+ error= CONTROL_FILE_TOO_SMALL;
+ errmsg= "Size of control file is smaller than expected";
+ goto err;
+ }
+
+ /* Check if control file is unexpectedly big */
+ if (file_size > CF_MAX_SIZE)
+ {
+ error= CONTROL_FILE_TOO_BIG;
+ errmsg= "File size bigger than expected";
+ goto err;
+ }
+
+ if (mysql_file_pread(file, buffer, (size_t)file_size, 0, MYF(MY_FNABP)))
+ {
+ errmsg= "Can't read file";
+ goto err;
+ }
+
+ if (memcmp(buffer + CF_MAGIC_STRING_OFFSET,
+ CF_MAGIC_STRING, CF_MAGIC_STRING_SIZE))
+ {
+ error= CONTROL_FILE_BAD_MAGIC_STRING;
+ errmsg= "Missing valid id at start of file. File is not a valid aria control file";
+ goto err;
+ }
+
+ printf("Aria file version: %u\n", buffer[CF_VERSION_OFFSET]);
+
+ new_cf_create_time_size= uint2korr(buffer + CF_CREATE_TIME_SIZE_OFFSET);
+ new_cf_changeable_size= uint2korr(buffer + CF_CHANGEABLE_SIZE_OFFSET);
+
+ if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE ||
+ new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE ||
+ new_cf_create_time_size + new_cf_changeable_size != file_size)
+ {
+ error= CONTROL_FILE_INCONSISTENT_INFORMATION;
+ errmsg= "Sizes stored in control file are inconsistent";
+ goto err;
+ }
+ checkpoint_lsn= lsn_korr(buffer + new_cf_create_time_size +
+ CF_LSN_OFFSET);
+ logno= uint4korr(buffer + new_cf_create_time_size + CF_FILENO_OFFSET);
+ my_uuid2str(buffer + CF_UUID_OFFSET, uuid_str);
+ uuid_str[MY_UUID_STRING_LENGTH]= 0;
+
+ printf("Block size: %u\n", uint2korr(buffer + CF_BLOCKSIZE_OFFSET));
+ printf("maria_uuid: %s\n", uuid_str);
+ printf("last_checkpoint_lsn: " LSN_FMT "\n", LSN_IN_PARTS(checkpoint_lsn));
+ printf("last_log_number: %lu\n", (ulong) logno);
+ if (new_cf_changeable_size >= (CF_MAX_TRID_OFFSET + CF_MAX_TRID_SIZE))
+ {
+ trid= transid_korr(buffer + new_cf_create_time_size + CF_MAX_TRID_OFFSET);
+ printf("trid: %llu\n", (ulonglong) trid);
+ }
+ if (new_cf_changeable_size >= (CF_RECOV_FAIL_OFFSET + CF_RECOV_FAIL_SIZE))
+ {
+ recovery_fails=
+ (buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET)[0];
+ printf("recovery_failuers: %u\n", recovery_fails);
+ }
+
+ DBUG_RETURN(0);
+
+err:
+ my_printf_error(HA_ERR_INITIALIZATION,
+ "Got error '%s' when trying to use aria control file "
+ "'%s'", 0, errmsg, name);
+ DBUG_RETURN(error);
+}
+
#endif /* EXTRACT_DEFINITIONS */
diff --git a/storage/maria/ma_control_file.h b/storage/maria/ma_control_file.h
index 85e8f2c899d..51599f0abfc 100644
--- a/storage/maria/ma_control_file.h
+++ b/storage/maria/ma_control_file.h
@@ -70,5 +70,6 @@ int ma_control_file_write_and_force(LSN last_checkpoint_lsn_arg,
uint8 recovery_failures_arg);
int ma_control_file_end(void);
my_bool ma_control_file_inited(void);
+my_bool print_aria_log_control(void);
C_MODE_END
#endif
diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c
index 9feead42cf7..9b544aaba59 100644
--- a/storage/maria/ma_extra.c
+++ b/storage/maria/ma_extra.c
@@ -420,7 +420,11 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
error= _ma_flush_table_files(info, MARIA_FLUSH_DATA | MARIA_FLUSH_INDEX,
FLUSH_KEEP, FLUSH_KEEP);
+ mysql_mutex_lock(&share->intern_lock);
+ /* Tell maria_lock_database() that we locked the intern_lock mutex */
+ info->intern_lock_locked= 1;
_ma_decrement_open_count(info, 1);
+ info->intern_lock_locked= 0;
if (share->not_flushed)
{
share->not_flushed= 0;
@@ -433,6 +437,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
_ma_set_fatal_error(share, HA_ERR_CRASHED);
}
}
+ mysql_mutex_unlock(&share->intern_lock);
break;
case HA_EXTRA_NORMAL: /* Theese isn't in use */
info->quick_mode= 0;
diff --git a/storage/maria/ma_init.c b/storage/maria/ma_init.c
index 7157f9e4c98..7244d95b184 100644
--- a/storage/maria/ma_init.c
+++ b/storage/maria/ma_init.c
@@ -81,6 +81,7 @@ int maria_init(void)
void maria_end(void)
{
+ DBUG_ENTER("maria_end");
if (maria_inited)
{
TrID trid;
@@ -111,6 +112,7 @@ void maria_end(void)
mysql_mutex_destroy(&THR_LOCK_maria);
my_hash_free(&maria_stored_state);
}
+ DBUG_VOID_RETURN;
}
/**
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c
index 54f072ede5c..203fd394d26 100644
--- a/storage/maria/ma_locking.c
+++ b/storage/maria/ma_locking.c
@@ -47,7 +47,8 @@ int maria_lock_database(MARIA_HA *info, int lock_type)
}
error=0;
- mysql_mutex_lock(&share->intern_lock);
+ if (!info->intern_lock_locked)
+ mysql_mutex_lock(&share->intern_lock);
if (share->kfile.file >= 0) /* May only be false on windows */
{
switch (lock_type) {
@@ -234,7 +235,8 @@ int maria_lock_database(MARIA_HA *info, int lock_type)
}
}
#endif
- mysql_mutex_unlock(&share->intern_lock);
+ if (!info->intern_lock_locked)
+ mysql_mutex_unlock(&share->intern_lock);
DBUG_RETURN(error);
} /* maria_lock_database */
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 158904f6692..724beb7136c 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -56,6 +56,8 @@ static mysql_cond_t COND_soft_sync;
static MA_SERVICE_THREAD_CONTROL soft_sync_control=
{0, FALSE, FALSE, &LOCK_soft_sync, &COND_soft_sync};
+uint log_purge_disabled= 0;
+
/* transaction log file descriptor */
typedef struct st_translog_file
@@ -3620,6 +3622,7 @@ my_bool translog_init_with_table(const char *directory,
translog_syncs= 0;
flush_start= 0;
id_to_share= NULL;
+ log_purge_disabled= 0;
log_descriptor.directory_fd= -1;
log_descriptor.is_everything_flushed= 1;
@@ -8668,7 +8671,7 @@ my_bool translog_purge(TRANSLOG_ADDRESS low)
mysql_rwlock_unlock(&log_descriptor.open_files_lock);
translog_close_log_file(file);
}
- if (log_purge_type == TRANSLOG_PURGE_IMMIDIATE)
+ if (log_purge_type == TRANSLOG_PURGE_IMMIDIATE && ! log_purge_disabled)
{
char path[FN_REFLEN], *file_name;
file_name= translog_filename_by_fileno(i, path);
@@ -8721,7 +8724,7 @@ my_bool translog_purge_at_flush()
mysql_mutex_lock(&log_descriptor.purger_lock);
- if (unlikely(log_descriptor.min_need_file == 0))
+ if (unlikely(log_descriptor.min_need_file == 0 || log_purge_disabled))
{
DBUG_PRINT("info", ("No info about min need file => exit"));
mysql_mutex_unlock(&log_descriptor.purger_lock);
@@ -9285,3 +9288,22 @@ void dump_page(uchar *buffer, File handler)
}
dump_datapage(buffer, handler);
}
+
+
+/*
+ Handle backup calls
+*/
+
+void translog_disable_purge()
+{
+ mysql_mutex_lock(&log_descriptor.purger_lock);
+ log_purge_disabled++;
+ mysql_mutex_unlock(&log_descriptor.purger_lock);
+}
+
+void translog_enable_purge()
+{
+ mysql_mutex_lock(&log_descriptor.purger_lock);
+ log_purge_disabled--;
+ mysql_mutex_unlock(&log_descriptor.purger_lock);
+}
diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h
index 3fb9e7d37bf..07d6a96557d 100644
--- a/storage/maria/ma_loghandler.h
+++ b/storage/maria/ma_loghandler.h
@@ -367,6 +367,8 @@ extern void dump_page(uchar *buffer, File handler);
extern my_bool translog_log_debug_info(TRN *trn,
enum translog_debug_info_type type,
uchar *info, size_t length);
+extern void translog_disable_purge(void);
+extern void translog_enable_purge(void);
enum enum_translog_status
{
@@ -520,6 +522,7 @@ typedef enum
} enum_maria_translog_purge_type;
extern ulong log_purge_type;
extern ulong log_file_size;
+extern uint log_purge_disabled; /* For backup */
typedef enum
{
diff --git a/storage/maria/ma_pagecrc.c b/storage/maria/ma_pagecrc.c
index 8982c7e5c09..aae11158286 100644
--- a/storage/maria/ma_pagecrc.c
+++ b/storage/maria/ma_pagecrc.c
@@ -54,11 +54,11 @@ static uint32 maria_page_crc(uint32 start, uchar *data, uint length)
@retval 1 Error
*/
-static my_bool maria_page_crc_check(uchar *page,
- pgcache_page_no_t page_no,
- MARIA_SHARE *share,
- uint32 no_crc_val,
- int data_length)
+my_bool maria_page_crc_check(uchar *page,
+ pgcache_page_no_t page_no,
+ MARIA_SHARE *share,
+ uint32 no_crc_val,
+ int data_length)
{
uint32 crc= uint4korr(page + share->block_size - CRC_SIZE), new_crc;
my_bool res;
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index dbb8d46bdbc..ae52b9191de 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -473,7 +473,13 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn,
fflush(stderr);
}
- set_if_bigger(max_trid_in_control_file, max_long_trid);
+ if (max_long_trid > max_trid_in_control_file)
+ {
+ if (ma_control_file_write_and_force(last_checkpoint_lsn, last_logno,
+ max_long_trid, recovery_failures))
+ goto err;
+ }
+
if (take_checkpoints && checkpoint_useful)
{
/* No dirty pages, all tables are closed, no active transactions, save: */
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index d5f2b1e80fd..1c77beb3c0f 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -689,6 +689,7 @@ struct st_maria_handler
uint16 last_used_keyseg; /* For MARIAMRG */
uint8 key_del_used; /* != 0 if key_del is used */
my_bool was_locked; /* Was locked in panic */
+ my_bool intern_lock_locked; /* locked in ma_extra() */
my_bool append_insert_at_end; /* Set if concurrent insert */
my_bool quick_mode;
my_bool in_check_table; /* We are running check tables */
@@ -1417,6 +1418,9 @@ extern my_bool maria_page_crc_check_bitmap(int, PAGECACHE_IO_HOOK_ARGS *args);
extern my_bool maria_page_crc_check_data(int, PAGECACHE_IO_HOOK_ARGS *args);
extern my_bool maria_page_crc_check_index(int, PAGECACHE_IO_HOOK_ARGS *args);
extern my_bool maria_page_crc_check_none(int, PAGECACHE_IO_HOOK_ARGS *args);
+extern my_bool maria_page_crc_check(uchar *page, pgcache_page_no_t page_no,
+ MARIA_SHARE *share, uint32 no_crc_val,
+ int data_length);
extern my_bool maria_page_filler_set_bitmap(PAGECACHE_IO_HOOK_ARGS *args);
extern my_bool maria_page_filler_set_normal(PAGECACHE_IO_HOOK_ARGS *args);
extern my_bool maria_page_filler_set_none(PAGECACHE_IO_HOOK_ARGS *args);
diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c
index 9a9c78f66d4..f3338714846 100644
--- a/storage/maria/maria_read_log.c
+++ b/storage/maria/maria_read_log.c
@@ -31,6 +31,7 @@ const char *default_dbug_option= "d:t:o,/tmp/aria_read_log.trace";
#endif /* DBUG_OFF */
static my_bool opt_display_only, opt_apply, opt_apply_undo, opt_silent;
static my_bool opt_check;
+static my_bool opt_print_aria_log_control;
static const char *opt_tmpdir;
static ulong opt_translog_buffer_size;
static ulonglong opt_page_buffer_size;
@@ -59,6 +60,12 @@ int main(int argc, char **argv)
goto err;
}
maria_block_size= 0; /* Use block size from file */
+ if (opt_print_aria_log_control)
+ {
+ if (print_aria_log_control())
+ goto err;
+ goto end;
+ }
/* we don't want to create a control file, it MUST exist */
if (ma_control_file_open(FALSE, TRUE))
{
@@ -209,6 +216,10 @@ static struct my_option my_long_options[] =
&opt_page_buffer_size, &opt_page_buffer_size, 0,
GET_ULL, REQUIRED_ARG, PAGE_BUFFER_INIT,
PAGE_BUFFER_INIT, SIZE_T_MAX, MALLOC_OVERHEAD, (long) IO_SIZE, 0},
+ { "print-log-control-file", 'l',
+ "Print the content of the aria_log_control_file",
+ &opt_print_aria_log_control, &opt_print_aria_log_control, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "start-from-lsn", 'o', "Start reading log from this lsn",
&opt_start_from_lsn, &opt_start_from_lsn,
0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 },
@@ -249,7 +260,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.3 for %s on %s\n",
+ printf("%s Ver 1.4 for %s on %s\n",
my_progname_short, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -271,6 +282,11 @@ static void usage(void)
#endif
printf("\nUsage: %s OPTIONS [-d | -a] -h `aria_log_directory`\n",
my_progname_short);
+ printf("or\n");
+ printf("Usage: %s OPTIONS -h `aria_log_directory` "
+ "--print-aria-log-control\n\n",
+ my_progname_short);
+
my_print_help(my_long_options);
print_defaults("my", load_default_groups);
my_print_variables(my_long_options);
@@ -339,12 +355,12 @@ static void get_options(int *argc,char ***argv)
need_help= 1;
fprintf(stderr, "Too many arguments given\n");
}
- if ((opt_display_only + opt_apply) != 1)
+ if ((opt_display_only + opt_apply + opt_print_aria_log_control) != 1)
{
need_help= 1;
fprintf(stderr,
- "You must use one and only one of the options 'display-only' or "
- "'apply'\n");
+ "You must use one and only one of the options 'display-only', \n"
+ "'print-log-control-file' and 'apply'\n");
}
if (need_help)
diff --git a/storage/maria/test_ma_backup.c b/storage/maria/test_ma_backup.c
new file mode 100644
index 00000000000..2a9a6704ecb
--- /dev/null
+++ b/storage/maria/test_ma_backup.c
@@ -0,0 +1,449 @@
+/* Copyright (C) 2018 MariaDB corporation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+/* Code for doing backups of Aria tables */
+
+/******************************************************************************
+ Testing ma_backup interface
+ Table creation code is taken from ma_test1
+******************************************************************************/
+
+#define ROWS_IN_TEST 100000
+
+#include "maria_def.h"
+#include "ma_blockrec.h" /* PAGE_SUFFIX_SIZE */
+#include "ma_checkpoint.h"
+#include <aria_backup.h>
+
+static int silent;
+static int create_test_table(const char *table_name, int stage);
+static int copy_table(const char *table_name, int stage);
+static void create_record(uchar *record,uint rownr);
+
+int main(int argc __attribute__((unused)), char *argv[])
+{
+ int error= 1;
+ int i;
+ char buff[FN_REFLEN];
+#ifdef SAFE_MUTEX
+ safe_mutex_deadlock_detector= 1;
+#endif
+ MY_INIT(argv[0]);
+ maria_data_root= (char *)".";
+
+ /* Maria requires that we always have a page cache */
+ if (maria_init() ||
+ (init_pagecache(maria_pagecache, maria_block_size * 2000, 0, 0,
+ maria_block_size, 0, MY_WME) == 0) ||
+ ma_control_file_open(TRUE, TRUE) ||
+ (init_pagecache(maria_log_pagecache,
+ TRANSLOG_PAGECACHE_SIZE, 0, 0,
+ TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
+ translog_init(maria_data_root, TRANSLOG_FILE_SIZE,
+ 0, 0, maria_log_pagecache,
+ TRANSLOG_DEFAULT_FLAGS, 0) ||
+ (trnman_init(0) || ma_checkpoint_init(0)))
+ {
+ fprintf(stderr, "Error in initialization\n");
+ exit(1);
+ }
+ init_thr_lock();
+
+ fn_format(buff, "test_copy", maria_data_root, "", MYF(0));
+
+ for (i= 0; i < 5 ; i++)
+ {
+ printf("Stage: %d\n", i);
+ fflush(stdout);
+ if (create_test_table(buff, i))
+ goto err;
+ if (copy_table(buff, i))
+ goto err;
+ }
+ error= 0;
+ printf("test ok\n");
+err:
+ if (error)
+ fprintf(stderr, "Test %i failed\n", i);
+ maria_end();
+ my_uuid_end();
+ my_end(MY_CHECK_ERROR);
+ exit(error);
+}
+
+
+/**
+ Example of how to read an Aria table
+*/
+
+static int copy_table(const char *table_name, int stage)
+{
+ char old_name[FN_REFLEN];
+ uchar *copy_buffer= 0;
+ ARIA_TABLE_CAPABILITIES cap;
+ ulonglong block;
+ File org_file= -1;
+ int error= 1;
+
+ strxmov(old_name, table_name, ".MAI", NullS);
+
+ if ((org_file= my_open(old_name,
+ O_RDONLY | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ MYF(MY_WME))) < 0)
+ goto err;
+ if ((error= aria_get_capabilities(org_file, &cap)))
+ {
+ fprintf(stderr, "aria_get_capabilities failed: %d\n", error);
+ goto err;
+ }
+
+ printf("- Capabilities read. oneline_backup_safe: %d\n",
+ cap.online_backup_safe);
+ printf("- Copying index file\n");
+
+ copy_buffer= my_malloc(cap.block_size, MYF(0));
+ for (block= 0 ; ; block++)
+ {
+ if ((error= aria_read_index(org_file, &cap, block, copy_buffer) ==
+ HA_ERR_END_OF_FILE))
+ break;
+ if (error)
+ {
+ fprintf(stderr, "aria_read_index failed: %d\n", error);
+ goto err;
+ }
+ }
+ my_close(org_file, MYF(MY_WME));
+
+
+ printf("- Copying data file\n");
+ strxmov(old_name, table_name, ".MAD", NullS);
+ if ((org_file= my_open(old_name, O_RDONLY | O_SHARE | O_NOFOLLOW | O_CLOEXEC,
+ MYF(MY_WME))) < 0)
+ goto err;
+
+ for (block= 0 ; ; block++)
+ {
+ size_t length;
+ if ((error= aria_read_data(org_file, &cap, block, copy_buffer,
+ &length) == HA_ERR_END_OF_FILE))
+ break;
+ if (error)
+ {
+ fprintf(stderr, "aria_read_index failed: %d\n", error);
+ goto err;
+ }
+ }
+ error= 0;
+
+err:
+ my_free(copy_buffer);
+ if (org_file >= 0)
+ my_close(org_file, MYF(MY_WME));
+ if (error)
+ fprintf(stderr, "Failed in copy_table stage: %d\n", stage);
+ return error;
+}
+
+
+/* Code extracted from ma_test1.c */
+#define MAX_REC_LENGTH 1024
+
+static MARIA_COLUMNDEF recinfo[4];
+static MARIA_KEYDEF keyinfo[10];
+static HA_KEYSEG keyseg[10];
+static HA_KEYSEG uniqueseg[10];
+
+
+/**
+ Create a test table and fill it with some data
+*/
+
+static int create_test_table(const char *table_name, int type_of_table)
+{
+ MARIA_HA *file;
+ int i,error,uniques=0;
+ int key_field=FIELD_SKIP_PRESPACE,extra_field=FIELD_SKIP_ENDSPACE;
+ int key_type=HA_KEYTYPE_NUM;
+ int create_flag=0;
+ uint offset_to_key;
+ uint pack_seg=0, pack_keys= 0;
+ uint key_length;
+ uchar record[MAX_REC_LENGTH];
+ MARIA_UNIQUEDEF uniquedef;
+ MARIA_CREATE_INFO create_info;
+ enum data_file_type record_type= DYNAMIC_RECORD;
+ my_bool null_fields= 0, unique_key= 0;
+ my_bool opt_unique= 0;
+ my_bool transactional= 0;
+
+ key_length= 12;
+ switch (type_of_table) {
+ case 0:
+ break;
+ case 1:
+ create_flag|= HA_CREATE_CHECKSUM | HA_CREATE_PAGE_CHECKSUM;
+ break;
+ case 2: /* transactional */
+ create_flag|= HA_CREATE_CHECKSUM | HA_CREATE_PAGE_CHECKSUM;
+ record_type= BLOCK_RECORD;
+ transactional= 1;
+ break;
+ case 3: /* transactional */
+ create_flag|= HA_CREATE_CHECKSUM | HA_CREATE_PAGE_CHECKSUM;
+ record_type= BLOCK_RECORD;
+ transactional= 1;
+ key_field=FIELD_VARCHAR; /* varchar keys */
+ extra_field= FIELD_VARCHAR;
+ key_type= HA_KEYTYPE_VARTEXT1;
+ pack_seg|= HA_VAR_LENGTH_PART;
+ null_fields= 1;
+ break;
+ case 4: /* transactional */
+ create_flag|= HA_CREATE_CHECKSUM | HA_CREATE_PAGE_CHECKSUM;
+ record_type= BLOCK_RECORD;
+ transactional= 1;
+ key_field=FIELD_BLOB; /* blob key */
+ extra_field= FIELD_BLOB;
+ pack_seg|= HA_BLOB_PART;
+ key_type= HA_KEYTYPE_VARTEXT1;
+ break;
+ }
+
+
+ bzero((char*) recinfo,sizeof(recinfo));
+ bzero((char*) &create_info,sizeof(create_info));
+
+ /* First define 2 columns */
+ create_info.null_bytes= 1;
+ recinfo[0].type= key_field;
+ recinfo[0].length= (key_field == FIELD_BLOB ? 4+portable_sizeof_char_ptr :
+ key_length);
+ if (key_field == FIELD_VARCHAR)
+ recinfo[0].length+= HA_VARCHAR_PACKLENGTH(key_length);
+ recinfo[1].type=extra_field;
+ recinfo[1].length= (extra_field == FIELD_BLOB ? 4 + portable_sizeof_char_ptr : 24);
+ if (extra_field == FIELD_VARCHAR)
+ recinfo[1].length+= HA_VARCHAR_PACKLENGTH(recinfo[1].length);
+ recinfo[1].null_bit= null_fields ? 2 : 0;
+
+ if (opt_unique)
+ {
+ recinfo[2].type=FIELD_CHECK;
+ recinfo[2].length=MARIA_UNIQUE_HASH_LENGTH;
+ }
+
+ if (key_type == HA_KEYTYPE_VARTEXT1 &&
+ key_length > 255)
+ key_type= HA_KEYTYPE_VARTEXT2;
+
+ /* Define a key over the first column */
+ keyinfo[0].seg=keyseg;
+ keyinfo[0].keysegs=1;
+ keyinfo[0].block_length= 0; /* Default block length */
+ keyinfo[0].key_alg=HA_KEY_ALG_BTREE;
+ keyinfo[0].seg[0].type= key_type;
+ keyinfo[0].seg[0].flag= pack_seg;
+ keyinfo[0].seg[0].start=1;
+ keyinfo[0].seg[0].length=key_length;
+ keyinfo[0].seg[0].null_bit= null_fields ? 2 : 0;
+ keyinfo[0].seg[0].null_pos=0;
+ keyinfo[0].seg[0].language= default_charset_info->number;
+ if (pack_seg & HA_BLOB_PART)
+ {
+ keyinfo[0].seg[0].bit_start=4; /* Length of blob length */
+ }
+ keyinfo[0].flag = (uint8) (pack_keys | unique_key);
+
+ if (opt_unique)
+ {
+ uint start;
+ uniques=1;
+ bzero((char*) &uniquedef,sizeof(uniquedef));
+ bzero((char*) uniqueseg,sizeof(uniqueseg));
+ uniquedef.seg=uniqueseg;
+ uniquedef.keysegs=2;
+
+ /* Make a unique over all columns (except first NULL fields) */
+ for (i=0, start=1 ; i < 2 ; i++)
+ {
+ uniqueseg[i].start=start;
+ start+=recinfo[i].length;
+ uniqueseg[i].length=recinfo[i].length;
+ uniqueseg[i].language= default_charset_info->number;
+ }
+ uniqueseg[0].type= key_type;
+ uniqueseg[0].null_bit= null_fields ? 2 : 0;
+ uniqueseg[1].type= HA_KEYTYPE_TEXT;
+ if (extra_field == FIELD_BLOB)
+ {
+ uniqueseg[1].length=0; /* The whole blob */
+ uniqueseg[1].bit_start=4; /* long blob */
+ uniqueseg[1].flag|= HA_BLOB_PART;
+ }
+ else if (extra_field == FIELD_VARCHAR)
+ {
+ uniqueseg[1].flag|= HA_VAR_LENGTH_PART;
+ uniqueseg[1].type= (HA_VARCHAR_PACKLENGTH(recinfo[1].length-1) == 1 ?
+ HA_KEYTYPE_VARTEXT1 : HA_KEYTYPE_VARTEXT2);
+ }
+ }
+ else
+ uniques=0;
+
+ offset_to_key= MY_TEST(null_fields);
+ if (key_field == FIELD_BLOB || key_field == FIELD_VARCHAR)
+ offset_to_key+= 2;
+
+ if (!silent)
+ printf("- Creating Aria file\n");
+ create_info.max_rows= 0;
+ create_info.transactional= transactional;
+ if (maria_create(table_name, record_type, 1, keyinfo,2+opt_unique,recinfo,
+ uniques, &uniquedef, &create_info,
+ create_flag))
+ goto err;
+ if (!(file=maria_open(table_name,2,HA_OPEN_ABORT_IF_LOCKED)))
+ goto err;
+ if (!silent)
+ printf("- Writing key:s\n");
+
+ if (maria_begin(file))
+ goto err;
+ my_errno=0;
+ for (i= 0 ; i < ROWS_IN_TEST ; i++)
+ {
+ create_record(record,i);
+ if ((error=maria_write(file,record)))
+ goto err;
+ }
+
+ if (maria_commit(file) | maria_close(file))
+ goto err;
+ printf("- Data copied\n");
+ return 0;
+
+err:
+ printf("got error: %3d when using maria-database\n",my_errno);
+ return 1; /* skip warning */
+}
+
+
+static void create_key_part(uchar *key,uint rownr)
+{
+ if (keyinfo[0].seg[0].type == HA_KEYTYPE_NUM)
+ {
+ sprintf((char*) key,"%*d",keyinfo[0].seg[0].length,rownr);
+ }
+ else if (keyinfo[0].seg[0].type == HA_KEYTYPE_VARTEXT1 ||
+ keyinfo[0].seg[0].type == HA_KEYTYPE_VARTEXT2)
+ { /* Alpha record */
+ /* Create a key that may be easily packed */
+ bfill(key,keyinfo[0].seg[0].length,rownr < 10 ? 'A' : 'B');
+ sprintf((char*) key+keyinfo[0].seg[0].length-2,"%-2d",rownr % 100);
+ if ((rownr & 7) == 0)
+ {
+ /* Change the key to force a unpack of the next key */
+ bfill(key+3,keyinfo[0].seg[0].length-5,rownr < 10 ? 'a' : 'b');
+ }
+ }
+ else
+ { /* Alpha record */
+ if (keyinfo[0].seg[0].flag & HA_SPACE_PACK)
+ sprintf((char*) key,"%-*d",keyinfo[0].seg[0].length,rownr);
+ else
+ {
+ /* Create a key that may be easily packed */
+ bfill(key,keyinfo[0].seg[0].length,rownr < 10 ? 'A' : 'B');
+ sprintf((char*) key+keyinfo[0].seg[0].length-2,"%-2d",rownr % 100);
+ if ((rownr & 7) == 0)
+ {
+ /* Change the key to force a unpack of the next key */
+ key[1]= (rownr < 10 ? 'a' : 'b');
+ }
+ }
+ }
+}
+
+
+static uchar blob_key[MAX_REC_LENGTH];
+static uchar blob_record[MAX_REC_LENGTH+20*20];
+
+
+static void create_record(uchar *record,uint rownr)
+{
+ uchar *pos;
+ bzero((char*) record,MAX_REC_LENGTH);
+ record[0]=1; /* delete marker */
+ if (rownr == 0 && keyinfo[0].seg[0].null_bit)
+ record[0]|=keyinfo[0].seg[0].null_bit; /* Null key */
+
+ pos=record+1;
+ if (recinfo[0].type == FIELD_BLOB)
+ {
+ size_t tmp;
+ uchar *ptr;
+ create_key_part(blob_key,rownr);
+ tmp=strlen((char*) blob_key);
+ int4store(pos,tmp);
+ ptr=blob_key;
+ memcpy(pos+4,&ptr,sizeof(char*));
+ pos+=recinfo[0].length;
+ }
+ else if (recinfo[0].type == FIELD_VARCHAR)
+ {
+ size_t tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[0].length-1);
+ create_key_part(pos+pack_length,rownr);
+ tmp= strlen((char*) pos+pack_length);
+ if (pack_length == 1)
+ *(uchar*) pos= (uchar) tmp;
+ else
+ int2store(pos,tmp);
+ pos+= recinfo[0].length;
+ }
+ else
+ {
+ create_key_part(pos,rownr);
+ pos+=recinfo[0].length;
+ }
+ if (recinfo[1].type == FIELD_BLOB)
+ {
+ size_t tmp;
+ uchar *ptr;;
+ sprintf((char*) blob_record,"... row: %d", rownr);
+ strappend((char*) blob_record, rownr % MAX_REC_LENGTH,'x');
+ tmp=strlen((char*) blob_record);
+ int4store(pos,tmp);
+ ptr=blob_record;
+ memcpy(pos+4,&ptr,sizeof(char*));
+ }
+ else if (recinfo[1].type == FIELD_VARCHAR)
+ {
+ size_t tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
+ sprintf((char*) pos+pack_length, "... row: %d", rownr);
+ tmp= strlen((char*) pos+pack_length);
+ if (pack_length == 1)
+ *pos= (uchar) tmp;
+ else
+ int2store(pos,tmp);
+ }
+ else
+ {
+ sprintf((char*) pos,"... row: %d", rownr);
+ strappend((char*) pos,recinfo[1].length,' ');
+ }
+}
+
+#include "ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_recovery.pl b/storage/maria/unittest/ma_test_recovery.pl
index f081f2741e2..fdc7ee689b2 100755
--- a/storage/maria/unittest/ma_test_recovery.pl
+++ b/storage/maria/unittest/ma_test_recovery.pl
@@ -298,11 +298,11 @@ sub check_table_is_same
$com= "$maria_exe_path/aria_chk$suffix -dvv $table | grep -v \"Creation time:\" | grep -v \"recover time:\"";
$com.= "| grep -v \"file length\" | grep -v \"LSNs:\" | grep -v \"UUID:\" > $tmp/aria_chk_message.txt 2>&1";
- $res= `$com`;
+ $res= my_exec2($com);
print MY_LOG $res;
- $res= `$maria_exe_path/aria_chk$suffix -ss -e --read-only $table`;
+ $res= my_exec2("$maria_exe_path/aria_chk$suffix -ss -e --read-only $table");
print MY_LOG $res;
- $checksum2= `$maria_exe_path/aria_chk$suffix -dss $table`;
+ $checksum2= my_exec2("$maria_exe_path/aria_chk$suffix -dss $table");
if ("$checksum" ne "$checksum2")
{
print MY_LOG "checksum differs for $table before and after recovery\n";
@@ -311,7 +311,7 @@ sub check_table_is_same
$com= "diff $tmp/aria_chk_message.good.txt $tmp/aria_chk_message.txt ";
$com.= "> $tmp/aria_chk_diff.txt || true";
- $res= `$com`;
+ $res= my_exec2($com);
print MY_LOG $res;
if (-s "$tmp/aria_chk_diff.txt")
@@ -455,6 +455,21 @@ sub my_exec
return $res;
}
+sub my_exec2
+{
+ my($command)= @_;
+ my $res, $err;
+ $res= `$command`;
+ if ($? != 0 && $opt_abort_on_error)
+ {
+ $err= $?;
+ print "$command\n";
+ print "failed with error: $err\n";
+ exit(1);
+ }
+ return $res;
+}
+
####
#### usage
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 4af8811800e..7a41442d4ba 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -10576,7 +10576,7 @@ int ha_mroonga::generic_store_bulk_time(Field *field, grn_obj *buf)
bool truncated = false;
Field_time *time_field = (Field_time *)field;
MYSQL_TIME mysql_time;
- time_field->get_time(&mysql_time);
+ time_field->get_date(&mysql_time, Time::Options(current_thd));
mrn::TimeConverter time_converter;
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
@@ -10596,7 +10596,7 @@ int ha_mroonga::generic_store_bulk_datetime(Field *field, grn_obj *buf)
bool truncated = false;
Field_datetime *datetime_field = (Field_datetime *)field;
MYSQL_TIME mysql_time;
- datetime_field->get_time(&mysql_time);
+ datetime_field->get_date(&mysql_time, Time::Options(current_thd));
mrn::TimeConverter time_converter;
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
@@ -10657,7 +10657,7 @@ int ha_mroonga::generic_store_bulk_datetime2(Field *field, grn_obj *buf)
bool truncated = false;
Field_datetimef *datetimef_field = (Field_datetimef *)field;
MYSQL_TIME mysql_time;
- datetimef_field->get_time(&mysql_time);
+ datetimef_field->get_date(&mysql_time, Time::Options(current_thd));
mrn::TimeConverter time_converter;
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
@@ -10682,7 +10682,7 @@ int ha_mroonga::generic_store_bulk_time2(Field *field, grn_obj *buf)
int error = 0;
bool truncated = false;
MYSQL_TIME mysql_time;
- field->get_time(&mysql_time);
+ field->get_date(&mysql_time, Time::Options(current_thd));
mrn::TimeConverter time_converter;
long long int time = time_converter.mysql_time_to_grn_time(&mysql_time,
&truncated);
@@ -10707,7 +10707,7 @@ int ha_mroonga::generic_store_bulk_new_date(Field *field, grn_obj *buf)
bool truncated = false;
Field_newdate *newdate_field = (Field_newdate *)field;
MYSQL_TIME mysql_date;
- newdate_field->get_time(&mysql_date);
+ newdate_field->get_date(&mysql_date, Time::Options(current_thd));
mrn::TimeConverter time_converter;
long long int time = time_converter.mysql_time_to_grn_time(&mysql_date,
&truncated);
@@ -11617,14 +11617,14 @@ int ha_mroonga::storage_encode_key_timestamp(Field *field, const uchar *key,
} else {
Field_timestamp_hires *timestamp_hires_field =
(Field_timestamp_hires *)field;
- uint fuzzy_date = 0;
uchar *ptr_backup = field->ptr;
uchar *null_ptr_backup = field->null_ptr;
TABLE *table_backup = field->table;
field->ptr = (uchar *)key;
field->null_ptr = (uchar *)(key - 1);
field->table = table;
- timestamp_hires_field->get_date(&mysql_time, date_mode_t(fuzzy_date));
+ Temporal::Options opt(TIME_CONV_NONE, current_thd);
+ timestamp_hires_field->get_date(&mysql_time, opt);
field->ptr = ptr_backup;
field->null_ptr = null_ptr_backup;
field->table = table_backup;
@@ -11675,12 +11675,12 @@ int ha_mroonga::storage_encode_key_time(Field *field, const uchar *key,
mysql_time.time_type = MYSQL_TIMESTAMP_TIME;
} else {
Field_time_hires *time_hires_field = (Field_time_hires *)field;
- uint fuzzy_date = 0;
uchar *ptr_backup = field->ptr;
uchar *null_ptr_backup = field->null_ptr;
field->ptr = (uchar *)key;
field->null_ptr = (uchar *)(key - 1);
- time_hires_field->get_date(&mysql_time, date_mode_t(fuzzy_date));
+ Temporal::Options opt(TIME_CONV_NONE, current_thd);
+ time_hires_field->get_date(&mysql_time, opt);
field->ptr = ptr_backup;
field->null_ptr = null_ptr_backup;
}
@@ -11749,12 +11749,12 @@ int ha_mroonga::storage_encode_key_datetime(Field *field, const uchar *key,
if (field->decimals() > 0) {
Field_datetime_hires *datetime_hires_field = (Field_datetime_hires *)field;
MYSQL_TIME mysql_time;
- uint fuzzy_date = 0;
uchar *ptr_backup = field->ptr;
uchar *null_ptr_backup = field->null_ptr;
field->ptr = (uchar *)key;
field->null_ptr = (uchar *)(key - 1);
- datetime_hires_field->get_date(&mysql_time, date_mode_t(fuzzy_date));
+ Temporal::Options opt(TIME_CONV_NONE, current_thd);
+ datetime_hires_field->get_date(&mysql_time, opt);
field->ptr = ptr_backup;
field->null_ptr = null_ptr_backup;
mrn::TimeConverter time_converter;
diff --git a/storage/mroonga/lib/mrn_condition_converter.cpp b/storage/mroonga/lib/mrn_condition_converter.cpp
index 49f8e10753a..68ffa073f4f 100644
--- a/storage/mroonga/lib/mrn_condition_converter.cpp
+++ b/storage/mroonga/lib/mrn_condition_converter.cpp
@@ -258,8 +258,11 @@ namespace mrn {
Item *real_value_item = value_item->real_item();
switch (field_item->field->type()) {
case MYSQL_TYPE_TIME:
- error = real_value_item->get_time(current_thd, mysql_time);
+ {
+ THD *thd= current_thd;
+ error= real_value_item->get_date(thd, mysql_time, Time::Options(thd));
break;
+ }
case MYSQL_TYPE_YEAR:
mysql_time->year = static_cast<int>(value_item->val_int());
mysql_time->month = 1;
@@ -273,9 +276,13 @@ namespace mrn {
error = false;
break;
default:
- error = real_value_item->get_date(current_thd, mysql_time, TIME_FUZZY_DATES);
+ {
+ THD *thd= current_thd;
+ Datetime::Options opt(TIME_FUZZY_DATES, thd);
+ error = real_value_item->get_date(thd, mysql_time, opt);
break;
}
+ }
DBUG_RETURN(error);
}
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result
index 2d5e5e64147..6617b49d682 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result
@@ -6,7 +6,7 @@ created_at DATETIME
) DEFAULT CHARSET UTF8;
INSERT INTO diaries (title, created_at)
VALUES ('2012', '2012');
-ERROR 22007: Incorrect datetime value: '2012' for column 'created_at' at row 1
+ERROR 22007: Incorrect datetime value: '2012' for column `test`.`diaries`.`created_at` at row 1
SELECT * FROM diaries;
id title created_at
DROP TABLE diaries;
diff --git a/storage/myisam/TODO b/storage/myisam/TODO
deleted file mode 100644
index cad9486e1bb..00000000000
--- a/storage/myisam/TODO
+++ /dev/null
@@ -1,7 +0,0 @@
-TODO:
-
-- Let packisam find the optimal way to store keys.
-- kill when using 'myisamchk' should remove all temporary files.
-- Text search index
- (Sergei A. Golub is working on this)
-- Add '%' packed to myisamchk for compressed tables with blobs.
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index f6929438ac0..01078c2a264 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -102,6 +102,9 @@ int chk_status(HA_CHECK *param, register MI_INFO *info)
{
MYISAM_SHARE *share=info->s;
+ /* Protection for HA_EXTRA_FLUSH */
+ mysql_mutex_lock(&share->intern_lock);
+
if (mi_is_crashed_on_repair(info))
mi_check_print_warning(param,
"Table is marked as crashed and last repair failed");
@@ -121,6 +124,7 @@ int chk_status(HA_CHECK *param, register MI_INFO *info)
if (param->testflag & T_UPDATE_STATE)
param->warning_printed=save;
}
+ mysql_mutex_unlock(&share->intern_lock);
return 0;
}
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index e28b9be501e..15f0297002f 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -332,7 +332,11 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (!share->temporary)
flush_key_blocks(share->key_cache, share->kfile, &share->dirty_part_map,
FLUSH_KEEP);
+ mysql_mutex_lock(&share->intern_lock);
+ /* Tell mi_lock_database() that we locked the intern_lock mutex */
+ info->intern_lock_locked= 1;
_mi_decrement_open_count(info);
+ info->intern_lock_locked= 0;
if (share->not_flushed)
{
share->not_flushed=0;
@@ -349,6 +353,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
if (share->base.blobs)
mi_alloc_rec_buff(info, -1, &info->rec_buff);
+ mysql_mutex_unlock(&share->intern_lock);
break;
case HA_EXTRA_NORMAL: /* Theese isn't in use */
info->quick_mode=0;
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index b348429fd3c..f3030148044 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -53,7 +53,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
error= 0;
DBUG_EXECUTE_IF ("mi_lock_database_failure", error= EINVAL;);
- mysql_mutex_lock(&share->intern_lock);
+ if (!info->intern_lock_locked)
+ mysql_mutex_lock(&share->intern_lock);
if (share->kfile >= 0) /* May only be false on windows */
{
switch (lock_type) {
@@ -261,7 +262,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
}
#endif
- mysql_mutex_unlock(&share->intern_lock);
+ if (!info->intern_lock_locked)
+ mysql_mutex_unlock(&share->intern_lock);
if (mark_crashed)
mi_mark_crashed(info);
DBUG_RETURN(error);
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index d51e0f9f9e1..8ba2bbcc209 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -296,6 +296,7 @@ struct st_myisam_info
uint preload_buff_size; /* When preloading indexes */
myf lock_wait; /* is 0 or MY_SHORT_WAIT */
my_bool was_locked; /* Was locked in panic */
+ my_bool intern_lock_locked; /* locked in mi_extra() */
my_bool append_insert_at_end; /* Set if concurrent insert */
my_bool quick_mode;
/* If info->buff can't be used for rnext */
diff --git a/storage/perfschema/unittest/pfs_server_stubs.cc b/storage/perfschema/unittest/pfs_server_stubs.cc
index d7154067fc2..12f54a193c2 100644
--- a/storage/perfschema/unittest/pfs_server_stubs.cc
+++ b/storage/perfschema/unittest/pfs_server_stubs.cc
@@ -24,8 +24,6 @@
struct sql_digest_storage;
-volatile bool ready_to_exit= false;
-
uint lower_case_table_names= 0;
CHARSET_INFO *files_charset_info= NULL;
CHARSET_INFO *system_charset_info= NULL;
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 090763a2ece..6bb8c9f6d67 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -221,7 +221,9 @@ TARGET_LINK_LIBRARIES(sst_dump rocksdblib)
MYSQL_ADD_EXECUTABLE(mysql_ldb tools/mysql_ldb.cc COMPONENT rocksdb-engine)
TARGET_LINK_LIBRARIES(mysql_ldb rocksdb_tools rocksdb_aux_lib dbug)
-INSTALL_SCRIPT(myrocks_hotbackup COMPONENT rocksdb-engine)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/myrocks_hotbackup.py
+ ${CMAKE_CURRENT_BINARY_DIR}/myrocks_hotbackup @ONLY)
+INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/myrocks_hotbackup COMPONENT rocksdb-engine)
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET_TARGET_PROPERTIES(rocksdb_tools sst_dump mysql_ldb PROPERTIES COMPILE_FLAGS -frtti)
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 38b33a41565..9f73b95cb4d 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -3770,7 +3770,6 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx)
We get here when committing a statement within a transaction.
*/
tx->make_stmt_savepoint_permanent();
- tx->make_stmt_savepoint_permanent();
}
if (my_core::thd_tx_isolation(thd) <= ISO_READ_COMMITTED) {
diff --git a/storage/rocksdb/myrocks_hotbackup b/storage/rocksdb/myrocks_hotbackup.py
index ef1e934f3fd..906ba814776 100755
--- a/storage/rocksdb/myrocks_hotbackup
+++ b/storage/rocksdb/myrocks_hotbackup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!@PYTHON_SHEBANG@
from __future__ import division
from optparse import OptionParser
@@ -8,7 +8,6 @@ import os
import stat
import sys
import re
-import commands
import subprocess
import logging
import logging.handlers
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result b/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result
index 32c0537c780..de7717b3480 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result
@@ -394,30 +394,41 @@ larger
larger
1
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
larger
1
larger
1
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select 1300 < 1300 * 1.5 as "same";
same
@@ -476,6 +487,7 @@ INSERT INTO t1 (a, b) VALUES (4, 20);
set global rocksdb_force_flush_memtable_now=1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SHOW INDEX in t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/analyze_table.result b/storage/rocksdb/mysql-test/rocksdb/r/analyze_table.result
index b666a17c81c..3459b6f189b 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/analyze_table.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/analyze_table.result
@@ -5,26 +5,32 @@ CREATE TABLE t2 (pk INT PRIMARY KEY, a INT(11), b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (3,3,'c');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t2 VALUES (1,4,'d');
ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
INSERT INTO t1 VALUES (4,5,'e');
INSERT INTO t2 VALUES (2,6,'f');
ANALYZE LOCAL TABLE t1, t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
DROP TABLE t1, t2;
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT(11), KEY(a)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1),(2,2),(3,4),(4,7);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1 VALUES (5,8),(6,10),(7,11),(8,12);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
#
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load.result
index 21417caf760..51664516bb4 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load.result
@@ -43,8 +43,11 @@ t2 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL 0 N
t3 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned 0 N
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result
index 3703c208d0b..4ea8cbccc1e 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_errors.result
@@ -77,7 +77,7 @@ SET rocksdb_bulk_load=1;
INSERT INTO t1 VALUES(13, 0);
INSERT INTO t1 VALUES(2, 'test 2');
Warnings:
-Warning 1366 Incorrect integer value: 'test 2' for column 'b' at row 1
+Warning 1366 Incorrect integer value: 'test 2' for column `test`.`t1`.`b` at row 1
INSERT INTO t1 VALUES(@id, @arg04);
SET @@global.table_open_cache=FALSE;
Warnings:
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf.result
index 484c2a89c3a..fa8546e3e3c 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf.result
@@ -43,8 +43,11 @@ t2 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL 0 N
t3 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned 0 N
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result
index 35a2845cb42..e3870dc37a8 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result
@@ -43,8 +43,11 @@ t2 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL 0 N
t3 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned 0 N
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_data.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_data.result
index 12013539017..5b432aec5da 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_data.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_data.result
@@ -43,8 +43,11 @@ t2 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL 0 N
t3 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_bin NULL partitioned 0 N
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted.result
index 444f997bf48..632b3b47eb5 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted.result
@@ -80,8 +80,11 @@ t2 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned 0 N
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted_rev.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted_rev.result
index dea69b3b089..b5a56b21f5e 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted_rev.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_unsorted_rev.result
@@ -80,8 +80,11 @@ t2 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 ROCKSDB 10 Fixed 2500000 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned 0 N
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SHOW TABLE STATUS WHERE name LIKE 't%';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/cardinality.result b/storage/rocksdb/mysql-test/rocksdb/r/cardinality.result
index d037c636a16..ce29ee04b30 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/cardinality.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/cardinality.result
@@ -88,6 +88,7 @@ ENGINE=ROCKSDB;
SET GLOBAL rocksdb_force_flush_memtable_now = 1;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
cardinality of the columns after 'a' must be equal to the cardinality of column 'a'
SELECT CARDINALITY INTO @c FROM information_schema.statistics WHERE TABLE_NAME='t2' AND INDEX_NAME='c' AND COLUMN_NAME='a';
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
index 2ae965b6cfc..64d87b7116d 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
@@ -577,8 +577,8 @@ b1 b2
0 0
INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
-Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1
+Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1
SELECT b1,b2 FROM t1;
b1 b2
-1 -2
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
index a834310417e..ba651fcbb14 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
@@ -500,8 +500,8 @@ b1 b2
0 0
INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
-Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1
+Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1
SELECT b1,b2 FROM t1;
b1 b2
-1 -2
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/drop_index_inplace.result b/storage/rocksdb/mysql-test/rocksdb/r/drop_index_inplace.result
index dfa5c5b2590..44f4af7b30f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/drop_index_inplace.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/drop_index_inplace.result
@@ -139,6 +139,7 @@ INSERT INTO t1 (col1,col2,col3) VALUES (1,2,3);
ALTER TABLE t1 ADD KEY idx ( col1, col2 );
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 DROP COLUMN col2;
ALTER TABLE t1 DROP COLUMN col3;
@@ -148,6 +149,7 @@ INSERT INTO t1 (col1,col2,col3) VALUES (1,2,3);
ALTER TABLE t1 ADD KEY idx ( col1, col2 );
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 DROP COLUMN col2;
ALTER TABLE t1 DROP COLUMN col3;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb.result
index 7fb9055083b..7c4f57b61bd 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb.result
@@ -28,6 +28,7 @@ insert into t1 values (1, 100, 100), (1, 200, 200), (1, 300, 300);
set global rocksdb_force_flush_memtable_now=1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain select * from t1 where key1 = 1;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/misc.result b/storage/rocksdb/mysql-test/rocksdb/r/misc.result
index f19f7f82ab7..b2e5d04f6f8 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/misc.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/misc.result
@@ -46,6 +46,8 @@ db User NULL NULL
event db NULL NULL
event name NULL NULL
func name NULL NULL
+global_priv Host NULL NULL
+global_priv User NULL NULL
gtid_slave_pos domain_id NULL NULL
gtid_slave_pos sub_id NULL NULL
help_category help_category_id NULL NULL
@@ -90,5 +92,3 @@ time_zone_transition Time_zone_id NULL NULL
time_zone_transition Transition_time NULL NULL
time_zone_transition_type Time_zone_id NULL NULL
time_zone_transition_type Transition_type_id NULL NULL
-user Host NULL NULL
-user User NULL NULL
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/partition.result b/storage/rocksdb/mysql-test/rocksdb/r/partition.result
index 1ba966e9e07..a7f2a6112c1 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/partition.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/partition.result
@@ -46,6 +46,7 @@ CREATE TABLE t1 (i INT, j INT, k INT, PRIMARY KEY (i)) ENGINE = ROCKSDB PARTITIO
Table Op Msg_type Msg_text
test.t1 optimize status OK
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
Table Op Msg_type Msg_text
test.t1 repair status OK
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result b/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result
index 89ebe760384..9bbbdec4794 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result
@@ -144,7 +144,7 @@ Warnings:
Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` >= 500 and `test`.`t1`.`b` <= 500
explain extended select * from t1 where a< 750 and b> 500 and b< 750;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 range ka,kb ka 5 NULL 1000 100.00 Using index condition; Using where
+1 SIMPLE t1 range ka,kb ka 5 NULL 1000 5.00 Using index condition; Using where
Warnings:
Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` < 750 and `test`.`t1`.`b` > 500 and `test`.`t1`.`b` < 750
drop index ka on t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
index 6a21a339207..e18bb5f9c0c 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
@@ -2451,9 +2451,9 @@ DROP TABLE t1;
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MEMORY;
INSERT INTO t2 VALUES (100,NULL),(150,"long varchar"),(200,"varchar"),(250,"long long long varchar");
Warnings:
-Warning 1366 Incorrect integer value: 'long varchar' for column 'data' at row 2
-Warning 1366 Incorrect integer value: 'varchar' for column 'data' at row 3
-Warning 1366 Incorrect integer value: 'long long long varchar' for column 'data' at row 4
+Warning 1366 Incorrect integer value: 'long varchar' for column `test`.`t2`.`data` at row 2
+Warning 1366 Incorrect integer value: 'varchar' for column `test`.`t2`.`data` at row 3
+Warning 1366 Incorrect integer value: 'long long long varchar' for column `test`.`t2`.`data` at row 4
create TABLE t1 (a int not null, b int not null, primary key(a,b));
INSERT INTO t1 VALUES (1,1);
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
@@ -2542,10 +2542,10 @@ a
truncate t1;
INSERT INTO t1 VALUES(X'042000200020',X'042000200020'),(X'200400200020',X'200400200020');
Warnings:
-Warning 1366 Incorrect integer value: '\x04 \x00 \x00 ' for column 'a' at row 1
-Warning 1366 Incorrect integer value: '\x04 \x00 \x00 ' for column 'b' at row 1
-Warning 1366 Incorrect integer value: ' \x04\x00 \x00 ' for column 'a' at row 2
-Warning 1366 Incorrect integer value: ' \x04\x00 \x00 ' for column 'b' at row 2
+Warning 1366 Incorrect integer value: '\x04 \x00 \x00 ' for column `test`.`t1`.`a` at row 1
+Warning 1366 Incorrect integer value: '\x04 \x00 \x00 ' for column `test`.`t1`.`b` at row 1
+Warning 1366 Incorrect integer value: ' \x04\x00 \x00 ' for column `test`.`t1`.`a` at row 2
+Warning 1366 Incorrect integer value: ' \x04\x00 \x00 ' for column `test`.`t1`.`b` at row 2
UNLOCK TABLES;
DROP TABLE t1;
#
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_cf_per_partition.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_cf_per_partition.result
index 99186153796..24b93ee3395 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_cf_per_partition.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_cf_per_partition.result
@@ -350,6 +350,8 @@ cf_name
another_cf_for_p5
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze Warning Engine-independent statistics are not collected for column 'col5'
test.t2 analyze status OK
EXPLAIN PARTITIONS SELECT * FROM t2 WHERE col3 = 0x4 AND col2 = 0x34567;
id select_type table partitions type possible_keys key key_len ref rows Extra
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result
index a925c21e188..bcda9341f1f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result
@@ -1,13 +1,14 @@
create table t1 (id1 bigint, id2 bigint, c1 bigint, c2 bigint, c3 bigint, c4 bigint, c5 bigint, c6 bigint, c7 bigint, primary key (id1, id2), index i(c1, c2));
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
select count(*) from t1;
count(*)
10000
explain select c1 from t1 where c1 > 5 limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range i i 9 NULL # Using where; Using index
+1 SIMPLE t1 index i i 18 NULL # Using where; Using index
drop table t1;
#
# MDEV-17414: MyROCKS order desc limit 1 fails
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/statistics.result b/storage/rocksdb/mysql-test/rocksdb/r/statistics.result
index 78344991360..24f3463bf11 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/statistics.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/statistics.result
@@ -49,8 +49,11 @@ t2 1 1
t3 1 1
analyze table t1,t2,t3,t4,t5;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t4 analyze Error Table 'test.t4' doesn't exist
test.t4 analyze status Operation failed
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_bool.result b/storage/rocksdb/mysql-test/rocksdb/r/type_bool.result
index 4abfdb49f37..bfe2c18acb4 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_bool.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_bool.result
@@ -45,8 +45,8 @@ b1 b2
0 0
INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
-Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
-Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
+Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1
+Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1
SELECT b1,b2 FROM t1;
b1 b2
-1 -2
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_decimal.result b/storage/rocksdb/mysql-test/rocksdb/r/type_decimal.result
index 7397ff64ab1..668a927669a 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_decimal.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_decimal.result
@@ -25,6 +25,7 @@ insert into t1 select pk+10000, 9.0, 9.0, 'extra-data' from t1;
insert into t1 select pk+100000, 9.0, 9.0, 'extra-data' from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# The following can't use index-only:
explain select * from t1 where col1 between -8 and 8;
@@ -88,6 +89,7 @@ insert into t1 select pk+10000, col1+20000, col2+20000, 'extra-data' from t1;
insert into t1 select pk+100000, col1+20000, col2+20000, 'extra-data' from t1;
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain
select col1, col2 from t1 force index(key1) where col1 between -800 and 800;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_varchar.result b/storage/rocksdb/mysql-test/rocksdb/r/type_varchar.result
index a7e086fde66..4c5ef47590a 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_varchar.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_varchar.result
@@ -191,6 +191,7 @@ insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
@@ -306,6 +307,7 @@ insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
@@ -421,6 +423,7 @@ insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
@@ -536,6 +539,7 @@ insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
@@ -651,6 +655,7 @@ insert into t1 values (2, 'a', 'a');
insert into t1 values (3, 'a \t', 'a-tab');
analyze table t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Must show 'using index' for latin1_bin and utf8_bin:
explain
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/xa.result b/storage/rocksdb/mysql-test/rocksdb/r/xa.result
new file mode 100644
index 00000000000..30cfe94e0b7
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/r/xa.result
@@ -0,0 +1,32 @@
+#
+# MDEV-13155: XA recovery not supported for RocksDB (Just a testcase)
+#
+call mtr.add_suppression("Found .* prepared XA transactions");
+connect con1,localhost,root,,test;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT) ENGINE=RocksDB;
+XA START 'xa1';
+INSERT INTO t1 (a) VALUES (1),(2);
+XA END 'xa1';
+XA PREPARE 'xa1';
+connect con2,localhost,root,,test;
+XA START 'xa2';
+INSERT INTO t1 (a) VALUES (3);
+INSERT INTO t1 (a) VALUES (4);
+XA END 'xa2';
+XA PREPARE 'xa2';
+connection default;
+SELECT * FROM t1;
+a
+connect con3,localhost,root,,test;
+XA RECOVER;
+formatID gtrid_length bqual_length data
+1 3 0 xa1
+1 3 0 xa2
+XA ROLLBACK 'xa1';
+XA COMMIT 'xa2';
+SELECT a FROM t1;
+a
+3
+4
+DROP TABLE t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
index 9fbc0ace0d2..91bf571371e 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
+++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
@@ -83,3 +83,4 @@ autoinc_debug: Fails with wrong results
drop_table: Hangs on shutdown
allow_to_start_after_corruption : result difference and assertion failure
index_merge_rocksdb2 : result difference
+rocksdb_range2 : result difference, update after MDEV-16746 is fixed
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/xa-master.opt b/storage/rocksdb/mysql-test/rocksdb/t/xa-master.opt
new file mode 100644
index 00000000000..70c120604f6
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/t/xa-master.opt
@@ -0,0 +1 @@
+--rocksdb_flush_log_at_trx_commit=1
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/xa.test b/storage/rocksdb/mysql-test/rocksdb/t/xa.test
new file mode 100644
index 00000000000..f8f381f0580
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/t/xa.test
@@ -0,0 +1,38 @@
+--echo #
+--echo # MDEV-13155: XA recovery not supported for RocksDB (Just a testcase)
+--echo #
+
+call mtr.add_suppression("Found .* prepared XA transactions");
+
+--connect (con1,localhost,root,,test)
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT) ENGINE=RocksDB;
+
+XA START 'xa1';
+INSERT INTO t1 (a) VALUES (1),(2);
+XA END 'xa1';
+XA PREPARE 'xa1';
+
+--connect (con2,localhost,root,,test)
+XA START 'xa2';
+INSERT INTO t1 (a) VALUES (3);
+INSERT INTO t1 (a) VALUES (4);
+XA END 'xa2';
+XA PREPARE 'xa2';
+
+--connection default
+SELECT * FROM t1;
+
+--let $shutdown_timeout= 0
+--source include/restart_mysqld.inc
+
+--connect (con3,localhost,root,,test)
+--disable_abort_on_error
+XA RECOVER;
+XA ROLLBACK 'xa1';
+XA COMMIT 'xa2';
+SELECT a FROM t1;
+DROP TABLE t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/r/mdev12179.result b/storage/rocksdb/mysql-test/rocksdb_rpl/r/mdev12179.result
index 9c20fea97ae..a1e501f78f4 100644
--- a/storage/rocksdb/mysql-test/rocksdb_rpl/r/mdev12179.result
+++ b/storage/rocksdb/mysql-test/rocksdb_rpl/r/mdev12179.result
@@ -2,6 +2,7 @@ include/master-slave.inc
[connection master]
connection server_2;
include/stop_slave.inc
+SET GLOBAL gtid_cleanup_batch_size = 999999999;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET sql_log_bin=0;
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos;
@@ -41,6 +42,8 @@ a
1
SELECT * FROM mysql.gtid_slave_pos ORDER BY sub_id;
domain_id sub_id server_id seq_no
+0 1 1 1
+0 2 1 2
0 3 1 3
0 4 1 4
SELECT * FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
@@ -121,6 +124,21 @@ Transactions_multi_engine 6
DELETE FROM t1 WHERE a >= 100;
DELETE FROM t2 WHERE a >= 100;
DELETE FROM t3 WHERE a >= 100;
+connection server_1;
+include/save_master_gtid.inc
+connection server_2;
+include/sync_with_master_gtid.inc
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos;
+COUNT(*)>=10
+1
+SELECT COUNT(*)>=10 FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
+UNION ALL SELECT * FROM mysql.gtid_slave_pos_innodb_redundant) inner_select;
+COUNT(*)>=10
+1
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos_rocksdb;
+COUNT(*)>=10
+1
+SET GLOBAL gtid_cleanup_batch_size = 3;
connection server_2;
include/stop_slave.inc
SET sql_log_bin=0;
diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/mdev12179.test b/storage/rocksdb/mysql-test/rocksdb_rpl/t/mdev12179.test
index e0d16e7f242..631d9ca533f 100644
--- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/mdev12179.test
+++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/mdev12179.test
@@ -4,6 +4,12 @@
--connection server_2
--source include/stop_slave.inc
+
+# Set GTID cleanup limit high enough that cleanup will not run and we
+# can rely on consistent table output in .result.
+--let $old_gtid_cleanup_batch_size=`SELECT @@GLOBAL.gtid_cleanup_batch_size`
+SET GLOBAL gtid_cleanup_batch_size = 999999999;
+
CHANGE MASTER TO master_use_gtid=slave_pos;
SET sql_log_bin=0;
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos;
@@ -89,6 +95,82 @@ DELETE FROM t2 WHERE a >= 100;
DELETE FROM t3 WHERE a >= 100;
+# Create a bunch more GTIDs in mysql.gtid_slave_pos* tables to test with.
+--connection server_1
+--disable_query_log
+let $i=10;
+while ($i) {
+ eval INSERT INTO t1 VALUES (300+$i);
+ eval INSERT INTO t2 VALUES (300+$i);
+ eval INSERT INTO t3 VALUES (300+$i);
+ dec $i;
+}
+--enable_query_log
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+
+# Check that we have many rows in mysql.gtid_slave_pos now (since
+# @@gtid_cleanup_batch_size was set to a huge value). No need to check
+# for an exact number, since that will require changing .result if
+# anything changes prior to this point, and we just need to know that
+# we have still have some data in the tables to make the following
+# test effective.
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos;
+SELECT COUNT(*)>=10 FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
+ UNION ALL SELECT * FROM mysql.gtid_slave_pos_innodb_redundant) inner_select;
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos_rocksdb;
+
+# Check that old GTID rows will be deleted when batch delete size is
+# set reasonably. Old row deletion is not 100% deterministic (by design), so
+# we must wait for it to occur, but it should occur eventually.
+SET GLOBAL gtid_cleanup_batch_size = 3;
+let $i=40;
+--disable_query_log
+--let $keep_include_silent=1
+while ($i) {
+ let N=`SELECT 1+($i MOD 3)`;
+ --connection server_1
+ eval UPDATE t$N SET a=a+1 WHERE a=(SELECT MAX(a) FROM t$N);
+ --source include/save_master_gtid.inc
+ --connection server_2
+ --source include/sync_with_master_gtid.inc
+ let $j=50;
+ while ($j) {
+ let $is_done=`SELECT SUM(a)=1 FROM (
+ SELECT COUNT(*) AS a FROM mysql.gtid_slave_pos
+ UNION ALL
+ SELECT COUNT(*) AS a FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
+ UNION ALL SELECT * FROM mysql.gtid_slave_pos_innodb_redundant) inner_select
+ UNION ALL
+ SELECT COUNT(*) AS a FROM mysql.gtid_slave_pos_rocksdb) outer_select`;
+ if ($is_done) {
+ let $j=0;
+ }
+ if (!$is_done) {
+ real_sleep 0.1;
+ dec $j;
+ }
+ }
+ dec $i;
+ if ($is_done) {
+ let $i=0;
+ }
+}
+--enable_query_log
+--let $keep_include_silent=0
+if (!$is_done) {
+ --echo Timed out waiting for mysql.gtid_slave_pos* tables to be cleaned up
+}
+
+--disable_query_log
+DELETE FROM t1 WHERE a >= 100;
+DELETE FROM t2 WHERE a >= 100;
+DELETE FROM t3 WHERE a >= 100;
+--enable_query_log
+
+
# Test status variables Rpl_transactions_multi_engine and Transactions_gtid_foreign_engine.
# Have mysql.gtid_slave_pos* for myisam and innodb but not rocksdb.
--connection server_2
@@ -223,6 +305,9 @@ SHOW STATUS LIKE "%transactions%engine";
SET sql_log_bin=0;
DROP TABLE mysql.gtid_slave_pos_innodb;
SET sql_log_bin=1;
+--disable_query_log
+eval SET GLOBAL gtid_cleanup_batch_size = $old_gtid_cleanup_batch_size;
+--enable_query_log
--connection server_1
DROP TABLE t1;
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index e6377d566d9..a5fc3345ea3 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -64,6 +64,9 @@ extern HASH spider_open_tables;
#endif
extern pthread_mutex_t spider_lgtm_tblhnd_share_mutex;
+/* UTC time zone for timestamp columns */
+extern Time_zone *UTC;
+
ha_spider::ha_spider(
) : handler(spider_hton_ptr, NULL)
{
@@ -7375,6 +7378,8 @@ int ha_spider::rnd_init(
#endif
if (quick_targets[roop_count])
{
+ spider_db_free_one_quick_result(
+ (SPIDER_RESULT *) result_list.current);
DBUG_ASSERT(quick_targets[roop_count] ==
conns[roop_count]->quick_target);
DBUG_PRINT("info", ("spider conn[%p]->quick_target=NULL",
@@ -7963,7 +7968,7 @@ int ha_spider::cmp_ref(
if ((ret = (*field)->cmp_binary_offset((uint) ptr_diff)))
{
DBUG_PRINT("info",("spider different at %s",
- (*field)->field_name.str));
+ SPIDER_field_name_str(*field)));
break;
}
}
@@ -9392,8 +9397,8 @@ ulonglong ha_spider::table_flags() const
HA_BINLOG_ROW_CAPABLE |
HA_BINLOG_STMT_CAPABLE |
HA_PARTIAL_COLUMN_READ |
-#ifdef HA_CMP_REF_IS_EXPENSIVE
- HA_CMP_REF_IS_EXPENSIVE |
+#ifdef HA_SLOW_CMP_REF
+ HA_SLOW_CMP_REF |
#endif
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
HA_CAN_TABLE_CONDITION_PUSHDOWN |
@@ -9959,21 +9964,38 @@ int ha_spider::end_bulk_update(
DBUG_RETURN(0);
}
+#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int ha_spider::bulk_update_row(
const uchar *old_data,
const uchar *new_data,
ha_rows *dup_key_found
-) {
+)
+#else
+int ha_spider::bulk_update_row(
+ const uchar *old_data,
+ uchar *new_data,
+ ha_rows *dup_key_found
+)
+#endif
+{
DBUG_ENTER("ha_spider::bulk_update_row");
DBUG_PRINT("info",("spider this=%p", this));
*dup_key_found = 0;
DBUG_RETURN(update_row(old_data, new_data));
}
+#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int ha_spider::update_row(
const uchar *old_data,
const uchar *new_data
-) {
+)
+#else
+int ha_spider::update_row(
+ const uchar *old_data,
+ uchar *new_data
+)
+#endif
+{
int error_num;
THD *thd = ha_thd();
backup_error_status();
@@ -10064,10 +10086,24 @@ int ha_spider::update_row(
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count, bool sorted,
- const uchar *new_data)
+#ifdef SPIDER_MDEV_16246
+int ha_spider::direct_update_rows_init(
+ List<Item> *update_fields,
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+)
+#else
+int ha_spider::direct_update_rows_init(
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+)
+#endif
{
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
int error_num;
@@ -10095,8 +10131,13 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
pre_direct_init_result));
DBUG_RETURN(pre_direct_init_result);
}
+#ifdef SPIDER_MDEV_16246
DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
update_fields, mode, ranges, range_count, sorted, new_data));
+#else
+ DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
+ mode, ranges, range_count, sorted, new_data));
+#endif
}
#endif
direct_update_init(
@@ -10200,6 +10241,7 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
#else
+#ifdef SPIDER_MDEV_16246
/**
Perform initialization for a direct update request.
@@ -10209,37 +10251,43 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
0 Success.
*/
-int ha_spider::direct_update_rows_init(List<Item> *update_fields)
+int ha_spider::direct_update_rows_init(
+ List<Item> *update_fields
+)
+#else
+int ha_spider::direct_update_rows_init()
+#endif
{
st_select_lex *select_lex;
longlong select_limit;
longlong offset_limit;
- List_iterator<Item> it(*update_fields);
+ List_iterator<Item> it(*direct_update_fields);
Item *item;
Field *field;
THD *thd = trx->thd;
DBUG_ENTER("ha_spider::direct_update_rows_init");
DBUG_PRINT("info",("spider this=%p", this));
-
- while ((item = it++))
+ if (thd->variables.time_zone != UTC)
{
- if (item->type() == Item::FIELD_ITEM)
+ while ((item = it++))
{
- field = ((Item_field *)item)->field;
-
- if (field->type() == FIELD_TYPE_TIMESTAMP &&
- field->flags & UNIQUE_KEY_FLAG)
+ if (item->type() == Item::FIELD_ITEM)
{
- /*
- Spider cannot perform direct update on unique timestamp fields.
- To avoid false duplicate key errors, the table needs to be
- updated one row at a time.
- */
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ field = ((Item_field *)item)->field;
+
+ if (field->type() == FIELD_TYPE_TIMESTAMP &&
+ field->flags & UNIQUE_KEY_FLAG)
+ {
+ /*
+ Spider cannot perform direct update on unique timestamp fields.
+ To avoid false duplicate key errors, the table needs to be
+ updated one row at a time.
+ */
+ DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ }
}
}
}
-
#ifdef HA_CAN_BULK_ACCESS
if (
bulk_access_executing &&
@@ -10257,8 +10305,12 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields)
pre_direct_init_result));
DBUG_RETURN(pre_direct_init_result);
}
+#ifdef SPIDER_MDEV_16246
DBUG_RETURN(bulk_access_link_exec_tgt->spider->
- direct_update_rows_init(List<Item> *update_fields));
+ direct_update_rows_init(update_fields));
+#else
+ DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init());
+#endif
}
#endif
direct_update_init(
@@ -10329,30 +10381,54 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields)
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int ha_spider::pre_direct_update_rows_init(List<Item> *update_fields,
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count, bool sorted,
- const uchar *new_data)
+#ifdef SPIDER_MDEV_16246
+int ha_spider::pre_direct_update_rows_init(
+ List<Item> *update_fields,
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+)
+#else
+int ha_spider::pre_direct_update_rows_init(
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+)
+#endif
{
int error_num;
DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
DBUG_PRINT("info",("spider this=%p", this));
if (bulk_access_started)
{
+#ifdef SPIDER_MDEV_16246
error_num = bulk_access_link_current->spider->
- pre_direct_update_rows_init(update_fields, mode, ranges, range_count,
- sorted, new_data);
+ pre_direct_update_rows_init(
+ update_fields, mode, ranges, range_count, sorted, new_data);
+#else
+ error_num = bulk_access_link_current->spider->
+ pre_direct_update_rows_init(
+ mode, ranges, range_count, sorted, new_data);
+#endif
bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
bulk_access_link_current->called = TRUE;
DBUG_RETURN(error_num);
}
- pre_direct_init_result = direct_update_rows_init(update_fields, mode,
- ranges, range_count,
- sorted, new_data);
+#ifdef SPIDER_MDEV_16246
+ pre_direct_init_result = direct_update_rows_init(
+ update_fields, mode, ranges, range_count, sorted, new_data);
+#else
+ pre_direct_init_result = direct_update_rows_init(
+ mode, ranges, range_count, sorted, new_data);
+#endif
DBUG_RETURN(pre_direct_init_result);
}
#else
+#ifdef SPIDER_MDEV_16246
/**
Do initialization for performing parallel direct update
for a handlersocket update request.
@@ -10363,20 +10439,34 @@ int ha_spider::pre_direct_update_rows_init(List<Item> *update_fields,
0 Success.
*/
-int ha_spider::pre_direct_update_rows_init(List<Item> *update_fields)
+int ha_spider::pre_direct_update_rows_init(
+ List<Item> *update_fields
+)
+#else
+int ha_spider::pre_direct_update_rows_init()
+#endif
{
int error_num;
DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
DBUG_PRINT("info",("spider this=%p", this));
if (bulk_access_started)
{
+#ifdef SPIDER_MDEV_16246
error_num = bulk_access_link_current->spider->
- pre_direct_update_rows_init(update_fields);
+ pre_direct_update_rows_init(update_fields);
+#else
+ error_num = bulk_access_link_current->spider->
+ pre_direct_update_rows_init();
+#endif
bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
bulk_access_link_current->called = TRUE;
DBUG_RETURN(error_num);
}
+#ifdef SPIDER_MDEV_16246
pre_direct_init_result = direct_update_rows_init(update_fields);
+#else
+ pre_direct_init_result = direct_update_rows_init();
+#endif
DBUG_RETURN(pre_direct_init_result);
}
#endif
@@ -11305,7 +11395,7 @@ int ha_spider::create(
DBUG_PRINT("info",
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
- thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
+ thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
if ((thd->lex->alter_info.partition_flags &
(
SPIDER_ALTER_PARTITION_ADD | SPIDER_ALTER_PARTITION_DROP |
@@ -11501,7 +11591,7 @@ int ha_spider::rename_table(
DBUG_PRINT("info",
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
- thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
+ thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
if (
(thd->lex->alter_info.partition_flags &
(
@@ -11697,7 +11787,7 @@ int ha_spider::delete_table(
DBUG_PRINT("info",
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
- thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
+ thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
if (
sql_command == SQLCOM_ALTER_TABLE &&
(thd->lex->alter_info.partition_flags &
@@ -13514,6 +13604,7 @@ void ha_spider::check_pre_call(
bool use_parallel
) {
THD* thd = ha_thd();
+ LEX *lex = thd->lex;
st_select_lex *select_lex = spider_get_select_lex(this);
int skip_parallel_search =
spider_param_skip_parallel_search(thd, share->skip_parallel_search);
@@ -13522,11 +13613,15 @@ void ha_spider::check_pre_call(
if (
(
(skip_parallel_search & 1) &&
- thd->lex && thd->lex->sql_command != SQLCOM_SELECT // such like insert .. select ..
+ lex->sql_command != SQLCOM_SELECT // such like insert .. select ..
) ||
(
(skip_parallel_search & 2) &&
- thd->lex->sql_cache == LEX::SQL_NO_CACHE // for mysqldump
+#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
+ lex->sql_cache == LEX::SQL_NO_CACHE // for mysqldump
+#else
+ select_lex && select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE // for mysqldump
+#endif
)
) {
use_pre_call = FALSE;
@@ -15672,12 +15767,23 @@ int ha_spider::mk_bulk_tmp_table_and_bulk_start()
dbton_hdl->first_link_idx >= 0 &&
dbton_hdl->need_copy_for_update(roop_count)
) {
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+ LEX_CSTRING field_name = {STRING_WITH_LEN("a")};
+ if (
+ !tmp_table[roop_count] &&
+ !(tmp_table[roop_count] = spider_mk_sys_tmp_table(
+ trx->thd, table, &result_list.upd_tmp_tbl_prms[roop_count],
+ &field_name, result_list.update_sqls[roop_count].charset()))
+ )
+#else
if (
!tmp_table[roop_count] &&
!(tmp_table[roop_count] = spider_mk_sys_tmp_table(
trx->thd, table, &result_list.upd_tmp_tbl_prms[roop_count], "a",
result_list.update_sqls[roop_count].charset()))
- ) {
+ )
+#endif
+ {
error_num = HA_ERR_OUT_OF_MEM;
goto error_2;
}
@@ -15775,8 +15881,7 @@ int ha_spider::print_item_type(
if (
dbton_hdl->first_link_idx >= 0 &&
(error_num = spider_db_print_item_type(item, NULL, this, str,
- alias, alias_length, dbton_id,
- FALSE, NULL))
+ alias, alias_length, dbton_id, FALSE, NULL))
) {
DBUG_RETURN(error_num);
}
diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h
index 66e5cf8a452..d33d9a3a7dc 100644
--- a/storage/spider/ha_spider.h
+++ b/storage/spider/ha_spider.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -576,6 +576,7 @@ public:
ha_rows *dup_key_found
);
int end_bulk_update();
+#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int bulk_update_row(
const uchar *old_data,
const uchar *new_data,
@@ -585,31 +586,92 @@ public:
const uchar *old_data,
const uchar *new_data
);
+#else
+ int bulk_update_row(
+ const uchar *old_data,
+ uchar *new_data,
+ ha_rows *dup_key_found
+ );
+ int update_row(
+ const uchar *old_data,
+ uchar *new_data
+ );
+#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int direct_update_rows_init(List<Item> *update_fields)
- {
+#ifdef SPIDER_MDEV_16246
+ inline int direct_update_rows_init(
+ List<Item> *update_fields
+ ) {
return direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
}
- int direct_update_rows_init(List<Item> *update_fields, uint mode,
- KEY_MULTI_RANGE *ranges, uint range_count,
- bool sorted, const uchar *new_data);
+ int direct_update_rows_init(
+ List<Item> *update_fields,
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+ );
+#else
+ inline int direct_update_rows_init()
+ {
+ return direct_update_rows_init(2, NULL, 0, FALSE, NULL);
+ }
+ int direct_update_rows_init(
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+ );
+#endif
#else
- int direct_update_rows_init(List<Item> *update_fields);
+#ifdef SPIDER_MDEV_16246
+ int direct_update_rows_init(
+ List<Item> *update_fields
+ );
+#else
+ int direct_update_rows_init();
+#endif
#endif
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int pre_direct_update_rows_init(List<Item> *update_fields)
+#ifdef SPIDER_MDEV_16246
+ inline int pre_direct_update_rows_init(
+ List<Item> *update_fields
+ ) {
+ return pre_direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
+ }
+ int pre_direct_update_rows_init(
+ List<Item> *update_fields,
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+ );
+#else
+ inline int pre_direct_update_rows_init()
{
- return pre_direct_update_rows_init(update_fields,
- 2, NULL, 0, FALSE, NULL);
+ return pre_direct_update_rows_init(2, NULL, 0, FALSE, NULL);
}
- int pre_direct_update_rows_init(List<Item> *update_fields,
- uint mode, KEY_MULTI_RANGE *ranges,
- uint range_count, bool sorted,
- uchar *new_data);
+ int pre_direct_update_rows_init(
+ uint mode,
+ KEY_MULTI_RANGE *ranges,
+ uint range_count,
+ bool sorted,
+ uchar *new_data
+ );
+#endif
#else
- int pre_direct_update_rows_init(List<Item> *update_fields);
+#ifdef SPIDER_MDEV_16246
+ int pre_direct_update_rows_init(
+ List<Item> *update_fields
+ );
+#else
+ int pre_direct_update_rows_init();
+#endif
#endif
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
diff --git a/storage/spider/hs_client/hs_compat.h b/storage/spider/hs_client/hs_compat.h
index e832b2974da..a1b18fe1b38 100644
--- a/storage/spider/hs_client/hs_compat.h
+++ b/storage/spider/hs_client/hs_compat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 Kentoku Shiba
+/* Copyright (C) 2013-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/storage/spider/hs_client/hstcpcli.cpp b/storage/spider/hs_client/hstcpcli.cpp
index 2cb37c7be9d..4c93b5a3a49 100644
--- a/storage/spider/hs_client/hstcpcli.cpp
+++ b/storage/spider/hs_client/hstcpcli.cpp
@@ -67,6 +67,8 @@ struct hstcpcli : public hstcpcli_i, private noncopyable {
virtual int get_result(hstresult& result);
virtual const string_ref *get_next_row();
virtual const string_ref *get_next_row_from_result(hstresult& result);
+ virtual size_t get_row_size();
+ virtual size_t get_row_size_from_result(hstresult& result);
virtual void response_buf_remove();
virtual int get_error_code();
virtual String& get_error();
@@ -93,6 +95,7 @@ struct hstcpcli : public hstcpcli_i, private noncopyable {
string_buffer writebuf;
size_t response_end_offset; /* incl newline */
size_t cur_row_offset;
+ size_t cur_row_size;
size_t num_flds;
size_t num_req_bufd; /* buffered but not yet sent */
size_t num_req_sent; /* sent but not yet received */
@@ -104,8 +107,9 @@ struct hstcpcli : public hstcpcli_i, private noncopyable {
};
hstcpcli::hstcpcli(const socket_args& args)
- : sargs(args), response_end_offset(0), cur_row_offset(0), num_flds(0),
- num_req_bufd(0), num_req_sent(0), num_req_rcvd(0), error_code(0), errno_buf(0)
+ : sargs(args), response_end_offset(0), cur_row_offset(0), cur_row_size(0),
+ num_flds(0), num_req_bufd(0), num_req_sent(0), num_req_rcvd(0),
+ error_code(0), errno_buf(0)
{
String err;
SPD_INIT_DYNAMIC_ARRAY2(&flds, sizeof(string_ref), NULL, 16, 16, MYF(MY_WME));
@@ -503,6 +507,7 @@ hstcpcli::response_recv(size_t& num_flds_r)
}
return set_error(resp_code, e);
}
+ cur_row_size = 0;
cur_row_offset = start - readbuf.begin();
DBG(fprintf(stderr, "[%s] ro=%zu eol=%zu\n",
String(readbuf.begin(), readbuf.begin() + response_end_offset)
@@ -529,6 +534,7 @@ hstcpcli::get_result(hstresult& result)
result.readbuf.space_wrote(response_end_offset);
result.response_end_offset = response_end_offset;
result.num_flds = num_flds;
+ result.cur_row_size = cur_row_size;
result.cur_row_offset = cur_row_offset;
if (result.flds.max_element < num_flds)
{
@@ -566,6 +572,7 @@ hstcpcli::get_next_row()
((string_ref *) flds.buffer)[i] = string_ref(fld_begin, wp);
}
}
+ cur_row_size = start - (readbuf.begin() + cur_row_offset);
cur_row_offset = start - readbuf.begin();
return (string_ref *) flds.buffer;
}
@@ -597,10 +604,24 @@ hstcpcli::get_next_row_from_result(hstresult& result)
((string_ref *) result.flds.buffer)[i] = string_ref(fld_begin, wp);
}
}
+ result.cur_row_size =
+ start - (result.readbuf.begin() + result.cur_row_offset);
result.cur_row_offset = start - result.readbuf.begin();
return (string_ref *) result.flds.buffer;
}
+size_t
+hstcpcli::get_row_size()
+{
+ return cur_row_size;
+}
+
+size_t
+hstcpcli::get_row_size_from_result(hstresult& result)
+{
+ return result.cur_row_size;
+}
+
void
hstcpcli::response_buf_remove()
{
diff --git a/storage/spider/hs_client/hstcpcli.hpp b/storage/spider/hs_client/hstcpcli.hpp
index d153b19cf9b..6894716e469 100644
--- a/storage/spider/hs_client/hstcpcli.hpp
+++ b/storage/spider/hs_client/hstcpcli.hpp
@@ -46,6 +46,7 @@ struct hstresult {
size_t response_end_offset;
size_t num_flds;
size_t cur_row_offset;
+ size_t cur_row_size;
DYNAMIC_ARRAY flds;
};
@@ -71,6 +72,8 @@ struct hstcpcli_i {
virtual int get_result(hstresult& result) = 0;
virtual const string_ref *get_next_row() = 0;
virtual const string_ref *get_next_row_from_result(hstresult& result) = 0;
+ virtual size_t get_row_size() = 0;
+ virtual size_t get_row_size_from_result(hstresult& result) = 0;
virtual void response_buf_remove() = 0;
virtual int get_error_code() = 0;
virtual String& get_error() = 0;
diff --git a/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc
new file mode 100644
index 00000000000..3316472c773
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc
@@ -0,0 +1,15 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc
new file mode 100644
index 00000000000..1cc6ca4ee32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc
@@ -0,0 +1,31 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
diff --git a/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc b/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_join_using_init.inc b/storage/spider/mysql-test/spider/include/direct_join_using_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_using_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_init.inc b/storage/spider/mysql-test/spider/include/direct_left_join_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_init.inc b/storage/spider/mysql-test/spider/include/direct_right_join_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc
new file mode 100644
index 00000000000..72d09f54316
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc
@@ -0,0 +1,21 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_0_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_0_init.inc
new file mode 100644
index 00000000000..92afb3bf10b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_0_init.inc
@@ -0,0 +1,55 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 0;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_1_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_1_deinit.inc
new file mode 100644
index 00000000000..72d09f54316
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_1_deinit.inc
@@ -0,0 +1,21 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_1_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_1_init.inc
new file mode 100644
index 00000000000..cc5a847fdc0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_1_init.inc
@@ -0,0 +1,55 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 1;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_2_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_2_deinit.inc
new file mode 100644
index 00000000000..72d09f54316
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_2_deinit.inc
@@ -0,0 +1,21 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_2_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_2_init.inc
new file mode 100644
index 00000000000..3a16bb1dc63
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_2_init.inc
@@ -0,0 +1,55 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 2;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_3_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_3_deinit.inc
new file mode 100644
index 00000000000..72d09f54316
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_3_deinit.inc
@@ -0,0 +1,21 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_3_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_3_init.inc
new file mode 100644
index 00000000000..df7d713c4c7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_3_init.inc
@@ -0,0 +1,55 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/include/slave_trx_isolation_deinit.inc b/storage/spider/mysql-test/spider/include/slave_trx_isolation_deinit.inc
new file mode 100644
index 00000000000..e5f585e5cca
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/slave_trx_isolation_deinit.inc
@@ -0,0 +1,17 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection slave1_1
+set global spider_slave_trx_isolation= @old_spider_slave_trx_isolation;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../include/deinit_spider.inc
+--source ../t/slave_test_deinit.inc
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/slave_trx_isolation_init.inc b/storage/spider/mysql-test/spider/include/slave_trx_isolation_init.inc
new file mode 100644
index 00000000000..94ccf1d3295
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/slave_trx_isolation_init.inc
@@ -0,0 +1,39 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--source ../t/slave_test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection slave1_1
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../include/init_spider.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+set @old_spider_slave_trx_isolation= @@spider_slave_trx_isolation;
+set global spider_slave_trx_isolation= 1;
diff --git a/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result b/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result
new file mode 100644
index 00000000000..fd748dc8590
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result
@@ -0,0 +1,104 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CHECKSUM TABLE tbl_a EXTENDED;
+Table Checksum
+auto_test_local.tbl_a 1061386331
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_join_using.result b/storage/spider/mysql-test/spider/r/direct_join_using.result
new file mode 100644
index 00000000000..66ae1503f9f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_join_using.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0,`auto_test_remote`.`ta_r_3` t1,`auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_join.result b/storage/spider/mysql-test/spider/r/direct_left_join.result
new file mode 100644
index 00000000000..b63f0661b2e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_join.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_int` t2 on (t2.`a` = t0.`a`) where 1 order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
new file mode 100644
index 00000000000..e646bc9bf38
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
+a b c a
+5 NULL NULL NULL
+4 NULL NULL NULL
+3 c 2000-01-03 00:00:00 NULL
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t0 left join `auto_test_remote`.`ta_r_auto_inc` t1 on ((t1.`a` = t0.`a`) and (t0.`a` is not null)) left join `auto_test_remote`.`ta_r_3` t2 on (t2.`c` = t1.`c`) left join `auto_test_remote`.`ta_r` t3 on ((t3.`b` = t2.`b`) and (t2.`b` is not null)) where 1 order by t0.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
new file mode 100644
index 00000000000..f3c6e189444
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL NULL NULL 4
+NULL NULL NULL 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null) and (t3.`b` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result
new file mode 100644
index 00000000000..88205fb0f65
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result
@@ -0,0 +1,112 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join (`auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t1.`c` = t2.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_join.result b/storage/spider/mysql-test/spider/r/direct_right_join.result
new file mode 100644
index 00000000000..8edfb682292
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_join.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r_int` t2 left join (`auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1) on ((t0.`a` = t2.`a`) and (t1.`a` = t2.`a`)) where 1 order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
new file mode 100644
index 00000000000..a05781cb6d6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join `auto_test_remote`.`ta_r_auto_inc` t2 on ((t2.`b` = t3.`b`) and (t3.`b` is not null)) left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result
new file mode 100644
index 00000000000..25e0913ba06
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result
@@ -0,0 +1,112 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
new file mode 100644
index 00000000000..48cd9c2c75f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL NULL NULL 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null))) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t3.`b` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_0.result b/storage/spider/mysql-test/spider/r/quick_mode_0.result
new file mode 100644
index 00000000000..1cf79124b8c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_0.result
@@ -0,0 +1,515 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 0;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_1.result b/storage/spider/mysql-test/spider/r/quick_mode_1.result
new file mode 100644
index 00000000000..1d56cff3e36
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_1.result
@@ -0,0 +1,515 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 1;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_2.result b/storage/spider/mysql-test/spider/r/quick_mode_2.result
new file mode 100644
index 00000000000..5b0cd75af34
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_2.result
@@ -0,0 +1,515 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 2;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_3.result b/storage/spider/mysql-test/spider/r/quick_mode_3.result
new file mode 100644
index 00000000000..4261cde2e36
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_3.result
@@ -0,0 +1,515 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result
new file mode 100644
index 00000000000..167739beaad
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result
@@ -0,0 +1,110 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+connection slave1_1;
+set @old_spider_slave_trx_isolation= @@spider_slave_trx_isolation;
+set global spider_slave_trx_isolation= 1;
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+connection master_1;
+SET SESSION sql_log_bin= 1;
+connection slave1_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+connection master_1;
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+connection slave1_1;
+connection master_1;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %';
+argument
+set session time_zone = '+00:00'
+SET NAMES utf8
+set session transaction isolation level read committed;set session autocommit = 1;start transaction
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+connection slave1_1;
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection slave1_1;
+set global spider_slave_trx_isolation= @old_spider_slave_trx_isolation;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test
new file mode 100644
index 00000000000..bf0d8bfa0a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test
@@ -0,0 +1,134 @@
+--source ../include/checksum_table_with_quick_mode_3_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+CHECKSUM TABLE tbl_a EXTENDED;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/checksum_table_with_quick_mode_3_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_join_using.test b/storage/spider/mysql-test/spider/t/direct_join_using.test
new file mode 100644
index 00000000000..819e56ff21c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_join_using.test
@@ -0,0 +1,197 @@
+--source ../include/direct_join_using_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_join_using_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_join.test b/storage/spider/mysql-test/spider/t/direct_left_join.test
new file mode 100644
index 00000000000..e09b6a12488
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_join.test
@@ -0,0 +1,197 @@
+--source ../include/direct_left_join_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_join_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test
new file mode 100644
index 00000000000..dc67a01b4b2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test
new file mode 100644
index 00000000000..9d5a990e0ba
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_left_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test
new file mode 100644
index 00000000000..90e3666957d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_left_right_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_right_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_join.test b/storage/spider/mysql-test/spider/t/direct_right_join.test
new file mode 100644
index 00000000000..0c0496651d6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_join.test
@@ -0,0 +1,197 @@
+--source ../include/direct_right_join_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_join_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test
new file mode 100644
index 00000000000..3ab4a30ea84
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test
new file mode 100644
index 00000000000..fefe255890d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_right_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test
new file mode 100644
index 00000000000..48882d27939
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_right_left_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_left_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_0.test b/storage/spider/mysql-test/spider/t/quick_mode_0.test
new file mode 100644
index 00000000000..ffb665c0604
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_0.test
@@ -0,0 +1,309 @@
+--source ../include/quick_mode_0_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_1.test b/storage/spider/mysql-test/spider/t/quick_mode_1.test
new file mode 100644
index 00000000000..70d61d087e3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_1.test
@@ -0,0 +1,309 @@
+--source ../include/quick_mode_1_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_2.test b/storage/spider/mysql-test/spider/t/quick_mode_2.test
new file mode 100644
index 00000000000..71e7b0338dc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_2.test
@@ -0,0 +1,309 @@
+--source ../include/quick_mode_2_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_2_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_3.test b/storage/spider/mysql-test/spider/t/quick_mode_3.test
new file mode 100644
index 00000000000..000edd4fdff
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_3.test
@@ -0,0 +1,309 @@
+--source ../include/quick_mode_3_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_3_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/slave_trx_isolation.test b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test
new file mode 100644
index 00000000000..d1dea8546b9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test
@@ -0,0 +1,166 @@
+--source ../include/slave_trx_isolation_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+--connection master_1
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS tbl_a;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+ eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ --enable_query_log
+ --connection master_1
+}
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/slave_trx_isolation_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/scripts/install_spider.sql b/storage/spider/scripts/install_spider.sql
index 9b2e5c480ab..904288f4237 100644
--- a/storage/spider/scripts/install_spider.sql
+++ b/storage/spider/scripts/install_spider.sql
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2016 Kentoku Shiba
+# Copyright (C) 2010-2018 Kentoku Shiba
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -167,8 +167,8 @@ drop procedure if exists mysql.spider_fix_system_tables;
delimiter //
create procedure mysql.spider_fix_one_table
(tab_name char(255) charset utf8 collate utf8_bin,
- test_col_name char(255) charset utf8 collate utf8_bin,
- _sql text charset utf8 collate utf8_bin)
+ test_col_name char(255) charset utf8 collate utf8_bin,
+ _sql text charset utf8 collate utf8_bin)
begin
set @col_exists := 0;
select 1 into @col_exists from INFORMATION_SCHEMA.COLUMNS
@@ -184,6 +184,13 @@ end;//
create procedure mysql.spider_fix_system_tables()
begin
+ select substring_index(substring_index(version(), '-', 2), '-', -1)
+ into @server_name;
+ select substring_index(version(), '.', 1)
+ into @server_major_version;
+ select substring_index(substring_index(version(), '.', 2), '.', -1)
+ into @server_minor_version;
+
-- Fix for 0.5
call mysql.spider_fix_one_table('spider_tables', 'server',
'alter table mysql.spider_tables
@@ -402,68 +409,78 @@ begin
end if;
-- Fix for MariaDB 10.4: Crash-Safe system tables
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_link_failed_log';
+ if @server_name = 'MariaDB' and
+ (
+ @server_major_version > 10 or
+ (
+ @server_major_version = 10 and
+ @server_minor_version >= 4
+ )
+ )
+ then
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_link_failed_log';
if @engine_name != 'Aria' then
alter table mysql.spider_link_failed_log
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_link_mon_servers';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_link_mon_servers';
if @engine_name != 'Aria' then
alter table mysql.spider_link_mon_servers
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_table_crd';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_table_crd';
if @engine_name != 'Aria' then
alter table mysql.spider_table_crd
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_table_position_for_recovery';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_table_position_for_recovery';
if @engine_name != 'Aria' then
alter table mysql.spider_table_position_for_recovery
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_table_sts';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_table_sts';
if @engine_name != 'Aria' then
alter table mysql.spider_table_sts
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_tables';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_tables';
if @engine_name != 'Aria' then
alter table mysql.spider_tables
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_xa';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_xa';
if @engine_name != 'Aria' then
alter table mysql.spider_xa
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_xa_failed_log';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_xa_failed_log';
if @engine_name != 'Aria' then
alter table mysql.spider_xa_failed_log
engine=Aria transactional=1;
- end if;
- select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
- where TABLE_SCHEMA = 'mysql'
- AND TABLE_NAME = 'spider_xa_member';
+ end if;
+ select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
+ where TABLE_SCHEMA = 'mysql'
+ AND TABLE_NAME = 'spider_xa_member';
if @engine_name != 'Aria' then
alter table mysql.spider_xa_member
engine=Aria transactional=1;
+ end if;
end if;
end;//
delimiter ;
diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc
index 148ad43d337..ba59acd64bc 100644
--- a/storage/spider/spd_conn.cc
+++ b/storage/spider/spd_conn.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1439,9 +1439,10 @@ void spider_conn_queue_time_zone(
DBUG_VOID_RETURN;
}
-void spider_conn_queue_UTC_time_zone(SPIDER_CONN *conn)
-{
- DBUG_ENTER("spider_conn_queue_time_zone");
+void spider_conn_queue_UTC_time_zone(
+ SPIDER_CONN *conn
+) {
+ DBUG_ENTER("spider_conn_queue_UTC_time_zone");
DBUG_PRINT("info", ("spider conn=%p", conn));
spider_conn_queue_time_zone(conn, UTC);
DBUG_VOID_RETURN;
@@ -2086,6 +2087,7 @@ void spider_bg_all_conn_break(
#endif
if (spider->quick_targets[roop_count])
{
+ spider_db_free_one_quick_result((SPIDER_RESULT *) result_list->current);
DBUG_ASSERT(spider->quick_targets[roop_count] == conn->quick_target);
DBUG_PRINT("info", ("spider conn[%p]->quick_target=NULL", conn));
conn->quick_target = NULL;
diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h
index 998658c5353..0a9f99a1853 100644
--- a/storage/spider/spd_conn.h
+++ b/storage/spider/spd_conn.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,8 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "tztime.h"
-
#define SPIDER_LOCK_MODE_NO_LOCK 0
#define SPIDER_LOCK_MODE_SHARED 1
#define SPIDER_LOCK_MODE_EXCLUSIVE 2
diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc
index 82c0c490147..8dd9d968b99 100644
--- a/storage/spider/spd_copy_tables.cc
+++ b/storage/spider/spd_copy_tables.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2017 Kentoku Shiba
+/* Copyright (C) 2009-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -53,10 +53,10 @@ int spider_udf_set_copy_tables_param_default(
if (!copy_tables->database)
{
DBUG_PRINT("info",("spider create default database"));
- copy_tables->database_length = copy_tables->trx->thd->db.length;
+ copy_tables->database_length = SPIDER_THD_db_length(copy_tables->trx->thd);
if (
!(copy_tables->database = spider_create_string(
- copy_tables->trx->thd->db.str,
+ SPIDER_THD_db_str(copy_tables->trx->thd),
copy_tables->database_length))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -90,8 +90,7 @@ int spider_udf_set_copy_tables_param_default(
start_ptr, TRUE, &param_string_parse))) \
copy_tables->SPIDER_PARAM_STR_LEN(param_name) = \
strlen(copy_tables->param_name); \
- else \
- { \
+ else { \
error_num = param_string_parse.print_param_error(); \
goto error; \
} \
@@ -968,19 +967,25 @@ long long spider_copy_tables_body(
goto error;
table_list = &copy_tables->spider_table_list;
- table_list->db.str = copy_tables->spider_db_name;
- table_list->db.length = copy_tables->spider_db_name_length;
- table_list->alias.str = table_list->table_name.str =
+ SPIDER_TABLE_LIST_db_str(table_list) = copy_tables->spider_db_name;
+ SPIDER_TABLE_LIST_db_length(table_list) = copy_tables->spider_db_name_length;
+ SPIDER_TABLE_LIST_alias_str(table_list) =
+ SPIDER_TABLE_LIST_table_name_str(table_list) =
copy_tables->spider_real_table_name;
- table_list->table_name.length = copy_tables->spider_real_table_name_length;
- table_list->alias.length= table_list->table_name.length;
+ SPIDER_TABLE_LIST_table_name_length(table_list) =
+ copy_tables->spider_real_table_name_length;
+#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
+ SPIDER_TABLE_LIST_alias_length(table_list) =
+ SPIDER_TABLE_LIST_table_name_length(table_list);
+#endif
table_list->lock_type = TL_READ;
- DBUG_PRINT("info",("spider db=%s", table_list->db.str));
- DBUG_PRINT("info",("spider db_length=%zd", table_list->db.length));
- DBUG_PRINT("info",("spider table_name=%s", table_list->table_name.str));
+ DBUG_PRINT("info",("spider db=%s", SPIDER_TABLE_LIST_db_str(table_list)));
+ DBUG_PRINT("info",("spider db_length=%zd", SPIDER_TABLE_LIST_db_length(table_list)));
+ DBUG_PRINT("info",("spider table_name=%s",
+ SPIDER_TABLE_LIST_table_name_str(table_list)));
DBUG_PRINT("info",("spider table_name_length=%zd",
- table_list->table_name.length));
+ SPIDER_TABLE_LIST_table_name_length(table_list)));
reprepare_observer_backup = thd->m_reprepare_observer;
thd->m_reprepare_observer = NULL;
copy_tables->trx->trx_start = TRUE;
@@ -991,8 +996,8 @@ long long spider_copy_tables_body(
#else
table_list->mdl_request.init(
MDL_key::TABLE,
- table_list->db.str,
- table_list->table_name.str,
+ SPIDER_TABLE_LIST_db_str(table_list),
+ SPIDER_TABLE_LIST_table_name_str(table_list),
MDL_SHARED_READ,
MDL_TRANSACTION
);
@@ -1004,8 +1009,9 @@ long long spider_copy_tables_body(
copy_tables->trx->updated_in_this_trx = FALSE;
DBUG_PRINT("info",("spider trx->updated_in_this_trx=FALSE"));
my_printf_error(ER_SPIDER_UDF_CANT_OPEN_TABLE_NUM,
- ER_SPIDER_UDF_CANT_OPEN_TABLE_STR, MYF(0), table_list->db,
- table_list->table_name);
+ ER_SPIDER_UDF_CANT_OPEN_TABLE_STR, MYF(0),
+ SPIDER_TABLE_LIST_db_str(table_list),
+ SPIDER_TABLE_LIST_table_name_str(table_list));
goto error;
}
thd->m_reprepare_observer = reprepare_observer_backup;
@@ -1019,7 +1025,8 @@ long long spider_copy_tables_body(
{
my_printf_error(ER_SPIDER_UDF_COPY_TABLE_NEED_PK_NUM,
ER_SPIDER_UDF_COPY_TABLE_NEED_PK_STR, MYF(0),
- table_list->db, table_list->table_name);
+ SPIDER_TABLE_LIST_db_str(table_list),
+ SPIDER_TABLE_LIST_table_name_str(table_list));
goto error;
}
key_info = &table->key_info[table_share->primary_key];
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 7ac1b050d76..c2cd4beccdb 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -77,7 +77,7 @@ pthread_mutex_t spider_open_conn_mutex;
const char spider_dig_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/* UTC time zone for timestamp columns */
-extern Time_zone *UTC;
+Time_zone *UTC = 0;
int spider_db_connect(
const SPIDER_SHARE *share,
@@ -1387,12 +1387,34 @@ int spider_db_unlock_tables(
int spider_db_append_name_with_quote_str(
spider_string *str,
- char *name,
+ const char *name,
uint dbton_id
) {
- int error_num, length = strlen(name);
- char *name_end, head_code;
DBUG_ENTER("spider_db_append_name_with_quote_str");
+ DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
+ str, name, strlen(name), dbton_id));
+}
+
+int spider_db_append_name_with_quote_str(
+ spider_string *str,
+ LEX_CSTRING &name,
+ uint dbton_id
+) {
+ DBUG_ENTER("spider_db_append_name_with_quote_str");
+ DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
+ str, name.str, name.length, dbton_id));
+}
+
+int spider_db_append_name_with_quote_str_internal(
+ spider_string *str,
+ const char *name,
+ int length,
+ uint dbton_id
+) {
+ int error_num;
+ const char *name_end;
+ char head_code;
+ DBUG_ENTER("spider_db_append_name_with_quote_str_internal");
for (name_end = name + length; name < name_end; name += length)
{
head_code = *name;
@@ -1695,8 +1717,13 @@ int spider_db_append_key_where_internal(
if (sql_kind == SPIDER_SQL_KIND_HANDLER)
{
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
const char *key_name = key_info->name.str;
- key_name_length = key_info->name.length;
+ key_name_length = key_info->name.length;
+#else
+ const char *key_name = key_info->name;
+ key_name_length = strlen(key_name);
+#endif
if (str->reserve(SPIDER_SQL_READ_LEN +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + key_name_length))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -2876,7 +2903,7 @@ int spider_db_fetch_row(
THD *thd = field->table->in_use;
Time_zone *saved_time_zone = thd->variables.time_zone;
DBUG_ENTER("spider_db_fetch_row");
- DBUG_PRINT("info", ("spider field_name %s", field->field_name.str));
+ DBUG_PRINT("info", ("spider field_name %s", SPIDER_field_name_str(field)));
DBUG_PRINT("info", ("spider fieldcharset %s", field->charset()->csname));
thd->variables.time_zone = UTC;
@@ -3013,7 +3040,7 @@ int spider_db_fetch_table(
dbug_tmp_use_all_columns(table, table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s",
- (*field)->field_name.str));
+ SPIDER_field_name_str(*field)));
if ((error_num =
spider_db_fetch_row(share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
@@ -3184,7 +3211,8 @@ int spider_db_fetch_key(
my_bitmap_map *tmp_map =
dbug_tmp_use_all_columns(table, table->write_set);
#endif
- DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name.str));
+ DBUG_PRINT("info", ("spider bitmap is set %s",
+ SPIDER_field_name_str(field)));
if ((error_num =
spider_db_fetch_row(share, field, row, ptr_diff)))
DBUG_RETURN(error_num);
@@ -3303,7 +3331,7 @@ int spider_db_fetch_minimum_columns(
dbug_tmp_use_all_columns(table, table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s",
- (*field)->field_name.str));
+ SPIDER_field_name_str(*field)));
if ((error_num = spider_db_fetch_row(share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
@@ -3445,6 +3473,22 @@ void spider_db_free_one_result(
DBUG_VOID_RETURN;
}
+void spider_db_free_one_quick_result(
+ SPIDER_RESULT *result
+) {
+ DBUG_ENTER("spider_db_free_one_quick_result");
+ if (result && result->result)
+ {
+ result->result->free_result();
+ if (!result->result_tmp_tbl)
+ {
+ delete result->result;
+ result->result = NULL;
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+
int spider_db_free_result(
ha_spider *spider,
bool final
@@ -3971,11 +4015,22 @@ int spider_db_store_result(
SPIDER_DB_ROW *tmp_row;
uint field_count = current->result->num_fields();
SPIDER_POSITION *position;
- longlong page_size =
- !result_list->quick_page_size ||
- result_list->limit_num < result_list->quick_page_size ?
- result_list->limit_num : result_list->quick_page_size;
+ longlong page_size;
int roop_count = 0;
+ if (!result_list->quick_page_size)
+ {
+ if (result_list->quick_mode == 3)
+ {
+ page_size = 0;
+ } else {
+ result_list->quick_page_size = result_list->limit_num;
+ page_size = result_list->limit_num;
+ }
+ } else {
+ page_size =
+ result_list->limit_num < result_list->quick_page_size ?
+ result_list->limit_num : result_list->quick_page_size;
+ }
current->field_count = field_count;
if (!(position = (SPIDER_POSITION *)
spider_bulk_malloc(spider_current_trx, 7, MYF(MY_WME | MY_ZEROFILL),
@@ -3987,22 +4042,56 @@ int spider_db_store_result(
current->pos_page_size = (int) page_size;
current->first_position = position;
current->tmp_tbl_row = tmp_row;
- do {
- if (!(position->row = row->clone()))
+ if (result_list->quick_mode == 3)
+ {
+ while (page_size > roop_count && row)
{
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ if (result_list->quick_page_byte < row->get_byte_size())
+ {
+ current->pos_page_size = roop_count;
+ page_size = roop_count;
+ result_list->quick_page_size = roop_count;
+ result_list->quick_page_byte = 0;
+ break;
+ } else {
+ result_list->quick_page_byte -= row->get_byte_size();
+ }
+ if (!(position->row = row->clone()))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ position++;
+ roop_count++;
+ row = current->result->fetch_row();
}
- position++;
- roop_count++;
- } while (
- page_size > roop_count &&
- (row = current->result->fetch_row())
- );
+ } else {
+ do {
+ if (!(position->row = row->clone()))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ position++;
+ roop_count++;
+ if (result_list->quick_page_byte < row->get_byte_size())
+ {
+ current->pos_page_size = roop_count;
+ page_size = roop_count;
+ result_list->quick_page_size = roop_count;
+ result_list->quick_page_byte = 0;
+ break;
+ } else {
+ result_list->quick_page_byte -= row->get_byte_size();
+ }
+ } while (
+ page_size > roop_count &&
+ (row = current->result->fetch_row())
+ );
+ }
if (
result_list->quick_mode == 3 &&
page_size == roop_count &&
result_list->limit_num > roop_count &&
- (row = current->result->fetch_row())
+ row
) {
THD *thd = current_thd;
char buf[MAX_FIELD_WIDTH];
@@ -4011,9 +4100,18 @@ int spider_db_store_result(
DBUG_PRINT("info",("spider store result to temporary table"));
DBUG_ASSERT(!current->result_tmp_tbl);
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+ LEX_CSTRING field_name1 = {STRING_WITH_LEN("a")};
+ LEX_CSTRING field_name2 = {STRING_WITH_LEN("b")};
+ LEX_CSTRING field_name3 = {STRING_WITH_LEN("c")};
+ if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result(
+ thd, table, &current->result_tmp_tbl_prm, &field_name1, &field_name2,
+ &field_name3, &my_charset_bin)))
+#else
if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result(
thd, table, &current->result_tmp_tbl_prm, "a", "b", "c",
&my_charset_bin)))
+#endif
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -4039,7 +4137,11 @@ int spider_db_store_result(
result_list->record_num += roop_count;
if (
result_list->internal_limit <= result_list->record_num ||
- page_size > roop_count
+ page_size > roop_count ||
+ (
+ result_list->quick_mode == 3 &&
+ result_list->limit_num > roop_count
+ )
) {
DBUG_PRINT("info",("spider set finish_flg point 4"));
DBUG_PRINT("info",("spider current->finish_flg = TRUE"));
@@ -5324,7 +5426,7 @@ int spider_db_seek_tmp_table(
dbug_tmp_use_all_columns(table, table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s",
- (*field)->field_name.str));
+ SPIDER_field_name_str(*field)));
if ((error_num =
spider_db_fetch_row(spider->share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
@@ -5411,7 +5513,8 @@ int spider_db_seek_tmp_key(
my_bitmap_map *tmp_map =
dbug_tmp_use_all_columns(table, table->write_set);
#endif
- DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name.str));
+ DBUG_PRINT("info", ("spider bitmap is set %s",
+ SPIDER_field_name_str(field)));
if ((error_num =
spider_db_fetch_row(spider->share, field, row, ptr_diff)))
DBUG_RETURN(error_num);
@@ -5502,7 +5605,7 @@ int spider_db_seek_tmp_minimum_columns(
dbug_tmp_use_all_columns(table, table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s",
- (*field)->field_name.str));
+ SPIDER_field_name_str(*field)));
if ((error_num =
spider_db_fetch_row(spider->share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
@@ -5514,7 +5617,7 @@ int spider_db_seek_tmp_minimum_columns(
else if (bitmap_is_set(table->read_set, (*field)->field_index))
{
DBUG_PRINT("info", ("spider bitmap is cleared %s",
- (*field)->field_name.str));
+ SPIDER_field_name_str(*field)));
bitmap_clear_bit(table->read_set, (*field)->field_index);
}
}
@@ -8478,11 +8581,14 @@ int spider_db_flush_logs(
contains only one field; NULL otherwise.
*/
-Field *spider_db_find_field_in_item_list(Item **item_list, uint item_count,
- uint start_item, spider_string *str,
- const char *func_name,
- int func_name_length)
-{
+Field *spider_db_find_field_in_item_list(
+ Item **item_list,
+ uint item_count,
+ uint start_item,
+ spider_string *str,
+ const char *func_name,
+ int func_name_length
+) {
uint item_num;
Item *item;
Field *field = NULL;
@@ -8530,11 +8636,17 @@ Field *spider_db_find_field_in_item_list(Item **item_list, uint item_count,
@return Error code.
*/
-int spider_db_print_item_type(Item *item, Field *field, ha_spider *spider,
- spider_string *str, const char *alias,
- uint alias_length, uint dbton_id,
- bool use_fields, spider_fields *fields)
-{
+int spider_db_print_item_type(
+ Item *item,
+ Field *field,
+ ha_spider *spider,
+ spider_string *str,
+ const char *alias,
+ uint alias_length,
+ uint dbton_id,
+ bool use_fields,
+ spider_fields *fields
+) {
DBUG_ENTER("spider_db_print_item_type");
DBUG_PRINT("info",("spider COND type=%d", item->type()));
@@ -8560,65 +8672,78 @@ int spider_db_print_item_type(Item *item, Field *field, ha_spider *spider,
case Item::ROW_ITEM:
DBUG_RETURN(spider_db_open_item_row((Item_row *) item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
+#ifdef SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
+ case Item::CONST_ITEM:
+ {
+ switch (item->cmp_type()) {
+ case TIME_RESULT:
+ case STRING_RESULT:
+ DBUG_RETURN(spider_db_open_item_string(item, field, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields));
+ case INT_RESULT:
+ case REAL_RESULT:
+ case DECIMAL_RESULT:
+ DBUG_RETURN(spider_db_open_item_int(item, field, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields));
+ default:
+ DBUG_ASSERT(FALSE);
+ DBUG_RETURN(spider_db_print_item_type_default(item, spider, str));
+ }
+ }
+#else
+ case Item::STRING_ITEM:
+ DBUG_RETURN(spider_db_open_item_string(item, field, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields));
+ case Item::INT_ITEM:
+ case Item::REAL_ITEM:
+ case Item::DECIMAL_ITEM:
+ DBUG_RETURN(spider_db_open_item_int(item, field, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields));
+#endif
case Item::CACHE_ITEM:
- DBUG_RETURN(spider_db_open_item_cache((Item_cache *) item, field,
- spider, str, alias, alias_length,
- dbton_id, use_fields, fields));
+ DBUG_RETURN(spider_db_open_item_cache((Item_cache *) item, field, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields));
case Item::INSERT_VALUE_ITEM:
DBUG_RETURN(spider_db_open_item_insert_value((Item_insert_value *) item,
- field, spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields));
+ field, spider, str, alias, alias_length, dbton_id, use_fields, fields));
case Item::SUBSELECT_ITEM:
case Item::TRIGGER_FIELD_ITEM:
#ifdef SPIDER_HAS_EXPR_CACHE_ITEM
case Item::EXPR_CACHE_ITEM:
#endif
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- case Item::CONST_ITEM:
- {
- switch (item->cmp_type())
- {
- case STRING_RESULT:
- case TIME_RESULT:
- DBUG_RETURN(spider_db_open_item_string(item, field, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
- case INT_RESULT:
- case REAL_RESULT:
- case DECIMAL_RESULT:
- DBUG_RETURN(spider_db_open_item_int(item, field, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
- default:
- DBUG_ASSERT(FALSE);
- /* Fall through */
- }
- }
default:
- THD *thd = spider->trx->thd;
- SPIDER_SHARE *share = spider->share;
- if (spider_param_skip_default_condition(thd,
- share->skip_default_condition))
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- if (str)
- {
- if (spider->share->access_charset->cset == system_charset_info->cset)
- {
+ DBUG_RETURN(spider_db_print_item_type_default(item, spider, str));
+ }
+
+ DBUG_RETURN(0);
+}
+
+int spider_db_print_item_type_default(
+ Item *item,
+ ha_spider *spider,
+ spider_string *str
+) {
+ DBUG_ENTER("spider_db_print_item_type_default");
+ THD *thd = spider->trx->thd;
+ SPIDER_SHARE *share = spider->share;
+ if (spider_param_skip_default_condition(thd,
+ share->skip_default_condition))
+ DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
+ if (str)
+ {
+ if (spider->share->access_charset->cset == system_charset_info->cset)
+ {
#if MYSQL_VERSION_ID < 50500
- item->print(str->get_str(), QT_IS);
+ item->print(str->get_str(), QT_IS);
#else
- item->print(str->get_str(), QT_TO_SYSTEM_CHARSET);
+ item->print(str->get_str(), QT_TO_SYSTEM_CHARSET);
#endif
- } else {
- item->print(str->get_str(), QT_ORDINARY);
- }
- str->mem_calc();
- }
- break;
+ } else {
+ item->print(str->get_str(), QT_ORDINARY);
+ }
+ str->mem_calc();
}
-
DBUG_RETURN(0);
}
@@ -8651,8 +8776,7 @@ restart_first:
if (str)
restart_pos = str->length();
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
{
if (
str &&
@@ -8686,8 +8810,7 @@ restart_first:
}
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
{
if (
str &&
@@ -8796,7 +8919,15 @@ int spider_db_open_item_ident(
}
if (str)
{
- field_name_length = item_ident->field_name.length;
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
+ if (item_ident->field_name.str)
+ field_name_length = item_ident->field_name.length;
+#else
+ if (item_ident->field_name)
+ field_name_length = strlen(item_ident->field_name);
+#endif
+ else
+ field_name_length = 0;
if (share->access_charset->cset == system_charset_info->cset)
{
if (str->reserve(alias_length +
@@ -8805,8 +8936,13 @@ int spider_db_open_item_ident(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
str->q_append(alias, alias_length);
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
if ((error_num = spider_dbton[dbton_id].db_util->
append_name(str, item_ident->field_name.str, field_name_length)))
+#else
+ if ((error_num = spider_dbton[dbton_id].db_util->
+ append_name(str, item_ident->field_name, field_name_length)))
+#endif
{
DBUG_RETURN(error_num);
}
@@ -8814,9 +8950,15 @@ int spider_db_open_item_ident(
if (str->reserve(alias_length))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(alias, alias_length);
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
if ((error_num = spider_dbton[dbton_id].db_util->
append_name_with_charset(str, item_ident->field_name.str,
field_name_length, system_charset_info)))
+#else
+ if ((error_num = spider_dbton[dbton_id].db_util->
+ append_name_with_charset(str, item_ident->field_name,
+ field_name_length, system_charset_info)))
+#endif
{
DBUG_RETURN(error_num);
}
@@ -8901,31 +9043,50 @@ int spider_db_open_item_ref(
DBUG_ENTER("spider_db_open_item_ref");
if (item_ref->ref)
{
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
if (
(*(item_ref->ref))->type() != Item::CACHE_ITEM &&
item_ref->ref_type() != Item_ref::VIEW_REF &&
!item_ref->table_name &&
item_ref->name.str &&
item_ref->alias_name_used
- ) {
+ )
+#else
+ if (
+ (*(item_ref->ref))->type() != Item::CACHE_ITEM &&
+ item_ref->ref_type() != Item_ref::VIEW_REF &&
+ !item_ref->table_name &&
+ item_ref->name &&
+ item_ref->alias_name_used
+ )
+#endif
+ {
if (str)
{
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
uint length = item_ref->name.length;
+#else
+ uint length = strlen(item_ref->name);
+#endif
if (str->reserve(length + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2))
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
if ((error_num = spider_dbton[dbton_id].db_util->
append_name(str, item_ref->name.str, length)))
+#else
+ if ((error_num = spider_dbton[dbton_id].db_util->
+ append_name(str, item_ref->name, length)))
+#endif
{
DBUG_RETURN(error_num);
}
}
DBUG_RETURN(0);
}
- DBUG_RETURN(spider_db_print_item_type(*(item_ref->ref), NULL, spider,
- str, alias, alias_length, dbton_id,
- use_fields, fields));
+ DBUG_RETURN(spider_db_print_item_type(*(item_ref->ref), NULL, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields));
}
DBUG_RETURN(spider_db_open_item_ident((Item_ident *) item_ref, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
@@ -8955,8 +9116,7 @@ int spider_db_open_item_row(
{
item = item_row->element_index(roop_count);
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -8967,8 +9127,7 @@ int spider_db_open_item_row(
}
item = item_row->element_index(roop_count);
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -8997,12 +9156,17 @@ int spider_db_open_item_row(
@return Error code.
*/
-int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
- spider_string *str,
- const char *alias, uint alias_length,
- uint dbton_id,
- bool use_fields, spider_fields *fields)
-{
+int spider_db_open_item_string(
+ Item *item,
+ Field *field,
+ ha_spider *spider,
+ spider_string *str,
+ const char *alias,
+ uint alias_length,
+ uint dbton_id,
+ bool use_fields,
+ spider_fields *fields
+) {
int error_num = 0;
DBUG_ENTER("spider_db_open_item_string");
@@ -9012,10 +9176,10 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
TABLE *table;
my_bitmap_map *saved_map;
Time_zone *saved_time_zone;
+ String str_value;
char tmp_buf[MAX_FIELD_WIDTH];
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
String *tmp_str2;
- String str_value;
tmp_str.init_calc_mem(126);
if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
@@ -9023,16 +9187,17 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
if (str->reserve(SPIDER_SQL_NULL_LEN))
{
error_num = HA_ERR_OUT_OF_MEM;
- goto error;
+ goto end;
}
str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
- }
- else
- {
- if (field && field->type() == FIELD_TYPE_TIMESTAMP)
- {
+ } else {
+ if (
+ field &&
+ field->type() == FIELD_TYPE_TIMESTAMP &&
+ field->table->in_use->variables.time_zone != UTC
+ ) {
/*
- Store the string value in the field. This is necessary
+ Store the string value in the field. This is necessary
when the statement contains more than one value for the
same field.
*/
@@ -9049,15 +9214,14 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
if (!tmp_str2)
{
error_num = HA_ERR_OUT_OF_MEM;
- goto error;
+ goto end;
}
}
-
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 +
- tmp_str2->length() * 2))
+ tmp_str2->length() * 2))
{
error_num = HA_ERR_OUT_OF_MEM;
- goto error;
+ goto end;
}
if (!thd)
tmp_str.mem_calc();
@@ -9066,12 +9230,12 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN))
{
error_num = HA_ERR_OUT_OF_MEM;
- goto error;
+ goto end;
}
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
}
-error:
+end:
if (thd)
{
thd->variables.time_zone = saved_time_zone;
@@ -9099,12 +9263,17 @@ error:
@return Error code.
*/
-int spider_db_open_item_int(Item *item, Field *field, ha_spider *spider,
- spider_string *str,
- const char *alias, uint alias_length,
- uint dbton_id,
- bool use_fields, spider_fields *fields)
-{
+int spider_db_open_item_int(
+ Item *item,
+ Field *field,
+ ha_spider *spider,
+ spider_string *str,
+ const char *alias,
+ uint alias_length,
+ uint dbton_id,
+ bool use_fields,
+ spider_fields *fields
+) {
int error_num = 0;
DBUG_ENTER("spider_db_open_item_int");
@@ -9114,21 +9283,25 @@ int spider_db_open_item_int(Item *item, Field *field, ha_spider *spider,
TABLE *table;
my_bitmap_map *saved_map;
Time_zone *saved_time_zone;
+ String str_value;
+ bool print_quoted_string;
char tmp_buf[MAX_FIELD_WIDTH];
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
- String str_value;
String *tmp_str2;
tmp_str.init_calc_mem(127);
if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
{
error_num = HA_ERR_OUT_OF_MEM;
- goto error;
+ goto end;
}
tmp_str.mem_calc();
- if (field && field->type() == FIELD_TYPE_TIMESTAMP)
- {
+ if (
+ field &&
+ field->type() == FIELD_TYPE_TIMESTAMP &&
+ field->table->in_use->variables.time_zone != UTC
+ ) {
/*
Store the int value in the field. This is necessary
when the statement contains more than one value for the
@@ -9140,32 +9313,45 @@ int spider_db_open_item_int(Item *item, Field *field, ha_spider *spider,
item->save_in_field(field, FALSE);
saved_time_zone = thd->variables.time_zone;
thd->variables.time_zone = UTC;
+ print_quoted_string = TRUE;
+ } else {
+#ifdef SPIDER_ITEM_HAS_CMP_TYPE
+ DBUG_PRINT("info",("spider cmp_type=%u", item->cmp_type()));
+ if (item->cmp_type() == TIME_RESULT)
+ print_quoted_string = TRUE;
+ else
+#endif
+ print_quoted_string = FALSE;
}
- if (thd)
+ if (print_quoted_string)
{
- /* Retrieve the stored value converted to UTC */
- tmp_str2 = field->val_str(&str_value);
-
- if (!tmp_str2)
+ if (thd)
{
- error_num = HA_ERR_OUT_OF_MEM;
- goto error;
+ /* Retrieve the stored value converted to UTC */
+ tmp_str2 = field->val_str(&str_value);
+
+ if (!tmp_str2)
+ {
+ error_num = HA_ERR_OUT_OF_MEM;
+ goto end;
+ }
}
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + tmp_str2->length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ {
+ error_num = HA_ERR_OUT_OF_MEM;
+ goto end;
+ }
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
str->append(*tmp_str2);
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- }
- else
- {
+ } else {
if (str->append(*tmp_str2))
error_num = HA_ERR_OUT_OF_MEM;
}
-error:
+end:
if (thd)
{
thd->variables.time_zone = saved_time_zone;
@@ -9193,12 +9379,17 @@ error:
@return Error code.
*/
-int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
- ha_spider *spider, spider_string *str,
- const char *alias, uint alias_length,
- uint dbton_id,
- bool use_fields, spider_fields *fields)
-{
+int spider_db_open_item_cache(
+ Item_cache *item_cache,
+ Field *field,
+ ha_spider *spider,
+ spider_string *str,
+ const char *alias,
+ uint alias_length,
+ uint dbton_id,
+ bool use_fields,
+ spider_fields *fields
+) {
DBUG_ENTER("spider_db_open_item_cache");
if (!item_cache->const_item())
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
@@ -9208,8 +9399,7 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
{
case STRING_RESULT:
DBUG_RETURN(spider_db_open_item_string(item_cache, field, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
case ROW_RESULT:
{
int error_num;
@@ -9224,11 +9414,9 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
for (roop_count = 0; roop_count < item_count; ++roop_count)
{
if ((error_num = spider_db_open_item_cache(
- (Item_cache *)
- item_cache_row->element_index(roop_count),
- NULL, spider, str, alias, alias_length,
- dbton_id, use_fields, fields)))
- {
+ (Item_cache *) item_cache_row->element_index(roop_count), NULL,
+ spider, str, alias, alias_length, dbton_id, use_fields, fields
+ ))) {
DBUG_RETURN(error_num);
}
if (str)
@@ -9239,11 +9427,9 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
}
}
if ((error_num = spider_db_open_item_cache(
- (Item_cache *)
- item_cache_row->element_index(roop_count),
- NULL, spider, str, alias, alias_length,
- dbton_id, use_fields, fields)))
- {
+ (Item_cache *) item_cache_row->element_index(roop_count), NULL,
+ spider, str, alias, alias_length, dbton_id, use_fields, fields
+ ))) {
DBUG_RETURN(error_num);
}
if (str)
@@ -9261,10 +9447,8 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
default:
break;
}
-
DBUG_RETURN(spider_db_open_item_int(item_cache, field, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
}
/**
@@ -9283,13 +9467,17 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
@return Error code.
*/
-int spider_db_open_item_insert_value(Item_insert_value *item_insert_value,
- Field *field, ha_spider *spider,
- spider_string *str,
- const char *alias, uint alias_length,
- uint dbton_id,
- bool use_fields, spider_fields *fields)
-{
+int spider_db_open_item_insert_value(
+ Item_insert_value *item_insert_value,
+ Field *field,
+ ha_spider *spider,
+ spider_string *str,
+ const char *alias,
+ uint alias_length,
+ uint dbton_id,
+ bool use_fields,
+ spider_fields *fields
+) {
int error_num;
DBUG_ENTER("spider_db_open_item_insert_value");
@@ -9303,9 +9491,7 @@ int spider_db_open_item_insert_value(Item_insert_value *item_insert_value,
str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
}
if ((error_num = spider_db_print_item_type(item_insert_value->arg, field,
- spider, str, alias,
- alias_length, dbton_id,
- use_fields, fields)))
+ spider, str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -9370,10 +9556,9 @@ int spider_db_append_update_columns(
while ((field = fi++))
{
value = vi++;
- if ((error_num = spider_db_print_item_type((Item *) field, NULL, spider,
- str, alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(
+ (Item *) field, NULL, spider, str, alias, alias_length, dbton_id,
+ use_fields, fields)))
{
if (
error_num == ER_SPIDER_COND_SKIP_NUM &&
@@ -9391,12 +9576,9 @@ int spider_db_append_update_columns(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
}
- if ((error_num = spider_db_print_item_type((Item *) value,
- ((Item_field *) field)->field,
- spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(
+ (Item *) value, ((Item_field *) field)->field, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -10594,8 +10776,13 @@ int spider_db_udf_copy_key_row(
) {
int error_num;
DBUG_ENTER("spider_db_udf_copy_key_row");
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
if ((error_num = spider_db_append_name_with_quote_str(str,
(char *) field->field_name.str, dbton_id)))
+#else
+ if ((error_num = spider_db_append_name_with_quote_str(str,
+ (char *) field->field_name, dbton_id)))
+#endif
DBUG_RETURN(error_num);
if (str->reserve(joint_length + *length + SPIDER_SQL_AND_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h
index 879ab3540c1..bf09d672685 100644
--- a/storage/spider/spd_db_conn.h
+++ b/storage/spider/spd_db_conn.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -412,7 +412,20 @@ int spider_db_unlock_tables(
int spider_db_append_name_with_quote_str(
spider_string *str,
- char *name,
+ const char *name,
+ uint dbton_id
+);
+
+int spider_db_append_name_with_quote_str(
+ spider_string *str,
+ LEX_CSTRING &name,
+ uint dbton_id
+);
+
+int spider_db_append_name_with_quote_str_internal(
+ spider_string *str,
+ const char *name,
+ int length,
uint dbton_id
);
@@ -566,6 +579,10 @@ void spider_db_free_one_result(
SPIDER_RESULT *result
);
+void spider_db_free_one_quick_result(
+ SPIDER_RESULT *result
+);
+
int spider_db_free_result(
ha_spider *spider,
bool final
@@ -859,6 +876,12 @@ int spider_db_print_item_type(
spider_fields *fields
);
+int spider_db_print_item_type_default(
+ Item *item,
+ ha_spider *spider,
+ spider_string *str
+);
+
int spider_db_open_item_cond(
Item_cond *item_cond,
ha_spider *spider,
diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc
index dc4b9dd25ec..4aebc7811b4 100644
--- a/storage/spider/spd_db_handlersocket.cc
+++ b/storage/spider/spd_db_handlersocket.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Kentoku Shiba
+/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -359,7 +359,7 @@ spider_string *spider_db_hs_str_buffer::add(
spider_db_handlersocket_row::spider_db_handlersocket_row() :
spider_db_row(spider_dbton_handlersocket.dbton_id),
- hs_row(NULL), field_count(0), cloned(FALSE)
+ hs_row(NULL), field_count(0), row_size(0), cloned(FALSE)
{
DBUG_ENTER("spider_db_handlersocket_row::spider_db_handlersocket_row");
DBUG_PRINT("info",("spider this=%p", this));
@@ -497,18 +497,13 @@ SPIDER_DB_ROW *spider_db_handlersocket_row::clone()
{
spider_db_handlersocket_row *clone_row;
char *tmp_char;
- uint row_size, i;
+ uint i;
DBUG_ENTER("spider_db_handlersocket_row::clone");
DBUG_PRINT("info",("spider this=%p", this));
if (!(clone_row = new spider_db_handlersocket_row()))
{
DBUG_RETURN(NULL);
}
- row_size = 0;
- for (i = 0; i < field_count; i++)
- {
- row_size += hs_row_first[i].size();
- }
if (!spider_bulk_malloc(spider_current_trx, 169, MYF(MY_WME),
&clone_row->hs_row, sizeof(SPIDER_HS_STRING_REF) * field_count,
&tmp_char, row_size,
@@ -525,6 +520,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_row::clone()
}
clone_row->hs_row_first = clone_row->hs_row;
clone_row->cloned = TRUE;;
+ clone_row->row_size = row_size;;
DBUG_RETURN(NULL);
}
@@ -560,6 +556,13 @@ int spider_db_handlersocket_row::store_to_tmp_table(
DBUG_RETURN(tmp_table->file->ha_write_row(tmp_table->record[0]));
}
+uint spider_db_handlersocket_row::get_byte_size()
+{
+ DBUG_ENTER("spider_db_handlersocket_row::get_byte_size");
+ DBUG_PRINT("info",("spider this=%p", this));
+ DBUG_RETURN(row_size);
+}
+
spider_db_handlersocket_result_buffer::spider_db_handlersocket_result_buffer(
) : spider_db_result_buffer()
@@ -676,6 +679,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_result::fetch_row()
}
row.field_count = field_count;
row.hs_row_first = row.hs_row;
+ row.row_size = (*hs_conn_p)->get_row_size();
DBUG_RETURN((SPIDER_DB_ROW *) &row);
}
@@ -694,6 +698,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_result::fetch_row_from_result_buffer(
}
row.field_count = field_count;
row.hs_row_first = row.hs_row;
+ row.row_size = (*hs_conn_p)->get_row_size_from_result(hs_res_buf->hs_result);
DBUG_RETURN((SPIDER_DB_ROW *) &row);
}
@@ -729,6 +734,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_result::fetch_row_from_tmp_table(
}
tmp_hs_row++;
}
+ row.row_size = row_ptr - tmp_str2.ptr();
DBUG_RETURN((SPIDER_DB_ROW *) &row);
}
@@ -2755,10 +2761,10 @@ int spider_db_handlersocket_util::open_item_func(
Item *item, **item_list = item_func->arguments();
uint roop_count, item_count = item_func->argument_count(), start_item = 0;
const char *func_name = SPIDER_SQL_NULL_CHAR_STR,
- *separete_str = SPIDER_SQL_NULL_CHAR_STR,
+ *separator_str = SPIDER_SQL_NULL_CHAR_STR,
*last_str = SPIDER_SQL_NULL_CHAR_STR;
int func_name_length = SPIDER_SQL_NULL_CHAR_LEN,
- separete_str_length = SPIDER_SQL_NULL_CHAR_LEN,
+ separator_str_length = SPIDER_SQL_NULL_CHAR_LEN,
last_str_length = SPIDER_SQL_NULL_CHAR_LEN;
int use_pushdown_udf;
bool merge_func = FALSE;
@@ -2824,7 +2830,7 @@ int spider_db_handlersocket_util::open_item_func(
) {
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (
!strncasecmp("case", func_name, func_name_length)
@@ -2840,7 +2846,7 @@ int spider_db_handlersocket_util::open_item_func(
if (item_func_case->first_expr_num != -1)
{
if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->first_expr_num], spider, str,
+ item_list[item_func_case->first_expr_num], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -2854,7 +2860,7 @@ int spider_db_handlersocket_util::open_item_func(
str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[roop_count], spider, str,
+ item_list[roop_count], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -2864,7 +2870,7 @@ int spider_db_handlersocket_util::open_item_func(
str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[roop_count + 1], spider, str,
+ item_list[roop_count + 1], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -2877,7 +2883,7 @@ int spider_db_handlersocket_util::open_item_func(
str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->else_expr_num], spider, str,
+ item_list[item_func_case->else_expr_num], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -2914,7 +2920,7 @@ int spider_db_handlersocket_util::open_item_func(
) {
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (
!strncasecmp("convert", func_name, func_name_length)
@@ -2939,7 +2945,7 @@ int spider_db_handlersocket_util::open_item_func(
) {
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (func_name_length == 9 &&
!strncasecmp("isnottrue", func_name, func_name_length)
@@ -2966,8 +2972,8 @@ int spider_db_handlersocket_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
break;
}
} else if (func_name_length == 12)
@@ -3055,7 +3061,7 @@ int spider_db_handlersocket_util::open_item_func(
{
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (!strncasecmp("timestampdiff", func_name, func_name_length))
{
@@ -3118,7 +3124,7 @@ int spider_db_handlersocket_util::open_item_func(
str->q_append(interval_str, interval_len);
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
- if ((error_num = spider_db_print_item_type(item_list[0], spider,
+ if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3127,7 +3133,7 @@ int spider_db_handlersocket_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
- if ((error_num = spider_db_print_item_type(item_list[1], spider,
+ if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3381,8 +3387,8 @@ int spider_db_handlersocket_util::open_item_func(
func_name = spider_db_timefunc_interval_str[
item_date_add_interval->int_type];
func_name_length = strlen(func_name);
- if ((error_num = spider_db_print_item_type(item_list[0], spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -3398,8 +3404,8 @@ int spider_db_handlersocket_util::open_item_func(
str->q_append(SPIDER_SQL_INTERVAL_STR, SPIDER_SQL_INTERVAL_LEN);
}
}
- if ((error_num = spider_db_print_item_type(item_list[1], spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -3421,15 +3427,15 @@ int spider_db_handlersocket_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
case Item_func::NOW_FUNC:
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
case Item_func::CHAR_TYPECAST_FUNC:
DBUG_PRINT("info",("spider CHAR_TYPECAST_FUNC"));
@@ -3555,15 +3561,15 @@ int spider_db_handlersocket_util::open_item_func(
{
func_name = SPIDER_SQL_NOT_IN_STR;
func_name_length = SPIDER_SQL_NOT_IN_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
} else {
func_name = SPIDER_SQL_IN_STR;
func_name_length = SPIDER_SQL_IN_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
}
@@ -3573,13 +3579,13 @@ int spider_db_handlersocket_util::open_item_func(
{
func_name = SPIDER_SQL_NOT_BETWEEN_STR;
func_name_length = SPIDER_SQL_NOT_BETWEEN_LEN;
- separete_str = SPIDER_SQL_AND_STR;
- separete_str_length = SPIDER_SQL_AND_LEN;
+ separator_str = SPIDER_SQL_AND_STR;
+ separator_str_length = SPIDER_SQL_AND_LEN;
} else {
func_name = (char*) item_func->func_name();
func_name_length = strlen(func_name);
- separete_str = SPIDER_SQL_AND_STR;
- separete_str_length = SPIDER_SQL_AND_LEN;
+ separator_str = SPIDER_SQL_AND_STR;
+ separator_str_length = SPIDER_SQL_AND_LEN;
}
break;
case Item_func::UDF_FUNC:
@@ -3600,8 +3606,8 @@ int spider_db_handlersocket_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -3621,10 +3627,10 @@ int spider_db_handlersocket_util::open_item_func(
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
if (item_func->result_type() == STRING_RESULT)
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
else
- DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
case Item_func::FT_FUNC:
if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY)
@@ -3636,8 +3642,8 @@ int spider_db_handlersocket_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN);
}
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -3654,8 +3660,8 @@ int spider_db_handlersocket_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -3686,8 +3692,8 @@ int spider_db_handlersocket_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -3720,8 +3726,8 @@ int spider_db_handlersocket_util::open_item_func(
}
DBUG_PRINT("info",("spider func_name = %s", func_name));
DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
- DBUG_PRINT("info",("spider separete_str = %s", separete_str));
- DBUG_PRINT("info",("spider separete_str_length = %d", separete_str_length));
+ DBUG_PRINT("info",("spider separator_str = %s", separator_str));
+ DBUG_PRINT("info",("spider separator_str_length = %d", separator_str_length));
DBUG_PRINT("info",("spider last_str = %s", last_str));
DBUG_PRINT("info",("spider last_str_length = %d", last_str_length));
if (item_count)
@@ -3730,13 +3736,13 @@ int spider_db_handlersocket_util::open_item_func(
for (roop_count = start_item; roop_count < item_count; roop_count++)
{
item = item_list[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (roop_count == 1)
{
- func_name = separete_str;
- func_name_length = separete_str_length;
+ func_name = separator_str;
+ func_name_length = separator_str_length;
}
if (str)
{
@@ -3748,7 +3754,7 @@ int spider_db_handlersocket_util::open_item_func(
}
}
item = item_list[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -3762,7 +3768,7 @@ int spider_db_handlersocket_util::open_item_func(
str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN);
}
item = item_list[0];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3850,7 +3856,7 @@ int spider_db_handlersocket_util::open_item_sum_func(
for (roop_count = 0; roop_count < item_count; roop_count++)
{
item = args[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3861,7 +3867,7 @@ int spider_db_handlersocket_util::open_item_sum_func(
}
}
item = args[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -3902,8 +3908,11 @@ int spider_db_handlersocket_util::append_escaped_util(
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int spider_db_handlersocket_util::append_from_and_tables(
+ ha_spider *spider,
spider_fields *fields,
- spider_string *str
+ spider_string *str,
+ TABLE_LIST *table_list,
+ uint table_count
) {
DBUG_ENTER("spider_db_handlersocket_util::append_from_and_tables");
DBUG_PRINT("info",("spider this=%p", this));
@@ -4209,7 +4218,7 @@ int spider_handlersocket_share::create_column_name_str()
str->init_calc_mem(202);
str->set_charset(spider_share->access_charset);
if ((error_num = spider_db_append_name_with_quote_str(str,
- (char *) (*field)->field_name.str, dbton_id)))
+ (*field)->field_name, dbton_id)))
goto error;
}
DBUG_RETURN(0);
diff --git a/storage/spider/spd_db_handlersocket.h b/storage/spider/spd_db_handlersocket.h
index 19138b22e1a..075f8720abf 100644
--- a/storage/spider/spd_db_handlersocket.h
+++ b/storage/spider/spd_db_handlersocket.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Kentoku Shiba
+/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -119,8 +119,11 @@ public:
);
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int append_from_and_tables(
+ ha_spider *spider,
spider_fields *fields,
- spider_string *str
+ spider_string *str,
+ TABLE_LIST *table_list,
+ uint table_count
);
int reappend_tables(
spider_fields *fields,
@@ -142,6 +145,7 @@ public:
SPIDER_HS_STRING_REF *hs_row;
SPIDER_HS_STRING_REF *hs_row_first;
uint field_count;
+ uint row_size;
bool cloned;
spider_db_handlersocket_row();
~spider_db_handlersocket_row();
@@ -170,6 +174,7 @@ public:
TABLE *tmp_table,
spider_string *str
);
+ uint get_byte_size();
};
class spider_db_handlersocket_result_buffer: public spider_db_result_buffer
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index d19306b1b1a..cc4d2bcd3a1 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#include "hstcpcli.hpp"
#endif
-#include "tztime.h"
#define SPIDER_DBTON_SIZE 15
@@ -703,6 +702,8 @@ public:
);
void set_pos_to_first_table_holder();
SPIDER_TABLE_HOLDER *get_next_table_holder();
+ SPIDER_TABLE_HOLDER *get_table_holder(TABLE *table);
+ uint get_table_count();
int add_field(Field *field_arg);
SPIDER_FIELD_HOLDER *create_field_holder();
void set_pos_to_first_field_holder();
@@ -888,8 +889,11 @@ public:
) = 0;
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
virtual int append_from_and_tables(
+ ha_spider *spider,
spider_fields *fields,
- spider_string *str
+ spider_string *str,
+ TABLE_LIST *table_list,
+ uint table_count
) = 0;
virtual int reappend_tables(
spider_fields *fields,
@@ -937,6 +941,7 @@ public:
TABLE *tmp_table,
spider_string *str
) = 0;
+ virtual uint get_byte_size() = 0;
};
class spider_db_result_buffer
@@ -1943,6 +1948,7 @@ typedef struct st_spider_result_list
int max_order;
int quick_mode;
longlong quick_page_size;
+ longlong quick_page_byte;
int low_mem_read;
int bulk_update_mode;
int bulk_update_size;
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index df2de2cb637..ceb38f886aa 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Kentoku Shiba
+/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -109,6 +109,15 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR;
#define SPIDER_SQL_UNLOCK_TABLE_STR "unlock tables"
#define SPIDER_SQL_UNLOCK_TABLE_LEN (sizeof(SPIDER_SQL_UNLOCK_TABLE_STR) - 1)
+#define SPIDER_SQL_LEFT_JOIN_STR " left join "
+#define SPIDER_SQL_LEFT_JOIN_LEN (sizeof(SPIDER_SQL_LEFT_JOIN_STR) - 1)
+#define SPIDER_SQL_RIGHT_JOIN_STR " right join "
+#define SPIDER_SQL_RIGHT_JOIN_LEN (sizeof(SPIDER_SQL_RIGHT_JOIN_STR) - 1)
+#define SPIDER_SQL_JOIN_STR " join "
+#define SPIDER_SQL_JOIN_LEN (sizeof(SPIDER_SQL_JOIN_STR) - 1)
+#define SPIDER_SQL_ON_STR " on "
+#define SPIDER_SQL_ON_LEN (sizeof(SPIDER_SQL_ON_STR) - 1)
+
#define SPIDER_SQL_SHOW_TABLE_STATUS_STR "show table status from "
#define SPIDER_SQL_SHOW_TABLE_STATUS_LEN sizeof(SPIDER_SQL_SHOW_TABLE_STATUS_STR) - 1
#define SPIDER_SQL_SELECT_TABLES_STATUS_STR "select `table_rows`,`avg_row_length`,`data_length`,`max_data_length`,`index_length`,`auto_increment`,`create_time`,`update_time`,`check_time` from `information_schema`.`tables` where `table_schema` = "
@@ -180,7 +189,7 @@ static const char *spider_db_timefunc_interval_str[] =
};
/* UTC time zone for timestamp columns */
-Time_zone *UTC = 0;
+extern Time_zone *UTC;
int spider_mysql_init()
{
@@ -406,11 +415,17 @@ SPIDER_DB_ROW *spider_db_mysql_row::clone()
{
DBUG_RETURN(NULL);
}
- row_size = field_count;
- for (i = 0; i < field_count; i++)
+ if (!record_size)
{
- row_size += *tmp_lengths;
- tmp_lengths++;
+ row_size = field_count;
+ for (i = 0; i < field_count; i++)
+ {
+ row_size += *tmp_lengths;
+ tmp_lengths++;
+ }
+ record_size = row_size - field_count;
+ } else {
+ row_size = record_size + field_count;
}
if (!spider_bulk_malloc(spider_current_trx, 29, MYF(MY_WME),
&clone_row->row, sizeof(char*) * field_count,
@@ -442,6 +457,7 @@ SPIDER_DB_ROW *spider_db_mysql_row::clone()
tmp_row++;
}
clone_row->field_count = field_count;
+ clone_row->record_size = record_size;
clone_row->row_first = clone_row->row;
clone_row->lengths_first = clone_row->lengths;
clone_row->cloned = TRUE;
@@ -484,6 +500,23 @@ int spider_db_mysql_row::store_to_tmp_table(
DBUG_RETURN(tmp_table->file->ha_write_row(tmp_table->record[0]));
}
+uint spider_db_mysql_row::get_byte_size()
+{
+ ulong *tmp_lengths = lengths_first;
+ uint i;
+ DBUG_ENTER("spider_db_mysql_row::get_byte_size");
+ DBUG_PRINT("info",("spider this=%p", this));
+ if (!record_size)
+ {
+ for (i = 0; i < field_count; i++)
+ {
+ record_size += *tmp_lengths;
+ tmp_lengths++;
+ }
+ }
+ DBUG_RETURN(record_size);
+}
+
spider_db_mysql_result::spider_db_mysql_result(SPIDER_DB_CONN *in_db_conn) :
spider_db_result(in_db_conn, spider_dbton_mysql.dbton_id),
db_result(NULL)
@@ -550,6 +583,7 @@ SPIDER_DB_ROW *spider_db_mysql_result::fetch_row()
row.field_count = mysql_num_fields(db_result);
row.row_first = row.row;
row.lengths_first = row.lengths;
+ row.record_size = 0;
DBUG_RETURN((SPIDER_DB_ROW *) &row);
}
@@ -573,6 +607,7 @@ SPIDER_DB_ROW *spider_db_mysql_result::fetch_row_from_result_buffer(
row.field_count = mysql_num_fields(db_result);
row.row_first = row.row;
row.lengths_first = row.lengths;
+ row.record_size = 0;
DBUG_RETURN((SPIDER_DB_ROW *) &row);
}
@@ -605,6 +640,7 @@ SPIDER_DB_ROW *spider_db_mysql_result::fetch_row_from_tmp_table(
row.field_count = field_count;
row.row_first = row.row;
row.lengths_first = row.lengths;
+ row.record_size = tmp_str2.length();
for (i = 0; i < field_count; i++)
{
if (*tmp_row)
@@ -713,8 +749,8 @@ int spider_db_mysql_result::fetch_table_status(
#ifdef SPIDER_HAS_TIME_STATUS
my_time_status_init(&time_status);
#endif
- str_to_datetime(mysql_row[11], strlen(mysql_row[11]), &mysql_time, 0,
- &time_status);
+ SPIDER_str_to_datetime(mysql_row[11], strlen(mysql_row[11]),
+ &mysql_time, 0, &time_status);
#ifdef MARIADB_BASE_VERSION
create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -738,8 +774,8 @@ int spider_db_mysql_result::fetch_table_status(
#ifdef SPIDER_HAS_TIME_STATUS
my_time_status_init(&time_status);
#endif
- str_to_datetime(mysql_row[12], strlen(mysql_row[12]), &mysql_time, 0,
- &time_status);
+ SPIDER_str_to_datetime(mysql_row[12], strlen(mysql_row[12]),
+ &mysql_time, 0, &time_status);
#ifdef MARIADB_BASE_VERSION
update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -763,8 +799,8 @@ int spider_db_mysql_result::fetch_table_status(
#ifdef SPIDER_HAS_TIME_STATUS
my_time_status_init(&time_status);
#endif
- str_to_datetime(mysql_row[13], strlen(mysql_row[13]), &mysql_time, 0,
- &time_status);
+ SPIDER_str_to_datetime(mysql_row[13], strlen(mysql_row[13]),
+ &mysql_time, 0, &time_status);
#ifdef MARIADB_BASE_VERSION
check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -831,8 +867,8 @@ int spider_db_mysql_result::fetch_table_status(
#ifdef SPIDER_HAS_TIME_STATUS
my_time_status_init(&time_status);
#endif
- str_to_datetime(mysql_row[6], strlen(mysql_row[6]), &mysql_time, 0,
- &time_status);
+ SPIDER_str_to_datetime(mysql_row[6], strlen(mysql_row[6]),
+ &mysql_time, 0, &time_status);
#ifdef MARIADB_BASE_VERSION
create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -856,8 +892,8 @@ int spider_db_mysql_result::fetch_table_status(
#ifdef SPIDER_HAS_TIME_STATUS
my_time_status_init(&time_status);
#endif
- str_to_datetime(mysql_row[7], strlen(mysql_row[7]), &mysql_time, 0,
- &time_status);
+ SPIDER_str_to_datetime(mysql_row[7], strlen(mysql_row[7]),
+ &mysql_time, 0, &time_status);
#ifdef MARIADB_BASE_VERSION
update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -881,8 +917,8 @@ int spider_db_mysql_result::fetch_table_status(
#ifdef SPIDER_HAS_TIME_STATUS
my_time_status_init(&time_status);
#endif
- str_to_datetime(mysql_row[8], strlen(mysql_row[8]), &mysql_time, 0,
- &time_status);
+ SPIDER_str_to_datetime(mysql_row[8], strlen(mysql_row[8]),
+ &mysql_time, 0, &time_status);
#ifdef MARIADB_BASE_VERSION
check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -1524,7 +1560,7 @@ int spider_db_mysql_result::fetch_table_for_discover_table_structure(
}
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
- if (num_fields() != 18)
+ if (num_fields() < 18)
{
DBUG_PRINT("info",("spider num_fields != 18"));
my_printf_error(ER_SPIDER_UNKNOWN_NUM, ER_SPIDER_UNKNOWN_STR, MYF(0));
@@ -3092,8 +3128,13 @@ void spider_db_mysql::set_dup_key_idx(
key_name = spider->share->tgt_pk_names[all_link_idx];
key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx];
} else {
- key_name = table->s->key_info[roop_count].name.str;
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
+ key_name = table->s->key_info[roop_count].name.str;
key_name_length = table->s->key_info[roop_count].name.length;
+#else
+ key_name = table->s->key_info[roop_count].name;
+ key_name_length = strlen(key_name);
+#endif
}
DBUG_PRINT("info",("spider key_name=%s", key_name));
if (
@@ -3212,8 +3253,7 @@ int spider_db_mysql_util::append_column_value(
tmp_str.set_quick((char *) new_ptr + HA_KEY_BLOB_LENGTH, length,
&my_charset_bin);
ptr = tmp_str.get_str();
- }
- else if (field->type() == MYSQL_TYPE_GEOMETRY)
+ } else if (field->type() == MYSQL_TYPE_GEOMETRY)
{
/*
uint mlength = SIZEOF_STORED_DOUBLE, lcnt;
@@ -3290,15 +3330,11 @@ int spider_db_mysql_util::append_column_value(
tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE * 3,
SIZEOF_STORED_DOUBLE);
ptr = tmp_str.get_str();
- }
- else
- {
+ } else {
ptr = field->val_str(tmp_str.get_str(), new_ptr);
tmp_str.mem_calc();
}
- }
- else
- {
+ } else {
ptr = field->val_str(tmp_str.get_str());
tmp_str.mem_calc();
}
@@ -3350,8 +3386,7 @@ int spider_db_mysql_util::append_column_value(
append_escaped_util(str, tmp_str2.get_str())
)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- else if (str->append(*ptr))
+ } else if (str->append(*ptr))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -3621,7 +3656,7 @@ int spider_db_mysql_util::open_item_func(
int error_num;
Item *item, **item_list = item_func->arguments();
Field *field;
- uint loop_count, item_count = item_func->argument_count(), start_item = 0;
+ uint roop_count, item_count = item_func->argument_count(), start_item = 0;
const char *func_name = SPIDER_SQL_NULL_CHAR_STR,
*separator_str = SPIDER_SQL_NULL_CHAR_STR,
*last_str = SPIDER_SQL_NULL_CHAR_STR;
@@ -3693,8 +3728,7 @@ int spider_db_mysql_util::open_item_func(
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
} else if (
!strncasecmp("case", func_name, func_name_length)
) {
@@ -3709,12 +3743,12 @@ int spider_db_mysql_util::open_item_func(
if (item_func_case->first_expr_num != -1)
{
if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->first_expr_num], spider, str,
+ item_list[item_func_case->first_expr_num], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
- for (loop_count = 0; loop_count < item_func_case->ncases;
- loop_count += 2)
+ for (roop_count = 0; roop_count < item_func_case->ncases;
+ roop_count += 2)
{
if (str)
{
@@ -3723,7 +3757,7 @@ int spider_db_mysql_util::open_item_func(
str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[loop_count], spider, str,
+ item_list[roop_count], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3733,7 +3767,7 @@ int spider_db_mysql_util::open_item_func(
str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[loop_count + 1], spider, str,
+ item_list[roop_count + 1], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -3746,7 +3780,7 @@ int spider_db_mysql_util::open_item_func(
str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->else_expr_num], spider, str,
+ item_list[item_func_case->else_expr_num], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -3784,9 +3818,7 @@ int spider_db_mysql_util::open_item_func(
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
} else if (
!strncasecmp("convert", func_name, func_name_length)
) {
@@ -3811,8 +3843,7 @@ int spider_db_mysql_util::open_item_func(
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
} else if (func_name_length == 9 &&
!strncasecmp("isnottrue", func_name, func_name_length)
) {
@@ -3928,9 +3959,7 @@ int spider_db_mysql_util::open_item_func(
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
} else if (!strncasecmp("timestampdiff", func_name, func_name_length))
{
#ifdef ITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC
@@ -3992,7 +4021,7 @@ int spider_db_mysql_util::open_item_func(
str->q_append(interval_str, interval_len);
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
- if ((error_num = spider_db_print_item_type(item_list[0], spider,
+ if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -4001,7 +4030,7 @@ int spider_db_mysql_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
- if ((error_num = spider_db_print_item_type(item_list[1], spider,
+ if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -4255,11 +4284,8 @@ int spider_db_mysql_util::open_item_func(
func_name = spider_db_timefunc_interval_str[
item_date_add_interval->int_type];
func_name_length = strlen(func_name);
- if ((error_num = spider_db_print_item_type(item_list[0], NULL,
- spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -4275,11 +4301,8 @@ int spider_db_mysql_util::open_item_func(
str->q_append(SPIDER_SQL_INTERVAL_STR, SPIDER_SQL_INTERVAL_LEN);
}
}
- if ((error_num = spider_db_print_item_type(item_list[1], NULL,
- spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -4309,9 +4332,8 @@ int spider_db_mysql_util::open_item_func(
case Item_func::NOW_FUNC:
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields));
case Item_func::CHAR_TYPECAST_FUNC:
DBUG_PRINT("info",("spider CHAR_TYPECAST_FUNC"));
{
@@ -4503,12 +4525,10 @@ int spider_db_mysql_util::open_item_func(
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
if (item_func->result_type() == STRING_RESULT)
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
else
DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields));
+ alias, alias_length, dbton_id, use_fields, fields));
case Item_func::FT_FUNC:
if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY)
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
@@ -4607,7 +4627,6 @@ int spider_db_mysql_util::open_item_func(
DBUG_PRINT("info",("spider separator_str_length = %d", separator_str_length));
DBUG_PRINT("info",("spider last_str = %s", last_str));
DBUG_PRINT("info",("spider last_str_length = %d", last_str_length));
-
if (item_count)
{
/* Find the field in the list of items of the expression tree */
@@ -4615,23 +4634,18 @@ int spider_db_mysql_util::open_item_func(
item_count, start_item,
str,
func_name, func_name_length);
-
item_count--;
-
/*
Loop through the items of the current function expression to
print its portion of the statement
*/
- for (loop_count = start_item; loop_count < item_count; loop_count++)
+ for (roop_count = start_item; roop_count < item_count; roop_count++)
{
- item = item_list[loop_count];
+ item = item_list[roop_count];
if ((error_num = spider_db_print_item_type(item, field, spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
-
- if (loop_count == 1)
+ if (roop_count == 1)
{
/* Remaining operands need to be preceded by the separator */
func_name = separator_str;
@@ -4648,11 +4662,9 @@ int spider_db_mysql_util::open_item_func(
}
/* Print the last operand value */
- item = item_list[loop_count];
+ item = item_list[roop_count];
if ((error_num = spider_db_print_item_type(item, field, spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -4667,8 +4679,7 @@ int spider_db_mysql_util::open_item_func(
}
item = item_list[0];
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -4755,11 +4766,8 @@ int spider_db_mysql_util::open_item_sum_func(
for (roop_count = 0; roop_count < item_count; roop_count++)
{
item = args[roop_count];
- if ((error_num = spider_db_print_item_type(item, NULL,
- spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -4770,9 +4778,7 @@ int spider_db_mysql_util::open_item_sum_func(
}
item = args[roop_count];
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
if (str)
@@ -4788,6 +4794,48 @@ int spider_db_mysql_util::open_item_sum_func(
case Item_sum::SUM_DISTINCT_FUNC:
case Item_sum::AVG_FUNC:
case Item_sum::AVG_DISTINCT_FUNC:
+ {
+ if (!use_fields)
+ DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
+ const char *func_name = item_sum->func_name();
+ uint func_name_length = strlen(func_name);
+ Item *item, **args = item_sum->get_args();
+ if (str)
+ {
+ if (str->reserve(func_name_length))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ str->q_append(func_name, func_name_length);
+ }
+ if (item_count)
+ {
+ item_count--;
+ for (roop_count = 0; roop_count < item_count; roop_count++)
+ {
+ item = args[roop_count];
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields)))
+ DBUG_RETURN(error_num);
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_COMMA_LEN))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
+ }
+ }
+ item = args[roop_count];
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
+ alias, alias_length, dbton_id, use_fields, fields)))
+ DBUG_RETURN(error_num);
+ }
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
+ SPIDER_SQL_CLOSE_PAREN_LEN);
+ }
+ }
+ break;
case Item_sum::STD_FUNC:
case Item_sum::VARIANCE_FUNC:
case Item_sum::SUM_BIT_FUNC:
@@ -4813,59 +4861,529 @@ int spider_db_mysql_util::append_escaped_util(
}
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
-int spider_db_mysql_util::append_from_and_tables(
+int spider_db_mysql_util::append_table(
+ ha_spider *spider,
spider_fields *fields,
- spider_string *str
+ spider_string *str,
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos,
+ TABLE_LIST **cond_table_list_ptr,
+ bool top_down,
+ bool first
) {
- SPIDER_TABLE_HOLDER *table_holder;
int error_num;
- uint dbton_id = spider_dbton_mysql.dbton_id, from_length;
+ bool use_cond_table_list = FALSE;
spider_mysql_share *db_share;
spider_mysql_handler *dbton_hdl;
- ha_spider *spider;
- DBUG_ENTER("spider_db_mysql_util::append_from_and_tables");
+ SPIDER_TABLE_HOLDER *table_holder;
+ uint dbton_id = spider_dbton_mysql.dbton_id;
+ TABLE_LIST *cond_table_list = *cond_table_list_ptr;
+ ha_spider *spd;
+ DBUG_ENTER("spider_db_mysql_util::append_table");
+ DBUG_PRINT("info",("spider table_list=%p", table_list));
+ DBUG_PRINT("info",("spider table_list->outer_join=%u",
+ table_list->outer_join));
+ DBUG_PRINT("info",("spider table_list->on_expr=%p",
+ table_list->on_expr));
+ DBUG_PRINT("info",("spider table_list->join_using_fields=%p",
+ table_list->join_using_fields));
+ DBUG_PRINT("info",("spider table_list->table=%p",
+ table_list->table));
+ if (!top_down && table_list->embedding)
+ {
+ if ((error_num = append_embedding_tables(spider, fields, str,
+ table_list->embedding, used_table_list, current_pos,
+ cond_table_list_ptr)))
+ DBUG_RETURN(error_num);
+ } else if (!table_list->table)
+ {
+ if ((error_num = append_tables_top_down(spider, fields, str, table_list,
+ used_table_list, current_pos, cond_table_list_ptr)))
+ DBUG_RETURN(error_num);
+ } else {
+ if (
+ table_list->outer_join ||
+ table_list->on_expr ||
+ table_list->join_using_fields
+ ) {
+ DBUG_PRINT("info",("spider use table_list"));
+ if (table_list->outer_join & JOIN_TYPE_LEFT)
+ {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_LEFT_JOIN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_LEFT_JOIN_STR, SPIDER_SQL_LEFT_JOIN_LEN);
+ }
+ } else {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_JOIN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_JOIN_STR, SPIDER_SQL_JOIN_LEN);
+ }
+ }
+ } else if (
+ cond_table_list &&
+ (
+ cond_table_list->outer_join ||
+ cond_table_list->on_expr ||
+ cond_table_list->join_using_fields
+ )
+ ) {
+ DBUG_PRINT("info",("spider use cond_table_list"));
+ if (cond_table_list->outer_join & (JOIN_TYPE_LEFT | JOIN_TYPE_RIGHT))
+ {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_LEFT_JOIN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_LEFT_JOIN_STR, SPIDER_SQL_LEFT_JOIN_LEN);
+ }
+ } else {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_JOIN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_JOIN_STR, SPIDER_SQL_JOIN_LEN);
+ }
+ }
+ use_cond_table_list = TRUE;
+ } else if (*current_pos > 0 && !first)
+ {
+ DBUG_PRINT("info",("spider no condition"));
+ if (top_down)
+ {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_JOIN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_JOIN_STR, SPIDER_SQL_JOIN_LEN);
+ }
+ } else {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_COMMA_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
+ }
+ }
+ }
+
+ if (str)
+ {
+ table_holder = fields->get_table_holder(table_list->table);
+ spd = table_holder->spider;
+ db_share = (spider_mysql_share *)
+ spd->share->dbton_share[dbton_id];
+ dbton_hdl = (spider_mysql_handler *)
+ spd->dbton_handler[dbton_id];
+
+ dbton_hdl->table_name_pos = str->length();
+
+ if (str->reserve(
+ db_share->db_nm_max_length +
+ SPIDER_SQL_DOT_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 +
+ db_share->table_nm_max_length + SPIDER_SQL_SPACE_LEN +
+ table_holder->alias->length() - SPIDER_SQL_DOT_LEN
+ )) {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+
+ if ((error_num = db_share->append_table_name_with_adjusting(str,
+ spd->conn_link_idx[dbton_hdl->first_link_idx])))
+ {
+ DBUG_RETURN(error_num);
+ }
+ str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
+ str->q_append(table_holder->alias->ptr(),
+ table_holder->alias->length() - SPIDER_SQL_DOT_LEN);
+ }
+ used_table_list[(*current_pos)++] = table_list;
+
+ if (str)
+ {
+ List<String> *join_using_fields = table_list->join_using_fields;
+ if (!join_using_fields && cond_table_list)
+ {
+ join_using_fields = cond_table_list->join_using_fields;
+ }
+
+ if (join_using_fields)
+ {
+ if (str->reserve(SPIDER_SQL_USING_LEN + SPIDER_SQL_OPEN_PAREN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_USING_STR, SPIDER_SQL_USING_LEN);
+ str->q_append(SPIDER_SQL_OPEN_PAREN_STR,
+ SPIDER_SQL_OPEN_PAREN_LEN);
+ List_iterator_fast<String> it2(*join_using_fields);
+ String *ptr;
+ while ((ptr = it2++))
+ {
+ if (str->reserve(ptr->length() + SPIDER_SQL_COMMA_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(ptr->ptr(), ptr->length());
+ str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
+ }
+ str->length(str->length() - SPIDER_SQL_COMMA_LEN);
+ if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
+ SPIDER_SQL_CLOSE_PAREN_LEN);
+ }
+ }
+
+ Item *on_expr = table_list->on_expr;
+ if (!on_expr && cond_table_list)
+ {
+ on_expr = cond_table_list->on_expr;
+ }
+
+ if (on_expr)
+ {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_ON_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_ON_STR, SPIDER_SQL_ON_LEN);
+ }
+ if ((error_num = spider_db_print_item_type(on_expr, NULL,
+ spider, str, NULL, 0, dbton_id, TRUE, fields)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ }
+
+ if (use_cond_table_list)
+ {
+ (*cond_table_list_ptr) = NULL;
+ DBUG_PRINT("info",("spider cond_table_list=%p", (*cond_table_list_ptr)));
+ }
+ }
+ DBUG_RETURN(0);
+}
+
+int spider_db_mysql_util::append_tables_top_down(
+ ha_spider *spider,
+ spider_fields *fields,
+ spider_string *str,
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos,
+ TABLE_LIST **cond_table_list_ptr
+) {
+ int error_num;
+ uint outer_join_backup;
+ TABLE_LIST *cur_table_list, *prev_table_list = NULL, *cond_table_list = NULL;
+ bool first;
+ DBUG_ENTER("spider_db_mysql_util::append_tables_top_down");
DBUG_PRINT("info",("spider this=%p", this));
+ if (
+ table_list->outer_join ||
+ table_list->on_expr ||
+ table_list->join_using_fields
+ ) {
+ DBUG_ASSERT(!(*cond_table_list_ptr));
+ (*cond_table_list_ptr) = table_list;
+ DBUG_PRINT("info",("spider cond_table_list=%p", table_list));
+ }
+ List_iterator_fast<TABLE_LIST> it1(table_list->nested_join->join_list);
+ cur_table_list = it1++;
+ if (cur_table_list->outer_join & JOIN_TYPE_RIGHT)
+ {
+ first = FALSE;
+ prev_table_list = cur_table_list;
+ cur_table_list = it1++;
+ } else if (*cond_table_list_ptr)
+ {
+ first = TRUE;
+ cond_table_list = (*cond_table_list_ptr);
+ (*cond_table_list_ptr) = NULL;
+ if (cond_table_list->outer_join & JOIN_TYPE_LEFT)
+ {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_LEFT_JOIN_LEN + SPIDER_SQL_OPEN_PAREN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_LEFT_JOIN_STR, SPIDER_SQL_LEFT_JOIN_LEN);
+ str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
+ }
+ } else {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_JOIN_LEN + SPIDER_SQL_OPEN_PAREN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_JOIN_STR, SPIDER_SQL_JOIN_LEN);
+ str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
+ }
+ }
+ }
- /* calculate from size */
- from_length = SPIDER_SQL_FROM_LEN;
- fields->set_pos_to_first_table_holder();
- while ((table_holder = fields->get_next_table_holder()))
+ do {
+ if (cur_table_list->outer_join & JOIN_TYPE_RIGHT)
+ {
+ prev_table_list = cur_table_list;
+ } else {
+ if ((error_num = append_table(spider, fields, str, cur_table_list,
+ used_table_list, current_pos, cond_table_list_ptr, TRUE, first)))
+ DBUG_RETURN(error_num);
+ first = FALSE;
+ if (prev_table_list)
+ {
+ outer_join_backup = prev_table_list->outer_join;
+ prev_table_list->outer_join = JOIN_TYPE_LEFT;
+ if ((error_num = append_table(spider, fields, str, prev_table_list,
+ used_table_list, current_pos, cond_table_list_ptr, TRUE, FALSE)))
+ {
+ prev_table_list->outer_join = outer_join_backup;
+ DBUG_RETURN(error_num);
+ }
+ prev_table_list->outer_join = outer_join_backup;
+ prev_table_list = NULL;
+ }
+ }
+ } while ((cur_table_list = it1++));
+
+ if (cond_table_list)
{
- spider = table_holder->spider;
- db_share = (spider_mysql_share *)
- spider->share->dbton_share[dbton_id];
- from_length +=
- db_share->db_nm_max_length +
- SPIDER_SQL_DOT_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 +
- db_share->table_nm_max_length +
- SPIDER_SQL_SPACE_LEN + SPIDER_SQL_COMMA_LEN +
- table_holder->alias->length() - SPIDER_SQL_DOT_LEN;
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
+ SPIDER_SQL_CLOSE_PAREN_LEN);
+
+ List<String> *join_using_fields = cond_table_list->join_using_fields;
+ if (join_using_fields)
+ {
+ if (str->reserve(SPIDER_SQL_USING_LEN + SPIDER_SQL_OPEN_PAREN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_USING_STR, SPIDER_SQL_USING_LEN);
+ str->q_append(SPIDER_SQL_OPEN_PAREN_STR,
+ SPIDER_SQL_OPEN_PAREN_LEN);
+ List_iterator_fast<String> it2(*join_using_fields);
+ String *ptr;
+ while ((ptr = it2++))
+ {
+ if (str->reserve(ptr->length() + SPIDER_SQL_COMMA_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(ptr->ptr(), ptr->length());
+ str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
+ }
+ str->length(str->length() - SPIDER_SQL_COMMA_LEN);
+ if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
+ SPIDER_SQL_CLOSE_PAREN_LEN);
+ }
+ }
+
+ Item *on_expr = cond_table_list->on_expr;
+ if (on_expr)
+ {
+ if (str)
+ {
+ if (str->reserve(SPIDER_SQL_ON_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_ON_STR, SPIDER_SQL_ON_LEN);
+ }
+ if ((error_num = spider_db_print_item_type(on_expr, NULL,
+ spider, str, NULL, 0, spider_dbton_mysql.dbton_id, TRUE, fields)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ }
+ }
+ DBUG_RETURN(0);
+}
+
+int spider_db_mysql_util::append_tables_top_down_check(
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos
+) {
+ int error_num;
+ TABLE_LIST *cur_table_list;
+ DBUG_ENTER("spider_db_mysql_util::append_tables_top_down_check");
+ DBUG_PRINT("info",("spider this=%p", this));
+ List_iterator_fast<TABLE_LIST> it1(table_list->nested_join->join_list);
+ while ((cur_table_list = it1++))
+ {
+ if (!cur_table_list->table)
+ {
+ if ((error_num = append_tables_top_down_check(
+ cur_table_list, used_table_list, current_pos)))
+ DBUG_RETURN(error_num);
+ } else {
+ used_table_list[(*current_pos)++] = cur_table_list;
+ }
+ }
+ DBUG_RETURN(0);
+}
+
+int spider_db_mysql_util::append_embedding_tables(
+ ha_spider *spider,
+ spider_fields *fields,
+ spider_string *str,
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos,
+ TABLE_LIST **cond_table_list_ptr
+) {
+ int error_num;
+ TABLE_LIST *embedding = table_list->embedding;
+ DBUG_ENTER("spider_db_mysql_util::append_embedding_tables");
+ DBUG_PRINT("info",("spider this=%p", this));
+ if (embedding)
+ {
+ DBUG_PRINT("info",("spider embedding=%p", embedding));
+ DBUG_PRINT("info",("spider embedding->outer_join=%u",
+ embedding->outer_join));
+ DBUG_PRINT("info",("spider embedding->on_expr=%p",
+ embedding->on_expr));
+ DBUG_PRINT("info",("spider embedding->join_using_fields=%p",
+ embedding->join_using_fields));
+ DBUG_PRINT("info",("spider embedding->table=%p",
+ embedding->table));
+ if ((error_num = append_embedding_tables(spider, fields, str, embedding,
+ used_table_list, current_pos, cond_table_list_ptr)))
+ DBUG_RETURN(error_num);
+ } else {
+ DBUG_PRINT("info",("spider table_list=%p", table_list));
+ DBUG_PRINT("info",("spider table_list->outer_join=%u",
+ table_list->outer_join));
+ DBUG_PRINT("info",("spider table_list->on_expr=%p",
+ table_list->on_expr));
+ DBUG_PRINT("info",("spider table_list->join_using_fields=%p",
+ table_list->join_using_fields));
+ DBUG_PRINT("info",("spider table_list->table=%p",
+ table_list->table));
+ if (table_list->outer_join & JOIN_TYPE_RIGHT)
+ {
+ if ((error_num = append_tables_top_down_check(table_list,
+ used_table_list, current_pos)))
+ DBUG_RETURN(error_num);
+ DBUG_ASSERT(!(*cond_table_list_ptr));
+ (*cond_table_list_ptr) = table_list;
+ DBUG_PRINT("info",("spider cond_table_list=%p", table_list));
+ } else {
+ if ((error_num = append_tables_top_down(spider, fields, str, table_list,
+ used_table_list, current_pos, cond_table_list_ptr)))
+ DBUG_RETURN(error_num);
+ }
}
+ DBUG_RETURN(0);
+}
- if (str->reserve(from_length))
+int spider_db_mysql_util::append_from_and_tables(
+ ha_spider *spider,
+ spider_fields *fields,
+ spider_string *str,
+ TABLE_LIST *table_list,
+ uint table_count
+) {
+ int error_num;
+ uint current_pos = 0, roop_count, backup_pos, outer_join_backup;
+ TABLE *table;
+ TABLE_LIST **used_table_list, *prev_table_list = NULL,
+ *cond_table_list = NULL;
+ DBUG_ENTER("spider_db_mysql_util::append_from_and_tables");
+ DBUG_PRINT("info",("spider this=%p", this));
+ used_table_list = (TABLE_LIST **)
+ my_alloca(sizeof(TABLE_LIST *) * table_count);
+ if (!used_table_list)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- fields->set_pos_to_first_table_holder();
- while ((table_holder = fields->get_next_table_holder()))
+ if (str)
{
- spider = table_holder->spider;
- db_share = (spider_mysql_share *)
- spider->share->dbton_share[dbton_id];
- dbton_hdl = (spider_mysql_handler *)
- spider->dbton_handler[dbton_id];
- dbton_hdl->table_name_pos = str->length();
- if ((error_num = db_share->append_table_name_with_adjusting(str,
- spider->conn_link_idx[dbton_hdl->first_link_idx])))
+ if (str->reserve(SPIDER_SQL_FROM_LEN))
{
- DBUG_RETURN(error_num);
+ my_afree(used_table_list);
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- str->q_append(table_holder->alias->ptr(),
- table_holder->alias->length() - SPIDER_SQL_DOT_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
+ str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
}
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
+
+ do {
+ table = table_list->table;
+ if (table->const_table)
+ continue;
+
+ for (roop_count = 0; roop_count < current_pos; ++roop_count)
+ {
+ if (used_table_list[roop_count] == table_list)
+ break;
+ }
+ if (roop_count < current_pos)
+ continue;
+
+ if (prev_table_list)
+ current_pos = backup_pos;
+ else
+ backup_pos = current_pos;
+ if ((error_num = append_table(spider, fields, str, table_list, used_table_list,
+ &current_pos, &cond_table_list, FALSE, FALSE)))
+ {
+ my_afree(used_table_list);
+ DBUG_RETURN(error_num);
+ }
+ if (prev_table_list)
+ {
+ outer_join_backup = prev_table_list->outer_join;
+ prev_table_list->outer_join = JOIN_TYPE_LEFT;
+ if ((error_num = append_table(spider, fields, str, prev_table_list,
+ used_table_list, &current_pos, &cond_table_list, FALSE, FALSE)))
+ {
+ prev_table_list->outer_join = outer_join_backup;
+ my_afree(used_table_list);
+ DBUG_RETURN(error_num);
+ }
+ prev_table_list->outer_join = outer_join_backup;
+ prev_table_list = NULL;
+ }
+ if (cond_table_list && (cond_table_list->outer_join & JOIN_TYPE_RIGHT))
+ {
+ prev_table_list = cond_table_list;
+ cond_table_list = NULL;
+ DBUG_PRINT("info",("spider cond_table_list=%p", cond_table_list));
+ }
+ } while ((table_list = table_list->next_local));
+ my_afree(used_table_list);
DBUG_RETURN(0);
}
@@ -5344,7 +5862,7 @@ int spider_mysql_share::create_column_name_str()
str->init_calc_mem(89);
str->set_charset(spider_share->access_charset);
if ((error_num = spider_db_append_name_with_quote_str(str,
- (char *) (*field)->field_name.str, dbton_id)))
+ (*field)->field_name, dbton_id)))
goto error;
}
DBUG_RETURN(0);
@@ -5377,7 +5895,7 @@ int spider_mysql_share::convert_key_hint_str()
DBUG_ENTER("spider_mysql_share::convert_key_hint_str");
if (spider_share->access_charset->cset != system_charset_info->cset)
{
- /* need convertion */
+ /* need conversion */
for (roop_count = 0, tmp_key_hint = key_hint;
roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++)
{
@@ -5613,6 +6131,10 @@ int spider_mysql_share::append_table_select()
spider_string *str = table_select;
TABLE_SHARE *table_share = spider_share->table_share;
DBUG_ENTER("spider_mysql_share::append_table_select");
+
+ if (!*table_share->field)
+ DBUG_RETURN(0);
+
for (field = table_share->field; *field; field++)
{
field_length = column_name_str[(*field)->field_index].length();
@@ -5637,6 +6159,10 @@ int spider_mysql_share::append_key_select(
TABLE_SHARE *table_share = spider_share->table_share;
const KEY *key_info = &table_share->key_info[idx];
DBUG_ENTER("spider_mysql_share::append_key_select");
+
+ if (!spider_user_defined_key_parts(key_info))
+ DBUG_RETURN(0);
+
for (key_part = key_info->key_part, part_num = 0;
part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
{
@@ -7276,16 +7802,28 @@ int spider_mysql_handler::append_select(
if (result_list->lock_type != F_WRLCK && spider->lock_mode < 1)
{
/* no lock */
+#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
LEX *lex = spider->trx->thd->lex;
+#else
+ st_select_lex *select_lex = &spider->trx->thd->lex->select_lex;
+#endif
if (
+#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
lex->sql_cache == LEX::SQL_CACHE &&
+#else
+ select_lex->sql_cache == SELECT_LEX::SQL_CACHE &&
+#endif
(spider->share->query_cache_sync & 1)
) {
if (str->reserve(SPIDER_SQL_SQL_CACHE_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_SQL_CACHE_STR, SPIDER_SQL_SQL_CACHE_LEN);
} else if (
+#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
lex->sql_cache == LEX::SQL_NO_CACHE &&
+#else
+ select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE &&
+#endif
(spider->share->query_cache_sync & 2)
) {
if (str->reserve(SPIDER_SQL_SQL_NO_CACHE_LEN))
@@ -7652,8 +8190,7 @@ int spider_mysql_handler::check_item_type(
DBUG_ENTER("spider_mysql_handler::check_item_type");
DBUG_PRINT("info",("spider this=%p", this));
error_num = spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0,
- spider_dbton_mysql.dbton_id,
- FALSE, NULL);
+ spider_dbton_mysql.dbton_id, FALSE, NULL);
DBUG_RETURN(error_num);
}
@@ -8276,22 +8813,67 @@ int spider_mysql_handler::append_update_where(
) {
uint field_name_length;
Field **field;
+ THD *thd = spider->trx->thd;
SPIDER_SHARE *share = spider->share;
+ bool no_pk = (table->s->primary_key == MAX_KEY);
DBUG_ENTER("spider_mysql_handler::append_update_where");
DBUG_PRINT("info", ("spider table->s->primary_key=%s",
table->s->primary_key != MAX_KEY ? "TRUE" : "FALSE"));
+ uint str_len_bakup = str->length();
if (str->reserve(SPIDER_SQL_WHERE_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- for (field = table->field; *field; field++)
- {
- DBUG_PRINT("info", ("spider bitmap=%s",
- bitmap_is_set(table->read_set, (*field)->field_index) ?
- "TRUE" : "FALSE"));
- if (
- table->s->primary_key == MAX_KEY ||
- bitmap_is_set(table->read_set, (*field)->field_index)
+
+ if (
+ no_pk ||
+ spider_param_use_cond_other_than_pk_for_update(thd)
+ ) {
+ for (field = table->field; *field; field++)
+ {
+ if (
+ no_pk ||
+ bitmap_is_set(table->read_set, (*field)->field_index)
+ ) {
+ field_name_length =
+ mysql_share->column_name_str[(*field)->field_index].length();
+ if ((*field)->is_null(ptr_diff))
+ {
+ if (str->reserve(field_name_length +
+ /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
+ SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ mysql_share->append_column_name(str, (*field)->field_index);
+ str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN);
+ } else {
+ if (str->reserve(field_name_length +
+ /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
+ SPIDER_SQL_EQUAL_LEN))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ mysql_share->append_column_name(str, (*field)->field_index);
+ str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
+ (*field)->move_field_offset(ptr_diff);
+ if (
+ spider_db_mysql_utility.
+ append_column_value(spider, str, *field, NULL,
+ share->access_charset) ||
+ str->reserve(SPIDER_SQL_AND_LEN)
+ )
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ (*field)->move_field_offset(-ptr_diff);
+ }
+ str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
+ }
+ }
+ } else {
+ KEY *key_info = &table->key_info[table->s->primary_key];
+ KEY_PART_INFO *key_part;
+ uint part_num;
+ for (
+ key_part = key_info->key_part, part_num = 0;
+ part_num < spider_user_defined_key_parts(key_info);
+ key_part++, part_num++
) {
+ field = &key_part->field;
field_name_length =
mysql_share->column_name_str[(*field)->field_index].length();
if ((*field)->is_null(ptr_diff))
@@ -8322,7 +8904,13 @@ int spider_mysql_handler::append_update_where(
str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
}
}
- str->length(str->length() - SPIDER_SQL_AND_LEN);
+ if (str->length() == str_len_bakup + SPIDER_SQL_WHERE_LEN)
+ {
+ /* no condition */
+ str->length(str_len_bakup);
+ } else {
+ str->length(str->length() - SPIDER_SQL_AND_LEN);
+ }
if (str->reserve(SPIDER_SQL_LIMIT1_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_LIMIT1_STR, SPIDER_SQL_LIMIT1_LEN);
@@ -8451,11 +9039,9 @@ int spider_mysql_handler::append_condition(
str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
}
}
- if ((error_num = spider_db_print_item_type((Item *) tmp_cond->cond,
- NULL, spider, str,
- alias, alias_length,
- spider_dbton_mysql.dbton_id,
- FALSE, NULL)))
+ if ((error_num = spider_db_print_item_type(
+ (Item *) tmp_cond->cond, NULL, spider, str, alias, alias_length,
+ spider_dbton_mysql.dbton_id, FALSE, NULL)))
{
if (str && error_num == ER_SPIDER_COND_SKIP_NUM)
{
@@ -8778,9 +9364,7 @@ int spider_mysql_handler::append_group_by(
for (; group; group = group->next)
{
if ((error_num = spider_db_print_item_type((*group->item), NULL, spider,
- str, alias, alias_length,
- spider_dbton_mysql.dbton_id,
- FALSE, NULL)))
+ str, alias, alias_length, spider_dbton_mysql.dbton_id, FALSE, NULL)))
{
DBUG_RETURN(error_num);
}
@@ -8973,8 +9557,7 @@ int spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias(
{
if ((error_num =
spider_db_print_item_type((*order->item), NULL, spider, str, alias,
- alias_length, spider_dbton_mysql.dbton_id,
- FALSE, NULL)))
+ alias_length, spider_dbton_mysql.dbton_id, FALSE, NULL)))
{
DBUG_PRINT("info",("spider error=%d", error_num));
DBUG_RETURN(error_num);
@@ -10602,8 +11185,14 @@ int spider_mysql_handler::mk_bulk_tmp_table_and_bulk_start()
DBUG_PRINT("info",("spider this=%p", this));
if (!upd_tmp_tbl)
{
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+ LEX_CSTRING field_name = {STRING_WITH_LEN("a")};
+ if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
+ thd, table, &upd_tmp_tbl_prm, &field_name, update_sql.charset())))
+#else
if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
thd, table, &upd_tmp_tbl_prm, "a", update_sql.charset())))
+#endif
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -11295,8 +11884,7 @@ int spider_mysql_handler::show_table_status(
conn->mta_conn_mutex_unlock_later = FALSE;
if (error_num || (error_num = spider_db_errorno(conn)))
DBUG_RETURN(error_num);
- else
- {
+ else {
my_printf_error(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM,
ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0),
mysql_share->db_names_str[spider->conn_link_idx[link_idx]].ptr(),
@@ -11496,7 +12084,6 @@ int spider_mysql_handler::show_table_status(
DBUG_PRINT("info",("spider auto_increment_value=%llu",
share->lgtm_tblhnd_share->auto_increment_value));
}
-
DBUG_RETURN(0);
}
@@ -12740,6 +13327,8 @@ int spider_mysql_handler::append_from_and_tables_part(
) {
int error_num;
spider_string *str;
+ SPIDER_TABLE_HOLDER *table_holder;
+ TABLE_LIST *table_list;
DBUG_ENTER("spider_mysql_handler::append_from_and_tables_part");
DBUG_PRINT("info",("spider this=%p", this));
switch (sql_type)
@@ -12750,7 +13339,12 @@ int spider_mysql_handler::append_from_and_tables_part(
default:
DBUG_RETURN(0);
}
- error_num = spider_db_mysql_utility.append_from_and_tables(fields, str);
+ fields->set_pos_to_first_table_holder();
+ table_holder = fields->get_next_table_holder();
+ table_list = table_holder->table->pos_in_table_list;
+ error_num = spider_db_mysql_utility.append_from_and_tables(
+ table_holder->spider, fields, str,
+ table_list, fields->get_table_count());
DBUG_RETURN(error_num);
}
@@ -12834,9 +13428,7 @@ int spider_mysql_handler::append_item_type_part(
DBUG_RETURN(0);
}
error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length,
- spider_dbton_mysql.dbton_id,
- use_fields, fields);
+ alias, alias_length, spider_dbton_mysql.dbton_id, use_fields, fields);
DBUG_RETURN(error_num);
}
@@ -12884,21 +13476,18 @@ int spider_mysql_handler::append_list_item_select(
while ((item = it++))
{
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id,
- use_fields, fields)))
+ alias, alias_length, dbton_id, use_fields, fields)))
{
DBUG_RETURN(error_num);
}
field = *(fields->get_next_field_ptr());
if (field)
{
- item_name = field->field_name.str;
- length = field->field_name.length;
- }
- else
- {
- item_name = item->name.str;
- length = item->name.length;
+ item_name = SPIDER_field_name_str(field);
+ length = SPIDER_field_name_length(field);
+ } else {
+ item_name = SPIDER_item_name_str(item);
+ length = SPIDER_item_name_length(item);
}
if (str->reserve(
SPIDER_SQL_COMMA_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
@@ -12907,7 +13496,7 @@ int spider_mysql_handler::append_list_item_select(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
if ((error_num = spider_db_mysql_utility.append_name(str,
- item_name, length)))
+ item_name, length)))
{
DBUG_RETURN(error_num);
}
@@ -12962,9 +13551,7 @@ int spider_mysql_handler::append_group_by(
for (; order; order = order->next)
{
if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
- str, alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ str, alias, alias_length, dbton_id, use_fields, fields)))
{
DBUG_RETURN(error_num);
}
@@ -13022,9 +13609,7 @@ int spider_mysql_handler::append_order_by(
for (; order; order = order->next)
{
if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
- str, alias, alias_length,
- dbton_id,
- use_fields, fields)))
+ str, alias, alias_length, dbton_id, use_fields, fields)))
{
DBUG_RETURN(error_num);
}
@@ -13147,7 +13732,7 @@ int spider_mysql_copy_table::append_table_columns(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) (*field)->field_name.str, spider_dbton_mysql.dbton_id)))
+ (*field)->field_name, spider_dbton_mysql.dbton_id)))
DBUG_RETURN(error_num);
if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -13276,7 +13861,7 @@ int spider_mysql_copy_table::append_key_order_str(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) field->field_name.str, spider_dbton_mysql.dbton_id)))
+ field->field_name, spider_dbton_mysql.dbton_id)))
DBUG_RETURN(error_num);
if (key_part->key_part_flag & HA_REVERSE_SORT)
{
@@ -13306,7 +13891,7 @@ int spider_mysql_copy_table::append_key_order_str(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) field->field_name.str, spider_dbton_mysql.dbton_id)))
+ field->field_name, spider_dbton_mysql.dbton_id)))
DBUG_RETURN(error_num);
if (key_part->key_part_flag & HA_REVERSE_SORT)
{
@@ -13438,7 +14023,7 @@ int spider_mysql_copy_table::copy_key_row(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) field->field_name.str, spider_dbton_mysql.dbton_id)))
+ field->field_name, spider_dbton_mysql.dbton_id)))
DBUG_RETURN(error_num);
if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + joint_length + *length +
SPIDER_SQL_AND_LEN))
diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h
index 25cad01c66c..9a709f46c51 100644
--- a/storage/spider/spd_db_mysql.h
+++ b/storage/spider/spd_db_mysql.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Kentoku Shiba
+/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,8 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "tztime.h"
-
class spider_db_mysql_util: public spider_db_util
{
public:
@@ -121,9 +119,46 @@ public:
String *from
);
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
+ int append_table(
+ ha_spider *spider,
+ spider_fields *fields,
+ spider_string *str,
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos,
+ TABLE_LIST **cond_table_list_ptr,
+ bool top_down,
+ bool first
+ );
+ int append_tables_top_down(
+ ha_spider *spider,
+ spider_fields *fields,
+ spider_string *str,
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos,
+ TABLE_LIST **cond_table_list_ptr
+ );
+ int append_tables_top_down_check(
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos
+ );
+ int append_embedding_tables(
+ ha_spider *spider,
+ spider_fields *fields,
+ spider_string *str,
+ TABLE_LIST *table_list,
+ TABLE_LIST **used_table_list,
+ uint *current_pos,
+ TABLE_LIST **cond_table_list_ptr
+ );
int append_from_and_tables(
+ ha_spider *spider,
spider_fields *fields,
- spider_string *str
+ spider_string *str,
+ TABLE_LIST *table_list,
+ uint table_count
);
int reappend_tables(
spider_fields *fields,
@@ -147,6 +182,7 @@ public:
ulong *lengths;
ulong *lengths_first;
uint field_count;
+ uint record_size;
bool cloned;
spider_db_mysql_row();
~spider_db_mysql_row();
@@ -175,6 +211,7 @@ public:
TABLE *tmp_table,
spider_string *str
);
+ uint get_byte_size();
};
class spider_db_mysql_result: public spider_db_result
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index b852a43282c..82a1e9a0fbc 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Kentoku Shiba
+/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -152,6 +152,9 @@ static const int spider_db_table_lock_len[] =
sizeof(" in exclusive mode") - 1
};
+/* UTC time zone for timestamp columns */
+extern Time_zone *UTC;
+
int spider_db_oracle_get_error(
sword res,
dvoid *hndlp,
@@ -516,6 +519,7 @@ SPIDER_DB_ROW *spider_db_oracle_row::clone()
clone_row->db_conn = db_conn;
clone_row->result = result;
clone_row->field_count = field_count;
+ clone_row->record_size = record_size;
clone_row->access_charset = access_charset;
clone_row->cloned = TRUE;
if (clone_row->init())
@@ -568,6 +572,13 @@ int spider_db_oracle_row::store_to_tmp_table(
DBUG_RETURN(tmp_table->file->ha_write_row(tmp_table->record[0]));
}
+uint spider_db_oracle_row::get_byte_size()
+{
+ DBUG_ENTER("spider_db_oracle_row::get_byte_size");
+ DBUG_PRINT("info",("spider this=%p", this));
+ DBUG_RETURN(record_size);
+}
+
int spider_db_oracle_row::init()
{
char *tmp_val;
@@ -693,6 +704,7 @@ int spider_db_oracle_row::fetch()
uint i;
DBUG_ENTER("spider_db_oracle_row::fetch");
DBUG_PRINT("info",("spider this=%p", this));
+ record_size = 0;
for (i = 0; i < field_count; i++)
{
if (ind[i] == -1)
@@ -754,6 +766,7 @@ int spider_db_oracle_row::fetch()
}
}
row_size[i] = val_str[i].length();
+ record_size += row_size[i];
}
DBUG_RETURN(0);
}
@@ -908,6 +921,7 @@ SPIDER_DB_ROW *spider_db_oracle_result::fetch_row_from_tmp_table(
str += row.row_size[i];
}
}
+ row.record_size = tmp_str2.length();
DBUG_RETURN((SPIDER_DB_ROW *) &row);
}
@@ -2410,8 +2424,13 @@ void spider_db_oracle::set_dup_key_idx(
key_name = spider->share->tgt_pk_names[all_link_idx];
key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx];
} else {
+#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
+ key_name = (char *) table->s->key_info[roop_count].name.str;
+ key_name_length = table->s->key_info[roop_count].name.length;
+#else
key_name = table->s->key_info[roop_count].name;
key_name_length = strlen(key_name);
+#endif
}
memcpy(tmp_pos, key_name, key_name_length + 1);
DBUG_PRINT("info",("spider key_name=%s", key_name));
@@ -2529,9 +2548,12 @@ int spider_db_oracle_util::append_column_value(
spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin);
String *ptr;
uint length;
+ Time_zone *saved_time_zone = thd->variables.time_zone;
DBUG_ENTER("spider_db_oracle_util::append_column_value");
tmp_str.init_calc_mem(181);
+ thd->variables.time_zone = UTC;
+
if (new_ptr)
{
if (
@@ -2625,6 +2647,9 @@ int spider_db_oracle_util::append_column_value(
ptr = field->val_str(tmp_str.get_str());
tmp_str.mem_calc();
}
+
+ thd->variables.time_zone = saved_time_zone;
+
DBUG_PRINT("info", ("spider field->type() is %d", field->type()));
DBUG_PRINT("info", ("spider ptr->length() is %d", ptr->length()));
/*
@@ -2909,12 +2934,13 @@ int spider_db_oracle_util::open_item_func(
uint dbton_id = spider_dbton_oracle.dbton_id;
int error_num;
Item *item, **item_list = item_func->arguments();
+ Field *field;
uint roop_count, item_count = item_func->argument_count(), start_item = 0;
const char *func_name = SPIDER_SQL_NULL_CHAR_STR,
- *separete_str = SPIDER_SQL_NULL_CHAR_STR,
+ *separator_str = SPIDER_SQL_NULL_CHAR_STR,
*last_str = SPIDER_SQL_NULL_CHAR_STR;
int func_name_length = SPIDER_SQL_NULL_CHAR_LEN,
- separete_str_length = SPIDER_SQL_NULL_CHAR_LEN,
+ separator_str_length = SPIDER_SQL_NULL_CHAR_LEN,
last_str_length = SPIDER_SQL_NULL_CHAR_LEN;
int use_pushdown_udf;
bool merge_func = FALSE;
@@ -2980,7 +3006,7 @@ int spider_db_oracle_util::open_item_func(
) {
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (
!strncasecmp("case", func_name, func_name_length)
@@ -2996,7 +3022,7 @@ int spider_db_oracle_util::open_item_func(
if (item_func_case->first_expr_num != -1)
{
if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->first_expr_num], spider, str,
+ item_list[item_func_case->first_expr_num], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -3010,7 +3036,7 @@ int spider_db_oracle_util::open_item_func(
str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[roop_count], spider, str,
+ item_list[roop_count], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3020,7 +3046,7 @@ int spider_db_oracle_util::open_item_func(
str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[roop_count + 1], spider, str,
+ item_list[roop_count + 1], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -3033,7 +3059,7 @@ int spider_db_oracle_util::open_item_func(
str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN);
}
if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->else_expr_num], spider, str,
+ item_list[item_func_case->else_expr_num], NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -3070,7 +3096,7 @@ int spider_db_oracle_util::open_item_func(
) {
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (
!strncasecmp("convert", func_name, func_name_length)
@@ -3095,7 +3121,7 @@ int spider_db_oracle_util::open_item_func(
) {
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (func_name_length == 9 &&
!strncasecmp("isnottrue", func_name, func_name_length)
@@ -3122,8 +3148,8 @@ int spider_db_oracle_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
break;
}
} else if (func_name_length == 12)
@@ -3211,7 +3237,7 @@ int spider_db_oracle_util::open_item_func(
{
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
} else if (!strncasecmp("timestampdiff", func_name, func_name_length))
{
@@ -3274,7 +3300,7 @@ int spider_db_oracle_util::open_item_func(
str->q_append(interval_str, interval_len);
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
- if ((error_num = spider_db_print_item_type(item_list[0], spider,
+ if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3283,7 +3309,7 @@ int spider_db_oracle_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
- if ((error_num = spider_db_print_item_type(item_list[1], spider,
+ if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
str, alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -3549,8 +3575,9 @@ int spider_db_oracle_util::open_item_func(
str->q_append(SPIDER_SQL_OPEN_PAREN_STR,
SPIDER_SQL_OPEN_PAREN_LEN);
}
- if ((error_num = spider_db_print_item_type(item_list[0], spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[0], NULL,
+ spider, str, alias, alias_length, dbton_id, use_fields,
+ fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -3567,8 +3594,9 @@ int spider_db_oracle_util::open_item_func(
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
}
- if ((error_num = spider_db_print_item_type(item_list[1], spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[1], NULL,
+ spider, str, alias, alias_length, dbton_id, use_fields,
+ fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -3613,8 +3641,9 @@ int spider_db_oracle_util::open_item_func(
case INTERVAL_MINUTE:
case INTERVAL_SECOND:
case INTERVAL_MICROSECOND:
- if ((error_num = spider_db_print_item_type(item_list[0], spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[0], NULL,
+ spider, str, alias, alias_length, dbton_id, use_fields,
+ fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -3629,8 +3658,9 @@ int spider_db_oracle_util::open_item_func(
str->q_append(SPIDER_SQL_PLUS_STR, SPIDER_SQL_PLUS_LEN);
}
}
- if ((error_num = spider_db_print_item_type(item_list[1], spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type(item_list[1], NULL,
+ spider, str, alias, alias_length, dbton_id, use_fields,
+ fields)))
DBUG_RETURN(error_num);
if (str)
{
@@ -3709,15 +3739,15 @@ int spider_db_oracle_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
case Item_func::NOW_FUNC:
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
case Item_func::CHAR_TYPECAST_FUNC:
DBUG_PRINT("info",("spider CHAR_TYPECAST_FUNC"));
@@ -3843,15 +3873,15 @@ int spider_db_oracle_util::open_item_func(
{
func_name = SPIDER_SQL_NOT_IN_STR;
func_name_length = SPIDER_SQL_NOT_IN_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
} else {
func_name = SPIDER_SQL_IN_STR;
func_name_length = SPIDER_SQL_IN_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
}
@@ -3861,13 +3891,13 @@ int spider_db_oracle_util::open_item_func(
{
func_name = SPIDER_SQL_NOT_BETWEEN_STR;
func_name_length = SPIDER_SQL_NOT_BETWEEN_LEN;
- separete_str = SPIDER_SQL_AND_STR;
- separete_str_length = SPIDER_SQL_AND_LEN;
+ separator_str = SPIDER_SQL_AND_STR;
+ separator_str_length = SPIDER_SQL_AND_LEN;
} else {
func_name = (char*) item_func->func_name();
func_name_length = strlen(func_name);
- separete_str = SPIDER_SQL_AND_STR;
- separete_str_length = SPIDER_SQL_AND_LEN;
+ separator_str = SPIDER_SQL_AND_STR;
+ separator_str_length = SPIDER_SQL_AND_LEN;
}
break;
case Item_func::UDF_FUNC:
@@ -3888,8 +3918,8 @@ int spider_db_oracle_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -3909,10 +3939,10 @@ int spider_db_oracle_util::open_item_func(
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
if (item_func->result_type() == STRING_RESULT)
- DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
else
- DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
+ DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
case Item_func::FT_FUNC:
if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY)
@@ -3924,8 +3954,8 @@ int spider_db_oracle_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN);
}
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -3942,8 +3972,8 @@ int spider_db_oracle_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -3974,8 +4004,8 @@ int spider_db_oracle_util::open_item_func(
}
func_name = SPIDER_SQL_COMMA_STR;
func_name_length = SPIDER_SQL_COMMA_LEN;
- separete_str = SPIDER_SQL_COMMA_STR;
- separete_str_length = SPIDER_SQL_COMMA_LEN;
+ separator_str = SPIDER_SQL_COMMA_STR;
+ separator_str_length = SPIDER_SQL_COMMA_LEN;
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
@@ -4008,23 +4038,28 @@ int spider_db_oracle_util::open_item_func(
}
DBUG_PRINT("info",("spider func_name = %s", func_name));
DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
- DBUG_PRINT("info",("spider separete_str = %s", separete_str));
- DBUG_PRINT("info",("spider separete_str_length = %d", separete_str_length));
+ DBUG_PRINT("info",("spider separator_str = %s", separator_str));
+ DBUG_PRINT("info",("spider separator_str_length = %d", separator_str_length));
DBUG_PRINT("info",("spider last_str = %s", last_str));
DBUG_PRINT("info",("spider last_str_length = %d", last_str_length));
if (item_count)
{
+ /* Find the field in the list of items of the expression tree */
+ field = spider_db_find_field_in_item_list(item_list,
+ item_count, start_item,
+ str,
+ func_name, func_name_length);
item_count--;
for (roop_count = start_item; roop_count < item_count; roop_count++)
{
item = item_list[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, field, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (roop_count == 1)
{
- func_name = separete_str;
- func_name_length = separete_str_length;
+ func_name = separator_str;
+ func_name_length = separator_str_length;
}
if (str)
{
@@ -4036,7 +4071,7 @@ int spider_db_oracle_util::open_item_func(
}
}
item = item_list[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, field, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -4050,7 +4085,7 @@ int spider_db_oracle_util::open_item_func(
str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN);
}
item = item_list[0];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -4138,7 +4173,7 @@ int spider_db_oracle_util::open_item_sum_func(
for (roop_count = 0; roop_count < item_count; roop_count++)
{
item = args[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
if (str)
@@ -4149,7 +4184,7 @@ int spider_db_oracle_util::open_item_sum_func(
}
}
item = args[roop_count];
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
DBUG_RETURN(error_num);
}
@@ -4209,8 +4244,11 @@ int spider_db_oracle_util::append_escaped_util(
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int spider_db_oracle_util::append_from_and_tables(
+ ha_spider *spider,
spider_fields *fields,
- spider_string *str
+ spider_string *str,
+ TABLE_LIST *table_list,
+ uint table_count
) {
SPIDER_TABLE_HOLDER *table_holder;
int error_num;
@@ -4745,7 +4783,7 @@ int spider_oracle_share::create_column_name_str()
str->init_calc_mem(196);
str->set_charset(spider_share->access_charset);
if ((error_num = spider_db_append_name_with_quote_str(str,
- (char *) (*field)->field_name.str, dbton_id)))
+ (*field)->field_name, dbton_id)))
goto error;
}
DBUG_RETURN(0);
@@ -4778,7 +4816,7 @@ int spider_oracle_share::convert_key_hint_str()
DBUG_ENTER("spider_oracle_share::convert_key_hint_str");
if (spider_share->access_charset->cset != system_charset_info->cset)
{
- /* need convertion */
+ /* need conversion */
for (roop_count = 0, tmp_key_hint = key_hint;
roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++)
{
@@ -5188,6 +5226,10 @@ int spider_oracle_share::append_table_select()
spider_string *str = table_select;
TABLE_SHARE *table_share = spider_share->table_share;
DBUG_ENTER("spider_oracle_share::append_table_select");
+
+ if (!*table_share->field)
+ DBUG_RETURN(0);
+
for (field = table_share->field; *field; field++)
{
field_length = column_name_str[(*field)->field_index].length();
@@ -5212,6 +5254,10 @@ int spider_oracle_share::append_key_select(
TABLE_SHARE *table_share = spider_share->table_share;
const KEY *key_info = &table_share->key_info[idx];
DBUG_ENTER("spider_oracle_share::append_key_select");
+
+ if (!spider_user_defined_key_parts(key_info))
+ DBUG_RETURN(0);
+
for (key_part = key_info->key_part, part_num = 0;
part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
{
@@ -6414,7 +6460,7 @@ int spider_oracle_handler::append_update_columns(
{
value = vi++;
if ((error_num = spider_db_print_item_type(
- (Item *) field, spider, str, alias, alias_length,
+ (Item *) field, NULL, spider, str, alias, alias_length,
spider_dbton_oracle.dbton_id, FALSE, NULL)))
{
if (
@@ -6432,8 +6478,8 @@ int spider_oracle_handler::append_update_columns(
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
}
if ((error_num = spider_db_print_item_type(
- (Item *) value, spider, str, alias, alias_length,
- spider_dbton_oracle.dbton_id, FALSE, NULL)))
+ (Item *) value, ((Item_field *) field)->field, spider, str,
+ alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
DBUG_RETURN(error_num);
if (str)
{
@@ -6834,7 +6880,7 @@ int spider_oracle_handler::check_item_type(
int error_num;
DBUG_ENTER("spider_oracle_handler::check_item_type");
DBUG_PRINT("info",("spider this=%p", this));
- error_num = spider_db_print_item_type(item, spider, NULL, NULL, 0,
+ error_num = spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0,
spider_dbton_oracle.dbton_id, FALSE, NULL);
DBUG_RETURN(error_num);
}
@@ -7437,17 +7483,64 @@ int spider_oracle_handler::append_update_where(
) {
uint field_name_length;
Field **field;
+ THD *thd = spider->trx->thd;
SPIDER_SHARE *share = spider->share;
+ bool no_pk = (table->s->primary_key == MAX_KEY);
DBUG_ENTER("spider_oracle_handler::append_update_where");
+ uint str_len_bakup = str->length();
if (str->reserve(SPIDER_SQL_WHERE_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- for (field = table->field; *field; field++)
- {
- if (
- table->s->primary_key == MAX_KEY ||
- bitmap_is_set(table->read_set, (*field)->field_index)
+ if (
+ no_pk ||
+ spider_param_use_cond_other_than_pk_for_update(thd)
+ ) {
+ for (field = table->field; *field; field++)
+ {
+ if (
+ no_pk ||
+ bitmap_is_set(table->read_set, (*field)->field_index)
+ ) {
+ field_name_length =
+ oracle_share->column_name_str[(*field)->field_index].length();
+ if ((*field)->is_null(ptr_diff))
+ {
+ if (str->reserve(field_name_length +
+ /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
+ SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ oracle_share->append_column_name(str, (*field)->field_index);
+ str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN);
+ } else {
+ if (str->reserve(field_name_length +
+ /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
+ SPIDER_SQL_EQUAL_LEN))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ oracle_share->append_column_name(str, (*field)->field_index);
+ str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
+ (*field)->move_field_offset(ptr_diff);
+ if (
+ spider_db_oracle_utility.
+ append_column_value(spider, str, *field, NULL,
+ share->access_charset) ||
+ str->reserve(SPIDER_SQL_AND_LEN)
+ )
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ (*field)->move_field_offset(-ptr_diff);
+ }
+ str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
+ }
+ }
+ } else {
+ KEY *key_info = &table->key_info[table->s->primary_key];
+ KEY_PART_INFO *key_part;
+ uint part_num;
+ for (
+ key_part = key_info->key_part, part_num = 0;
+ part_num < spider_user_defined_key_parts(key_info);
+ key_part++, part_num++
) {
+ field = &key_part->field;
field_name_length =
oracle_share->column_name_str[(*field)->field_index].length();
if ((*field)->is_null(ptr_diff))
@@ -7478,9 +7571,13 @@ int spider_oracle_handler::append_update_where(
str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
}
}
-/*
- str->length(str->length() - SPIDER_SQL_AND_LEN);
-*/
+ if (str->length() == str_len_bakup + SPIDER_SQL_WHERE_LEN)
+ {
+ /* no condition */
+ str->length(str_len_bakup);
+ } else {
+ str->length(str->length() - SPIDER_SQL_AND_LEN);
+ }
if (str->reserve(SPIDER_SQL_LIMIT1_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_LIMIT1_STR, SPIDER_SQL_LIMIT1_LEN);
@@ -7615,7 +7712,7 @@ int spider_oracle_handler::append_condition(
}
}
if ((error_num = spider_db_print_item_type(
- (Item *) tmp_cond->cond, spider, str, alias, alias_length,
+ (Item *) tmp_cond->cond, NULL, spider, str, alias, alias_length,
spider_dbton_oracle.dbton_id, FALSE, NULL)))
{
if (str && error_num == ER_SPIDER_COND_SKIP_NUM)
@@ -7937,8 +8034,8 @@ int spider_oracle_handler::append_group_by(
str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN);
for (; group; group = group->next)
{
- if ((error_num = spider_db_print_item_type((*group->item), spider, str,
- alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
+ if ((error_num = spider_db_print_item_type((*group->item), NULL, spider,
+ str, alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
{
DBUG_RETURN(error_num);
}
@@ -8276,8 +8373,8 @@ int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias(
order = order->next)
{
if ((error_num =
- spider_db_print_item_type((*order->item), spider, &sql_part, alias,
- alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
+ spider_db_print_item_type((*order->item), NULL, spider, &sql_part,
+ alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
{
DBUG_PRINT("info",("spider error=%d", error_num));
DBUG_RETURN(error_num);
@@ -8367,7 +8464,7 @@ int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias(
order = order->next)
{
if ((error_num =
- spider_db_print_item_type((*order->item), spider, str, alias,
+ spider_db_print_item_type((*order->item), NULL, spider, str, alias,
alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
{
DBUG_PRINT("info",("spider error=%d", error_num));
@@ -10199,8 +10296,14 @@ int spider_oracle_handler::mk_bulk_tmp_table_and_bulk_start()
DBUG_PRINT("info",("spider this=%p", this));
if (!upd_tmp_tbl)
{
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+ LEX_CSTRING field_name = {STRING_WITH_LEN("a")};
+ if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
+ thd, table, &upd_tmp_tbl_prm, &field_name, update_sql.charset())))
+#else
if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
thd, table, &upd_tmp_tbl_prm, "a", update_sql.charset())))
+#endif
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -12454,6 +12557,8 @@ int spider_oracle_handler::append_from_and_tables_part(
) {
int error_num;
spider_string *str;
+ SPIDER_TABLE_HOLDER *table_holder;
+ TABLE_LIST *table_list;
DBUG_ENTER("spider_oracle_handler::append_from_and_tables_part");
DBUG_PRINT("info",("spider this=%p", this));
switch (sql_type)
@@ -12464,7 +12569,11 @@ int spider_oracle_handler::append_from_and_tables_part(
default:
DBUG_RETURN(0);
}
- error_num = spider_db_oracle_utility.append_from_and_tables(fields, str);
+ fields->set_pos_to_first_table_holder();
+ table_holder = fields->get_next_table_holder();
+ table_list = table_holder->table->pos_in_table_list;
+ error_num = spider_db_oracle_utility.append_from_and_tables(fields, str,
+ table_list);
DBUG_RETURN(error_num);
}
@@ -12547,8 +12656,8 @@ int spider_oracle_handler::append_item_type_part(
default:
DBUG_RETURN(0);
}
- error_num = spider_db_print_item_type(item, spider, str, alias, alias_length,
- spider_dbton_oracle.dbton_id, use_fields, fields);
+ error_num = spider_db_print_item_type(item, NULL, spider, str,
+ alias, alias_length, spider_dbton_oracle.dbton_id, use_fields, fields);
DBUG_RETURN(error_num);
}
@@ -12589,18 +12698,26 @@ int spider_oracle_handler::append_list_item_select(
uint dbton_id = spider_dbton_oracle.dbton_id, length;
List_iterator_fast<Item> it(*select);
Item *item;
- Field **field_ptr;
+ Field *field;
+ const char *item_name;
DBUG_ENTER("spider_oracle_handler::append_list_item_select");
DBUG_PRINT("info",("spider this=%p", this));
while ((item = it++))
{
- if ((error_num = spider_db_print_item_type(item, spider, str,
+ if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
alias, alias_length, dbton_id, use_fields, fields)))
{
DBUG_RETURN(error_num);
}
- field_ptr = fields->get_next_field_ptr();
- length = strlen((*field_ptr)->field_name);
+ field = *(fields->get_next_field_ptr());
+ if (field)
+ {
+ item_name = SPIDER_field_name_str(field);
+ length = SPIDER_field_name_length(field);
+ } else {
+ item_name = SPIDER_item_name_str(item);
+ length = SPIDER_item_name_length(item);
+ }
if (str->reserve(
SPIDER_SQL_COMMA_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
SPIDER_SQL_SPACE_LEN + length
@@ -12608,7 +12725,7 @@ int spider_oracle_handler::append_list_item_select(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
if ((error_num = spider_db_oracle_utility.append_name(str,
- (*field_ptr)->field_name, length)))
+ item_name, length)))
{
DBUG_RETURN(error_num);
}
@@ -12662,8 +12779,8 @@ int spider_oracle_handler::append_group_by(
str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN);
for (; order; order = order->next)
{
- if ((error_num = spider_db_print_item_type((*order->item), spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields)))
{
DBUG_RETURN(error_num);
}
@@ -12720,8 +12837,8 @@ int spider_oracle_handler::append_order_by(
str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
for (; order; order = order->next)
{
- if ((error_num = spider_db_print_item_type((*order->item), spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
+ if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
+ str, alias, alias_length, dbton_id, use_fields, fields)))
{
DBUG_RETURN(error_num);
}
@@ -12831,7 +12948,7 @@ int spider_oracle_copy_table::append_table_columns(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) (*field)->field_name.str, spider_dbton_oracle.dbton_id)))
+ (*field)->field_name, spider_dbton_oracle.dbton_id)))
DBUG_RETURN(error_num);
if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -12977,7 +13094,7 @@ int spider_oracle_copy_table::append_key_order_str(
sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql_part,
- (char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
+ field->field_name, spider_dbton_oracle.dbton_id)))
DBUG_RETURN(error_num);
if (key_part->key_part_flag & HA_REVERSE_SORT)
{
@@ -13011,7 +13128,7 @@ int spider_oracle_copy_table::append_key_order_str(
sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql_part,
- (char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
+ field->field_name, spider_dbton_oracle.dbton_id)))
DBUG_RETURN(error_num);
if (key_part->key_part_flag & HA_REVERSE_SORT)
{
@@ -13075,7 +13192,7 @@ int spider_oracle_copy_table::append_key_order_str(
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
+ field->field_name, spider_dbton_oracle.dbton_id)))
DBUG_RETURN(error_num);
if (key_part->key_part_flag & HA_REVERSE_SORT)
{
@@ -13108,7 +13225,7 @@ int spider_oracle_copy_table::append_key_order_str(
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
+ field->field_name, spider_dbton_oracle.dbton_id)))
DBUG_RETURN(error_num);
if (key_part->key_part_flag & HA_REVERSE_SORT)
{
@@ -13316,7 +13433,7 @@ int spider_oracle_copy_table::copy_key_row(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
+ field->field_name, spider_dbton_oracle.dbton_id)))
DBUG_RETURN(error_num);
if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + joint_length + *length +
SPIDER_SQL_AND_LEN))
diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h
index 6962ff4884f..d0bd1757418 100644
--- a/storage/spider/spd_db_oracle.h
+++ b/storage/spider/spd_db_oracle.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Kentoku Shiba
+/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,8 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "tztime.h"
-
class spider_db_oracle;
class spider_db_oracle_result;
@@ -131,8 +129,11 @@ public:
);
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int append_from_and_tables(
+ ha_spider *spider,
spider_fields *fields,
- spider_string *str
+ spider_string *str,
+ TABLE_LIST *table_list,
+ uint table_count
);
int reappend_tables(
spider_fields *fields,
@@ -167,6 +168,7 @@ public:
ub2 *coltp;
ub2 *colsz;
uint field_count;
+ uint record_size;
ulong *row_size;
ulong *row_size_first;
CHARSET_INFO *access_charset;
@@ -200,6 +202,7 @@ public:
TABLE *tmp_table,
spider_string *str
);
+ uint get_byte_size();
/* for oracle */
int init();
void deinit();
diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc
index d56848f5dbd..65d5142e1f1 100644
--- a/storage/spider/spd_direct_sql.cc
+++ b/storage/spider/spd_direct_sql.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2017 Kentoku Shiba
+/* Copyright (C) 2009-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,6 +27,7 @@
#include "sql_partition.h"
#include "sql_base.h"
#include "sql_servers.h"
+#include "tztime.h"
#endif
#include "spd_err.h"
#include "spd_param.h"
@@ -65,6 +66,9 @@ extern pthread_mutex_t spider_conn_id_mutex;
extern pthread_mutex_t spider_ipport_conn_mutex;
extern ulonglong spider_conn_id;
+/* UTC time zone for timestamp columns */
+extern Time_zone *UTC;
+
uint spider_udf_calc_hash(
char *key,
uint mod
@@ -132,7 +136,7 @@ int spider_udf_direct_sql_create_table_list(
&direct_sql->tables, sizeof(TABLE*) * table_count,
&tmp_name_ptr, sizeof(char) * (
table_name_list_length +
- thd->db.length * table_count +
+ SPIDER_THD_db_length(thd) * table_count +
2 * table_count
),
&direct_sql->iop, sizeof(int) * table_count,
@@ -163,11 +167,11 @@ int spider_udf_direct_sql_create_table_list(
tmp_name_ptr += length + 1;
tmp_ptr = tmp_ptr3 + 1;
} else {
- if (thd->db.str)
+ if (SPIDER_THD_db_str(thd))
{
- memcpy(tmp_name_ptr, thd->db.str,
- thd->db.length + 1);
- tmp_name_ptr += thd->db.length + 1;
+ memcpy(tmp_name_ptr, SPIDER_THD_db_str(thd),
+ SPIDER_THD_db_length(thd) + 1);
+ tmp_name_ptr += SPIDER_THD_db_length(thd) + 1;
} else {
direct_sql->db_names[roop_count] = (char *) "";
}
@@ -395,6 +399,13 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
int *need_mon;
DBUG_ENTER("spider_udf_direct_sql_create_conn");
+ if (unlikely(!UTC))
+ {
+ /* UTC time zone for timestamp columns */
+ String tz_00_name(STRING_WITH_LEN("+00:00"), &my_charset_bin);
+ UTC = my_tz_find(current_thd, &tz_00_name);
+ }
+
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (direct_sql->access_mode == 0)
{
@@ -976,8 +987,7 @@ error:
start_ptr, TRUE, &param_string_parse))) \
direct_sql->SPIDER_PARAM_STR_LEN(param_name) = \
strlen(direct_sql->param_name); \
- else \
- { \
+ else { \
error_num = param_string_parse.print_param_error(); \
goto error; \
} \
@@ -1330,10 +1340,10 @@ int spider_udf_set_direct_sql_param_default(
if (!direct_sql->tgt_default_db_name)
{
DBUG_PRINT("info",("spider create default tgt_default_db_name"));
- direct_sql->tgt_default_db_name_length = trx->thd->db.length;
+ direct_sql->tgt_default_db_name_length = SPIDER_THD_db_length(trx->thd);
if (
!(direct_sql->tgt_default_db_name = spider_create_string(
- trx->thd->db.str,
+ SPIDER_THD_db_str(trx->thd),
direct_sql->tgt_default_db_name_length))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
@@ -1686,14 +1696,29 @@ long long spider_direct_sql_body(
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
{
#ifdef SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
- LEX_CSTRING db_name= { direct_sql->db_names[roop_count],
- strlen(direct_sql->db_names[roop_count]) };
- LEX_CSTRING tbl_name= { direct_sql->table_names[roop_count],
- strlen(direct_sql->table_names[roop_count]) };
+#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
+ LEX_CSTRING db_name =
+ {
+ direct_sql->db_names[roop_count],
+ strlen(direct_sql->db_names[roop_count])
+ };
+ LEX_CSTRING tbl_name =
+ {
+ direct_sql->table_names[roop_count],
+ strlen(direct_sql->table_names[roop_count])
+ };
table_list.init_one_table(&db_name, &tbl_name, 0, TL_WRITE);
#else
- table_list.db = direct_sql->db_names[roop_count];
- table_list.table_name = direct_sql->table_names[roop_count];
+ table_list.init_one_table(direct_sql->db_names[roop_count],
+ strlen(direct_sql->db_names[roop_count]),
+ direct_sql->table_names[roop_count],
+ strlen(direct_sql->table_names[roop_count]),
+ direct_sql->table_names[roop_count], TL_WRITE);
+#endif
+#else
+ SPIDER_TABLE_LIST_db_str(&table_list) = direct_sql->db_names[roop_count];
+ SPIDER_TABLE_LIST_table_name_str(&table_list) =
+ direct_sql->table_names[roop_count];
#endif
if (!(direct_sql->tables[roop_count] =
SPIDER_find_temporary_table(thd, &table_list)))
@@ -1706,16 +1731,28 @@ long long spider_direct_sql_body(
error_num = ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM;
my_printf_error(ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM,
ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_STR,
- MYF(0), table_list.db.str, table_list.table_name.str);
+ MYF(0), SPIDER_TABLE_LIST_db_str(&table_list),
+ SPIDER_TABLE_LIST_table_name_str(&table_list));
goto error;
#if MYSQL_VERSION_ID < 50500
#else
}
TABLE_LIST *tables = &direct_sql->table_list[roop_count];
-
- table_list.init_one_table(&table_list.db, &table_list.table_name, 0, TL_WRITE);
- tables->mdl_request.init(MDL_key::TABLE, table_list.db.str,
- table_list.table_name.str, MDL_SHARED_WRITE, MDL_TRANSACTION);
+#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
+ table_list.init_one_table(
+ &table_list.db, &table_list.table_name, 0, TL_WRITE);
+#else
+ tables->init_one_table(
+ SPIDER_TABLE_LIST_db_str(&table_list),
+ SPIDER_TABLE_LIST_db_length(&table_list),
+ SPIDER_TABLE_LIST_table_name_str(&table_list),
+ SPIDER_TABLE_LIST_table_name_length(&table_list),
+ SPIDER_TABLE_LIST_table_name_str(&table_list), TL_WRITE);
+#endif
+ tables->mdl_request.init(MDL_key::TABLE,
+ SPIDER_TABLE_LIST_db_str(&table_list),
+ SPIDER_TABLE_LIST_table_name_str(&table_list),
+ MDL_SHARED_WRITE, MDL_TRANSACTION);
if (!direct_sql->table_list_first)
{
direct_sql->table_list_first = tables;
diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h
index ef7e6ff88c8..5e66a912582 100644
--- a/storage/spider/spd_environ.h
+++ b/storage/spider/spd_environ.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba & 2017 MariaDB corp
+/* Copyright (C) 2008-2018 Kentoku Shiba & 2017 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,4 +37,17 @@
#define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
#endif
+
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100300
+#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
+#endif
+
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100309
+#define SPIDER_MDEV_16246
+#endif
+
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
+#define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
+#define SPIDER_SQL_CACHE_IS_IN_LEX
+#endif
#endif /* SPD_ENVIRON_INCLUDED */
diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc
index 0f8479b6ca6..3b57092c4ce 100644
--- a/storage/spider/spd_group_by_handler.cc
+++ b/storage/spider/spd_group_by_handler.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -172,6 +172,7 @@ int spider_fields::make_link_idx_chain(
add_link_idx_holder->table_link_idx_holder =
dup_link_idx_holder->table_link_idx_holder;
add_link_idx_holder->link_idx = dup_link_idx_holder->link_idx;
+ add_link_idx_holder->link_status = dup_link_idx_holder->link_status;
link_idx_holder->next = add_link_idx_holder;
}
link_idx_holder = link_idx_holder->next;
@@ -446,6 +447,8 @@ bool spider_fields::check_link_ok_chain(
for (current_link_idx_chain = first_link_idx_chain; current_link_idx_chain;
current_link_idx_chain = current_link_idx_chain->next)
{
+ DBUG_PRINT("info",("spider current_link_idx_chain=%p", current_link_idx_chain));
+ DBUG_PRINT("info",("spider current_link_idx_chain->link_status=%d", current_link_idx_chain->link_status));
if (current_link_idx_chain->link_status == SPIDER_LINK_STATUS_OK)
{
first_ok_link_idx_chain = current_link_idx_chain;
@@ -819,7 +822,7 @@ void spider_fields::choose_a_conn(
current_conn_holder = first_conn_holder;
}
- DBUG_PRINT("info",("spider choosed connection is %p",
+ DBUG_PRINT("info",("spider chosen connection is %p",
current_conn_holder->conn));
last_conn_holder = current_conn_holder;
current_conn_holder = current_conn_holder->next;
@@ -924,8 +927,8 @@ SPIDER_TABLE_HOLDER *spider_fields::add_table(
bool spider_fields::all_query_fields_are_query_table_members()
{
SPIDER_FIELD_HOLDER *field_holder;
- DBUG_ENTER("spider_fields::all_fields_are_query_table_fields");
- DBUG_PRINT("info", ("spider this=%p", this));
+ DBUG_ENTER("spider_fields::all_query_fields_are_query_table_members");
+ DBUG_PRINT("info",("spider this=%p", this));
set_pos_to_first_field_holder();
while ((field_holder = get_next_field_holder()))
@@ -977,6 +980,25 @@ SPIDER_TABLE_HOLDER *spider_fields::get_next_table_holder(
DBUG_RETURN(return_table_holder);
}
+SPIDER_TABLE_HOLDER *spider_fields::get_table_holder(TABLE *table)
+{
+ uint table_num;
+ DBUG_ENTER("spider_fields::get_table_holder");
+ DBUG_PRINT("info",("spider this=%p", this));
+ for (table_num = 0; table_num < table_count; ++table_num)
+ {
+ if (table_holder[table_num].table == table)
+ DBUG_RETURN(&table_holder[table_num]);
+ }
+ DBUG_RETURN(NULL);
+}
+
+uint spider_fields::get_table_count()
+{
+ DBUG_ENTER("spider_fields::get_table_count");
+ DBUG_RETURN(table_count);
+}
+
int spider_fields::add_field(
Field *field_arg
) {
@@ -1191,7 +1213,8 @@ int spider_group_by_handler::init_scan()
*field;
field++
) {
- DBUG_PRINT("info",("spider field_name=%s", (*field)->field_name.str));
+ DBUG_PRINT("info",("spider field_name=%s",
+ SPIDER_field_name_str(*field)));
}
#endif
@@ -1757,7 +1780,7 @@ group_by_handler *spider_create_group_by_handler(
{
DBUG_PRINT("info",("spider select item=%p", item));
if (spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0,
- roop_count, TRUE, fields_arg))
+ roop_count, TRUE, fields_arg))
{
DBUG_PRINT("info",("spider dbton_id=%d can't create select", roop_count));
spider_clear_bit(dbton_bitmap, roop_count);
@@ -1767,12 +1790,21 @@ group_by_handler *spider_create_group_by_handler(
}
if (keep_going)
{
+ if (spider_dbton[roop_count].db_util->append_from_and_tables(
+ spider, fields_arg, NULL, query->from, table_idx))
+ {
+ DBUG_PRINT("info",("spider dbton_id=%d can't create from", roop_count));
+ spider_clear_bit(dbton_bitmap, roop_count);
+ keep_going = FALSE;
+ }
+ }
+ if (keep_going)
+ {
DBUG_PRINT("info",("spider query->where=%p", query->where));
if (query->where)
{
- if (spider_db_print_item_type(query->where, NULL, spider, NULL,
- NULL, 0, roop_count,
- TRUE, fields_arg))
+ if (spider_db_print_item_type(query->where, NULL, spider, NULL, NULL, 0,
+ roop_count, TRUE, fields_arg))
{
DBUG_PRINT("info",("spider dbton_id=%d can't create where", roop_count));
spider_clear_bit(dbton_bitmap, roop_count);
@@ -1787,9 +1819,8 @@ group_by_handler *spider_create_group_by_handler(
{
for (order = query->group_by; order; order = order->next)
{
- if (spider_db_print_item_type((*order->item), NULL, spider, NULL,
- NULL, 0, roop_count,
- TRUE, fields_arg))
+ if (spider_db_print_item_type((*order->item), NULL, spider, NULL, NULL, 0,
+ roop_count, TRUE, fields_arg))
{
DBUG_PRINT("info",("spider dbton_id=%d can't create group by", roop_count));
spider_clear_bit(dbton_bitmap, roop_count);
@@ -1806,9 +1837,8 @@ group_by_handler *spider_create_group_by_handler(
{
for (order = query->order_by; order; order = order->next)
{
- if (spider_db_print_item_type((*order->item), NULL, spider, NULL,
- NULL, 0, roop_count,
- TRUE, fields_arg))
+ if (spider_db_print_item_type((*order->item), NULL, spider, NULL, NULL, 0,
+ roop_count, TRUE, fields_arg))
{
DBUG_PRINT("info",("spider dbton_id=%d can't create order by", roop_count));
spider_clear_bit(dbton_bitmap, roop_count);
@@ -1823,9 +1853,8 @@ group_by_handler *spider_create_group_by_handler(
DBUG_PRINT("info",("spider query->having=%p", query->having));
if (query->having)
{
- if (spider_db_print_item_type(query->having, NULL, spider, NULL,
- NULL, 0, roop_count,
- TRUE, fields_arg))
+ if (spider_db_print_item_type(query->having, NULL, spider, NULL, NULL, 0,
+ roop_count, TRUE, fields_arg))
{
DBUG_PRINT("info",("spider dbton_id=%d can't create having", roop_count));
spider_clear_bit(dbton_bitmap, roop_count);
@@ -2036,7 +2065,7 @@ group_by_handler *spider_create_group_by_handler(
fields->check_support_dbton(dbton_bitmap);
if (!fields->has_conn_holder())
{
- DBUG_PRINT("info",("spider all choosed connections can't match dbton_id"));
+ DBUG_PRINT("info",("spider all chosen connections can't match dbton_id"));
delete fields;
DBUG_RETURN(NULL);
}
diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc
index 8a7ad752bcd..9c9e066b62f 100644
--- a/storage/spider/spd_i_s.cc
+++ b/storage/spider/spd_i_s.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Kentoku Shiba
+/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -164,6 +164,6 @@ struct st_maria_plugin spider_i_s_alloc_mem_maria =
NULL,
NULL,
"1.0",
- MariaDB_PLUGIN_MATURITY_STABLE
+ MariaDB_PLUGIN_MATURITY_STABLE,
};
#endif
diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h
index 79e030b0872..23bbff22fbb 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,9 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "tztime.h"
-
-#define SPIDER_DETAIL_VERSION "3.3.13"
+#define SPIDER_DETAIL_VERSION "3.3.14"
#define SPIDER_HEX_VERSION 0x0303
#if MYSQL_VERSION_ID < 50500
@@ -76,12 +74,21 @@
#define spider_user_defined_key_parts(A) (A)->user_defined_key_parts
#define spider_join_table_count(A) (A)->table_count
#define SPIDER_CAN_BG_UPDATE (1LL << 39)
-#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
-#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
-#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
-#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
-#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
-#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
+#if MYSQL_VERSION_ID >= 100304
+#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
+#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
+#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
+#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
+#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
+#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
+#else
+#define SPIDER_ALTER_PARTITION_ADD Alter_info::ALTER_ADD_PARTITION
+#define SPIDER_ALTER_PARTITION_DROP Alter_info::ALTER_DROP_PARTITION
+#define SPIDER_ALTER_PARTITION_COALESCE Alter_info::ALTER_COALESCE_PARTITION
+#define SPIDER_ALTER_PARTITION_REORGANIZE Alter_info::ALTER_REORGANIZE_PARTITION
+#define SPIDER_ALTER_PARTITION_TABLE_REORG Alter_info::ALTER_TABLE_REORG
+#define SPIDER_ALTER_PARTITION_REBUILD Alter_info::ALTER_REBUILD_PARTITION
+#endif
#define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION
@@ -100,12 +107,12 @@
#endif
#define spider_user_defined_key_parts(A) (A)->key_parts
#define spider_join_table_count(A) (A)->tables
-#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
-#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
-#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
-#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
-#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
-#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
+#define SPIDER_ALTER_PARTITION_ADD ALTER_ADD_PARTITION
+#define SPIDER_ALTER_PARTITION_DROP ALTER_DROP_PARTITION
+#define SPIDER_ALTER_PARTITION_COALESCE ALTER_COALESCE_PARTITION
+#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_REORGANIZE_PARTITION
+#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_TABLE_REORG
+#define SPIDER_ALTER_PARTITION_REBUILD ALTER_REBUILD_PARTITION
#define SPIDER_WARN_LEVEL_WARN MYSQL_ERROR::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION THD::KILL_CONNECTION
@@ -182,10 +189,56 @@
#define SPIDER_free_part_syntax(A,B) spider_my_free(A,B)
#endif
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100306
+#define SPIDER_read_record_read_record(A) read_record()
+#define SPIDER_has_Item_with_subquery
+#define SPIDER_use_LEX_CSTRING_for_KEY_Field_name
+#define SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+#define SPIDER_use_LEX_CSTRING_for_database_tablename_alias
+#define SPIDER_THD_db_str(A) (A)->db.str
+#define SPIDER_THD_db_length(A) (A)->db.length
+#define SPIDER_TABLE_LIST_db_str(A) (A)->db.str
+#define SPIDER_TABLE_LIST_db_length(A) (A)->db.length
+#define SPIDER_TABLE_LIST_table_name_str(A) (A)->table_name.str
+#define SPIDER_TABLE_LIST_table_name_length(A) (A)->table_name.length
+#define SPIDER_TABLE_LIST_alias_str(A) (A)->alias.str
+#define SPIDER_TABLE_LIST_alias_length(A) (A)->alias.length
+#define SPIDER_field_name_str(A) (A)->field_name.str
+#define SPIDER_field_name_length(A) (A)->field_name.length
+#define SPIDER_item_name_str(A) (A)->name.str
+#define SPIDER_item_name_length(A) (A)->name.length
+const LEX_CSTRING SPIDER_empty_string = {"", 0};
+#else
+#define SPIDER_read_record_read_record(A) read_record(A)
+#define SPIDER_THD_db_str(A) (A)->db
+#define SPIDER_THD_db_length(A) (A)->db_length
+#define SPIDER_TABLE_LIST_db_str(A) (A)->db
+#define SPIDER_TABLE_LIST_db_length(A) (A)->db_length
+#define SPIDER_TABLE_LIST_table_name_str(A) (A)->table_name
+#define SPIDER_TABLE_LIST_table_name_length(A) (A)->table_name_length
+#define SPIDER_TABLE_LIST_alias_str(A) (A)->alias
+#define SPIDER_TABLE_LIST_alias_length(A) strlen((A)->alias)
+#define SPIDER_field_name_str(A) (A)->field_name
+#define SPIDER_field_name_length(A) strlen((A)->field_name)
+#define SPIDER_item_name_str(A) (A)->name
+#define SPIDER_item_name_length(A) strlen((A)->name)
+const char SPIDER_empty_string = "";
+#endif
+
#if MYSQL_VERSION_ID >= 50500
#define SPIDER_HAS_HASH_VALUE_TYPE
#endif
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
+#define SPIDER_date_mode_t(A) date_mode_t(A)
+#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E)
+#define SPIDER_get_linkage(A) A->get_linkage()
+#else
+#define SPIDER_date_mode_t(A) A
+#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime(A,B,C,D,E)
+#define SPIDER_get_linkage(A) A->linkage
+#endif
+
#define spider_bitmap_size(A) ((A + 7) / 8)
#define spider_set_bit(BITMAP, BIT) \
((BITMAP)[(BIT) / 8] |= (1 << ((BIT) & 7)))
@@ -907,6 +960,7 @@ typedef struct st_spider_share
longlong priority;
int quick_mode;
longlong quick_page_size;
+ longlong quick_page_byte;
int low_mem_read;
int table_count_mode;
int select_column_mode;
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index 9c7aa4dcdcb..6b237bbfff8 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1364,6 +1364,31 @@ longlong spider_param_quick_page_size(
/*
-1 :use table parameter
+ 0-:the limitation of memory size
+ */
+static MYSQL_THDVAR_LONGLONG(
+ quick_page_byte, /* name */
+ PLUGIN_VAR_RQCMDARG, /* opt */
+ "The limitation of memory size in a page when acquisition one by one", /* comment */
+ NULL, /* check */
+ NULL, /* update */
+ -1, /* def */
+ -1, /* min */
+ 9223372036854775807LL, /* max */
+ 0 /* blk */
+);
+
+longlong spider_param_quick_page_byte(
+ THD *thd,
+ longlong quick_page_byte
+) {
+ DBUG_ENTER("spider_param_quick_page_byte");
+ DBUG_RETURN(THDVAR(thd, quick_page_byte) < 0 ?
+ quick_page_byte : THDVAR(thd, quick_page_byte));
+}
+
+/*
+ -1 :use table parameter
0 :It doesn't use low memory mode.
1 :It uses low memory mode.
*/
@@ -3123,6 +3148,30 @@ int spider_param_bka_table_name_type(
bka_table_name_type : THDVAR(thd, bka_table_name_type));
}
+/*
+ -1 :use table parameter
+ 0 :off
+ 1 :on
+ */
+static MYSQL_THDVAR_INT(
+ use_cond_other_than_pk_for_update, /* name */
+ PLUGIN_VAR_RQCMDARG, /* opt */
+ "Use all conditions even if condition has pk", /* comment */
+ NULL, /* check */
+ NULL, /* update */
+ 1, /* def */
+ 0, /* min */
+ 1, /* max */
+ 0 /* blk */
+);
+
+int spider_param_use_cond_other_than_pk_for_update(
+ THD *thd
+) {
+ DBUG_ENTER("spider_param_reset_sql_alloc");
+ DBUG_RETURN(THDVAR(thd, use_cond_other_than_pk_for_update));
+}
+
static int spider_store_last_sts;
/*
-1 : use table parameter
@@ -3279,6 +3328,33 @@ uint spider_param_table_crd_thread_count()
}
#endif
+static int spider_slave_trx_isolation;
+/*
+ -1 :off
+ 0 :read uncommitted
+ 1 :read committed
+ 2 :repeatable read
+ 3 :serializable
+ */
+static MYSQL_SYSVAR_INT(
+ slave_trx_isolation,
+ spider_slave_trx_isolation,
+ PLUGIN_VAR_RQCMDARG,
+ "Transaction isolation level when Spider table is used by slave SQL thread",
+ NULL, /* check */
+ NULL, /* update */
+ -1, /* def */
+ -1, /* min */
+ 3, /* max */
+ 0 /* blk */
+);
+
+int spider_param_slave_trx_isolation()
+{
+ DBUG_ENTER("spider_param_slave_trx_isolation");
+ DBUG_RETURN(spider_slave_trx_isolation);
+}
+
static struct st_mysql_storage_engine spider_storage_engine =
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
@@ -3330,6 +3406,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(net_write_timeout),
MYSQL_SYSVAR(quick_mode),
MYSQL_SYSVAR(quick_page_size),
+ MYSQL_SYSVAR(quick_page_byte),
MYSQL_SYSVAR(low_mem_read),
MYSQL_SYSVAR(select_column_mode),
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -3421,11 +3498,13 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(dry_access),
MYSQL_SYSVAR(delete_all_rows_type),
MYSQL_SYSVAR(bka_table_name_type),
+ MYSQL_SYSVAR(use_cond_other_than_pk_for_update),
MYSQL_SYSVAR(connect_error_interval),
#ifndef WITHOUT_SPIDER_BG_SEARCH
MYSQL_SYSVAR(table_sts_thread_count),
MYSQL_SYSVAR(table_crd_thread_count),
#endif
+ MYSQL_SYSVAR(slave_trx_isolation),
NULL
};
diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h
index 06df06a3129..8fdf2e452b2 100644
--- a/storage/spider/spd_param.h
+++ b/storage/spider/spd_param.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software); you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -171,6 +171,10 @@ longlong spider_param_quick_page_size(
THD *thd,
longlong quick_page_size
);
+longlong spider_param_quick_page_byte(
+ THD *thd,
+ longlong quick_page_byte
+);
int spider_param_low_mem_read(
THD *thd,
int low_mem_read
@@ -397,6 +401,9 @@ int spider_param_bka_table_name_type(
THD *thd,
int bka_table_name_type
);
+int spider_param_use_cond_other_than_pk_for_update(
+ THD *thd
+);
int spider_param_store_last_sts(
int store_last_sts
);
@@ -413,3 +420,4 @@ int spider_param_load_crd_at_startup(
uint spider_param_table_sts_thread_count();
uint spider_param_table_crd_thread_count();
#endif
+int spider_param_slave_trx_isolation();
diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc
index 680618e3087..f72487f034c 100644
--- a/storage/spider/spd_ping_table.cc
+++ b/storage/spider/spd_ping_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2017 Kentoku Shiba
+/* Copyright (C) 2009-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc
index e64b5173b9a..cd1c56a077e 100644
--- a/storage/spider/spd_sys_table.cc
+++ b/storage/spider/spd_sys_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -38,7 +38,6 @@
extern handlerton *spider_hton_ptr;
extern Time_zone *spd_tz_system;
-static const LEX_CSTRING empty_clex_string= {"", 0};
/**
Insert a Spider system table row.
@@ -155,15 +154,30 @@ TABLE *spider_open_sys_table(
#if MYSQL_VERSION_ID < 50500
memset(&tables, 0, sizeof(TABLE_LIST));
- tables.db = (char*)"mysql";
- tables.db_length = sizeof("mysql") - 1;
- tables.alias = tables.table_name = (char *) table_name;
- tables.table_name_length = table_name_length;
+ SPIDER_TABLE_LIST_db_str(&tables) = (char*)"mysql";
+ SPIDER_TABLE_LIST_db_length(&tables) = sizeof("mysql") - 1;
+ SPIDER_TABLE_LIST_alias_str(&tables) =
+ SPIDER_TABLE_LIST_table_name_str(&tables) = (char *) table_name;
+ SPIDER_TABLE_LIST_table_name_length(&tables) = table_name_length;
tables.lock_type = (write ? TL_WRITE : TL_READ);
#else
- LEX_CSTRING db_name= { "mysql", sizeof("mysql") - 1 };
- LEX_CSTRING tbl_name= { table_name, (size_t) table_name_length };
- tables.init_one_table( &db_name, &tbl_name, 0, (write ? TL_WRITE : TL_READ));
+#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
+ LEX_CSTRING db_name =
+ {
+ "mysql",
+ sizeof("mysql") - 1
+ };
+ LEX_CSTRING tbl_name =
+ {
+ table_name,
+ (size_t) table_name_length
+ };
+ tables.init_one_table(&db_name, &tbl_name, 0, (write ? TL_WRITE : TL_READ));
+#else
+ tables.init_one_table(
+ "mysql", sizeof("mysql") - 1, table_name, table_name_length, table_name,
+ (write ? TL_WRITE : TL_READ));
+#endif
#endif
#if MYSQL_VERSION_ID < 50500
@@ -371,14 +385,15 @@ TABLE *spider_sys_open_table(
TABLE *table;
ulonglong utime_after_lock_backup = thd->utime_after_lock;
DBUG_ENTER("spider_sys_open_table");
- thd->reset_n_backup_open_tables_state(open_tables_backup);
+ if (open_tables_backup)
+ thd->reset_n_backup_open_tables_state(open_tables_backup);
if ((table = open_ltable(thd, tables, tables->lock_type,
MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK | MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |
MYSQL_OPEN_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT | MYSQL_LOCK_LOG_TABLE
))) {
table->use_all_columns();
table->s->no_replicate = 1;
- } else
+ } else if (open_tables_backup)
thd->restore_backup_open_tables_state(open_tables_backup);
thd->utime_after_lock = utime_after_lock_backup;
DBUG_RETURN(table);
@@ -504,7 +519,7 @@ int spider_get_sys_table_by_idx(
) {
int error_num;
uint key_length;
- KEY *key_info = table->key_info;
+ KEY *key_info = table->key_info + idx;
DBUG_ENTER("spider_get_sys_table_by_idx");
if ((error_num = spider_sys_index_init(table, idx, FALSE)))
DBUG_RETURN(error_num);
@@ -595,6 +610,28 @@ int spider_sys_index_first(
DBUG_RETURN(0);
}
+int spider_sys_index_last(
+ TABLE *table,
+ const int idx
+) {
+ int error_num;
+ DBUG_ENTER("spider_sys_index_last");
+ if ((error_num = spider_sys_index_init(table, idx, FALSE)))
+ DBUG_RETURN(error_num);
+
+ if (
+#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
+ (error_num = table->file->ha_index_last(table->record[0]))
+#else
+ (error_num = table->file->index_last(table->record[0]))
+#endif
+ ) {
+ spider_sys_index_end(table);
+ DBUG_RETURN(error_num);
+ }
+ DBUG_RETURN(0);
+}
+
int spider_sys_index_next(
TABLE *table
) {
@@ -1262,7 +1299,9 @@ int spider_insert_xa(
spider_store_xa_bqual_length(table, xid);
spider_store_xa_status(table, status);
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
} else {
my_message(ER_SPIDER_XA_EXISTS_NUM, ER_SPIDER_XA_EXISTS_STR, MYF(0));
DBUG_RETURN(ER_SPIDER_XA_EXISTS_NUM);
@@ -1293,7 +1332,9 @@ int spider_insert_xa_member(
table->use_all_columns();
spider_store_xa_member_info(table, xid, conn);
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
} else {
my_message(ER_SPIDER_XA_MEMBER_EXISTS_NUM, ER_SPIDER_XA_MEMBER_EXISTS_STR,
MYF(0));
@@ -1324,7 +1365,9 @@ int spider_insert_tables(
share->alter_table.tmp_link_statuses[roop_count] :
SPIDER_LINK_STATUS_OK);
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
DBUG_RETURN(0);
@@ -1335,9 +1378,8 @@ int spider_insert_sys_table(
) {
int error_num;
DBUG_ENTER("spider_insert_sys_table");
- if ((error_num = spider_write_sys_table_row(table)))
- DBUG_RETURN(error_num);
- DBUG_RETURN(0);
+ error_num = spider_write_sys_table_row(table);
+ DBUG_RETURN(error_num);
}
int spider_insert_or_update_table_sts(
@@ -1378,7 +1420,9 @@ int spider_insert_or_update_table_sts(
DBUG_RETURN(error_num);
}
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
} else {
if ((error_num = spider_update_sys_table_row(table, FALSE)))
{
@@ -1415,7 +1459,9 @@ int spider_insert_or_update_table_crd(
DBUG_RETURN(error_num);
}
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
} else {
if ((error_num = spider_update_sys_table_row(table, FALSE)))
{
@@ -1444,7 +1490,9 @@ int spider_log_tables_link_failed(
table->timestamp_field->set_time();
#endif
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
DBUG_RETURN(0);
}
@@ -1479,7 +1527,9 @@ int spider_log_xa_failed(
table->timestamp_field->set_time();
#endif
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
DBUG_RETURN(0);
}
@@ -1509,7 +1559,9 @@ int spider_update_xa(
table->use_all_columns();
spider_store_xa_status(table, status);
if ((error_num = spider_update_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
DBUG_RETURN(0);
@@ -1543,7 +1595,9 @@ int spider_update_tables_name(
table->use_all_columns();
spider_store_tables_name(table, to, strlen(to));
if ((error_num = spider_update_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
roop_count++;
}
@@ -1588,7 +1642,9 @@ int spider_update_tables_priority(
alter_table->tmp_link_statuses[roop_count] :
SPIDER_LINK_STATUS_OK);
if ((error_num = spider_write_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
roop_count++;
} while (roop_count < (int) alter_table->all_link_count);
DBUG_RETURN(0);
@@ -1605,7 +1661,9 @@ int spider_update_tables_priority(
spider_store_tables_link_status(table,
alter_table->tmp_link_statuses[roop_count]);
if ((error_num = spider_update_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
}
while (TRUE)
@@ -1624,7 +1682,9 @@ int spider_update_tables_priority(
DBUG_RETURN(error_num);
}
if ((error_num = spider_delete_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
roop_count++;
}
@@ -1661,12 +1721,23 @@ int spider_update_tables_link_status(
table->use_all_columns();
spider_store_tables_link_status(table, link_status);
if ((error_num = spider_update_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
DBUG_RETURN(0);
}
+int spider_update_sys_table(
+ TABLE *table
+) {
+ int error_num;
+ DBUG_ENTER("spider_update_sys_table");
+ error_num = spider_update_sys_table_row(table);
+ DBUG_RETURN(error_num);
+}
+
int spider_delete_xa(
TABLE *table,
XID *xid
@@ -1689,7 +1760,9 @@ int spider_delete_xa(
DBUG_RETURN(ER_SPIDER_XA_NOT_EXISTS_NUM);
} else {
if ((error_num = spider_delete_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
DBUG_RETURN(0);
@@ -1752,7 +1825,9 @@ int spider_delete_tables(
break;
else {
if ((error_num = spider_delete_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
roop_count++;
}
@@ -1783,7 +1858,9 @@ int spider_delete_table_sts(
DBUG_RETURN(0);
} else {
if ((error_num = spider_delete_sys_table_row(table)))
+ {
DBUG_RETURN(error_num);
+ }
}
DBUG_RETURN(0);
@@ -2386,7 +2463,7 @@ void spider_get_sys_table_sts_info(
*index_file_length = (ulonglong) table->field[4]->val_int();
*records = (ha_rows) table->field[5]->val_int();
*mean_rec_length = (ulong) table->field[6]->val_int();
- table->field[7]->get_date(&mysql_time, date_mode_t(0));
+ table->field[7]->get_date(&mysql_time, SPIDER_date_mode_t(0));
#ifdef MARIADB_BASE_VERSION
*check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -2394,7 +2471,7 @@ void spider_get_sys_table_sts_info(
*check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_my_bool);
#endif
- table->field[8]->get_date(&mysql_time, date_mode_t(0));
+ table->field[8]->get_date(&mysql_time, SPIDER_date_mode_t(0));
#ifdef MARIADB_BASE_VERSION
*create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -2402,7 +2479,7 @@ void spider_get_sys_table_sts_info(
*create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_my_bool);
#endif
- table->field[9]->get_date(&mysql_time, date_mode_t(0));
+ table->field[9]->get_date(&mysql_time, SPIDER_date_mode_t(0));
#ifdef MARIADB_BASE_VERSION
*update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
@@ -3207,27 +3284,37 @@ error:
DBUG_RETURN(error_num);
}
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+TABLE *spider_mk_sys_tmp_table(
+ THD *thd,
+ TABLE *table,
+ TMP_TABLE_PARAM *tmp_tbl_prm,
+ const LEX_CSTRING *field_name,
+ CHARSET_INFO *cs
+)
+#else
TABLE *spider_mk_sys_tmp_table(
THD *thd,
TABLE *table,
TMP_TABLE_PARAM *tmp_tbl_prm,
const char *field_name,
CHARSET_INFO *cs
-) {
+)
+#endif
+{
Field_blob *field;
Item_field *i_field;
List<Item> i_list;
TABLE *tmp_table;
- LEX_CSTRING name= { field_name, strlen(field_name) };
DBUG_ENTER("spider_mk_sys_tmp_table");
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
if (!(field = new (thd->mem_root) Field_blob(
- (uint32) 4294967295U, FALSE, &name, cs, TRUE)))
+ 4294967295U, FALSE, field_name, cs, TRUE)))
goto error_alloc_field;
#else
if (!(field = new Field_blob(
- 4294967295U, FALSE, &name, cs, TRUE)))
+ 4294967295U, FALSE, field_name, cs, TRUE)))
goto error_alloc_field;
#endif
field->init(table);
@@ -3244,8 +3331,9 @@ TABLE *spider_mk_sys_tmp_table(
goto error_push_item;
if (!(tmp_table = create_tmp_table(thd, tmp_tbl_prm,
- i_list, (ORDER*) NULL, FALSE, FALSE, TMP_TABLE_FORCE_MYISAM,
- HA_POS_ERROR, &empty_clex_string)))
+ i_list, (ORDER*) NULL, FALSE, FALSE,
+ (TMP_TABLE_FORCE_MYISAM | TMP_TABLE_ALL_COLUMNS),
+ HA_POS_ERROR, &SPIDER_empty_string)))
goto error_create_tmp_table;
DBUG_RETURN(tmp_table);
@@ -3270,6 +3358,17 @@ void spider_rm_sys_tmp_table(
DBUG_VOID_RETURN;
}
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+TABLE *spider_mk_sys_tmp_table_for_result(
+ THD *thd,
+ TABLE *table,
+ TMP_TABLE_PARAM *tmp_tbl_prm,
+ const LEX_CSTRING *field_name1,
+ const LEX_CSTRING *field_name2,
+ const LEX_CSTRING *field_name3,
+ CHARSET_INFO *cs
+)
+#else
TABLE *spider_mk_sys_tmp_table_for_result(
THD *thd,
TABLE *table,
@@ -3278,23 +3377,22 @@ TABLE *spider_mk_sys_tmp_table_for_result(
const char *field_name2,
const char *field_name3,
CHARSET_INFO *cs
-) {
+)
+#endif
+{
Field_blob *field1, *field2, *field3;
Item_field *i_field1, *i_field2, *i_field3;
List<Item> i_list;
TABLE *tmp_table;
- LEX_CSTRING name1= { field_name1, strlen(field_name1) };
- LEX_CSTRING name2= { field_name2, strlen(field_name2) };
- LEX_CSTRING name3= { field_name3, strlen(field_name3) };
DBUG_ENTER("spider_mk_sys_tmp_table_for_result");
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
if (!(field1 = new (thd->mem_root) Field_blob(
- (uint32) 4294967295U, FALSE, &name1, cs, TRUE)))
+ 4294967295U, FALSE, field_name1, cs, TRUE)))
goto error_alloc_field1;
#else
if (!(field1 = new Field_blob(
- 4294967295U, FALSE, &name1, cs, TRUE)))
+ 4294967295U, FALSE, field_name1, cs, TRUE)))
goto error_alloc_field1;
#endif
field1->init(table);
@@ -3312,11 +3410,11 @@ TABLE *spider_mk_sys_tmp_table_for_result(
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
if (!(field2 = new (thd->mem_root) Field_blob(
- 4294967295U, FALSE, &name2, cs, TRUE)))
+ 4294967295U, FALSE, field_name2, cs, TRUE)))
goto error_alloc_field2;
#else
if (!(field2 = new Field_blob(
- 4294967295U, FALSE, &name2, cs, TRUE)))
+ 4294967295U, FALSE, field_name2, cs, TRUE)))
goto error_alloc_field2;
#endif
field2->init(table);
@@ -3334,7 +3432,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
if (!(field3 = new (thd->mem_root) Field_blob(
- 4294967295U, FALSE, &name3, cs, TRUE)))
+ 4294967295U, FALSE, field_name3, cs, TRUE)))
goto error_alloc_field3;
#else
if (!(field3 = new Field_blob(
@@ -3355,8 +3453,9 @@ TABLE *spider_mk_sys_tmp_table_for_result(
goto error_push_item3;
if (!(tmp_table = create_tmp_table(thd, tmp_tbl_prm,
- i_list, (ORDER*) NULL, FALSE, FALSE, TMP_TABLE_FORCE_MYISAM,
- HA_POS_ERROR, &empty_clex_string)))
+ i_list, (ORDER*) NULL, FALSE, FALSE,
+ (TMP_TABLE_FORCE_MYISAM | TMP_TABLE_ALL_COLUMNS),
+ HA_POS_ERROR, &SPIDER_empty_string)))
goto error_create_tmp_table;
DBUG_RETURN(tmp_table);
diff --git a/storage/spider/spd_sys_table.h b/storage/spider/spd_sys_table.h
index 009ef2ac8ca..857109edb38 100644
--- a/storage/spider/spd_sys_table.h
+++ b/storage/spider/spd_sys_table.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2016 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -173,6 +173,11 @@ int spider_sys_index_first(
const int idx
);
+int spider_sys_index_last(
+ TABLE *table,
+ const int idx
+);
+
int spider_sys_index_next(
TABLE *table
);
@@ -386,6 +391,10 @@ int spider_update_tables_link_status(
long link_status
);
+int spider_update_sys_table(
+ TABLE *table
+);
+
int spider_delete_xa(
TABLE *table,
XID *xid
@@ -618,6 +627,15 @@ int spider_sys_replace(
bool *modified_non_trans_table
);
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+TABLE *spider_mk_sys_tmp_table(
+ THD *thd,
+ TABLE *table,
+ TMP_TABLE_PARAM *tmp_tbl_prm,
+ const LEX_CSTRING *field_name,
+ CHARSET_INFO *cs
+);
+#else
TABLE *spider_mk_sys_tmp_table(
THD *thd,
TABLE *table,
@@ -625,6 +643,7 @@ TABLE *spider_mk_sys_tmp_table(
const char *field_name,
CHARSET_INFO *cs
);
+#endif
void spider_rm_sys_tmp_table(
THD *thd,
@@ -632,6 +651,17 @@ void spider_rm_sys_tmp_table(
TMP_TABLE_PARAM *tmp_tbl_prm
);
+#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
+TABLE *spider_mk_sys_tmp_table_for_result(
+ THD *thd,
+ TABLE *table,
+ TMP_TABLE_PARAM *tmp_tbl_prm,
+ const LEX_CSTRING *field_name1,
+ const LEX_CSTRING *field_name2,
+ const LEX_CSTRING *field_name3,
+ CHARSET_INFO *cs
+);
+#else
TABLE *spider_mk_sys_tmp_table_for_result(
THD *thd,
TABLE *table,
@@ -641,6 +671,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
const char *field_name3,
CHARSET_INFO *cs
);
+#endif
void spider_rm_sys_tmp_table_for_result(
THD *thd,
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 2e3705f04ee..fe5265184b6 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1721,8 +1721,7 @@ int st_spider_param_string_parse::print_param_error()
if ((share->param_name = spider_get_string_between_quote( \
start_ptr, TRUE, &connect_string_parse))) \
share->SPIDER_PARAM_STR_LEN(param_name) = strlen(share->param_name); \
- else \
- { \
+ else { \
error_num = connect_string_parse.print_param_error(); \
goto error; \
} \
@@ -2046,6 +2045,7 @@ int spider_parse_connect_info(
share->priority = -1;
share->quick_mode = -1;
share->quick_page_size = -1;
+ share->quick_page_byte = -1;
share->low_mem_read = -1;
share->table_count_mode = -1;
share->select_column_mode = -1;
@@ -2291,6 +2291,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("qch", query_cache, 0, 2);
SPIDER_PARAM_INT_WITH_MAX("qcs", query_cache_sync, 0, 3);
SPIDER_PARAM_INT_WITH_MAX("qmd", quick_mode, 0, 3);
+ SPIDER_PARAM_LONGLONG("qpb", quick_page_byte, 0);
SPIDER_PARAM_LONGLONG("qps", quick_page_size, 0);
SPIDER_PARAM_INT_WITH_MAX("rom", read_only_mode, 0, 1);
SPIDER_PARAM_DOUBLE("rrt", read_rate, 0);
@@ -2460,6 +2461,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_LONGLONG("internal_offset", internal_offset, 0);
SPIDER_PARAM_INT_WITH_MAX("reset_sql_alloc", reset_sql_alloc, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("semi_table_lock", semi_table_lock, 0, 1);
+ SPIDER_PARAM_LONGLONG("quick_page_byte", quick_page_byte, 0);
SPIDER_PARAM_LONGLONG("quick_page_size", quick_page_size, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG("bgs_second_read", bgs_second_read, 0);
@@ -3825,9 +3827,11 @@ int spider_set_connect_info_default(
if (share->priority == -1)
share->priority = 1000000;
if (share->quick_mode == -1)
- share->quick_mode = 0;
+ share->quick_mode = 3;
if (share->quick_page_size == -1)
- share->quick_page_size = 100;
+ share->quick_page_size = 1024;
+ if (share->quick_page_byte == -1)
+ share->quick_page_byte = 10485760;
if (share->low_mem_read == -1)
share->low_mem_read = 1;
if (share->table_count_mode == -1)
@@ -5219,15 +5223,20 @@ SPIDER_SHARE *spider_get_share(
}
if (!share->link_status_init)
{
- if (
- (
- table_share->tmp_table == NO_TMP_TABLE &&
- sql_command != SQLCOM_DROP_TABLE &&
- sql_command != SQLCOM_SHOW_CREATE
- ) ||
- /* for alter change link status */
- sql_command == SQLCOM_ALTER_TABLE
- ) {
+ /*
+ The link statuses need to be refreshed from the spider_tables table
+ if the operation:
+ - Is not a DROP TABLE on a permanent table; or
+ - Is an ALTER TABLE.
+
+ Note that SHOW CREATE TABLE is not excluded, because the commands
+ that follow it require up-to-date link statuses.
+ */
+ if ((table_share->tmp_table == NO_TMP_TABLE &&
+ sql_command != SQLCOM_DROP_TABLE) ||
+ /* for alter change link status */
+ sql_command == SQLCOM_ALTER_TABLE)
+ {
SPD_INIT_ALLOC_ROOT(&mem_root, 4096, 0, MYF(MY_WME));
init_mem_root = TRUE;
if (
@@ -7993,6 +8002,8 @@ void spider_set_result_list_param(
spider_param_quick_mode(thd, share->quick_mode);
result_list->quick_page_size =
spider_param_quick_page_size(thd, share->quick_page_size);
+ result_list->quick_page_byte =
+ spider_param_quick_page_byte(thd, share->quick_page_byte);
result_list->low_mem_read =
spider_param_low_mem_read(thd, share->low_mem_read);
DBUG_VOID_RETURN;
@@ -8965,7 +8976,9 @@ bool spider_check_direct_order_limit(
int spider_set_direct_limit_offset(
ha_spider *spider
) {
+#ifndef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
THD *thd = spider->trx->thd;
+#endif
st_select_lex *select_lex;
longlong select_limit;
longlong offset_limit;
@@ -9037,7 +9050,11 @@ int spider_set_direct_limit_offset(
DBUG_RETURN(FALSE);
// ignore condition like 1=1
+#ifdef SPIDER_has_Item_with_subquery
if (select_lex->where && select_lex->where->with_subquery())
+#else
+ if (select_lex->where && select_lex->where->with_subselect)
+#endif
DBUG_RETURN(FALSE);
if (
@@ -9048,14 +9065,8 @@ int spider_set_direct_limit_offset(
)
DBUG_RETURN(FALSE);
- /*
- TODO: following comment is wrong or the check is wrong (correct
- check for derived table will be something like select_lex->linkage,
- if they need only top level it is better to check nested level and do
- not loose UNIONS & Co
- */
// must not be derived table
- if (thd->lex->first_select_lex() != select_lex)
+ if (SPIDER_get_linkage(select_lex) == DERIVED_TABLE_TYPE)
DBUG_RETURN(FALSE);
spider->direct_select_offset = offset_limit;
@@ -9497,7 +9508,8 @@ int spider_discover_table_structure(
uint collatelen = strlen(table_charset->name);
if (str.reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_DEFAULT_CHARSET_LEN +
csnamelen + SPIDER_SQL_COLLATE_LEN + collatelen +
- SPIDER_SQL_CONNECTION_LEN + SPIDER_SQL_VALUE_QUOTE_LEN
+ SPIDER_SQL_CONNECTION_LEN + SPIDER_SQL_VALUE_QUOTE_LEN +
+ (share->comment.length * 2)
)) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -9510,7 +9522,8 @@ int spider_discover_table_structure(
str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
str.append_escape_string(share->comment.str, share->comment.length);
if (str.reserve(SPIDER_SQL_CONNECTION_LEN +
- (SPIDER_SQL_VALUE_QUOTE_LEN * 2)))
+ (SPIDER_SQL_VALUE_QUOTE_LEN * 2) +
+ (share->connect_string.length * 2)))
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
index e09c7fa6c45..6204ca9852c 100644
--- a/storage/spider/spd_trx.cc
+++ b/storage/spider/spd_trx.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2017 Kentoku Shiba
+/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,6 @@
#include "sql_class.h"
#include "sql_partition.h"
#include "records.h"
-#include "tztime.h"
#endif
#include "spd_err.h"
#include "spd_param.h"
@@ -1587,21 +1586,23 @@ int spider_check_and_set_trx_isolation(
SPIDER_CONN *conn,
int *need_mon
) {
+ THD *thd = conn->thd;
int trx_isolation;
DBUG_ENTER("spider_check_and_set_trx_isolation");
-
- trx_isolation = thd_tx_isolation(conn->thd);
- DBUG_PRINT("info",("spider local trx_isolation=%d", trx_isolation));
-/*
- DBUG_PRINT("info",("spider conn->trx_isolation=%d", conn->trx_isolation));
- if (conn->trx_isolation != trx_isolation)
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL)
{
-*/
- spider_conn_queue_trx_isolation(conn, trx_isolation);
-/*
- conn->trx_isolation = trx_isolation;
+ if ((trx_isolation = spider_param_slave_trx_isolation()) == -1)
+ {
+ trx_isolation = thd_tx_isolation(thd);
+ DBUG_PRINT("info",("spider local trx_isolation=%d", trx_isolation));
+ } else {
+ DBUG_PRINT("info",("spider slave trx_isolation=%d", trx_isolation));
+ }
+ } else {
+ trx_isolation = thd_tx_isolation(thd);
+ DBUG_PRINT("info",("spider local trx_isolation=%d", trx_isolation));
}
-*/
+ spider_conn_queue_trx_isolation(conn, trx_isolation);
DBUG_RETURN(0);
}
@@ -1648,9 +1649,7 @@ int spider_check_and_set_sql_log_off(
if (internal_sql_log_off)
{
spider_conn_queue_sql_log_off(conn, TRUE);
- }
- else
- {
+ } else {
spider_conn_queue_sql_log_off(conn, FALSE);
}
}
@@ -2764,7 +2763,8 @@ int spider_initinal_xa_recover(
FALSE, FALSE);
}
SPD_INIT_ALLOC_ROOT(&mem_root, 4096, 0, MYF(MY_WME));
- while ((!(read_record->read_record())) && cnt < (int) len)
+ while ((!(read_record->SPIDER_read_record_read_record(read_record))) &&
+ cnt < (int) len)
{
spider_get_sys_xid(table_xa, &xid_list[cnt], &mem_root);
cnt++;
@@ -2813,7 +2813,7 @@ int spider_internal_xa_commit_by_xid(
SPIDER_TRX *trx,
XID* xid
) {
- TABLE *table_xa, *table_xa_member= 0;
+ TABLE *table_xa, *table_xa_member = 0;
int error_num;
char xa_key[MAX_KEY_LENGTH];
char xa_member_key[MAX_KEY_LENGTH];
@@ -3048,7 +3048,7 @@ int spider_internal_xa_rollback_by_xid(
SPIDER_TRX *trx,
XID* xid
) {
- TABLE *table_xa, *table_xa_member= 0;
+ TABLE *table_xa, *table_xa_member = 0;
int error_num;
char xa_key[MAX_KEY_LENGTH];
char xa_member_key[MAX_KEY_LENGTH];
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 86463c2997e..3b4e4fb967e 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -49,34 +49,43 @@ CHECK_JEMALLOC()
IF(NOT LIBJEMALLOC)
MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported")
+ELSEIF(LIBJEMALLOC STREQUAL jemalloc_pic)
+ CHECK_CXX_SOURCE_COMPILES(
+"
+#include <jemalloc/jemalloc.h>
+#if JEMALLOC_VERSION_MAJOR < 5
+int main() { return 0; }
+#else
+#error
+#endif
+" JEMALLOC_OK)
+ IF (NOT JEMALLOC_OK)
+ MESSAGE(FATAL_ERROR "static jemalloc_pic.a can only be used up to jemalloc 4")
+ ENDIF()
ELSEIF(LIBJEMALLOC STREQUAL jemalloc)
FIND_LIBRARY(LIBJEMALLOC_SO jemalloc)
IF(NOT LIBJEMALLOC_SO)
MESSAGE(FATAL_ERROR "jemalloc is present, but cannot be found?")
ENDIF()
GET_FILENAME_COMPONENT(LIBJEMALLOC_PATH ${LIBJEMALLOC_SO} REALPATH CACHE)
-ENDIF()
-IF(LIBJEMALLOC_PATH AND (RPM OR DEB))
- UNSET(LIBJEMALLOC)
- GET_DIRECTORY_PROPERTY(V DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITION CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES)
- SET(CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES "${V} jemalloc" PARENT_SCOPE)
- SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #"
- SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}")
-ELSEIF(LIBJEMALLOC_PATH)
- SET(systemd_env "#Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #"
- SET(cnf_malloc_lib "#malloc-lib=${LIBJEMALLOC_PATH}")
-ELSE()
- SET(systemd_env "#Environment=\"LD_PRELOAD=/path/to/libjemalloc.so\"") #"
- SET(cnf_malloc_lib "#malloc-lib=/path/to/libjemalloc.so")
+ IF(RPM OR DEB)
+ UNSET(LIBJEMALLOC)
+ GET_DIRECTORY_PROPERTY(V DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITION CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES)
+ SET(CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES "${V} jemalloc" PARENT_SCOPE)
+ ENDIF()
+
+ IF(INSTALL_SYSCONFDIR)
+ SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"")
+ SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}")
+ CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf
+ DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/
+ COMPONENT tokudb-engine)
+ ENDIF()
ENDIF()
+
CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY)
-CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY)
-IF(INSTALL_SYSCONFDIR)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf
- DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/
- COMPONENT tokudb-engine)
-ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_master_tokudb.result b/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_master_tokudb.result
index 6ee39039985..cca18c7c1ab 100644
--- a/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_master_tokudb.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_master_tokudb.result
@@ -194,7 +194,7 @@ INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
insert ignore into t31 set f1=1, f2=1, f3=2, f4='second',
f9=2.2, f10='seven samurai', f28=222.222, f35='222';
Warnings:
-Warning 1366 Incorrect integer value: 'seven samurai' for column 'f10' at row 1
+Warning 1366 Incorrect integer value: 'seven samurai' for column `test`.`t31`.`f10` at row 1
insert ignore into t31 values (1, 1, 3, 'third',
/* f5 BIGINT, */ 333333333333333333333333,
/* f6 BLOB, */ '3333333333333333333333',
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result
index 8ada947f217..df3ea1d6de6 100644
--- a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result
@@ -484,77 +484,78 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
******************** CREATE USER ********************
CREATE USER 'user_test_rpl'@'localhost' IDENTIFIED BY PASSWORD '*1111111111111111111111111111111111111111';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection master;
******************** GRANT ********************
GRANT SELECT ON *.* TO 'user_test_rpl'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 Y
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 Y
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 Y
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 Y
connection master;
******************** REVOKE ********************
REVOKE SELECT ON *.* FROM 'user_test_rpl'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *1111111111111111111111111111111111111111 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *1111111111111111111111111111111111111111 mysql_native_password *1111111111111111111111111111111111111111 N
connection master;
******************** SET PASSWORD ********************
SET PASSWORD FOR 'user_test_rpl'@'localhost' = '*0000000000000000000000000000000000000000';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection master;
******************** RENAME USER ********************
RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
-localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
+Host User Password plugin authentication_string Select_priv
+localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
connection master;
******************** DROP USER ********************
DROP USER 'user_test_rpl_2'@'localhost';
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
+Host User Password plugin authentication_string Select_priv
connection slave;
USE test_rpl;
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
-host user password plugin authentication_string select_priv
+Host User Password plugin authentication_string Select_priv
connection master;
INSERT INTO t1 VALUES(100, 'test');
******************** ANALYZE ********************
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test_rpl.t1 analyze status Engine-independent statistics collected
test_rpl.t1 analyze status OK
******************** CHECK TABLE ********************
diff --git a/storage/tokudb/mysql-test/tokudb/disabled.def b/storage/tokudb/mysql-test/tokudb/disabled.def
index 89f6992d26d..4f759001151 100644
--- a/storage/tokudb/mysql-test/tokudb/disabled.def
+++ b/storage/tokudb/mysql-test/tokudb/disabled.def
@@ -30,5 +30,5 @@ i_s_tokudb_lock_waits_released: unstable, race conditions
i_s_tokudb_locks_released: unstable, race conditions
row_format: n/a
nonflushing_analyze_debug: Freezes in MariaDB 10.0
-tokudb.change_column_all_1000_1: We are too lazy to fix this properly
-tokudb.change_column_all_1000_10: We are too lazy to fix this properly
+change_column_all_1000_1: We are too lazy to fix this properly
+change_column_all_1000_10: We are too lazy to fix this properly
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_add_drop.result b/storage/tokudb/mysql-test/tokudb/r/card_add_drop.result
index 71a39eb1f3e..fe87a8e2ed6 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_add_drop.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_add_drop.result
@@ -9,6 +9,7 @@ tt 1 b 1 b A 4 NULL NULL YES BTREE
tt 1 c 1 c A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -23,6 +24,7 @@ tt 1 c 1 c A 4 NULL NULL YES BTREE
tt 1 d 1 d A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_add_index.result b/storage/tokudb/mysql-test/tokudb/r/card_add_index.result
index 9a929b19a80..c32b4522460 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_add_index.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_add_index.result
@@ -7,6 +7,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
tt 0 PRIMARY 1 a A 4 NULL NULL BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -18,6 +19,7 @@ tt 0 PRIMARY 1 a A 4 NULL NULL BTREE
tt 1 b 1 b A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -31,6 +33,7 @@ tt 1 b 1 b A 2 NULL NULL YES BTREE
tt 1 c 1 c A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_drop_index.result b/storage/tokudb/mysql-test/tokudb/r/card_drop_index.result
index 2cfdfe11296..ac2979ab057 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_drop_index.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_drop_index.result
@@ -9,6 +9,7 @@ tt 1 b 1 b A 4 NULL NULL YES BTREE
tt 1 c 1 c A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_drop_index_2.result b/storage/tokudb/mysql-test/tokudb/r/card_drop_index_2.result
index ed28d2a3226..2a65b6f0982 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_drop_index_2.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_drop_index_2.result
@@ -136,6 +136,7 @@ tt 1 b 1 b A 500 NULL NULL YES BTREE
tt 1 c 1 c A 500 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_drop_pk.result b/storage/tokudb/mysql-test/tokudb/r/card_drop_pk.result
index 2369d88c274..1b562ad6ac9 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_drop_pk.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_drop_pk.result
@@ -9,6 +9,7 @@ tt 1 b 1 b A 4 NULL NULL YES BTREE
tt 1 c 1 c A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_no_keys.result b/storage/tokudb/mysql-test/tokudb/r/card_no_keys.result
index 1302cfaf252..a96f3edd4b8 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_no_keys.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_no_keys.result
@@ -6,6 +6,7 @@ show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_pk.result b/storage/tokudb/mysql-test/tokudb/r/card_pk.result
index b0317507f7c..173fb696d69 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_pk.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_pk.result
@@ -7,6 +7,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
tt 0 PRIMARY 1 a A 4 NULL NULL BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_pk_2.result b/storage/tokudb/mysql-test/tokudb/r/card_pk_2.result
index 3c1b652db15..a5434968b0d 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_pk_2.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_pk_2.result
@@ -8,6 +8,7 @@ tt 0 PRIMARY 1 a A 4 NULL NULL BTREE
tt 0 PRIMARY 2 b A 4 NULL NULL BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_pk_sk.result b/storage/tokudb/mysql-test/tokudb/r/card_pk_sk.result
index 02c8d1f8218..6c6f72be4a6 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_pk_sk.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_pk_sk.result
@@ -1007,6 +1007,7 @@ tt 0 PRIMARY 1 a A 4000 NULL NULL BTREE
tt 1 b 1 b A 4000 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -2025,6 +2026,7 @@ tt 0 PRIMARY 1 a A 4000 NULL NULL BTREE
tt 1 b 1 b A 4000 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result b/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result
index 981433fac91..a452be2006a 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result
@@ -1,5 +1,6 @@
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
set global tokudb_cardinality_scale_percent = 10;
show indexes from tt;
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_sk.result b/storage/tokudb/mysql-test/tokudb/r/card_sk.result
index 310fc863a9b..19b98092a7b 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_sk.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_sk.result
@@ -8,6 +8,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
tt 1 b 1 b A 8 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_sk_2.result b/storage/tokudb/mysql-test/tokudb/r/card_sk_2.result
index 8ff57b63e5d..950fdaf7850 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_sk_2.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_sk_2.result
@@ -8,6 +8,7 @@ tt 1 a 1 a A 4 NULL NULL YES BTREE
tt 1 a 2 b A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/card_unique_sk.result b/storage/tokudb/mysql-test/tokudb/r/card_unique_sk.result
index cbcab7bdc44..22b0733a933 100644
--- a/storage/tokudb/mysql-test/tokudb/r/card_unique_sk.result
+++ b/storage/tokudb/mysql-test/tokudb/r/card_unique_sk.result
@@ -7,6 +7,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
tt 0 a 1 a A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
+test.tt analyze status Engine-independent statistics collected
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_date.result b/storage/tokudb/mysql-test/tokudb/r/type_date.result
index 047dc6dc777..70281843ac6 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_date.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_date.result
@@ -100,7 +100,7 @@ DROP TABLE t1, t2, t3;
CREATE TABLE t1 (y YEAR);
INSERT INTO t1 VALUES ('abc');
Warnings:
-Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1
+Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`y` at row 1
SELECT * FROM t1;
y
0000
@@ -211,7 +211,7 @@ a
0000-00-00
0000-00-00
INSERT INTO t1 VALUES ('0000-00-00');
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`a` at row 1
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
CREATE TABLE t1 (a DATE);
@@ -240,7 +240,7 @@ a
1000-00-00
1000-00-00
INSERT INTO t1 VALUES ('1000-00-00');
-ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1
+ERROR 22007: Incorrect date value: '1000-00-00' for column `test`.`t1`.`a` at row 1
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
CREATE TABLE t1 SELECT curdate() AS f1;
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_datetime.result b/storage/tokudb/mysql-test/tokudb/r/type_datetime.result
index 698bad10390..dbe93b37271 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_datetime.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_datetime.result
@@ -218,7 +218,7 @@ insert into t1 set dt='2007-03-23 13:49:38',da=dt;
Warnings:
Note 1265 Data truncated for column 'da' at row 1
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
-ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
+ERROR 22007: Incorrect date value: '2007-03-32' for column `test`.`t1`.`da` at row 1
select * from t1;
da dt
1962-03-03 1962-03-03 00:00:00
@@ -586,7 +586,7 @@ insert into t1 set dt='2007-03-23 13:49:38',da=dt;
Warnings:
Note 1265 Data truncated for column 'da' at row 1
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
-ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
+ERROR 22007: Incorrect date value: '2007-03-32' for column `test`.`t1`.`da` at row 1
select * from t1;
da dt
1962-03-03 1962-03-03 00:00:00
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
index afea1736a5a..3b82bbcef4f 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
@@ -177,9 +177,9 @@ Note 1265 Data truncated for column 'a' at row 2
insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'a' at row 2
+Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2
Note 1265 Data truncated for column 'a' at row 3
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
+Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_float.result b/storage/tokudb/mysql-test/tokudb/r/type_float.result
index f8ce24f08c4..daff546cc81 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_float.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_float.result
@@ -459,7 +459,7 @@ Warnings:
Warning 1265 Data truncated for column 'f' at row 1
INSERT INTO t1 VALUES ('.');
Warnings:
-Warning 1366 Incorrect double value: '.' for column 'f' at row 1
+Warning 1366 Incorrect double value: '.' for column `test`.`t1`.`f` at row 1
SELECT * FROM t1 ORDER BY f;
f
0
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result b/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result
index ec8a947a78c..ad920deeda4 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_newdecimal.result
@@ -826,7 +826,7 @@ Warning 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT INTO Sow6_2f VALUES ('a59b');
-ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1
+ERROR 22007: Incorrect decimal value: 'a59b' for column `test`.`Sow6_2f`.`col1` at row 1
drop table Sow6_2f;
select 10.3330000000000/12.34500000;
10.3330000000000/12.34500000
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py
index 2c7d8dd9a54..2c7d8dd9a54 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py
index 6bd5de38fe8..6bd5de38fe8 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char.py
index c53442ade50..c53442ade50 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py
index e92797918d5..e92797918d5 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py
index 065e37b186d..065e37b186d 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py
index fe73fce0d53..fe73fce0d53 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int.py
index 6f69156e260..6f69156e260 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py
index fd7e5868c40..fd7e5868c40 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py
index 1708c65efde..1708c65efde 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py
index 5222564a9a2..5222564a9a2 100755..100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash.result
index 70bc86e1abc..65b79f136a9 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash.result
@@ -13,6 +13,7 @@ t 0 PRIMARY 1 id A 6 NULL NULL BTREE
t 1 x 1 x A 6 NULL NULL YES BTREE
analyze table t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1.result
index b6d9fd7da85..f62e90bdecf 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1.result
@@ -12,6 +12,7 @@ t 0 PRIMARY 1 id A 4 NULL NULL BTREE
t 1 x 1 x A 4 NULL NULL YES BTREE
analyze table t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result
index caaa963c325..7609a5a1504 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result
@@ -13,6 +13,7 @@ t 0 PRIMARY 1 id A 7 NULL NULL BTREE
t 1 x 1 x A 7 NULL NULL YES BTREE
analyze table t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2.result
index 6d345d98c95..39c59f51b3c 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2.result
@@ -12,6 +12,7 @@ t 0 PRIMARY 1 id A 4 NULL NULL BTREE
t 1 x 1 x A 4 NULL NULL YES BTREE
analyze table t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2_pick.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2_pick.result
index 06639c311cf..406d4da8d37 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2_pick.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_2_pick.result
@@ -13,6 +13,7 @@ t 0 PRIMARY 1 id A 7 NULL NULL BTREE
t 1 x 1 x A 7 NULL NULL YES BTREE
analyze table t;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db757_part_alter_analyze.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db757_part_alter_analyze.result
index 62337802688..e839d5fd527 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db757_part_alter_analyze.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db757_part_alter_analyze.result
@@ -11,6 +11,7 @@ t 1 x 1 x A 5 NULL NULL YES BTREE
t 1 y 1 y A 5 NULL NULL YES BTREE
alter table t analyze partition p0;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -19,6 +20,7 @@ t 1 x 1 x A 5 NULL NULL YES BTREE
t 1 y 1 y A 5 NULL NULL YES BTREE
alter table t analyze partition p1;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -29,10 +31,11 @@ insert into t values (100,1,1),(200,2,1),(300,3,1),(400,4,1),(500,5,1);
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 9 NULL NULL BTREE
-t 1 x 1 x A 9 NULL NULL YES BTREE
+t 1 x 1 x A 2 NULL NULL YES BTREE
t 1 y 1 y A 9 NULL NULL YES BTREE
alter table t analyze partition p0;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
@@ -41,6 +44,7 @@ t 1 x 1 x A 9 NULL NULL YES BTREE
t 1 y 1 y A 9 NULL NULL YES BTREE
alter table t analyze partition p1;
Table Op Msg_type Msg_text
+test.t analyze status Engine-independent statistics collected
test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_2_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_2_tokudb.result
index 410e6fd0ba2..994be80c4fe 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_2_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_2_tokudb.result
@@ -517,6 +517,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1009,6 +1010,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1516,6 +1518,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2017,6 +2020,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2516,6 +2520,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3026,6 +3031,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3538,6 +3544,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4038,6 +4045,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4531,6 +4539,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5023,6 +5032,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5530,6 +5540,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6031,6 +6042,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6530,6 +6542,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7040,6 +7053,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7552,6 +7566,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8052,6 +8067,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8562,6 +8578,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9070,6 +9087,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9593,6 +9611,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10110,6 +10129,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10625,6 +10645,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11151,6 +11172,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11679,6 +11701,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12195,6 +12218,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12704,6 +12728,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13212,6 +13237,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13735,6 +13761,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14252,6 +14279,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14767,6 +14795,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15293,6 +15322,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15821,6 +15851,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16337,6 +16368,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16832,6 +16864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17325,6 +17358,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17833,6 +17867,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18335,6 +18370,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18835,6 +18871,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19346,6 +19383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19859,6 +19897,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20360,6 +20399,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20854,6 +20894,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21347,6 +21388,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21855,6 +21897,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22357,6 +22400,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22857,6 +22901,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23368,6 +23413,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23881,6 +23927,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24382,6 +24429,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24876,6 +24924,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25369,6 +25418,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25877,6 +25927,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26379,6 +26430,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26879,6 +26931,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27390,6 +27443,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27903,6 +27957,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28404,6 +28459,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_tokudb.result
index 093dbbe11c5..8b57e929951 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_1_tokudb.result
@@ -835,6 +835,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1327,6 +1328,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1834,6 +1836,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2335,6 +2338,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2836,6 +2840,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3346,6 +3351,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3858,6 +3864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4358,6 +4365,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4851,6 +4859,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5343,6 +5352,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5850,6 +5860,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6351,6 +6362,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6852,6 +6864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7362,6 +7375,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7874,6 +7888,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8374,6 +8389,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8884,6 +8900,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9392,6 +9409,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9915,6 +9933,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10432,6 +10451,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10949,6 +10969,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11475,6 +11496,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12003,6 +12025,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12519,6 +12542,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13028,6 +13052,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13536,6 +13561,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14059,6 +14085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14576,6 +14603,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15093,6 +15121,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15619,6 +15648,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16147,6 +16177,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16663,6 +16694,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_2_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_2_tokudb.result
index a05ce5cb71b..7103426b454 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_2_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter1_2_tokudb.result
@@ -464,6 +464,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -904,6 +905,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1359,6 +1361,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1808,6 +1811,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2257,6 +2261,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2715,6 +2720,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3175,6 +3181,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3623,6 +3630,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4064,6 +4072,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4504,6 +4513,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4959,6 +4969,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5408,6 +5419,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5857,6 +5869,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6315,6 +6328,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6775,6 +6789,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7223,6 +7238,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7680,6 +7696,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8136,6 +8153,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8607,6 +8625,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9072,6 +9091,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9537,6 +9557,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10011,6 +10032,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10487,6 +10509,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10951,6 +10974,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11396,6 +11420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11836,6 +11861,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12291,6 +12317,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12740,6 +12767,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13187,6 +13215,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13645,6 +13674,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14105,6 +14135,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14553,6 +14584,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14994,6 +15026,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15434,6 +15467,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15889,6 +15923,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16338,6 +16373,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16785,6 +16821,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17243,6 +17280,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17703,6 +17741,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18151,6 +18190,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18609,6 +18649,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19065,6 +19106,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19536,6 +19578,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20001,6 +20044,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20464,6 +20508,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20938,6 +20983,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21414,6 +21460,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21878,6 +21925,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22335,6 +22383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22791,6 +22840,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23262,6 +23312,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23727,6 +23778,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24190,6 +24242,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24664,6 +24717,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25140,6 +25194,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25604,6 +25659,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26046,6 +26102,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26486,6 +26543,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26941,6 +26999,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27390,6 +27449,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27837,6 +27897,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28295,6 +28356,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28755,6 +28817,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29203,6 +29266,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29644,6 +29708,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30084,6 +30149,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30539,6 +30605,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30988,6 +31055,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31435,6 +31503,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31893,6 +31962,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32353,6 +32423,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32801,6 +32872,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33258,6 +33330,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33714,6 +33787,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34185,6 +34259,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34650,6 +34725,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35113,6 +35189,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35587,6 +35664,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36063,6 +36141,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36527,6 +36606,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_1_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_1_tokudb.result
index a398ac33f42..eba06e441c9 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_1_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_1_tokudb.result
@@ -481,6 +481,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -937,6 +938,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1408,6 +1410,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1873,6 +1876,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2338,6 +2342,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2812,6 +2817,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3288,6 +3294,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3752,6 +3759,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4248,6 +4256,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4742,6 +4751,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5251,6 +5261,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5754,6 +5765,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6257,6 +6269,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6769,6 +6782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7283,6 +7297,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7785,6 +7800,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8280,6 +8296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8774,6 +8791,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9283,6 +9301,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9786,6 +9805,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10289,6 +10309,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10801,6 +10822,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11315,6 +11337,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11817,6 +11840,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12327,6 +12351,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12835,6 +12860,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13358,6 +13384,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13875,6 +13902,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14392,6 +14420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14918,6 +14947,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15446,6 +15476,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15962,6 +15993,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16471,6 +16503,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16979,6 +17012,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17502,6 +17536,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18019,6 +18054,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18536,6 +18572,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19062,6 +19099,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19590,6 +19628,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20106,6 +20145,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_2_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_2_tokudb.result
index 60cc765a570..6acd1198d16 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_2_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_1_2_tokudb.result
@@ -477,6 +477,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -933,6 +934,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1404,6 +1406,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1869,6 +1872,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2332,6 +2336,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2806,6 +2811,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3282,6 +3288,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3746,6 +3753,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4243,6 +4251,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4738,6 +4747,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5248,6 +5258,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5752,6 +5763,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6254,6 +6266,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6767,6 +6780,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7282,6 +7296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7785,6 +7800,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8281,6 +8297,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8776,6 +8793,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9286,6 +9304,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9790,6 +9809,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10292,6 +10312,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10805,6 +10826,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11320,6 +11342,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11823,6 +11846,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12333,6 +12357,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12841,6 +12866,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13364,6 +13390,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13881,6 +13908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14396,6 +14424,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14922,6 +14951,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15450,6 +15480,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15966,6 +15997,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16475,6 +16507,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16983,6 +17016,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17506,6 +17540,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18023,6 +18058,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18538,6 +18574,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19064,6 +19101,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19592,6 +19630,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20108,6 +20147,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_1_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_1_tokudb.result
index 0b5d8289ecc..6f58b3de45a 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_1_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_1_tokudb.result
@@ -483,6 +483,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -941,6 +942,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1414,6 +1416,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1879,6 +1882,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2346,6 +2350,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2820,6 +2825,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3298,6 +3304,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3764,6 +3771,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4261,6 +4269,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4757,6 +4766,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5268,6 +5278,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5771,6 +5782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6276,6 +6288,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6788,6 +6801,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7304,6 +7318,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7808,6 +7823,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8305,6 +8321,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8801,6 +8818,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9312,6 +9330,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9815,6 +9834,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10320,6 +10340,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10832,6 +10853,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11348,6 +11370,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11852,6 +11875,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12364,6 +12388,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12874,6 +12899,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13399,6 +13425,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13916,6 +13943,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14435,6 +14463,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14961,6 +14990,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15491,6 +15521,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16009,6 +16040,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16520,6 +16552,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17030,6 +17063,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17555,6 +17589,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18072,6 +18107,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18591,6 +18627,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19117,6 +19154,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19647,6 +19685,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20165,6 +20204,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_2_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_2_tokudb.result
index 67bae3acecb..2a1049bb5ee 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_2_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter2_2_2_tokudb.result
@@ -479,6 +479,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -938,6 +939,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1412,6 +1414,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1882,6 +1885,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2350,6 +2354,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2829,6 +2834,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3308,6 +3314,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3775,6 +3782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4275,6 +4283,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4773,6 +4782,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5286,6 +5296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5795,6 +5806,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6302,6 +6314,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6820,6 +6833,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7338,6 +7352,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7844,6 +7859,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8343,6 +8359,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8841,6 +8858,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9354,6 +9372,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9863,6 +9882,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10370,6 +10390,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10888,6 +10909,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11406,6 +11428,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11912,6 +11935,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12425,6 +12449,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12936,6 +12961,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13462,6 +13488,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13984,6 +14011,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14504,6 +14532,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15035,6 +15064,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15566,6 +15596,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16085,6 +16116,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16597,6 +16629,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17108,6 +17141,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17634,6 +17668,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18156,6 +18191,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18676,6 +18712,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19207,6 +19244,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19738,6 +19776,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20257,6 +20296,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter4_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter4_tokudb.result
index 808f646dd48..27c473e0a5a 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter4_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_alter4_tokudb.result
@@ -60,6 +60,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -483,6 +484,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -519,6 +521,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -945,6 +948,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -989,6 +993,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -1418,6 +1423,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1460,6 +1466,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -1885,6 +1892,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1925,6 +1933,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -2352,6 +2361,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2396,6 +2406,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -2828,6 +2839,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2872,6 +2884,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -3306,6 +3319,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3346,6 +3360,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -3772,6 +3787,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3810,6 +3826,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -4233,6 +4250,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4269,6 +4287,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -4695,6 +4714,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4739,6 +4759,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -5168,6 +5189,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5210,6 +5232,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -5635,6 +5658,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5675,6 +5699,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -6102,6 +6127,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6146,6 +6172,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -6578,6 +6605,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6622,6 +6650,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -7056,6 +7085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7096,6 +7126,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -7522,6 +7553,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7983,6 +8015,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8445,6 +8478,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8918,6 +8952,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9385,6 +9420,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9852,6 +9888,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10328,6 +10365,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10806,6 +10844,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11272,6 +11311,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11733,6 +11773,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12195,6 +12236,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12668,6 +12710,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13135,6 +13178,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13602,6 +13646,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14078,6 +14123,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14556,6 +14602,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15022,6 +15069,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15060,6 +15108,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -15483,6 +15532,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15519,6 +15569,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -15945,6 +15996,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15989,6 +16041,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -16418,6 +16471,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16460,6 +16514,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -16885,6 +16940,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16925,6 +16981,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -17352,6 +17409,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17396,6 +17454,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -17828,6 +17887,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17872,6 +17932,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -18306,6 +18367,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18346,6 +18408,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -18772,6 +18835,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19236,6 +19300,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19698,6 +19763,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20171,6 +20237,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20638,6 +20705,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21105,6 +21173,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21581,6 +21650,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22059,6 +22129,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22525,6 +22596,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22986,6 +23058,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23448,6 +23521,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23921,6 +23995,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24388,6 +24463,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24855,6 +24931,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25331,6 +25408,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25809,6 +25887,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26275,6 +26354,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26736,6 +26816,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27198,6 +27279,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27671,6 +27753,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28138,6 +28221,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28605,6 +28689,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29081,6 +29166,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29559,6 +29645,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30025,6 +30112,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30486,6 +30574,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30948,6 +31037,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31421,6 +31511,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31888,6 +31979,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32355,6 +32447,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -32831,6 +32924,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33309,6 +33403,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -33775,6 +33870,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34236,6 +34332,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -34698,6 +34795,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35171,6 +35269,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -35638,6 +35737,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36105,6 +36205,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -36581,6 +36682,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37059,6 +37161,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37525,6 +37628,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -37990,6 +38094,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -38453,6 +38558,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -38927,6 +39033,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -39395,6 +39502,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -39863,6 +39971,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -40340,6 +40449,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -40819,6 +40929,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -41286,6 +41397,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -41748,6 +41860,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -42211,6 +42324,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -42685,6 +42799,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -43153,6 +43268,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -43621,6 +43737,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -44098,6 +44215,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -44577,6 +44695,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45044,6 +45163,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45505,6 +45625,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -45967,6 +46088,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -46440,6 +46562,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -46907,6 +47030,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -47374,6 +47498,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -47850,6 +47975,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -48328,6 +48454,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -48794,6 +48921,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -49255,6 +49383,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -49717,6 +49846,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -50190,6 +50320,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -50657,6 +50788,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -51124,6 +51256,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -51600,6 +51733,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -52078,6 +52212,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -52544,6 +52679,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53006,6 +53142,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53469,6 +53606,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -53943,6 +54081,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -54411,6 +54550,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -54879,6 +55019,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -55356,6 +55497,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -55835,6 +55977,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -56302,6 +56445,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -56764,6 +56908,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -57224,6 +57369,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -57695,6 +57841,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -58160,6 +58307,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -58625,6 +58773,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -59099,6 +59248,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -59575,6 +59725,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60039,6 +60190,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60498,6 +60650,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -60958,6 +61111,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -61429,6 +61583,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -61894,6 +62049,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -62359,6 +62515,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -62833,6 +62990,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -63309,6 +63467,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -63773,6 +63932,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -64552,6 +64712,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65012,6 +65173,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65483,6 +65645,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -65948,6 +66111,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -66413,6 +66577,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -66887,6 +67052,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -67363,6 +67529,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -67827,6 +67994,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -68291,6 +68459,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -68753,6 +68922,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -69226,6 +69396,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -69693,6 +69864,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -70160,6 +70332,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -70636,6 +70809,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -71114,6 +71288,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -71580,6 +71755,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72041,6 +72217,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72503,6 +72680,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -72976,6 +73154,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -73443,6 +73622,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -73910,6 +74090,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -74386,6 +74567,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -74864,6 +75046,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -75330,6 +75513,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -75791,6 +75975,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -76253,6 +76438,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -76726,6 +76912,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -77193,6 +77380,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -77660,6 +77848,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -78136,6 +78325,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -78614,6 +78804,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -79080,6 +79271,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -79541,6 +79733,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80003,6 +80196,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80476,6 +80670,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -80943,6 +81138,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -81410,6 +81606,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -81886,6 +82083,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -82364,6 +82562,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -82830,6 +83029,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -83291,6 +83491,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -83753,6 +83954,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -84226,6 +84428,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -84693,6 +84896,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -85160,6 +85364,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -85636,6 +85841,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -86114,6 +86320,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -86580,6 +86787,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87039,6 +87247,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87493,6 +87702,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -87955,6 +88165,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -88415,6 +88626,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -88873,6 +89085,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -89335,6 +89548,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -89797,6 +90011,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -90255,6 +90470,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_basic_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_basic_tokudb.result
index ae20097fdda..8c19f82b9b6 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_basic_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_basic_tokudb.result
@@ -484,6 +484,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -939,6 +940,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1409,6 +1411,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1873,6 +1876,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2337,6 +2341,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2810,6 +2815,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3289,6 +3295,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3752,6 +3759,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4209,6 +4217,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4664,6 +4673,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5134,6 +5144,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5598,6 +5609,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6060,6 +6072,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -6533,6 +6546,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7008,6 +7022,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7471,6 +7486,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -7969,6 +7985,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8461,6 +8478,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -8968,6 +8986,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9469,6 +9488,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -9970,6 +9990,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10480,6 +10501,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -10996,6 +11018,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11496,6 +11519,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -11989,6 +12013,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12481,6 +12506,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -12988,6 +13014,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13489,6 +13516,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -13990,6 +14018,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -14500,6 +14529,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15016,6 +15046,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -15516,6 +15547,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16025,6 +16057,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -16533,6 +16566,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17056,6 +17090,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -17573,6 +17608,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18090,6 +18126,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -18616,6 +18653,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19148,6 +19186,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -19664,6 +19703,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20162,6 +20202,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -20654,6 +20695,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21161,6 +21203,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -21662,6 +21705,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22161,6 +22205,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -22671,6 +22716,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23183,6 +23229,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -23683,6 +23730,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24176,6 +24224,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -24668,6 +24717,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25175,6 +25225,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -25676,6 +25727,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26175,6 +26227,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -26685,6 +26738,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27197,6 +27251,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -27697,6 +27752,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28206,6 +28262,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -28714,6 +28771,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29237,6 +29295,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -29754,6 +29813,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30269,6 +30329,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -30795,6 +30856,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31323,6 +31385,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -31839,6 +31902,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_debug_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_debug_tokudb.result
index af3aaddca7c..125155bad9f 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_debug_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_debug_tokudb.result
@@ -20,6 +20,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -45,9 +46,11 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -79,6 +82,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -106,9 +110,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -140,6 +146,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -167,9 +174,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -201,6 +210,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -228,9 +238,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -262,6 +274,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -289,9 +302,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -323,6 +338,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -350,9 +366,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -384,6 +402,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -411,9 +430,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -445,6 +466,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -472,9 +494,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -507,6 +531,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -532,9 +557,11 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -567,6 +594,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -592,9 +620,11 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -628,6 +658,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -653,6 +684,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -683,6 +715,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -709,6 +742,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -741,6 +775,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -766,6 +801,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -796,6 +832,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -822,6 +859,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -854,6 +892,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -879,6 +918,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -909,6 +949,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -935,6 +976,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -967,6 +1009,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -992,6 +1035,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1022,6 +1066,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1048,6 +1093,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1080,6 +1126,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1105,6 +1152,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1135,6 +1183,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1161,6 +1210,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1193,6 +1243,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1218,6 +1269,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1248,6 +1300,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1274,6 +1327,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1306,6 +1360,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1331,6 +1386,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1361,6 +1417,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1387,6 +1444,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1419,6 +1477,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1444,6 +1503,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1475,6 +1535,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1501,6 +1562,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1534,6 +1596,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1559,6 +1622,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1590,6 +1654,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1616,6 +1681,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1649,6 +1715,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1674,6 +1741,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1705,6 +1773,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1731,6 +1800,7 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1765,6 +1835,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1789,9 +1860,11 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1823,6 +1896,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1849,9 +1923,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1883,6 +1959,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1909,9 +1986,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1943,6 +2022,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1969,9 +2049,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -1998,6 +2080,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2024,9 +2107,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2053,6 +2138,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2079,9 +2165,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2108,6 +2196,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2132,9 +2221,11 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2161,6 +2252,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2185,9 +2277,11 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2214,6 +2308,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2238,9 +2333,11 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2268,6 +2365,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2292,6 +2390,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2322,6 +2421,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2347,6 +2447,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2379,6 +2480,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2403,6 +2505,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2433,6 +2536,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2458,6 +2562,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2490,6 +2595,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2514,6 +2620,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2544,6 +2651,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2569,6 +2677,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2601,6 +2710,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2625,6 +2735,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2650,6 +2761,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2675,6 +2787,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2702,6 +2815,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2726,6 +2840,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2751,6 +2866,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2776,6 +2892,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2803,6 +2920,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2827,6 +2945,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2852,6 +2971,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2877,6 +2997,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2904,6 +3025,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2928,6 +3050,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2953,6 +3076,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -2978,6 +3102,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3005,6 +3130,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3029,6 +3155,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3054,6 +3181,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3079,6 +3207,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3106,6 +3235,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3130,6 +3260,7 @@ a b
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3155,6 +3286,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3180,6 +3312,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3209,6 +3342,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3235,9 +3369,11 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3269,6 +3405,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3297,9 +3434,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3331,6 +3470,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3359,9 +3499,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3393,6 +3535,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3421,9 +3564,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3455,6 +3600,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3483,9 +3629,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3517,6 +3665,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3545,9 +3694,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3579,6 +3730,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3607,9 +3759,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3642,6 +3796,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3670,9 +3825,11 @@ ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
#sql-t1.par
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3705,6 +3862,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3731,9 +3889,11 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3766,6 +3926,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3792,9 +3953,11 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3827,6 +3990,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3853,9 +4017,11 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3888,6 +4054,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3914,9 +4081,11 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
# State after crash recovery
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3951,6 +4120,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -3977,6 +4147,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4007,6 +4178,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4034,6 +4206,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4066,6 +4239,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4092,6 +4266,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4122,6 +4297,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4149,6 +4325,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4181,6 +4358,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4207,6 +4385,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4237,6 +4416,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4264,6 +4444,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4296,6 +4477,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4322,6 +4504,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4352,6 +4535,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4379,6 +4563,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4411,6 +4596,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4437,6 +4623,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4467,6 +4654,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4494,6 +4682,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4526,6 +4715,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4552,6 +4742,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4582,6 +4773,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4609,6 +4801,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4641,6 +4834,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4667,6 +4861,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4698,6 +4893,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4725,6 +4921,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4758,6 +4955,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4784,6 +4982,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4815,6 +5014,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4842,6 +5042,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4875,6 +5076,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4901,6 +5103,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4932,6 +5135,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4959,6 +5163,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -4992,6 +5197,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5018,6 +5224,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5049,6 +5256,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5076,6 +5284,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5109,6 +5318,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5135,6 +5345,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5166,6 +5377,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5193,6 +5405,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5226,6 +5439,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5252,6 +5466,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5283,6 +5498,7 @@ PARTITION BY LIST (a)
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5310,6 +5526,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
# State after failure
+db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
@@ -5363,6 +5580,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -5392,10 +5610,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -5459,6 +5679,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -5488,10 +5709,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -5555,6 +5778,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -5584,10 +5808,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -5651,6 +5877,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -5680,10 +5907,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -5747,6 +5976,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -5776,10 +6006,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -5843,6 +6075,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -5872,10 +6105,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -5939,6 +6174,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -5968,10 +6204,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -6035,6 +6273,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -6064,10 +6303,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -6131,6 +6372,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
+db.opt
t1.frm
t1.par
t2.frm
@@ -6160,10 +6402,12 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
+db.opt
t1.frm
t1.par
t2.frm
# State after crash recovery
+db.opt
t1.frm
t1.par
t2.frm
@@ -6227,6 +6471,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6256,6 +6501,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6319,6 +6565,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6348,6 +6595,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6411,6 +6659,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6440,6 +6689,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: 0 "Internal error/check (Not system error)")
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6503,6 +6753,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6532,6 +6783,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6595,6 +6847,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6624,6 +6877,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: 0 "Internal error/check (Not system error)")
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6687,6 +6941,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6716,6 +6971,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6779,6 +7035,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6808,6 +7065,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)")
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6871,6 +7129,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6900,6 +7159,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6963,6 +7223,7 @@ PARTITION BY RANGE (a)
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
+db.opt
t1.frm
t1.par
t2.frm
@@ -6992,6 +7253,7 @@ a b
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
+db.opt
t1.frm
t1.par
t2.frm
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_engine_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_engine_tokudb.result
index a921ba0f56d..028809cd36b 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_engine_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_engine_tokudb.result
@@ -475,6 +475,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -933,6 +934,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1395,6 +1397,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -1920,6 +1923,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2421,6 +2425,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -2883,6 +2888,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3342,6 +3348,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -3804,6 +3811,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4269,6 +4277,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -4723,6 +4732,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
@@ -5178,6 +5188,7 @@ AND f_int2 <> CAST(f_char1 AS SIGNED INT)
AND f_charbig = '####updated per insert trigger####';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc0_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc0_tokudb.result
index 4c30d47f526..558c3cbdff4 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc0_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc0_tokudb.result
@@ -1020,6 +1020,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+MySQL_Test_DB.t1 analyze status Engine-independent statistics collected
MySQL_Test_DB.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc10_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc10_tokudb.result
index 6ccd9afefab..1c2f23a277b 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc10_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc10_tokudb.result
@@ -949,6 +949,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+MySQL_Test_DB.t1 analyze status Engine-independent statistics collected
MySQL_Test_DB.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc1_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc1_tokudb.result
index fce0d496032..76418679582 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc1_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_mgm_lc1_tokudb.result
@@ -987,6 +987,7 @@ a b
2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze status OK
# Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX;
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/r/mdev12179.result b/storage/tokudb/mysql-test/tokudb_rpl/r/mdev12179.result
index d4532eec4e2..d79e7e59aa4 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/r/mdev12179.result
+++ b/storage/tokudb/mysql-test/tokudb_rpl/r/mdev12179.result
@@ -2,6 +2,7 @@ include/master-slave.inc
[connection master]
connection server_2;
include/stop_slave.inc
+SET GLOBAL gtid_cleanup_batch_size = 999999999;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET sql_log_bin=0;
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos;
@@ -41,6 +42,8 @@ a
1
SELECT * FROM mysql.gtid_slave_pos ORDER BY sub_id;
domain_id sub_id server_id seq_no
+0 1 1 1
+0 2 1 2
0 3 1 3
0 4 1 4
SELECT * FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
@@ -121,6 +124,21 @@ Transactions_multi_engine 6
DELETE FROM t1 WHERE a >= 100;
DELETE FROM t2 WHERE a >= 100;
DELETE FROM t3 WHERE a >= 100;
+connection server_1;
+include/save_master_gtid.inc
+connection server_2;
+include/sync_with_master_gtid.inc
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos;
+COUNT(*)>=10
+1
+SELECT COUNT(*)>=10 FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
+UNION ALL SELECT * FROM mysql.gtid_slave_pos_innodb_redundant) inner_select;
+COUNT(*)>=10
+1
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos_tokudb;
+COUNT(*)>=10
+1
+SET GLOBAL gtid_cleanup_batch_size = 3;
connection server_2;
include/stop_slave.inc
SET sql_log_bin=0;
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/t/mdev12179.test b/storage/tokudb/mysql-test/tokudb_rpl/t/mdev12179.test
index ceb119cd0dc..1d19a25889e 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/t/mdev12179.test
+++ b/storage/tokudb/mysql-test/tokudb_rpl/t/mdev12179.test
@@ -4,6 +4,12 @@
--connection server_2
--source include/stop_slave.inc
+
+# Set GTID cleanup limit high enough that cleanup will not run and we
+# can rely on consistent table output in .result.
+--let $old_gtid_cleanup_batch_size=`SELECT @@GLOBAL.gtid_cleanup_batch_size`
+SET GLOBAL gtid_cleanup_batch_size = 999999999;
+
CHANGE MASTER TO master_use_gtid=slave_pos;
SET sql_log_bin=0;
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos;
@@ -89,6 +95,82 @@ DELETE FROM t2 WHERE a >= 100;
DELETE FROM t3 WHERE a >= 100;
+# Create a bunch more GTIDs in mysql.gtid_slave_pos* tables to test with.
+--connection server_1
+--disable_query_log
+let $i=10;
+while ($i) {
+ eval INSERT INTO t1 VALUES (300+$i);
+ eval INSERT INTO t2 VALUES (300+$i);
+ eval INSERT INTO t3 VALUES (300+$i);
+ dec $i;
+}
+--enable_query_log
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+
+# Check that we have many rows in mysql.gtid_slave_pos now (since
+# @@gtid_cleanup_batch_size was set to a huge value). No need to check
+# for an exact number, since that will require changing .result if
+# anything changes prior to this point, and we just need to know that
+# we have still have some data in the tables to make the following
+# test effective.
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos;
+SELECT COUNT(*)>=10 FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
+ UNION ALL SELECT * FROM mysql.gtid_slave_pos_innodb_redundant) inner_select;
+SELECT COUNT(*)>=10 FROM mysql.gtid_slave_pos_tokudb;
+
+# Check that old GTID rows will be deleted when batch delete size is
+# set reasonably. Old row deletion is not 100% deterministic (by design), so
+# we must wait for it to occur, but it should occur eventually.
+SET GLOBAL gtid_cleanup_batch_size = 3;
+let $i=40;
+--disable_query_log
+--let $keep_include_silent=1
+while ($i) {
+ let N=`SELECT 1+($i MOD 3)`;
+ --connection server_1
+ eval UPDATE t$N SET a=a+1 WHERE a=(SELECT MAX(a) FROM t$N);
+ --source include/save_master_gtid.inc
+ --connection server_2
+ --source include/sync_with_master_gtid.inc
+ let $j=50;
+ while ($j) {
+ let $is_done=`SELECT SUM(a)=1 FROM (
+ SELECT COUNT(*) AS a FROM mysql.gtid_slave_pos
+ UNION ALL
+ SELECT COUNT(*) AS a FROM ( SELECT * FROM mysql.gtid_slave_pos_innodb
+ UNION ALL SELECT * FROM mysql.gtid_slave_pos_innodb_redundant) inner_select
+ UNION ALL
+ SELECT COUNT(*) AS a FROM mysql.gtid_slave_pos_tokudb) outer_select`;
+ if ($is_done) {
+ let $j=0;
+ }
+ if (!$is_done) {
+ real_sleep 0.1;
+ dec $j;
+ }
+ }
+ dec $i;
+ if ($is_done) {
+ let $i=0;
+ }
+}
+--enable_query_log
+--let $keep_include_silent=0
+if (!$is_done) {
+ --echo Timed out waiting for mysql.gtid_slave_pos* tables to be cleaned up
+}
+
+--disable_query_log
+DELETE FROM t1 WHERE a >= 100;
+DELETE FROM t2 WHERE a >= 100;
+DELETE FROM t3 WHERE a >= 100;
+--enable_query_log
+
+
# Test status variables Rpl_transactions_multi_engine and Transactions_gtid_foreign_engine.
# Have mysql.gtid_slave_pos* for myisam and innodb but not tokudb.
--connection server_2
@@ -223,6 +305,9 @@ SHOW STATUS LIKE "%transactions%engine";
SET sql_log_bin=0;
DROP TABLE mysql.gtid_slave_pos_innodb;
SET sql_log_bin=1;
+--disable_query_log
+eval SET GLOBAL gtid_cleanup_batch_size = $old_gtid_cleanup_batch_size;
+--enable_query_log
--connection server_1
DROP TABLE t1;
diff --git a/storage/tokudb/tokudb_sysvars.cc b/storage/tokudb/tokudb_sysvars.cc
index 1e841f3b959..c561fb65dc8 100644
--- a/storage/tokudb/tokudb_sysvars.cc
+++ b/storage/tokudb/tokudb_sysvars.cc
@@ -892,6 +892,7 @@ static MYSQL_THDVAR_ULONGLONG(
1);
#endif // defined(TOKU_INCLUDE_RFR) && TOKU_INCLUDE_RFR
+#if defined(TOKU_INCLUDE_UPSERT)
static MYSQL_THDVAR_BOOL(
enable_fast_update,
PLUGIN_VAR_THDLOCAL,
@@ -900,13 +901,14 @@ static MYSQL_THDVAR_BOOL(
NULL,
false);
-static MYSQL_THDVAR_BOOL(
+ static MYSQL_THDVAR_BOOL(
enable_fast_upsert,
PLUGIN_VAR_THDLOCAL,
"disable slow upsert",
NULL,
NULL,
false);
+#endif
#if TOKU_INCLUDE_XA
static MYSQL_THDVAR_BOOL(
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 2b764e8827e..6c94ce2271e 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -772,7 +772,7 @@ static json_state_handler json_actions[NR_JSON_STATES][NR_C_CLASSES]=
syntax_error, syntax_error, syntax_error, syntax_error, syntax_error,
syntax_error, syntax_error, syntax_error, not_json_chr, bad_chr},
{/*OBJ_CONT*/
- unexpected_eos, syntax_error, end_object, syntax_error, end_array,
+ unexpected_eos, syntax_error, end_object, syntax_error, syntax_error,
syntax_error, next_key, syntax_error, syntax_error, syntax_error,
syntax_error, syntax_error, syntax_error, not_json_chr, bad_chr},
{/*ARRAY_CONT*/
@@ -1846,3 +1846,253 @@ int json_path_compare(const json_path_t *a, const json_path_t *b,
b->steps+1, b->last_step, vt);
}
+
+static enum json_types smart_read_value(json_engine_t *je,
+ const char **value, int *value_len)
+{
+ if (json_read_value(je))
+ goto err_return;
+
+ *value= (char *) je->value;
+
+ if (json_value_scalar(je))
+ *value_len= je->value_len;
+ else
+ {
+ if (json_skip_level(je))
+ goto err_return;
+
+ *value_len= (int) ((char *) je->s.c_str - *value);
+ }
+
+ return je->value_type;
+
+err_return:
+ return JSV_BAD_JSON;
+}
+
+
+enum json_types json_type(const char *js, const char *js_end,
+ const char **value, int *value_len)
+{
+ json_engine_t je;
+
+ json_scan_start(&je, &my_charset_utf8mb4_bin,(const uchar *) js,
+ (const uchar *) js_end);
+
+ return smart_read_value(&je, value, value_len);
+}
+
+
+enum json_types json_get_array_item(const char *js, const char *js_end,
+ int n_item,
+ const char **value, int *value_len)
+{
+ json_engine_t je;
+ int c_item= 0;
+
+ json_scan_start(&je, &my_charset_utf8mb4_bin,(const uchar *) js,
+ (const uchar *) js_end);
+
+ if (json_read_value(&je) ||
+ je.value_type != JSON_VALUE_ARRAY)
+ goto err_return;
+
+ while (!json_scan_next(&je))
+ {
+ switch (je.state)
+ {
+ case JST_VALUE:
+ if (c_item == n_item)
+ return smart_read_value(&je, value, value_len);
+
+ if (json_skip_key(&je))
+ goto err_return;
+
+ c_item++;
+ break;
+
+ case JST_ARRAY_END:
+ *value= (const char *) (je.s.c_str - je.sav_c_len);
+ *value_len= c_item;
+ return JSV_NOTHING;
+ }
+ }
+
+err_return:
+ return JSV_BAD_JSON;
+}
+
+
+/** Simple json lookup for a value by the key.
+
+ Expects JSON object.
+ Only scans the 'first level' of the object, not
+ the nested structures.
+
+ @param js [in] json object to search in
+ @param js_end [in] end of json string
+ @param key [in] key to search for
+ @param key_end [in] - " -
+ @param value_start [out] pointer into js (value or closing })
+ @param value_len [out] length of the value found or number of keys
+
+ @retval the type of the key value
+ @retval JSV_BAD_JSON - syntax error found reading JSON.
+ or not JSON object.
+ @retval JSV_NOTHING - no such key found.
+*/
+enum json_types json_get_object_key(const char *js, const char *js_end,
+ const char *key,
+ const char **value, int *value_len)
+{
+ const char *key_end= key + strlen(key);
+ json_engine_t je;
+ json_string_t key_name;
+ int n_keys= 0;
+
+ json_string_set_cs(&key_name, &my_charset_utf8mb4_bin);
+
+ json_scan_start(&je, &my_charset_utf8mb4_bin,(const uchar *) js,
+ (const uchar *) js_end);
+
+ if (json_read_value(&je) ||
+ je.value_type != JSON_VALUE_OBJECT)
+ goto err_return;
+
+ while (!json_scan_next(&je))
+ {
+ switch (je.state)
+ {
+ case JST_KEY:
+ n_keys++;
+ json_string_set_str(&key_name, (const uchar *) key,
+ (const uchar *) key_end);
+ if (json_key_matches(&je, &key_name))
+ return smart_read_value(&je, value, value_len);
+
+ if (json_skip_key(&je))
+ goto err_return;
+
+ break;
+
+ case JST_OBJ_END:
+ *value= (const char *) (je.s.c_str - je.sav_c_len);
+ *value_len= n_keys;
+ return JSV_NOTHING;
+ }
+ }
+
+err_return:
+ return JSV_BAD_JSON;
+}
+
+
+enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
+ const char **keyname, const char **keyname_end,
+ const char **value, int *value_len)
+{
+ return JSV_NOTHING;
+}
+
+
+/** Check if json is valid (well-formed)
+
+ @retval 0 - success, json is well-formed
+ @retval 1 - error, json is invalid
+*/
+int json_valid(const char *js, size_t js_len, CHARSET_INFO *cs)
+{
+ json_engine_t je;
+ json_scan_start(&je, cs, (const uchar *) js, (const uchar *) js + js_len);
+ while (json_scan_next(&je) == 0) /* no-op */ ;
+ return je.s.error == 0;
+}
+
+
+/*
+ Expects the JSON object as an js argument, and the key name.
+ Looks for this key in the object and returns
+ the location of all the text related to it.
+ The text includes the comma, separating this key.
+
+ comma_pos - the hint where the comma is. It is important
+ if you plan to replace the key rather than just cut.
+ 1 - comma is on the left
+ 2 - comma is on the right.
+ 0 - no comma at all (the object has just this single key)
+
+ if no such key found *key_start is set to NULL.
+*/
+int json_locate_key(const char *js, const char *js_end,
+ const char *kname,
+ const char **key_start, const char **key_end,
+ int *comma_pos)
+{
+ const char *kname_end= kname + strlen(kname);
+ json_engine_t je;
+ json_string_t key_name;
+ int t_next, c_len, match_result;
+
+ json_string_set_cs(&key_name, &my_charset_utf8mb4_bin);
+
+ json_scan_start(&je, &my_charset_utf8mb4_bin,(const uchar *) js,
+ (const uchar *) js_end);
+
+ if (json_read_value(&je) ||
+ je.value_type != JSON_VALUE_OBJECT)
+ goto err_return;
+
+ *key_start= (const char *) je.s.c_str;
+ *comma_pos= 0;
+
+ while (!json_scan_next(&je))
+ {
+ switch (je.state)
+ {
+ case JST_KEY:
+ json_string_set_str(&key_name, (const uchar *) kname,
+ (const uchar *) kname_end);
+ match_result= json_key_matches(&je, &key_name);
+ if (json_skip_key(&je))
+ goto err_return;
+ get_first_nonspace(&je.s, &t_next, &c_len);
+ je.s.c_str-= c_len;
+
+ if (match_result)
+ {
+ *key_end= (const char *) je.s.c_str;
+
+ if (*comma_pos == 1)
+ return 0;
+
+ DBUG_ASSERT(*comma_pos == 0);
+
+ if (t_next == C_COMMA)
+ {
+ *key_end+= c_len;
+ *comma_pos= 2;
+ }
+ else if (t_next == C_RCURB)
+ *comma_pos= 0;
+ else
+ goto err_return;
+ return 0;
+ }
+
+ *key_start= (const char *) je.s.c_str;
+ *comma_pos= 1;
+ break;
+
+ case JST_OBJ_END:
+ *key_start= NULL;
+ return 0;
+ }
+ }
+
+err_return:
+ return 1;
+
+}
+
+
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
index 4d9ca1c815b..3f7a79556f9 100644
--- a/support-files/compiler_warnings.supp
+++ b/support-files/compiler_warnings.supp
@@ -204,7 +204,6 @@
.*/ctype-simple\.c : .*unary minus operator applied to unsigned type, result still unsigned.*
.*/sql/sys_vars\.cc : invalid access to non-static data member
.*/string3\.h : memset used with constant zero length parameter
-.*/sql/wsrep_hton\.cc : NULL used in arithmetic : 500-600
.* : missing-declarations.*is valid
#
diff --git a/support-files/policy/apparmor/usr.sbin.mysqld b/support-files/policy/apparmor/usr.sbin.mysqld
index 05ec77414d2..6555c614889 100644
--- a/support-files/policy/apparmor/usr.sbin.mysqld
+++ b/support-files/policy/apparmor/usr.sbin.mysqld
@@ -101,13 +101,12 @@
/usr/bin/cut rix,
/usr/bin/dirname rix,
/usr/bin/gawk rix,
- /usr/bin/innobackupex rix,
/usr/bin/mysql rix,
/usr/bin/perl rix,
/usr/bin/seq rix,
/usr/bin/wsrep_sst* rix,
/usr/bin/wsrep_sst_common r,
- /usr/bin/xtrabackup* rix,
+ /usr/bin/mariabackup* rix,
/var/lib/mysql/ r,
/var/lib/mysql/** rw,
/var/lib/mysql/*.log w,
diff --git a/support-files/policy/selinux/mariadb-server.fc b/support-files/policy/selinux/mariadb-server.fc
index 409f72923aa..e3f2b5015c7 100644
--- a/support-files/policy/selinux/mariadb-server.fc
+++ b/support-files/policy/selinux/mariadb-server.fc
@@ -6,5 +6,5 @@
/var/lib/mysql/.*\.err -- gen_context(system_u:object_r:mysqld_log_t,s0)
/var/lib/mysql/.*\.pid -- gen_context(system_u:object_r:mysqld_var_run_t,s0)
/var/lib/mysql/.*\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0)
-/usr/bin/xtrabackup.* -- gen_context(system_u:object_r:mysqld_exec_t,s0)
+/usr/bin/mariabackup.* -- gen_context(system_u:object_r:mysqld_exec_t,s0)
/usr/bin/wsrep.* -- gen_context(system_u:object_r:mysqld_safe_exec_t,s0)
diff --git a/support-files/policy/selinux/mariadb-server.te b/support-files/policy/selinux/mariadb-server.te
index 45ef40f4153..71924012283 100644
--- a/support-files/policy/selinux/mariadb-server.te
+++ b/support-files/policy/selinux/mariadb-server.te
@@ -78,7 +78,7 @@ allow mysqld_t user_tmp_t:file create;
allow mysqld_t bin_t:lnk_file read;
allow mysqld_t tmp_t:file { append create read write open getattr unlink setattr };
-# Allows too much leeway - the xtrabackup/wsrep rules in fc should fix it, but
+# Allows too much leeway - the mariabackup/wsrep rules in fc should fix it, but
# keep for the moment.
allow mysqld_t shell_exec_t:file { execute_no_trans getattr read execute open };
allow mysqld_t bin_t:file { getattr read execute open execute_no_trans ioctl };
@@ -93,7 +93,7 @@ allow mysqld_t tram_port_t:tcp_socket name_bind;
# This rule allows port udp/4567 (see README)
allow mysqld_t mysqld_port_t:udp_socket name_bind;
-# Rules related to XtraBackup
+# Rules related to mariabackup
allow mysqld_t self:netlink_tcpdiag_socket { create nlmsg_read };
allow mysqld_t sysctl_net_t:file { read getattr open };
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 90c8b503a05..2d238d84d54 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -20305,8 +20305,67 @@ static void test_bulk_autoinc()
myquery(rc);
}
-#endif
+static void test_bulk_delete()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[1];
+ MYSQL_ROW row;
+ char indicator[]= {0, 0, 0};
+ my_bool error[1];
+ int i, id[]= {1, 2, 4}, count= sizeof(id)/sizeof(id[0]);
+ MYSQL_RES *result;
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE t1 (id int not null primary key)");
+ myquery(rc);
+ rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1),(2),(3),(4)");
+ myquery(rc);
+ verify_affected_rows(4);
+
+ stmt= mysql_stmt_init(mysql);
+ rc= mysql_stmt_prepare(stmt, "DELETE FROM t1 where id=?", -1);
+ check_execute(stmt, rc);
+
+ memset(bind, 0, sizeof(bind));
+ bind[0].buffer_type = MYSQL_TYPE_LONG;
+ bind[0].buffer = (void *)id;
+ bind[0].buffer_length = 0;
+ bind[0].is_null = NULL;
+ bind[0].length = NULL;
+ bind[0].error = error;
+ bind[0].u.indicator= indicator;
+ mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, (void*)&count);
+ rc= mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ verify_affected_rows(3);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "SELECT id FROM t1");
+ myquery(rc);
+
+ result= mysql_store_result(mysql);
+ mytest(result);
+
+ i= 0;
+ while ((row= mysql_fetch_row(result)))
+ {
+ i++;
+ DIE_IF(atoi(row[0]) != 3);
+ }
+ DIE_IF(i != 1);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+}
+
+#endif
static void print_metadata(MYSQL_RES *rs_metadata, int num_fields)
{
@@ -20915,6 +20974,7 @@ static struct my_tests_st my_tests[]= {
#ifndef EMBEDDED_LIBRARY
{ "test_proxy_header", test_proxy_header},
{ "test_bulk_autoinc", test_bulk_autoinc},
+ { "test_bulk_delete", test_bulk_delete },
#endif
{ "test_explain_meta", test_explain_meta },
{ 0, 0 }
diff --git a/unittest/mysys/lf-t.c b/unittest/mysys/lf-t.c
index abfa74877f8..7070da648a8 100644
--- a/unittest/mysys/lf-t.c
+++ b/unittest/mysys/lf-t.c
@@ -48,9 +48,6 @@ pthread_handler_t test_lf_pinbox(void *arg)
pins= lf_pinbox_get_pins(&lf_allocator.pinbox);
}
lf_pinbox_put_pins(pins);
- pthread_mutex_lock(&mutex);
- if (!--running_threads) pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
if (with_my_thread_init)
my_thread_end();
@@ -105,7 +102,6 @@ pthread_handler_t test_lf_alloc(void *arg)
bad|= lf_allocator.mallocs - lf_alloc_pool_count(&lf_allocator);
#endif
}
- if (!--running_threads) pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
if (with_my_thread_init)
@@ -172,7 +168,6 @@ pthread_handler_t test_lf_hash(void *arg)
lf_hash.size, inserts, scans);
bad|= lf_hash.count;
}
- if (!--running_threads) pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
if (with_my_thread_init)
my_thread_end();
diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c
index 79e93b36ad9..7a7fbaeecd1 100644
--- a/unittest/mysys/my_atomic-t.c
+++ b/unittest/mysys/my_atomic-t.c
@@ -29,9 +29,6 @@ pthread_handler_t test_atomic_add(void *arg)
my_atomic_add32(&bad, x);
my_atomic_add32(&bad, -x);
}
- pthread_mutex_lock(&mutex);
- if (!--running_threads) pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
return 0;
}
@@ -47,13 +44,6 @@ pthread_handler_t test_atomic_add64(void *arg)
my_atomic_add64(&a64, x);
my_atomic_add64(&a64, -x);
}
- pthread_mutex_lock(&mutex);
- if (!--running_threads)
- {
- bad= (a64 != 0);
- pthread_cond_signal(&cond);
- }
- pthread_mutex_unlock(&mutex);
return 0;
}
@@ -83,9 +73,6 @@ pthread_handler_t test_atomic_fas(void *arg)
my_atomic_add32(&bad, -x);
- pthread_mutex_lock(&mutex);
- if (!--running_threads) pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
return 0;
}
@@ -109,9 +96,6 @@ pthread_handler_t test_atomic_cas(void *arg)
ok= my_atomic_cas32(&bad, &y, y-x);
} while (!ok) ;
}
- pthread_mutex_lock(&mutex);
- if (!--running_threads) pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
return 0;
}
@@ -142,4 +126,5 @@ void do_tests()
}
a64=0;
test_concurrently("my_atomic_add64", test_atomic_add64, THREADS, CYCLES);
+ bad= (a64 != 0);
}
diff --git a/unittest/mysys/thr_template.c b/unittest/mysys/thr_template.c
index 83c7432c823..3a57ed091e9 100644
--- a/unittest/mysys/thr_template.c
+++ b/unittest/mysys/thr_template.c
@@ -20,35 +20,34 @@
#include <tap.h>
volatile uint32 bad;
-pthread_attr_t thr_attr;
pthread_mutex_t mutex;
-pthread_cond_t cond;
-uint running_threads;
void do_tests();
void test_concurrently(const char *test, pthread_handler handler, int n, int m)
{
- pthread_t t;
+ pthread_t *threads= malloc(n * sizeof(pthread_t));
+ int i;
ulonglong now= my_interval_timer();
+ assert(threads);
bad= 0;
diag("Testing %s with %d threads, %d iterations... ", test, n, m);
- for (running_threads= n ; n ; n--)
+ for (i= n; i; i--)
{
- if (pthread_create(&t, &thr_attr, handler, &m) != 0)
+ if (pthread_create(&threads[i], 0, handler, &m) != 0)
{
diag("Could not create thread");
abort();
}
}
- pthread_mutex_lock(&mutex);
- while (running_threads)
- pthread_cond_wait(&cond, &mutex);
- pthread_mutex_unlock(&mutex);
+
+ for (i= n; i; i--)
+ pthread_join(threads[i], 0);
now= my_interval_timer() - now;
+ free(threads);
ok(!bad, "tested %s in %g secs (%d)", test, ((double)now)/1e9, bad);
}
@@ -60,9 +59,6 @@ int main(int argc __attribute__((unused)), char **argv)
DBUG_SET_INITIAL(argv[1]);
pthread_mutex_init(&mutex, 0);
- pthread_cond_init(&cond, 0);
- pthread_attr_init(&thr_attr);
- pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
#define CYCLES 3000
#define THREADS 30
@@ -71,16 +67,7 @@ int main(int argc __attribute__((unused)), char **argv)
do_tests();
- /*
- workaround until we know why it crashes randomly on some machine
- (BUG#22320).
- */
-#ifdef NOT_USED
- sleep(2);
-#endif
pthread_mutex_destroy(&mutex);
- pthread_cond_destroy(&cond);
- pthread_attr_destroy(&thr_attr);
my_end(0);
return exit_status();
}
diff --git a/unittest/mysys/waiting_threads-t.c b/unittest/mysys/waiting_threads-t.c
index 01fc850cb96..a2cb7a51c85 100644
--- a/unittest/mysys/waiting_threads-t.c
+++ b/unittest/mysys/waiting_threads-t.c
@@ -136,10 +136,8 @@ retry:
pthread_mutex_unlock(&lock);
pthread_mutex_unlock(& thds[id].lock);
wt_thd_destroy(& thds[id].thd);
-
- if (!--running_threads) /* now, signal when everybody is done with deinit */
- pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
+
DBUG_PRINT("wt", ("exiting"));
my_thread_end();
return 0;
diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc
index 3fff2d49daa..8397c539dd5 100644
--- a/unittest/sql/mf_iocache-t.cc
+++ b/unittest/sql/mf_iocache-t.cc
@@ -352,7 +352,7 @@ void mdev17133()
// random size 2nd read
res= my_b_read(&info, buf_i + total + MY_MIN(19, curr_read_size),
19 >= curr_read_size ? 0 : curr_read_size - 19);
- ok(res == 0, "rest of read %lu", curr_read_size - 19);
+ ok(res == 0, "rest of read %lu", (ulong) (curr_read_size - 19));
// mark read bytes in the used part of the cache buffer
memset(info.buffer, 0, info.read_pos - info.buffer);
diff --git a/unittest/strings/CMakeLists.txt b/unittest/strings/CMakeLists.txt
index 245747538c9..0896e132d24 100644
--- a/unittest/strings/CMakeLists.txt
+++ b/unittest/strings/CMakeLists.txt
@@ -1,3 +1,3 @@
-MY_ADD_TESTS(strings LINK_LIBRARIES strings mysys)
+MY_ADD_TESTS(strings json LINK_LIBRARIES strings mysys)
diff --git a/unittest/strings/json-t.c b/unittest/strings/json-t.c
new file mode 100644
index 00000000000..ce0f04dc030
--- /dev/null
+++ b/unittest/strings/json-t.c
@@ -0,0 +1,82 @@
+/* Copyright (c) 2019, MariaDB Corporation
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <tap.h>
+#include <my_sys.h>
+#include <json_lib.h>
+
+int json_locate_key(const char *js, const char *js_end, const char *kname,
+ const char **key_start, const char **key_end,
+ int *comma_pos);
+int main()
+{
+ const char *json="{\"int\":1, \"str\":\"foo bar\", "
+ "\"array\":[10,20,{\"c\":\"d\"}],\"bool\":false}";
+ const char *json_ar="[1, \"foo bar\", " "[10,20,{\"c\":\"d\"}], false]";
+ const char *json_w="{\"int\" : 1 , \"str\" : \"foo bar\" , "
+ "\"array\" : [10,20,{\"c\":\"d\"}] , \"bool\" : false }";
+ const char *json_1="{ \"str\" : \"foo bar\" }";
+ enum json_types value_type;
+ const char *value_start;
+ int value_len;
+ const char *key_start, *key_end;
+ int result, comma_pos;
+
+ plan(15);
+
+#define do_json(V) \
+ do { \
+ value_type= json_get_object_key(json, json+strlen(json), \
+ V, &value_start, &value_len); \
+ ok(value_type != JSV_BAD_JSON, V); \
+ diag("type=%d, value=\"%.*s\"", value_type, (int)value_len, value_start); \
+ } while(0)
+#define do_json_ar(N) \
+ do { \
+ value_type= json_get_array_item(json_ar, json_ar+strlen(json_ar), \
+ N, &value_start, &value_len); \
+ ok(value_type != JSV_BAD_JSON, #N); \
+ diag("type=%d, value=\"%.*s\"", value_type, (int)value_len, value_start); \
+ } while(0)
+#define do_json_locate(J, V) \
+ do { \
+ result= json_locate_key(J, J+strlen(J), \
+ V, &key_start, &key_end, &comma_pos); \
+ ok(result == 0, V); \
+ if (key_start) \
+ diag("key_str=\"%.*s\" comma_pos= %d", (int)(key_end - key_start), key_start, comma_pos); \
+ else \
+ diag("no key found"); \
+ } while(0)
+
+ do_json("int");
+ do_json("str");
+ do_json("bool");
+ do_json("c");
+ do_json("array");
+
+ do_json_ar(0);
+ do_json_ar(1);
+ do_json_ar(2);
+ do_json_ar(3);
+ do_json_ar(4);
+
+ do_json_locate(json_w, "bool");
+ do_json_locate(json_w, "int");
+ do_json_locate(json_w, "array");
+ do_json_locate(json_1, "str");
+ do_json_locate(json_w, "c");
+ return exit_status();
+}
diff --git a/vio/docs/TODO b/vio/docs/TODO
deleted file mode 100644
index 7296ab73a10..00000000000
--- a/vio/docs/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-* Consistent error handling. May be the initialization should
- be taken out of constructors and be put into virtual method open().
-* The open() method is named very misleadingly().
diff --git a/win/upgrade_wizard/upgradeDlg.cpp b/win/upgrade_wizard/upgradeDlg.cpp
index d996c0ebe5d..793e89886d6 100644
--- a/win/upgrade_wizard/upgradeDlg.cpp
+++ b/win/upgrade_wizard/upgradeDlg.cpp
@@ -422,21 +422,22 @@ void CUpgradeDlg::UpgradeOneService(const string& servicename)
{
allMessages[lines%MAX_MESSAGES] = output_line;
m_DataDir.SetWindowText(allMessages[lines%MAX_MESSAGES].c_str());
- output_line.clear();
lines++;
- /*
- Updating progress dialog.There are currently 9 messages from
- mysql_upgrade_service (actually it also writes Phase N/M but
- we do not parse the output right now).
- */
-#define EXPRECTED_MYSQL_UPGRADE_MESSAGES 9
-
- int stepsTotal= m_ProgressTotal*EXPRECTED_MYSQL_UPGRADE_MESSAGES;
- int stepsCurrent= m_ProgressCurrent*EXPRECTED_MYSQL_UPGRADE_MESSAGES
- + lines;
- int percentDone= stepsCurrent*100/stepsTotal;
- m_Progress.SetPos(percentDone);
+ int curPhase, numPhases;
+
+ // Parse output line to update progress indicator
+ if (strncmp(output_line.c_str(),"Phase ",6) == 0 &&
+ sscanf(output_line.c_str() +6 ,"%d/%d",&curPhase,&numPhases) == 2
+ && numPhases > 0 )
+ {
+ int stepsTotal= m_ProgressTotal*numPhases;
+ int stepsCurrent= m_ProgressCurrent*numPhases+ curPhase;
+ int percentDone= stepsCurrent*100/stepsTotal;
+ m_Progress.SetPos(percentDone);
+ m_Progress.SetPos(stepsCurrent * 100 / stepsTotal);
+ }
+ output_line.clear();
}
else
{
diff --git a/wsrep-lib b/wsrep-lib
new file mode 160000
+Subproject 136767ae044eac53e7f3d76909d176cde0dc27a
diff --git a/wsrep/CMakeLists.txt b/wsrep/CMakeLists.txt
deleted file mode 100644
index ff2bdec4def..00000000000
--- a/wsrep/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2012, Codership Oy. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-SET(WSREP_SOURCES wsrep_gtid.c wsrep_uuid.c wsrep_loader.c wsrep_dummy.c)
-
-IF(NOT WITH_INNOBASE_STORAGE_ENGINE)
- MESSAGE(WARNING "WSRep is enabled, but innodb is not. This configuration is not supported")
-ENDIF()
-
-ADD_CONVENIENCE_LIBRARY(wsrep ${WSREP_SOURCES})
-DTRACE_INSTRUMENT(wsrep)
-
-#ADD_EXECUTABLE(listener wsrep_listener.c ${WSREP_SOURCES})
-#TARGET_LINK_LIBRARIES(listener ${LIBDL})
diff --git a/wsrep/wsrep_api.h b/wsrep/wsrep_api.h
deleted file mode 100644
index 1d6bc059d3d..00000000000
--- a/wsrep/wsrep_api.h
+++ /dev/null
@@ -1,1117 +0,0 @@
-/* Copyright (C) 2009-2013 Codership Oy <info@codership.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/*!
- @file wsrep API declaration.
-
- HOW TO READ THIS FILE.
-
- Due to C language rules this header layout doesn't lend itself to intuitive
- reading. So here's the scoop: in the end this header declares two main types:
-
- * struct wsrep_init_args
-
- and
-
- * struct wsrep
-
- wsrep_init_args contains initialization parameters for wsrep provider like
- names, addresses, etc. and pointers to callbacks. The callbacks will be called
- by provider when it needs to do something application-specific, like log a
- message or apply a writeset. It should be passed to init() call from
- wsrep API. It is an application part of wsrep API contract.
-
- struct wsrep is the interface to wsrep provider. It contains all wsrep API
- calls. It is a provider part of wsrep API contract.
-
- Finally, wsrep_load() method loads (dlopens) wsrep provider library. It is
- defined in wsrep_loader.c unit and is part of libwsrep.a (which is not a
- wsrep provider, but a convenience library).
-
- wsrep_unload() does the reverse.
-
-*/
-#ifndef WSREP_H
-#define WSREP_H
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**************************************************************************
- * *
- * wsrep replication API *
- * *
- **************************************************************************/
-
-#define WSREP_INTERFACE_VERSION "25"
-
-/*! Empty backend spec */
-#define WSREP_NONE "none"
-
-
-/*!
- * @brief log severity levels, passed as first argument to log handler
- */
-typedef enum wsrep_log_level
-{
- WSREP_LOG_FATAL, //!< Unrecoverable error, application must quit.
- WSREP_LOG_ERROR, //!< Operation failed, must be repeated.
- WSREP_LOG_WARN, //!< Unexpected condition, but no operational failure.
- WSREP_LOG_INFO, //!< Informational message.
- WSREP_LOG_DEBUG //!< Debug message. Shows only of compiled with debug.
-} wsrep_log_level_t;
-
-/*!
- * @brief error log handler
- *
- * All messages from wsrep provider are directed to this
- * handler, if present.
- *
- * @param level log level
- * @param message log message
- */
-typedef void (*wsrep_log_cb_t)(wsrep_log_level_t, const char *);
-
-
-/*!
- * Certain provider capabilities application may want to know about
- */
-#define WSREP_CAP_MULTI_MASTER ( 1ULL << 0 )
-#define WSREP_CAP_CERTIFICATION ( 1ULL << 1 )
-#define WSREP_CAP_PARALLEL_APPLYING ( 1ULL << 2 )
-#define WSREP_CAP_TRX_REPLAY ( 1ULL << 3 )
-#define WSREP_CAP_ISOLATION ( 1ULL << 4 )
-#define WSREP_CAP_PAUSE ( 1ULL << 5 )
-#define WSREP_CAP_CAUSAL_READS ( 1ULL << 6 )
-#define WSREP_CAP_CAUSAL_TRX ( 1ULL << 7 )
-#define WSREP_CAP_INCREMENTAL_WRITESET ( 1ULL << 8 )
-#define WSREP_CAP_SESSION_LOCKS ( 1ULL << 9 )
-#define WSREP_CAP_DISTRIBUTED_LOCKS ( 1ULL << 10 )
-#define WSREP_CAP_CONSISTENCY_CHECK ( 1ULL << 11 )
-#define WSREP_CAP_UNORDERED ( 1ULL << 12 )
-#define WSREP_CAP_ANNOTATION ( 1ULL << 13 )
-#define WSREP_CAP_PREORDERED ( 1ULL << 14 )
-
-
-/*!
- * Writeset flags
- *
- * COMMIT the writeset and all preceding writesets must be committed
- * ROLLBACK all preceding writesets in a transaction must be rolled back
- * ISOLATION the writeset must be applied AND committed in isolation
- * PA_UNSAFE the writeset cannot be applied in parallel
- * COMMUTATIVE the order in which the writeset is applied does not matter
- * NATIVE the writeset contains another writeset in this provider format
- *
- * Note that some of the flags are mutually exclusive (e.g. COMMIT and
- * ROLLBACK).
- */
-#define WSREP_FLAG_COMMIT ( 1ULL << 0 )
-#define WSREP_FLAG_ROLLBACK ( 1ULL << 1 )
-#define WSREP_FLAG_ISOLATION ( 1ULL << 2 )
-#define WSREP_FLAG_PA_UNSAFE ( 1ULL << 3 )
-#define WSREP_FLAG_COMMUTATIVE ( 1ULL << 4 )
-#define WSREP_FLAG_NATIVE ( 1ULL << 5 )
-
-
-typedef uint64_t wsrep_trx_id_t; //!< application transaction ID
-typedef uint64_t wsrep_conn_id_t; //!< application connection ID
-typedef int64_t wsrep_seqno_t; //!< sequence number of a writeset, etc.
-#ifdef __cplusplus
-typedef bool wsrep_bool_t;
-#else
-typedef _Bool wsrep_bool_t; //!< should be the same as standard (C99) bool
-#endif /* __cplusplus */
-
-/*! undefined seqno */
-#define WSREP_SEQNO_UNDEFINED (-1)
-
-
-/*! wsrep provider status codes */
-typedef enum wsrep_status
-{
- WSREP_OK = 0, //!< success
- WSREP_WARNING, //!< minor warning, error logged
- WSREP_TRX_MISSING, //!< transaction is not known by wsrep
- WSREP_TRX_FAIL, //!< transaction aborted, server can continue
- WSREP_BF_ABORT, //!< trx was victim of brute force abort
- WSREP_SIZE_EXCEEDED, //!< data exceeded maximum supported size
- WSREP_CONN_FAIL, //!< error in client connection, must abort
- WSREP_NODE_FAIL, //!< error in node state, wsrep must reinit
- WSREP_FATAL, //!< fatal error, server must abort
- WSREP_NOT_IMPLEMENTED //!< feature not implemented
-} wsrep_status_t;
-
-
-/*! wsrep callbacks status codes */
-typedef enum wsrep_cb_status
-{
- WSREP_CB_SUCCESS = 0, //!< success (as in "not critical failure")
- WSREP_CB_FAILURE //!< critical failure (consistency violation)
- /* Technically, wsrep provider has no use for specific failure codes since
- * there is nothing it can do about it but abort execution. Therefore any
- * positive number shall indicate a critical failure. Optionally that value
- * may be used by provider to come to a consensus about state consistency
- * in a group of nodes. */
-} wsrep_cb_status_t;
-
-
-/*!
- * UUID type - for all unique IDs
- */
-typedef struct wsrep_uuid {
- uint8_t data[16];
-} wsrep_uuid_t;
-
-/*! Undefined UUID */
-static const wsrep_uuid_t WSREP_UUID_UNDEFINED = {{0,}};
-
-/*! UUID string representation length, terminating '\0' not included */
-#define WSREP_UUID_STR_LEN 36
-
-/*!
- * Scan UUID from string
- * @return length of UUID string representation or negative error code
- */
-extern int
-wsrep_uuid_scan (const char* str, size_t str_len, wsrep_uuid_t* uuid);
-
-/*!
- * Print UUID to string
- * @return length of UUID string representation or negative error code
- */
-extern int
-wsrep_uuid_print (const wsrep_uuid_t* uuid, char* str, size_t str_len);
-
-#define WSREP_MEMBER_NAME_LEN 32 //!< maximum logical member name length
-#define WSREP_INCOMING_LEN 256 //!< max Domain Name length + 0x00
-
-
-/*!
- * Global transaction identifier
- */
-typedef struct wsrep_gtid
-{
- wsrep_uuid_t uuid; /*!< History UUID */
- wsrep_seqno_t seqno; /*!< Sequence number */
-} wsrep_gtid_t;
-
-/*! Undefined GTID */
-static const wsrep_gtid_t WSREP_GTID_UNDEFINED = {{{0, }}, -1};
-
-/*! Minimum number of bytes guaranteed to store GTID string representation,
- * terminating '\0' not included (36 + 1 + 20) */
-#define WSREP_GTID_STR_LEN 57
-
-
-/*!
- * Scan GTID from string
- * @return length of GTID string representation or negative error code
- */
-extern int
-wsrep_gtid_scan(const char* str, size_t str_len, wsrep_gtid_t* gtid);
-
-/*!
- * Print GTID to string
- * @return length of GTID string representation or negative error code
- */
-extern int
-wsrep_gtid_print(const wsrep_gtid_t* gtid, char* str, size_t str_len);
-
-
-/*!
- * Transaction meta data
- */
-typedef struct wsrep_trx_meta
-{
- wsrep_gtid_t gtid; /*!< Global transaction identifier */
- wsrep_seqno_t depends_on; /*!< Sequence number part of the last transaction
- this transaction depends on */
-} wsrep_trx_meta_t;
-
-
-/*!
- * member status
- */
-typedef enum wsrep_member_status {
- WSREP_MEMBER_UNDEFINED, //!< undefined state
- WSREP_MEMBER_JOINER, //!< incomplete state, requested state transfer
- WSREP_MEMBER_DONOR, //!< complete state, donates state transfer
- WSREP_MEMBER_JOINED, //!< complete state
- WSREP_MEMBER_SYNCED, //!< complete state, synchronized with group
- WSREP_MEMBER_ERROR, //!< this and above is provider-specific error code
- WSREP_MEMBER_MAX
-} wsrep_member_status_t;
-
-/*!
- * static information about a group member (some fields are tentative yet)
- */
-typedef struct wsrep_member_info {
- wsrep_uuid_t id; //!< group-wide unique member ID
- char name[WSREP_MEMBER_NAME_LEN]; //!< human-readable name
- char incoming[WSREP_INCOMING_LEN]; //!< address for client requests
-} wsrep_member_info_t;
-
-/*!
- * group status
- */
-typedef enum wsrep_view_status {
- WSREP_VIEW_PRIMARY, //!< primary group configuration (quorum present)
- WSREP_VIEW_NON_PRIMARY, //!< non-primary group configuration (quorum lost)
- WSREP_VIEW_DISCONNECTED, //!< not connected to group, retrying.
- WSREP_VIEW_MAX
-} wsrep_view_status_t;
-
-/*!
- * view of the group
- */
-typedef struct wsrep_view_info {
- wsrep_gtid_t state_id; //!< global state ID
- wsrep_seqno_t view; //!< global view number
- wsrep_view_status_t status; //!< view status
- wsrep_bool_t state_gap; //!< gap between global and local states
- int my_idx; //!< index of this member in the view
- int memb_num; //!< number of members in the view
- int proto_ver; //!< application protocol agreed on the view
- wsrep_member_info_t members[1];//!< array of member information
-} wsrep_view_info_t;
-
-/*!
- * Magic string to tell provider to engage into trivial (empty) state transfer.
- * No data will be passed, but the node shall be considered JOINED.
- * Should be passed in sst_req parameter of wsrep_view_cb_t.
- */
-#define WSREP_STATE_TRANSFER_TRIVIAL "trivial"
-
-/*!
- * Magic string to tell provider not to engage in state transfer at all.
- * The member will stay in WSREP_MEMBER_UNDEFINED state but will keep on
- * receiving all writesets.
- * Should be passed in sst_req parameter of wsrep_view_cb_t.
- */
-#define WSREP_STATE_TRANSFER_NONE "none"
-
-/*!
- * @brief group view handler
- *
- * This handler is called in total order corresponding to the group
- * configuration change. It is to provide a vital information about
- * new group view. If view info indicates existence of discontinuity
- * between group and member states, state transfer request message
- * should be filled in by the callback implementation.
- *
- * @note Currently it is assumed that sst_req is allocated using
- * malloc()/calloc()/realloc() and it will be freed by
- * wsrep implementation.
- *
- * @param app_ctx application context
- * @param recv_ctx receiver context
- * @param view new view on the group
- * @param state current state
- * @param state_len lenght of current state
- * @param sst_req location to store SST request
- * @param sst_req_len location to store SST request length or error code,
- * value of 0 means no SST.
- */
-typedef enum wsrep_cb_status (*wsrep_view_cb_t) (
- void* app_ctx,
- void* recv_ctx,
- const wsrep_view_info_t* view,
- const char* state,
- size_t state_len,
- void** sst_req,
- size_t* sst_req_len
-);
-
-
-/*!
- * @brief apply callback
- *
- * This handler is called from wsrep library to apply replicated writeset
- * Must support brute force applying for multi-master operation
- *
- * @param recv_ctx receiver context pointer provided by the application
- * @param data data buffer containing the writeset
- * @param size data buffer size
- * @param flags WSREP_FLAG_... flags
- * @param meta transaction meta data of the writeset to be applied
- *
- * @return success code:
- * @retval WSREP_OK
- * @retval WSREP_NOT_IMPLEMENTED appl. does not support the writeset format
- * @retval WSREP_ERROR failed to apply the writeset
- */
-typedef enum wsrep_cb_status (*wsrep_apply_cb_t) (
- void* recv_ctx,
- const void* data,
- size_t size,
- uint32_t flags,
- const wsrep_trx_meta_t* meta
-);
-
-
-/*!
- * @brief commit callback
- *
- * This handler is called to commit the changes made by apply callback.
- *
- * @param recv_ctx receiver context pointer provided by the application
- * @param flags WSREP_FLAG_... flags
- * @param meta transaction meta data of the writeset to be committed
- * @param exit set to true to exit recv loop
- * @param commit true - commit writeset, false - rollback writeset
- *
- * @return success code:
- * @retval WSREP_OK
- * @retval WSREP_ERROR call failed
- */
-typedef enum wsrep_cb_status (*wsrep_commit_cb_t) (
- void* recv_ctx,
- uint32_t flags,
- const wsrep_trx_meta_t* meta,
- wsrep_bool_t* exit,
- wsrep_bool_t commit
-);
-
-
-/*!
- * @brief unordered callback
- *
- * This handler is called to execute unordered actions (actions that need not
- * to be executed in any particular order) attached to writeset.
- *
- * @param recv_ctx receiver context pointer provided by the application
- * @param data data buffer containing the writeset
- * @param size data buffer size
- */
-typedef enum wsrep_cb_status (*wsrep_unordered_cb_t) (
- void* recv_ctx,
- const void* data,
- size_t size
-);
-
-
-/*!
- * @brief a callback to donate state snapshot
- *
- * This handler is called from wsrep library when it needs this node
- * to deliver state to a new cluster member.
- * No state changes will be committed for the duration of this call.
- * Wsrep implementation may provide internal state to be transmitted
- * to new cluster member for initial state.
- *
- * @param app_ctx application context
- * @param recv_ctx receiver context
- * @param msg state transfer request message
- * @param msg_len state transfer request message length
- * @param gtid current state ID on this node
- * @param state current wsrep internal state buffer
- * @param state_len current wsrep internal state buffer len
- * @param bypass bypass snapshot transfer, only transfer uuid:seqno pair
- */
-typedef enum wsrep_cb_status (*wsrep_sst_donate_cb_t) (
- void* app_ctx,
- void* recv_ctx,
- const void* msg,
- size_t msg_len,
- const wsrep_gtid_t* state_id,
- const char* state,
- size_t state_len,
- wsrep_bool_t bypass
-);
-
-
-/*!
- * @brief a callback to signal application that wsrep state is synced
- * with cluster
- *
- * This callback is called after wsrep library has got in sync with
- * rest of the cluster.
- *
- * @param app_ctx application context
- */
-typedef void (*wsrep_synced_cb_t) (void* app_ctx);
-
-
-/*!
- * Initialization parameters for wsrep provider.
- */
-struct wsrep_init_args
-{
- void* app_ctx; //!< Application context for callbacks
-
- /* Configuration parameters */
- const char* node_name; //!< Symbolic name of this node (e.g. hostname)
- const char* node_address; //!< Address to be used by wsrep provider
- const char* node_incoming; //!< Address for incoming client connections
- const char* data_dir; //!< Directory where wsrep files are kept if any
- const char* options; //!< Provider-specific configuration string
- int proto_ver; //!< Max supported application protocol version
-
- /* Application initial state information. */
- const wsrep_gtid_t* state_id; //!< Application state GTID
- const char* state; //!< Initial state for wsrep provider
- size_t state_len; //!< Length of state buffer
-
- /* Application callbacks */
- wsrep_log_cb_t logger_cb; //!< logging handler
- wsrep_view_cb_t view_handler_cb; //!< group view change handler
-
- /* Applier callbacks */
- wsrep_apply_cb_t apply_cb; //!< apply callback
- wsrep_commit_cb_t commit_cb; //!< commit callback
- wsrep_unordered_cb_t unordered_cb; //!< callback for unordered actions
-
- /* State Snapshot Transfer callbacks */
- wsrep_sst_donate_cb_t sst_donate_cb; //!< starting to donate
- wsrep_synced_cb_t synced_cb; //!< synced with group
-};
-
-
-/*! Type of the stats variable value in struct wsrep_status_var */
-typedef enum wsrep_var_type
-{
- WSREP_VAR_STRING, //!< pointer to null-terminated string
- WSREP_VAR_INT64, //!< int64_t
- WSREP_VAR_DOUBLE //!< double
-}
-wsrep_var_type_t;
-
-/*! Generalized stats variable representation */
-struct wsrep_stats_var
-{
- const char* name; //!< variable name
- wsrep_var_type_t type; //!< variable value type
- union {
- int64_t _integer64;
- double _double;
- const char* _string;
- } value; //!< variable value
-};
-
-
-/*! Abstract data buffer structure */
-typedef struct wsrep_buf
-{
- const void* ptr; /*!< Pointer to data buffer */
- size_t len; /*!< Length of buffer */
-} wsrep_buf_t;
-
-/*! Key struct used to pass certification keys for transaction handling calls.
- * A key consists of zero or more key parts. */
-typedef struct wsrep_key
-{
- const wsrep_buf_t* key_parts; /*!< Array of key parts */
- size_t key_parts_num; /*!< Number of key parts */
-} wsrep_key_t;
-
-/*! Key type:
- * EXCLUSIVE conflicts with any key type
- * SEMI reserved. If not supported, should be interpeted as EXCLUSIVE
- * SHARED conflicts only with EXCLUSIVE keys */
-typedef enum wsrep_key_type
-{
- WSREP_KEY_SHARED = 0,
- WSREP_KEY_SEMI,
- WSREP_KEY_EXCLUSIVE
-} wsrep_key_type_t;
-
-/*! Data type:
- * ORDERED state modification event that should be applied and committed
- * in order.
- * UNORDERED some action that does not modify state and execution of which is
- * optional and does not need to happen in order.
- * ANNOTATION (human readable) writeset annotation. */
-typedef enum wsrep_data_type
-{
- WSREP_DATA_ORDERED = 0,
- WSREP_DATA_UNORDERED,
- WSREP_DATA_ANNOTATION
-} wsrep_data_type_t;
-
-
-/*! Transaction handle struct passed for wsrep transaction handling calls */
-typedef struct wsrep_ws_handle
-{
- wsrep_trx_id_t trx_id; //!< transaction ID
- void* opaque; //!< opaque provider transaction context data
-} wsrep_ws_handle_t;
-
-/*!
- * @brief Helper method to reset trx writeset handle state when trx id changes
- *
- * Instead of passing wsrep_ws_handle_t directly to wsrep calls,
- * wrapping handle with this call offloads bookkeeping from
- * application.
- */
-static inline wsrep_ws_handle_t* wsrep_ws_handle_for_trx(
- wsrep_ws_handle_t* ws_handle,
- wsrep_trx_id_t trx_id)
-{
- if (ws_handle->trx_id != trx_id)
- {
- ws_handle->trx_id = trx_id;
- ws_handle->opaque = NULL;
- }
- return ws_handle;
-}
-
-
-/*!
- * A handle for processing preordered actions.
- * Must be initialized to WSREP_PO_INITIALIZER before use.
- */
-typedef struct wsrep_po_handle { void* opaque; } wsrep_po_handle_t;
-
-static const wsrep_po_handle_t WSREP_PO_INITIALIZER = { NULL };
-
-
-typedef struct wsrep wsrep_t;
-/*!
- * wsrep interface for dynamically loadable libraries
- */
-struct wsrep {
-
- const char *version; //!< interface version string
-
- /*!
- * @brief Initializes wsrep provider
- *
- * @param wsrep provider handle
- * @param args wsrep initialization parameters
- */
- wsrep_status_t (*init) (wsrep_t* wsrep,
- const struct wsrep_init_args* args);
-
- /*!
- * @brief Returns provider capabilities flag bitmap
- *
- * @param wsrep provider handle
- */
- uint64_t (*capabilities) (wsrep_t* wsrep);
-
- /*!
- * @brief Passes provider-specific configuration string to provider.
- *
- * @param wsrep provider handle
- * @param conf configuration string
- *
- * @retval WSREP_OK configuration string was parsed successfully
- * @retval WSREP_WARNING could't not parse conf string, no action taken
- */
- wsrep_status_t (*options_set) (wsrep_t* wsrep, const char* conf);
-
- /*!
- * @brief Returns provider-specific string with current configuration values.
- *
- * @param wsrep provider handle
- *
- * @return a dynamically allocated string with current configuration
- * parameter values
- */
- char* (*options_get) (wsrep_t* wsrep);
-
- /*!
- * @brief Opens connection to cluster
- *
- * Returns when either node is ready to operate as a part of the clsuter
- * or fails to reach operating status.
- *
- * @param wsrep provider handle
- * @param cluster_name unique symbolic cluster name
- * @param cluster_url URL-like cluster address (backend://address)
- * @param state_donor name of the node to be asked for state transfer.
- * @param bootstrap a flag to request initialization of a new wsrep
- * service rather then a connection to the existing one.
- * clister_url may still carry important initialization
- * parameters, like backend spec and/or listen address.
- */
- wsrep_status_t (*connect) (wsrep_t* wsrep,
- const char* cluster_name,
- const char* cluster_url,
- const char* state_donor,
- wsrep_bool_t bootstrap);
-
- /*!
- * @brief Closes connection to cluster.
- *
- * If state_uuid and/or state_seqno is not NULL, will store final state
- * in there.
- *
- * @param wsrep this wsrep handler
- */
- wsrep_status_t (*disconnect)(wsrep_t* wsrep);
-
- /*!
- * @brief start receiving replication events
- *
- * This function never returns
- *
- * @param wsrep provider handle
- * @param recv_ctx receiver context
- */
- wsrep_status_t (*recv)(wsrep_t* wsrep, void* recv_ctx);
-
- /*!
- * @brief Replicates/logs result of transaction to other nodes and allocates
- * required resources.
- *
- * Must be called before transaction commit. Returns success code, which
- * caller must check.
- * In case of WSREP_OK, starts commit critical section, transaction can
- * commit. Otherwise transaction must rollback.
- *
- * @param wsrep provider handle
- * @param ws_handle writeset of committing transaction
- * @param conn_id connection ID
- * @param flags fine tuning the replication WSREP_FLAG_*
- * @param meta transaction meta data
- *
- * @retval WSREP_OK cluster-wide commit succeeded
- * @retval WSREP_TRX_FAIL must rollback transaction
- * @retval WSREP_CONN_FAIL must close client connection
- * @retval WSREP_NODE_FAIL must close all connections and reinit
- */
- wsrep_status_t (*pre_commit)(wsrep_t* wsrep,
- wsrep_conn_id_t conn_id,
- wsrep_ws_handle_t* ws_handle,
- uint32_t flags,
- wsrep_trx_meta_t* meta);
-
- /*!
- * @brief Releases resources after transaction commit.
- *
- * Ends commit critical section.
- *
- * @param wsrep provider handle
- * @param ws_handle writeset of committing transaction
- * @retval WSREP_OK post_commit succeeded
- */
- wsrep_status_t (*post_commit) (wsrep_t* wsrep,
- wsrep_ws_handle_t* ws_handle);
-
- /*!
- * @brief Releases resources after transaction rollback.
- *
- * @param wsrep provider handle
- * @param ws_handle writeset of committing transaction
- * @retval WSREP_OK post_rollback succeeded
- */
- wsrep_status_t (*post_rollback)(wsrep_t* wsrep,
- wsrep_ws_handle_t* ws_handle);
-
- /*!
- * @brief Replay trx as a slave writeset
- *
- * If local trx has been aborted by brute force, and it has already
- * replicated before this abort, we must try if we can apply it as
- * slave trx. Note that slave nodes see only trx writesets and certification
- * test based on write set content can be different to DBMS lock conflicts.
- *
- * @param wsrep provider handle
- * @param ws_handle writeset of committing transaction
- * @param trx_ctx transaction context
- *
- * @retval WSREP_OK cluster commit succeeded
- * @retval WSREP_TRX_FAIL must rollback transaction
- * @retval WSREP_BF_ABORT brute force abort happened after trx replicated
- * must rollback transaction and try to replay
- * @retval WSREP_CONN_FAIL must close client connection
- * @retval WSREP_NODE_FAIL must close all connections and reinit
- */
- wsrep_status_t (*replay_trx)(wsrep_t* wsrep,
- wsrep_ws_handle_t* ws_handle,
- void* trx_ctx);
-
- /*!
- * @brief Abort pre_commit() call of another thread.
- *
- * It is possible, that some high-priority transaction needs to abort
- * another transaction which is in pre_commit() call waiting for resources.
- *
- * The kill routine checks that abort is not attmpted against a transaction
- * which is front of the caller (in total order).
- *
- * @param wsrep provider handle
- * @param bf_seqno seqno of brute force trx, running this cancel
- * @param victim_trx transaction to be aborted, and which is committing
- *
- * @retval WSREP_OK abort secceded
- * @retval WSREP_WARNING abort failed
- */
- wsrep_status_t (*abort_pre_commit)(wsrep_t* wsrep,
- wsrep_seqno_t bf_seqno,
- wsrep_trx_id_t victim_trx);
-
- /*!
- * @brief Appends a row reference to transaction writeset
- *
- * Both copy flag and key_type can be ignored by provider (key type
- * interpreted as WSREP_KEY_EXCLUSIVE).
- *
- * @param wsrep provider handle
- * @param ws_handle writeset handle
- * @param keys array of keys
- * @param count length of the array of keys
- * @param type type ot the key
- * @param copy can be set to FALSE if keys persist through commit.
- */
- wsrep_status_t (*append_key)(wsrep_t* wsrep,
- wsrep_ws_handle_t* ws_handle,
- const wsrep_key_t* keys,
- size_t count,
- enum wsrep_key_type type,
- wsrep_bool_t copy);
-
- /*!
- * @brief Appends data to transaction writeset
- *
- * This method can be called any time before commit and it
- * appends a number of data buffers to transaction writeset.
- *
- * Both copy and unordered flags can be ignored by provider.
- *
- * @param wsrep provider handle
- * @param ws_handle writeset handle
- * @param data array of data buffers
- * @param count buffer count
- * @param type type of data
- * @param copy can be set to FALSE if data persists through commit.
- */
- wsrep_status_t (*append_data)(wsrep_t* wsrep,
- wsrep_ws_handle_t* ws_handle,
- const struct wsrep_buf* data,
- size_t count,
- enum wsrep_data_type type,
- wsrep_bool_t copy);
-
- /*!
- * @brief Get causal ordering for read operation
- *
- * This call will block until causal ordering with all possible
- * preceding writes in the cluster is guaranteed. If pointer to
- * gtid is non-null, the call stores the global transaction ID
- * of the last transaction which is guaranteed to be ordered
- * causally before this call.
- *
- * @param wsrep provider handle
- * @param gtid location to store GTID
- */
- wsrep_status_t (*causal_read)(wsrep_t* wsrep, wsrep_gtid_t* gtid);
-
- /*!
- * @brief Clears allocated connection context.
- *
- * Whenever a new connection ID is passed to wsrep provider through
- * any of the API calls, a connection context is allocated for this
- * connection. This call is to explicitly notify provider fo connection
- * closing.
- *
- * @param wsrep provider handle
- * @param conn_id connection ID
- * @param query the 'set database' query
- * @param query_len length of query (does not end with 0)
- */
- wsrep_status_t (*free_connection)(wsrep_t* wsrep,
- wsrep_conn_id_t conn_id);
-
- /*!
- * @brief Replicates a query and starts "total order isolation" section.
- *
- * Replicates the action spec and returns success code, which caller must
- * check. Total order isolation continues until to_execute_end() is called.
- *
- * @param wsrep provider handle
- * @param conn_id connection ID
- * @param keys array of keys
- * @param keys_num lenght of the array of keys
- * @param action action buffer array to be executed
- * @param count action buffer count
- * @param meta transaction meta data
- *
- * @retval WSREP_OK cluster commit succeeded
- * @retval WSREP_CONN_FAIL must close client connection
- * @retval WSREP_NODE_FAIL must close all connections and reinit
- */
- wsrep_status_t (*to_execute_start)(wsrep_t* wsrep,
- wsrep_conn_id_t conn_id,
- const wsrep_key_t* keys,
- size_t keys_num,
- const struct wsrep_buf* action,
- size_t count,
- wsrep_trx_meta_t* meta);
-
- /*!
- * @brief Ends the total order isolation section.
- *
- * Marks the end of total order isolation. TO locks are freed
- * and other transactions are free to commit from this point on.
- *
- * @param wsrep provider handle
- * @param conn_id connection ID
- *
- * @retval WSREP_OK cluster commit succeeded
- * @retval WSREP_CONN_FAIL must close client connection
- * @retval WSREP_NODE_FAIL must close all connections and reinit
- */
- wsrep_status_t (*to_execute_end)(wsrep_t* wsrep, wsrep_conn_id_t conn_id);
-
- /*!
- * @brief Collects preordered replication events into a writeset.
- *
- * @param wsrep wsrep provider handle
- * @param handle a handle associated with a given writeset
- * @param data an array of data buffers.
- * @param count length of data buffer array.
- * @param copy whether provider needs to make a copy of events.
- *
- * @retval WSREP_OK cluster-wide commit succeeded
- * @retval WSREP_TRX_FAIL operation failed (e.g. trx size exceeded limit)
- * @retval WSREP_NODE_FAIL must close all connections and reinit
- */
- wsrep_status_t (*preordered_collect) (wsrep_t* wsrep,
- wsrep_po_handle_t* handle,
- const struct wsrep_buf* data,
- size_t count,
- wsrep_bool_t copy);
-
- /*!
- * @brief "Commits" preordered writeset to cluster.
- *
- * The contract is that the writeset will be committed in the same (partial)
- * order this method was called. Frees resources associated with the writeset
- * handle and reinitializes the handle.
- *
- * @param wsrep wsrep provider handle
- * @param po_handle a handle associated with a given writeset
- * @param source_id ID of the event producer, also serves as the partial order
- * or stream ID - events with different source_ids won't be
- * ordered with respect to each other.
- * @param flags WSREP_FLAG_... flags
- * @param pa_range the number of preceding events this event can be processed
- * in parallel with. A value of 0 means strict serial
- * processing. Note: commits always happen in wsrep order.
- * @param commit 'true' to commit writeset to cluster (replicate) or
- * 'false' to rollback (cancel) the writeset.
- *
- * @retval WSREP_OK cluster-wide commit succeeded
- * @retval WSREP_TRX_FAIL operation failed (e.g. NON-PRIMARY component)
- * @retval WSREP_NODE_FAIL must close all connections and reinit
- */
- wsrep_status_t (*preordered_commit) (wsrep_t* wsrep,
- wsrep_po_handle_t* handle,
- const wsrep_uuid_t* source_id,
- uint32_t flags,
- int pa_range,
- wsrep_bool_t commit);
-
- /*!
- * @brief Signals to wsrep provider that state snapshot has been sent to
- * joiner.
- *
- * @param wsrep provider handle
- * @param state_id state ID
- * @param rcode 0 or negative error code of the operation.
- */
- wsrep_status_t (*sst_sent)(wsrep_t* wsrep,
- const wsrep_gtid_t* state_id,
- int rcode);
-
- /*!
- * @brief Signals to wsrep provider that new state snapshot has been received.
- * May deadlock if called from sst_prepare_cb.
- *
- * @param wsrep provider handle
- * @param state_id state ID
- * @param state initial state provided by SST donor
- * @param state_len length of state buffer
- * @param rcode 0 or negative error code of the operation.
- */
- wsrep_status_t (*sst_received)(wsrep_t* wsrep,
- const wsrep_gtid_t* state_id,
- const void* state,
- size_t state_len,
- int rcode);
-
-
- /*!
- * @brief Generate request for consistent snapshot.
- *
- * If successfull, this call will generate internally SST request
- * which in turn triggers calling SST donate callback on the nodes
- * specified in donor_spec. If donor_spec is null, callback is
- * called only locally. This call will block until sst_sent is called
- * from callback.
- *
- * @param wsrep provider handle
- * @param msg context message for SST donate callback
- * @param msg_len length of context message
- * @param donor_spec list of snapshot donors
- */
- wsrep_status_t (*snapshot)(wsrep_t* wsrep,
- const void* msg,
- size_t msg_len,
- const char* donor_spec);
-
- /*!
- * @brief Returns an array fo status variables.
- * Array is terminated by Null variable name.
- *
- * @param wsrep provider handle
- * @return array of struct wsrep_status_var.
- */
- struct wsrep_stats_var* (*stats_get) (wsrep_t* wsrep);
-
- /*!
- * @brief Release resources that might be associated with the array.
- *
- * @param wsrep provider handle.
- * @param var_array array returned by stats_get().
- */
- void (*stats_free) (wsrep_t* wsrep, struct wsrep_stats_var* var_array);
-
- /*!
- * @brief Reset some stats variables to inital value, provider-dependent.
- *
- * @param wsrep provider handle.
- */
- void (*stats_reset) (wsrep_t* wsrep);
-
- /*!
- * @brief Pauses writeset applying/committing.
- *
- * @return global sequence number of the paused state or negative error code.
- */
- wsrep_seqno_t (*pause) (wsrep_t* wsrep);
-
- /*!
- * @brief Resumes writeset applying/committing.
- */
- wsrep_status_t (*resume) (wsrep_t* wsrep);
-
- /*!
- * @brief Desynchronize from cluster
- *
- * Effectively turns off flow control for this node, allowing it
- * to fall behind the cluster.
- */
- wsrep_status_t (*desync) (wsrep_t* wsrep);
-
- /*!
- * @brief Request to resynchronize with cluster.
- *
- * Effectively turns on flow control. Asynchronous - actual synchronization
- * event to be deliverred via sync_cb.
- */
- wsrep_status_t (*resync) (wsrep_t* wsrep);
-
- /*!
- * @brief Acquire global named lock
- *
- * @param wsrep wsrep provider handle
- * @param name lock name
- * @param shared shared or exclusive lock
- * @param owner 64-bit owner ID
- * @param tout timeout in nanoseconds.
- * 0 - return immediately, -1 wait forever.
- * @return wsrep status or negative error code
- * @retval -EDEADLK lock was already acquired by this thread
- * @retval -EBUSY lock was busy
- */
- wsrep_status_t (*lock) (wsrep_t* wsrep,
- const char* name, wsrep_bool_t shared,
- uint64_t owner, int64_t tout);
-
- /*!
- * @brief Release global named lock
- *
- * @param wsrep wsrep provider handle
- * @param name lock name
- * @param owner 64-bit owner ID
- * @return wsrep status or negative error code
- * @retval -EPERM lock does not belong to this owner
- */
- wsrep_status_t (*unlock) (wsrep_t* wsrep, const char* name, uint64_t owner);
-
- /*!
- * @brief Check if global named lock is locked
- *
- * @param wsrep wsrep provider handle
- * @param name lock name
- * @param owner if not NULL will contain 64-bit owner ID
- * @param node if not NULL will contain owner's node UUID
- * @return true if lock is locked
- */
- wsrep_bool_t (*is_locked) (wsrep_t* wsrep, const char* name, uint64_t* conn,
- wsrep_uuid_t* node);
-
- /*!
- * wsrep provider name
- */
- const char* provider_name;
-
- /*!
- * wsrep provider version
- */
- const char* provider_version;
-
- /*!
- * wsrep provider vendor name
- */
- const char* provider_vendor;
-
- /*!
- * @brief Frees allocated resources before unloading the library.
- * @param wsrep provider handle
- */
- void (*free)(wsrep_t* wsrep);
-
- void *dlh; //!< reserved for future use
- void *ctx; //!< reserved for implemetation private context
-};
-
-
-/*!
- *
- * @brief Loads wsrep library
- *
- * @param spec path to wsrep library. If NULL or WSREP_NONE initialises dummy
- * pass-through implementation.
- * @param hptr wsrep handle
- * @param log_cb callback to handle loader messages. Otherwise writes to stderr.
- *
- * @return zero on success, errno on failure
- */
-int wsrep_load(const char* spec, wsrep_t** hptr, wsrep_log_cb_t log_cb);
-
-/*!
- * @brief Unloads wsrep library and frees associated resources
- *
- * @param hptr wsrep handler pointer
- */
-void wsrep_unload(wsrep_t* hptr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* WSREP_H */
diff --git a/wsrep/wsrep_dummy.c b/wsrep/wsrep_dummy.c
deleted file mode 100644
index e48dcff39a1..00000000000
--- a/wsrep/wsrep_dummy.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/* Copyright (C) 2009-2010 Codership Oy <info@codersihp.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-/*! @file Dummy wsrep API implementation. */
-
-#include "wsrep_api.h"
-
-#include <errno.h>
-#include <string.h>
-
-/*! Dummy backend context. */
-typedef struct wsrep_dummy
-{
- wsrep_log_cb_t log_fn;
- char* options;
-} wsrep_dummy_t;
-
-/* Get pointer to wsrep_dummy context from wsrep_t pointer */
-#define WSREP_DUMMY(_p) ((wsrep_dummy_t *) (_p)->ctx)
-
-/* Trace function usage a-la DBUG */
-#define WSREP_DBUG_ENTER(_w) do { \
- if (WSREP_DUMMY(_w)) { \
- if (WSREP_DUMMY(_w)->log_fn) \
- WSREP_DUMMY(_w)->log_fn(WSREP_LOG_DEBUG, __FUNCTION__); \
- } \
- } while (0)
-
-
-static void dummy_free(wsrep_t *w)
-{
- WSREP_DBUG_ENTER(w);
- if (WSREP_DUMMY(w)->options) {
- free(WSREP_DUMMY(w)->options);
- WSREP_DUMMY(w)->options = NULL;
- }
- free(w->ctx);
- w->ctx = NULL;
-}
-
-static wsrep_status_t dummy_init (wsrep_t* w,
- const struct wsrep_init_args* args)
-{
- WSREP_DUMMY(w)->log_fn = args->logger_cb;
- WSREP_DBUG_ENTER(w);
- if (args->options) {
- WSREP_DUMMY(w)->options = strdup(args->options);
- }
- return WSREP_OK;
-}
-
-static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused)))
-{
- return 0;
-}
-
-static wsrep_status_t dummy_options_set(
- wsrep_t* w,
- const char* conf)
-{
- WSREP_DBUG_ENTER(w);
- if (WSREP_DUMMY(w)->options) {
- free(WSREP_DUMMY(w)->options);
- WSREP_DUMMY(w)->options = NULL;
- }
- if (conf) {
- WSREP_DUMMY(w)->options = strdup(conf);
- }
- return WSREP_OK;
-}
-
-static char* dummy_options_get (wsrep_t* w)
-{
- char *options;
-
- WSREP_DBUG_ENTER(w);
- options= WSREP_DUMMY(w)->options;
-
- if (options)
- options= strdup(WSREP_DUMMY(w)->options);
-
- return options;
-}
-
-static wsrep_status_t dummy_connect(
- wsrep_t* w,
- const char* name __attribute__((unused)),
- const char* url __attribute__((unused)),
- const char* donor __attribute__((unused)),
- wsrep_bool_t bootstrap __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_disconnect(wsrep_t* w)
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_recv(wsrep_t* w,
- void* recv_ctx __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_pre_commit(
- wsrep_t* w,
- const wsrep_conn_id_t conn_id __attribute__((unused)),
- wsrep_ws_handle_t* ws_handle __attribute__((unused)),
- uint32_t flags __attribute__((unused)),
- wsrep_trx_meta_t* meta __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_post_commit(
- wsrep_t* w,
- wsrep_ws_handle_t* ws_handle __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_post_rollback(
- wsrep_t* w,
- wsrep_ws_handle_t* ws_handle __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_replay_trx(
- wsrep_t* w,
- wsrep_ws_handle_t* ws_handle __attribute__((unused)),
- void* trx_ctx __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_abort_pre_commit(
- wsrep_t* w,
- const wsrep_seqno_t bf_seqno __attribute__((unused)),
- const wsrep_trx_id_t trx_id __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_append_key(
- wsrep_t* w,
- wsrep_ws_handle_t* ws_handle __attribute__((unused)),
- const wsrep_key_t* key __attribute__((unused)),
- const size_t key_num __attribute__((unused)),
- const wsrep_key_type_t key_type __attribute__((unused)),
- const wsrep_bool_t copy __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_append_data(
- wsrep_t* w,
- wsrep_ws_handle_t* ws_handle __attribute__((unused)),
- const struct wsrep_buf* data __attribute__((unused)),
- const size_t count __attribute__((unused)),
- const wsrep_data_type_t type __attribute__((unused)),
- const wsrep_bool_t copy __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_causal_read(
- wsrep_t* w,
- wsrep_gtid_t* gtid __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_free_connection(
- wsrep_t* w,
- const wsrep_conn_id_t conn_id __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_to_execute_start(
- wsrep_t* w,
- const wsrep_conn_id_t conn_id __attribute__((unused)),
- const wsrep_key_t* key __attribute__((unused)),
- const size_t key_num __attribute__((unused)),
- const struct wsrep_buf* data __attribute__((unused)),
- const size_t count __attribute__((unused)),
- wsrep_trx_meta_t* meta __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_to_execute_end(
- wsrep_t* w,
- const wsrep_conn_id_t conn_id __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_preordered_collect(
- wsrep_t* w,
- wsrep_po_handle_t* handle __attribute__((unused)),
- const struct wsrep_buf* data __attribute__((unused)),
- size_t count __attribute__((unused)),
- wsrep_bool_t copy __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_preordered_commit(
- wsrep_t* w,
- wsrep_po_handle_t* handle __attribute__((unused)),
- const wsrep_uuid_t* source_id __attribute__((unused)),
- uint32_t flags __attribute__((unused)),
- int pa_range __attribute__((unused)),
- wsrep_bool_t commit __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_sst_sent(
- wsrep_t* w,
- const wsrep_gtid_t* state_id __attribute__((unused)),
- const int rcode __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_sst_received(
- wsrep_t* w,
- const wsrep_gtid_t* state_id __attribute__((unused)),
- const void* state __attribute__((unused)),
- const size_t state_len __attribute__((unused)),
- const int rcode __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_snapshot(
- wsrep_t* w,
- const void* msg __attribute__((unused)),
- const size_t msg_len __attribute__((unused)),
- const char* donor_spec __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static struct wsrep_stats_var dummy_stats[] = {
- { NULL, WSREP_VAR_STRING, { 0 } }
-};
-
-static struct wsrep_stats_var* dummy_stats_get (wsrep_t* w)
-{
- WSREP_DBUG_ENTER(w);
- return dummy_stats;
-}
-
-static void dummy_stats_free (
- wsrep_t* w,
- struct wsrep_stats_var* stats __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
-}
-
-static void dummy_stats_reset (wsrep_t* w)
-{
- WSREP_DBUG_ENTER(w);
-}
-
-static wsrep_seqno_t dummy_pause (wsrep_t* w)
-{
- WSREP_DBUG_ENTER(w);
- return -ENOSYS;
-}
-
-static wsrep_status_t dummy_resume (wsrep_t* w)
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_desync (wsrep_t* w)
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_NOT_IMPLEMENTED;
-}
-
-static wsrep_status_t dummy_resync (wsrep_t* w)
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_status_t dummy_lock (wsrep_t* w,
- const char* s __attribute__((unused)),
- wsrep_bool_t r __attribute__((unused)),
- uint64_t o __attribute__((unused)),
- int64_t t __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_NOT_IMPLEMENTED;
-}
-
-static wsrep_status_t dummy_unlock (wsrep_t* w,
- const char* s __attribute__((unused)),
- uint64_t o __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return WSREP_OK;
-}
-
-static wsrep_bool_t dummy_is_locked (wsrep_t* w,
- const char* s __attribute__((unused)),
- uint64_t* o __attribute__((unused)),
- wsrep_uuid_t* t __attribute__((unused)))
-{
- WSREP_DBUG_ENTER(w);
- return 0;
-}
-
-static wsrep_t dummy_iface = {
- WSREP_INTERFACE_VERSION,
- &dummy_init,
- &dummy_capabilities,
- &dummy_options_set,
- &dummy_options_get,
- &dummy_connect,
- &dummy_disconnect,
- &dummy_recv,
- &dummy_pre_commit,
- &dummy_post_commit,
- &dummy_post_rollback,
- &dummy_replay_trx,
- &dummy_abort_pre_commit,
- &dummy_append_key,
- &dummy_append_data,
- &dummy_causal_read,
- &dummy_free_connection,
- &dummy_to_execute_start,
- &dummy_to_execute_end,
- &dummy_preordered_collect,
- &dummy_preordered_commit,
- &dummy_sst_sent,
- &dummy_sst_received,
- &dummy_snapshot,
- &dummy_stats_get,
- &dummy_stats_free,
- &dummy_stats_reset,
- &dummy_pause,
- &dummy_resume,
- &dummy_desync,
- &dummy_resync,
- &dummy_lock,
- &dummy_unlock,
- &dummy_is_locked,
- WSREP_NONE,
- WSREP_INTERFACE_VERSION,
- "Codership Oy <info@codership.com>",
- &dummy_free,
- NULL,
- NULL
-};
-
-int wsrep_dummy_loader(wsrep_t* w)
-{
- if (!w)
- return EINVAL;
-
- *w = dummy_iface;
-
- // allocate private context
- if (!(w->ctx = malloc(sizeof(wsrep_dummy_t))))
- return ENOMEM;
-
- // initialize private context
- WSREP_DUMMY(w)->log_fn = NULL;
- WSREP_DUMMY(w)->options = NULL;
-
- return 0;
-}
diff --git a/wsrep/wsrep_gtid.c b/wsrep/wsrep_gtid.c
deleted file mode 100644
index 45148785c25..00000000000
--- a/wsrep/wsrep_gtid.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2013 Codership Oy <info@codersihp.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-/*! @file Helper functions to deal with GTID string representations */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "wsrep_api.h"
-
-/*!
- * Read GTID from string
- * @return length of GTID string representation or -EINVAL in case of error
- */
-int
-wsrep_gtid_scan(const char* str, size_t str_len, wsrep_gtid_t* gtid)
-{
- unsigned int offset;
- char* endptr;
-
- if ((offset = wsrep_uuid_scan(str, str_len, &gtid->uuid)) > 0 &&
- offset < str_len && str[offset] == ':') {
- ++offset;
- if (offset < str_len)
- {
- errno = 0;
- gtid->seqno = strtoll(str + offset, &endptr, 0);
-
- if (errno == 0) {
- offset = endptr - str;
- return offset;
- }
- }
- }
- *gtid = WSREP_GTID_UNDEFINED;
- return -EINVAL;
-}
-
-/*!
- * Write GTID to string
- * @return length of GTID stirng representation of -EMSGSIZE if string is too
- * short
- */
-int
-wsrep_gtid_print(const wsrep_gtid_t* gtid, char* str, size_t str_len)
-{
- unsigned int offset, ret;
- if ((offset = wsrep_uuid_print(&gtid->uuid, str, str_len)) > 0)
- {
- ret = snprintf(str + offset, str_len - offset,
- ":%" PRId64, gtid->seqno);
- if (ret <= str_len - offset) {
- return (offset + ret);
- }
-
- }
-
- return -EMSGSIZE;
-}
diff --git a/wsrep/wsrep_loader.c b/wsrep/wsrep_loader.c
deleted file mode 100644
index 1321538742f..00000000000
--- a/wsrep/wsrep_loader.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/* Copyright (C) 2009-2011 Codership Oy <info@codersihp.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-/*! @file wsrep implementation loader */
-
-#include <dlfcn.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "wsrep_api.h"
-
-// Logging stuff for the loader
-static const char* log_levels[] = {"FATAL", "ERROR", "WARN", "INFO", "DEBUG"};
-
-static void default_logger (wsrep_log_level_t lvl, const char* msg)
-{
- fprintf (stderr, "wsrep loader: [%s] %s\n", log_levels[lvl], msg);
-}
-
-static wsrep_log_cb_t logger = default_logger;
-
-/**************************************************************************
- * Library loader
- **************************************************************************/
-
-static int wsrep_check_iface_version(const char* found, const char* iface_ver)
-{
- const size_t msg_len = 128;
- char msg[128];
-
- if (strcmp(found, iface_ver)) {
- snprintf (msg, msg_len,
- "provider interface version mismatch: need '%s', found '%s'",
- iface_ver, found);
- logger (WSREP_LOG_ERROR, msg);
- return EINVAL;
- }
-
- return 0;
-}
-
-static int verify(const wsrep_t *wh, const char *iface_ver)
-{
- char msg[128];
-
-#define VERIFY(_p) if (!(_p)) { \
- snprintf(msg, sizeof(msg), "wsrep_load(): verify(): %s\n", # _p); \
- logger (WSREP_LOG_ERROR, msg); \
- return EINVAL; \
- }
-
- VERIFY(wh);
- VERIFY(wh->version);
-
- if (wsrep_check_iface_version(wh->version, iface_ver))
- return EINVAL;
-
- VERIFY(wh->init);
- VERIFY(wh->options_set);
- VERIFY(wh->options_get);
- VERIFY(wh->connect);
- VERIFY(wh->disconnect);
- VERIFY(wh->recv);
- VERIFY(wh->pre_commit);
- VERIFY(wh->post_commit);
- VERIFY(wh->post_rollback);
- VERIFY(wh->replay_trx);
- VERIFY(wh->abort_pre_commit);
- VERIFY(wh->append_key);
- VERIFY(wh->append_data);
- VERIFY(wh->free_connection);
- VERIFY(wh->to_execute_start);
- VERIFY(wh->to_execute_end);
- VERIFY(wh->preordered_collect);
- VERIFY(wh->preordered_commit);
- VERIFY(wh->sst_sent);
- VERIFY(wh->sst_received);
- VERIFY(wh->stats_get);
- VERIFY(wh->stats_free);
- VERIFY(wh->stats_reset);
- VERIFY(wh->pause);
- VERIFY(wh->resume);
- VERIFY(wh->desync);
- VERIFY(wh->resync);
- VERIFY(wh->lock);
- VERIFY(wh->unlock);
- VERIFY(wh->is_locked);
- VERIFY(wh->provider_name);
- VERIFY(wh->provider_version);
- VERIFY(wh->provider_vendor);
- VERIFY(wh->free);
- return 0;
-}
-
-typedef int (*wsrep_loader_fun)(wsrep_t*);
-
-static wsrep_loader_fun wsrep_dlf(void *dlh, const char *sym)
-{
- union {
- wsrep_loader_fun dlfun;
- void *obj;
- } alias;
- alias.obj = dlsym(dlh, sym);
- return alias.dlfun;
-}
-
-static int wsrep_check_version_symbol(void *dlh)
-{
- char** dlversion = NULL;
- dlversion = (char**) dlsym(dlh, "wsrep_interface_version");
- if (dlversion == NULL)
- return 0;
- return wsrep_check_iface_version(*dlversion, WSREP_INTERFACE_VERSION);
-}
-
-extern int wsrep_dummy_loader(wsrep_t *w);
-
-int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
-{
- int ret = 0;
- void *dlh = NULL;
- wsrep_loader_fun dlfun;
- char msg[1025];
- msg[sizeof(msg)-1] = 0;
-
- if (NULL != log_cb)
- logger = log_cb;
-
- if (!(spec && hptr))
- return EINVAL;
-
- snprintf (msg, sizeof(msg)-1,
- "wsrep_load(): loading provider library '%s'", spec);
- logger (WSREP_LOG_INFO, msg);
-
- if (!(*hptr = malloc(sizeof(wsrep_t)))) {
- logger (WSREP_LOG_FATAL, "wsrep_load(): out of memory");
- return ENOMEM;
- }
-
- if (!spec || strcmp(spec, WSREP_NONE) == 0) {
- if ((ret = wsrep_dummy_loader(*hptr)) != 0) {
- free (*hptr);
- *hptr = NULL;
- }
- return ret;
- }
-
- if (!(dlh = dlopen(spec, RTLD_NOW | RTLD_LOCAL))) {
- snprintf(msg, sizeof(msg)-1, "wsrep_load(): dlopen(): %s", dlerror());
- logger (WSREP_LOG_ERROR, msg);
- ret = EINVAL;
- goto out;
- }
-
- if (!(dlfun = wsrep_dlf(dlh, "wsrep_loader"))) {
- ret = EINVAL;
- goto out;
- }
-
- if (wsrep_check_version_symbol(dlh) != 0) {
- ret = EINVAL;
- goto out;
- }
-
- if ((ret = (*dlfun)(*hptr)) != 0) {
- snprintf(msg, sizeof(msg)-1, "wsrep_load(): loader failed: %s",
- strerror(ret));
- logger (WSREP_LOG_ERROR, msg);
- goto out;
- }
-
- if ((ret = verify(*hptr, WSREP_INTERFACE_VERSION)) != 0) {
- snprintf (msg, sizeof(msg)-1,
- "wsrep_load(): interface version mismatch: my version %s, "
- "provider version %s", WSREP_INTERFACE_VERSION,
- (*hptr)->version);
- logger (WSREP_LOG_ERROR, msg);
- goto out;
- }
-
- (*hptr)->dlh = dlh;
-
-out:
- if (ret != 0) {
- if (dlh) dlclose(dlh);
- free(*hptr);
- *hptr = NULL;
- } else {
- snprintf (msg, sizeof(msg)-1,
- "wsrep_load(): %s %s by %s loaded successfully.",
- (*hptr)->provider_name, (*hptr)->provider_version,
- (*hptr)->provider_vendor);
- logger (WSREP_LOG_INFO, msg);
- }
-
- return ret;
-}
-
-void wsrep_unload(wsrep_t *hptr)
-{
- if (!hptr) {
- logger (WSREP_LOG_WARN, "wsrep_unload(): null pointer.");
- } else {
- if (hptr->free)
- hptr->free(hptr);
- if (hptr->dlh)
- dlclose(hptr->dlh);
- free(hptr);
- }
-}
-
diff --git a/wsrep/wsrep_uuid.c b/wsrep/wsrep_uuid.c
deleted file mode 100644
index 54ae4ab5ed5..00000000000
--- a/wsrep/wsrep_uuid.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (C) 2009 Codership Oy <info@codersihp.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-/*! @file Helper functions to deal with history UUID string representations */
-
-#include <errno.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#include "wsrep_api.h"
-
-/*!
- * Read UUID from string
- * @return length of UUID string representation or -EINVAL in case of error
- */
-int
-wsrep_uuid_scan (const char* str, size_t str_len, wsrep_uuid_t* uuid)
-{
- unsigned int uuid_len = 0;
- unsigned int uuid_offt = 0;
-
- while (uuid_len + 1 < str_len) {
- /* We are skipping potential '-' after uuid_offt == 4, 6, 8, 10
- * which means
- * (uuid_offt >> 1) == 2, 3, 4, 5,
- * which in turn means
- * (uuid_offt >> 1) - 2 <= 3
- * since it is always >= 0, because uuid_offt is unsigned */
- if (((uuid_offt >> 1) - 2) <= 3 && str[uuid_len] == '-') {
- // skip dashes after 4th, 6th, 8th and 10th positions
- uuid_len += 1;
- continue;
- }
-
- if (isxdigit(str[uuid_len]) && isxdigit(str[uuid_len + 1])) {
- // got hex digit, scan another byte to uuid, increment uuid_offt
- sscanf (str + uuid_len, "%2hhx", uuid->data + uuid_offt);
- uuid_len += 2;
- uuid_offt += 1;
- if (sizeof (uuid->data) == uuid_offt)
- return uuid_len;
- }
- else {
- break;
- }
- }
-
- *uuid = WSREP_UUID_UNDEFINED;
- return -EINVAL;
-}
-
-/*!
- * Write UUID to string
- * @return length of UUID string representation or -EMSGSIZE if string is too
- * short
- */
-int
-wsrep_uuid_print (const wsrep_uuid_t* uuid, char* str, size_t str_len)
-{
- if (str_len > 36) {
- const unsigned char* u = uuid->data;
- return snprintf(str, str_len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
- "%02x%02x-%02x%02x%02x%02x%02x%02x",
- u[ 0], u[ 1], u[ 2], u[ 3], u[ 4], u[ 5], u[ 6], u[ 7],
- u[ 8], u[ 9], u[10], u[11], u[12], u[13], u[14], u[15]);
- }
- else {
- return -EMSGSIZE;
- }
-}